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