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