Support Pointer Events on macOS
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-27  Antoine Quint  <graouts@apple.com>
2
3         Support Pointer Events on macOS
4         https://bugs.webkit.org/show_bug.cgi?id=195008
5         <rdar://problem/47454419>
6
7         Reviewed by Dean Jackson.
8
9         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
10         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
11         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
12         and the same behavior also extends to "pointerup".
13
14         Tests: pointerevents/mouse/over-enter-out-leave.html
15                pointerevents/mouse/pointer-capture.html
16                pointerevents/mouse/pointer-event-basic-properties.html
17                pointerevents/mouse/pointer-events-before-mouse-events.html
18                pointerevents/mouse/pointerdown-prevent-default.html
19
20         * Configurations/FeatureDefines.xcconfig:
21         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
22         property does not have any effect on macOS.
23         (WebCore::Document::invalidateRenderingDependentRegions):
24         (WebCore::Document::nodeWillBeRemoved):
25         (WebCore::Document::updateTouchActionElements):
26         * dom/Document.h:
27         * dom/Element.cpp:
28         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
29         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
30         the mouse event.
31         * dom/PointerEvent.cpp:
32         (WebCore::pointerEventType):
33         (WebCore::PointerEvent::create):
34         * dom/PointerEvent.h:
35         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
36         (WebCore::hierarchyHasCapturingEventListeners):
37         (WebCore::EventHandler::updateMouseEventTargetNode):
38         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
39         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
40         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
41         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
42         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
43         it is set.
44         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
45         * style/StyleTreeResolver.cpp:
46         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
47
48 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
49
50         Network Process is put to suspended when holding locked IndexedDB files
51         https://bugs.webkit.org/show_bug.cgi?id=195024
52         <rdar://problem/45194169>
53
54         Reviewed by Geoffrey Garen.
55
56         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
57         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
58         taking background assertion in UI process until the closes are done and locks are released.
59
60         * Modules/indexeddb/server/IDBServer.cpp:
61         (WebCore::IDBServer::IDBServer::create):
62         (WebCore::IDBServer::IDBServer::IDBServer):
63         (WebCore::IDBServer::IDBServer::createBackingStore):
64         (WebCore::IDBServer::IDBServer::closeDatabase):
65         (WebCore::IDBServer::IDBServer::didCloseDatabase):
66         * Modules/indexeddb/server/IDBServer.h:
67         (WebCore::IDBServer::IDBServer::create):
68         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
69         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
70         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
71         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
72         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
73         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
74         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
75         * Modules/indexeddb/server/UniqueIDBDatabase.h:
76
77 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
78
79         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
80         https://bugs.webkit.org/show_bug.cgi?id=194973
81
82         Reviewed by Antti Koivisto.
83
84         This patch cleans up how the scrolling tree responds to scrolls.
85
86         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
87         UI process scroll position.
88
89         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
90         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
91         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
92         updates related layers on this node (counter-scrolling layers etc), and then tells the
93         scrolling tree, which recurses through descendant nodes so they can adjust their layer
94         positions.
95
96         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
97         which does the above other than setting scrolledContentsLayer (since we're reacting to
98         layer state changes, not producing them).
99
100         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
101         ScrollingTree does the tree walk so classes don't have to implement
102         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
103         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
104         need to cross frame boundaries).
105
106         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
107         since the fixed state was computed with the "layout" scroll position, so we have to account
108         for the scroll delta since the last committed position. It's possible we could improve this
109         in future.
110
111         * page/scrolling/ScrollingTree.cpp:
112         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
113         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
114         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
115         (WebCore::ScrollingTree::mainFrameLayoutViewport):
116         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
117         * page/scrolling/ScrollingTree.h:
118         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
119         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
120         * page/scrolling/ScrollingTreeFrameHostingNode.h:
121         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
122         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
123         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
124         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
125         * page/scrolling/ScrollingTreeNode.cpp:
126         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
127         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
128         * page/scrolling/ScrollingTreeNode.h:
129         * page/scrolling/ScrollingTreeScrollingNode.cpp:
130         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
131         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
132         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
133         (WebCore::ScrollingTreeScrollingNode::scrollBy):
134         (WebCore::ScrollingTreeScrollingNode::scrollTo):
135         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
136         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
137         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
138         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
139         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
140         * page/scrolling/ScrollingTreeScrollingNode.h:
141         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
142         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
143         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
144         * page/scrolling/ThreadedScrollingTree.cpp:
145         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
146         * page/scrolling/ThreadedScrollingTree.h:
147         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
148         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
149         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
150         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
151         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
152         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
153         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
154         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
155         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
156         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
157         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
158         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
159         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
160         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
161         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
162         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
163         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
164         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
165         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
166         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
167         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
168         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
169         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
170         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
171         (): Deleted.
172         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
173         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
174         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
175         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
176         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
177         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
178         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
179         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
180         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
181         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
182         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
183         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
184         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
185         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
186         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
187         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
188
189 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
190
191         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
192         https://bugs.webkit.org/show_bug.cgi?id=194973
193
194         Reviewed by Antti Koivisto.
195
196         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
197         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
198         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
199         the layout viewport.
200         
201         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
202         an alias for the scroll position.
203
204         Add some isRootNode() checks for things that should only affect the main frame.
205
206         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
207         no sense here.
208         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
209         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
210         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
211         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
212         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
213         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
214         * page/scrolling/ScrollingTreeScrollingNode.cpp:
215         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
216         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
217         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
218         * page/scrolling/ScrollingTreeScrollingNode.h:
219         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
220         * page/scrolling/ios/ScrollingTreeIOS.cpp:
221         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
222         * page/scrolling/ios/ScrollingTreeIOS.h:
223         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
224         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
225         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
226         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
227         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
228         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
229         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
230         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
231         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
232         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
233         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
234
235 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
236
237         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
238         https://bugs.webkit.org/show_bug.cgi?id=194747
239         <rdar://problem/48148469>
240
241         Reviewed by Jer Noble.
242
243         Prevent unintended frame drops by including last frame duration in discontinuity check. 
244
245         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
246
247         * Modules/mediasource/SourceBuffer.cpp:
248         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
249
250 2019-02-27  Timothy Hatcher  <timothy@apple.com>
251
252         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
253         https://bugs.webkit.org/show_bug.cgi?id=195086
254         rdar://problem/48419124
255
256         Reviewed by Tim Horton.
257
258         * platform/mac/ScrollAnimatorMac.mm:
259         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
260
261 2019-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
262
263         Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
264         https://bugs.webkit.org/show_bug.cgi?id=195067
265         <rdar://problem/44812080>
266
267         Reviewed by Tim Horton.
268
269         This iOS-specific override was introduced to fix <rdar://problem/7114425>, in which the last typed character
270         would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug
271         by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it
272         really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform-
273         specific guards around this logic.
274
275         Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in
276         a very subtle behavior change covered by the new layout test below.
277
278         Test: editing/undo/redo-text-insertion-in-non-editable-node.html
279
280         * editing/InsertIntoTextNodeCommand.cpp:
281         (WebCore::InsertIntoTextNodeCommand::doReapply):
282         * editing/InsertIntoTextNodeCommand.h:
283
284 2019-02-26  Keith Miller  <keith_miller@apple.com>
285
286         Code quality cleanup in NeverDestroyed
287         https://bugs.webkit.org/show_bug.cgi?id=194824
288
289         Reviewed by Mark Lam.
290
291         name_names.pl should not just assume the layout of LazyNeverDestroyed.
292
293         * dom/make_names.pl:
294         (printNamesCppFile):
295
296 2019-02-26  Zalan Bujtas  <zalan@apple.com>
297
298         Do not try to observe the timer when Page is nullptr
299         https://bugs.webkit.org/show_bug.cgi?id=195076
300
301         Reviewed by Tim Horton.
302
303         Covered by fast/dom/Window/timer-null-script-execution-context.html.
304
305         * page/DOMTimer.cpp:
306         (WebCore::DOMTimer::install):
307
308 2019-02-20  Jer Noble  <jer.noble@apple.com>
309
310         [Cocoa] Media elements will restart network buffering just before suspending
311         https://bugs.webkit.org/show_bug.cgi?id=193691
312
313         Reviewed by Eric Carlson.
314
315         API Test: WebKit.ProcessSuspendMediaBuffering
316
317         Allow the Page to suspend all media buffering in its child Documents.
318
319         * dom/Document.cpp:
320         (WebCore::Document::suspendAllMediaBuffering):
321         (WebCore::Document::resumeAllMediaBuffering):
322         * dom/Document.h:
323         * html/MediaElementSession.cpp:
324         (WebCore::MediaElementSession::dataBufferingPermitted const):
325         (WebCore::MediaElementSession::suspendBuffering):
326         (WebCore::MediaElementSession::resumeBuffering):
327         (WebCore::MediaElementSession::bufferingSuspended const):
328         * html/MediaElementSession.h:
329         * page/Page.cpp:
330         (WebCore::Page::suspendAllMediaBuffering):
331         (WebCore::Page::resumeAllMediaBuffering):
332         * page/Page.h:
333         (WebCore::Page::mediaPlaybackIsSuspended const):
334         (WebCore::Page::mediaBufferingIsSuspended const):
335         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
336         * platform/audio/PlatformMediaSession.h:
337         (WebCore::PlatformMediaSession::suspendBuffering):
338         (WebCore::PlatformMediaSession::resumeBuffering):
339         * platform/audio/PlatformMediaSessionManager.cpp:
340         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
341         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
342         * platform/audio/PlatformMediaSessionManager.h:
343
344 2019-02-26  Youenn Fablet  <youenn@apple.com>
345
346         Move service worker response validation from the service worker client to the service worker itself
347         https://bugs.webkit.org/show_bug.cgi?id=194716
348
349         Reviewed by Geoffrey Garen.
350
351         Added response validation at service worker side.
352
353         No change of behavior except for now logging validation error messages in the console.
354         Covered by rebased tests.
355
356         * workers/service/context/ServiceWorkerFetch.cpp:
357         (WebCore::ServiceWorkerFetch::validateResponse):
358         (WebCore::ServiceWorkerFetch::processResponse):
359         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
360
361 2019-02-26  Sihui Liu  <sihui_liu@apple.com>
362
363         [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky
364         https://bugs.webkit.org/show_bug.cgi?id=195036
365
366         Reviewed by Geoffrey Garen.
367
368         When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but 
369         also transactions in committing process.
370
371         Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise 
372         there is a reference cycle of TransactionOpration.
373
374         Covered by existing tests storage/indexeddb/IDBObject-leak.html.
375
376         * Modules/indexeddb/IDBDatabase.cpp:
377         (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost.
378         * Modules/indexeddb/IDBTransaction.cpp:
379         (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends.
380         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
381         (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions.
382         * Modules/indexeddb/client/IDBConnectionProxy.h:
383         * Modules/indexeddb/client/TransactionOperation.h:
384         (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the 
385         operation is in completion process. 
386
387 2019-02-26  Zalan Bujtas  <zalan@apple.com>
388
389         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
390         https://bugs.webkit.org/show_bug.cgi?id=195066
391         <rdar://problem/48411682>
392
393         Reviewed by Tim Horton.
394
395         Now all the empty clearContentChangeObservers() implementations can be removed.
396
397         * dom/Document.cpp:
398         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
399         * loader/EmptyClients.h:
400         * page/ChromeClient.h:
401         * page/Frame.cpp:
402         (WebCore::Frame::willDetachPage):
403         * page/ios/ContentChangeObserver.h:
404         * page/ios/ContentChangeObserver.mm:
405         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
406         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
407         (WebCore::ContentChangeObserver::willDetachPage):
408
409 2019-02-26  Zalan Bujtas  <zalan@apple.com>
410
411         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
412         https://bugs.webkit.org/show_bug.cgi?id=195062
413         <rdar://problem/48409258>
414
415         Reviewed by Tim Horton.
416
417         Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
418
419         * dom/Document.cpp:
420         (WebCore::Document::scheduleStyleRecalc):
421         * page/DOMTimer.cpp:
422         (WebCore::DOMTimer::install):
423         * page/ios/ContentChangeObserver.h:
424         * page/ios/ContentChangeObserver.mm:
425         (WebCore::ContentChangeObserver::didInstallDOMTimer):
426         (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
427         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
428
429 2019-02-26  Chris Dumez  <cdumez@apple.com>
430
431         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
432         https://bugs.webkit.org/show_bug.cgi?id=195054
433         <rdar://problem/48330549>
434
435         Reviewed by Geoff Garen.
436
437         Add MaintainMemoryCache flag to indicate that the memory cache should not get purged.
438
439         * page/MemoryRelease.cpp:
440         (WebCore::releaseNoncriticalMemory):
441         (WebCore::releaseCriticalMemory):
442         (WebCore::releaseMemory):
443         * page/MemoryRelease.h:
444
445 2019-02-26  Commit Queue  <commit-queue@webkit.org>
446
447         Unreviewed, rolling out r241970.
448         https://bugs.webkit.org/show_bug.cgi?id=195057
449
450         made the QuickLook.LegacyQuickLookContent API test flakey
451         (Requested by estes on #webkit).
452
453         Reverted changeset:
454
455         "[iOS] Break a reference cycle between PreviewLoader and
456         ResourceLoader"
457         https://bugs.webkit.org/show_bug.cgi?id=194964
458         https://trac.webkit.org/changeset/241970
459
460 2019-02-26  Zalan Bujtas  <zalan@apple.com>
461
462         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
463         https://bugs.webkit.org/show_bug.cgi?id=195023
464         <rdar://problem/48381885>
465
466         Reviewed by Tim Horton.
467
468         In the future we might decide that certain activities don't require DOMTimer observation, but that should
469         be internal to ContentChangeObserver.
470
471         * page/ios/ContentChangeObserver.h:
472         * page/ios/ContentChangeObserver.mm:
473         (WebCore::ContentChangeObserver::startObservingContentChanges):
474         (WebCore::ContentChangeObserver::stopObservingContentChanges):
475         * page/ios/EventHandlerIOS.mm:
476         (WebCore::EventHandler::mouseMoved):
477
478 2019-02-26  Zalan Bujtas  <zalan@apple.com>
479
480         [ContentChangeObserver] Move observing logic from Document::updateStyleIfNeeded to ContentChangeObserver
481         https://bugs.webkit.org/show_bug.cgi?id=195032
482         <rdar://problem/48388063>
483
484         Reviewed by Tim Horton.
485
486         This might eventually turn into a regular start/stop content observing call.
487
488         * dom/Document.cpp:
489         (WebCore::Document::updateStyleIfNeeded):
490         * page/ios/ContentChangeObserver.h:
491         * page/ios/ContentChangeObserver.mm:
492         (WebCore::ContentChangeObserver::startObservingStyleResolve):
493         (WebCore::ContentChangeObserver::stopObservingStyleResolve):
494
495 2019-02-26  Zalan Bujtas  <zalan@apple.com>
496
497         [ContentChangeObserver] Move CheckForVisibilityChange to ContentChangeObserver class
498         https://bugs.webkit.org/show_bug.cgi?id=195035
499         <rdar://problem/48389123>
500
501         Reviewed by Tim Horton.
502
503         Visibility checking logic belongs to ContentChangeObserver.
504
505         * page/ios/ContentChangeObserver.h:
506         * page/ios/ContentChangeObserver.mm:
507         (WebCore::elementImplicitVisibility):
508         (WebCore::ContentChangeObserver::StyleChange::StyleChange):
509         (WebCore::ContentChangeObserver::StyleChange::~StyleChange):
510         * rendering/updating/RenderTreeUpdater.cpp:
511         (WebCore::RenderTreeUpdater::updateElementRenderer):
512         (WebCore::elementImplicitVisibility): Deleted.
513         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): Deleted.
514         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): Deleted.
515
516 2019-02-26  Philippe Normand  <pnormand@igalia.com>
517
518         [EGL] Runtime support for RGB565 pixel layout
519         https://bugs.webkit.org/show_bug.cgi?id=194817
520
521         Reviewed by Carlos Garcia Campos.
522
523         Currently our graphics pipeline always relies on a ARGB8888 (32
524         bpp) pixel configuration. On some low-end (old) embedded platforms
525         the graphics driver is sometimes optimized for 16 bpp
526         configurations, such as RGB565. On those platforms the application
527         can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to
528         "RGB565" to adjust to the best pixel configuration supported by
529         the screen and graphics driver.
530
531         * platform/graphics/egl/GLContextEGL.cpp:
532         (WebCore::GLContextEGL::getEGLConfig):
533
534 2019-02-26  Philippe Normand  <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
535
536         [WPE] Add API for webview background color configuration
537         https://bugs.webkit.org/show_bug.cgi?id=192305
538
539         Reviewed by Michael Catanzaro.
540
541         Adapt the FrameView API to allow a default non-white background color.
542
543         * page/Frame.cpp:
544         (WebCore::Frame::createView): Replace isTransparent argument with a background color one.
545         * page/Frame.h:
546         * page/FrameView.cpp:
547         (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
548         (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
549         used only in non-dark-mode-css build configurations.
550         * page/FrameView.h:
551         * testing/Internals.cpp:
552         (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.
553
554 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
555
556         scalableNativeWebpageParameters() is not preserved on new page navigation.
557         https://bugs.webkit.org/show_bug.cgi?id=194892
558         <rdar://problem/47538280>
559
560         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
561         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
562         configuration until we derive the right values from viewport meta-tag.
563
564         Reviewed by Wenson Hsieh.
565
566         Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html
567
568         * page/ViewportConfiguration.cpp:
569         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters().
570         (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters.
571         (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration
572             based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth().
573         (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters()
574         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters.
575         * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old
576             static method to fixedNativeWebpageParameters which better reflects the actual behavior.
577
578 2019-02-25  Zalan Bujtas  <zalan@apple.com>
579
580         [ContentChangeObserver] Move observing logic from DOMWindow::clearTimeout to ContentChangeObserver
581         https://bugs.webkit.org/show_bug.cgi?id=194988
582         <rdar://problem/48343040>
583
584         Reviewed by Tim Horton.
585
586         ContentChangeObserver::removeDOMTimer takes care of the canceled timer removal.
587
588         * page/DOMWindow.cpp:
589         (WebCore::DOMWindow::clearTimeout):
590         * page/ios/ContentChangeObserver.h:
591         * page/ios/ContentChangeObserver.mm:
592         (WebCore::ContentChangeObserver::startObservingDOMTimer):
593         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
594         (WebCore::ContentChangeObserver::removeDOMTimer):
595
596 2019-02-25  Zalan Bujtas  <zalan@apple.com>
597
598         [ContentChangeObserver] Move observing logic from DOMTimer to ContentChangeObserver
599         https://bugs.webkit.org/show_bug.cgi?id=194987
600         <rdar://problem/48342910>
601
602         Reviewed by Tim Horton.
603
604         Content obvservation logic should all move to the ContentChangeObserver class.
605
606         * page/DOMTimer.cpp:
607         (WebCore::DOMTimer::install):
608         (WebCore::DOMTimer::fired):
609         * page/Page.cpp:
610         (WebCore::Page::Page):
611         * page/Page.h:
612         (WebCore::Page::contentChangeObserver):
613         * page/ios/ContentChangeObserver.h:
614         * page/ios/ContentChangeObserver.mm:
615         (WebCore::ContentChangeObserver::ContentChangeObserver):
616         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded):
617         (WebCore::ContentChangeObserver::startObservingDOMTimer):
618         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
619         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
620         (WebCore::ContentChangeObserver::addObservedDOMTimer):
621         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
622
623 2019-02-25  John Wilander  <wilander@apple.com>
624
625         Introduce and adopt new class RegistrableDomain for eTLD+1
626         https://bugs.webkit.org/show_bug.cgi?id=194791
627         <rdar://problem/48179240>
628
629         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
630
631         A new API test was added. Plenty of existing layout tests under
632         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
633
634         This patch introduces and adopts a new class called WebCore::RegistrableDomain
635         which represents a domain's eTLD+1 (effective top level domain plus one) and is
636         the basis for the term "site," as in same-site. Other popular names include
637         high-level domain, primary domain, and top privately controlled/owned domain.
638         Effective top level domains are enumerated on the Public Suffix List
639         (https://publicsuffix.org).
640
641         This class just uses the full domain for when the Public Suffix List cannot help
642         finding the registrable domain and for WebKit ports that haven't enabled
643         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
644         for the null or unique origin (this matches how these origins were handled
645         before).
646
647         The implementation is a wrapper around a String and the functions and class
648         members that now make use of this new class used to handle regular String
649         objects which didn't help much in terms of type safety or guarantees that the
650         string had already been converted to an eTLD+1.
651
652         We've at least two bad bugs in the Storage Access API because of confusion
653         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
654         will prohibit such bugs in the future.
655
656         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
657         WebCore::RegistrableDomain for partitioning in a later patch.
658
659         This patch also enhances parameter naming by:
660         - Removing parts that refer to "primary" as in primaryDomain.
661         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
662         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
663         - Using the term "domain" consistently instead of e.g. "host."
664
665         * WebCore.xcodeproj/project.pbxproj:
666         * dom/Document.cpp:
667         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
668         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
669         * dom/Document.h:
670         * html/HTMLAnchorElement.cpp:
671         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
672         * html/HTMLMediaElement.cpp:
673         (WebCore::HTMLMediaElement::mediaSessionTitle const):
674         * loader/AdClickAttribution.cpp:
675         (WebCore::AdClickAttribution::url const):
676         (WebCore::AdClickAttribution::referrer const):
677         (WebCore::AdClickAttribution::toString const):
678         * loader/AdClickAttribution.h:
679         (WebCore::AdClickAttribution::Source::Source):
680         (WebCore::AdClickAttribution::Source::matches const):
681         (WebCore::AdClickAttribution::Source::deleteValue):
682         (WebCore::AdClickAttribution::Destination::Destination):
683         (WebCore::AdClickAttribution::Destination::matches const):
684         (WebCore::AdClickAttribution::Destination::deleteValue):
685         * loader/ResourceLoadObserver.cpp:
686         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
687         (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
688         (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
689         (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
690         (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
691         (WebCore::ResourceLoadObserver::logSubresourceLoading):
692         (WebCore::ResourceLoadObserver::logWebSocketLoading):
693         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
694         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
695         (WebCore::ResourceLoadObserver::logFontLoad):
696         (WebCore::ResourceLoadObserver::logCanvasRead):
697         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
698         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
699         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
700         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
701         (WebCore::ResourceLoadObserver::statisticsForOrigin):
702         (WebCore::primaryDomain): Deleted.
703         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
704         * loader/ResourceLoadObserver.h:
705         * loader/ResourceLoadStatistics.cpp:
706         (WebCore::ResourceLoadStatistics::encode const):
707         (WebCore::ResourceLoadStatistics::decode):
708         (WebCore::ResourceLoadStatistics::toString const):
709         (WebCore::ResourceLoadStatistics::merge):
710         (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
711         * loader/ResourceLoadStatistics.h:
712         (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
713         * page/Page.cpp:
714         (WebCore::Page::logNavigation):
715         (WebCore::Page::mainFrameLoadStarted):
716         * page/Page.h:
717         * page/PerformanceMonitor.cpp:
718         (WebCore::reportPageOverPostLoadResourceThreshold):
719         * platform/RegistrableDomain.h: Added.
720         (WebCore::RegistrableDomain::RegistrableDomain):
721         (WebCore::RegistrableDomain::isEmpty const):
722         (WebCore::RegistrableDomain::string const):
723         (WebCore::RegistrableDomain::operator!= const):
724         (WebCore::RegistrableDomain::operator== const):
725         (WebCore::RegistrableDomain::matches const):
726         (WebCore::RegistrableDomain::isolatedCopy const):
727         (WebCore::RegistrableDomain::isHashTableDeletedValue const):
728         (WebCore::RegistrableDomain::hash const):
729         (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
730         (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
731         (WebCore::RegistrableDomain::encode const):
732         (WebCore::RegistrableDomain::decode):
733         * platform/network/NetworkStorageSession.cpp:
734         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
735         (WebCore::NetworkStorageSession::shouldBlockCookies const):
736         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
737         (WebCore::NetworkStorageSession::removePrevalentDomains):
738         (WebCore::NetworkStorageSession::hasStorageAccess const):
739         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
740         (WebCore::NetworkStorageSession::grantStorageAccess):
741         (WebCore::getPartitioningDomain): Deleted.
742         * platform/network/NetworkStorageSession.h:
743
744 2019-02-25  Chris Fleizach  <cfleizach@apple.com>
745
746         AX: <footer> HTML5 tag not reading as ARIA Landmark to VoiceOver
747         https://bugs.webkit.org/show_bug.cgi?id=190138
748         <rdar://problem/44907695>
749
750         Reviewed by Joanmarie Diggs.
751
752         Make sure that footer elements use the right role depending on their context.
753         If scoped to body, they become contentinfo. Otherwise they are just delineated by
754         a footer subrole.
755
756         * accessibility/AccessibilityObject.cpp:
757         (WebCore::AccessibilityObject::isLandmark const):
758         * accessibility/AccessibilityRenderObject.cpp:
759         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
760         (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
761         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
762         * accessibility/AccessibilityRenderObject.h:
763         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
764         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
765         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
766         (-[WebAccessibilityObjectWrapper subrole]):
767
768 2019-02-25  Sihui Liu  <sihui_liu@apple.com>
769
770         IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
771         https://bugs.webkit.org/show_bug.cgi?id=194709
772
773         Reviewed by Geoffrey Garen.
774
775         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
776         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
777  
778         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
779         between IDBOpenDBRequest and IDBTransaction.
780
781         Test: storage/indexeddb/IDBObject-leak.html
782
783         * Modules/indexeddb/IDBDatabase.cpp:
784         (WebCore::IDBDatabase::connectionToServerLost):
785         * Modules/indexeddb/IDBTransaction.cpp:
786         (WebCore::IDBTransaction::IDBTransaction):
787         (WebCore::IDBTransaction::~IDBTransaction):
788         (WebCore::IDBTransaction::connectionClosedFromServer):
789         * Modules/indexeddb/IDBTransaction.h:
790         * testing/Internals.cpp:
791         (WebCore::Internals::numberOfIDBTransactions const):
792         * testing/Internals.h:
793         * testing/Internals.idl:
794
795 2019-02-25  Zalan Bujtas  <zalan@apple.com>
796
797         Add missing stream parameter. Unreviewed.
798
799         * page/DOMTimer.cpp:
800         (WebCore::DOMTimer::fired):
801
802 2019-02-25  Zalan Bujtas  <zalan@apple.com>
803
804         Unreviewed build fix after r242032.
805
806         * page/DOMTimer.cpp:
807         (WebCore::DOMTimer::install):
808
809 2019-02-20  Darin Adler  <darin@apple.com>
810
811         Incorrect use of String::foldCase for font family names
812         https://bugs.webkit.org/show_bug.cgi?id=194895
813
814         Reviewed by Myles C. Maxfield.
815
816         * platform/graphics/FontCascadeDescription.cpp:
817         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
818         familyNamesAreEqual instead of calling convertToASCIILowercase directly.
819         (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
820         operator== when we want case sensitive family name comparisons. This is a special
821         case to accomodate CoreText, which uses "."-prefix names for internal fonts that
822         are treated case sensitively. (Ideally webpages would not use these fonts at all.)
823         (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
824         when we want case sensitive family name hashing.
825         (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
826         AtomicString so we can use this at an additional call site. Converting from an
827         AtomicString to a String if free and automatic at the existing call sites. Use
828         convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
829         here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
830         must be consistent. 2) this is considerably faster, and 3) font family names don't
831         need arbitrary Unicode case folding, it's only A-Z that should be folded.
832         * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
833         in the foldedFamilyName function.
834
835         * platform/graphics/cocoa/FontCacheCoreText.cpp:
836         (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
837         FontCascadeDescription::foldedFamilyName to correctly fold font family names.
838
839 2019-02-25  Charlie Turner  <cturner@igalia.com>
840
841         [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
842         https://bugs.webkit.org/show_bug.cgi?id=194992
843
844         Reviewed by Xabier Rodriguez-Calvar.
845
846         Refactoring, no new tests.
847
848         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
849         (transformCaps): Simplify the code a little. The idea to use this
850         utility function came from a review upstream here:
851         https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
852
853 2019-02-25  Alicia Boya García  <aboya@igalia.com>
854
855         [MSE][GStreamer] Batch player duration updates
856         https://bugs.webkit.org/show_bug.cgi?id=194220
857
858         Reviewed by Xabier Rodriguez-Calvar.
859
860         This saves up a ton of CPU cycles doing layout unnecessarily when all
861         the appended frames extend the duration of the movie, like in
862         YTTV 2018 59.DASHLatencyVP9.
863
864         This patch is an optimization that introduces no new behavior.
865
866         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
867         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
868         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
869         (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges):
870         (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
871         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
872         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
873
874 2019-02-25  Miguel Gomez  <magomez@igalia.com>
875
876         [WPE] Add support for holepunch using an external video player
877         https://bugs.webkit.org/show_bug.cgi?id=194899
878
879         Reviewed by Xabier Rodriguez-Calvar.
880
881         Implement the holepunch feature to allow playback using an external player. This creates
882         a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and
883         whose goal is to just draw a transparent rectangle in the position where the video should be.
884         This can be used to allow a player placed on a lower plane than the browser to become visible.
885
886         Added ManualTest wpe/video-player-holepunch-external.html to test the feature.
887
888         * PlatformWPE.cmake:
889         * platform/HolePunch.cmake: Added.
890         * platform/graphics/MediaPlayer.cpp:
891         (WebCore::buildMediaEnginesVector):
892         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added.
893         (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch):
894         (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch):
895         (WebCore::MediaPlayerPrivateHolePunch::platformLayer const):
896         (WebCore::MediaPlayerPrivateHolePunch::naturalSize const):
897         (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
898         (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded):
899         (WebCore::MediaPlayerPrivateHolePunch::proxy const):
900         (WebCore::mimeTypeCache):
901         (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes):
902         (WebCore::MediaPlayerPrivateHolePunch::supportsType):
903         (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine):
904         (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState):
905         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added.
906         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
907         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
908
909 2019-02-24  Zalan Bujtas  <zalan@apple.com>
910
911         Introduce ContentChangeObserver class
912         https://bugs.webkit.org/show_bug.cgi?id=194977
913         <rdar://problem/48338115>
914
915         Reviewed by Simon Fraser.
916
917         This patch is about piping through all the related WK* calls. 
918
919         * SourcesCocoa.txt:
920         * WebCore.xcodeproj/project.pbxproj:
921         * dom/Document.cpp:
922         (WebCore::Document::scheduleStyleRecalc):
923         (WebCore::Document::updateStyleIfNeeded):
924         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
925         * loader/FrameLoader.cpp:
926         * page/DOMTimer.cpp:
927         (WebCore::DOMTimer::install):
928         (WebCore::DOMTimer::fired):
929         * page/DOMWindow.cpp:
930         (WebCore::DOMWindow::clearTimeout):
931         * page/Frame.cpp:
932         (WebCore::Frame::willDetachPage):
933         * page/Page.h:
934         (WebCore::Page::contentChangeObserver):
935         * page/ios/EventHandlerIOS.mm:
936         (WebCore::EventHandler::mouseMoved):
937         * rendering/updating/RenderTreeUpdater.cpp:
938         (WebCore::RenderTreeUpdater::updateElementRenderer):
939         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange):
940         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
941
942 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
943
944         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
945         https://bugs.webkit.org/show_bug.cgi?id=194984
946
947         Reviewed by Sam Weinig.
948
949         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
950
951         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
952         current layout viewport rect. Instead, set the layout viewport on the root
953         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
954
955         * page/scrolling/ScrollingTree.cpp:
956         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
957         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
958         * page/scrolling/ScrollingTree.h:
959         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
960         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
961         * page/scrolling/ScrollingTreeFrameHostingNode.h:
962         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
963         * page/scrolling/ScrollingTreeNode.h:
964         * page/scrolling/ScrollingTreeScrollingNode.cpp:
965         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
966         * page/scrolling/ScrollingTreeScrollingNode.h:
967         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
968         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
969         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
970         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
971         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
972         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
973         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
974         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
975         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
976         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
977         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
978
979 2019-02-24  Devin Rousso  <drousso@apple.com>
980
981         Web Inspector: Change the InspectorOverlay to use native rather than canvas
982         https://bugs.webkit.org/show_bug.cgi?id=105023
983         <rdar://problem/13443692>
984
985         Reviewed by Brian Burg.
986
987         Should be no change in observed functionality.
988
989         * inspector/InspectorOverlay.h:
990         * inspector/InspectorOverlay.cpp:
991         (WebCore::truncateWithEllipsis): Added.
992         (WebCore::localPointToRootPoint): Added.
993         (WebCore::contentsQuadToCoordinateSystem):
994         (WebCore::effectiveElementForNode): Added.
995         (WebCore::quadToPath): Added.
996         (WebCore::drawOutlinedQuadWithClip): Added.
997         (WebCore::drawOutlinedQuad): Added.
998         (WebCore::drawFragmentHighlight): Added.
999         (WebCore::drawShapeHighlight): Added.
1000         (WebCore::InspectorOverlay::paint):
1001         (WebCore::InspectorOverlay::setIndicating):
1002         (WebCore::InspectorOverlay::shouldShowOverlay const):
1003         (WebCore::InspectorOverlay::update):
1004         (WebCore::InspectorOverlay::setShowPaintRects): Added.
1005         (WebCore::InspectorOverlay::showPaintRect):
1006         (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
1007         (WebCore::InspectorOverlay::drawNodeHighlight):
1008         (WebCore::InspectorOverlay::drawQuadHighlight):
1009         (WebCore::InspectorOverlay::drawPaintRects):
1010         (WebCore::InspectorOverlay::drawBounds): Added.
1011         (WebCore::InspectorOverlay::drawRulers):
1012         (WebCore::InspectorOverlay::drawElementTitle): Added.
1013         (WebCore::contentsQuadToPage): Deleted.
1014         (WebCore::InspectorOverlay::setPausedInDebuggerMessage): Deleted.
1015         (WebCore::buildObjectForPoint): Deleted.
1016         (WebCore::buildObjectForRect): Deleted.
1017         (WebCore::buildArrayForQuad): Deleted.
1018         (WebCore::buildObjectForHighlight): Deleted.
1019         (WebCore::buildObjectForSize): Deleted.
1020         (WebCore::InspectorOverlay::setShowingPaintRects): Deleted.
1021         (WebCore::buildArrayForRendererFragments): Deleted.
1022         (WebCore::localPointToRoot): Deleted.
1023         (WebCore::appendPathCommandAndPoints): Deleted.
1024         (WebCore::appendPathSegment): Deleted.
1025         (WebCore::buildObjectForShapeOutside): Deleted.
1026         (WebCore::buildObjectForElementData): Deleted.
1027         (WebCore::InspectorOverlay::buildHighlightObjectForNode const): Deleted.
1028         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const): Deleted.
1029         (WebCore::InspectorOverlay::drawPausedInDebuggerMessage): Deleted.
1030         (WebCore::InspectorOverlay::overlayPage): Deleted.
1031         (WebCore::InspectorOverlay::forcePaint): Deleted.
1032         (WebCore::InspectorOverlay::reset): Deleted.
1033         (WebCore::evaluateCommandInOverlay): Deleted.
1034         (WebCore::InspectorOverlay::evaluateInOverlay): Deleted.
1035         (WebCore::InspectorOverlay::freePage): Deleted.
1036
1037         * inspector/agents/InspectorPageAgent.cpp:
1038         (WebCore::InspectorPageAgent::disable):
1039         (WebCore::InspectorPageAgent::setShowPaintRects):
1040         Drive-by: rename `setShowingPaintRects` to better match the protocol.
1041
1042         * inspector/agents/page/PageDebuggerAgent.h:
1043         * inspector/agents/page/PageDebuggerAgent.cpp:
1044         (WebCore::PageDebuggerAgent::PageDebuggerAgent):
1045         (WebCore::PageDebuggerAgent::setOverlayMessage): Deleted.
1046         Remove `Debugger.setOverlayMessage` command as it hasn't been used and is no longer supported.
1047
1048         * inspector/InspectorController.h:
1049         * inspector/InspectorController.cpp:
1050         (WebCore::InspectorController::createLazyAgents):
1051         (WebCore::InspectorController::disconnectFrontend):
1052         (WebCore::InspectorController::disconnectAllFrontends):
1053         (WebCore::InspectorController::buildObjectForHighlightedNodes const): Deleted.
1054
1055         * testing/Internals.h:
1056         * testing/Internals.idl:
1057         * testing/Internals.cpp:
1058         (WebCore::Internals::inspectorHighlightObject): Deleted.
1059
1060         * inspector/InspectorOverlayPage.css: Removed.
1061         * inspector/InspectorOverlayPage.html: Removed.
1062         * inspector/InspectorOverlayPage.js: Removed.
1063
1064         * CMakeLists.txt:
1065         * DerivedSources-input.xcfilelist:
1066         * DerivedSources-output.xcfilelist:
1067         * DerivedSources.make:
1068         * WebCore.xcodeproj/project.pbxproj:
1069
1070 2019-02-20  Darin Adler  <darin@apple.com>
1071
1072         Finish removing String::format
1073         https://bugs.webkit.org/show_bug.cgi?id=194893
1074
1075         Reviewed by Daniel Bates.
1076
1077         * dom/Document.cpp:
1078         (WebCore::Document::lastModified const): Use makeString and pad.
1079         * html/FTPDirectoryDocument.cpp:
1080         (WebCore::processFileDateString): Ditto.
1081
1082         * mathml/MathMLElement.cpp:
1083         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
1084
1085         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1086         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
1087
1088         * page/linux/ResourceUsageOverlayLinux.cpp:
1089         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
1090         (WebCore::gcTimerString): Use String::number.
1091
1092         * platform/DateComponents.cpp:
1093         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
1094         (WebCore::DateComponents::toString const): Ditto.
1095
1096         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
1097         and that was also inaccurate.
1098
1099         * platform/audio/HRTFElevation.cpp:
1100         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1101         Use makeString and pad.
1102         * platform/mock/MockRealtimeVideoSource.cpp:
1103         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
1104         * rendering/RenderLayerCompositor.cpp:
1105         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
1106         * rendering/RenderTheme.cpp:
1107         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
1108
1109 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1110
1111         [WPE][GTK] Remove user agent quirk for washingtonpost.com
1112         https://bugs.webkit.org/show_bug.cgi?id=194981
1113
1114         Reviewed by Žan Doberšek.
1115
1116         Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now.
1117
1118         * platform/UserAgentQuirks.cpp:
1119         (WebCore::urlRequiresChromeBrowser):
1120
1121 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
1122
1123         Remove remnants of iOS WK1 scrolling tree code
1124         https://bugs.webkit.org/show_bug.cgi?id=194980
1125
1126         Reviewed by Sam Weinig.
1127
1128         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
1129         to reduce maintenance costs and simplify.
1130
1131         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
1132         since that was the only concrete subclass, removing code which never applies to iOS WK2
1133         (e.g. the synchronous scrolling code path).
1134
1135         * SourcesCocoa.txt:
1136         * WebCore.xcodeproj/project.pbxproj:
1137         * page/FrameView.h:
1138         * page/scrolling/ScrollingCoordinator.cpp:
1139         * page/scrolling/ScrollingTree.h:
1140         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1141         * page/scrolling/ScrollingTreeNode.h:
1142         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1143         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
1144         * page/scrolling/ScrollingTreeScrollingNode.h:
1145         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
1146         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
1147         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
1148         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
1149         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
1150         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
1151         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
1152         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
1153         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
1154         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
1155         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
1156         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
1157         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
1158         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
1159         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
1160         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
1161         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
1162         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
1163         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
1164         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
1165         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
1166         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
1167         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
1168         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
1169         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
1170         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
1171         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
1172         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
1173         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
1174         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
1175         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
1176         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
1177         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1178         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1179
1180 2019-02-23  Justin Fan  <justin_fan@apple.com>
1181
1182         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
1183         https://bugs.webkit.org/show_bug.cgi?id=194665
1184
1185         Reviewed by Dean Jackson.
1186
1187         Test: map-write-buffers.html. Other tests updated to match new API.
1188
1189         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
1190         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
1191         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
1192         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
1193         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
1194         (WebCore::WebGPUBuffer::create):
1195         (WebCore::WebGPUBuffer::WebGPUBuffer):
1196         (WebCore::WebGPUBuffer::mapReadAsync):
1197         (WebCore::WebGPUBuffer::mapWriteAsync):
1198         (WebCore::WebGPUBuffer::unmap):
1199         (WebCore::WebGPUBuffer::destroy):
1200         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
1201         * Modules/webgpu/WebGPUBuffer.h:
1202         (WebCore::WebGPUBuffer::buffer const):
1203         (WebCore::WebGPUBuffer::mapping const): Deleted.
1204         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
1205         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1206         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
1207         * Modules/webgpu/WebGPUDevice.cpp:
1208         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
1209         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
1210         * Modules/webgpu/WebGPUDevice.h:
1211         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
1212         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
1213         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
1214         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
1215         * platform/graphics/gpu/GPUBuffer.cpp: Added.
1216         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
1217         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
1218         (WebCore::GPUBuffer::isVertex const):
1219         (WebCore::GPUBuffer::isUniform const):
1220         (WebCore::GPUBuffer::isStorage const):
1221         (WebCore::GPUBuffer::isReadOnly const):
1222         (WebCore::GPUBuffer::PendingMapPromise::create):
1223         (WebCore::GPUBuffer::isMappable const):
1224         (WebCore::GPUBuffer::isMapWriteable const):
1225         (WebCore::GPUBuffer::isMapReadable const):
1226         (WebCore::GPUBuffer::mapping const): Deleted.
1227         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
1228         * platform/graphics/gpu/GPUDevice.cpp:
1229         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
1230         (WebCore::GPUDevice::createBuffer const): Deleted.
1231         * platform/graphics/gpu/GPUDevice.h:
1232         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1233         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
1234         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
1235         (WebCore::GPUBuffer::GPUBuffer):
1236         (WebCore::GPUBuffer::~GPUBuffer):
1237         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
1238         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
1239         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
1240         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
1241         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
1242         (WebCore::GPUBuffer::create): Deleted.
1243         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1244         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
1245
1246         Add symbols for new files:
1247         * Sources.txt:
1248         * WebCore.xcodeproj/project.pbxproj:
1249
1250 2019-02-23  Keith Miller  <keith_miller@apple.com>
1251
1252         Add new mac target numbers
1253         https://bugs.webkit.org/show_bug.cgi?id=194955
1254
1255         Reviewed by Tim Horton.
1256
1257         * Configurations/Base.xcconfig:
1258         * Configurations/DebugRelease.xcconfig:
1259
1260 2019-02-23  chris fleizach  <cfleizach@apple.com>
1261
1262         AX: WebKit is incorrectly mapping the <meter> element to progressbar
1263         https://bugs.webkit.org/show_bug.cgi?id=164051
1264         <rdar://problem/29055615>
1265
1266         Reviewed by Joanmarie Diggs.
1267
1268         Add a specific role for meter and map that to the appropriate mac role. 
1269
1270         * accessibility/AccessibilityNodeObject.cpp:
1271         (WebCore::AccessibilityNodeObject::canHaveChildren const):
1272         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
1273         * accessibility/AccessibilityObject.cpp:
1274         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
1275         (WebCore::AccessibilityObject::isRangeControl const):
1276         (WebCore::AccessibilityObject::computedRoleString const):
1277         * accessibility/AccessibilityObjectInterface.h:
1278         * accessibility/AccessibilityProgressIndicator.cpp:
1279         (WebCore::AccessibilityProgressIndicator::roleValue const):
1280         * accessibility/AccessibilityProgressIndicator.h:
1281         * accessibility/AccessibilityRenderObject.cpp:
1282         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
1283         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1284         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1285         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1286         (createAccessibilityRoleMap):
1287
1288 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
1289
1290         Crash in SWServerJobQueue::runNextJobSynchronously
1291         https://bugs.webkit.org/show_bug.cgi?id=194974
1292
1293         Reviewed by Geoffrey Garen.
1294
1295         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
1296         or there is a timer heap corruption again :(
1297
1298         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
1299         but convert an existing release assert to a debug assert since this appears to be hitting
1300         too frequently in wild.
1301
1302         * workers/service/server/SWServerJobQueue.cpp:
1303         (WebCore::SWServerJobQueue::runNextJobSynchronously):
1304
1305 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1306
1307         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
1308         https://bugs.webkit.org/show_bug.cgi?id=194968
1309
1310         Reviewed by Antti Koivisto.
1311
1312         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
1313         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
1314
1315         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
1316         reduce that.
1317
1318         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1319         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
1320         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1321         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1322         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
1323         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
1324         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1325         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1326         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
1327         * page/scrolling/ScrollingTreeScrollingNode.h:
1328         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
1329         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
1330         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
1331         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
1332         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1333         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1334         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1335         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1336         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1337         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1338         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1339         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1340         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
1341         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1342         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1343         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
1344         * platform/PlatformWheelEvent.h:
1345         (WebCore::PlatformWheelEvent::delta const):
1346         * platform/ScrollTypes.h:
1347
1348 2019-02-22  Eric Liang  <ericliang@apple.com>
1349
1350         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
1351         https://bugs.webkit.org/show_bug.cgi?id=194923
1352
1353         Reviewed by Chris Fleizach.
1354
1355         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
1356
1357         Test: accessibility/mac/children-in-navigation-order-returns-children.html
1358
1359         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1360         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1361
1362 2019-02-22  Tim Horton  <timothy_horton@apple.com>
1363
1364         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
1365         https://bugs.webkit.org/show_bug.cgi?id=194963
1366
1367         Reviewed by Dean Jackson.
1368
1369         Tested by existing failing API test.
1370
1371         * page/Page.cpp:
1372         (WebCore::Page::installedPageOverlaysChanged): Deleted.
1373         * page/Page.h:
1374         (WebCore::Page::pageOverlayController):
1375         * page/PageOverlayController.cpp:
1376         (WebCore::PageOverlayController::installedPageOverlaysChanged):
1377         (WebCore::PageOverlayController::detachViewOverlayLayers):
1378         (WebCore::PageOverlayController::installPageOverlay):
1379         (WebCore::PageOverlayController::uninstallPageOverlay):
1380         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
1381         * page/PageOverlayController.h:
1382         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
1383         Also, make it ignore isInWindow state; otherwise, if you install a overlay
1384         and then come into window, nothing installs the root layer. There is no
1385         need for this code to follow in-window state manually anymore since
1386         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
1387
1388         Make some methods private, and make detachViewOverlayLayers only touch
1389         *view* overlays, so that we don't detach the document-relative root
1390         layer when you drop to having no view overlays. This maintains
1391         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
1392
1393         Now there are no callers of willDetachRootLayer, so remove it.
1394
1395 2019-02-22  Andy Estes  <aestes@apple.com>
1396
1397         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
1398         https://bugs.webkit.org/show_bug.cgi?id=194964
1399         <rdar://problem/48279441>
1400
1401         Reviewed by Alex Christensen.
1402
1403         When a document's QuickLook preview is loaded, a reference cycle is created between
1404         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
1405         ResourceLoader::releaseResources().
1406
1407         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
1408
1409         * loader/ResourceLoader.cpp:
1410         (WebCore::ResourceLoader::releaseResources):
1411
1412 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
1413
1414         Crash under IDBServer::IDBConnectionToClient::identifier() const
1415         https://bugs.webkit.org/show_bug.cgi?id=194843
1416         <rdar://problem/48203102>
1417
1418         Reviewed by Geoffrey Garen.
1419
1420         UniqueIDBDatabase should ignore requests from connections that are already closed.
1421
1422         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
1423         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
1424         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
1425         may start a version change transaction and ask for identifier from the connection that is already gone.
1426
1427         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
1428         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
1429         * Modules/indexeddb/server/IDBConnectionToClient.h:
1430         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
1431         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1432         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
1433         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
1434         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
1435         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1436
1437 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1438
1439         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
1440         https://bugs.webkit.org/show_bug.cgi?id=194703
1441         <rdar://problem/48111775>
1442
1443         Reviewed by Ryosuke Niwa.
1444
1445         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
1446         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
1447         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
1448         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
1449
1450         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
1451         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
1452
1453         Tests: fast/events/before-input-events-prevent-block-text-direction.html
1454                fast/events/before-input-events-prevent-inline-text-direction.html
1455
1456         * editing/CompositeEditCommand.cpp:
1457         (WebCore::CompositeEditCommand::apply):
1458         * editing/EditAction.cpp:
1459         (WebCore::undoRedoLabel):
1460         * editing/EditAction.h:
1461         * editing/EditCommand.cpp:
1462         (WebCore::inputTypeNameForEditingAction):
1463         * editing/Editor.cpp:
1464         (WebCore::inputEventDataForEditingStyleAndAction):
1465         (WebCore::Editor::setBaseWritingDirection):
1466         * editing/EditorCommand.cpp:
1467         (WebCore::executeMakeTextWritingDirectionLeftToRight):
1468         (WebCore::executeMakeTextWritingDirectionNatural):
1469         (WebCore::executeMakeTextWritingDirectionRightToLeft):
1470
1471 2019-02-22  Rob Buis  <rbuis@igalia.com>
1472
1473         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
1474         https://bugs.webkit.org/show_bug.cgi?id=160172
1475
1476         Reviewed by Frédéric Wang.
1477
1478         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
1479         from HTTPParsers instead.
1480
1481         No new tests, already covered by MathML tests.
1482
1483         * mathml/MathMLElement.cpp:
1484         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
1485         * mathml/MathMLElement.h:
1486         * mathml/MathMLPresentationElement.cpp:
1487         (WebCore::MathMLPresentationElement::parseMathMLLength):
1488         * mathml/MathMLTokenElement.cpp:
1489         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
1490
1491 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
1492
1493         Update some media logging
1494         https://bugs.webkit.org/show_bug.cgi?id=194915
1495
1496         Reviewed by Jer Noble.
1497
1498         No new tests, no functional change.
1499
1500         * Modules/mediasource/SourceBuffer.cpp:
1501         (WebCore::SourceBuffer::evictCodedFrames):
1502         (WebCore::SourceBuffer::provideMediaData):
1503         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
1504
1505         * html/HTMLMediaElement.cpp:
1506         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
1507         (WebCore::HTMLMediaElement::loadResource):
1508         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1509         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
1510         (WebCore::HTMLMediaElement::seekTask):
1511         (WebCore::HTMLMediaElement::playInternal):
1512         (WebCore::HTMLMediaElement::pauseInternal):
1513         (WebCore::HTMLMediaElement::setLoop):
1514         (WebCore::HTMLMediaElement::setControls):
1515         (WebCore::HTMLMediaElement::sourceWasRemoved):
1516
1517         * html/MediaElementSession.cpp:
1518         (WebCore::convertEnumerationToString):
1519
1520         * html/MediaElementSession.h:
1521         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
1522
1523         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1524         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1525
1526 2019-02-22  Rob Buis  <rbuis@igalia.com>
1527
1528         Fix unitless usage of mathsize
1529         https://bugs.webkit.org/show_bug.cgi?id=194940
1530
1531         Reviewed by Frédéric Wang.
1532
1533         Convert unitless lengths to percentage values to correct the computed
1534         font size.
1535
1536         * mathml/MathMLElement.cpp:
1537         (WebCore::convertToPercentageIfNeeded):
1538         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
1539
1540 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
1541
1542         Hardcode Visual Viewports on everywhere except iOS WK1
1543         https://bugs.webkit.org/show_bug.cgi?id=194928
1544
1545         Reviewed by Zalan Bujtas.
1546
1547         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
1548         change the default value of the Setting to 'true', and hardcode WebView on iOS to
1549         set it to false. The setting has shipped for several years and there's no need to turn
1550         it off now.
1551
1552         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
1553         Visual Viewports are not enabled.
1554         
1555         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
1556         that only runs in WK2
1557
1558         * page/Settings.yaml:
1559         * page/scrolling/AsyncScrollingCoordinator.cpp:
1560         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1561         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1562         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
1563         * page/scrolling/AsyncScrollingCoordinator.h:
1564         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1565         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1566         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
1567         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
1568         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
1569         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1570         * page/scrolling/ScrollingTree.cpp:
1571         (WebCore::ScrollingTree::commitTreeState):
1572         * page/scrolling/ScrollingTree.h:
1573         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
1574         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
1575         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1576         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
1577         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1578         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
1579         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1580
1581 2019-02-21  Darin Adler  <darin@apple.com>
1582
1583         Some refinements for Node and Document
1584         https://bugs.webkit.org/show_bug.cgi?id=194764
1585
1586         Reviewed by Ryosuke Niwa.
1587
1588         * accessibility/AccessibilityObject.cpp:
1589         (WebCore::AccessibilityObject::press): Use shadowHost instead of
1590         deprecatedShadowAncestorNode.
1591         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
1592         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
1593         function to streamline.
1594
1595         * accessibility/AccessibilityRenderObject.cpp:
1596         (WebCore::AccessibilityRenderObject::accessKey const): Use
1597         attributeWithoutSynchronization for efficiency and consistency with other
1598         code working with the accesskey attribute.
1599
1600         * dom/ContainerNode.cpp:
1601         (WebCore::ContainerNode::childrenChanged): Added call to
1602         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
1603
1604         * dom/DecodedDataDocumentParser.cpp:
1605         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
1606         type change of createDecoderIfNeeded to decoder.
1607         (WebCore::DecodedDataDocumentParser::flush): Ditto.
1608
1609         * dom/Document.cpp:
1610         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
1611         to match WebKit coding style. Changed to use unique_ptr instead of separate
1612         boolean to keep track of map validity status.
1613         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
1614         clarify that this is a cache. Changed to use composedTreeDescendants rather
1615         than explicit calls to shadowRoot. Use add instead of set so that first element
1616         in document order wins, instead of last element in document order. Updated
1617         to make a new map in a new unique_ptr instead of populating a map.
1618         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
1619         invalidateAccessKeyMap, and left an inline part in the header so the fast case
1620         of quickly checking for a null pointer can be inlined.
1621         (WebCore::Document::doctype const): Use downcast instead of static_cast.
1622         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
1623         from here to childrenChanged and accesskey attribute change handling.
1624         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
1625         directly since this is the only place that does it and we don't need to factor
1626         that one line of code into a function.
1627         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
1628         that always returns nullptr and can be inlined.
1629         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
1630         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
1631         the create function, since Document::create now always involves no frame.
1632         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
1633         and simplified the logic with a local variable.
1634         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
1635         checks and rearranged things so that m_associatedFormControls will always
1636         get cleared even if the document is no longer associated with a page.
1637
1638         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
1639         value is always zero, etc.) and formatted simple enumerations in a single line
1640         for easier reading. Moved Document::create fucntion bodies out of line, removed
1641         the frame argument from the simple "create with URL" overload and made the frame
1642         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
1643         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
1644         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
1645         m_elementsByAccessKey to m_accessKeyCache and changed its type.
1646         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
1647         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
1648
1649         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
1650         placeholder returning null.
1651
1652         * dom/Element.cpp:
1653         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
1654         value of the accesskey attribute is changed. Also moved the class attribute code
1655         so the attributes here are in alphabetical order (only class and id were out of
1656         alphabetical order).
1657
1658         * dom/Node.cpp:
1659         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
1660         use deprecatedShadowAncestorNode and used boolean operators to make it a
1661         single line and easier to understand. Also added a FIXME since the
1662         containsIncludingShadowDOM function is so similar, yet differently written.
1663         (WebCore::Node::contains const): Rewrote as a single line to make this easier
1664         to read and to *slightly* improve the speed in the "this == node" case.
1665         (WebCore::Node::containsIncludingHostElements const): Use downcast.
1666         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
1667
1668         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
1669
1670         * editing/ReplaceSelectionCommand.cpp:
1671         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
1672         instead of deprecatedShadowAncestorNode.
1673
1674         * html/FormAssociatedElement.cpp:
1675         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
1676         didAssociateFormControl.
1677         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
1678
1679         * html/HTMLAreaElement.cpp:
1680         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
1681         attribute, because we want to call the base class parseAttribute in that case.
1682
1683         * html/HTMLFormElement.cpp:
1684         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
1685         didAssociateFormControl.
1686
1687         * html/HTMLSelectElement.cpp:
1688         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
1689         attribute with mysterious FIXME, because we want to call the base class
1690         parseAttribute in that case. The old code had no effect before; the access key
1691         logic would still find the attribute; if the goal is to ignore the attribute
1692         for these elements we will need a different solution.
1693         * html/HTMLTextAreaElement.cpp:
1694         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
1695
1696         * loader/DocumentLoader.cpp:
1697         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
1698         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
1699         m_frame was always null.
1700         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
1701
1702         * loader/DocumentWriter.cpp:
1703         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
1704         the passed in frame, which was always nullptr, and initialized some booleans and an
1705         enumeration, which are now initialized in the class definition.
1706         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
1707         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
1708         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
1709         to return a reference.
1710         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
1711         updated now that State is an enum class.
1712         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
1713         enum class.
1714         (WebCore::DocumentWriter::end): Ditto.
1715
1716         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
1717         Removed the frame pointer argument to the constructor, caller was always passing a
1718         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
1719         to decoder and changed it to return a reference. Initialized m_frame,
1720         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
1721         to initialize them in a constructor. Renamed the enum from WriterState to State since
1722         it's a member of DocumentWriter already, and made it an enum class rather than ending
1723         each enumeration value with WritingState.
1724
1725         * page/DragController.cpp:
1726         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
1727         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
1728         function instead.
1729         (WebCore::hasEnabledColorInputAsShadowHost): Added.
1730         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
1731         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
1732         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
1733         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
1734         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
1735         into a local variable to simplify code.
1736         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
1737
1738         * page/EventHandler.cpp:
1739         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
1740
1741         * page/FocusController.cpp:
1742         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
1743
1744         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1745         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
1746         Document::createNonRenderedPlaceholder.
1747
1748 2019-02-21  Daniel Bates  <dabates@apple.com>
1749
1750         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
1751         https://bugs.webkit.org/show_bug.cgi?id=194906
1752         <rdar://problem/44305947>
1753
1754         Reviewed by Brent Fulgham.
1755
1756         Ensure that a request for a top-level navigation is annotated as such regardless of whether
1757         the request has a computed Same Site policy.
1758
1759         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
1760         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
1761         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
1762         from an existing page. (Command + click should be thought of as a convenience to the user from
1763         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
1764         Currently the frame loader marks a request as a top-level navigation if and only if the request
1765         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
1766         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
1767         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
1768         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
1769         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
1770         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
1771
1772         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
1773         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
1774
1775         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
1776
1777         * loader/FrameLoader.cpp:
1778         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
1779         level navigation bit.
1780         * platform/network/ResourceRequestBase.cpp:
1781         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
1782         level navigation bit.
1783
1784 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
1785
1786         Layout Test fast/text/international/khmer-selection.html is crashing
1787         https://bugs.webkit.org/show_bug.cgi?id=191368
1788
1789         Reviewed by Brent Fulgham.
1790
1791         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
1792         Our underlining code requires this array.
1793
1794         Uniscribe gives us a character -> glyph mapping, so we just have to compute
1795         the inverse and give it to the GlyphBuffer.
1796
1797         This patch is written by Myles C. Maxfield.
1798
1799         Test: fast/text/international/khmer-selection.html.
1800
1801         * platform/graphics/GlyphBuffer.h:
1802         (WebCore::GlyphBuffer::add):
1803         * platform/graphics/displaylists/DisplayListItems.cpp:
1804         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
1805         * platform/graphics/win/UniscribeController.cpp:
1806         (WebCore::UniscribeController::advance):
1807         (WebCore::UniscribeController::itemizeShapeAndPlace):
1808         (WebCore::UniscribeController::shapeAndPlaceItem):
1809         * platform/graphics/win/UniscribeController.h:
1810
1811 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
1812
1813         IndexedDB: leak UniqueIDBDatabase in layout tests
1814         https://bugs.webkit.org/show_bug.cgi?id=194870
1815         <rdar://problem/48163812>
1816
1817         Reviewed by Geoffrey Garen.
1818
1819         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
1820         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
1821         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
1822         is received. 
1823
1824         No new test as the order of task completion and confirmation arrival is uncertain.
1825
1826         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1827         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
1828
1829 2019-02-21  Andy Estes  <aestes@apple.com>
1830
1831         contentfiltering tests leak documents
1832         https://bugs.webkit.org/show_bug.cgi?id=189434
1833         <rdar://44239943>
1834
1835         Reviewed by Simon Fraser.
1836
1837         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
1838
1839         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
1840
1841         * bindings/js/ScriptController.h:
1842         * loader/ContentFilter.cpp:
1843         (WebCore::ContentFilter::didDecide):
1844
1845 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
1846
1847         [CMake][Win] Fix !USE(CF) build of WebCore
1848         https://bugs.webkit.org/show_bug.cgi?id=194879
1849
1850         Reviewed by Konstantin Tokarev.
1851
1852         * PlatformAppleWin.cmake:
1853         * PlatformWin.cmake:
1854         * PlatformWinCairo.cmake:
1855
1856 2019-02-21  Zalan Bujtas  <zalan@apple.com>
1857
1858         [LFC][Floats] Add support for placing formatting roots in-between floats.
1859         https://bugs.webkit.org/show_bug.cgi?id=194902
1860
1861         Reviewed by Antti Koivisto.
1862
1863         This patch add support for placing a formatting root box in-between existing floats.
1864         The initial vertical position of a formatting root is its static position which can make the box
1865         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
1866
1867         Test: fast/block/block-only/floats-and-block-formatting-roots.html
1868
1869         * layout/blockformatting/BlockFormattingContext.cpp:
1870         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1871         * layout/floats/FloatingContext.cpp:
1872         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
1873         (WebCore::Layout::FloatPair::isEmpty const):
1874         (WebCore::Layout::FloatPair::operator* const):
1875         (WebCore::Layout::Iterator::operator* const):
1876         (WebCore::Layout::begin):
1877         (WebCore::Layout::end):
1878         (WebCore::Layout::FloatingContext::positionForFloat const):
1879         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
1880         (WebCore::Layout::findAvailablePosition):
1881         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
1882         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
1883         (WebCore::Layout::FloatPair::FloatPair):
1884         (WebCore::Layout::FloatPair::left const):
1885         (WebCore::Layout::FloatPair::right const):
1886         (WebCore::Layout::FloatPair::intersects const):
1887         (WebCore::Layout::FloatPair::operator == const):
1888         (WebCore::Layout::FloatPair::horizontalConstraints const):
1889         (WebCore::Layout::FloatPair::bottom const):
1890         (WebCore::Layout::Iterator::operator++):
1891         (WebCore::Layout::Iterator::set):
1892         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
1893         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
1894         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
1895         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
1896         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
1897         (WebCore::Layout::FloatingPair::left const): Deleted.
1898         (WebCore::Layout::FloatingPair::right const): Deleted.
1899         (WebCore::Layout::FloatingPair::intersects const): Deleted.
1900         (WebCore::Layout::FloatingPair::operator == const): Deleted.
1901         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
1902         (WebCore::Layout::FloatingPair::bottom const): Deleted.
1903         * layout/floats/FloatingContext.h:
1904
1905 2019-02-21  Rob Buis  <rbuis@igalia.com>
1906
1907         Update MIME type parser
1908         https://bugs.webkit.org/show_bug.cgi?id=180526
1909
1910         Reviewed by Darin Adler.
1911
1912         Further testing showed the MIME parser needs these fixes:
1913         - stripWhitespace is wrong for removing HTTP whitespace, use
1914           stripLeadingAndTrailingHTTPSpaces instead.
1915         - HTTP Token code points checking for Rfc2045 and Mimesniff were
1916           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
1917         - Quoted Strings were not unescaped/escaped, this seems ok for
1918           serializing but is wrong when gettings individual parameter values.
1919           Implement [1] and [2] Step 2.4 to properly unescape and escape.
1920
1921         This change also tries to avoid hard to read uses of find.
1922
1923         Test: ParsedContentType.Serialize
1924
1925         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
1926         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
1927
1928         * platform/network/ParsedContentType.cpp:
1929         (WebCore::skipSpaces):
1930         (WebCore::parseToken):
1931         (WebCore::isNotQuoteOrBackslash):
1932         (WebCore::collectHTTPQuotedString):
1933         (WebCore::containsNonTokenCharacters):
1934         (WebCore::parseQuotedString):
1935         (WebCore::ParsedContentType::parseContentType):
1936         (WebCore::ParsedContentType::create):
1937         (WebCore::ParsedContentType::setContentType):
1938         (WebCore::containsNonQuoteStringTokenCharacters):
1939         (WebCore::ParsedContentType::setContentTypeParameter):
1940         (WebCore::ParsedContentType::serialize const):
1941         (WebCore::substringForRange): Deleted.
1942         (WebCore::isNonTokenCharacter): Deleted.
1943         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
1944         * platform/network/ParsedContentType.h:
1945
1946 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
1947
1948         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
1949         https://bugs.webkit.org/show_bug.cgi?id=194889
1950         rdar://problem/47755552
1951
1952         Reviewed by Tim Horton.
1953         
1954         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
1955         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
1956         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
1957         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
1958         
1959         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
1960         layer.
1961
1962         Not currently testable.
1963
1964         * rendering/RenderLayerCompositor.cpp:
1965         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
1966
1967 2019-02-20  Dean Jackson  <dino@apple.com>
1968
1969         Rotation animations sometimes use the wrong origin (affects apple.com)
1970         https://bugs.webkit.org/show_bug.cgi?id=194878
1971         <rdar://problem/43908047>
1972
1973         Reviewed by Simon Fraser.
1974
1975         Some versions of CoreAnimation apply additive animations in reverse
1976         order. Detect this and reverse the list of animations we provide.
1977
1978         Update the existing animations/additive-transform-animations.html test to
1979         be a ref-test that would identify this failure. Previously it relied on
1980         a pixel test.
1981
1982         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
1983             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
1984             not to flip the list of animations (and mark the correct ones as
1985             additive).
1986         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
1987         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1988
1989 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
1990
1991         [Win] Guard CF usage in RenderThemeWin
1992         https://bugs.webkit.org/show_bug.cgi?id=194875
1993
1994         Reviewed by Alex Christensen.
1995
1996         No new tests. No change in behavior.
1997
1998         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
1999
2000         * rendering/RenderThemeWin.cpp:
2001         (WebCore::RenderThemeWin::stringWithContentsOfFile):
2002         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
2003         (WebCore::RenderThemeWin::mediaControlsScript):
2004         * rendering/RenderThemeWin.h:
2005
2006 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
2007
2008         Crash in DOMWindowExtension::suspendForPageCache
2009         https://bugs.webkit.org/show_bug.cgi?id=194871
2010
2011         Reviewed by Chris Dumez.
2012
2013         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
2014
2015         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
2016         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
2017         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
2018         to avoid the crash.
2019
2020         * page/DOMWindow.cpp:
2021         (WebCore::DOMWindow::willDestroyCachedFrame):
2022         (WebCore::DOMWindow::willDestroyDocumentInFrame):
2023         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2024         (WebCore::DOMWindow::suspendForPageCache):
2025         (WebCore::DOMWindow::resumeFromPageCache):
2026         * page/DOMWindowExtension.cpp:
2027         (WebCore::DOMWindowExtension::suspendForPageCache):
2028
2029 2019-02-20  Alex Christensen  <achristensen@webkit.org>
2030
2031         Always call CompletionHandlers after r240909
2032         https://bugs.webkit.org/show_bug.cgi?id=194823
2033
2034         Reviewed by Ryosuke Niwa.
2035
2036         * loader/PolicyChecker.cpp:
2037         (WebCore::PolicyChecker::checkNavigationPolicy):
2038         (WebCore::PolicyChecker::checkNewWindowPolicy):
2039
2040 2019-02-20  Andy Estes  <aestes@apple.com>
2041
2042         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
2043         https://bugs.webkit.org/show_bug.cgi?id=194869
2044
2045         Rubber-stamped by Jer Noble.
2046
2047         * WebCore.xcodeproj/project.pbxproj:
2048
2049 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2050
2051         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
2052         https://bugs.webkit.org/show_bug.cgi?id=194746
2053
2054         Reviewed by Dean Jackson.
2055
2056         Test: fast/canvas/canvas-drawImage-composite-copy.html
2057
2058         If the source canvas of drawImage() is the same as the destination and
2059         globalCompositeOperation is set to "copy", copy the srcRect from the 
2060         canvas to a temporary buffer before calling clearCanvas() then drawImage
2061         from this temporary buffer.
2062
2063         * html/canvas/CanvasRenderingContext2DBase.cpp:
2064         (WebCore::CanvasRenderingContext2DBase::drawImage):
2065         * platform/graphics/ImageBuffer.cpp:
2066         (WebCore::ImageBuffer::copyRectToBuffer):
2067         * platform/graphics/ImageBuffer.h:
2068
2069 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2070
2071         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
2072         https://bugs.webkit.org/show_bug.cgi?id=194866
2073
2074         Reviewed by Antti Koivisto.
2075
2076         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
2077         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
2078         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
2079
2080         * rendering/RenderLayerCompositor.cpp:
2081         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
2082
2083 2019-02-20  Daniel Bates  <dabates@apple.com>
2084
2085         [iOS] Tweak UI for focus rings
2086         https://bugs.webkit.org/show_bug.cgi?id=194864
2087         <rdar://problem/47831886>
2088
2089         Reviewed by Brent Fulgham.
2090
2091         Make use of UIKit constants to make focus rings pretty.
2092
2093         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2094         (WebCore::drawFocusRingAtTime):
2095
2096 2019-02-20  Timothy Hatcher  <timothy@apple.com>
2097
2098         RenderThemeIOS should use RenderTheme's color cache instead of its own.
2099         https://bugs.webkit.org/show_bug.cgi?id=194822
2100         rdar://problem/48208296
2101
2102         Reviewed by Tim Horton.
2103
2104         Tested by fast/css/apple-system-colors.html.
2105
2106         * css/CSSValueKeywords.in:
2107         * css/parser/CSSPropertyParser.cpp:
2108         (WebCore::isAppleLegacyCssValueKeyword):
2109         * platform/graphics/Color.h:
2110         * platform/graphics/cg/ColorCG.cpp:
2111         (WebCore::makeRGBAFromCGColor):
2112         (WebCore::Color::Color):
2113         * rendering/RenderThemeIOS.h:
2114         * rendering/RenderThemeIOS.mm:
2115         (WebCore::RenderThemeIOS::systemColor const):
2116         * rendering/RenderThemeMac.mm:
2117         (WebCore::RenderThemeMac::systemColor const):
2118
2119 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
2120
2121         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
2122         https://bugs.webkit.org/show_bug.cgi?id=194819
2123
2124         Reviewed by Joseph Pecoraro.
2125
2126         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
2127
2128         * Modules/websockets/WebSocketChannel.h:
2129         (WebCore::WebSocketChannel::hasCreatedHandshake):
2130         * inspector/agents/page/PageNetworkAgent.cpp:
2131         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
2132
2133 2019-02-20  Zalan Bujtas  <zalan@apple.com>
2134
2135         [LFC][Floats] Make FloatAvoider::resetPosition implicit
2136         https://bugs.webkit.org/show_bug.cgi?id=194855
2137
2138         Reviewed by Antti Koivisto.
2139
2140         Let's compute the initial top/left position during c'tor time.
2141         This is in preparation for fixing formatting root box placement in a float context.
2142
2143         * layout/floats/FloatAvoider.cpp:
2144         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
2145         * layout/floats/FloatAvoider.h:
2146         (WebCore::Layout::FloatAvoider::displayBox):
2147         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
2148         * layout/floats/FloatBox.cpp:
2149         (WebCore::Layout::FloatBox::FloatBox):
2150         (WebCore::Layout::FloatBox::initialVerticalPosition const):
2151         * layout/floats/FloatBox.h:
2152         * layout/floats/FloatingContext.cpp:
2153         (WebCore::Layout::FloatingContext::floatingPosition const):
2154
2155 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2156
2157         [MSVC] Fix compilation errors with lambdas in Service Workers
2158         https://bugs.webkit.org/show_bug.cgi?id=194841
2159
2160         Reviewed by Alex Christensen.
2161
2162         No new tests. No change in behavior.
2163
2164         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
2165         referring to the enclosing lambda according to MSVC. This patch works around this behavior
2166         through by using the `protectedThis` pattern in WebKit code.
2167
2168         * workers/service/server/RegistrationDatabase.cpp:
2169         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2170
2171 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
2172
2173         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
2174         https://bugs.webkit.org/show_bug.cgi?id=167941
2175
2176         Reviewed by Carlos Garcia Campos.
2177
2178         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
2179         to the list of files with translatable strings.
2180
2181 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
2182
2183         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
2184         https://bugs.webkit.org/show_bug.cgi?id=194827
2185         rdar://problem/47620594
2186
2187         Reviewed by Antti Koivisto.
2188
2189         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
2190         layer configurations, since a repaint implies that a layer gains painted content. This is done
2191         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
2192         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
2193         for the root. The configuration state that matters here is whether the layer contains painted content,
2194         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
2195         and feeds into GraphicsLayer::drawsContent().
2196
2197         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
2198         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
2199         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
2200
2201         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
2202         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
2203         to always return false for the RenderView's layer (the root).
2204         
2205         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
2206         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
2207         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
2208         respect it.
2209
2210         Test: compositing/visibility/root-visibility-toggle.html
2211
2212         * page/Frame.h:
2213         * platform/graphics/GraphicsLayer.cpp:
2214         (WebCore::GraphicsLayer::dumpProperties const):
2215         * platform/graphics/GraphicsLayerClient.h:
2216         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
2217         * rendering/RenderLayerBacking.cpp:
2218         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
2219         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
2220         * rendering/RenderLayerBacking.h:
2221         * rendering/RenderLayerCompositor.cpp:
2222         (WebCore::RenderLayerCompositor::layerTreeAsText):
2223         * testing/Internals.cpp:
2224         (WebCore::toLayerTreeFlags):
2225         * testing/Internals.h:
2226         * testing/Internals.idl:
2227
2228 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
2229
2230         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
2231         https://bugs.webkit.org/show_bug.cgi?id=194820
2232
2233         Reviewed by Geoffrey Garen.
2234
2235         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
2236         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
2237         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
2238         and we don't rely on PolicyChecker's load type until then.
2239
2240         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
2241
2242         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
2243         invoking checkNewWindowPolicy which is not the right assumption.
2244
2245         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
2246
2247         * loader/FrameLoader.cpp:
2248         (WebCore::FrameLoader::loadURL):
2249         (WebCore::FrameLoader::load):
2250         (WebCore::FrameLoader::loadPostRequest):
2251
2252 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2253
2254         Fix post-commit feedback.
2255
2256         Unreviewed. 
2257
2258         * layout/floats/FloatingContext.cpp:
2259         (WebCore::Layout::FloatingPair::intersects const):
2260
2261 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2262
2263         [LFC][Floats] Remove redundant intersecting logic
2264         https://bugs.webkit.org/show_bug.cgi?id=194804
2265
2266         Reviewed by Antti Koivisto.
2267
2268         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
2269
2270         * layout/floats/FloatingContext.cpp:
2271         (WebCore::Layout::FloatingContext::floatingPosition const):
2272         (WebCore::Layout::FloatingPair::intersects const):
2273
2274 2019-02-19  Commit Queue  <commit-queue@webkit.org>
2275
2276         Unreviewed, rolling out r241722.
2277         https://bugs.webkit.org/show_bug.cgi?id=194801
2278
2279         Causing time outs and EWS failures after expectation file was
2280         added. (Requested by ShawnRoberts on #webkit).
2281
2282         Reverted changeset:
2283
2284         "IndexedDB: leak IDBDatabase and IDBTransacstion in layout
2285         tests"
2286         https://bugs.webkit.org/show_bug.cgi?id=194709
2287         https://trac.webkit.org/changeset/241722
2288
2289 2019-02-16  Darin Adler  <darin@apple.com>
2290
2291         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
2292         https://bugs.webkit.org/show_bug.cgi?id=194752
2293
2294         Reviewed by Daniel Bates.
2295
2296         * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
2297         got included because of Logger.h, but that no longer pulls in HexNumber.h.
2298
2299         * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
2300         * css/CSSPrimitiveValue.cpp: Ditto.
2301
2302         * css/CSSUnicodeRangeValue.cpp:
2303         (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
2304         of String::format and "%x".
2305
2306         * html/HTMLMediaElement.h:
2307         (WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
2308         TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.
2309
2310         * html/canvas/WebGLRenderingContextBase.cpp:
2311         (GetErrorString): Use makeString and hex instead of String::format and "%04x".
2312
2313         * html/track/TextTrackCue.cpp:
2314         (WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
2315         from HTMLMediaElement.h and use makeString instead of String::format. Also use
2316         the word "debug" to make it clear that it's not OK to use this string, with a
2317         pointer value serialized into it, outside of debugging.
2318         * html/track/TextTrackCue.h: Added TextTrackCue::debugString.
2319
2320         * page/linux/ResourceUsageOverlayLinux.cpp:
2321         (WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
2322         instead of String::format and "%.1f" etc.
2323
2324         * platform/cocoa/KeyEventCocoa.mm:
2325         (WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
2326         the old code that did each of the four characters explicitly.
2327
2328         * platform/gamepad/mac/HIDGamepad.cpp:
2329         (WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.
2330
2331         * platform/graphics/Color.cpp:
2332         (WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
2333         digit separately.
2334
2335         * platform/graphics/FloatPolygon.cpp:
2336         (WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
2337         from the header and use makeString instead of String::format. Also use
2338         the word "debug" to make it clear that it's not OK to use this string, with a
2339         pointer value serialized into it, outside of debugging.
2340         * platform/graphics/FloatPolygon.h: Updated for the above.
2341
2342         * platform/graphics/ca/GraphicsLayerCA.cpp:
2343         (WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
2344         (WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
2345         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2346         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
2347         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
2348         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2349         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
2350         * platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
2351         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
2352         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2353         (WebCore::GStreamerVideoEncoder::makeElement): Ditto.
2354         (WebCore::GStreamerVideoEncoder::InitEncode): Ditto.
2355
2356         * platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
2357         and "using namespace WTF".
2358
2359         * platform/win/GDIObjectCounter.cpp:
2360         (WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
2361         * platform/win/KeyEventWin.cpp:
2362         (WebCore::keyIdentifierForWindowsKeyCode): Ditto.
2363
2364         * rendering/FloatingObjects.cpp:
2365         (WebCore::FloatingObject::debugString const): Added. Moved string conversion here
2366         from the header and use makeString instead of String::format. Also use
2367         the word "debug" to make it clear that it's not OK to use this string, with a
2368         pointer value serialized into it, outside of debugging.
2369         * rendering/FloatingObjects.h: Updated for the above.
2370
2371         * rendering/RenderFragmentContainer.cpp:
2372         (WebCore::RenderFragmentContainer::debugString const): Added. Moved string
2373         conversion here from the header and use makeString instead of String::format.
2374         Also use the word "debug" to make it clear that it's not OK to use this string,
2375         with a pointer value serialized into it, outside of debugging.
2376         * rendering/RenderFragmentContainer.h: Updated for the above.
2377         * rendering/RenderFragmentedFlow.h: Ditto.
2378
2379         * testing/Internals.cpp:
2380         (WebCore::Internals::address): Use makeString instead of String::format.
2381
2382 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2383
2384         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
2385         https://bugs.webkit.org/show_bug.cgi?id=194670
2386         <rdar://problem/39066529>
2387
2388         Reviewed by Tim Horton.
2389
2390         Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
2391         switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
2392         special codepath in WebContentReader::readImage.
2393
2394         This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
2395         attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
2396         contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
2397         attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
2398         conforms to "public.content", we take this codepath instead of first attempting the web content reading types
2399         supported by default in WebKit.
2400
2401         See below for more detail.
2402
2403         Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments
2404
2405         * editing/Editor.cpp:
2406         (WebCore::Editor::clientReplacementURLForResource): Deleted.
2407         * editing/Editor.h:
2408         * editing/WebContentReader.h:
2409         * editing/cocoa/WebContentReaderCocoa.mm:
2410         (WebCore::mimeTypeFromContentType):
2411         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
2412         (WebCore::createFragmentAndAddResources):
2413         (WebCore::sanitizeMarkupWithArchive):
2414
2415         Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2416
2417         (WebCore::WebContentReader::readImage):
2418         (WebCore::attachmentForFilePath):
2419         (WebCore::attachmentForData):
2420
2421         Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
2422         quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
2423         of their similarities into helper functions.
2424
2425         (WebCore::WebContentReader::readDataBuffer):
2426         (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.
2427
2428         Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2429
2430         * loader/EmptyClients.cpp:
2431         * page/EditorClient.h:
2432         * platform/Pasteboard.h:
2433         * platform/PasteboardItemInfo.h:
2434         (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
2435         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
2436         (WebCore::PasteboardItemInfo::encode const):
2437         (WebCore::PasteboardItemInfo::decode):
2438
2439         Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
2440         message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
2441         fidelity order instead.
2442
2443         * platform/PasteboardStrategy.h:
2444         * platform/PlatformPasteboard.h:
2445         * platform/ios/AbstractPasteboard.h:
2446         * platform/ios/PasteboardIOS.mm:
2447         (WebCore::Pasteboard::read):
2448
2449         Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
2450         informationForItemAtIndex out of the inner loop when reading web content.
2451
2452         (WebCore::Pasteboard::readRespectingUTIFidelities):
2453
2454         Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
2455         PasteboardItemInfo, instead of being sent in a separate message.
2456
2457         * platform/ios/PlatformPasteboardIOS.mm:
2458         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2459
2460         Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).
2461
2462         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
2463         * platform/ios/WebItemProviderPasteboard.h:
2464         * platform/ios/WebItemProviderPasteboard.mm:
2465         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.
2466
2467 2019-02-18  Daniel Bates  <dabates@apple.com>
2468
2469         Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
2470         https://bugs.webkit.org/show_bug.cgi?id=194785
2471
2472         Reviewed by Simon Fraser.
2473
2474         Change from early return to else-clause to make the states clearer and make it more straightforward
2475         to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
2476         switch to uniform initializer syntax.
2477
2478         * rendering/RenderThemeIOS.mm:
2479         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
2480
2481 2019-02-18  Daniel Bates  <dabates@apple.com>
2482
2483         [iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
2484         https://bugs.webkit.org/show_bug.cgi?id=193599
2485         <rdar://problem/47399602>
2486
2487         Reviewed by Simon Fraser.
2488
2489         For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
2490         for text fields, textareas, keygens, and selects so as to match the visual appearance of all
2491         the other controls.
2492
2493         Tests: fast/forms/ios/focus-button.html
2494                fast/forms/ios/focus-checkbox.html
2495                fast/forms/ios/focus-checked-checkbox.html
2496                fast/forms/ios/focus-checked-radio.html
2497                fast/forms/ios/focus-radio.html
2498                fast/forms/ios/focus-reset-button.html
2499                fast/forms/ios/focus-search-field.html
2500                fast/forms/ios/focus-submit-button.html
2501                fast/forms/ios/focus-text-field.html
2502                fast/forms/ios/focus-textarea.html
2503
2504         * css/html.css:
2505         (:focus): Use 3px outline width.
2506         (input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
2507         * rendering/RenderBox.cpp:
2508         (WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
2509         * rendering/RenderElement.cpp:
2510         (WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
2511         Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.
2512
2513 2019-02-18  Oriol Brufau  <obrufau@igalia.com>
2514
2515         [css-grid] Handle indefinite percentages in fit-content()
2516         https://bugs.webkit.org/show_bug.cgi?id=194509
2517
2518         Reviewed by Javier Fernandez.
2519
2520         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
2521
2522         If the size of the grid container depends on the size of its tracks,
2523         a percentage in fit-content() is indefinite. Without this patch, some
2524         places treated this case as fit-content(0), which prevented the grid
2525         container from growing enough to contain the max-content contribution
2526         of its grid items.
2527
2528         This patch treats such fit-content() as minmax(auto, max-content),
2529         but once the size of the grid container is known and it is laid out
2530         "for real", then the percentage is definite and it's used.
2531
2532         * rendering/GridTrackSizingAlgorithm.cpp:
2533         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
2534         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
2535
2536 2019-02-18  John Wilander  <wilander@apple.com>
2537
2538         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
2539         https://bugs.webkit.org/show_bug.cgi?id=194777
2540         <rdar://problem/47731945>
2541
2542         Reviewed by Geoffrey Garen and Chris Dumez.
2543
2544         Test: http/tests/storageAccess/remove-requesting-iframe.html
2545
2546         * dom/Document.cpp:
2547         (WebCore::Document::hasFrameSpecificStorageAccess const):
2548             Now checks for the existence of the frame.
2549         (WebCore::Document::setHasFrameSpecificStorageAccess):
2550             Now checks for the existence of the frame.
2551         * loader/ResourceLoadObserver.cpp:
2552         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2553             Now checks that the session ID is valid.
2554
2555 2019-02-18  Jer Noble  <jer.noble@apple.com>
2556
2557         -[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
2558         https://bugs.webkit.org/show_bug.cgi?id=194790
2559         <rdar://problem/33866742>
2560
2561         Reviewed by Jon Lee.
2562
2563         Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
2564         an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.
2565
2566         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2567         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
2568
2569 2019-02-18  Joseph Pecoraro  <pecoraro@apple.com>
2570
2571         Web Inspector: Better categorize CPU usage per-thread / worker
2572         https://bugs.webkit.org/show_bug.cgi?id=194564
2573
2574         Reviewed by Devin Rousso.
2575
2576         Test: inspector/cpu-profiler/threads.html
2577
2578         * workers/WorkerThread.cpp:
2579         (WebCore::WorkerThread::workerThreadsMutex):
2580         (WebCore::WorkerThread::workerThreadCount):
2581         (WebCore::WorkerThread::WorkerThread):
2582         (WebCore::WorkerThread::~WorkerThread):
2583         (WebCore::WorkerThread::workerThread):
2584         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
2585         * workers/WorkerThread.h:
2586         (WebCore::WorkerThread::identifier const):
2587         Expose the set of all WorkerThreads.
2588
2589         * inspector/agents/InspectorCPUProfilerAgent.cpp:
2590         (WebCore::InspectorCPUProfilerAgent::collectSample):
2591         Send inspector additional per-thread data.
2592
2593         * page/ResourceUsageData.h:
2594         (WebCore::WorkerCPUInfo::WorkerCPUInfo):
2595         * page/cocoa/ResourceUsageThreadCocoa.mm:
2596         (WebCore::ThreadInfo::ThreadInfo):
2597         (WebCore::threadInfos):
2598         (WebCore::ResourceUsageThread::platformCollectCPUData):
2599         (WebCore::threadSendRights): Deleted.
2600         (WebCore::cpuUsage): Deleted.
2601         Compute per-thread values on cocoa ports.
2602
2603         * page/linux/ResourceUsageThreadLinux.cpp:
2604         (WebCore::ResourceUsageThread::platformCollectCPUData):
2605         Stub per-thread values on linux ports.
2606
2607 2019-02-18  Jer Noble  <jer.noble@apple.com>
2608
2609         Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
2610         https://bugs.webkit.org/show_bug.cgi?id=194786
2611
2612         Reviewed by Eric Carlson.
2613
2614         Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
2615         in an exception handler.
2616
2617         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2618         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
2619
2620 2019-02-18  Daniel Bates  <dabates@apple.com>
2621
2622         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
2623         https://bugs.webkit.org/show_bug.cgi?id=192824
2624         <rdar://problem/47100332>
2625
2626         Reviewed by Wenson Hsieh.
2627
2628         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
2629         now that hardware key events to non-editable elements use the same code path as for editable elements. 
2630
2631         * platform/ios/KeyEventIOS.mm:
2632         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
2633         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
2634         (WebCore::isFunctionKey): Ditto.
2635         * platform/ios/WebEvent.mm:
2636         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
2637         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
2638
2639 2019-02-18  Eric Carlson  <eric.carlson@apple.com>
2640
2641         Add MSE logging configuration
2642         https://bugs.webkit.org/show_bug.cgi?id=194719
2643         <rdar://problem/48122151>
2644
2645         Reviewed by Joseph Pecoraro.
2646
2647         No new tests, updated inspector/console/webcore-logging.html.
2648
2649         * dom/Document.cpp:
2650         (WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.
2651
2652         * inspector/agents/WebConsoleAgent.cpp:
2653         (WebCore::WebConsoleAgent::getLoggingChannels): Ditto.
2654
2655 2019-02-18  Antoine Quint  <graouts@apple.com>
2656
2657         [iOS] Dispatch additional events along with pointerdown and pointerup
2658         https://bugs.webkit.org/show_bug.cgi?id=194776
2659         <rdar://problem/48164284>
2660
2661         Reviewed by Brent Fulgham.
2662
2663         The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
2664         and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
2665         it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
2666         allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.
2667
2668         Test: pointerevents/ios/over-enter-out-leave.html
2669
2670         * dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
2671         * dom/PointerEvent.h:
2672         * dom/ios/PointerEventIOS.cpp:
2673         (WebCore::PointerEvent::create):
2674         * page/EventHandler.cpp:
2675         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
2676         * page/EventHandler.h:
2677         * page/PointerCaptureController.cpp:
2678         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
2679         and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
2680         had defaultPrevented() or defaultHanded() return true and return those values as a pair.
2681         (WebCore::PointerCaptureController::pointerEventWasDispatched):
2682         * page/PointerCaptureController.h:
2683
2684 2019-02-18  Sihui Liu  <sihui_liu@apple.com>
2685
2686         IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
2687         https://bugs.webkit.org/show_bug.cgi?id=194709
2688
2689         Reviewed by Geoffrey Garen.
2690
2691         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
2692         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
2693
2694         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
2695         between IDBOpenDBRequest and IDBTransaction.
2696
2697         Test: storage/indexeddb/IDBObject-leak.html
2698
2699         * Modules/indexeddb/IDBDatabase.cpp:
2700         (WebCore::IDBDatabase::connectionToServerLost):
2701         * Modules/indexeddb/IDBTransaction.cpp:
2702         (WebCore::IDBTransaction::IDBTransaction):
2703         (WebCore::IDBTransaction::~IDBTransaction):
2704         (WebCore::IDBTransaction::finishedDispatchEventForRequest):
2705         (WebCore::IDBTransaction::connectionClosedFromServer):
2706         * Modules/indexeddb/IDBTransaction.h:
2707         * testing/Internals.cpp:
2708         (WebCore::Internals::numberOfIDBTransactions const):
2709         * testing/Internals.h:
2710         * testing/Internals.idl:
2711
2712 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
2713
2714         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
2715         https://bugs.webkit.org/show_bug.cgi?id=194742
2716
2717         Reviewed by Chris Dumez.
2718
2719         With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
2720         had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).
2721
2722         This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
2723         receive notifications.
2724
2725         It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
2726         page load.
2727
2728         * accessibility/mac/AXObjectCacheMac.mm:
2729         (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
2730
2731 2019-02-18  Megan Gardner  <megan_gardner@apple.com>
2732
2733         Turn On Smart Delete
2734         https://bugs.webkit.org/show_bug.cgi?id=194320
2735
2736         Reviewed by Ryosuke Niwa.
2737
2738         Updated the following tests to work with iOS:
2739         * editing/deleting/smart-delete-001.html:
2740         * editing/deleting/smart-delete-002.html:
2741         * editing/deleting/smart-delete-003.html:
2742         * editing/deleting/smart-delete-004.html:
2743         * editing/deleting/smart-delete-across-editable-boundaries-2.html:
2744         * editing/selection/delete-word-granularity-text-control.html:
2745
2746         Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other 
2747         platforms to turn on smart delete when desired.
2748
2749         * editing/Editor.cpp:
2750         (WebCore::Editor::shouldSmartDelete):
2751         Allow platfroms to determine if smart delete should be on.
2752         On mac, this is via word granularity, on iOS this is just on all the time.
2753         (WebCore::Editor::canSmartCopyOrDelete):
2754         (WebCore::Editor::performCutOrCopy):
2755         * editing/Editor.h:
2756         * editing/EditorCommand.cpp:
2757         (WebCore::executeDelete):
2758         * editing/ios/EditorIOS.mm:
2759         (WebCore::Editor::shouldSmartDelete):
2760         * editing/mac/EditorMac.mm:
2761         (WebCore::Editor::shouldSmartDelete):
2762
2763 2019-02-17  David Kilzer  <ddkilzer@apple.com>
2764
2765         Unreviewed, rolling out r241620.
2766
2767         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
2768         (Requested by ddkilzer on #webkit.)
2769
2770         Reverted changeset:
2771
2772         "[WTF] Add environment variable helpers"
2773         https://bugs.webkit.org/show_bug.cgi?id=192405
2774         https://trac.webkit.org/changeset/241620
2775
2776 2019-02-16  Zalan Bujtas  <zalan@apple.com>
2777
2778         [LFC] RenderImage's default intrinsic size is 0.
2779         https://bugs.webkit.org/show_bug.cgi?id=194745
2780
2781         Reviewed by Antti Koivisto.
2782
2783         While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
2784         * layout/layouttree/LayoutTreeBuilder.cpp:
2785         (WebCore::Layout::TreeBuilder::createSubTree):
2786
2787 2019-02-16  Zalan Bujtas  <zalan@apple.com>
2788
2789         [LFC][BFC] Add support for block replaced intrinsic width.
2790         https://bugs.webkit.org/show_bug.cgi?id=194705
2791
2792         Reviewed by Simon Fraser.
2793
2794         Replaced boxes should report their intrinsic width as preferred widths.
2795
2796         Test: fast/block/block-only/replaced-intrinsic-width-simple.html
2797
2798         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2799         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
2800
2801 2019-02-16  Zalan Bujtas  <zalan@apple.com>
2802
2803         [LFC] Apply min/max width constraints to preferred width computation
2804         https://bugs.webkit.org/show_bug.cgi?id=194739
2805
2806         Reviewed by Simon Fraser.
2807
2808         Ensure that both min-height and max-height are taken into account while computing the preferred width.
2809
2810         Test: fast/block/block-only/min-max-and-preferred-width-simple.html
2811
2812         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2813         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
2814
2815 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
2816
2817         [JSC] Make builtin objects more lazily initialized under non-JIT mode
2818         https://bugs.webkit.org/show_bug.cgi?id=194727
2819
2820         Reviewed by Saam Barati.
2821
2822         * Modules/streams/ReadableByteStreamInternals.js:
2823         (privateInitializeReadableByteStreamController):
2824         (readableByteStreamControllerRespond):
2825
2826 2019-02-15  Dean Jackson  <dino@apple.com>
2827
2828         Allow emulation of user gestures from Web Inspector console
2829         https://bugs.webkit.org/show_bug.cgi?id=194725
2830         <rdar://problem/48126604>
2831
2832         Reviewed by Joseph Pecoraro and Devin Rousso.
2833
2834         Test: inspector/runtime/evaluate-userGestureEmulation.html
2835
2836         * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
2837         a UserGestureIndicator based on the emulateUserGesture option.
2838         (WebCore::PageRuntimeAgent::evaluate):
2839         * inspector/agents/page/PageRuntimeAgent.h:
2840
2841 2019-02-15  Chris Dumez  <cdumez@apple.com>
2842
2843         Sample domainsVisited diagnostic logging
2844         https://bugs.webkit.org/show_bug.cgi?id=194657
2845
2846         Reviewed by Ryosuke Niwa.
2847
2848         Sample domainsVisited diagnostic logging, we are getting a lot of data from
2849         this key and this is hurting our other keys.
2850
2851         * page/Page.cpp:
2852         (WebCore::Page::logNavigation):
2853
2854 2019-02-15  Ryosuke Niwa  <rniwa@webkit.org>
2855
2856         Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
2857         https://bugs.webkit.org/show_bug.cgi?id=194691
2858
2859         Reviewed by Simon Fraser.
2860
2861         The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
2862         without updating the layout of ancestor documents (i.e. documents in which frame owner
2863         elements appear) even though it hit-tests against the top-level document's RenderView.
2864
2865         Fixed the bug by updating the layout of the top-level document as needed.
2866
2867         Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html
2868
2869         * html/HTMLPlugInElement.cpp:
2870         (WebCore::HTMLPlugInElement::isReplacementObscured):
2871
2872 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
2873
2874         [WTF] Add environment variable helpers
2875         https://bugs.webkit.org/show_bug.cgi?id=192405
2876
2877         Reviewed by Michael Catanzaro.
2878
2879         * platform/NotImplemented.h:
2880         * platform/cocoa/SystemVersion.mm:
2881         (WebCore::createSystemMarketingVersion):
2882         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2883         (WebCore::initializeGStreamer):
2884         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2885         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2886         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
2887         (Nicosia::PaintingEngine::create):
2888         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
2889         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
2890         * platform/graphics/x11/PlatformDisplayX11.cpp:
2891         (WebCore::PlatformDisplayX11::create):
2892         * platform/gtk/RenderThemeWidget.cpp:
2893         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
2894         * platform/gtk/ScrollbarThemeGtk.cpp:
2895         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
2896         * platform/network/curl/CurlContext.cpp:
2897         (WebCore::CurlContext::CurlContext):
2898         (WebCore::EnvironmentVariableReader::read): Deleted.
2899         (WebCore::EnvironmentVariableReader::defined): Deleted.
2900         (WebCore::EnvironmentVariableReader::readAs): Deleted.
2901         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
2902         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
2903         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
2904         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2905         (WebCore::defaultCookieJarPath):
2906         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
2907         (WebCore::getCACertPathEnv):
2908         * platform/network/win/CurlSSLHandleWin.cpp:
2909         (WebCore::getCACertPathEnv):
2910         * platform/text/hyphen/HyphenationLibHyphen.cpp:
2911         (WebCore::topLevelPath):
2912         (WebCore::webkitBuildDirectory):
2913         * platform/unix/LoggingUnix.cpp:
2914         (WebCore::logLevelString):
2915         * platform/win/LoggingWin.cpp:
2916         (WebCore::logLevelString):
2917         Utilize WTF::Environment where possible.
2918
2919 2019-02-15  Antoine Quint  <graouts@apple.com>
2920
2921         Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
2922         https://bugs.webkit.org/show_bug.cgi?id=194702
2923         <rdar://problem/48109355>
2924
2925         Reviewed by Dean Jackson.
2926
2927         * page/EventHandler.cpp:
2928         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
2929         * page/EventHandler.h:
2930
2931 2019-02-15  Per Arne Vollan  <pvollan@apple.com>
2932
2933         [WebVTT] Inline WebVTT styles should start with '::cue'
2934         https://bugs.webkit.org/show_bug.cgi?id=194227
2935
2936         Reviewed by Eric Carlson.
2937
2938         The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
2939         with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
2940         all selectors starts with '::cue'.
2941
2942         Test: media/track/track-cue-css.html
2943
2944         * html/track/WebVTTParser.cpp:
2945         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
2946
2947 2019-02-15  Youenn Fablet  <youenn@apple.com>
2948
2949         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
2950         https://bugs.webkit.org/show_bug.cgi?id=194713
2951
2952         Reviewed by Eric Carlson.
2953
2954         Binding tests covering mediaDevices and serviceWorker attributes.
2955
2956         * bindings/scripts/test/JS/JSTestObj.cpp:
2957         (WebCore::JSTestObjPrototype::finishCreation):
2958         (WebCore::jsTestObjMediaDevices1Getter):
2959         (WebCore::jsTestObjMediaDevices1):
2960         (WebCore::jsTestObjMediaDevices2Getter):
2961         (WebCore::jsTestObjMediaDevices2):
2962         (WebCore::jsTestObjServiceWorkers1Getter):
2963         (WebCore::jsTestObjServiceWorkers1):
2964         (WebCore::jsTestObjServiceWorkers2Getter):
2965         (WebCore::jsTestObjServiceWorkers2):
2966         * bindings/scripts/test/TestObj.idl:
2967
2968 2019-02-15  Beth Dakin  <bdakin@apple.com>
2969
2970         Build fix.
2971
2972         * rendering/RenderThemeIOS.mm:
2973         (WebCore::iconForAttachment):
2974
2975 2019-02-15  Youenn Fablet  <youenn@apple.com>
2976
2977         Make ServiceWorkerClientFetch closer to WebResourceLoader
2978         https://bugs.webkit.org/show_bug.cgi?id=194651
2979
2980         Reviewed by Alex Christensen.
2981
2982         Check for redirection response and if so call a specific client API.
2983         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
2984         so that its m_connection is only accessed on that thread.
2985
2986         Covered by existing tests.
2987
2988         * platform/network/FormData.h:
2989         * platform/network/ResourceErrorBase.h:
2990         * workers/service/context/ServiceWorkerFetch.cpp:
2991         (WebCore::ServiceWorkerFetch::processResponse):
2992         * workers/service/context/ServiceWorkerFetch.h:
2993         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2994         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
2995         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
2996         * workers/service/context/ServiceWorkerThreadProxy.h:
2997
2998 2019-02-15  Youenn Fablet  <youenn@apple.com>
2999
3000         Make navigator.mediaDevices SecureContext
3001         https://bugs.webkit.org/show_bug.cgi?id=194666
3002
3003         Reviewed by Eric Carlson.
3004
3005         Make navigator.mediaDevices SecureContext.
3006         This can still be enabled for unsecure context using the existing page settings.
3007         To cover that case, introduce ContextHasMediaDevices custom IDL keyword.
3008
3009         Covered by API test.
3010
3011         * Modules/mediastream/NavigatorMediaDevices.idl:
3012         * bindings/scripts/CodeGeneratorJS.pm:
3013         (GenerateRuntimeEnableConditionalString):
3014         * bindings/scripts/IDLAttributes.json:
3015         * dom/ScriptExecutionContext.cpp:
3016         (WebCore::ScriptExecutionContext::hasMediaDevices const):
3017         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
3018         * dom/ScriptExecutionContext.h:
3019
3020 2019-02-15  Youenn Fablet  <youenn@apple.com>
3021
3022         WebSocket should not fire events after being stopped
3023         https://bugs.webkit.org/show_bug.cgi?id=194690
3024
3025         Reviewed by Geoffrey Garen.
3026
3027         dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
3028         This makes it possible to dispatch an event while WebSocket is already stopped.
3029         Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.
3030
3031         As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.
3032
3033         * Modules/websockets/WebSocket.cpp:
3034         (WebCore::WebSocket::stop):
3035         (WebCore::WebSocket::connect):
3036         * Modules/websockets/WebSocket.h:
3037
3038 2019-02-15  Youenn Fablet  <youenn@apple.com>
3039
3040         Performance should not fire events when its context is stopped
3041         https://bugs.webkit.org/show_bug.cgi?id=194689
3042
3043         Reviewed by Alex Christensen.
3044
3045         Stop the timer when its context is destroyed.
3046         Add an assertion to ensure the timer does not fire after context is destroyed.
3047
3048         * page/Performance.cpp:
3049         (WebCore::Performance::stop):
3050
3051 2019-02-15  Alex Christensen  <achristensen@webkit.org>
3052
3053         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
3054         https://bugs.webkit.org/show_bug.cgi?id=194523
3055
3056         Reviewed by Geoffrey Garen.
3057
3058         The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
3059         so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
3060         and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
3061         A younger me should've noticed this when reviewing r218517.
3062
3063         * platform/network/cf/FormDataStreamCFNet.cpp:
3064         (WebCore::formCreate):
3065         (WebCore::createHTTPBodyCFReadStream):
3066
3067 2019-02-15  Commit Queue  <commit-queue@webkit.org>
3068
3069         Unreviewed, rolling out r241559 and r241566.
3070         https://bugs.webkit.org/show_bug.cgi?id=194710
3071
3072         Causes layout test crashes under GuardMalloc (Requested by
3073         ryanhaddad on #webkit).
3074
3075         Reverted changesets:
3076
3077         "[WTF] Add environment variable helpers"
3078         https://bugs.webkit.org/show_bug.cgi?id=192405
3079         https://trac.webkit.org/changeset/241559
3080
3081         "Unreviewed build fix for WinCairo Debug after r241559."
3082         https://trac.webkit.org/changeset/241566
3083
3084 2019-02-15  Youenn Fablet  <youenn@apple.com>
3085
3086         Stop the endpoint synchronously in RTCPeerConnection::close
3087         https://bugs.webkit.org/show_bug.cgi?id=194688
3088
3089         Reviewed by Eric Carlson.
3090
3091         In the case where the peer connection is being closed, it was asynchronously stopping the endpoint.
3092         But the endpoint, before being stopped, could try to fire an event.
3093         If the context is gone in between, we end up with a null pointer dereference.
3094
3095         * Modules/mediastream/RTCPeerConnection.cpp:
3096         (WebCore::RTCPeerConnection::close):
3097
3098 2019-02-15  Zalan Bujtas  <zalan@apple.com>
3099
3100         [LFC] Out-of-flow box is never a float box
3101         https://bugs.webkit.org/show_bug.cgi?id=194704
3102
3103         Reviewed by Antti Koivisto.
3104
3105         We can't have it both ways. Absolute positioning wins.
3106
3107         Test: fast/block/block-only/out-of-flow-is-never-float-box.html
3108
3109         * layout/layouttree/LayoutBox.cpp:
3110         (WebCore::Layout::Box::isFloatingPositioned const):
3111         (WebCore::Layout::Box::isLeftFloatingPositioned const):
3112         (WebCore::Layout::Box::isRightFloatingPositioned const):
3113
3114 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3115
3116         [GStreamer] Simplify GObject class name check
3117         https://bugs.webkit.org/show_bug.cgi?id=194537
3118
3119         Reviewed by Michael Catanzaro.
3120
3121         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3122         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
3123         Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child
3124         elements.
3125
3126 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3127
3128         Refactor EditingStyle::textDirection to return an Optional<WritingDirection> instead of a bool
3129         https://bugs.webkit.org/show_bug.cgi?id=194686
3130
3131         Reviewed by Ryosuke Niwa.
3132
3133         Changes EditingStyle::textDirection to return an Optional<WritingDirection>, instead of taking a reference to
3134         the resulting WritingDirection. No change in behavior.
3135
3136         * editing/ApplyStyleCommand.cpp:
3137         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
3138         (WebCore::ApplyStyleCommand::applyInlineStyle):
3139         * editing/EditingStyle.cpp:
3140         (WebCore::EditingStyle::textDirection const):
3141         (WebCore::EditingStyle::textDirectionForSelection):
3142         * editing/EditingStyle.h:
3143
3144 2019-02-10  Darin Adler  <darin@apple.com>
3145
3146         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
3147         https://bugs.webkit.org/show_bug.cgi?id=194487
3148
3149         Reviewed by Daniel Bates.
3150
3151         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
3152         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString
3153         instead of String::format.
3154
3155         * page/linux/ResourceUsageOverlayLinux.cpp:
3156         (WebCore::formatByteNumber): Use String::number instead of String::format.
3157
3158         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
3159         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
3160         Use makeString instead of String::format.
3161         * platform/glib/UserAgentGLib.cpp:
3162         (WebCore::platformVersionForUAString): Ditto.
3163         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3164         (WebCore::simpleBusMessageCallback): Ditto.
3165         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3166         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto.
3167         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3168         (WebCore::AppendPipeline::AppendPipeline): Ditto.
3169         (WebCore::AppendPipeline::handleStateChangeMessage): Ditto.
3170         (WebCore::AppendPipeline::resetParserState): Ditto.
3171         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3172         (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto.
3173         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto.
3174
3175         * platform/graphics/gtk/ImageBufferGtk.cpp:
3176         (WebCore::encodeImage): Use String::number instead of String::format.
3177
3178         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
3179         (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of
3180         String::format.
3181         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
3182         (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto.
3183         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
3184         (WebCore::webkitMediaStreamSrcAddPad): Ditto.
3185         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
3186         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
3187         * platform/network/curl/CookieJarDB.cpp:
3188         (WebCore::CookieJarDB::verifySchemaVersion): Ditto.
3189         * platform/win/SearchPopupMenuDB.cpp:
3190         (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto.
3191
3192 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3193
3194         [GStreamer] Decoding media-capabilities configuration initial support
3195         https://bugs.webkit.org/show_bug.cgi?id=191191
3196
3197         Reviewed by Xabier Rodriguez-Calvar.
3198
3199         This patch enables basic platform probing for GStreamer decoders,
3200         optionally using Hardware decoding capabilities. The previous code
3201         for decoders/demuxers probing partially duplicated between the MSE
3202         player and its parent class was moved to a new module called
3203         GStreamerRegistryScanner. There is one instance of it for the MSE player
3204         and one for the parent class.
3205
3206         The scanner can check for the presence of the GstElement Hardware
3207         metadata classifier in decoders and thus advise the
3208         MediaEngineConfigurationFactoryGStreamer that hardware decoding is
3209         supported or not. This is only a first step though. The scanner
3210         should also probably attempt a NULL->READY transition on decoders
3211         to validate specific input caps are supported. As this might
3212         require changes in GStreamer, this part of the patch wasn't
3213         included.
3214
3215         This patch is covered by the existing media tests.
3216
3217         * platform/GStreamer.cmake: New files.
3218         * platform/graphics/MediaPlayer.cpp: Add support for converting
3219         SupportsType enum to string.
3220         (WebCore::convertEnumerationToString):
3221         * platform/graphics/MediaPlayer.h: Ditto.
3222         * platform/graphics/MediaPlayerEnums.h: Ditto.
3223         * platform/graphics/gstreamer/GStreamerCommon.cpp: Move
3224         gstRegistryHasElementForMediaType to GStreamerRegistryScanner.
3225         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto.
3226         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added.
3227         (WebCore::GStreamerRegistryScanner::singleton):
3228         (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize
3229         supported mime-types and codecs from the GStreamer registry.
3230         (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories.
3231         (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType):
3232         Check the input caps are supported, optionally using hardware
3233         device.
3234         (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping):
3235         Moved from MediaPlayerPrivateGStreamer{,MSE}.
3236         (WebCore::GStreamerRegistryScanner::initialize): Ditto.
3237         (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto.
3238         (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto.
3239         (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check
3240         the given configuration is supported. For now hardware support is
3241         checked for video configurations only as it is quite uncommon
3242         anyway to have hardware-enabled audio decoders.
3243         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added.
3244         (WebCore::GStreamerRegistryScanner::mimeTypeSet):
3245         (WebCore::GStreamerRegistryScanner::supportsContainerType const):
3246         (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const):
3247         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added.
3248         (WebCore::createMediaPlayerDecodingConfigurationGStreamer):
3249         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added.
3250         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3251         Rely on new GStreamerRegistryScanner and add some debugging macros.
3252         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
3253         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
3254         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also
3255         plug qtdemux for AAC containers, this is an explicit consequence
3256         of finer-grained codecs probing.
3257         (WebCore::AppendPipeline::AppendPipeline):
3258         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3259         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added.
3260         (WebCore::GStreamerRegistryScannerMSE::singleton):
3261         (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE):
3262         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added.
3263         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3264         Rely on new GStreamerRegistryScanner and add some debugging macros.
3265         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
3266         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
3267         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3268         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
3269         (WebCore::factories): GStreamer support.
3270
3271 2019-02-14  Joseph Pecoraro  <pecoraro@apple.com>
3272
3273         Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
3274         https://bugs.webkit.org/show_bug.cgi?id=194671
3275         <rdar://problem/47628191>
3276
3277         Reviewed by Devin Rousso.
3278
3279         * css/CSSStyleSheet.cpp:
3280         (WebCore::CSSStyleSheet::item):
3281         A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
3282         sync with the m_contents list of rules. In particular if the wrappers
3283         vector is shorter than the rule list. We tried exercising code paths
3284         that modify these lists but were not able to reproduce the crash.
3285         To avoid a crash we can make this access safer and avoid the original
3286         overflow. At the same time we will keep and promote the assertion that
3287         would catch the lists getting out of sync in debug builds.
3288
3289 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3290
3291         Unreviewed build fix for WinCairo Debug after r241559.
3292
3293         * platform/network/curl/CurlContext.cpp:
3294         (WebCore::CurlContext::CurlContext):
3295
3296 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3297
3298         [WTF] Add environment variable helpers
3299         https://bugs.webkit.org/show_bug.cgi?id=192405
3300
3301         Reviewed by Michael Catanzaro.
3302
3303         * platform/NotImplemented.h:
3304         * platform/cocoa/SystemVersion.mm:
3305         (WebCore::createSystemMarketingVersion):
3306         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3307         (WebCore::initializeGStreamer):
3308         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3309         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3310         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3311         (Nicosia::PaintingEngine::create):
3312         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3313         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3314         * platform/graphics/x11/PlatformDisplayX11.cpp:
3315         (WebCore::PlatformDisplayX11::create):
3316         * platform/gtk/RenderThemeWidget.cpp:
3317         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3318         * platform/gtk/ScrollbarThemeGtk.cpp:
3319         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3320         * platform/network/curl/CurlContext.cpp:
3321         (WebCore::CurlContext::CurlContext):
3322         (WebCore::EnvironmentVariableReader::read): Deleted.
3323         (WebCore::EnvironmentVariableReader::defined): Deleted.
3324         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3325         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3326         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3327         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3328         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3329         (WebCore::defaultCookieJarPath):
3330         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3331         (WebCore::getCACertPathEnv):
3332         * platform/network/win/CurlSSLHandleWin.cpp:
3333         (WebCore::getCACertPathEnv):
3334         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3335         (WebCore::topLevelPath):
3336         (WebCore::webkitBuildDirectory):
3337         * platform/unix/LoggingUnix.cpp:
3338         (WebCore::logLevelString):
3339         * platform/win/LoggingWin.cpp:
3340         (WebCore::logLevelString):
3341         Utilize WTF::Environment where possible.
3342
3343 2019-02-14  Chris Dumez  <cdumez@apple.com>
3344
3345         [PSON] Introduce a WebContent Process cache
3346         https://bugs.webkit.org/show_bug.cgi?id=194594
3347         <rdar://problem/46793397>
3348
3349         Reviewed by Geoff Garen.
3350
3351         Update localizable strings.
3352
3353         * en.lproj/Localizable.strings:
3354
3355 2019-02-14  Commit Queue  <commit-queue@webkit.org>
3356
3357         Unreviewed, rolling out r241486.
3358         https://bugs.webkit.org/show_bug.cgi?id=194655
3359
3360         causing API failures in builds (Requested by ShawnRoberts on
3361         #webkit).
3362
3363         Reverted changeset:
3364
3365         "[Cocoa] Media elements will restart network buffering just
3366         before suspending"
3367         https://bugs.webkit.org/show_bug.cgi?id=193691
3368         https://trac.webkit.org/changeset/241486
3369
3370 2019-02-13  Brian Burg  <bburg@apple.com>
3371
3372         Web Inspector: don't include accessibility role in DOM.Node object payloads
3373         https://bugs.webkit.org/show_bug.cgi?id=194623
3374         <rdar://problem/36384037>
3375
3376         Reviewed by Devin Rousso.
3377
3378         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
3379         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
3380         first place due to a DOM node tree update (i.e., NodeInserted).
3381
3382         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
3383         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
3384         necessary to collect this information in a problematic way when initially pushing the node, as
3385         it will be updated anyway.
3386
3387         No new tests, no change in behavior.
3388
3389         * inspector/agents/InspectorDOMAgent.cpp:
3390         (WebCore::InspectorDOMAgent::buildObjectForNode):
3391
3392 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3393
3394         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
3395         https://bugs.webkit.org/show_bug.cgi?id=194622
3396
3397         Reviewed by Antti Koivisto.
3398
3399         Ensure that block replaced boxes don't collapse through their vertical margins. 
3400
3401         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
3402
3403         * layout/blockformatting/BlockMarginCollapse.cpp:
3404         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
3405         * page/FrameViewLayoutContext.cpp:
3406         (WebCore::layoutUsingFormattingContext):
3407
3408 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3409
3410         [LFC] Shrink-to-fit-width should be constrained by min/max width
3411         https://bugs.webkit.org/show_bug.cgi?id=194653
3412
3413         Reviewed by Antti Koivisto.
3414
3415         Use the fixed value of min-width/max-width to constrain the computed preferred width.
3416
3417         * layout/FormattingContext.h:
3418         * layout/FormattingContextGeometry.cpp:
3419         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
3420         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3421         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3422         * layout/inlineformatting/InlineFormattingContext.cpp:
3423         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
3424
3425 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
3426
3427         Crash in DOMTimer::fired
3428         https://bugs.webkit.org/show_bug.cgi?id=194638
3429
3430         Reviewed by Brent Fulgham.
3431
3432         This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.
3433
3434         The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
3435         is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).
3436
3437         Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
3438         from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
3439         we would not leak these DOM timers.
3440
3441         We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
3442         size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
3443         Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
3444         and is no longer the preferred approach when dealing with these classes of bugs in WebKit.
3445
3446         Test: fast/dom/timer-destruction-during-firing.html
3447
3448         * page/DOMTimer.cpp:
3449         (WebCore::NestedTimersMap::add):
3450         (WebCore::DOMTimer::install):
3451         (WebCore::DOMTimer::fired):
3452
3453 2019-02-13  Joseph Pecoraro  <pecoraro@apple.com>
3454
3455         Web Inspector: Crash when inspecting an element that constantly changes visibility
3456         https://bugs.webkit.org/show_bug.cgi?id=194632
3457         <rdar://problem/48060258>
3458
3459         Reviewed by Matt Baker and Devin Rousso.
3460
3461         * inspector/agents/InspectorDOMAgent.h:
3462         * inspector/agents/InspectorDOMAgent.cpp:
3463         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
3464         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3465         Don't use rvalue-references as that was taking ownership and deleting
3466         the object we want to keep around. Instead simplify this to just use
3467         references so no ref counting changes happen.
3468
3469 2019-02-13  Chris Fleizach  <cfleizach@apple.com>
3470
3471         AX: Crash in handleMenuOpen
3472         https://bugs.webkit.org/show_bug.cgi?id=194627
3473
3474         Reviewed by Zalan Bujtas.
3475
3476         Tests run under libGuardMalloc will cause crashes.
3477
3478         This list of objects is a Node list, not an Element list, so we were
3479         not removing some nodes when they were being deallocated.
3480
3481         * accessibility/AXObjectCache.cpp:
3482         (WebCore::AXObjectCache::remove):
3483
3484 2019-02-13  Jer Noble  <jer.noble@apple.com>
3485
3486         [Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
3487         https://bugs.webkit.org/show_bug.cgi?id=194621
3488         <rdar://problem/48002560>
3489
3490         Reviewed by Eric Carlson.
3491
3492         When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
3493         change events in the media-controller.js on rAF().
3494
3495         * Modules/modern-media-controls/media/media-controller.js:
3496         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
3497
3498 2019-02-13  John Wilander  <wilander@apple.com>
3499
3500         Ignore Ad Click Attribution where source and destination are same-site
3501         https://bugs.webkit.org/show_bug.cgi?id=194620
3502         <rdar://problem/47890018>
3503
3504         Reviewed by Jiewen Tan.
3505
3506         Updated the existing test.
3507
3508         We should not accept Ad Click Attribution requests where the site of the
3509         anchor tag and its addestination attribute are same-site. Such attributions
3510         don’t make sense (the site can track intra-site clicks through better means)
3511         and would just lead to increased memory use where are the pending
3512         attributions are stored.
3513
3514         For ports that don't have access to the Public Suffix List, this patch
3515         only checks that the hosts don't match, i.e. not just eTLD+1.
3516
3517         * html/HTMLAnchorElement.cpp:
3518         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
3519             Now returns WTF::nullopt if the current document and the
3520             addestination are same site. Also fixed a console message
3521             typo.
3522
3523 2019-02-13  Eric Carlson  <eric.carlson@apple.com> and Youenn Fablet  <youenn@apple.com>
3524
3525         getUserMedia with an ideal deviceId constraint doesn't always select the correct device
3526         https://bugs.webkit.org/show_bug.cgi?id=193614
3527
3528         Reviewed by Eric Carlson.
3529
3530         Compute a fitness score based on constraints.
3531         For each constraint, a fitness score is computed from the distance.
3532         The smaller the distance, the higher the score.
3533         Fitness scores are then summed to give a device fitness score.
3534         Matching devices are then sorted according the fitness score.
3535
3536         For important constraints, deviceId and facingMode, add a more important weight.
3537         This ensures that should any of these ideal constraints are set, they will be respected.
3538
3539         Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
3540         Do not set a default ideal frameRate if width and height are already set.
3541
3542         Covered by updated test.
3543
3544         * platform/mediastream/MediaConstraints.cpp:
3545         (WebCore::FlattenedConstraint::set):
3546         (WebCore::MediaConstraints::setDefaultVideoConstraints):
3547         * platform/mediastream/RealtimeMediaSource.cpp:
3548         (WebCore::RealtimeMediaSource::fitnessDistance):
3549         (WebCore::RealtimeMediaSource::selectSettings):
3550         (WebCore::RealtimeMediaSource::supportsConstraints):
3551         (WebCore::RealtimeMediaSource::applyConstraints):
3552         * platform/mediastream/RealtimeMediaSource.h:
3553         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3554         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
3555
3556 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
3557
3558         [iOS] Add a hack to work around buggy video control library
3559         https://bugs.webkit.org/show_bug.cgi?id=194615
3560         <rdar://problem/46146946>
3561
3562         Reviewed by Jer Noble.
3563
3564         Test: media/ios/video-volume-ios-quirk.html
3565
3566         * html/HTMLMediaElement.cpp:
3567         (WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
3568         (WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
3569         (WebCore::HTMLMediaElement::closeTaskQueues): Close it.
3570         * html/HTMLMediaElement.h:
3571
3572 2019-02-13  Jer Noble  <jer.noble@apple.com>
3573
3574         [Cocoa] Media elements will restart network buffering just before suspending
3575         https://bugs.webkit.org/show_bug.cgi?id=193691
3576
3577         Reviewed by Eric Carlson.
3578
3579         API Test: WebKit.ProcessSuspendMediaBuffering
3580
3581         Allow the Page to suspend all media buffering in its child Documents.
3582
3583         * dom/Document.cpp:
3584         (WebCore::Document::suspendAllMediaBuffering):
3585         (WebCore::Document::resumeAllMediaBuffering):
3586         * dom/Document.h:
3587         * html/MediaElementSession.cpp:
3588         (WebCore::MediaElementSession::dataBufferingPermitted const):
3589         (WebCore::MediaElementSession::suspendBuffering):
3590         (WebCore::MediaElementSession::resumeBuffering):
3591         (WebCore::MediaElementSession::bufferingSuspended const):
3592         * html/MediaElementSession.h:
3593         * page/Page.cpp:
3594         (WebCore::Page::suspendAllMediaBuffering):
3595         (WebCore::Page::resumeAllMediaBuffering):
3596         * page/Page.h:
3597         (WebCore::Page::mediaPlaybackIsSuspended const):
3598         (WebCore::Page::mediaBufferingIsSuspended const):
3599         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
3600         * platform/audio/PlatformMediaSession.h:
3601         (WebCore::PlatformMediaSession::suspendBuffering):
3602         (WebCore::PlatformMediaSession::resumeBuffering):
3603         * platform/audio/PlatformMediaSessionManager.cpp:
3604         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
3605         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
3606         * platform/audio/PlatformMediaSessionManager.h:
3607
3608 2019-02-13  Jer Noble  <jer.noble@apple.com>
3609
3610         Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root
3611         https://bugs.webkit.org/show_bug.cgi?id=194516
3612         <rdar://problem/44678353>
3613
3614         Reviewed by Antoine Quint.
3615
3616         Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html
3617
3618         When walking up the element ancestor chain, use parentElementInComposedTree() to
3619         walk past the shadow root boundary.
3620
3621         * dom/Element.cpp:
3622         (WebCore::parentCrossingFrameBoundaries):
3623
3624 2019-02-13  Chris Dumez  <cdumez@apple.com>
3625
3626         Unreviewed, update localizable strings.
3627
3628         * en.lproj/Localizable.strings:
3629
3630 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
3631
3632         Further restricting webarchive loads
3633         https://bugs.webkit.org/show_bug.cgi?id=194567
3634         <rdar://problem/47610130>
3635
3636         Reviewed by Youenn Fablet.
3637
3638         This patch futher restricts main frame webarchive loads to the followings:
3639         1) loaded by clients;
3640         2) loaded by drag;
3641         3) reloaded from any of the previous two.
3642
3643         It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
3644         to FrameLoader such that the option is remembered during redirections.
3645
3646         Covered by API tests.
3647
3648         * dom/Document.h:
3649         (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
3650         (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
3651         * loader/DocumentLoader.cpp:
3652         (WebCore::DocumentLoader::disallowWebArchive const):
3653         * loader/DocumentLoader.h:
3654         (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
3655         (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
3656         * loader/FrameLoadRequest.h:
3657         (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
3658         (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
3659         * loader/FrameLoader.cpp:
3660         (WebCore::FrameLoader::load):
3661         (WebCore::FrameLoader::reload):
3662         * loader/FrameLoader.h:
3663         (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
3664         (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
3665         * page/DragController.cpp:
3666         (WebCore::DragController::performDragOperation):
3667         * testing/Internals.cpp:
3668         (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
3669         * testing/Internals.h:
3670         * testing/Internals.idl:
3671
3672 2019-02-13  Jer Noble  <jer.noble@apple.com>
3673
3674         Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()
3675         https://bugs.webkit.org/show_bug.cgi?id=194613
3676         <rdar://problem/48023912>
3677
3678         Reviewed by Eric Carlson.
3679
3680         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3681         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3682
3683 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
3684
3685         Unreviewed, fix unused variable warnings after r241148/r241251
3686         https://bugs.webkit.org/show_bug.cgi?id=194348
3687         <rdar://problem/47566449>
3688
3689         * Modules/mediasource/SourceBuffer.cpp:
3690         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
3691         (WebCore::SourceBuffer::evictCodedFrames):
3692         (WebCore::SourceBuffer::provideMediaData):
3693
3694 2019-02-13  Sihui Liu  <sihui_liu@apple.com>
3695
3696         REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash
3697         https://bugs.webkit.org/show_bug.cgi?id=194413
3698         <rdar://problem/47897254>
3699
3700         Reviewed by Brady Eidson.
3701
3702         IDB clients expected transaction operations to be executed in order, but in 
3703         UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly.
3704         This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order
3705         as IDB Server receives the request.
3706
3707         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3708         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
3709         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
3710         (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
3711         (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
3712         (WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback):
3713         (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
3714         (WebCore::IDBServer::UniqueIDBDatabase::performCountCallback):
3715         (WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback):
3716         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3717
3718 2019-02-13  John Wilander  <wilander@apple.com>
3719
3720         Store Ad Click Attribution requests in the network process
3721         https://bugs.webkit.org/show_bug.cgi?id=194510
3722         <rdar://problem/47650118>
3723
3724         Reviewed by Alex Christensen and Daniel Bates.
3725
3726         Test: http/tests/adClickAttribution/store-ad-click-attribution.html
3727
3728         This patch adds support functions for validation and storage of
3729         WebCore::AdClickAttribution objects. It also adds WTF::HashTraits so that
3730         WebCore::AdClickAttribution::Source and WebCore::AdClickAttribution::Destination
3731         can be used in a HashMap.
3732
3733         * loader/AdClickAttribution.cpp:
3734         (WebCore::AdClickAttribution::toString const):
3735         * loader/AdClickAttribution.h:
3736         (WebCore::AdClickAttribution::Source::operator== const):
3737         (WebCore::AdClickAttribution::Source::deletedValue):
3738         (WebCore::AdClickAttribution::Source::constructDeletedValue):
3739         (WebCore::AdClickAttribution::Source::deleteValue):
3740         (WebCore::AdClickAttribution::Source::isDeletedValue const):
3741         (WebCore::AdClickAttribution::SourceHash::hash):
3742         (WebCore::AdClickAttribution::SourceHash::equal):
3743         (WebCore::AdClickAttribution::Destination::operator== const):
3744         (WebCore::AdClickAttribution::Destination::matches const):
3745             This convenience function allows matching of a WTF::URL object.
3746         (WebCore::AdClickAttribution::Destination::deletedValue):
3747         (WebCore::AdClickAttribution::Destination::constructDeletedValue):
3748         (WebCore::AdClickAttribution::Destination::deleteValue):
3749         (WebCore::AdClickAttribution::Destination::isDeletedValue const):
3750         (WebCore::AdClickAttribution::DestinationHash::hash):
3751         (WebCore::AdClickAttribution::DestinationHash::equal):
3752         (WebCore::AdClickAttribution::source const):
3753         (WebCore::AdClickAttribution::destination const):
3754             Getters added to support mapped storage based on source and destination.
3755         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::emptyValue):
3756         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::constructDeletedValue):
3757         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::isDeletedValue):
3758         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::emptyValue):
3759         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::constructDeletedValue):
3760         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::isDeletedValue):
3761         * loader/NavigationAction.h:
3762         (WebCore::NavigationAction::adClickAttribution const):
3763         (WebCore::NavigationAction::adClickAttribution): Deleted.
3764             Corrected the constness of this function.
3765
3766 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
3767
3768         Revert r240434
3769         https://bugs.webkit.org/show_bug.cgi?id=194600
3770         <rdar://problem/48044566>
3771
3772         Reviewed by Brent Fulgham.
3773
3774         * html/HTMLMediaElement.cpp:
3775         (WebCore::HTMLMediaElement::setVolume):
3776         (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
3777         (WebCore::HTMLMediaElement::updateVolume):
3778         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3779         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):
3780
3781 2019-02-13  Alex Christensen  <achristensen@webkit.org>
3782
3783         Stop using setDefersLoading from WebCore
3784         https://bugs.webkit.org/show_bug.cgi?id=194315
3785
3786         Reviewed by Jer Noble.
3787
3788         That is what CompletionHandlers are for.
3789
3790         * loader/MediaResourceLoader.cpp:
3791         (WebCore::MediaResource::responseReceived):
3792         (WebCore::MediaResource::setDefersLoading): Deleted.
3793         * loader/MediaResourceLoader.h:
3794         * platform/graphics/PlatformMediaResourceLoader.h:
3795         (WebCore::PlatformMediaResourceClient::responseReceived):
3796         (WebCore::PlatformMediaResource::stop):
3797         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
3798         * platform/network/cocoa/WebCoreNSURLSession.mm:
3799         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
3800         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
3801         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
3802         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
3803
3804 2019-02-13  Jer Noble  <jer.noble@apple.com>
3805
3806         [Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
3807         https://bugs.webkit.org/show_bug.cgi?id=194580
3808         <rdar://problem/42727739>
3809
3810         Reviewed by Eric Carlson.
3811
3812         * platform/cocoa/CoreVideoSoftLink.cpp:
3813         * platform/cocoa/CoreVideoSoftLink.h:
3814         * platform/graphics/cv/PixelBufferConformerCV.cpp:
3815         (WebCore::CVPixelBufferGetBytePointerCallback):
3816         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
3817
3818 2019-02-13  Antoine Quint  <graouts@apple.com>
3819
3820         Support simulated mouse events on iOS based on a PlatformTouchEvent
3821         https://bugs.webkit.org/show_bug.cgi?id=194501
3822         <rdar://problem/46910790>
3823
3824         Reviewed by Dean Jackson.
3825
3826         Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and
3827         whether simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate
3828         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
3829         EventTarget::innerInvokeEventListeners() to see whether any page code has been evaluated as a result of a mousemove event being dispatched.
3830         Finally, we also track mouse events when invalidating touch regions provided the required internal runtime flag is on.
3831
3832         Test: fast/events/touch/ios/mouse-events-dispatch-with-touch.html
3833
3834         * SourcesCocoa.txt:
3835         * WebCore.xcodeproj/project.pbxproj:
3836         * dom/Event.cpp:
3837         * dom/Event.h:
3838         (WebCore::Event::hasEncounteredListener const):
3839         (WebCore::Event::setHasEncounteredListener):
3840         * dom/EventNames.h:
3841         (WebCore::EventNames::isTouchRelatedEventType const):
3842         (WebCore::EventNames::touchRelatedEventNames const):
3843         (WebCore::EventNames::extendedTouchRelatedEventNames const):
3844         (WebCore::EventNames::isTouchEventType const): Deleted.
3845         (WebCore::EventNames::touchAndPointerEventNames const): Deleted.
3846         * dom/EventTarget.cpp:
3847         (WebCore::EventTarget::innerInvokeEventListeners):
3848         * dom/MouseEvent.h:
3849         * dom/Node.cpp:
3850         (WebCore::Node::moveNodeToNewDocument):
3851         (WebCore::tryAddEventListener):
3852         (WebCore::tryRemoveEventListener):
3853         (WebCore::Node::defaultEventHandler):
3854         * dom/ios/MouseEventIOS.cpp: Added.
3855         (WebCore::mouseEventType):
3856         (WebCore::MouseEvent::create):
3857         * dom/ios/PointerEventIOS.cpp:
3858         (WebCore::pointerEventType):
3859         (WebCore::PointerEvent::create):
3860         (WebCore::eventType): Deleted.
3861         * page/DOMWindow.cpp:
3862         (WebCore::DOMWindow::addEventListener):
3863         (WebCore::DOMWindow::removeEventListener):
3864         * page/EventHandler.h:
3865         * page/RuntimeEnabledFeatures.h:
3866         (WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const):
3867         (WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled):
3868         (WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const):
3869         (WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled):
3870
3871 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3872
3873         [FreeType] Unable to render some Hebrew characters
3874         https://bugs.webkit.org/show_bug.cgi?id=194498
3875
3876         Reviewed by Michael Catanzaro.
3877
3878         We are failing to find a font for some of the combining character sequences because normalization is failing due
3879         to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
3880         we should handle that case to resize the output buffer and try again.
3881
3882         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
3883         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
3884
3885 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
3886
3887         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
3888         https://bugs.webkit.org/show_bug.cgi?id=194582
3889
3890         Reviewed by Antti Koivisto.
3891
3892         Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong
3893         from the non-generated identifier being sent to us as it was the case in this failure.
3894
3895         * loader/PolicyChecker.cpp:
3896         (WebCore::PolicyCheckIdentifier::isValidFor):
3897
3898 2019-02-13  Commit Queue  <commit-queue@webkit.org>
3899
3900         Unreviewed, rolling out r241273.
3901         https://bugs.webkit.org/show_bug.cgi?id=194579
3902
3903         This change is causing a flaky assertion failure crash in High
3904         Sierra Debug (Requested by ShawnRoberts on #webkit).
3905
3906         Reverted changeset:
3907
3908         "Stop using setDefersLoading from WebCore"
3909         https://bugs.webkit.org/show_bug.cgi?id=194315
3910         https://trac.webkit.org/changeset/241273
3911
3912 2019-02-12  Mark Lam  <mark.lam@apple.com>
3913
3914         Remove unnecessary null check in bindings.
3915         https://bugs.webkit.org/show_bug.cgi?id=194581
3916
3917         Reviewed by Yusuke Suzuki.
3918
3919         It is always safe to call visitor.containsOpaqueRoot(root) with a null root pointer.
3920         It will just return false.  Since we don't expect the root pointer to be null in
3921         the common case, having a null check here is also not optimal.  We'll remove this
3922         unneeded null check.
3923
3924         * bindings/scripts/CodeGeneratorJS.pm:
3925         (GenerateImplementation):
3926         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3927         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
3928
3929 2019-02-12  Rob Buis  <rbuis@igalia.com>
3930
3931         Align with Fetch on data: URLs
3932         https://bugs.webkit.org/show_bug.cgi?id=182325
3933
3934         Reviewed by Alex Christensen.
3935
3936         The MIME type part of the data url should be serialized as
3937         specified in step 3 under "data" [1].
3938
3939         Test: web-platform-tests/fetch/data-urls/processing.any.js
3940
3941         [1] https://fetch.spec.whatwg.org/#concept-scheme-fetch 
3942
3943         * platform/network/DataURLDecoder.cpp:
3944         (WebCore::DataURLDecoder::parseMediaType):
3945
3946 2019-02-12  Alex Christensen  <achristensen@webkit.org>
3947
3948         Build fix after r241320
3949         https://bugs.webkit.org/show_bug.cgi?id=194271
3950
3951         * page/Frame.cpp:
3952         (WebCore::Frame::requestDOMPasteAccess):
3953
3954 2019-02-12  Justin