Unreviewed, rolling out r241486.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-14  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r241486.
4         https://bugs.webkit.org/show_bug.cgi?id=194655
5
6         causing API failures in builds (Requested by ShawnRoberts on
7         #webkit).
8
9         Reverted changeset:
10
11         "[Cocoa] Media elements will restart network buffering just
12         before suspending"
13         https://bugs.webkit.org/show_bug.cgi?id=193691
14         https://trac.webkit.org/changeset/241486
15
16 2019-02-13  Brian Burg  <bburg@apple.com>
17
18         Web Inspector: don't include accessibility role in DOM.Node object payloads
19         https://bugs.webkit.org/show_bug.cgi?id=194623
20         <rdar://problem/36384037>
21
22         Reviewed by Devin Rousso.
23
24         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
25         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
26         first place due to a DOM node tree update (i.e., NodeInserted).
27
28         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
29         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
30         necessary to collect this information in a problematic way when initially pushing the node, as
31         it will be updated anyway.
32
33         No new tests, no change in behavior.
34
35         * inspector/agents/InspectorDOMAgent.cpp:
36         (WebCore::InspectorDOMAgent::buildObjectForNode):
37
38 2019-02-14  Zalan Bujtas  <zalan@apple.com>
39
40         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
41         https://bugs.webkit.org/show_bug.cgi?id=194622
42
43         Reviewed by Antti Koivisto.
44
45         Ensure that block replaced boxes don't collapse through their vertical margins. 
46
47         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
48
49         * layout/blockformatting/BlockMarginCollapse.cpp:
50         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
51         * page/FrameViewLayoutContext.cpp:
52         (WebCore::layoutUsingFormattingContext):
53
54 2019-02-14  Zalan Bujtas  <zalan@apple.com>
55
56         [LFC] Shrink-to-fit-width should be constrained by min/max width
57         https://bugs.webkit.org/show_bug.cgi?id=194653
58
59         Reviewed by Antti Koivisto.
60
61         Use the fixed value of min-width/max-width to constrain the computed preferred width.
62
63         * layout/FormattingContext.h:
64         * layout/FormattingContextGeometry.cpp:
65         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
66         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
67         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
68         * layout/inlineformatting/InlineFormattingContext.cpp:
69         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
70
71 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
72
73         Crash in DOMTimer::fired
74         https://bugs.webkit.org/show_bug.cgi?id=194638
75
76         Reviewed by Brent Fulgham.
77
78         This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.
79
80         The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
81         is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).
82
83         Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
84         from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
85         we would not leak these DOM timers.
86
87         We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
88         size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
89         Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
90         and is no longer the preferred approach when dealing with these classes of bugs in WebKit.
91
92         Test: fast/dom/timer-destruction-during-firing.html
93
94         * page/DOMTimer.cpp:
95         (WebCore::NestedTimersMap::add):
96         (WebCore::DOMTimer::install):
97         (WebCore::DOMTimer::fired):
98
99 2019-02-13  Joseph Pecoraro  <pecoraro@apple.com>
100
101         Web Inspector: Crash when inspecting an element that constantly changes visibility
102         https://bugs.webkit.org/show_bug.cgi?id=194632
103         <rdar://problem/48060258>
104
105         Reviewed by Matt Baker and Devin Rousso.
106
107         * inspector/agents/InspectorDOMAgent.h:
108         * inspector/agents/InspectorDOMAgent.cpp:
109         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
110         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
111         Don't use rvalue-references as that was taking ownership and deleting
112         the object we want to keep around. Instead simplify this to just use
113         references so no ref counting changes happen.
114
115 2019-02-13  Chris Fleizach  <cfleizach@apple.com>
116
117         AX: Crash in handleMenuOpen
118         https://bugs.webkit.org/show_bug.cgi?id=194627
119
120         Reviewed by Zalan Bujtas.
121
122         Tests run under libGuardMalloc will cause crashes.
123
124         This list of objects is a Node list, not an Element list, so we were
125         not removing some nodes when they were being deallocated.
126
127         * accessibility/AXObjectCache.cpp:
128         (WebCore::AXObjectCache::remove):
129
130 2019-02-13  Jer Noble  <jer.noble@apple.com>
131
132         [Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
133         https://bugs.webkit.org/show_bug.cgi?id=194621
134         <rdar://problem/48002560>
135
136         Reviewed by Eric Carlson.
137
138         When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
139         change events in the media-controller.js on rAF().
140
141         * Modules/modern-media-controls/media/media-controller.js:
142         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
143
144 2019-02-13  John Wilander  <wilander@apple.com>
145
146         Ignore Ad Click Attribution where source and destination are same-site
147         https://bugs.webkit.org/show_bug.cgi?id=194620
148         <rdar://problem/47890018>
149
150         Reviewed by Jiewen Tan.
151
152         Updated the existing test.
153
154         We should not accept Ad Click Attribution requests where the site of the
155         anchor tag and its addestination attribute are same-site. Such attributions
156         don’t make sense (the site can track intra-site clicks through better means)
157         and would just lead to increased memory use where are the pending
158         attributions are stored.
159
160         For ports that don't have access to the Public Suffix List, this patch
161         only checks that the hosts don't match, i.e. not just eTLD+1.
162
163         * html/HTMLAnchorElement.cpp:
164         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
165             Now returns WTF::nullopt if the current document and the
166             addestination are same site. Also fixed a console message
167             typo.
168
169 2019-02-13  Eric Carlson  <eric.carlson@apple.com> and Youenn Fablet  <youenn@apple.com>
170
171         getUserMedia with an ideal deviceId constraint doesn't always select the correct device
172         https://bugs.webkit.org/show_bug.cgi?id=193614
173
174         Reviewed by Eric Carlson.
175
176         Compute a fitness score based on constraints.
177         For each constraint, a fitness score is computed from the distance.
178         The smaller the distance, the higher the score.
179         Fitness scores are then summed to give a device fitness score.
180         Matching devices are then sorted according the fitness score.
181
182         For important constraints, deviceId and facingMode, add a more important weight.
183         This ensures that should any of these ideal constraints are set, they will be respected.
184
185         Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
186         Do not set a default ideal frameRate if width and height are already set.
187
188         Covered by updated test.
189
190         * platform/mediastream/MediaConstraints.cpp:
191         (WebCore::FlattenedConstraint::set):
192         (WebCore::MediaConstraints::setDefaultVideoConstraints):
193         * platform/mediastream/RealtimeMediaSource.cpp:
194         (WebCore::RealtimeMediaSource::fitnessDistance):
195         (WebCore::RealtimeMediaSource::selectSettings):
196         (WebCore::RealtimeMediaSource::supportsConstraints):
197         (WebCore::RealtimeMediaSource::applyConstraints):
198         * platform/mediastream/RealtimeMediaSource.h:
199         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
200         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
201
202 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
203
204         [iOS] Add a hack to work around buggy video control library
205         https://bugs.webkit.org/show_bug.cgi?id=194615
206         <rdar://problem/46146946>
207
208         Reviewed by Jer Noble.
209
210         Test: media/ios/video-volume-ios-quirk.html
211
212         * html/HTMLMediaElement.cpp:
213         (WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
214         (WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
215         (WebCore::HTMLMediaElement::closeTaskQueues): Close it.
216         * html/HTMLMediaElement.h:
217
218 2019-02-13  Jer Noble  <jer.noble@apple.com>
219
220         [Cocoa] Media elements will restart network buffering just before suspending
221         https://bugs.webkit.org/show_bug.cgi?id=193691
222
223         Reviewed by Eric Carlson.
224
225         API Test: WebKit.ProcessSuspendMediaBuffering
226
227         Allow the Page to suspend all media buffering in its child Documents.
228
229         * dom/Document.cpp:
230         (WebCore::Document::suspendAllMediaBuffering):
231         (WebCore::Document::resumeAllMediaBuffering):
232         * dom/Document.h:
233         * html/MediaElementSession.cpp:
234         (WebCore::MediaElementSession::dataBufferingPermitted const):
235         (WebCore::MediaElementSession::suspendBuffering):
236         (WebCore::MediaElementSession::resumeBuffering):
237         (WebCore::MediaElementSession::bufferingSuspended const):
238         * html/MediaElementSession.h:
239         * page/Page.cpp:
240         (WebCore::Page::suspendAllMediaBuffering):
241         (WebCore::Page::resumeAllMediaBuffering):
242         * page/Page.h:
243         (WebCore::Page::mediaPlaybackIsSuspended const):
244         (WebCore::Page::mediaBufferingIsSuspended const):
245         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
246         * platform/audio/PlatformMediaSession.h:
247         (WebCore::PlatformMediaSession::suspendBuffering):
248         (WebCore::PlatformMediaSession::resumeBuffering):
249         * platform/audio/PlatformMediaSessionManager.cpp:
250         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
251         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
252         * platform/audio/PlatformMediaSessionManager.h:
253
254 2019-02-13  Jer Noble  <jer.noble@apple.com>
255
256         Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root
257         https://bugs.webkit.org/show_bug.cgi?id=194516
258         <rdar://problem/44678353>
259
260         Reviewed by Antoine Quint.
261
262         Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html
263
264         When walking up the element ancestor chain, use parentElementInComposedTree() to
265         walk past the shadow root boundary.
266
267         * dom/Element.cpp:
268         (WebCore::parentCrossingFrameBoundaries):
269
270 2019-02-13  Chris Dumez  <cdumez@apple.com>
271
272         Unreviewed, update localizable strings.
273
274         * en.lproj/Localizable.strings:
275
276 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
277
278         Further restricting webarchive loads
279         https://bugs.webkit.org/show_bug.cgi?id=194567
280         <rdar://problem/47610130>
281
282         Reviewed by Youenn Fablet.
283
284         This patch futher restricts main frame webarchive loads to the followings:
285         1) loaded by clients;
286         2) loaded by drag;
287         3) reloaded from any of the previous two.
288
289         It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
290         to FrameLoader such that the option is remembered during redirections.
291
292         Covered by API tests.
293
294         * dom/Document.h:
295         (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
296         (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
297         * loader/DocumentLoader.cpp:
298         (WebCore::DocumentLoader::disallowWebArchive const):
299         * loader/DocumentLoader.h:
300         (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
301         (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
302         * loader/FrameLoadRequest.h:
303         (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
304         (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
305         * loader/FrameLoader.cpp:
306         (WebCore::FrameLoader::load):
307         (WebCore::FrameLoader::reload):
308         * loader/FrameLoader.h:
309         (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
310         (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
311         * page/DragController.cpp:
312         (WebCore::DragController::performDragOperation):
313         * testing/Internals.cpp:
314         (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
315         * testing/Internals.h:
316         * testing/Internals.idl:
317
318 2019-02-13  Jer Noble  <jer.noble@apple.com>
319
320         Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()
321         https://bugs.webkit.org/show_bug.cgi?id=194613
322         <rdar://problem/48023912>
323
324         Reviewed by Eric Carlson.
325
326         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
327         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
328
329 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
330
331         Unreviewed, fix unused variable warnings after r241148/r241251
332         https://bugs.webkit.org/show_bug.cgi?id=194348
333         <rdar://problem/47566449>
334
335         * Modules/mediasource/SourceBuffer.cpp:
336         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
337         (WebCore::SourceBuffer::evictCodedFrames):
338         (WebCore::SourceBuffer::provideMediaData):
339
340 2019-02-13  Sihui Liu  <sihui_liu@apple.com>
341
342         REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash
343         https://bugs.webkit.org/show_bug.cgi?id=194413
344         <rdar://problem/47897254>
345
346         Reviewed by Brady Eidson.
347
348         IDB clients expected transaction operations to be executed in order, but in 
349         UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly.
350         This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order
351         as IDB Server receives the request.
352
353         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
354         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
355         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
356         (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
357         (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
358         (WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback):
359         (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
360         (WebCore::IDBServer::UniqueIDBDatabase::performCountCallback):
361         (WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback):
362         * Modules/indexeddb/server/UniqueIDBDatabase.h:
363
364 2019-02-13  John Wilander  <wilander@apple.com>
365
366         Store Ad Click Attribution requests in the network process
367         https://bugs.webkit.org/show_bug.cgi?id=194510
368         <rdar://problem/47650118>
369
370         Reviewed by Alex Christensen and Daniel Bates.
371
372         Test: http/tests/adClickAttribution/store-ad-click-attribution.html
373
374         This patch adds support functions for validation and storage of
375         WebCore::AdClickAttribution objects. It also adds WTF::HashTraits so that
376         WebCore::AdClickAttribution::Source and WebCore::AdClickAttribution::Destination
377         can be used in a HashMap.
378
379         * loader/AdClickAttribution.cpp:
380         (WebCore::AdClickAttribution::toString const):
381         * loader/AdClickAttribution.h:
382         (WebCore::AdClickAttribution::Source::operator== const):
383         (WebCore::AdClickAttribution::Source::deletedValue):
384         (WebCore::AdClickAttribution::Source::constructDeletedValue):
385         (WebCore::AdClickAttribution::Source::deleteValue):
386         (WebCore::AdClickAttribution::Source::isDeletedValue const):
387         (WebCore::AdClickAttribution::SourceHash::hash):
388         (WebCore::AdClickAttribution::SourceHash::equal):
389         (WebCore::AdClickAttribution::Destination::operator== const):
390         (WebCore::AdClickAttribution::Destination::matches const):
391             This convenience function allows matching of a WTF::URL object.
392         (WebCore::AdClickAttribution::Destination::deletedValue):
393         (WebCore::AdClickAttribution::Destination::constructDeletedValue):
394         (WebCore::AdClickAttribution::Destination::deleteValue):
395         (WebCore::AdClickAttribution::Destination::isDeletedValue const):
396         (WebCore::AdClickAttribution::DestinationHash::hash):
397         (WebCore::AdClickAttribution::DestinationHash::equal):
398         (WebCore::AdClickAttribution::source const):
399         (WebCore::AdClickAttribution::destination const):
400             Getters added to support mapped storage based on source and destination.
401         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::emptyValue):
402         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::constructDeletedValue):
403         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::isDeletedValue):
404         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::emptyValue):
405         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::constructDeletedValue):
406         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::isDeletedValue):
407         * loader/NavigationAction.h:
408         (WebCore::NavigationAction::adClickAttribution const):
409         (WebCore::NavigationAction::adClickAttribution): Deleted.
410             Corrected the constness of this function.
411
412 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
413
414         Revert r240434
415         https://bugs.webkit.org/show_bug.cgi?id=194600
416         <rdar://problem/48044566>
417
418         Reviewed by Brent Fulgham.
419
420         * html/HTMLMediaElement.cpp:
421         (WebCore::HTMLMediaElement::setVolume):
422         (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
423         (WebCore::HTMLMediaElement::updateVolume):
424         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
425         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):
426
427 2019-02-13  Alex Christensen  <achristensen@webkit.org>
428
429         Stop using setDefersLoading from WebCore
430         https://bugs.webkit.org/show_bug.cgi?id=194315
431
432         Reviewed by Jer Noble.
433
434         That is what CompletionHandlers are for.
435
436         * loader/MediaResourceLoader.cpp:
437         (WebCore::MediaResource::responseReceived):
438         (WebCore::MediaResource::setDefersLoading): Deleted.
439         * loader/MediaResourceLoader.h:
440         * platform/graphics/PlatformMediaResourceLoader.h:
441         (WebCore::PlatformMediaResourceClient::responseReceived):
442         (WebCore::PlatformMediaResource::stop):
443         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
444         * platform/network/cocoa/WebCoreNSURLSession.mm:
445         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
446         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
447         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
448         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
449
450 2019-02-13  Jer Noble  <jer.noble@apple.com>
451
452         [Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
453         https://bugs.webkit.org/show_bug.cgi?id=194580
454         <rdar://problem/42727739>
455
456         Reviewed by Eric Carlson.
457
458         * platform/cocoa/CoreVideoSoftLink.cpp:
459         * platform/cocoa/CoreVideoSoftLink.h:
460         * platform/graphics/cv/PixelBufferConformerCV.cpp:
461         (WebCore::CVPixelBufferGetBytePointerCallback):
462         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
463
464 2019-02-13  Antoine Quint  <graouts@apple.com>
465
466         Support simulated mouse events on iOS based on a PlatformTouchEvent
467         https://bugs.webkit.org/show_bug.cgi?id=194501
468         <rdar://problem/46910790>
469
470         Reviewed by Dean Jackson.
471
472         Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and
473         whether simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate
474         that, we allow for a MouseEvent to be created, much like a PointerEvent, based on a PlatformTouchEvent. Then, we set a flag on Event within
475         EventTarget::innerInvokeEventListeners() to see whether any page code has been evaluated as a result of a mousemove event being dispatched.
476         Finally, we also track mouse events when invalidating touch regions provided the required internal runtime flag is on.
477
478         Test: fast/events/touch/ios/mouse-events-dispatch-with-touch.html
479
480         * SourcesCocoa.txt:
481         * WebCore.xcodeproj/project.pbxproj:
482         * dom/Event.cpp:
483         * dom/Event.h:
484         (WebCore::Event::hasEncounteredListener const):
485         (WebCore::Event::setHasEncounteredListener):
486         * dom/EventNames.h:
487         (WebCore::EventNames::isTouchRelatedEventType const):
488         (WebCore::EventNames::touchRelatedEventNames const):
489         (WebCore::EventNames::extendedTouchRelatedEventNames const):
490         (WebCore::EventNames::isTouchEventType const): Deleted.
491         (WebCore::EventNames::touchAndPointerEventNames const): Deleted.
492         * dom/EventTarget.cpp:
493         (WebCore::EventTarget::innerInvokeEventListeners):
494         * dom/MouseEvent.h:
495         * dom/Node.cpp:
496         (WebCore::Node::moveNodeToNewDocument):
497         (WebCore::tryAddEventListener):
498         (WebCore::tryRemoveEventListener):
499         (WebCore::Node::defaultEventHandler):
500         * dom/ios/MouseEventIOS.cpp: Added.
501         (WebCore::mouseEventType):
502         (WebCore::MouseEvent::create):
503         * dom/ios/PointerEventIOS.cpp:
504         (WebCore::pointerEventType):
505         (WebCore::PointerEvent::create):
506         (WebCore::eventType): Deleted.
507         * page/DOMWindow.cpp:
508         (WebCore::DOMWindow::addEventListener):
509         (WebCore::DOMWindow::removeEventListener):
510         * page/EventHandler.h:
511         * page/RuntimeEnabledFeatures.h:
512         (WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const):
513         (WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled):
514         (WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const):
515         (WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled):
516
517 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
518
519         [FreeType] Unable to render some Hebrew characters
520         https://bugs.webkit.org/show_bug.cgi?id=194498
521
522         Reviewed by Michael Catanzaro.
523
524         We are failing to find a font for some of the combining character sequences because normalization is failing due
525         to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
526         we should handle that case to resize the output buffer and try again.
527
528         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
529         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
530
531 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
532
533         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
534         https://bugs.webkit.org/show_bug.cgi?id=194582
535
536         Reviewed by Antti Koivisto.
537
538         Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong
539         from the non-generated identifier being sent to us as it was the case in this failure.
540
541         * loader/PolicyChecker.cpp:
542         (WebCore::PolicyCheckIdentifier::isValidFor):
543
544 2019-02-13  Commit Queue  <commit-queue@webkit.org>
545
546         Unreviewed, rolling out r241273.
547         https://bugs.webkit.org/show_bug.cgi?id=194579
548
549         This change is causing a flaky assertion failure crash in High
550         Sierra Debug (Requested by ShawnRoberts on #webkit).
551
552         Reverted changeset:
553
554         "Stop using setDefersLoading from WebCore"
555         https://bugs.webkit.org/show_bug.cgi?id=194315
556         https://trac.webkit.org/changeset/241273
557
558 2019-02-12  Mark Lam  <mark.lam@apple.com>
559
560         Remove unnecessary null check in bindings.
561         https://bugs.webkit.org/show_bug.cgi?id=194581
562
563         Reviewed by Yusuke Suzuki.
564
565         It is always safe to call visitor.containsOpaqueRoot(root) with a null root pointer.
566         It will just return false.  Since we don't expect the root pointer to be null in
567         the common case, having a null check here is also not optimal.  We'll remove this
568         unneeded null check.
569
570         * bindings/scripts/CodeGeneratorJS.pm:
571         (GenerateImplementation):
572         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
573         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
574
575 2019-02-12  Rob Buis  <rbuis@igalia.com>
576
577         Align with Fetch on data: URLs
578         https://bugs.webkit.org/show_bug.cgi?id=182325
579
580         Reviewed by Alex Christensen.
581
582         The MIME type part of the data url should be serialized as
583         specified in step 3 under "data" [1].
584
585         Test: web-platform-tests/fetch/data-urls/processing.any.js
586
587         [1] https://fetch.spec.whatwg.org/#concept-scheme-fetch 
588
589         * platform/network/DataURLDecoder.cpp:
590         (WebCore::DataURLDecoder::parseMediaType):
591
592 2019-02-12  Alex Christensen  <achristensen@webkit.org>
593
594         Build fix after r241320
595         https://bugs.webkit.org/show_bug.cgi?id=194271
596
597         * page/Frame.cpp:
598         (WebCore::Frame::requestDOMPasteAccess):
599
600 2019-02-12  Justin Fan  <justin_fan@apple.com>
601
602         [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
603         https://bugs.webkit.org/show_bug.cgi?id=194552
604
605         Reviewed by Dean Jackson.
606
607         WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
608         Consolidate the two versions of these classes in our implementation.
609
610         Affected layout tests updated with new names. No change in behavior.
611
612         * CMakeLists.txt:
613         * DerivedSources-input.xcfilelist:
614         * DerivedSources-output.xcfilelist:
615         * DerivedSources.make:
616         * Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
617         * Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
618         * Modules/webgpu/WebGPUBufferUsage.h: Removed.
619         * Modules/webgpu/WebGPUDevice.cpp:
620         (WebCore::WebGPUDevice::createBuffer const):
621         * Modules/webgpu/WebGPUDevice.h:
622         * Modules/webgpu/WebGPUDevice.idl:
623         * Sources.txt:
624         * WebCore.xcodeproj/project.pbxproj:
625         * bindings/js/WebCoreBuiltinNames.h:
626         * platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
627         * platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.
628
629 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
630
631         Unreviewed, try to fix the internal iOS build after r241321
632
633         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
634
635 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
636
637         Allow pages to trigger programmatic paste from script on iOS
638         https://bugs.webkit.org/show_bug.cgi?id=194271
639         <rdar://problem/47808810>
640
641         Reviewed by Tim Horton.
642
643         Tests: editing/pasteboard/ios/dom-paste-confirmation.html
644                editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
645                editing/pasteboard/ios/dom-paste-rejection.html
646                editing/pasteboard/ios/dom-paste-requires-user-gesture.html
647
648         * dom/UserGestureIndicator.cpp:
649         (WebCore::UserGestureIndicator::~UserGestureIndicator):
650
651         Reset a gesture token's DOM paste access when exiting the scope of a user gesture. This prevents DOM paste
652         access permissions from leaking into `setTimeout()` callbacks when we forward user gesture tokens.
653
654         * dom/UserGestureIndicator.h:
655         (WebCore::UserGestureToken::resetDOMPasteAccess):
656
657 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
658
659         AX: IsolatedTree: Implement more attributes
660         https://bugs.webkit.org/show_bug.cgi?id=193911
661         <rdar://problem/47599217>
662
663         Reviewed by Daniel Bates.
664
665         Make use of new HIServices SPI to use a secondary AX thread.
666         Store root node/focused node status in IsolatedTree rather than on the element.
667         Implement the following attributes: children, parent, isIgnored, isTree, isTreeItem, relativeFrame, speechHint, title, description.
668         Implement hit-testing using relative-frames.
669         Ensure that WKAccessibilityWebPageObject queries happen on main thread when they need to.
670
671         * SourcesCocoa.txt:
672         * WebCore.xcodeproj/project.pbxproj:
673         * accessibility/AXObjectCache.cpp:
674         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
675         * accessibility/AXObjectCache.h:
676         (WebCore::AXObjectCache::focusedUIElementForPage):
677         * accessibility/AccessibilityAttachment.cpp:
678         (WebCore::AccessibilityAttachment::accessibilityText const):
679         (WebCore::AccessibilityAttachment::accessibilityText): Deleted.
680         * accessibility/AccessibilityAttachment.h:
681         * accessibility/AccessibilityImageMapLink.cpp:
682         (WebCore::AccessibilityImageMapLink::accessibilityText const):
683         (WebCore::AccessibilityImageMapLink::accessibilityText): Deleted.
684         * accessibility/AccessibilityImageMapLink.h:
685         * accessibility/AccessibilityMediaControls.cpp:
686         (WebCore::AccessibilityMediaControl::accessibilityText const):
687         (WebCore::AccessibilityMediaControl::accessibilityText): Deleted.
688         * accessibility/AccessibilityMediaControls.h:
689         * accessibility/AccessibilityNodeObject.cpp:
690         (WebCore::AccessibilityNodeObject::accessibilityText const):
691         (WebCore::AccessibilityNodeObject::accessibilityText): Deleted.
692         * accessibility/AccessibilityNodeObject.h:
693         * accessibility/AccessibilityObject.cpp:
694         (WebCore::AccessibilityObject::convertFrameToSpace const):
695         (WebCore::AccessibilityObject::relativeFrame const):
696         (WebCore::AccessibilityObject::elementAccessibilityHitTest const):
697         (WebCore::AccessibilityObject::focusedUIElement const):
698         * accessibility/AccessibilityObject.h:
699         (WebCore::AccessibilityObject::accessibilityText const):
700         (WebCore::AccessibilityObject::isLink const): Deleted.
701         (WebCore::AccessibilityObject::isImage const): Deleted.
702         (WebCore::AccessibilityObject::isAttachment const): Deleted.
703         (WebCore::AccessibilityObject::isFileUploadButton const): Deleted.
704         (WebCore::AccessibilityObject::isImageMapLink const): Deleted.
705         (WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
706         (WebCore::AccessibilityObject::isTree const): Deleted.
707         (WebCore::AccessibilityObject::isTreeItem const): Deleted.
708         (WebCore::AccessibilityObject::isScrollbar const): Deleted.
709         (WebCore::AccessibilityObject::accessibilityHitTest const): Deleted.
710         (WebCore::AccessibilityObject::accessibilityText): Deleted.
711         (WebCore::AccessibilityObject::roleValue const): Deleted.
712         (WebCore::AccessibilityObject::wrapper const): Deleted.
713         * accessibility/AccessibilityObjectInterface.h: Replaced.
714         * accessibility/AccessibilityRenderObject.cpp:
715         (WebCore::AccessibilityRenderObject::isTabItemSelected const):
716         (WebCore::AccessibilityRenderObject::remoteSVGElementHitTest const):
717         (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest const):
718         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
719         (WebCore::AccessibilityRenderObject::selectedChildren):
720         * accessibility/AccessibilityRenderObject.h:
721         * accessibility/AccessibilitySVGElement.cpp:
722         (WebCore::AccessibilitySVGElement::accessibilityText const):
723         (WebCore::AccessibilitySVGElement::accessibilityText): Deleted.
724         * accessibility/AccessibilitySVGElement.h:
725         * accessibility/AccessibilityScrollView.cpp:
726         (WebCore::AccessibilityScrollView::accessibilityHitTest const):
727         * accessibility/AccessibilityScrollView.h:
728         * accessibility/ios/AccessibilityObjectIOS.mm:
729         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
730         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
731         (-[WebAccessibilityObjectWrapper fileUploadButtonReturnsValueInTitle]): Deleted.
732         * accessibility/isolatedtree: Replaced.
733         * accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
734         (WebCore::AXIsolatedTree::treePageCache):
735         (WebCore::AXIsolatedTree::AXIsolatedTree):
736         (WebCore::AXIsolatedTree::nodeInTreeForID):
737         (WebCore::AXIsolatedTree::nodeForID const):
738         (WebCore::AXIsolatedTree::focusedUIElement):
739         (WebCore::AXIsolatedTree::setRootNodeID):
740         (WebCore::AXIsolatedTree::setFocusedNodeID):
741         (WebCore::AXIsolatedTree::setInitialRequestInProgress):
742         (WebCore::AXIsolatedTree::applyPendingChanges):
743         * accessibility/isolatedtree/AXIsolatedTree.h: Added.
744         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
745         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
746         (WebCore::AXIsolatedTreeNode::~AXIsolatedTreeNode):
747         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
748         (WebCore::AXIsolatedTreeNode::setProperty):
749         (WebCore::AXIsolatedTreeNode::setParent):
750         (WebCore::AXIsolatedTreeNode::setTreeIdentifier):
751         (WebCore::AXIsolatedTreeNode::focusedUIElement const):
752         (WebCore::AXIsolatedTreeNode::parentObjectInterfaceUnignored const):
753         (WebCore::AXIsolatedTreeNode::accessibilityHitTest const):
754         (WebCore::AXIsolatedTreeNode::tree const):
755         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
756         (WebCore::AXIsolatedTreeNode::stringAttributeValue const):
757         * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
758         * accessibility/mac/AXObjectCacheMac.mm:
759         (WebCore::AXObjectCache::associateIsolatedTreeNode):
760         * accessibility/mac/AccessibilityObjectBase.mm: Added.
761         (WebCore::AccessibilityObject::speechHintAttributeValue const):
762         (WebCore::AccessibilityObject::descriptionAttributeValue const):
763         (WebCore::AccessibilityObject::titleAttributeValue const):
764         (WebCore::AccessibilityObject::helpTextAttributeValue const):
765         * accessibility/mac/AccessibilityObjectMac.mm:
766         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
767         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
768         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
769         (addChildToArray):
770         (convertToNSArray):
771         (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
772         (-[WebAccessibilityObjectWrapperBase detach]):
773         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
774         (-[WebAccessibilityObjectWrapperBase accessibilityObject]):
775         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
776         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
777         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
778         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
779         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
780         (convertPathToScreenSpaceFunction):
781         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
782         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
783         (-[WebAccessibilityObjectWrapperBase titleTagShouldBeUsedInDescriptionField]): Deleted.
784         (-[WebAccessibilityObjectWrapperBase fileUploadButtonReturnsValueInTitle]): Deleted.
785         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
786         (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]):
787         (-[WebAccessibilityObjectWrapper childrenVectorSize]):
788         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
789         (-[WebAccessibilityObjectWrapper position]):
790         (-[WebAccessibilityObjectWrapper subrole]):
791         (-[WebAccessibilityObjectWrapper roleDescription]):
792         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
793         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
794         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
795         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
796         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
797         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
798
799 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
800
801         Allow pages to trigger programmatic paste from script on iOS
802         https://bugs.webkit.org/show_bug.cgi?id=194271
803         <rdar://problem/47808810>
804
805         Reviewed by Ryosuke Niwa.
806
807         Add support for allowing script to trigger programmatic paste commands. Currently on macOS and iOS, the ability
808         to trigger programmatic paste (i.e. `document.execCommand('Paste');`) is disabled by default, such that
809         execCommand is simply a no-op that returns false. This policy is a privacy measure (common among other major
810         browsers) that prevents untrusted web content from sniffing content from the system pasteboard (even on user
811         interaction, since unintended user interaction occasionally happens as well!).
812
813         In order to make it possible for web pages to programmatically paste without opening the door to privacy and
814         security issues, we make paste commands triggered from bindings present platform UI on iOS, in the form of a
815         callout bar with the single option to paste. This UI is dismissed upon any user interaction; furthermore, any
816         user interaction short of explicitly triggering the "Paste" action subsequently prevents the page from executing
817         the paste (and causes execCommand to return false). However, if the paste action is chosen by the user, we
818         instead follow through with the programmatic paste command.
819
820         New tests to come in a followup patch.
821
822         * WebCore.xcodeproj/project.pbxproj:
823         * dom/DOMPasteAccessPolicy.h: Added.
824         * dom/UserGestureIndicator.h:
825         (WebCore::UserGestureToken::domPasteAccessPolicy const):
826         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
827
828         Add helpers on UserGestureToken to update and query the current DOM paste access policy. The access policies are
829         "NotRequestedYet" (i.e. pending a response from the user), "Granted" (the user has granted DOM paste access to
830         the page), or "Denied" (the user has prevented the page from reading the contents of the clipboard). When DOM
831         paste access is granted or rejected, make this decision sticky until the end of the current user gesture.
832
833         * editing/EditorCommand.cpp:
834         (WebCore::executePaste):
835         (WebCore::executePasteAndMatchStyle):
836         (WebCore::executePasteAsPlainText):
837         (WebCore::executePasteAsQuotation):
838
839         When executing a paste command where the source is DOM bindings, request DOM paste if needed before proceeding
840         with the paste.
841
842         (WebCore::supportedPaste):
843         * loader/EmptyClients.cpp:
844         * page/EditorClient.h:
845         * page/Frame.cpp:
846         (WebCore::Frame::requestDOMPasteAccess):
847
848         Add a helper method that requests access to the clipboard on behalf of script when pasting.
849
850         * page/Frame.h:
851         * page/Settings.yaml:
852
853         Introduce a new WebCore setting, used to gate DOM paste access requests.
854
855 2019-02-12  Alex Christensen  <achristensen@webkit.org>
856
857         Remove setDefersLoading infrastructure from WebKit2
858         https://bugs.webkit.org/show_bug.cgi?id=194506
859
860         Reviewed by Brady Eidson.
861
862         setDefersLoading is inherently racy from WebCore to the NetworkProcess,
863         it adds unwanted complexity to the initialization and use of network objects,
864         and it has led to many unrecoverable hang bugs over the years.
865         We needed to force it into WebKit2 to transition some existing clients who relied on it,
866         but we have recently finished transitioning those clients to other solutions, mostly
867         completion handlers.
868
869         * inspector/PageScriptDebugServer.cpp:
870         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
871
872 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
873
874         Unreviewed, fix build warnings after content extensions enablement
875         https://bugs.webkit.org/show_bug.cgi?id=193622
876         <rdar://problem/47982850>
877
878         * contentextensions/DFABytecode.h:
879         (WebCore::ContentExtensions::instructionSizeWithArguments):
880         * contentextensions/DFABytecodeCompiler.h:
881         * contentextensions/URLFilterParser.cpp:
882         (WebCore::ContentExtensions::URLFilterParser::statusString):
883
884 2019-02-12  Justin Fan  <justin_fan@apple.com>
885
886         [Web GPU] DepthStencilAttachment implementation
887         https://bugs.webkit.org/show_bug.cgi?id=194458
888         <rdar://problem/47932446>
889
890         Reviewed by Dean Jackson.
891
892         Implement ability to provide a depth attachment to the render pass encoder. Also implement
893         GPULoad/StoreOp and update color attachments' implementation for full functionality.
894
895         Test: webgpu/depth-enabled-triangle-strip.html
896
897         Update project files for new symbols:
898         * CMakeLists.txt:
899         * DerivedSources-input.xcfilelist:
900         * DerivedSources-output.xcfilelist:
901         * DerivedSources.make:
902         * Sources.txt:
903         * WebCore.xcodeproj/project.pbxproj:
904
905         * Modules/webgpu/GPUColor.idl: Renamed from WebGPUColor.idl
906         * Modules/webgpu/GPULoadOp.idl: Added. Interface for attachment operation enum.
907         * Modules/webgpu/GPUStoreOp.idl: Ditto.
908         * Modules/webpug/WebGPUColor.h: Removed.
909         * Modules/webgpu/WebGPUCommandBuffer.cpp: Refactored descriptor validation logic out of this file.
910         (WebCore::WebGPUCommandBuffer::beginRenderPass):
911         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Added. Now owns code for validating descriptors.
912         (WebCore::WebGPURenderPassDescriptor::validateAndConvertToGPUVersion const):
913         * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h/idl: Removed. Code moved into WebGPURenderPassDescriptor.
914         * Modules/webgpu/WebGPURenderPassDescriptor.h: Move sub-descriptor definitions into this file.
915         * Modules/webgpu/WebGPURenderPassDescriptor.idl: Ditto.
916         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Make depthStencilState optional to match API update.
917         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
918         * Modules/webgpu/WebGPUTextureView.h:
919         * platform/graphics/gpu/GPULoadOp.h: Added.
920         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Removed (moved into GPURenderPassDescriptor).
921         * platform/graphics/gpu/GPURenderPassDescriptor.h: Mirror WebGPU* changes.
922         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Make depthStencilState optional.
923         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
924         * platform/graphics/gpu/GPUStoreOp.h: Added.
925         * platform/graphics/gpu/GPUTexture.h:
926         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
927         (WebCore::loadActionForGPULoadOp): Added.
928         (WebCore::storeActionForGPUStoreOp): Added.
929         (WebCore::populateMtlColorAttachmentsArray): Added. Create all expected color attachments, rather than just the first.
930         (WebCore::populateMtlDepthStencilAttachment): Added.
931         (WebCore::GPURenderPassEncoder::create):
932         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Make depthStencilState optional.
933         (WebCore::GPURenderPipeline::create):
934
935 2019-02-12  David Kilzer  <ddkilzer@apple.com>
936
937         REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
938         <https://webkit.org/b/194529>
939         <rdar://problem/47924449>
940
941         Reviewed by Eric Carlson.
942
943         * SourcesCocoa.txt:
944         - Do not include DataDetectorsCoreSoftLink.mm in unified
945           sources.
946         * WebCore.xcodeproj/project.pbxproj:
947         - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
948           that it isn't part of the unifed sources.
949         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
950         - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
951           SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
952           DataDetectorsCore.framework. None of the other macros assume
953           this framework is optional, and it was likely made optional
954           originally because the framework was new to iOS and thus
955           didn't exist on older versions.
956         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
957         - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
958           SOFT_LINK_CLASS() since the latter can only be used with
959           SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
960           the fix for <wtf/SoftLinking.h> was applied.
961
962 2019-02-12  Youenn Fablet  <youenn@apple.com>
963
964         Make use of is<SubresourceLoader>
965         https://bugs.webkit.org/show_bug.cgi?id=194541
966
967         Reviewed by Alex Christensen.
968
969         No change of behavior.
970
971         * inspector/agents/InspectorNetworkAgent.cpp:
972         (WebCore::InspectorNetworkAgent::didReceiveResponse):
973         * loader/SubresourceLoader.h:
974         (isType):
975
976 2019-02-12  Mark Lam  <mark.lam@apple.com>
977
978         Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions.
979         https://bugs.webkit.org/show_bug.cgi?id=194530
980         <rdar://problem/47973274>
981
982         Reviewed by Chris Dumez.
983
984         This is needed to fix a null pointer dereference that arises from the following scenario:
985         1. a Document detaches from its StyleSheetList.
986         2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet
987            to be scanned and collected by the GC.
988         3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and
989            discovers a null owner pointer.
990
991         This patch fixes this issue by applying the following null checks:
992
993         1. Add a null check in JSNodeCustom.h's root().
994
995            root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm.
996            isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result
997            to root().  However, depending on which class the ownerNode() method belongs to,
998            it can either return a pointer or a reference.  The null check only makes sense
999            in the pointer case.
1000
1001            To accommodate the 2 forms, root() itself is has an overload that takes a
1002            reference instead of a pointer.
1003
1004            Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode()
1005            returns, it can't discern when the result is a pointer and apply the null check.
1006            Instead, we just add the null check to the version of root() that takes a
1007            pointer.  If the node pointer is null, we'll return a null opaque root.
1008
1009         2. Fix CodeGeneratorJS.pm to null check the opaque root before using it.
1010
1011         * bindings/js/JSNodeCustom.h:
1012         (WebCore::root):
1013         * bindings/scripts/CodeGeneratorJS.pm:
1014         (GenerateImplementation):
1015         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1016         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
1017
1018 2019-02-12  Andy Estes  <aestes@apple.com>
1019
1020         [iOSMac] Enable Parental Controls Content Filtering
1021         https://bugs.webkit.org/show_bug.cgi?id=194521
1022         <rdar://39732376>
1023
1024         Reviewed by Tim Horton.
1025
1026         * Configurations/FeatureDefines.xcconfig:
1027         * platform/ContentFilterUnblockHandler.h:
1028         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
1029         * platform/cocoa/ParentalControlsContentFilter.mm:
1030
1031 2019-02-11  Jer Noble  <jer.noble@apple.com>
1032
1033         Unreviewed build fix; add a HAVE_CELESTIAL guard around Celestial framework usage.
1034
1035         * platform/audio/ios/MediaSessionManagerIOS.h:
1036         * platform/audio/ios/MediaSessionManagerIOS.mm:
1037         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
1038
1039 2019-02-12  Antti Koivisto  <antti@apple.com>
1040
1041         Crash in WebCore::ScrollingTree::updateTreeFromStateNode
1042         https://bugs.webkit.org/show_bug.cgi?id=194538
1043         <rdar://problem/47841926>
1044
1045         Reviewed by Zalan Bujtas.
1046
1047         * page/scrolling/ScrollingTree.cpp:
1048         (WebCore::ScrollingTree::updateTreeFromStateNode):
1049
1050         Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent.
1051
1052 2019-02-12  Zalan Bujtas  <zalan@apple.com>
1053
1054         [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding
1055         https://bugs.webkit.org/show_bug.cgi?id=194540
1056
1057         Reviewed by Antti Koivisto.
1058
1059         Use FormattingContext::computeBorderAndPadding instead.
1060
1061         * layout/FormattingContext.cpp:
1062         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1063         * layout/FormattingContext.h:
1064         * layout/inlineformatting/InlineFormattingContext.cpp:
1065         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted.
1066         * layout/inlineformatting/InlineFormattingContext.h:
1067
1068 2019-02-12  Zalan Bujtas  <zalan@apple.com>
1069
1070         [LFC][IFC] Add intrinsic width support for float boxes.
1071         https://bugs.webkit.org/show_bug.cgi?id=194528
1072
1073         Reviewed by Antti Koivisto.
1074
1075         This patch implements a very simple float box support for intrinsic width.
1076
1077         * layout/inlineformatting/InlineFormattingContext.cpp:
1078         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1079         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
1080         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
1081         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1082         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted.
1083         * layout/inlineformatting/InlineFormattingContext.h:
1084
1085 2019-02-12  Rob Buis  <rbuis@igalia.com>
1086
1087         Implement serializing in MIME type parser
1088         https://bugs.webkit.org/show_bug.cgi?id=193909
1089
1090         Reviewed by Darin Adler.
1091
1092         Implement serializing in MIME type parser [1], to preserve the parameter
1093         order the Vector m_parameterNames is introduced, since HashMaps do not
1094         guarantee any order.
1095
1096         Test: ParsedContentType.Serialize
1097
1098         [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
1099
1100         * platform/network/ParsedContentType.cpp:
1101         (WebCore::skipSpaces):
1102         (WebCore::parseQuotedString):
1103         (WebCore::ParsedContentType::parseContentType):
1104         (WebCore::ParsedContentType::parameterValueForName const):
1105         (WebCore::ParsedContentType::parameterCount const):
1106         (WebCore::ParsedContentType::setContentType):
1107         (WebCore::ParsedContentType::setContentTypeParameter):
1108         (WebCore::ParsedContentType::serialize const):
1109         * platform/network/ParsedContentType.h:
1110
1111 2019-02-08  Chris Fleizach  <cfleizach@apple.com>
1112
1113         AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc
1114         https://bugs.webkit.org/show_bug.cgi?id=182280
1115         <rdar://problem/37018386>
1116
1117         Reviewed by Alan Bujtas.
1118
1119         Remove the possibility that changing children calls back into updating layout by
1120         handling children changes in a deferred manner.
1121
1122         This follows the same architecture as many other deferred changes, but also requires us to check deferred changes
1123         in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children.
1124
1125         A few tests had to be modified to no longer change the tree and then check the children immediately. 
1126
1127         * accessibility/AXObjectCache.cpp:
1128         (WebCore::AXObjectCache::remove):
1129         (WebCore::AXObjectCache::childrenChanged):
1130         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1131         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1132         * accessibility/AXObjectCache.h:
1133         * accessibility/AccessibilityObject.cpp:
1134         (WebCore::AccessibilityObject::updateBackingStore):
1135         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1136         (convertToNSArray):
1137         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
1138
1139 2019-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
1140
1141         [Cocoa] Ask platform for generic font family mappings
1142         https://bugs.webkit.org/show_bug.cgi?id=187723
1143         <rdar://problem/41892438>
1144
1145         Reviewed by Brent Fulgham.
1146
1147         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
1148         When trying to style a character with a generic font family, we first look to see if
1149         we have a mapping for the particular script the character is rendered with, and if we
1150         don't find a match, we then check USCRIPT_COMMON.
1151
1152         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
1153         the only scripts which won't use the API families) is in
1154         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
1155         for the CJK scripts.
1156
1157         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
1158         user-installed fonts. Instead, we should be consulting with the platform for some of
1159         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
1160         API still has to work to set the mappings for untagged content. Therefore, we use the
1161         system mappings for language-tagged content, and the API mappings for non-language-tagged
1162         content. This is a good balance that makes sure we always have a good mapping for every
1163         language, but API clients can still set the mappings, too.
1164
1165         Test: fast/text/ja-sans-serif.html
1166
1167         * css/CSSComputedStyleDeclaration.cpp:
1168         * css/CSSFontSelector.cpp:
1169         (WebCore::resolveGenericFamily):
1170         * css/parser/CSSPropertyParser.cpp:
1171         (WebCore::consumeFontFamily):
1172         * page/cocoa/SettingsBaseCocoa.mm:
1173         (WebCore::SettingsBase::initializeDefaultFontFamilies):
1174         (WebCore::osakaMonoIsInstalled): Deleted.
1175         * platform/graphics/FontDescription.cpp:
1176         (WebCore::FontDescription::platformResolveGenericFamily):
1177         * platform/graphics/FontDescription.h:
1178         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1179         (WebCore::computeSpecializedChineseLocale):
1180         (WebCore::cachedSpecializedChineseLocale):
1181         (WebCore::languageChanged):
1182         (WebCore::FontDescription::platformResolveGenericFamily):
1183         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1184         (WebCore::SystemFontDatabaseCoreText::clear):
1185         (WebCore::genericFamily):
1186         (WebCore::SystemFontDatabaseCoreText::serifFamily):
1187         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
1188         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
1189         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
1190         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
1191         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
1192
1193 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
1194
1195         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
1196         https://bugs.webkit.org/show_bug.cgi?id=193622
1197
1198         Reviewed by Michael Catanzaro.
1199
1200         No new tests needed.
1201
1202         * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
1203         * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
1204
1205 2019-02-11  Daniel Bates  <dabates@apple.com>
1206
1207         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1208         https://bugs.webkit.org/show_bug.cgi?id=191446
1209         <rdar://problem/45929460>
1210
1211         Reviewed by Tim Horton.
1212
1213         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
1214         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
1215         to be passed to WebKit.
1216
1217         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
1218                fast/events/touch/ios/pointer-events-with-modifiers.html
1219                fast/events/touch/ios/touch-events-with-modifiers.html
1220
1221         * platform/ios/PlatformEventFactoryIOS.mm:
1222         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1223         * platform/ios/WebEvent.h:
1224         * platform/ios/WebEvent.mm:
1225         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
1226         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
1227
1228 2019-02-11  Jer Noble  <jer.noble@apple.com>
1229
1230         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
1231         https://bugs.webkit.org/show_bug.cgi?id=194504
1232
1233         Reviewed by Eric Carlson.
1234
1235         This allows the MediaRemote framework to associate the WebContent process with its host application.
1236
1237         * Modules/mediastream/UserMediaRequest.cpp:
1238         (WebCore::UserMediaRequest::start):
1239         * platform/audio/PlatformMediaSessionManager.h:
1240         (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest):
1241         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
1242         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
1243         (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest):
1244         (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary):
1245         (MediaSessionManagerCocoa::updateNowPlayingInfo):
1246
1247 2019-02-11  Commit Queue  <commit-queue@webkit.org>
1248
1249         Unreviewed, rolling out r241272 and r241276.
1250         https://bugs.webkit.org/show_bug.cgi?id=194514
1251
1252         Broke the Apple Internal build and the fix requires human
1253         intervention :( (Requested by dydz on #webkit).
1254
1255         Reverted changesets:
1256
1257         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
1258         https://bugs.webkit.org/show_bug.cgi?id=191446
1259         https://trac.webkit.org/changeset/241272
1260
1261         "Fix internal iOS build after r241272"
1262         https://bugs.webkit.org/show_bug.cgi?id=191446
1263         https://trac.webkit.org/changeset/241276
1264
1265 2019-02-11  Alex Christensen  <achristensen@webkit.org>
1266
1267         Stop using setDefersLoading from WebCore
1268         https://bugs.webkit.org/show_bug.cgi?id=194315
1269
1270         Reviewed by Jer Noble.
1271
1272         That is what CompletionHandlers are for.
1273
1274         * loader/MediaResourceLoader.cpp:
1275         (WebCore::MediaResource::responseReceived):
1276         (WebCore::MediaResource::setDefersLoading): Deleted.
1277         * loader/MediaResourceLoader.h:
1278         * platform/graphics/PlatformMediaResourceLoader.h:
1279         (WebCore::PlatformMediaResourceClient::responseReceived):
1280         (WebCore::PlatformMediaResource::stop):
1281         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
1282         * platform/network/cocoa/WebCoreNSURLSession.mm:
1283         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
1284         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
1285         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
1286         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
1287
1288 2019-02-11  Daniel Bates  <dabates@apple.com>
1289
1290         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1291         https://bugs.webkit.org/show_bug.cgi?id=191446
1292         <rdar://problem/45929460>
1293
1294         Reviewed by Tim Horton.
1295
1296         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
1297         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
1298         to be passed to WebKit.
1299
1300         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
1301                fast/events/touch/ios/pointer-events-with-modifiers.html
1302                fast/events/touch/ios/touch-events-with-modifiers.html
1303
1304         * platform/ios/PlatformEventFactoryIOS.mm:
1305         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1306         * platform/ios/WebEvent.h:
1307         * platform/ios/WebEvent.mm:
1308         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
1309         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
1310
1311 2019-02-11  Daniel Bates  <dabates@apple.com>
1312
1313         Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
1314         https://bugs.webkit.org/show_bug.cgi?id=193591
1315
1316         Reviewed by Simon Fraser.
1317
1318         Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using
1319         the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when
1320         outline-style: auto.
1321
1322         No functionality changed. So, no new tests.
1323
1324         * platform/graphics/GraphicsContext.h:
1325         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1326         (WebCore::drawFocusRing):
1327         (WebCore::drawFocusRingToContextAtTime):
1328         Change some macro guards.
1329
1330         * rendering/RenderElement.cpp:
1331         (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added.
1332         (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added.
1333         (WebCore::drawFocusRing): Added.
1334         (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing().
1335
1336 2019-02-11  Truitt Savell  <tsavell@apple.com>
1337
1338         Unreviewed, rolling out r241229.
1339
1340         Revision broke internal builds for watchOS.
1341
1342         Reverted changeset:
1343
1344         "[Cocoa] Ask platform for generic font family mappings"
1345         https://bugs.webkit.org/show_bug.cgi?id=187723
1346         https://trac.webkit.org/changeset/241229
1347
1348 2019-02-11  Youenn Fablet  <youenn@apple.com>
1349
1350         Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object
1351         https://bugs.webkit.org/show_bug.cgi?id=194404
1352         <rdar://problem/47891915>
1353
1354         Reviewed by Geoffrey Garen.
1355
1356         Align with the spec, except for known problematic web sites.
1357         Covered by updated test.
1358
1359         * Modules/fetch/FetchRequest.cpp:
1360         (WebCore::needsSignalQuirk):
1361         (WebCore::processInvalidSignal):
1362         (WebCore::FetchRequest::initializeWith):
1363
1364 2019-02-11  Zalan Bujtas  <zalan@apple.com>
1365
1366         [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues
1367         https://bugs.webkit.org/show_bug.cgi?id=194490
1368
1369         Reviewed by Antti Koivisto.
1370
1371         This is in preparation for adding floating preferred width computation support. It requires height computaiton
1372         which uses containing block width to resolve vertical margins.
1373
1374         * layout/FormattingContext.cpp:
1375         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1376         * layout/FormattingContext.h:
1377         * layout/FormattingContextGeometry.cpp:
1378         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1379         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1380         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1381         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1382         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1383         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
1384         * layout/FormattingContextQuirks.cpp:
1385         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
1386         * layout/LayoutUnits.h:
1387         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1388         * layout/blockformatting/BlockFormattingContext.cpp:
1389         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1390         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1391         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1392         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1393         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1394         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
1395         * layout/blockformatting/BlockMarginCollapse.cpp:
1396         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
1397         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
1398         * layout/inlineformatting/InlineFormattingContext.cpp:
1399         (WebCore::Layout::InlineFormattingContext::layout const):
1400         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1401         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1402         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
1403
1404 2019-02-11  Zalan Bujtas  <zalan@apple.com>
1405
1406         [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently.
1407         https://bugs.webkit.org/show_bug.cgi?id=194483
1408
1409         Reviewed by Antti Koivisto.
1410
1411         Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore).
1412
1413         * layout/FormattingContext.h:
1414         * layout/FormattingContextGeometry.cpp:
1415         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1416         * layout/blockformatting/BlockFormattingContext.cpp:
1417         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
1418         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted.
1419         * layout/blockformatting/BlockFormattingContext.h:
1420         * layout/inlineformatting/InlineFormattingContext.cpp:
1421         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1422         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1423         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted.
1424         * layout/inlineformatting/InlineFormattingContext.h:
1425
1426 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1427
1428         [LFC] Fix spelling error.
1429         https://bugs.webkit.org/show_bug.cgi?id=194489
1430
1431         Reviewed by Simon Fraser.
1432
1433         instrinsic -> intrinsic
1434
1435         * layout/FormattingContext.h:
1436         * layout/FormattingContextGeometry.cpp:
1437         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1438         * layout/FormattingState.h:
1439         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
1440         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
1441         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
1442         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted.
1443         (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted.
1444         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted.
1445         * layout/blockformatting/BlockFormattingContext.cpp:
1446         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const):
1447         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted.
1448         * layout/blockformatting/BlockFormattingContext.h:
1449         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1450         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth):
1451         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1452         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted.
1453         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted.
1454         * layout/inlineformatting/InlineFormattingContext.cpp:
1455         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const):
1456         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1457         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted.
1458         * layout/inlineformatting/InlineFormattingContext.h:
1459
1460 2019-02-10  Darin Adler  <darin@apple.com>
1461
1462         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
1463         https://bugs.webkit.org/show_bug.cgi?id=194485
1464
1465         Reviewed by Daniel Bates.
1466
1467         * Modules/websockets/WebSocket.cpp:
1468         (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format.
1469
1470         * css/parser/CSSParserToken.cpp:
1471         (WebCore::CSSParserToken::serialize const): Fixed style of many return statements
1472         that called a function returning void; doesn't match WebKit's prevailing style.
1473         Also use break instead of return. Used appendLiteral instead of append in many
1474         cases, and append character instead of single-character literal in others.
1475         Use appendUnsignedAsHex instead of String::format.
1476
1477         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1478         (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex.
1479         Should come back here and use makeString once we make HexNumber.h work with that.
1480
1481         * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h.
1482
1483         * rendering/RenderTreeAsText.cpp:
1484         (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls
1485         to character append. Touched because it was next to a call to appendUnsignedAsHex.
1486
1487 2019-02-10  Pablo Saavedra  <psaavedra@igalia.com>
1488
1489         libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const
1490         https://bugs.webkit.org/show_bug.cgi?id=194484
1491
1492         Reviewed by Darin Adler.
1493
1494         * bindings/js/JSUndoItemCustom.cpp:
1495
1496 2019-02-10  Philippe Normand  <pnormand@igalia.com>
1497
1498         Unreviewed, GTK Debug build fix after r241148.
1499
1500         * Modules/mediasource/SourceBuffer.cpp:
1501         (WebCore::removeSamplesFromTrackBuffer):
1502         SourceBuffer::logClassName and friends are declared for
1503         !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly.
1504
1505 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1506
1507         [LFC][IFC] Add intrinsic width support for inline-block boxes
1508         https://bugs.webkit.org/show_bug.cgi?id=194479
1509
1510         Reviewed by Antti Koivisto.
1511
1512         Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while
1513         laying out the content for the min/max width.
1514
1515         <div style="position: absolute">before<span id=inline-block style="display: inline-block">inline_block content<span>after</div>
1516
1517         The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for
1518         the maximum width. These min/max values are used to figure out the intrinsic width for the parent <div>.
1519
1520         * layout/inlineformatting/InlineFormattingContext.cpp:
1521         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1522         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1523         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1524         * layout/inlineformatting/InlineFormattingContext.h:
1525         * page/FrameViewLayoutContext.cpp:
1526         (WebCore::layoutUsingFormattingContext):
1527
1528 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1529
1530         [LFC][IFC] Add intrinsic width support for replaced boxes
1531         https://bugs.webkit.org/show_bug.cgi?id=194478
1532
1533         Reviewed by Antti Koivisto.
1534
1535         * layout/inlineformatting/InlineFormattingContext.cpp:
1536         (WebCore::Layout::InlineFormattingContext::layout const):
1537         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1538         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1539         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
1540         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1541         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
1542         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted.
1543         * layout/inlineformatting/InlineFormattingContext.h:
1544
1545 2019-02-10  Alicia Boya García  <aboya@igalia.com>
1546
1547         [MSE][GStreamer] Add missing return type to lambda
1548         https://bugs.webkit.org/show_bug.cgi?id=194414
1549
1550         Reviewed by Darin Adler.
1551
1552         Since g_signal_connect() is untyped, a compiler error was not
1553         generated when a lambda with a missing GstFlowReturn return type was
1554         provided for a signal that expects it.
1555
1556         This used to work before r240784 because a recent function call had
1557         set GST_FLOW_OK in the return value register and it happened to
1558         survive until the lambda function call ended. Starting on that commit
1559         such return value was removed and it stopped working on debug.
1560
1561         Of course, the actual problem is in the signature of the lambda
1562         function, and this patch fixes that.
1563
1564         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1565         (WebCore::AppendPipeline::AppendPipeline):
1566
1567 2019-02-09  Darin Adler  <darin@apple.com>
1568
1569         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
1570         https://bugs.webkit.org/show_bug.cgi?id=194021
1571
1572         Reviewed by Geoffrey Garen.
1573
1574         For floating point numbers, String::number gives a fixed precision result,
1575         stripping trailing zeroes. When possible, I changed the code to instead use the
1576         equivalent of String::numberToStringECMAScript, which is what makeString does by
1577         default for floating point, gives the same results for many cases, and gives
1578         better results in many others. However, for floats, we do not yet have a good
1579         implementation, so instead I used FormattedNumber::fixedPrecision to match
1580         the old behavior.
1581
1582         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
1583         (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let
1584         makeString do the conversion without allocating/destroying a String.
1585         * Modules/websockets/ThreadableWebSocketChannel.cpp:
1586         (WebCore::ThreadableWebSocketChannel::create): Ditto.
1587         * Modules/websockets/WebSocket.cpp:
1588         (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the
1589         ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t)
1590         and sometimes used for UTF-16 code units (UChar) and can be the same type.
1591
1592         * Modules/websockets/WebSocketChannel.cpp:
1593         (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing
1594         a string instead of just a normal C literal. Switched to makeString so we could
1595         remove String::number and do the conversion without allocating/destroying a String.
1596         (WebCore::WebSocketChannel::didFail): Ditto.
1597         (WebCore::WebSocketChannel::processFrame): Ditto.
1598         * Modules/websockets/WebSocketFrame.cpp:
1599         (WebCore::WebSocketFrame::parseFrame): Ditto.
1600         * Modules/websockets/WebSocketHandshake.cpp:
1601         (WebCore::WebSocketHandshake::readServerHandshake): Ditto.
1602         * accessibility/AccessibilityRenderObject.cpp:
1603         (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto.
1604         * bindings/js/JSDOMConvertNumbers.cpp:
1605         (WebCore::rangeErrorString): Ditto.
1606         * css/CSSAspectRatioValue.cpp:
1607         (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used
1608         FormattedNumber::fixedPrecision since these are floats.
1609
1610         * css/DOMMatrixReadOnly.cpp:
1611         (WebCore::DOMMatrixReadOnly::toString const): Use
1612         StringBuilder::builder.appendECMAScriptNumber instead of
1613         String::numberToStringECMAScript so we can do it without allocating/destroying
1614         a String.
1615         * css/WebKitCSSMatrix.cpp:
1616         (WebCore::WebKitCSSMatrix::toString const): Ditto.
1617
1618         * dom/MessagePortIdentifier.h:
1619         (WebCore::MessagePortIdentifier::logString const): Remove String::number and let
1620         makeString do the conversion without allocating/destroying a String.
1621
1622         * editing/cocoa/DataDetection.mm:
1623         (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values
1624         passed to String::number and to StringBuilder::appendNumber. These could do
1625         harm if the values were out of range, and should not be necessary.
1626
1627         * history/BackForwardItemIdentifier.h:
1628         (WebCore::BackForwardItemIdentifier::logString const): Remove String::number
1629         and let makeString do the conversion without allocating/destroying a String.
1630         * html/FTPDirectoryDocument.cpp:
1631         (WebCore::processFileDateString): Ditto.
1632         * html/canvas/WebGLRenderingContextBase.cpp:
1633         (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
1634         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto.
1635         * inspector/agents/WebConsoleAgent.cpp:
1636         (WebCore::WebConsoleAgent::didReceiveResponse): Ditto.
1637         * loader/WorkerThreadableLoader.cpp:
1638         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
1639         * loader/appcache/ApplicationCacheGroup.cpp:
1640         (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto.
1641         * page/PageSerializer.cpp:
1642         (WebCore::PageSerializer::urlForBlankFrame): Ditto.
1643         * page/PrintContext.cpp:
1644         (WebCore::PrintContext::pageProperty): Ditto.
1645         (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto.
1646
1647         * page/WheelEventTestTrigger.cpp:
1648         (WebCore::dumpState): Use StringBuilder::appendNumber instead of
1649         String::number so we can do it without allocating/destroying a String.
1650         Also use StringBuilder::appendLiteral on a literal.
1651
1652         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1653         (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit
1654         KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior,
1655         since default is now to truncate trailing zeros.
1656
1657         * platform/graphics/Color.cpp:
1658         (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of
1659         calling numberToFixedPrecisionString to do the same thing.
1660         * platform/graphics/ExtendedColor.cpp:
1661         (WebCore::ExtendedColor::cssText): Ditto.
1662
1663         * platform/graphics/ca/GraphicsLayerCA.cpp:
1664         (WebCore::animationIdentifier): Remove String::number and let makeString
1665         do the conversion without allocating/destroying a String. Had to add
1666         a typecast to convert the enumeration into an integer.
1667         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
1668         (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto.
1669         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1670         (WebCore::FontPlatformData::description const): Ditto.
1671
1672         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1673         (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number
1674         instead of String::number to avoid unneccessarily allocating an additional
1675         temporary String when an AtomicString already exists.
1676
1677         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1678         (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number
1679         and let makeString do the conversion without allocating/destroying a String.
1680         * platform/sql/SQLiteDatabase.cpp:
1681         (WebCore::SQLiteDatabase::setMaximumSize): Ditto.
1682         (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to
1683         convert the enumeration into an integer.
1684         * svg/SVGAngleValue.cpp:
1685         (WebCore::SVGAngleValue::valueAsString const): Ditto.
1686         * svg/SVGLengthValue.cpp:
1687         (WebCore::SVGLengthValue::valueAsString const): Ditto.
1688         * testing/Internals.cpp:
1689         (WebCore::Internals::configurationForViewport): Ditto. Used
1690         FormattedNumber::fixedPrecision since these are floats.
1691         (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber
1692         instead of calling numberToFixedPrecisionString to do the same thing.
1693         (WebCore::Internals::queueMicroTask): Remove String::number and let makeString
1694         do the conversion without allocating/destroying a String.
1695         (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of
1696         String::number so we can do it without allocating/destroying a String.
1697
1698         * workers/service/ServiceWorkerClientIdentifier.h:
1699         (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number
1700         and let makeString do the conversion without allocating/destroying a String.
1701         * workers/service/server/RegistrationDatabase.cpp:
1702         (WebCore::databaseFilenameFromVersion): Ditto.
1703
1704 2019-02-09  Zalan Bujtas  <zalan@apple.com>
1705
1706         [LFC][IFC] Add intrinsic width support for basic inline containers
1707         https://bugs.webkit.org/show_bug.cgi?id=194473
1708
1709         Reviewed by Antti Koivisto.
1710
1711         Preferred width computation logic is very similar to normal layout.
1712         One of the main difference is that the preferred width codepath does not provide valid containing block width.
1713         This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues. 
1714
1715         * layout/inlineformatting/InlineFormattingContext.cpp:
1716         (WebCore::Layout::InlineFormattingContext::layout const):
1717         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1718         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
1719         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
1720         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1721         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1722         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
1723         * layout/inlineformatting/InlineFormattingContext.h:
1724
1725 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
1726
1727         [Cocoa] CTLineGetGlyphRuns() might return nullptr
1728         https://bugs.webkit.org/show_bug.cgi?id=194467
1729         <rdar://problem/42423999>
1730
1731         Reviewed by Simon Fraser.
1732
1733         Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.
1734
1735         Covered by find/text/find-backwards.html
1736
1737         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1738         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1739
1740 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
1741
1742         [Cocoa] Ask platform for generic font family mappings
1743         https://bugs.webkit.org/show_bug.cgi?id=187723
1744         <rdar://problem/41892438>
1745
1746         Reviewed by Brent Fulgham.
1747
1748         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
1749         When trying to style a character with a generic font family, we first look to see if
1750         we have a mapping for the particular script the character is rendered with, and if we
1751         don't find a match, we then check USCRIPT_COMMON.
1752
1753         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
1754         the only scripts which won't use the API families) is in
1755         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
1756         for the CJK scripts.
1757
1758         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
1759         user-installed fonts. Instead, we should be consulting with the platform for some of
1760         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
1761         API still has to work to set the mappings for untagged content. Therefore, we use the
1762         system mappings for language-tagged content, and the API mappings for non-language-tagged
1763         content. This is a good balance that makes sure we always have a good mapping for every
1764         language, but API clients can still set the mappings, too.
1765
1766         Test: fast/text/ja-sans-serif.html
1767
1768         * css/CSSComputedStyleDeclaration.cpp:
1769         * css/CSSFontSelector.cpp:
1770         (WebCore::resolveGenericFamily):
1771         * css/parser/CSSPropertyParser.cpp:
1772         (WebCore::consumeFontFamily):
1773         * page/cocoa/SettingsBaseCocoa.mm:
1774         (WebCore::SettingsBase::initializeDefaultFontFamilies):
1775         (WebCore::osakaMonoIsInstalled): Deleted.
1776         * platform/graphics/FontDescription.cpp:
1777         (WebCore::FontDescription::platformResolveGenericFamily):
1778         * platform/graphics/FontDescription.h:
1779         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1780         (WebCore::computeSpecializedChineseLocale):
1781         (WebCore::cachedSpecializedChineseLocale):
1782         (WebCore::languageChanged):
1783         (WebCore::FontDescription::platformResolveGenericFamily):
1784         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1785         (WebCore::SystemFontDatabaseCoreText::clear):
1786         (WebCore::SystemFontDatabaseCoreText::serifFamily):
1787         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
1788         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
1789         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
1790         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
1791         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
1792
1793 2019-02-08  Yusuke Suzuki  <ysuzuki@apple.com>
1794
1795         [JSC] Shrink sizeof(CodeBlock) more
1796         https://bugs.webkit.org/show_bug.cgi?id=194419
1797
1798         Reviewed by Mark Lam.
1799
1800         * testing/Internals.cpp:
1801         (WebCore::Internals::parserMetaData):
1802
1803 2019-02-08  Chris Dumez  <cdumez@apple.com>
1804
1805         [Cocoa] Optimize ResourceResponse::platformLazyInit()
1806         https://bugs.webkit.org/show_bug.cgi?id=194438
1807
1808         Reviewed by Alex Christensen.
1809
1810         Optimize ResourceResponse::platformLazyInit(). Most of the CPU time currently goes into getting the
1811         HTTP headers from CFNetwork:
1812         """
1813         Sample Count, Samples %, CPU %, Symbol
1814         46, 0.0%, 0.0%, WebCore::initializeHTTPHeaders(WebCore::OnlyCommonHeaders, NSHTTPURLResponse*, WebCore::HTTPHeaderMap&) (in WebCore)
1815         34, 0.0%, 0.0%,     HTTPHeaderDict::copyAsOrdinaryDict(__CFAllocator const*) const (in CFNetwork)
1816         11, 0.0%, 0.0%,     CFDictionaryApplyFunction (in CoreFoundation)
1817         """
1818
1819         We currently have 2 levels of initialization: CommonFieldsOnly & AllFields. With WebKit2, most ResourceResponses get sent over IPC
1820         and thus end up getting initialized twice, once with CommonFieldsOnly and then with AllFields.
1821         This would cause us to call the expensive HTTPHeaderDict::copyAsOrdinaryDict() twice instead of once, simply to initialize the common
1822         HTTP headers first and then the uncommon ones later.
1823
1824         This patch updates ResourceResponse::platformLazyInit() to initialize all HTTP headers at once, as soon as CommonFieldsOnly
1825         initialization is requested, so that we no longer copy all HTTP headers twice.
1826
1827         * platform/network/cocoa/ResourceResponseCocoa.mm:
1828         (WebCore::initializeHTTPHeaders):
1829         (WebCore::ResourceResponse::platformLazyInit):
1830
1831 2019-02-08  Justin Fan  <justin_fan@apple.com>
1832
1833         [Web GPU] Build fix for MTLStorageMode availability on different Cocoa platforms
1834         https://bugs.webkit.org/show_bug.cgi?id=194443
1835
1836         Unreviewed build fix.
1837
1838         For MTLTextures, MTLStorageModeManaged is only available on macOS. Other platforms,
1839         if not using MTLStorageModePrivate, must use MTLStorageModeShared.
1840
1841         Behavior unchanged.
1842
1843         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1844         (WebCore::storageModeForPixelFormatAndSampleCount):
1845
1846 2019-02-08  Per Arne Vollan  <pvollan@apple.com>
1847
1848         [WebVTT] Inline WebVTT styles should start with '::cue'
1849         https://bugs.webkit.org/show_bug.cgi?id=194227
1850         <rdar://problem/47791087>
1851
1852         Reviewed by Eric Carlson.
1853
1854         Check that the CSS string starts with '::cue' and is successfully parsed before adding it
1855         to the CSS stylesheet list. Also, the caption preferences CSS string should start with
1856         '::cue', since it is added inside the video shadow root element.
1857
1858         Test: media/track/track-cue-css.html
1859
1860         * html/track/WebVTTParser.cpp:
1861         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
1862         * page/CaptionUserPreferencesMediaAF.cpp:
1863         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
1864
1865 2019-02-08  Youenn Fablet  <youenn@apple.com>
1866
1867         Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
1868         https://bugs.webkit.org/show_bug.cgi?id=194380
1869         <rdar://problem/47916514>
1870
1871         Reviewed by Eric Carlson.
1872
1873         Set whether VP8 is supported at creation of the page.
1874         This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.
1875
1876         Add internal API to enable resetting the factory to enable proper testing.
1877
1878         Covered by updated test.
1879
1880         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1881         (WebCore::createLibWebRTCPeerConnectionBackend):
1882         * page/Page.cpp:
1883         (WebCore::m_applicationManifest):
1884         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1885         * testing/Internals.cpp:
1886         (WebCore::Internals::clearPeerConnectionFactory):
1887         * testing/Internals.h:
1888         * testing/Internals.idl:
1889
1890 2019-02-08  Andy Estes  <aestes@apple.com>
1891
1892         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
1893         https://bugs.webkit.org/show_bug.cgi?id=190997
1894         <rdar://problem/35983035>
1895
1896         Reviewed by Brent Fulgham.
1897
1898         Support serializing sequences and FrozenArrays of types that aren't interfaces. This is
1899         needed to properly serialize PaymentAddress, which has a FrozenArray of DOMStrings.
1900
1901         We should support serializing sequences of interfaces too, but that's slightly more
1902         complicated since it involves iterating the sequence and serializing each of its items. I
1903         left that as a follow-up task, since I don't see any IDLs that currently need this.
1904
1905         We also don't support serializing sequences with the CachedAttribute or CustomGetter
1906         extended attributes, because WebIDL specifies that a new array should be created when
1907         converting an IDL sequence into an ECMAScript value.
1908
1909         Added bindings test cases to TestSerialization.idl and PaymentAddress test cases to
1910         http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html.
1911
1912         * bindings/scripts/CodeGenerator.pm:
1913         (GetInterfaceForType): Renamed from GetInterfaceForAttribute.
1914         (IsSerializableType): Modified to allow sequences and FrozenArrays of non-interface types.
1915         (hasCachedAttributeOrCustomGetterExtendedAttribute): Added a helper to determine if an
1916         attribute has the CachedAttribute or CustomGetter extended attributes.
1917         (IsSerializableAttribute): Checked for sequences with the CachedAttribute or CustomGetter
1918         extended attributes before calling IsSerializableType.
1919         (GetInterfaceForAttribute): Renamed to GetInterfaceForType.
1920         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1921         * bindings/scripts/test/TestSerialization.idl:
1922
1923 2019-02-08  Sihui Liu  <sihui_liu@apple.com>
1924
1925         IndexedDB tests leak documents
1926         https://bugs.webkit.org/show_bug.cgi?id=189435
1927         <rdar://problem/44240043>
1928
1929         Reviewed by Geoffrey Garen.
1930
1931         Remove use of JSC::Strong in IndexedDatabase.
1932
1933         * Modules/indexeddb/IDBCursor.cpp:
1934         (WebCore::IDBCursor::update):
1935         (WebCore::IDBCursor::continuePrimaryKey):
1936         (WebCore::IDBCursor::continueFunction):
1937         (WebCore::IDBCursor::deleteFunction):
1938         (WebCore::IDBCursor::setGetResult):
1939         * Modules/indexeddb/IDBCursor.h:
1940         (WebCore::IDBCursor::key):
1941         (WebCore::IDBCursor::primaryKey):
1942         (WebCore::IDBCursor::value):
1943         (WebCore::IDBCursor::keyWrapper):
1944         (WebCore::IDBCursor::primaryKeyWrapper):
1945         (WebCore::IDBCursor::valueWrapper):
1946         (WebCore::IDBCursor::key const): Deleted.
1947         (WebCore::IDBCursor::primaryKey const): Deleted.
1948         (WebCore::IDBCursor::value const): Deleted.
1949         * Modules/indexeddb/IDBCursor.idl:
1950         * Modules/indexeddb/IDBCursorWithValue.idl:
1951         * Modules/indexeddb/IDBObjectStore.cpp:
1952         (WebCore::IDBObjectStore::putForCursorUpdate):
1953         * Modules/indexeddb/IDBObjectStore.h:
1954         * Modules/indexeddb/IDBRequest.cpp:
1955         (WebCore::IDBRequest::IDBRequest):
1956         (WebCore::IDBRequest::~IDBRequest):
1957         (WebCore::IDBRequest::result const):
1958         (WebCore::IDBRequest::setResult):
1959         (WebCore::IDBRequest::setResultToStructuredClone):
1960         (WebCore::IDBRequest::setResultToUndefined):
1961         (WebCore::IDBRequest::resultCursor):
1962         (WebCore::IDBRequest::willIterateCursor):
1963         (WebCore::IDBRequest::didOpenOrIterateCursor):
1964         * Modules/indexeddb/IDBRequest.h:
1965         (WebCore::IDBRequest::resultWrapper):
1966         * Modules/indexeddb/IDBRequest.idl:
1967         * Sources.txt:
1968         * WebCore.xcodeproj/project.pbxproj:
1969         * bindings/js/JSIDBCursorCustom.cpp:
1970         (WebCore::JSIDBCursor::key const):
1971         (WebCore::JSIDBCursor::primaryKey const):
1972         (WebCore::JSIDBCursor::visitAdditionalChildren):
1973         * bindings/js/JSIDBCursorWithValueCustom.cpp:
1974         (WebCore::JSIDBCursorWithValue::value const):
1975         (WebCore::JSIDBCursorWithValue::visitAdditionalChildren):
1976         * bindings/js/JSIDBRequestCustom.cpp: Added.
1977         (WebCore::JSIDBRequest::result const):
1978         (WebCore::JSIDBRequest::visitAdditionalChildren):
1979         * inspector/agents/InspectorIndexedDBAgent.cpp:
1980
1981 2019-02-08  Zalan Bujtas  <zalan@apple.com>
1982
1983         [LFC] The used containing block width value is optional
1984         https://bugs.webkit.org/show_bug.cgi?id=194428
1985
1986         Reviewed by Antti Koivisto.
1987
1988         The preferred width codepath cannot provide a valid used containing block width value.
1989
1990         "The percentage is calculated with respect to the width of the generated box's containing block.
1991         If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.2."
1992
1993         Let's use 0 as used value for now.
1994
1995         * layout/FormattingContextGeometry.cpp:
1996         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1997         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1998         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1999         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2000         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2001         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2002         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
2003         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
2004         * layout/LayoutUnits.h:
2005         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
2006         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2007         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2008         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2009         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2010         * page/FrameViewLayoutContext.cpp:
2011
2012 2019-02-08  Zalan Bujtas  <zalan@apple.com>
2013
2014         [LFC] Horizontal geometry compute functions should take the containing block's width as a used value
2015         https://bugs.webkit.org/show_bug.cgi?id=194424
2016
2017         Reviewed by Antti Koivisto.
2018
2019         This is in preparation for passing optional containing block width for the preferred with codepath. 
2020
2021         * layout/FormattingContext.cpp:
2022         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2023         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
2024         * layout/FormattingContext.h:
2025         * layout/FormattingContextGeometry.cpp:
2026         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2027         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2028         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2029         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2030         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2031         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2032         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
2033         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
2034         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
2035         * layout/LayoutUnits.h:
2036         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
2037         * layout/blockformatting/BlockFormattingContext.cpp:
2038         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2039         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2040         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2041         * layout/inlineformatting/InlineFormattingContext.cpp:
2042         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
2043         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2044         * layout/inlineformatting/InlineFormattingContext.h:
2045         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2046         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2047
2048 2019-02-08  Benjamin Poulain  <benjamin@webkit.org>
2049
2050         clampTo(): do not convert the input to double when dealing with integers
2051         https://bugs.webkit.org/show_bug.cgi?id=194263
2052         <rdar://problem/47692312>
2053
2054         Reviewed by Darin Adler.
2055
2056         Make the calls to clampTo<float>() unambiguous.
2057
2058         * page/FrameView.cpp:
2059         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
2060         * rendering/style/RenderStyle.h:
2061         (WebCore::RenderStyle::setOpacity):
2062         (WebCore::RenderStyle::setShapeImageThreshold):
2063
2064 2019-02-08  Eric Liang  <ericliang@apple.com>
2065
2066         When performing AXPress, check to see if the menu list is disabled.
2067         https://bugs.webkit.org/show_bug.cgi?id=193878
2068
2069         Reviewed by Chris Fleizach.
2070
2071         Test: accessibility/mac/press-not-work-for-disabled-menu-list.html
2072
2073         * accessibility/AXObjectCache.h:
2074         * accessibility/AccessibilityMenuList.cpp:
2075         (WebCore::AccessibilityMenuList::press):
2076         * accessibility/mac/AXObjectCacheMac.mm:
2077         (WebCore::AXObjectCache::postPlatformNotification):
2078
2079 2019-02-07  Devin Rousso  <drousso@apple.com>
2080
2081         PseudoElement created for any ::before/::after selector regardless of whether a content property exists
2082         https://bugs.webkit.org/show_bug.cgi?id=194423
2083         <rdar://problem/46787260>
2084
2085         Reviewed by Antti Koivisto.
2086
2087         Test: inspector/css/pseudo-creation.html
2088
2089         * style/StyleTreeResolver.cpp:
2090         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2091         We should only be creating `PseudoElement`s if we actually have a `content` proprety in the
2092         `PseudoElement`'s style. Otherwise, we end up creating `PseudoElement`s for every CSS rule
2093         that has a `::before`/`::after`, only to immediately destroy them as there is nothing to show.
2094
2095 2019-02-07  Chris Dumez  <cdumez@apple.com>
2096
2097         Mark more heap-allocated classes as fast allocated
2098         https://bugs.webkit.org/show_bug.cgi?id=194422
2099
2100         Reviewed by Ryosuke Niwa.
2101
2102         * Modules/applepay/PaymentCoordinator.h:
2103         * Modules/beacon/NavigatorBeacon.h:
2104         * Modules/cache/DOMWindowCaches.h:
2105         * Modules/cache/WorkerGlobalScopeCaches.h:
2106         * Modules/credentialmanagement/NavigatorCredentials.h:
2107         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
2108         * Modules/gamepad/NavigatorGamepad.h:
2109         * Modules/indexeddb/IDBGetAllResult.h:
2110         * Modules/indexeddb/IDBGetResult.h:
2111         * Modules/indexeddb/IDBKeyData.h:
2112         * Modules/indexeddb/IDBValue.h:
2113         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
2114         * Modules/indexeddb/server/IndexValueEntry.h:
2115         * Modules/indexeddb/server/IndexValueStore.h:
2116         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
2117         * Modules/indexeddb/server/MemoryCursor.h:
2118         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2119         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2120         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2121         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
2122         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2123         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
2124         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2125         * Modules/indexeddb/shared/IDBTransactionInfo.h:
2126         * Modules/mediacapabilities/NavigatorMediaCapabilities.h:
2127         * Modules/mediasession/WebMediaSessionManager.cpp:
2128         * Modules/mediastream/NavigatorMediaDevices.h:
2129         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2130         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
2131         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2132         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
2133         * Modules/navigatorcontentutils/NavigatorContentUtils.h:
2134         * Modules/quota/DOMWindowQuota.h:
2135         * Modules/quota/NavigatorStorageQuota.h:
2136         * Modules/quota/WorkerNavigatorStorageQuota.h:
2137         * Modules/speech/DOMWindowSpeechSynthesis.h:
2138         * Modules/webaudio/BiquadProcessor.h:
2139         * Modules/webaudio/DelayProcessor.h:
2140         * Modules/webauthn/fido/FidoHidPacket.h:
2141         * Modules/webdriver/NavigatorWebDriver.h:
2142         * Modules/webgpu/DOMWindowWebGPU.h:
2143         * Modules/websockets/WebSocketChannel.h:
2144         * Modules/webvr/NavigatorWebVR.h:
2145         * accessibility/AXObjectCache.h:
2146         * bindings/js/DOMGCOutputConstraint.h:
2147         * bindings/js/DOMPromiseProxy.h:
2148         * bridge/c/c_runtime.h:
2149         * contentextensions/CombinedURLFilters.cpp:
2150         * crypto/CryptoAlgorithmParameters.h:
2151         * css/CSSComputedStyleDeclaration.h:
2152         * css/CSSRegisteredCustomProperty.h:
2153         * css/DOMCSSPaintWorklet.h:
2154         * css/DOMCSSRegisterCustomProperty.h:
2155         * css/StyleRule.h:
2156         * dom/ConstantPropertyMap.h:
2157         * dom/CustomElementReactionQueue.h:
2158         * dom/Document.h:
2159         * dom/GenericEventQueue.h:
2160         * dom/RejectedPromiseTracker.h:
2161         * dom/UserGestureIndicator.h:
2162         * editing/ReplaceSelectionCommand.cpp:
2163         * editing/SelectionRectGatherer.h:
2164         * editing/TextIterator.h:
2165         * editing/cocoa/HTMLConverter.mm:
2166         * fileapi/AsyncFileStream.cpp:
2167         * fileapi/AsyncFileStream.h:
2168         * html/forms/FileIconLoader.h:
2169         * html/parser/HTMLTreeBuilder.h:
2170         * html/track/WebVTTParser.h:
2171         * inspector/DOMPatchSupport.cpp:
2172         * loader/FrameLoaderClient.h:
2173         * loader/WorkerThreadableLoader.cpp:
2174         * page/IntersectionObserver.h:
2175         * page/PerformanceMonitor.h:
2176         * page/PerformanceUserTiming.h:
2177         * page/PrintContext.h:
2178         * page/ValidationMessageClient.h:
2179         * platform/ColorChooser.h:
2180         * platform/ControlStates.h:
2181         * platform/DataListSuggestionPicker.h:
2182         * platform/FileStream.h:
2183         * platform/KeyedCoding.h:
2184         * platform/LowPowerModeNotifier.h:
2185         * platform/PlatformSpeechSynthesizer.h:
2186         * platform/WebGLStateTracker.h:
2187         * platform/audio/AudioArray.h:
2188         * platform/audio/AudioDestination.h:
2189         * platform/audio/DownSampler.h:
2190         * platform/audio/DynamicsCompressor.h:
2191         * platform/audio/FFTFrame.h:
2192         * platform/audio/HRTFDatabase.h:
2193         * platform/audio/MultiChannelResampler.h:
2194         * platform/audio/Panner.h:
2195         * platform/audio/Reverb.h:
2196         * platform/audio/ReverbConvolver.h:
2197         * platform/audio/ReverbConvolverStage.h:
2198         * platform/audio/UpSampler.h:
2199         * platform/audio/mac/AudioSessionMac.cpp:
2200         * platform/audio/mac/CAAudioStreamDescription.h:
2201         * platform/audio/mac/CARingBuffer.h:
2202         * platform/cocoa/ScrollSnapAnimatorState.h:
2203         * platform/gamepad/PlatformGamepad.h:
2204         * platform/graphics/GraphicsLayer.cpp:
2205         * platform/graphics/GraphicsLayerFactory.h:
2206         * platform/graphics/PlatformTimeRanges.h:
2207         * platform/graphics/TextTrackRepresentation.h:
2208         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
2209         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2210         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
2211         * platform/graphics/displaylists/DisplayListRecorder.h:
2212         * platform/network/cocoa/WebCoreNSURLSession.mm:
2213         * platform/sql/SQLiteDatabase.h:
2214         * platform/text/TextCodecICU.h:
2215         * rendering/GridBaselineAlignment.h:
2216         * rendering/GridTrackSizingAlgorithm.h:
2217         * rendering/RenderObject.h:
2218         * rendering/style/GridArea.h:
2219         * workers/service/context/SWContextManager.h:
2220
2221 2019-02-07  Justin Fan  <justin_fan@apple.com>
2222
2223         [Web GPU] GPUDevice::createTexture implementation prototype
2224         https://bugs.webkit.org/show_bug.cgi?id=194409
2225         <rdar://problem/47894312>
2226
2227         Reviewed by Myles C. Maxfield.
2228
2229         Test: textures-textureviews.html updated to test new functionality.
2230
2231         Implement GPUDevice::createTexture():
2232         * Modules/webgpu/WebGPUDevice.cpp:
2233         (WebCore::WebGPUDevice::createTexture const):
2234         * Modules/webgpu/WebGPUDevice.h:
2235         * Modules/webgpu/WebGPUDevice.idl:
2236         * Modules/webgpu/WebGPUTexture.cpp:
2237         (WebCore::WebGPUTexture::create): Modified to return non-nullable to match direction of API.
2238         (WebCore::WebGPUTexture::WebGPUTexture):
2239         * Modules/webgpu/WebGPUTexture.h:
2240
2241         Metal backend MTLTextureDescriptor and MTLTexture creation:
2242         * platform/graphics/gpu/GPUDevice.cpp:
2243         (WebCore::GPUDevice::tryCreateTexture const):
2244         * platform/graphics/gpu/GPUDevice.h:
2245         * platform/graphics/gpu/GPUTexture.h:
2246         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2247         (WebCore::mtlTextureTypeForGPUTextureDescriptor):
2248         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
2249         (WebCore::storageModeForPixelFormatAndSampleCount):
2250         (WebCore::tryCreateMtlTextureDescriptor):
2251         (WebCore::GPUTexture::tryCreate):
2252         (WebCore::GPUTexture::createDefaultTextureView): Add ObjC try/catch guards.
2253
2254         Add GPUUtils.h/cpp for shared utility functions:
2255         * SourcesCocoa.txt:
2256         * WebCore.xcodeproj/project.pbxproj:
2257         * platform/graphics/gpu/GPUUtils.h: Added. Moved platformTextureFormatForGPUTextureFormat here.
2258         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2259         (WebCore::GPUSwapChain::setFormat):
2260         (WebCore::platformTextureFormatForGPUTextureFormat): Moved to GPUUtils.
2261         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Added.
2262         (WebCore::platformTextureFormatForGPUTextureFormat): Moved here to be referenced by multiple files.
2263
2264 2019-02-07  Sihui Liu  <sihui_liu@apple.com>
2265
2266         REGRESSION(r239887): Crash under IDBConnectionToClient::didDeleteDatabase(WebCore::IDBResultData const&)
2267         https://bugs.webkit.org/show_bug.cgi?id=194402
2268         <rdar://problem/47858241>
2269
2270         Reviewed by Geoffrey Garen.
2271
2272         r239887 removed a reference cycle of IDBConnectionToClient so that IDBConnectionToClient would no longer be
2273         around forever. Therefore, ServerOpenRequest should keep a reference to IDBConnectionToClient to make sure it
2274         is valid during access.
2275
2276         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
2277         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
2278         (WebCore::IDBServer::ServerOpenDBRequest::notifyDidDeleteDatabase):
2279         * Modules/indexeddb/server/ServerOpenDBRequest.h:
2280
2281 2019-02-07  Timothy Hatcher  <timothy@apple.com>
2282
2283         Overflow element scrollbar is light for dark mode content.
2284         https://bugs.webkit.org/show_bug.cgi?id=194407
2285         rdar://problem/45991585
2286
2287         Reviewed by Beth Dakin.
2288
2289         Tested by css-dark-mode/supported-color-schemes-scrollbar.html.
2290
2291         * page/ChromeClient.h:
2292         (WebCore::FrameView::preferredScrollbarOverlayStyle): Return WTF::nullopt by default to avoid
2293         short-circuiting auto detection in recalculateScrollbarOverlayStyle() for clients, like WK1,
2294         that do not implement preferredScrollbarOverlayStyle().
2295         * page/FrameView.cpp:
2296         (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use WTF::nullopt in the false case
2297         to auto detect overlay style when page() is null.
2298         * rendering/RenderLayer.cpp:
2299         (WebCore::RenderLayer::useDarkAppearance const): Added.
2300         * rendering/RenderLayer.h:
2301         * testing/Internals.cpp:
2302         (WebCore::Internals::scrollbarOverlayStyle const): Added Node argument.
2303         (WebCore::Internals::scrollbarUsingDarkAppearance const): Added.
2304         * testing/Internals.h:
2305         * testing/Internals.idl:
2306
2307 2019-02-07  Eric Carlson  <eric.carlson@apple.com>
2308
2309         [MSE] Convert debug-only logging to runtime logging
2310         https://bugs.webkit.org/show_bug.cgi?id=194348
2311         <rdar://problem/47566449>
2312
2313         Reviewed by Jer Noble.
2314
2315         No new tests, this just changes existing logging.
2316
2317         * Modules/mediasource/MediaSource.cpp:
2318         (WebCore::convertEnumerationToString):
2319         (WebCore::MediaSource::MediaSource):
2320         (WebCore::MediaSource::~MediaSource):
2321         (WebCore::MediaSource::setPrivateAndOpen):
2322         (WebCore::MediaSource::addedToRegistry):
2323         (WebCore::MediaSource::removedFromRegistry):
2324         (WebCore::MediaSource::durationChanged):
2325         (WebCore::MediaSource::seekToTime):
2326         (WebCore::MediaSource::completeSeek):
2327         (WebCore::MediaSource::setLiveSeekableRange):
2328         (WebCore::MediaSource::clearLiveSeekableRange):
2329         (WebCore::MediaSource::setDuration):
2330         (WebCore::MediaSource::setDurationInternal):
2331         (WebCore::MediaSource::setReadyState):
2332         (WebCore::MediaSource::endOfStream):
2333         (WebCore::MediaSource::streamEndedWithError):
2334         (WebCore::MediaSource::addSourceBuffer):
2335         (WebCore::MediaSource::removeSourceBuffer):
2336         (WebCore::MediaSource::isTypeSupported):
2337         (WebCore::MediaSource::detachFromElement):
2338         (WebCore::MediaSource::attachToElement):
2339         (WebCore::MediaSource::openIfInEndedState):
2340         (WebCore::MediaSource::suspend):
2341         (WebCore::MediaSource::resume):
2342         (WebCore::MediaSource::stop):
2343         (WebCore::MediaSource::onReadyStateChange):
2344         (WebCore::MediaSource::scheduleEvent):
2345         (WebCore::MediaSource::logChannel const):
2346         (WebCore::MediaSourceInternal::toString): Deleted.
2347         * Modules/mediasource/MediaSource.h:
2348         (WTF::LogArgument<WebCore::MediaSource::EndOfStreamError>::toString):
2349         (WTF::LogArgument<WebCore::MediaSource::ReadyState>::toString):
2350         * Modules/mediasource/SourceBuffer.cpp:
2351         (WebCore::SourceBuffer::SourceBuffer):
2352         (WebCore::SourceBuffer::~SourceBuffer):
2353         (WebCore::SourceBuffer::remove):
2354         (WebCore::SourceBuffer::seekToTime):
2355         (WebCore::SourceBuffer::appendBufferInternal):
2356         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
2357         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
2358         (WebCore::removeSamplesFromTrackBuffer):
2359         (WebCore::SourceBuffer::removeCodedFrames):
2360         (WebCore::SourceBuffer::evictCodedFrames):
2361         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
2362         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2363         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples):
2364         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
2365         (WebCore::SourceBuffer::provideMediaData):
2366         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
2367         (WebCore::SourceBuffer::monitorBufferingRate):
2368         (WebCore::SourceBuffer::logChannel const):
2369         * Modules/mediasource/SourceBuffer.h:
2370         * dom/Document.cpp:
2371         (WebCore::messageSourceForWTFLogChannel):
2372         (WebCore::Document::didLogMessage):
2373         * html/HTMLMediaElement.cpp:
2374         (WebCore::convertEnumerationToString):
2375         (WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
2376         (WebCore::HTMLMediaElement::selectMediaResource):
2377         (WebCore::HTMLMediaElement::loadResource):
2378         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
2379         (WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
2380         (WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
2381         (WebCore::HTMLMediaElement::scheduleUpdatePlayState):
2382         (WebCore::HTMLMediaElement::scheduleUpdateMediaState):
2383         * platform/ContentType.cpp:
2384         (WebCore::ContentType::toJSONString const):
2385         * platform/ContentType.h:
2386         (WTF::LogArgument<WebCore::ContentType>::toString):
2387         * platform/MediaSample.h:
2388         (WebCore::MediaSample::toJSONString const):
2389         (WTF::LogArgument<WebCore::MediaSample>::toString):
2390         * platform/graphics/FloatSize.cpp:
2391         (WebCore::FloatSize::toJSONObject const):
2392         (WebCore::FloatSize::toJSONString const):
2393         * platform/graphics/FloatSize.h:
2394         (WTF::LogArgument<WebCore::FloatSize>::toString):
2395         * platform/graphics/MediaSourcePrivate.h:
2396         (WebCore::MediaSourcePrivate::mediaSourceLogIdentifier):
2397         (WTF::LogArgument<WebCore::MediaSourcePrivate::AddStatus>::toString):
2398         (WTF::LogArgument<WebCore::MediaSourcePrivate::EndOfStreamStatus>::toString):
2399         * platform/graphics/SourceBufferPrivate.h:
2400         (WebCore::SourceBufferPrivate::sourceBufferLogger const):
2401         (WebCore::SourceBufferPrivate::sourceBufferLogIdentifier):
2402         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2403         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
2404         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
2405         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
2406         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
2407         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
2408         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
2409         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
2410         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2411         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogIdentifier):
2412         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
2413         (WTF::LogArgument<WebCore::MediaPlayerPrivateMediaSourceAVFObjC::SeekState>::toString):
2414         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2415         (WebCore::convertEnumerationToString):
2416         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2417         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
2418         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load):
2419         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
2420         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
2421         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
2422         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
2423         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
2424         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
2425         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible):
2426         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
2427         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
2428         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted):
2429         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted):
2430         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
2431         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
2432         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
2433         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
2434         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
2435         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
2436         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2437         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
2438         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
2439         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2440         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
2441         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
2442         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState):
2443         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState):
2444         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget):
2445         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetWireless const):
2446         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
2447         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2448         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
2449         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
2450         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2451         (WebCore::MediaSampleAVFObjC::toJSONString const):
2452         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2453         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2454         (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC):
2455         (WebCore::MediaSourcePrivateAVFObjC::~MediaSourcePrivateAVFObjC):
2456         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
2457         (WebCore::MediaSourcePrivateAVFObjC::logChannel const):
2458         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2459         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2460         (WebCore::bufferWasConsumedCallback):
2461         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
2462         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
2463         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2464         (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
2465         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
2466         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
2467         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
2468         (WebCore::SourceBufferPrivateAVFObjC::append):
2469         (WebCore::SourceBufferPrivateAVFObjC::abort):
2470         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
2471         (WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource):
2472         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
2473         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2474         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
2475         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
2476         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
2477         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2478         (WebCore::SourceBufferPrivateAVFObjC::flush):
2479         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
2480         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2481         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
2482         (WebCore::SourceBufferPrivateAVFObjC::setActive):
2483         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2484         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
2485         (WebCore::SourceBufferPrivateAVFObjC::canSwitchToType):
2486         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
2487         (WebCore::SourceBufferPrivateAVFObjC::logChannel const):
2488
2489 2019-02-07  Youenn Fablet  <youenn@apple.com>
2490
2491         Simplify applyConstraints callbacks
2492         https://bugs.webkit.org/show_bug.cgi?id=194297
2493
2494         Reviewed by Eric Carlson.
2495
2496         Make use of one callback for both success and failure cases.
2497         No changed of behavior.
2498
2499         * Modules/mediastream/MediaStreamTrack.cpp:
2500         (WebCore::MediaStreamTrack::applyConstraints):
2501         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2502         (WebCore::MediaStreamTrackPrivate::applyConstraints):
2503         * platform/mediastream/MediaStreamTrackPrivate.h:
2504         * platform/mediastream/RealtimeMediaSource.cpp:
2505         (WebCore::RealtimeMediaSource::applyConstraints):
2506         * platform/mediastream/RealtimeMediaSource.h:
2507         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2508         (WebCore::AVVideoCaptureSource::create):
2509         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2510         (WebCore::CoreAudioCaptureSource::create):
2511         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
2512         (WebCore::MockGStreamerAudioCaptureSource::applyConstraints):
2513         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
2514         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
2515         (WebCore::MockGStreamerVideoCaptureSource::applyConstraints):
2516         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
2517
2518 2019-02-07  Youenn Fablet  <youenn@apple.com>
2519
2520         Unable to sign in leetcode.
2521         https://bugs.webkit.org/show_bug.cgi?id=194366
2522         rdar://problem/47259025.
2523
2524         Reviewed by Chris Dumez.
2525
2526         In case a signal is passed as part of a FetchRequestInit,
2527         the IDL binding code is throwing an exception in case signal is not an AbortSignal object.
2528         This breaks an AbortSignal shim used in some web sites.
2529         Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest.
2530
2531         Test: http/wpt/fetch/request-abort.html
2532         Also covered by manually signing in to leetcode.
2533
2534         * Modules/fetch/FetchRequest.cpp:
2535         (WebCore::FetchRequest::initializeWith):
2536         * Modules/fetch/FetchRequestInit.h:
2537         (WebCore::FetchRequestInit::hasMembers const):
2538         * Modules/fetch/FetchRequestInit.idl:
2539
2540 2019-02-07  Youenn Fablet  <youenn@apple.com>
2541
2542         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
2543         https://bugs.webkit.org/show_bug.cgi?id=194312
2544
2545         Reviewed by Eric Carlson.
2546
2547         Add a way for sources to know when they are ended, i.e. that they will never be started again.
2548         No observable change of behavior.
2549
2550         * platform/mediastream/RealtimeMediaSource.cpp:
2551         (WebCore::RealtimeMediaSource::requestStop):
2552         * platform/mediastream/RealtimeMediaSource.h:
2553
2554 2019-02-07  Jer Noble  <jer.noble@apple.com>
2555
2556         HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
2557         https://bugs.webkit.org/show_bug.cgi?id=194360
2558
2559         HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should
2560         really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement,
2561         make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor
2562         taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases.
2563
2564         Reviewed by Geoffrey Garen.
2565
2566         * Modules/applepay/ApplePaySession.cpp:
2567         (WebCore::ApplePaySession::ApplePaySession):
2568         * Modules/mediarecorder/MediaRecorder.cpp:
2569         (WebCore::MediaRecorder::MediaRecorder):
2570         * Modules/mediastream/MediaDevices.cpp:
2571         (WebCore::MediaDevices::MediaDevices):
2572         * Modules/mediastream/UserMediaRequest.cpp:
2573         (WebCore::UserMediaRequest::UserMediaRequest):
2574         * Modules/notifications/Notification.cpp:
2575         (WebCore::Notification::Notification):
2576         * Modules/paymentrequest/PaymentRequest.cpp:
2577         (WebCore::PaymentRequest::PaymentRequest):
2578         * Modules/webaudio/AudioContext.cpp:
2579         (WebCore::AudioContext::AudioContext):
2580         * animation/WebAnimation.cpp:
2581         (WebCore::WebAnimation::WebAnimation):
2582         * css/FontFaceSet.cpp:
2583         (WebCore::FontFaceSet::FontFaceSet):
2584         * dom/ActiveDOMObject.cpp:
2585         (WebCore::ActiveDOMObject::ActiveDOMObject):
2586         * dom/ActiveDOMObject.h:
2587         * dom/Document.h:
2588         (WebCore::ActiveDOMObject::ActiveDOMObject):
2589         * html/HTMLMarqueeElement.cpp:
2590         (WebCore::HTMLMarqueeElement::HTMLMarqueeElement):
2591         * html/HTMLMediaElement.cpp:
2592         (WebCore::HTMLMediaElement::HTMLMediaElement):
2593         * html/HTMLSourceElement.cpp:
2594         (WebCore::HTMLSourceElement::HTMLSourceElement):
2595         * page/IntersectionObserver.cpp:
2596         (WebCore::IntersectionObserver::IntersectionObserver):
2597
2598 2019-02-07  Zalan Bujtas  <zalan@apple.com>
2599
2600         [LFC][Out-of-flow] Use the containing block's padding width when computing min/max width.
2601         https://bugs.webkit.org/show_bug.cgi?id=194391
2602
2603         Reviewed by Antti Koivisto.
2604
2605         The spec is not clear about this but that's what matches the current behaviour.
2606
2607         Test: fast/block/block-only/absolute-positioned-min-max-percentage-with-parent-padding.html
2608
2609         * layout/FormattingContext.cpp:
2610         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2611
2612 2019-02-07  Zalan Bujtas  <zalan@apple.com>
2613
2614         [LFC] Use dedicated data structures for optional used values (input to geometry functions)
2615         https://bugs.webkit.org/show_bug.cgi?id=194376
2616
2617         Reviewed by Antti Koivisto.
2618
2619         This is in preparation for being able to pass in the containing block's width as an optional used value.
2620         During layout we always have a valid width for the containing block, however it's not the case while computing the preferred width.
2621
2622         * layout/FormattingContext.cpp:
2623         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2624         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2625         * layout/FormattingContext.h:
2626         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): Deleted.
2627         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): Deleted.
2628         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): Deleted.
2629         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): Deleted.
2630         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): Deleted.
2631         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): Deleted.
2632         (): Deleted.
2633         (WebCore::Layout::FormattingContext::Geometry::complicatedCases): Deleted.
2634         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): Deleted.
2635         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): Deleted.
2636         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): Deleted.
2637         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): Deleted.
2638         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): Deleted.
2639         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Deleted.
2640         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): Deleted.
2641         * layout/FormattingContextGeometry.cpp:
2642         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2643         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2644         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2645         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2646         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
2647         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2648         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
2649         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2650         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
2651         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2652         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
2653         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2654         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2655         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2656         * layout/LayoutUnits.h:
2657         * layout/blockformatting/BlockFormattingContext.cpp:
2658         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2659         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2660         * layout/blockformatting/BlockFormattingContext.h:
2661         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): Deleted.
2662         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): Deleted.
2663         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): Deleted.
2664         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): Deleted.
2665         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): Deleted.
2666         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2667         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2668         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2669         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2670         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2671         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2672         * layout/inlineformatting/InlineFormattingContext.cpp:
2673         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2674         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
2675         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2676         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2677         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
2678         * page/FrameViewLayoutContext.cpp:
2679         (WebCore::layoutUsingFormattingContext):
2680
2681 2019-02-07  Antti Koivisto  <antti@apple.com>
2682
2683         Infinite recursion via CachedResource::~CachedResource
2684         https://bugs.webkit.org/show_bug.cgi?id=194378
2685         <rdar://problem/42023295>
2686
2687         Reviewed by Daniel Bates.
2688
2689         I don't know the exact steps to trigger this but the mechanism seems clear.
2690
2691         1) An existing resource is removed from or replaced in CachedResourceLoader::m_documentResources map.
2692         2) This decrements the handle count of resource and causes it be deleted.
2693         3) CachedResource::~CachedResource calls m_owningCachedResourceLoader->removeCachedResource(*this). This only happens with
2694            resources that are "owned" by CachedResourceLoader which is a rare special case (used by image document and if memory cache is disabled).
2695         4) CachedResourceLoader::removeCachedResource looks up the resource from the map which causes a temporary CachedResourceHandle to be created.
2696            This increments the handle count of the resource from 0 back to 1.
2697         5) When the temporary dies, CachedResource::~CachedResource is called again and we cycle back to 3).
2698
2699         The fix here is simply to remove CachedResourceLoader::removeCachedResource call from ~CachedResource.
2700         It is a leftover from when the map contained raw pointers instead of owning CachedResourceHandles.
2701
2702         Since m_documentResources map has a handle to the resource, the only way we are in the destructor is that the resource
2703         has been removed from the map already (or is in process of being removed like in this crash). Any call that does anything
2704         other than bail out is going to crash.
2705
2706         CachedResource::n_owningCachedResourceLoader member and CachedResourceLoader::removeCachedResource function only exist to
2707         support this erranous call so they are removed as well.
2708
2709         * loader/ImageLoader.cpp:
2710         (WebCore::ImageLoader::updateFromElement):
2711         * loader/cache/CachedResource.cpp:
2712         (WebCore::CachedResource::~CachedResource):
2713
2714         This is the substantive change. The rest just removes now-dead code.
2715
2716         * loader/cache/CachedResource.h:
2717         (WebCore::CachedResource::setOwningCachedResourceLoader): Deleted.
2718         * loader/cache/CachedResourceLoader.cpp:
2719         (WebCore::CachedResourceLoader::~CachedResourceLoader):
2720         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2721         (WebCore::CachedResourceLoader::requestResource):
2722         (WebCore::CachedResourceLoader::loadResource):
2723         (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
2724         (WebCore::CachedResourceLoader::removeCachedResource): Deleted.
2725         * loader/cache/CachedResourceLoader.h:
2726
2727 2019-02-07  Miguel Gomez  <magomez@igalia.com>
2728
2729         [WPE] Implement GStreamer based holepunch
2730         https://bugs.webkit.org/show_bug.cgi?id=193715
2731
2732         Reviewed by Xabier Rodriguez-Calvar.
2733
2734         Implement GStreamer based holepunch functionality. Instead of getting the video frames from the
2735         video sink and drawing then, the player just draws a transparent rectangle on the position where
2736         the video should be. MediaPlayerPrivateGStreamerBase will instantiate a platform dependant video
2737         sink which will be in charge of displaying the video frames in some way (usually on a plane below
2738         the browser), and will push empty frames to the compositor indicating that the rectangle to draw
2739         should overwrite the existent content. TextureMapperPlatformLayerBuffer::HolePunchClient is used
2740         to tell the video sink where to position the video so it's set below the browser transparent hole.
2741
2742         Added ManualTest wpe/video-player-holepunch.html to test the feature.
2743
2744         * platform/graphics/MediaPlayer.cpp:
2745         (WebCore::MediaPlayer::shouldIgnoreIntrinsicSize):
2746         * platform/graphics/MediaPlayer.h:
2747         * platform/graphics/MediaPlayerPrivate.h:
2748         (WebCore::MediaPlayerPrivateInterface::shouldIgnoreIntrinsicSize):
2749         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2750         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
2751         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
2752         (WebCore::setRectangleToVideoSink):
2753         (WebCore::GStreamerHolePunchClient::GStreamerHolePunchClient):
2754         (WebCore::MediaPlayerPrivateGStreamerBase::createHolePunchVideoSink):
2755         (WebCore::MediaPlayerPrivateGStreamerBase::pushNextHolePunchBuffer):
2756         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
2757         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2758         * platform/graphics/texmap/TextureMapper.h:
2759         * platform/graphics/texmap/TextureMapperGL.cpp:
2760         (WebCore::TextureMapperGL::drawSolidColor):
2761         * platform/graphics/texmap/TextureMapperGL.h:
2762         * platform/graphics/texmap/TextureMapperLayer.cpp:
2763         (WebCore::TextureMapperLayer::paintSelf):
2764         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2765         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
2766         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2767         (WebCore::TextureMapperPlatformLayerBuffer::setHolePunchClient):
2768         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2769         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
2770         * rendering/RenderVideo.cpp:
2771         (WebCore::RenderVideo::videoBox const):
2772
2773 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
2774
2775         Unreviewed, rolling out r240759 and r240944.
2776
2777         Some timer uses are done off the main thread, WebCore::Timer
2778         cannot be used
2779
2780         Reverted changesets:
2781
2782         "<rdar://problem/47570443> Responsiveness timers are too
2783         expensive for frequent events"
2784         https://bugs.webkit.org/show_bug.cgi?id=194003
2785         https://trac.webkit.org/changeset/240759
2786
2787         "Use deferrable timer to restart the Responsiveness Timer on
2788         each wheel event"
2789         https://bugs.webkit.org/show_bug.cgi?id=194135
2790         https://trac.webkit.org/changeset/240944
2791
2792 2019-02-06  Keith Rollin  <krollin@apple.com>
2793
2794         Update .xcfilelist files
2795
2796         Unreviewed build fix.
2797
2798         * DerivedSources-input.xcfilelist:
2799         * DerivedSources-output.xcfilelist:
2800
2801 2019-02-06  Devin Rousso  <drousso@apple.com>
2802
2803         Web Inspector: DOM: don't send the entire function string with each event listener
2804         https://bugs.webkit.org/show_bug.cgi?id=194293
2805         <rdar://problem/47822809>
2806
2807         Reviewed by Joseph Pecoraro.
2808
2809         Test: inspector/dom/getEventListenersForNode.html
2810
2811         * inspector/agents/InspectorDOMAgent.cpp:
2812         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
2813
2814 2019-02-06  Andy Estes  <aestes@apple.com>
2815
2816         [Payment Request] It should be possible to require a phonetic name for shipping contacts
2817         https://bugs.webkit.org/show_bug.cgi?id=194311
2818         <rdar://46733045>
2819
2820         Reviewed by Alex Christensen.
2821
2822         It should be possible to require that a shipping contact has a phonetic name in Payment Request.
2823         To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
2824         ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
2825
2826         Since required shipping contact fields can now be specified both in
2827         requiredShippingContactFields and PaymentOptions, we merge the required fields from these
2828         two sources such that, e.g., email is required if it is specified in either place.
2829
2830         So that clients can detect this new feature, the API version number is bumped from 5 to 6.
2831
2832         Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
2833
2834         * DerivedSources.make:
2835         * Modules/applepay/ApplePayPaymentRequest.h:
2836         * Modules/applepay/ApplePayPaymentRequest.idl:
2837         * Modules/applepay/ApplePayRequestBase.cpp:
2838         (WebCore::convertAndValidate):
2839         * Modules/applepay/ApplePayRequestBase.h:
2840         * Modules/applepay/ApplePayRequestBase.idl:
2841         * Modules/applepay/ApplePaySession.cpp:
2842         (WebCore::convertAndValidate):
2843         * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
2844         (WebCore::PaymentCoordinatorClient::supportsVersion):
2845         * Modules/applepay/PaymentCoordinatorClient.h:
2846         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2847         (WebCore::mergePaymentOptions):
2848         (WebCore::ApplePayPaymentHandler::show):
2849         * SourcesCocoa.txt:
2850         * WebCore.xcodeproj/project.pbxproj:
2851         * loader/EmptyClients.cpp:
2852         * testing/MockPaymentContactFields.h: Added.
2853         (WebCore::MockPaymentContactFields::MockPaymentContactFields):
2854         * testing/MockPaymentContactFields.idl: Added.
2855         * testing/MockPaymentCoordinator.cpp:
2856         (WebCore::MockPaymentCoordinator::showPaymentUI):
2857         (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
2858         * testing/MockPaymentCoordinator.h:
2859         * testing/MockPaymentCoordinator.idl:
2860
2861 2019-02-06  Yusuke Suzuki  <ysuzuki@apple.com>
2862
2863         [JSC] PrivateName to PublicName hash table is wasteful
2864         https://bugs.webkit.org/show_bug.cgi?id=194277
2865
2866         Reviewed by Michael Saboff.
2867
2868         Use WebCoreBuiltinNames instead of adding WebCore names to JSC CommonIdentifiers.
2869
2870         * bindings/js/JSDOMWindowCustom.cpp:
2871         (WebCore::addCrossOriginPropertyNames):
2872         * bindings/js/JSLocationCustom.cpp:
2873         (WebCore::getOwnPropertySlotCommon):
2874         (WebCore::putCommon):
2875         * bindings/js/WebCoreBuiltinNames.h:
2876
2877 2019-02-06  Keith Rollin  <krollin@apple.com>
2878
2879         Really enable the automatic checking and regenerations of .xcfilelists during builds
2880         https://bugs.webkit.org/show_bug.cgi?id=194357
2881         <rdar://problem/47861231>
2882
2883         Reviewed by Chris Dumez.
2884
2885         Bug 194124 was supposed to enable the automatic checking and
2886         regenerating of .xcfilelist files during the build. While related
2887         changes were included in that patch, the change to actually enable the
2888         operation somehow was omitted. This patch actually enables the
2889         operation. The check-xcfilelist.sh scripts now check
2890         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
2891         from the checking.
2892
2893         No new tests since there should be no observable behavior difference.
2894
2895         * Scripts/check-xcfilelists.sh:
2896
2897 2019-02-06  John Wilander  <wilander@apple.com>
2898
2899         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
2900         https://bugs.webkit.org/show_bug.cgi?id=194325
2901         <rdar://problem/47840283>
2902
2903         Reviewed by Chris Dumez.
2904
2905         No new tests. This is just data forwarding. Once the data is stored, I will create
2906         test infrastructure to query it.
2907
2908         * html/HTMLAnchorElement.cpp:
2909         (WebCore::HTMLAnchorElement::handleClick):
2910         * loader/AdClickAttribution.h:
2911         (WebCore::AdClickAttribution::encode const):
2912         (WebCore::AdClickAttribution::decode):
2913         (WebCore::AdClickAttribution::Conversion::encode const):
2914         (WebCore::AdClickAttribution::Conversion::decode):
2915             Infrastructure for IPC.
2916         * loader/FrameLoader.cpp:
2917         (WebCore::FrameLoader::urlSelected):
2918         (WebCore::FrameLoader::loadURLIntoChildFrame):
2919         (WebCore::FrameLoader::loadFrameRequest):
2920         (WebCore::FrameLoader::loadURL):
2921             These functions forward the optional WebCore::AdClickAttribution object
2922             FrameLoader::loadURL() creates the NavigationAction object and sets the
2923             WebCore::AdClickAttribution object on there.
2924         * loader/FrameLoader.h:
2925         (WebCore::FrameLoader::urlSelected):
2926         (WebCore::FrameLoader::loadURL):
2927         * loader/NavigationAction.h:
2928         (WebCore::NavigationAction::adClickAttribution):
2929         (WebCore::NavigationAction::setAdClickAttribution):
2930
2931 2019-02-06  Justin Fan  <justin_fan@apple.com>
2932
2933         [Web GPU] Implement supporting dictionaries for GPUTexture
2934         https://bugs.webkit.org/show_bug.cgi?id=194354
2935
2936         Reviewed by Dean Jackson.
2937
2938         Add dictionaries needed to create a GPUTextureDescriptor.
2939
2940         No new tests; no change in behavior. 
2941
2942         New interface and dictionaries added:
2943         * Modules/webgpu/GPUExtent3D.idl:
2944         * Modules/webgpu/GPUTextureDescriptor.idl:
2945         * Modules/webgpu/GPUTextureDimension.idl:
2946         * Modules/webgpu/GPUTextureUsage.idl:
2947         * platform/graphics/gpu/GPUExtent3D.h:
2948         * platform/graphics/gpu/GPUTextureDescriptor.h:
2949         * platform/graphics/gpu/GPUTextureDimension.h:
2950         * platform/graphics/gpu/GPUTextureUsage.h:
2951
2952         Update WebGPUTextureFormatEnum to GPUTextureFormat:
2953         * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed.
2954         * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case.
2955         * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL.
2956         * Modules/webgpu/WebGPUSwapChain.cpp:
2957         * Modules/webgpu/WebGPUSwapChain.h:
2958         * Modules/webgpu/WebGPUSwapChain.idl:
2959         * platform/graphics/gpu/GPUSwapChain.h:
2960         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2961         (WebCore::platformTextureFormatForGPUTextureFormat):
2962         (WebCore::GPUSwapChain::setFormat):
2963
2964         Update project files with new symbols:
2965         * CMakeLists.txt:
2966         * DerivedSources.make:
2967         * Sources.txt:
2968         * WebCore.xcodeproj/project.pbxproj:
2969         * bindings/js/WebCoreBuiltinNames.h:
2970
2971 2019-02-12  Dean Jackson  <dino@apple.com>
2972
2973         BitmapRenderer should handle existing ImageBuffers
2974         https://bugs.webkit.org/show_bug.cgi?id=194555
2975         <rdar://problem/47857150>
2976
2977         Reviewed by Tim Horton.
2978
2979         Our logic in ImageBitmapRenderingContext assumed that
2980         it had always created the ImageBuffer being used. However, it's
2981         valid to call something like toBlob() or toDataURL() before creating
2982         a context, so we need to handle the case where an ImageBuffer
2983         already exists.
2984
2985         Test: fast/canvas/bitmaprenderer-created-after-toBlob.html
2986
2987         * html/HTMLCanvasElement.cpp:
2988         (WebCore::HTMLCanvasElement::createImageBuffer const): Move some logic into setImageBuffer.
2989         (WebCore::HTMLCanvasElement::setImageBuffer const): Make sure to clear the state saver.
2990
2991 2019-02-06  Daniel Bates  <dabates@apple.com>
2992
2993         Standardize on ControlKey instead of CtrlKey
2994         https://bugs.webkit.org/show_bug.cgi?id=194317
2995
2996         Reviewed by Tim Horton.
2997
2998         * dom/UIEventWithKeyState.cpp:
2999         (WebCore::UIEventWithKeyState::modifiersFromInitializer):
3000         (WebCore::UIEventWithKeyState::setModifierKeys):
3001         * dom/UIEventWithKeyState.h:
3002         (WebCore::UIEventWithKeyState::ctrlKey const):
3003         * page/ios/EventHandlerIOS.mm:
3004         (WebCore::EventHandler::accessKeyModifiers):
3005         * page/mac/EventHandlerMac.mm:
3006         (WebCore::EventHandler::accessKeyModifiers):
3007         * platform/PlatformEvent.h:
3008         (WebCore::PlatformEvent::controlKey const):
3009         (WebCore::PlatformEvent::PlatformEvent):
3010         (WebCore::PlatformEvent::ctrlKey const): Deleted.
3011         * platform/cocoa/KeyEventCocoa.mm:
3012         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
3013         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3014         (WebCore::modifiersForGdkKeyEvent):
3015         * platform/gtk/PlatformMouseEventGtk.cpp:
3016         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3017         * platform/gtk/PlatformWheelEventGtk.cpp:
3018         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
3019         * platform/ios/KeyEventIOS.mm:
3020         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
3021         * platform/ios/PlatformEventFactoryIOS.mm:
3022         (WebCore::modifiersForEvent):
3023         * platform/mac/KeyEventMac.mm:
3024         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
3025         * platform/mac/PlatformEventFactoryMac.mm:
3026         (WebCore::modifiersForEvent):
3027         * testing/Internals.cpp:
3028         (WebCore::Internals::accessKeyModifiers const):
3029
3030 2019-02-06  Alex Christensen  <achristensen@webkit.org>
3031
3032         Fix WatchOS build
3033         https://bugs.webkit.org/show_bug.cgi?id=194353
3034
3035         Rubber stamped by Tim Horton and Wenson Hsieh.
3036
3037         * rendering/RenderThemeIOS.mm:
3038         (WebCore::iconForAttachment):
3039
3040 2019-02-06  Olivier Blin  <olivier.blin@softathome.com>
3041
3042         [SVG] fix SVGURIReference build by including SVGElement
3043         https://bugs.webkit.org/show_bug.cgi?id=194292
3044
3045         Reviewed by Michael Catanzaro.
3046
3047         * svg/SVGURIReference.h:
3048         SVGURIReference is making use of SVGElement in its constructor, but
3049         it was not declared.
3050
3051         The issue was not seen in unified builds because it was grouped with
3052         other files including SVGElement.
3053
3054 2019-02-06  Zalan Bujtas  <zalan@apple.com>
3055
3056         [LFC][IFC] Move line layout code to a dedicated file
3057         https://bugs.webkit.org/show_bug.cgi?id=194328
3058
3059         Reviewed by Antti Koivisto.
3060
3061         * Sources.txt:
3062         * WebCore.xcodeproj/project.pbxproj:
3063         * layout/inlineformatting/InlineFormattingContext.cpp:
3064         (WebCore::Layout::InlineFormattingContext::layout const):
3065         (WebCore::Layout::isTrimmableContent): Deleted.
3066         (WebCore::Layout::InlineFormattingContext::initializeNewLine const): Deleted.
3067         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): Deleted.
3068         (WebCore::Layout::InlineFormattingContext::createFinalRuns const): Deleted.
3069         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): Deleted.
3070         (WebCore::Layout::InlineFormattingContext::closeLine const): Deleted.
3071         (WebCore::Layout::InlineFormattingContext::appendContentToLine const): Deleted.
3072         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): Deleted.
3073         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const): Deleted.
3074         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): Deleted.
3075         * layout/inlineformatting/InlineFormattingContext.h:
3076         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::hasContent const):
3077         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isClosed const):
3078         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isFirstLine const):
3079         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::runs):
3080         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalLeft const):
3081         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::availableWidth const):
3082         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::lastRunType const):
3083         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalTop const):
3084         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalBottom const):
3085         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalHeight const):
3086         (WebCore::Layout::InlineFormattingContext::Line::hasContent const): Deleted.
3087         (WebCore::Layout::InlineFormattingContext::Line::isClosed const): Deleted.
3088         (WebCore::Layout::InlineFormattingContext::Line::isFirstLine const): Deleted.
3089         (WebCore::Layout::InlineFormattingContext::Line::runs): Deleted.
3090         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const): Deleted.
3091         (WebCore::Layout::InlineFormattingContext::Line::availableWidth const): Deleted.
3092         (WebCore::Layout::InlineFormattingContext::Line::lastRunType const): Deleted.
3093         (WebCore::Layout::InlineFormattingContext::Line::logicalTop const): Deleted.
3094         (WebCore::Layout::InlineFormattingContext::Line::logicalBottom const): Deleted.
3095         (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const): Deleted.
3096         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3097         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
3098         (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns): Deleted.
3099         (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities): Deleted.
3100         (WebCore::Layout::InlineFormattingContext::Geometry::alignRuns): Deleted.
3101         (WebCore::Layout::InlineFormattingContext::Geometry::runWidth): Deleted.
3102         * layout/inlineformatting/Line.cpp:
3103         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::init):
3104         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalLeft):
3105         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalRight):
3106         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalRight const):
3107         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::appendContent):
3108         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::close):
3109         (WebCore::Layout::InlineFormattingContext::Line::init): Deleted.
3110         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalLeft): Deleted.
3111         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalRight): Deleted.
3112         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const): Deleted.
3113         (WebCore::Layout::InlineFormattingContext::Line::appendContent): Deleted.
3114         (WebCore::Layout::InlineFormattingContext::Line::close): Deleted.
3115
3116 2019-02-06  Youenn Fablet  <youenn@apple.com>
3117
3118         CoreAudioCaptureSource should not configure its audio unit until it starts producing data
3119         https://bugs.webkit.org/show_bug.cgi?id=194310
3120
3121         Reviewed by Eric Carlson.
3122
3123         Delay the configuration of the audio unit until the source is instructed to start producing data.
3124         This allows the UIProcess to not start changing the audio unit when
3125         checking for constraints during getUserMedia call before the prompt.
3126         Covered by manual testing.
3127
3128         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3129         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
3130         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
3131         (WebCore::CoreAudioCaptureSource::startProducingData):
3132         * platform/mediastream/mac/CoreAudioCaptureSource.h:
3133
3134 2019-02-06  Youenn Fablet  <youenn@apple.com>
3135
3136         Disable audio ducking at Audio Unit setup time
3137         https://bugs.webkit.org/show_bug.cgi?id=194303
3138
3139         Reviewed by Eric Carlson.
3140
3141         When creating a CoreAudioCaptureSource, the audio unit might be
3142         reconfigured if a past audio capture was done.
3143         This might trigger audio ducking which is undone in startInternal.
3144         In some cases, startInternal will never call start.
3145         In that case, the audio unit will continue ducking the other processing.
3146         To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
3147
3148         In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
3149         This might affect all applications.
3150         Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
3151         This has noticeable effects in the quality of audio being played on bluetooth devices.
3152
3153         Covered by manual tests.
3154
3155         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3156         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
3157         (WebCore::CoreAudioSharedUnit::unduck):
3158         (WebCore::CoreAudioSharedUnit::startInternal):
3159         (WebCore::CoreAudioSharedUnit::captureFailed):
3160         (WebCore::CoreAudioSharedUnit::stopProducingData):
3161
3162 2019-02-06  Antti Koivisto  <antti@apple.com>
3163
3164         RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver
3165         https://bugs.webkit.org/show_bug.cgi?id=194333
3166         <rdar://problem/47822929>
3167
3168         Reviewed by Zalan Bujtas.
3169
3170         Content extensions may mutate the extension stylesheet in the middle of a style resolution as a result of
3171         the legacy animation code triggering a resource load.
3172
3173         Test: http/tests/contentextensions/css-display-none-keyframe.html
3174
3175         * style/StyleScope.cpp:
3176         (WebCore::Style::Scope::scheduleUpdate):
3177
3178         Avoid clearing the style resolver if we are in the middle of a style resolution.
3179         A better fix that avoid doing this in the first place is tracked by https://bugs.webkit.org/show_bug.cgi?id=194335.
3180
3181 2019-02-06  Pablo Saavedra  <psaavedra@igalia.com>
3182
3183         Build failure after r240315
3184         https://bugs.webkit.org/show_bug.cgi?id=194341
3185
3186         Reviewed by Wenson Hsieh.
3187
3188         * bindings/js/JSUndoItemCustom.cpp:
3189         (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots):
3190
3191 2019-02-05  Ryosuke Niwa  <rniwa@webkit.org>
3192
3193         REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with a non-existent target name
3194         https://bugs.webkit.org/show_bug.cgi?id=194329
3195
3196         Reviewed by Geoffrey Garen.
3197
3198         The bug was caused by the code path for when navigating with a specific target frame name that does not exist
3199         never setting the load type of PolicyChecker. As a result, we would use whatever load type used in the previous
3200         navigation, resulting in this release assertion.
3201
3202         Updating the load type here should in theory fix the underlying bug r240909 was meant to catch & fix.
3203
3204         Test: fast/loader/navigate-with-new-target-after-back-forward-navigation.html
3205
3206         * loader/FrameLoader.cpp:
3207         (WebCore::FrameLoader::loadURL):
3208
3209 2019-02-05  Claudio Saavedra  <csaavedra@igalia.com>
3210
3211         [FreeType] Build fix for Debian stable
3212
3213         Unreviewed build fix.
3214
3215         Debian stable currently has a version of fontconfig that doesn't
3216         yet have FC_COLOR. #ifdef its use to fix the build.
3217
3218         * platform/graphics/freetype/FontCacheFreeType.cpp:
3219         (WebCore::FontCache::systemFallbackForCharacters):
3220
3221 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3222
3223         Stop using blobRegistry in NetworkProcess
3224         https://bugs.webkit.org/show_bug.cgi?id=194027
3225
3226         Reviewed by Youenn Fablet.
3227
3228         Also stop using NetworkBlobRegistry::singleton.
3229         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
3230         We now have to resolve all blob file references while we still have a
3231         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
3232         using the singleton after we have passed everything to the loading code, but it works the same
3233         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
3234         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
3235         which extensions to revoke.
3236
3237         * platform/network/BlobRegistryImpl.h:
3238         * platform/network/FormData.cpp:
3239         (WebCore::appendBlobResolved):
3240         (WebCore::FormData::resolveBlobReferences):
3241         * platform/network/FormData.h:
3242         * platform/network/cf/FormDataStreamCFNet.cpp:
3243         (WebCore::createHTTPBodyCFReadStream):
3244         * platform/network/curl/CurlFormDataStream.cpp:
3245         (WebCore::CurlFormDataStream::CurlFormDataStream):
3246
3247 2019-02-05  Truitt Savell  <tsavell@apple.com>
3248
3249         Unreviewed, rolling out r240984.
3250
3251         Revision casued two API timeouts
3252
3253         Reverted changeset:
3254
3255         "Stop using blobRegistry in NetworkProcess"
3256         https://bugs.webkit.org/show_bug.cgi?id=194027
3257         https://trac.webkit.org/changeset/240984
3258
3259 2019-02-05  Keith Rollin  <krollin@apple.com>
3260
3261         Enable the automatic checking and regenerations of .xcfilelists during builds
3262         https://bugs.webkit.org/show_bug.cgi?id=194124
3263         <rdar://problem/47721277>
3264
3265         Reviewed by Tim Horton.
3266
3267         Bug 193790 add a facility for checking -- during build time -- that
3268         any needed .xcfilelist files are up-to-date and for updating them if
3269         they are not. This facility was initially opt-in by setting
3270         WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
3271         the process seemed robust. Its now time to enable this facility and
3272         make it opt-out. If there is a need to disable this facility, set and
3273         export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
3274         running `make` or `build-webkit`, or before running Xcode from the
3275         command line.
3276
3277         Additionally, remove the step that generates a list of source files
3278         going into the UnifiedSources build step. It's only necessarily to
3279         specify Sources.txt and SourcesCocoa.txt as inputs.
3280
3281         No new tests since there should be no observable behavior difference.
3282
3283         * UnifiedSources-input.xcfilelist: Removed.
3284         * WebCore.xcodeproj/project.pbxproj:
3285
3286 2019-02-05  Keith Rollin  <krollin@apple.com>
3287
3288         Update .xcfilelist files
3289         https://bugs.webkit.org/show_bug.cgi?id=194121
3290         <rdar://problem/47720863>
3291
3292         Reviewed by Tim Horton.
3293
3294         Preparatory to enabling the facility for automatically updating the
3295         .xcfilelist files, check in a freshly-updated set so that not everyone
3296         runs up against having to regenerate them themselves.
3297
3298         No new tests since there should be no observable behavior difference.
3299
3300         * DerivedSources-input.xcfilelist:
3301         * DerivedSources-output.xcfilelist:
3302
3303 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3304
3305         Stop using blobRegistry in NetworkProcess
3306         https://bugs.webkit.org/show_bug.cgi?id=194027
3307
3308         Reviewed by Youenn Fablet.
3309
3310         Also stop using NetworkBlobRegistry::singleton.
3311         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
3312         We now have to resolve all blob file references while we still have a
3313         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
3314         using the singleton after we have passed everything to the loading code, but it works the same
3315         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
3316         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
3317         which extensions to revoke.
3318
3319         * platform/network/BlobRegistryImpl.h:
3320         * platform/network/FormData.cpp:
3321         (WebCore::appendBlobResolved):
3322         (WebCore::FormData::resolveBlobReferences):
3323         * platform/network/FormData.h:
3324         * platform/network/cf/FormDataStreamCFNet.cpp:
3325         (WebCore::createHTTPBodyCFReadStream):
3326         * platform/network/curl/CurlFormDataStream.cpp:
3327         (WebCore::CurlFormDataStream::CurlFormDataStream):
3328
3329 2019-02-05  Ryan Haddad  <ryanhaddad@apple.com>
3330
3331         Unreviewed, rolling out r240742.
3332
3333         Causes crashes on iOS simulator.
3334
3335         Reverted changeset:
3336
3337         "[iOS] Keyups for non-modifier keys identified as "Dead" when
3338         not focused in a content-editable element"
3339         https://bugs.webkit.org/show_bug.cgi?id=192824
3340         https://trac.webkit.org/changeset/240742
3341
3342 2019-02-05  Zalan Bujtas  <zalan@apple.com>
3343
3344         [LFC][IFC] collectInlineContent should use pre-computed margins, paddings and borders
3345         https://bugs.webkit.org/show_bug.cgi?id=194269
3346
3347         Reviewed by Antti Koivisto.
3348
3349         In this patch we pre-compute the margins padding and borders for formatting context roots, replaced boxes and non-replaced containers.
3350         These property values are input to collectInlineContent's inline item detaching logic.
3351
3352         * layout/inlineformatting/InlineFormattingContext.cpp:
3353         (WebCore::Layout::nextInPreOrder):
3354         (WebCore::Layout::InlineFormattingContext::layout const):
3355         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
3356         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
3357         * layout/inlineformatting/InlineFormattingContext.h:
3358         * layout/layouttree/LayoutBox.h: ran out bits. 
3359
3360 2019-02-05  Antoine Quint  <graouts@apple.com>
3361
3362         REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
3363         https://bugs.webkit.org/show_bug.cgi?id=194284
3364         <rdar://problem/47774298>
3365
3366         Reviewed by Antti Koivisto.
3367
3368         The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
3369         which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
3370         whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
3371         the latter being called from Style::TreeResolver::resolveElement().
3372
3373         * dom/Document.cpp:
3374         (WebCore::Document::updateTouchActionElements):
3375         * dom/Document.h:
3376         (WebCore::Document::touchActionElements const):
3377
3378 2019-02-05  Benjamin Poulain  <benjamin@webkit.org>
3379
3380         Hit testing functions optimizations
3381         https://bugs.webkit.org/show_bug.cgi?id=194073
3382         <rdar://problem/47692312>
3383
3384         Reviewed by Zalan Bujtas.
3385
3386         This patch implements some easy optimizations that speed up
3387         hit testing without changing the algorithms.
3388
3389         * page/FrameViewLayoutContext.h:
3390         The code for:
3391             view().frameView().layoutContext().isPaintOffsetCacheEnabled()
3392         followed by:
3393             view().frameView().layoutContext().layoutState()
3394         was loading all the intermediate values twice and calling layoutState()
3395         twice.
3396
3397         By marking the function as pure, Clang can CSE the whole thing and
3398         remove the duplicated code.
3399
3400         * platform/graphics/LayoutRect.h:
3401         (WebCore::LayoutRect::isInfinite const):
3402         That one is pretty funny.
3403
3404         Since LayoutRect::isInfinite() was implemented before operator==() is
3405         declared, the compiler was falling back to the implicit convertion to FloatRect()
3406         before doing any comparison.
3407
3408         This explains a bunch of the convertions to float when using LayoutRect.
3409
3410         * rendering/RenderBox.cpp:
3411         (WebCore::RenderBox::mapLocalToContainer const):
3412         Just reoder to make the register nice and clean for the optimization described above.
3413
3414 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
3415
3416         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
3417         https://bugs.webkit.org/show_bug.cgi?id=193993
3418
3419         Reviewed by Keith Miller.
3420
3421         * bindings/scripts/CodeGeneratorJS.pm:
3422         (GenerateHeader):
3423         * bridge/runtime_method.h:
3424
3425 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
3426
3427         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
3428         https://bugs.webkit.org/show_bug.cgi?id=194245
3429
3430         Reviewed by Zalan Bujtas.
3431
3432         ScrollingTreeFixedNode and ScrollingTreeStickyNode are used on iOS and macOS, so move them to the cocoa
3433         directory.
3434
3435         Standardize on the ordering of ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC).
3436
3437         Stop building ScrollingThread for iOS (it's never used), and stub out some functions so things build.
3438
3439         * SourcesCocoa.txt:
3440         * WebCore.xcodeproj/project.pbxproj:
3441         * page/scrolling/ScrollingThread.cpp:
3442         (WebCore::ScrollingThread::initializeRunLoop):
3443         (WebCore::ScrollingThread::wakeUpRunLoop):
3444         (WebCore::ScrollingThread::threadRunLoopSourceCallback):
3445         * page/scrolling/cocoa/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h.
3446         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm.
3447         * page/scrolling/cocoa/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h.
3448         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm.
3449         * page/scrolling/mac/ScrollingThreadMac.mm:
3450         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
3451         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3452
3453 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
3454
3455         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
3456         https://bugs.webkit.org/show_bug.cgi?id=174816
3457
3458         Reviewed by Michael Catanzaro.
3459
3460         Tests: enabled fast/url/user-visible/.
3461
3462         * testing/Internals.cpp:
3463         (WebCore::Internals::userVisibleString): Enable method on all platforms.
3464
3465 2019-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
3466
3467         [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle
3468         https://bugs.webkit.org/show_bug.cgi?id=190895
3469
3470         Reviewed by Ross Kirsling.
3471
3472         An assertion was failing in CurlRequest::invokeDidReceiveResponse
3473         because DidReceiveResponse was already dispatched. This condition
3474         was met if CurlRequestScheduler::completeTransfer is called while
3475         waiting for the reply for the first DidReceiveResponse.
3476
3477         No new tests, covered by existing tests.
3478
3479         * platform/network/curl/CurlRequest.h:
3480         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
3481         Return true if m_didNotifyResponse is false disregard to
3482         m_didReturnFromNotify.
3483
3484 2019-02-04  Said Abou-Hallawa  <said@apple.com>
3485
3486         [CG] Enable setAdditionalSupportedImageTypes for WK1
3487         https://bugs.webkit.org/show_bug.cgi?id=194190
3488
3489         Reviewed by Tim Horton.
3490
3491         Move the function webCoreStringVectorFromNSStringArray from WebKit to
3492         WebCore so it can be used by both WebKit and WebKitLegacy.
3493
3494         * platform/mac/StringUtilities.h:
3495         * platform/mac/StringUtilities.mm:
3496         (WebCore::webCoreStringVectorFromNSStringArray):
3497
3498 2019-02-04  Justin Fan  <justin_fan@apple.com>
3499
3500         [Web GPU] Code clean-up for RenderPipeline backend
3501         https://bugs.webkit.org/show_bug.cgi?id=194238
3502
3503         Reviewed by Dean Jackson.
3504
3505         Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
3506         the input state's descriptor arrays.
3507
3508         Covered by existing tests; no change in behavior.
3509
3510         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3511         (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
3512         (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
3513
3514 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
3515
3516         Use deferrable timer to restart the Responsiveness Timer on each wheel event
3517         https://bugs.webkit.org/show_bug.cgi?id=194135
3518         <rdar://problem/47724099>
3519
3520         Reviewed by Simon Fraser.
3521
3522         The original DeferrableOneShotTimer was not really deferrable.
3523         What it allows is to restart the count down from scratch after
3524         firing.
3525
3526         For this optimization, I want to keep the correct timing but avoid
3527         starting a real timer every time.
3528
3529         I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
3530         created a real DeferrableOneShotTimer that support deadlines.
3531
3532         * css/CSSImageGeneratorValue.cpp:
3533         * html/HTMLPlugInImageElement.h:
3534         * loader/cache/CachedResource.h:
3535         * platform/Timer.cpp:
3536         (WebCore::DeferrableOneShotTimer::startOneShot):
3537         (WebCore::DeferrableOneShotTimer::fired):
3538         * platform/Timer.h:
3539         (WebCore::TimerBase::nextFireTime const):
3540         (WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
3541         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
3542         (WebCore::DeferrableOneShotTimer::stop):
3543         (WebCore::DeferrableOneShotTimer::restart): Deleted.
3544         * platform/graphics/ca/TileController.h:
3545         * platform/graphics/cg/SubimageCacheWithTimer.h:
3546
3547 2019-02-04  Antoine Quint  <graouts@apple.com>
3548
3549         Use constants for pointer types
3550         https://bugs.webkit.org/show_bug.cgi?id=194232
3551
3552         Reviewed by Dean Jackson.
3553
3554         We cannot use an enum for the pointer type since a custom pointer type can be created by developers when creating a
3555         pointer event using JavaScript, but we can at least used string constants for the ones created internally.
3556
3557         * dom/PointerEvent.cpp:
3558         (WebCore::PointerEvent::mousePointerType):
3559         (WebCore::PointerEvent::penPointerType):
3560         (WebCore::PointerEvent::touchPointerType):
3561         * dom/PointerEvent.h:
3562         * dom/ios/PointerEventIOS.cpp:
3563
3564 2019-02-04  Zalan Bujtas  <zalan@apple.com>
3565
3566         [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
3567         https://bugs.webkit.org/show_bug.cgi?id=194168
3568
3569         Reviewed by Simon Fraser.
3570
3571         First paint should not be blocked by async or deferred scripts.
3572
3573         * page/FrameView.cpp:
3574         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
3575
3576 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
3577
3578         Async overflow scroll with border-radius renders incorrectly
3579         https://bugs.webkit.org/show_bug.cgi?id=194205
3580         <rdar://problem/47771668>
3581
3582         Reviewed by Zalan Bujtas.
3583
3584         When an element has composited overflow:scroll and border-radius, we need to make a layer
3585         to clip to the inside of the border radius if necessary.
3586
3587         Existing code simply turned off needsDescendantsClippingLayer for composited scrolling
3588         layers, but now we check to see if the inner border is rounded. If we have both a m_childContainmentLayer
3589         and scrolling layers, we need to adjust the location of the scrolling layers (which are parented
3590         in m_childContainmentLayer).
3591
3592         Also fix offsetFromRenderer for these layers; it's positive for layers inset from the top left
3593         of the border box.
3594
3595         Tests: compositing/clipping/border-radius-async-overflow-clipping-layer.html
3596                compositing/clipping/border-radius-async-overflow-non-stacking.html
3597                compositing/clipping/border-radius-async-overflow-stacking.html
3598
3599         * rendering/RenderLayerBacking.cpp:
3600         (WebCore::RenderLayerBacking::updateConfiguration):
3601         (WebCore::RenderLayerBacking::updateGeometry):
3602         (WebCore::RenderLayerBacking::updateChildClippingStrategy): Layout is always up-to-date now, so remove the comment.
3603
3604 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
3605
3606         PageOverlayController's layers should be created lazily
3607         https://bugs.webkit.org/show_bug.cgi?id=194199
3608
3609         Reviewed by Tim Horton.
3610
3611         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
3612         and use them to only parent the overlay-hosting layers when necessary.
3613
3614         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
3615         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
3616         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
3617         compositing updates that parents the layerWithDocumentOverlays().
3618
3619         View overlays are added to the layer tree via the DrawingArea. When we go between having
3620         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
3621         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
3622         compositing flush (this has to be done manually because view overlay layers are outside the
3623         subtree managed by RenderLayerCompositor).
3624         
3625         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
3626         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
3627         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
3628         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
3629
3630         * loader/EmptyClients.h:
3631         * page/ChromeClient.h:
3632         * page/FrameView.cpp:
3633         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush
3634         because there may be nothing else that does.
3635         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3636         * page/Page.cpp:
3637         (WebCore::Page::installedPageOverlaysChanged):
3638         * page/Page.h:
3639         * page/PageOverlayController.cpp:
3640         (WebCore::PageOverlayController::hasDocumentOverlays const):
3641         (WebCore::PageOverlayController::hasViewOverlays const):
3642         (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it
3643         might as well be the one to call through the ChromeClient.
3644         (WebCore::PageOverlayController::detachViewOverlayLayers):
3645         (WebCore::PageOverlayController::installPageOverlay):
3646         (WebCore::PageOverlayController::uninstallPageOverlay):
3647         * page/PageOverlayController.h:
3648         * rendering/RenderLayerCompositor.cpp:
3649         (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it.
3650         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3651         (WebCore::RenderLayerCompositor::attachRootLayer):
3652         (WebCore::RenderLayerCompositor::detachRootLayer):
3653
3654 2019-02-04  Eric Liang  <ericliang@apple.com>
3655
3656         When performing Increment or Decrement on sliders, check to see if the slider is disabled.
3657         https://bugs.webkit.org/show_bug.cgi?id=173497
3658
3659         Reviewed by Chris Fleizach.
3660
3661         Test: accessibility/set-value-not-work-for-disabled-sliders.html
3662
3663         * accessibility/AccessibilityNodeObject.cpp:
3664         (WebCore::AccessibilityNodeObject::alterSliderValue):
3665
3666 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
3667
3668         IndexedDB: leak WebIDBConnectionToServer in layout tests
3669         https://bugs.webkit.org/show_bug.cgi?id=193688
3670         <rdar://problem/47353263>
3671
3672         Reviewed by Geoffrey Garen.
3673
3674         Let IDBConnectionToServer keep a WeakPtr of IDBConnectionToServerDelegate.
3675
3676         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
3677         (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer):
3678         * Modules/indexeddb/client/IDBConnectionToServer.h:
3679         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
3680
3681 2019-02-04  Youenn Fablet  <youenn@apple.com>
3682
3683         Make sure to remove the device observer in AVVideoCaptureSource
3684         https://bugs.webkit.org/show_bug.cgi?id=194181
3685         <rdar://problem/47739247>
3686
3687         Reviewed by Eric Carlson.
3688
3689         Make sure to remove the device observer when the observer is destroyed.
3690         To simplify things, add the observer in AVVideoCaptureSource constructor and remove it in the destructor.
3691
3692         Make also sure the session observer is also removed whenever the session is released by AVVideoCaptureSource.
3693
3694         Covered by manual test.
3695
3696        * platform/mediastream/mac/AVVideoCaptureSource.h:
3697         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3698         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
3699         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
3700         (WebCore::AVVideoCaptureSource::initializeSession):
3701         (WebCore::AVVideoCaptureSource::clearSession):
3702         (WebCore::AVVideoCaptureSource::stopProducingData):
3703         (WebCore::AVVideoCaptureSource::setupSession):
3704
3705 2019-02-04  Antoine Quint  <graouts@apple.com>
3706
3707         Use a dedicated type instead of int32_t for pointer identifiers
3708         https://bugs.webkit.org/show_bug.cgi?id=194217
3709
3710         Reviewed by Antti Koivisto.
3711
3712         * WebCore.xcodeproj/project.pbxproj:
3713         * dom/PointerEvent.h:
3714         * dom/PointerID.h: Added.
3715         * page/PointerCaptureController.cpp:
3716         (WebCore::PointerCaptureController::setPointerCapture):
3717         (WebCore::PointerCaptureController::releasePointerCapture):
3718         (WebCore::PointerCaptureController::hasPointerCapture):
3719         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
3720         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
3721         (WebCore::PointerCaptureController::cancelPointer):
3722         * page/PointerCaptureController.h:
3723
3724 2019-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3725
3726         [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
3727         Followup to https://bugs.webkit.org/show_bug.cgi?id=193758
3728
3729         Reviewed by Daniel Bates.
3730
3731         Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
3732         behavior.
3733
3734         * editing/EditingBehavior.h:
3735         (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):
3736         * html/HTMLInputElement.cpp:
3737         (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):
3738
3739 2019-02-04  Zalan Bujtas  <zalan@apple.com>
3740
3741         [LFC][IFC] Make InlineFormattingContext::collectInlineContent non-recursive.
3742         https://bugs.webkit.org/show_bug.cgi?id=194210
3743
3744         Reviewed by Antti Koivisto.
3745
3746         Use iterative algorithm to collect inline content (and add breaking rules).
3747         This is in preparation for fixing the inline preferred width computation.  
3748
3749         * layout/Verification.cpp:
3750         (WebCore::Layout::resolveForRelativePositionIfNeeded):
3751         * layout/inlineformatting/InlineFormattingContext.cpp:
3752         (WebCore::Layout::addDetachingRules):
3753         (WebCore::Layout::createAndAppendInlineItem):
3754         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
3755         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): Deleted.
3756         * layout/inlineformatting/InlineFormattingContext.h:
3757
3758 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3759
3760         Unreviewed, fix unused variable warnings introduced in r240912
3761         https://bugs.webkit.org/show_bug.cgi?id=194198
3762         <rdar://problem/47776051>
3763
3764         * page/FrameView.cpp:
3765         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
3766         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3767
3768 2019-02-04  Frederic Wang  <fwang@igalia.com>
3769
3770         [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow
3771         https://bugs.webkit.org/show_bug.cgi?id=191816
3772
3773         Reviewed by Wenson Hsieh.
3774
3775         This patch fixes a bug that prevents children of a scroll container to create snap positions
3776         when they have non-visible overflow. This happens because for such a child, the function
3777         RenderBox::findEnclosingScrollableContainer() will return the child itself rather than the
3778         scroll container. To address that issue, we introduce a new
3779         RenderObject::enclosingScrollableContainerForSnapping() helper function that ensures that
3780         a real RenderBox ancestor is returned.
3781
3782         Test: css3/scroll-snap/scroll-snap-children-with-overflow.html
3783
3784         * page/scrolling/AxisScrollSnapOffsets.cpp:
3785         (WebCore::updateSnapOffsetsForScrollableArea): Use enclosingScrollableContainerForSnapping()
3786         so that we don't skip children with non-visible overflow.
3787         * rendering/RenderLayerModelObject.cpp:
3788         (WebCore::RenderLayerModelObject::styleDidChange): Ditto. The new function calls
3789         enclosingBox().
3790         * rendering/RenderObject.cpp:
3791         (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Return
3792         the scrollable container of the enclosing box. If it is actually the render object itself
3793         then start the search from the parent box instead.
3794         * rendering/RenderObject.h: Declare enclosingScrollableContainerForSnapping(). 
3795
3796 2019-02-04  Antti Koivisto  <antti@apple.com>
3797
3798         Rename GraphicsLayer and PlatformCALayer scrolling layer type enum values to be less ambiguous
3799         https://bugs.webkit.org/show_bug.cgi?id=194215
3800
3801         Reviewed by Frédéric Wang.
3802
3803         GraphicsLayer::Type::Scrolling -> GraphicsLayer::Type::ScrollContainer
3804         PlatformCALayer::LayerTypeScrollingLayer -> PlatformCALayer::LayerTypeScrollContainerLayer
3805
3806         * platform/graphics/GraphicsLayer.cpp:
3807         (WebCore::GraphicsLayer::supportsLayerType):
3808         * platform/graphics/GraphicsLayer.h:
3809         * platform/graphics/ca/GraphicsLayerCA.cpp:
3810         (WebCore::GraphicsLayer::supportsLayerType):
3811         (WebCore::GraphicsLayerCA::initialize):
3812         * platform/graphics/ca/PlatformCALayer.cpp:
3813         (WebCore::operator<<):
3814         * platform/graphics/ca/PlatformCALayer.h:
3815         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3816         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
3817         (WebCore::PlatformCALayerCocoa::commonInit):
3818         * rendering/RenderLayerBacking.cpp:
3819         (WebCore::RenderLayerBacking::updateScrollingLayers):
3820         * rendering/RenderLayerCompositor.cpp:
3821         (WebCore::RenderLayerCompositor::ensureRootLayer):
3822
3823 2019-02-03  Antti Koivisto  <antti@apple.com>
3824
3825         [iOS] Tiles not created in large scrollable iframes
3826         https://bugs.webkit.org/show_bug.cgi?id=193665
3827
3828         Reviewed by Simon Fraser.
3829
3830         We are not syncing scroll position back to the graphics layer tree correctly.
3831
3832         Test by Frédéric Wang.
3833
3834         * page/scrolling/AsyncScrollingCoordinator.cpp:
3835         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3836         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3837         (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
3838
3839         Factor setting and syncing scrolling layer positions into a function.
3840         Use bounds.origin scrolling mechanic when scrollContainerLayer is present.
3841
3842         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
3843         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
3844         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Deleted.
3845         * page/scrolling/AsyncScrollingCoordinator.h:
3846         * page/scrolling/ScrollingCoordinator.cpp:
3847         (WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView):
3848         (WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView):
3849         (WebCore::ScrollingCoordinator::scrollLayerForFrameView): Deleted.
3850         * page/scrolling/ScrollingCoordinator.h:
3851         * rendering/RenderLayerCompositor.cpp:
3852
3853         Rename scrollLayer to scrolledContentsLayer according to out preferred naming scheme and use it in that role only.
3854         Add scrollContainerLayer as a separate layer. It is only constructed when using async scrolling on iOS.
3855
3856         (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
3857         (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation const):
3858         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
3859         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3860         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
3861         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
3862         (WebCore::RenderLayerCompositor::frameViewDidScroll):
3863         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
3864         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
3865         (WebCore::RenderLayerCompositor::updateLayerForHeader):
3866         (WebCore::RenderLayerCompositor::updateLayerForFooter):
3867         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
3868         (WebCore::RenderLayerCompositor::ensureRootLayer):
3869         (WebCore::RenderLayerCompositor::destroyRootLayer):
3870         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3871         * rendering/RenderLayerCompositor.h:
3872
3873 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
3874
3875         Make setNeedsLayout on the root more explicitly about triggering its side-effects
3876         https://bugs.webkit.org/show_bug.cgi?id=194198
3877
3878         Reviewed by Antti Koivisto.
3879
3880         Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree
3881         generally manages its own dirty state.
3882
3883         Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects
3884         of layout, like compositing updates, which are required when view configuration state, like
3885         headers, footers and transparency, change. These dependencies are currently implicit and
3886         poorly defined.
3887
3888         Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure
3889         rendering updates, vs updates of downstream data strutures like compositing. It's now called
3890         setNeedsLayoutAfterViewConfigurationChange(). In addition, expose
3891         setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers
3892         can trigger the appropriate types of compositing updates on the root layer.
3893
3894         In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a
3895         layout. Withtout this, some callers would dirty the RenderView's layout but rely on some
3896         other trigger to make the layout happen.
3897
3898         This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout
3899         but never scheduled it, making banner insertion in MiniBrowser unreliable.
3900
3901         This patch also removes the aliasing of headerHeight/footerHeight between Page and
3902         FrameView. Banners are a property of Page, so FrameView fetches the banner heights
3903         from Page.
3904
3905         * page/FrameView.cpp:
3906         (WebCore::FrameView::headerHeight const):
3907         (WebCore::FrameView::footerHeight const):
3908         (WebCore::FrameView::availableContentSizeChanged):
3909         (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange):
3910         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
3911         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3912         (WebCore::FrameView::scheduleSelectionUpdate):
3913         (WebCore::FrameView::setTransparent):
3914         (WebCore::FrameView::setBaseBackgroundColor):
3915         (WebCore::FrameView::setAutoSizeFixedMinimumHeight):
3916         (WebCore::FrameView::enableAutoSizeMode):
3917         (WebCore::FrameView::setHeaderHeight): Deleted.
3918         (WebCore::FrameView::setFooterHeight): Deleted.
3919         (WebCore::FrameView::setNeedsLayout): Deleted.
3920         * page/FrameView.h:
3921         * page/FrameViewLayoutContext.cpp:
3922         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
3923         (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted.
3924         * page/FrameViewLayoutContext.h:
3925         * page/Page.cpp:
3926         (WebCore::Page::setPageScaleFactor):
3927         (WebCore::Page::setHeaderHeight):
3928         (WebCore::Page::setFooterHeight):
3929         (WebCore::Page::addHeaderWithHeight): Deleted.
3930         (WebCore::Page::addFooterWithHeight): Deleted.
3931         * page/Page.h:
3932         * rendering/RenderLayerCompositor.cpp:
3933         (WebCore::RenderLayerCompositor::updateBacking):
3934         * testing/Internals.cpp:
3935         (WebCore::Internals::resetToConsistentState):
3936         (WebCore::Internals::setHeaderHeight):
3937         (WebCore::Internals::setFooterHeight):
3938
3939 2019-02-03  John Wilander  <wilander@apple.com>
3940
3941         Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
3942         https://bugs.webkit.org/show_bug.cgi?id=194104
3943         <rdar://problem/47649991>
3944
3945         Reviewed by Chris Dumez, Daniel Bates, and Darin Adler.
3946
3947         Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html
3948
3949         This patch adds parsing and validation of the two new Ad Click Attribution