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