f6fb51c05f13f20c7b913ce85939db4dd1f6f86a
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2
3         [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle
4         https://bugs.webkit.org/show_bug.cgi?id=190895
5
6         Reviewed by Ross Kirsling.
7
8         An assertion was failing in CurlRequest::invokeDidReceiveResponse
9         because DidReceiveResponse was already dispatched. This condition
10         was met if CurlRequestScheduler::completeTransfer is called while
11         waiting for the reply for the first DidReceiveResponse.
12
13         No new tests, covered by existing tests.
14
15         * platform/network/curl/CurlRequest.h:
16         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
17         Return true if m_didNotifyResponse is false disregard to
18         m_didReturnFromNotify.
19
20 2019-02-04  Said Abou-Hallawa  <said@apple.com>
21
22         [CG] Enable setAdditionalSupportedImageTypes for WK1
23         https://bugs.webkit.org/show_bug.cgi?id=194190
24
25         Reviewed by Tim Horton.
26
27         Move the function webCoreStringVectorFromNSStringArray from WebKit to
28         WebCore so it can be used by both WebKit and WebKitLegacy.
29
30         * platform/mac/StringUtilities.h:
31         * platform/mac/StringUtilities.mm:
32         (WebCore::webCoreStringVectorFromNSStringArray):
33
34 2019-02-04  Justin Fan  <justin_fan@apple.com>
35
36         [Web GPU] Code clean-up for RenderPipeline backend
37         https://bugs.webkit.org/show_bug.cgi?id=194238
38
39         Reviewed by Dean Jackson.
40
41         Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
42         the input state's descriptor arrays.
43
44         Covered by existing tests; no change in behavior.
45
46         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
47         (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
48         (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
49
50 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
51
52         Use deferrable timer to restart the Responsiveness Timer on each wheel event
53         https://bugs.webkit.org/show_bug.cgi?id=194135
54         <rdar://problem/47724099>
55
56         Reviewed by Simon Fraser.
57
58         The original DeferrableOneShotTimer was not really deferrable.
59         What it allows is to restart the count down from scratch after
60         firing.
61
62         For this optimization, I want to keep the correct timing but avoid
63         starting a real timer every time.
64
65         I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
66         created a real DeferrableOneShotTimer that support deadlines.
67
68         * css/CSSImageGeneratorValue.cpp:
69         * html/HTMLPlugInImageElement.h:
70         * loader/cache/CachedResource.h:
71         * platform/Timer.cpp:
72         (WebCore::DeferrableOneShotTimer::startOneShot):
73         (WebCore::DeferrableOneShotTimer::fired):
74         * platform/Timer.h:
75         (WebCore::TimerBase::nextFireTime const):
76         (WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
77         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
78         (WebCore::DeferrableOneShotTimer::stop):
79         (WebCore::DeferrableOneShotTimer::restart): Deleted.
80         * platform/graphics/ca/TileController.h:
81         * platform/graphics/cg/SubimageCacheWithTimer.h:
82
83 2019-02-04  Antoine Quint  <graouts@apple.com>
84
85         Use constants for pointer types
86         https://bugs.webkit.org/show_bug.cgi?id=194232
87
88         Reviewed by Dean Jackson.
89
90         We cannot use an enum for the pointer type since a custom pointer type can be created by developers when creating a
91         pointer event using JavaScript, but we can at least used string constants for the ones created internally.
92
93         * dom/PointerEvent.cpp:
94         (WebCore::PointerEvent::mousePointerType):
95         (WebCore::PointerEvent::penPointerType):
96         (WebCore::PointerEvent::touchPointerType):
97         * dom/PointerEvent.h:
98         * dom/ios/PointerEventIOS.cpp:
99
100 2019-02-04  Zalan Bujtas  <zalan@apple.com>
101
102         [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
103         https://bugs.webkit.org/show_bug.cgi?id=194168
104
105         Reviewed by Simon Fraser.
106
107         First paint should not be blocked by async or deferred scripts.
108
109         * page/FrameView.cpp:
110         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
111
112 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
113
114         Async overflow scroll with border-radius renders incorrectly
115         https://bugs.webkit.org/show_bug.cgi?id=194205
116         <rdar://problem/47771668>
117
118         Reviewed by Zalan Bujtas.
119
120         When an element has composited overflow:scroll and border-radius, we need to make a layer
121         to clip to the inside of the border radius if necessary.
122
123         Existing code simply turned off needsDescendantsClippingLayer for composited scrolling
124         layers, but now we check to see if the inner border is rounded. If we have both a m_childContainmentLayer
125         and scrolling layers, we need to adjust the location of the scrolling layers (which are parented
126         in m_childContainmentLayer).
127
128         Also fix offsetFromRenderer for these layers; it's positive for layers inset from the top left
129         of the border box.
130
131         Tests: compositing/clipping/border-radius-async-overflow-clipping-layer.html
132                compositing/clipping/border-radius-async-overflow-non-stacking.html
133                compositing/clipping/border-radius-async-overflow-stacking.html
134
135         * rendering/RenderLayerBacking.cpp:
136         (WebCore::RenderLayerBacking::updateConfiguration):
137         (WebCore::RenderLayerBacking::updateGeometry):
138         (WebCore::RenderLayerBacking::updateChildClippingStrategy): Layout is always up-to-date now, so remove the comment.
139
140 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
141
142         PageOverlayController's layers should be created lazily
143         https://bugs.webkit.org/show_bug.cgi?id=194199
144
145         Reviewed by Tim Horton.
146
147         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
148         and use them to only parent the overlay-hosting layers when necessary.
149
150         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
151         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
152         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
153         compositing updates that parents the layerWithDocumentOverlays().
154
155         View overlays are added to the layer tree via the DrawingArea. When we go between having
156         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
157         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
158         compositing flush (this has to be done manually because view overlay layers are outside the
159         subtree managed by RenderLayerCompositor).
160         
161         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
162         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
163         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
164         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
165
166         * loader/EmptyClients.h:
167         * page/ChromeClient.h:
168         * page/FrameView.cpp:
169         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush
170         because there may be nothing else that does.
171         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
172         * page/Page.cpp:
173         (WebCore::Page::installedPageOverlaysChanged):
174         * page/Page.h:
175         * page/PageOverlayController.cpp:
176         (WebCore::PageOverlayController::hasDocumentOverlays const):
177         (WebCore::PageOverlayController::hasViewOverlays const):
178         (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it
179         might as well be the one to call through the ChromeClient.
180         (WebCore::PageOverlayController::detachViewOverlayLayers):
181         (WebCore::PageOverlayController::installPageOverlay):
182         (WebCore::PageOverlayController::uninstallPageOverlay):
183         * page/PageOverlayController.h:
184         * rendering/RenderLayerCompositor.cpp:
185         (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it.
186         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
187         (WebCore::RenderLayerCompositor::attachRootLayer):
188         (WebCore::RenderLayerCompositor::detachRootLayer):
189
190 2019-02-04  Eric Liang  <ericliang@apple.com>
191
192         When performing Increment or Decrement on sliders, check to see if the slider is disabled.
193         https://bugs.webkit.org/show_bug.cgi?id=173497
194
195         Reviewed by Chris Fleizach.
196
197         Test: accessibility/set-value-not-work-for-disabled-sliders.html
198
199         * accessibility/AccessibilityNodeObject.cpp:
200         (WebCore::AccessibilityNodeObject::alterSliderValue):
201
202 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
203
204         IndexedDB: leak WebIDBConnectionToServer in layout tests
205         https://bugs.webkit.org/show_bug.cgi?id=193688
206         <rdar://problem/47353263>
207
208         Reviewed by Geoffrey Garen.
209
210         Let IDBConnectionToServer keep a WeakPtr of IDBConnectionToServerDelegate.
211
212         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
213         (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer):
214         * Modules/indexeddb/client/IDBConnectionToServer.h:
215         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
216
217 2019-02-04  Youenn Fablet  <youenn@apple.com>
218
219         Make sure to remove the device observer in AVVideoCaptureSource
220         https://bugs.webkit.org/show_bug.cgi?id=194181
221         <rdar://problem/47739247>
222
223         Reviewed by Eric Carlson.
224
225         Make sure to remove the device observer when the observer is destroyed.
226         To simplify things, add the observer in AVVideoCaptureSource constructor and remove it in the destructor.
227
228         Make also sure the session observer is also removed whenever the session is released by AVVideoCaptureSource.
229
230         Covered by manual test.
231
232        * platform/mediastream/mac/AVVideoCaptureSource.h:
233         * platform/mediastream/mac/AVVideoCaptureSource.mm:
234         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
235         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
236         (WebCore::AVVideoCaptureSource::initializeSession):
237         (WebCore::AVVideoCaptureSource::clearSession):
238         (WebCore::AVVideoCaptureSource::stopProducingData):
239         (WebCore::AVVideoCaptureSource::setupSession):
240
241 2019-02-04  Antoine Quint  <graouts@apple.com>
242
243         Use a dedicated type instead of int32_t for pointer identifiers
244         https://bugs.webkit.org/show_bug.cgi?id=194217
245
246         Reviewed by Antti Koivisto.
247
248         * WebCore.xcodeproj/project.pbxproj:
249         * dom/PointerEvent.h:
250         * dom/PointerID.h: Added.
251         * page/PointerCaptureController.cpp:
252         (WebCore::PointerCaptureController::setPointerCapture):
253         (WebCore::PointerCaptureController::releasePointerCapture):
254         (WebCore::PointerCaptureController::hasPointerCapture):
255         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
256         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
257         (WebCore::PointerCaptureController::cancelPointer):
258         * page/PointerCaptureController.h:
259
260 2019-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
261
262         [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
263         Followup to https://bugs.webkit.org/show_bug.cgi?id=193758
264
265         Reviewed by Daniel Bates.
266
267         Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
268         behavior.
269
270         * editing/EditingBehavior.h:
271         (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):
272         * html/HTMLInputElement.cpp:
273         (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):
274
275 2019-02-04  Zalan Bujtas  <zalan@apple.com>
276
277         [LFC][IFC] Make InlineFormattingContext::collectInlineContent non-recursive.
278         https://bugs.webkit.org/show_bug.cgi?id=194210
279
280         Reviewed by Antti Koivisto.
281
282         Use iterative algorithm to collect inline content (and add breaking rules).
283         This is in preparation for fixing the inline preferred width computation.  
284
285         * layout/Verification.cpp:
286         (WebCore::Layout::resolveForRelativePositionIfNeeded):
287         * layout/inlineformatting/InlineFormattingContext.cpp:
288         (WebCore::Layout::addDetachingRules):
289         (WebCore::Layout::createAndAppendInlineItem):
290         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
291         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): Deleted.
292         * layout/inlineformatting/InlineFormattingContext.h:
293
294 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
295
296         Unreviewed, fix unused variable warnings introduced in r240912
297         https://bugs.webkit.org/show_bug.cgi?id=194198
298         <rdar://problem/47776051>
299
300         * page/FrameView.cpp:
301         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
302         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
303
304 2019-02-04  Frederic Wang  <fwang@igalia.com>
305
306         [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow
307         https://bugs.webkit.org/show_bug.cgi?id=191816
308
309         Reviewed by Wenson Hsieh.
310
311         This patch fixes a bug that prevents children of a scroll container to create snap positions
312         when they have non-visible overflow. This happens because for such a child, the function
313         RenderBox::findEnclosingScrollableContainer() will return the child itself rather than the
314         scroll container. To address that issue, we introduce a new
315         RenderObject::enclosingScrollableContainerForSnapping() helper function that ensures that
316         a real RenderBox ancestor is returned.
317
318         Test: css3/scroll-snap/scroll-snap-children-with-overflow.html
319
320         * page/scrolling/AxisScrollSnapOffsets.cpp:
321         (WebCore::updateSnapOffsetsForScrollableArea): Use enclosingScrollableContainerForSnapping()
322         so that we don't skip children with non-visible overflow.
323         * rendering/RenderLayerModelObject.cpp:
324         (WebCore::RenderLayerModelObject::styleDidChange): Ditto. The new function calls
325         enclosingBox().
326         * rendering/RenderObject.cpp:
327         (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Return
328         the scrollable container of the enclosing box. If it is actually the render object itself
329         then start the search from the parent box instead.
330         * rendering/RenderObject.h: Declare enclosingScrollableContainerForSnapping(). 
331
332 2019-02-04  Antti Koivisto  <antti@apple.com>
333
334         Rename GraphicsLayer and PlatformCALayer scrolling layer type enum values to be less ambiguous
335         https://bugs.webkit.org/show_bug.cgi?id=194215
336
337         Reviewed by Frédéric Wang.
338
339         GraphicsLayer::Type::Scrolling -> GraphicsLayer::Type::ScrollContainer
340         PlatformCALayer::LayerTypeScrollingLayer -> PlatformCALayer::LayerTypeScrollContainerLayer
341
342         * platform/graphics/GraphicsLayer.cpp:
343         (WebCore::GraphicsLayer::supportsLayerType):
344         * platform/graphics/GraphicsLayer.h:
345         * platform/graphics/ca/GraphicsLayerCA.cpp:
346         (WebCore::GraphicsLayer::supportsLayerType):
347         (WebCore::GraphicsLayerCA::initialize):
348         * platform/graphics/ca/PlatformCALayer.cpp:
349         (WebCore::operator<<):
350         * platform/graphics/ca/PlatformCALayer.h:
351         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
352         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
353         (WebCore::PlatformCALayerCocoa::commonInit):
354         * rendering/RenderLayerBacking.cpp:
355         (WebCore::RenderLayerBacking::updateScrollingLayers):
356         * rendering/RenderLayerCompositor.cpp:
357         (WebCore::RenderLayerCompositor::ensureRootLayer):
358
359 2019-02-03  Antti Koivisto  <antti@apple.com>
360
361         [iOS] Tiles not created in large scrollable iframes
362         https://bugs.webkit.org/show_bug.cgi?id=193665
363
364         Reviewed by Simon Fraser.
365
366         We are not syncing scroll position back to the graphics layer tree correctly.
367
368         Test by Frédéric Wang.
369
370         * page/scrolling/AsyncScrollingCoordinator.cpp:
371         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
372         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
373         (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
374
375         Factor setting and syncing scrolling layer positions into a function.
376         Use bounds.origin scrolling mechanic when scrollContainerLayer is present.
377
378         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
379         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
380         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Deleted.
381         * page/scrolling/AsyncScrollingCoordinator.h:
382         * page/scrolling/ScrollingCoordinator.cpp:
383         (WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView):
384         (WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView):
385         (WebCore::ScrollingCoordinator::scrollLayerForFrameView): Deleted.
386         * page/scrolling/ScrollingCoordinator.h:
387         * rendering/RenderLayerCompositor.cpp:
388
389         Rename scrollLayer to scrolledContentsLayer according to out preferred naming scheme and use it in that role only.
390         Add scrollContainerLayer as a separate layer. It is only constructed when using async scrolling on iOS.
391
392         (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
393         (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation const):
394         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
395         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
396         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
397         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
398         (WebCore::RenderLayerCompositor::frameViewDidScroll):
399         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
400         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
401         (WebCore::RenderLayerCompositor::updateLayerForHeader):
402         (WebCore::RenderLayerCompositor::updateLayerForFooter):
403         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
404         (WebCore::RenderLayerCompositor::ensureRootLayer):
405         (WebCore::RenderLayerCompositor::destroyRootLayer):
406         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
407         * rendering/RenderLayerCompositor.h:
408
409 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
410
411         Make setNeedsLayout on the root more explicitly about triggering its side-effects
412         https://bugs.webkit.org/show_bug.cgi?id=194198
413
414         Reviewed by Antti Koivisto.
415
416         Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree
417         generally manages its own dirty state.
418
419         Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects
420         of layout, like compositing updates, which are required when view configuration state, like
421         headers, footers and transparency, change. These dependencies are currently implicit and
422         poorly defined.
423
424         Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure
425         rendering updates, vs updates of downstream data strutures like compositing. It's now called
426         setNeedsLayoutAfterViewConfigurationChange(). In addition, expose
427         setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers
428         can trigger the appropriate types of compositing updates on the root layer.
429
430         In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a
431         layout. Withtout this, some callers would dirty the RenderView's layout but rely on some
432         other trigger to make the layout happen.
433
434         This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout
435         but never scheduled it, making banner insertion in MiniBrowser unreliable.
436
437         This patch also removes the aliasing of headerHeight/footerHeight between Page and
438         FrameView. Banners are a property of Page, so FrameView fetches the banner heights
439         from Page.
440
441         * page/FrameView.cpp:
442         (WebCore::FrameView::headerHeight const):
443         (WebCore::FrameView::footerHeight const):
444         (WebCore::FrameView::availableContentSizeChanged):
445         (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange):
446         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
447         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
448         (WebCore::FrameView::scheduleSelectionUpdate):
449         (WebCore::FrameView::setTransparent):
450         (WebCore::FrameView::setBaseBackgroundColor):
451         (WebCore::FrameView::setAutoSizeFixedMinimumHeight):
452         (WebCore::FrameView::enableAutoSizeMode):
453         (WebCore::FrameView::setHeaderHeight): Deleted.
454         (WebCore::FrameView::setFooterHeight): Deleted.
455         (WebCore::FrameView::setNeedsLayout): Deleted.
456         * page/FrameView.h:
457         * page/FrameViewLayoutContext.cpp:
458         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
459         (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted.
460         * page/FrameViewLayoutContext.h:
461         * page/Page.cpp:
462         (WebCore::Page::setPageScaleFactor):
463         (WebCore::Page::setHeaderHeight):
464         (WebCore::Page::setFooterHeight):
465         (WebCore::Page::addHeaderWithHeight): Deleted.
466         (WebCore::Page::addFooterWithHeight): Deleted.
467         * page/Page.h:
468         * rendering/RenderLayerCompositor.cpp:
469         (WebCore::RenderLayerCompositor::updateBacking):
470         * testing/Internals.cpp:
471         (WebCore::Internals::resetToConsistentState):
472         (WebCore::Internals::setHeaderHeight):
473         (WebCore::Internals::setFooterHeight):
474
475 2019-02-03  John Wilander  <wilander@apple.com>
476
477         Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
478         https://bugs.webkit.org/show_bug.cgi?id=194104
479         <rdar://problem/47649991>
480
481         Reviewed by Chris Dumez, Daniel Bates, and Darin Adler.
482
483         Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html
484
485         This patch adds parsing and validation of the two new Ad Click Attribution
486         attributes in anchor elements: adcampaignid and addestination. The data is
487         not yet forwarded into the loader.
488
489         * html/HTMLAnchorElement.cpp:
490         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
491         (WebCore::HTMLAnchorElement::handleClick):
492             Now calls HTMLAnchorElement::parseAdClickAttribution().
493         * html/HTMLAnchorElement.h:
494         * loader/AdClickAttribution.h:
495             Made WebCore::AdClickAttribution copyable since it's needed to have it be
496             WTF::Optional. Also made AdClickAttribution::MaxEntropy public. Changed
497             numeric types from unsigned short to uint32_t.
498         (WebCore::AdClickAttribution::Campaign::isValid const):
499         (WebCore::AdClickAttribution::Conversion::isValid const):
500
501 2019-02-03  Ryosuke Niwa  <rniwa@webkit.org>
502
503         Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
504         https://bugs.webkit.org/show_bug.cgi?id=194189
505
506         Reviewed by Geoffrey Garen.
507
508         Introduced PolicyCheckIdentifier to pair each navigation policy check request with a decision,
509         and deployed it in PolicyChecker. The identifier is passed from WebContent process to UI process
510         in WebKit2, and passed it back with the policy decision.
511
512         Because PolicyCheckIdentifier embeds the process identifier from which a navigation policy is checked,
513         we would be able to detect when UI process had sent the decision to a wrong WebContent process.
514
515         This patch also adds release assertions to make sure history().provisionalItem() is set whenever
516         we're requesting a navigation policy check.
517
518         These code changes should either:
519         1. Fix crashes in FrameLoader::continueLoadAfterNavigationPolicy where isBackForwardLoadType would
520            return true yet history().provisionalItem() is null.
521         2. Detect a bug that UI process can send a navigation policy decision to a wrong WebContent process.
522         3. Rule out the possibility that (2) exists.
523
524         * loader/DocumentLoader.cpp:
525         (WebCore::DocumentLoader::willSendRequest):
526         (WebCore::DocumentLoader::responseReceived):
527         * loader/EmptyClients.cpp:
528         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
529         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
530         * loader/EmptyFrameLoaderClient.h:
531         * loader/FrameLoader.cpp:
532         (WebCore::FrameLoader::checkContentPolicy):
533         (WebCore::FrameLoader::loadURL):
534         (WebCore::FrameLoader::load):
535         (WebCore::FrameLoader::loadWithDocumentLoader):
536         (WebCore::FrameLoader::loadPostRequest):
537         * loader/FrameLoader.h:
538         * loader/FrameLoaderClient.h:
539         * loader/FrameLoaderTypes.h:
540         (WebCore::PolicyCheckIdentifier): Added.
541         (WebCore::PolicyCheckIdentifier::operator== const): Added.
542         (WebCore::PolicyCheckIdentifier::PolicyCheckIdentifier): Added.
543         (WebCore::PolicyCheckIdentifier::encode const): Added.
544         (WebCore::PolicyCheckIdentifier::decode): Added.
545         * loader/PolicyChecker.cpp:
546         (WebCore::PolicyCheckIdentifier::generate):
547         (WebCore::PolicyCheckIdentifier::isValidFor): Returns true if the identifer matches. Also release asserts
548         that the process ID is same, and that m_check is always not zero (meaning it's a generated value).
549         The failure of these release assertions would indicate that there is a bug in UI process, which results in
550         a policy decision response being sent to a wrong Web process.
551         (WebCore::PolicyChecker::checkNavigationPolicy): Exit early if isValidFor fails.
552         (WebCore::PolicyChecker::checkNewWindowPolicy):
553
554 2019-02-03  Antti Koivisto  <antti@apple.com>
555
556         Don't include ScrollCoordinator.h from Element.h
557         https://bugs.webkit.org/show_bug.cgi?id=194206
558
559         Reviewed by Daniel Bates.
560
561         * dom/Element.h:
562
563 2019-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
564
565         Unable to move selection into editable roots with 0 height
566         https://bugs.webkit.org/show_bug.cgi?id=194143
567         <rdar://problem/47767284>
568
569         Reviewed by Ryosuke Niwa.
570
571         Currently, positions inside editable elements of height 0 are not considered to be candidates when
572         canonicalizing a position to its visible counterpart. This prevents us from moving the selection into these
573         editable roots at all. To fix this, we relax this constraint by allowing positions anchored by root editable
574         elements to be candidates.
575
576         Test: editing/selection/insert-text-in-empty-content-editable.html
577
578         * dom/Position.cpp:
579         (WebCore::Position::isCandidate const):
580
581 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
582
583         Tidyup of Pagination and FrameView m_mediaType initialization
584         https://bugs.webkit.org/show_bug.cgi?id=194203
585
586         Reviewed by Darin Adler.
587
588         Fix post-commit feedback on lines around code changed in r240901.
589
590         * page/FrameView.cpp:
591         (WebCore::FrameView::FrameView):
592         * page/FrameView.h:
593         * rendering/Pagination.h:
594         (WebCore::Pagination::operator!= const):
595
596 2019-02-03  Megan Gardner  <megan_gardner@apple.com>
597
598         Turn on Smart Paste
599         https://bugs.webkit.org/show_bug.cgi?id=193786
600
601         Reviewed by Ryosuke Niwa.
602
603         Turned on a modified tests:
604         LayoutTests/editing/pasteboard/smart-paste-001.html
605         LayoutTests/editing/pasteboard/smart-paste-002.html
606         LayoutTests/editing/pasteboard/smart-paste-003.html
607         LayoutTests/editing/pasteboard/smart-paste-004.html
608         LayoutTests/editing/pasteboard/smart-paste-005.html
609         LayoutTests/editing/pasteboard/smart-paste-006.html
610         LayoutTests/editing/pasteboard/smart-paste-007.html
611         LayoutTests/editing/pasteboard/smart-paste-008.html
612
613         * platform/ios/PasteboardIOS.mm:
614         (WebCore::Pasteboard::canSmartReplace):
615         Turn on smart replace.
616
617 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
618
619         Tidy up data memebers of FrameView and related classes to shrink class sizes
620         https://bugs.webkit.org/show_bug.cgi?id=194197
621
622         Reviewed by Zalan Bujtas.
623
624         Make various enums 8-bit. Re-order data members of FrameView, FrameViewLayoutContext, Widget
625         and ScrollView to optimize padding.
626
627         Use more data member initializers.
628
629         This shrinks FrameView from 1168 (144 padding bytes) to 1096 (96 padding bytes).
630
631         * dom/Element.h:
632         * page/FrameView.cpp:
633         (WebCore::FrameView::FrameView):
634         * page/FrameView.h:
635         * page/FrameViewLayoutContext.h:
636         * platform/ScrollTypes.h:
637         * platform/ScrollView.h: Data members should come after member functions.
638         * platform/Widget.h:
639         * rendering/Pagination.h:
640         (WebCore::Pagination::Pagination): Deleted.
641
642 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
643
644         Rename "scrollingLayer" in RenderLayerBacking to "scrollContainerLayer" for clarity
645         https://bugs.webkit.org/show_bug.cgi?id=194194
646
647         Rubber-stampted by Antti Koivisto.
648
649         Our desired terminology is "scrollContainerLayer" for the outer, clipping layer
650         for scrolling, and "scrolledContentsLayer" for the contents that move when you scroll.
651
652         * rendering/RenderLayerBacking.cpp:
653         (WebCore::RenderLayerBacking::updateDebugIndicators):
654         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
655         (WebCore::RenderLayerBacking::updateGeometry):
656         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
657         (WebCore::RenderLayerBacking::updateAfterDescendants):
658         (WebCore::RenderLayerBacking::updateInternalHierarchy):
659         (WebCore::RenderLayerBacking::updateDrawsContent):
660         (WebCore::RenderLayerBacking::updateScrollingLayers):
661         * rendering/RenderLayerBacking.h:
662         * rendering/RenderLayerCompositor.cpp:
663         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
664         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
665         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
666         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
667         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
668         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
669
670 2019-02-02  Justin Fan  <justin_fan@apple.com>
671
672         [Web GPU] Fix GPURenderPassEncoder::setVertexBuffers and allow overlapping indices with GPUBindGroups
673         https://bugs.webkit.org/show_bug.cgi?id=194125
674
675         Reviewed by Myles C. Maxfield.
676
677         GPURenderPassEncoder::setVertexBuffers is now actually written to set all buffers provided. In addition,
678         shift vertex input buffer indices so that any resource bindings can bind vertex buffer resources to the same indices. 
679
680         Existing tests cover setVertexBuffers. Updated buffer-resource-triangles to assign bind groups and vertex buffers to the same index.
681
682         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: Added.
683         (WebCore::WHLSL::Metal::calculateVertexBufferIndex): Simple shifting function for vertex input buffer indices.
684         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: Added.
685         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
686         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const): Limit maximum bind group indices to 0 to 3.
687         * Modules/webgpu/WebGPURenderPassEncoder.cpp: 
688         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Limit vertex input indices to 0 to 15.
689         * Modules/webgpu/WebGPURenderPassEncoder.h: Move IDL/bindings bug note to IDL file.
690         * Modules/webgpu/WebGPURenderPassEncoder.idl: Ditto.
691         * platform/graphics/gpu/GPULimits.h: Added. Home for Web GPU limits constants shared between files.
692         * platform/graphics/gpu/GPURenderPassEncoder.h: Change IDL/bindings bug workaround to unsigned long long to prevent narrowing compared to spec.
693         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
694         (WebCore::GPURenderPassEncoder::setVertexBuffers): Now properly calls Metal's setVertexBuffers. 
695         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
696         (WebCore::setInputStateForPipelineDescriptor): Fix validation checks for vertex attribute numbers and vertex buffer indices. 
697
698         Add symbols to project:
699         * Sources.txt:
700         * WebCore.xcodeproj/project.pbxproj:
701
702 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
703
704         Async overflow scroll is jumpy on macOS if the main thread is busy
705         https://bugs.webkit.org/show_bug.cgi?id=194184
706         <rdar://problem/47758655>
707
708         Reviewed by Antti Koivisto.
709
710         This change extends to macOS some existing overflow-scroll functionality for iOS.
711         When an async scroll is in process in the scroll thread (or UI process), we periodically
712         message back to the web process main thread with scroll position updates. These
713         can trigger post-scroll compositing updates, but we need to ensure that this update
714         doesn't clobber the scroll position of the native layers, which would trigger
715         stutters.
716
717         To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which
718         pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't
719         propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling,
720         coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
721
722         In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added
723         updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep
724         the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry().
725
726         There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer()
727         just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer.
728
729         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
730         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging
731         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging
732         * rendering/RenderLayer.cpp:
733         (WebCore::RenderLayer::RenderLayer):
734         (WebCore::RenderLayer::scrollTo):
735         * rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation
736         and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion.
737         * rendering/RenderLayerBacking.cpp:
738         (WebCore::RenderLayerBacking::updateDebugIndicators):
739         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
740         (WebCore::RenderLayerBacking::updateGeometry):
741         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
742         (WebCore::RenderLayerBacking::updateScrollOffset):
743         (WebCore::RenderLayerBacking::updateDrawsContent):
744         (WebCore::RenderLayerBacking::updateScrollingLayers):
745         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
746         (WebCore::RenderLayerBacking::parentForSublayers const):
747         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
748         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
749         (WebCore::RenderLayerBacking::paintContents):
750         (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
751         * rendering/RenderLayerBacking.h:
752
753 2019-02-02  Zalan Bujtas  <zalan@apple.com>
754
755         [LFC] Initialize ICB's style with fixed width/height.
756         https://bugs.webkit.org/show_bug.cgi?id=194188
757
758         Reviewed by Antti Koivisto.
759
760         Let's set ICB's logical width/height to Fixed so that it's available when we try to resolve a box's height
761         in FormattingContext::Geometry::computedHeightValue() by using the containing block's height (ICB in this case).
762
763         * layout/LayoutState.cpp:
764         (WebCore::Layout::LayoutState::LayoutState):
765         * layout/LayoutState.h:
766         * layout/layouttree/LayoutTreeBuilder.cpp:
767         (WebCore::Layout::TreeBuilder::createLayoutTree):
768
769 2019-02-02  Zalan Bujtas  <zalan@apple.com>
770
771         [LFC] Add missing case to out-of-flow non-replaced horizontal used margin value computation
772         https://bugs.webkit.org/show_bug.cgi?id=194185
773
774         Reviewed by Antti Koivisto.
775
776         If none of horizontal values (left, right, width, margin-left/right) are auto, then usedHorizontalMarginValues = computedHorizontalMarginValues.
777
778         Test: fast/block/block-only/absolute-position-left-right-margin.html
779
780         * layout/FormattingContextGeometry.cpp:
781         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
782
783 2018-12-16  Darin Adler  <darin@apple.com>
784
785         Convert additional String::format clients to alternative approaches
786         https://bugs.webkit.org/show_bug.cgi?id=192746
787
788         Reviewed by Alexey Proskuryakov.
789
790         This round of conversions covers less-trivial cases such as floating
791         point numerals and hexadecimal. Not yet taking on pointer serialization
792         ("%p") or padding with spaces of zero digits, so call sites using those
793         have been left untouched.
794
795         In some cases these new idioms are a bit clumsy, and we could follow up
796         with additional convenience functions to make them more elegant.
797
798         * Modules/indexeddb/IDBKeyData.cpp:
799         (WebCore::IDBKeyData::loggingString const): Use more ASCIILiteral and
800         more appendLiteral for efficiency. Use upperNibbleToLowercaseASCIIHexDigit,
801         lowerNibbleToLowercaseASCIIHexDigit, and also makeString and FormattedNumber.
802
803         * css/MediaQueryEvaluator.cpp:
804         (WebCore::aspectRatioValueAsString): Use makeString and FormattedNumber.
805         Doing it this way makes it a little clearer that we have an unpleasant
806         use of fixed 6-digit precision here.
807
808         * html/FTPDirectoryDocument.cpp:
809         (WebCore::processFilesizeString): Use makeString and FormattedNumber.
810         * html/track/VTTCue.cpp:
811         (WebCore::VTTCueBox::applyCSSProperties): Ditto.
812         * page/CaptionUserPreferencesMediaAF.cpp:
813         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto.
814         * page/History.cpp:
815         (WebCore::History::stateObjectAdded): Ditto.
816         * page/cocoa/ResourceUsageOverlayCocoa.mm:
817         (WebCore::formatByteNumber): Ditto.
818         (WebCore::gcTimerString): Use String::number.
819         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and FormattedNumber.
820
821         * page/scrolling/AxisScrollSnapOffsets.cpp:
822         (WebCore::snapOffsetsToString): Removed some unnecessary copying in the for loop,
823         use appendLiteral, and use appendFixedWidthNumber.
824         (WebCore::snapOffsetRangesToString): Ditto.
825         (WebCore::snapPortOrAreaToString): Use makeString and FormattedNumber.
826
827         * platform/animation/TimingFunction.cpp:
828         (WebCore::TimingFunction::cssText const): Use makeString.
829
830         * platform/cocoa/KeyEventCocoa.mm:
831         (WebCore::keyIdentifierForCharCode): Use makeString and the ASCIIHexDigit
832         functions.
833         * platform/graphics/Color.cpp:
834         (WebCore::Color::nameForRenderTreeAsText const): Ditto.
835
836         * platform/mock/MockRealtimeVideoSource.cpp:
837         (WebCore::MockRealtimeVideoSource::drawText): Use makeString and FormattedNumber.
838
839         * platform/text/PlatformLocale.cpp:
840         (WebCore::DateTimeStringBuilder::visitField): Use String::numberToStringFixedWidth.
841
842 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
843
844         Remove the unused layerForScrolling()
845         https://bugs.webkit.org/show_bug.cgi?id=194180
846
847         Reviewed by Zalan Bujtas.
848
849         Remove ScrollableArea::layerForScrolling() and derivations. This was unused.
850
851         * page/FrameView.cpp:
852         (WebCore::FrameView::layerForScrolling const): Deleted.
853         * page/FrameView.h:
854         * page/scrolling/ScrollingCoordinator.cpp:
855         (WebCore::ScrollingCoordinator::scrollLayerForScrollableArea): Deleted.
856         * page/scrolling/ScrollingCoordinator.h:
857         * platform/ScrollableArea.h:
858         (WebCore::ScrollableArea::layerForScrolling const): Deleted.
859         * rendering/RenderLayer.cpp:
860         (WebCore::RenderLayer::calculateClipRects const):
861         * rendering/RenderLayer.h:
862
863 2019-02-01  Zalan Bujtas  <zalan@apple.com>
864
865         [LFC] Fix statically positioned replaced out-of-flow horizontal geometry
866         https://bugs.webkit.org/show_bug.cgi?id=194163
867
868         Reviewed by Simon Fraser.
869
870         Fix a typo.
871
872         * layout/FormattingContextGeometry.cpp:
873         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
874
875 2019-02-01  Chris Dumez  <cdumez@apple.com>
876
877         REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
878         https://bugs.webkit.org/show_bug.cgi?id=193740
879         <rdar://problem/47527267>
880
881         Reviewed by Alex Christensen.
882
883         * loader/DocumentLoader.cpp:
884         (WebCore::DocumentLoader::willSendRequest):
885         (WebCore::DocumentLoader::continueAfterContentPolicy):
886         * loader/FrameLoader.cpp:
887         (WebCore::FrameLoader::loadURL):
888         (WebCore::FrameLoader::loadWithDocumentLoader):
889         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
890         * loader/FrameLoader.h:
891         * loader/FrameLoaderTypes.h:
892         * loader/PolicyChecker.cpp:
893         (WebCore::PolicyChecker::checkNavigationPolicy):
894         (WebCore::PolicyChecker::checkNewWindowPolicy):
895         * loader/PolicyChecker.h:
896
897 2019-02-01  Antoine Quint  <graouts@apple.com>
898
899         Dispatch pointercancel events when content is panned or zoomed on iOS
900         https://bugs.webkit.org/show_bug.cgi?id=193962
901         <rdar://problem/47629134>
902
903         Reviewed by Dean Jackson.
904
905         Expose two new methods on PointerCaptureController so that, given a pointer id, it can be established whether this pointer
906         has been cancelled, which is important because a cancelled pointer should no longer dispatch any further pointer events, and
907         to cancel a pointer.
908
909         Tests: pointerevents/ios/touch-action-pointercancel-pan-x.html
910                pointerevents/ios/touch-action-pointercancel-pan-y.html
911                pointerevents/ios/touch-action-pointercancel-pinch-zoom.html
912
913         * WebCore.xcodeproj/project.pbxproj: Make PointerCaptureController.h Private so that it can be imported from WebKit.
914         * dom/PointerEvent.h: Remove an unnecessary #if ENABLE(POINTER_EVENTS) since the entire file is already contained in one.
915         Then we add a new create() method that takes an event type, a pointer id and a pointer type (touch vs. pen) that we use
916         to create pointercancel events in PointerCaptureController::cancelPointer().
917         * page/Page.cpp:
918         (WebCore::Page::Page): Pass the Page as a parameter when creating the PointerCaptureController.
919         * page/PointerCaptureController.cpp:
920         (WebCore::PointerCaptureController::PointerCaptureController): Add a Page reference to the constructor since we'll need
921         the page to access its main frame's EventHandler to perform hit testing in case we do not have a capture target override
922         in cancelPointer().
923         (WebCore::PointerCaptureController::releasePointerCapture): Drive-by, remove the the implicit parameter since on iOS we
924         don't need to differentiate. We'll bring this back for the macOS work.
925         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier): New method we'll use when dispatching pointer
926         events to identify whether a pointer id has already been cancelled which will allow for _not_ dispatching any further
927         pointer events for this pointer id.
928         (WebCore::PointerCaptureController::pointerEventWillBeDispatched): Keep track of the pointer type so we can preserve it
929         when dispatching pointercancel events for a given pointer id.
930         (WebCore::PointerCaptureController::cancelPointer): Dispatch a pointercancel for the provided pointer id, using the capture
931         target override as the event's target, if there is one, and otherwise hit-testing at the provided location to figure out
932         what the target should be.
933         * page/PointerCaptureController.h: Switch the target overrides from Element* to RefPtr<Element> to ensure it may not be
934         deleted while we still need them. Existing code already ensures these get set to nullptr.
935
936 2019-02-01  Jer Noble  <jer.noble@apple.com>
937
938         Make the WebKit default for media source based on the WebCore default.
939         https://bugs.webkit.org/show_bug.cgi?id=194172
940
941         Reviewed by Eric Carlson.
942
943         * page/SettingsBase.h:
944
945 2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
946
947         Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled
948         https://bugs.webkit.org/show_bug.cgi?id=194111
949         <rdar://problem/47714555>
950
951         Rubber-stamped by Devin Rousso.
952
953         * page/ResourceUsageThread.cpp:
954         (WebCore::ResourceUsageThread::waitUntilObservers):
955         (WebCore::ResourceUsageThread::threadBody):
956         Wait a short period of time before the first listener registers
957         and we start sampling. This will allow multiple listeners to
958         register, each that wants different data.
959
960 2019-02-01  Antti Koivisto  <antti@apple.com>
961
962         Don't use base layer() as the scroll layer in scrolling tree.
963         https://bugs.webkit.org/show_bug.cgi?id=194160
964
965         Reviewed by Simon Fraser.
966
967         Maintain scrollContainerLayer() and scrolledContentsLayer() separately in ScrollingTreeScrollingNode.
968
969         * page/scrolling/AsyncScrollingCoordinator.cpp:
970         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
971         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
972         * page/scrolling/AsyncScrollingCoordinator.h:
973         * page/scrolling/ScrollingCoordinator.h:
974         (WebCore::ScrollingCoordinator::setNodeLayers):
975
976         Turn the long layer parameter list into a struct.
977
978         * page/scrolling/ScrollingStateNode.cpp:
979         (WebCore::ScrollingStateNode::ScrollingStateNode):
980         (WebCore::ScrollingStateNode::setAllPropertiesChanged):
981         (WebCore::ScrollingStateNode::setLayer):
982         * page/scrolling/ScrollingStateNode.h:
983         * page/scrolling/ScrollingStateScrollingNode.cpp:
984         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
985         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
986         (WebCore::ScrollingStateScrollingNode::setScrollContainerLayer):
987         (WebCore::ScrollingStateScrollingNode::dumpProperties const):
988         * page/scrolling/ScrollingStateScrollingNode.h:
989         (WebCore::ScrollingStateScrollingNode::scrollContainerLayer const):
990         * page/scrolling/ScrollingTree.cpp:
991         (WebCore::ScrollingTree::commitTreeState):
992         * page/scrolling/ScrollingTreeScrollingNode.cpp:
993         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
994         * page/scrolling/ScrollingTreeScrollingNode.h:
995         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const):
996         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const):
997         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
998         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
999         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
1000         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollPosition const):
1001         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
1002         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollLayer const): Deleted.
1003         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
1004         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
1005         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1006         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1007         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1008         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
1009         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const):
1010         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1011         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
1012         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1013         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1014         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
1015         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
1016         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
1017         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
1018         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
1019         * rendering/RenderLayerCompositor.cpp:
1020         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
1021         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
1022         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
1023         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
1024
1025 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
1026
1027         REGRESSION (r240698): fast/scrolling/sticky-to-fixed.html can cause a crash
1028         https://bugs.webkit.org/show_bug.cgi?id=194134
1029         rdar://problem/47721210
1030
1031         Reviewed by Daniel Bates.
1032
1033         fast/scrolling/sticky-to-fixed.html changes the scrolling node type, which causes
1034         scrollingCoordinator->insertNode() to return a different ScrollingNodeID to the one
1035         passed in. We have to handle this, removing the node for the nodeID and unregistering
1036         the layer with the old nodeID.
1037
1038         * rendering/RenderLayerCompositor.cpp:
1039         (WebCore::RenderLayerCompositor::attachScrollingNode):
1040
1041 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1042
1043         REGRESSION(r239915): css3/font-feature-font-face-local.html failing on WPE
1044         https://bugs.webkit.org/show_bug.cgi?id=194008
1045
1046         Reviewed by Žan Doberšek.
1047
1048         We need to replace control characters with zero width space too.
1049
1050         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
1051         (WebCore::GlyphPage::fill):
1052         * platform/text/CharacterProperties.h:
1053         (WebCore::isControlCharacter):
1054
1055 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1056
1057         ComplexText: Test fast/text/word-space-nbsp.html fails when using complex text path
1058         https://bugs.webkit.org/show_bug.cgi?id=193279
1059
1060         Reviewed by Michael Catanzaro.
1061
1062         The fix applied in r135884 to WidthIterator should also be applied to ComplexTextController.
1063
1064         * platform/graphics/ComplexTextController.cpp:
1065         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1066
1067 2019-02-01  Zalan Bujtas  <zalan@apple.com>
1068
1069         [LFC] Adjust replaced element's intrinsic ratio
1070         https://bugs.webkit.org/show_bug.cgi?id=194154
1071
1072         Reviewed by Antti Koivisto.
1073
1074         Decouple image and iframe replaced types and set intrinsic ratio accordingly.
1075
1076         * layout/layouttree/LayoutBox.cpp:
1077         (WebCore::Layout::Box::Box):
1078         * layout/layouttree/LayoutBox.h:
1079         (WebCore::Layout::Box::isReplaced const):
1080         (WebCore::Layout::Box::isIFrame const):
1081         (WebCore::Layout::Box::isImage const):
1082         * layout/layouttree/LayoutReplaced.cpp:
1083         (WebCore::Layout::Replaced::hasIntrinsicRatio const):
1084         (WebCore::Layout::Replaced::intrinsicRatio const):
1085         (WebCore::Layout::Replaced::hasAspectRatio const):
1086         * layout/layouttree/LayoutReplaced.h:
1087         * layout/layouttree/LayoutTreeBuilder.cpp:
1088         (WebCore::Layout::TreeBuilder::createSubTree):
1089
1090 2019-02-01  Zalan Bujtas  <zalan@apple.com>
1091
1092         [LFC] Set intrinsic size on Layout::Replaced
1093         https://bugs.webkit.org/show_bug.cgi?id=194139
1094
1095         Reviewed by Antti Koivisto.
1096
1097         Eventually Layout::Replaced will track intrinsic size internally until then let's query the RenderReplaced. 
1098
1099         * layout/layouttree/LayoutBox.h:
1100         (WebCore::Layout::Box::replaced):
1101         * layout/layouttree/LayoutReplaced.cpp:
1102         (WebCore::Layout::Replaced::hasIntrinsicWidth const):
1103         (WebCore::Layout::Replaced::hasIntrinsicHeight const):
1104         (WebCore::Layout::Replaced::intrinsicWidth const):
1105         (WebCore::Layout::Replaced::intrinsicHeight const):
1106         * layout/layouttree/LayoutReplaced.h:
1107         (WebCore::Layout::Replaced::setIntrinsicSize):
1108         (WebCore::Layout::Replaced::setIntrinsicRatio):
1109         * layout/layouttree/LayoutTreeBuilder.cpp:
1110         (WebCore::Layout::TreeBuilder::createSubTree):
1111         * rendering/RenderReplaced.h:
1112
1113 2019-02-01  Claudio Saavedra  <csaavedra@igalia.com>
1114
1115         Race-condition during scrolling thread creation
1116         https://bugs.webkit.org/show_bug.cgi?id=194016
1117
1118         Reviewed by Saam Barati.
1119
1120         There is a threading issue during the initialization
1121         of the scrolling thread caused by createThreadIfNeeded
1122         locking only on the creation of the thread but not on
1123         the initialization of the main loop, making it possible
1124         for a thread to try to spin the main loop before it's
1125         created.
1126
1127         Fix this by unconditionally waiting on the main loop
1128         being created. This makes it necessary to always hold
1129         the lock, even when the thread is already created.
1130
1131         * page/scrolling/ScrollingThread.cpp:
1132         (WebCore::ScrollingThread::createThreadIfNeeded):
1133
1134 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
1135
1136         Use ScrollingNodeID in more places, and improve the name of a ScrollableArea function that returns a ScrollingNodeID
1137         https://bugs.webkit.org/show_bug.cgi?id=194126
1138
1139         Reviewed by Frédéric Wang.
1140         
1141         Change uint64_t ScrollableArea::scrollLayerID() to ScrollingNodeID ScrollableArea::scrollingNodeID()
1142         and fix callers.
1143
1144         * page/FrameView.cpp:
1145         (WebCore::FrameView::scrollingNodeID const):
1146         (WebCore::FrameView::scrollLayerID const): Deleted.
1147         * page/FrameView.h:
1148         * page/scrolling/AsyncScrollingCoordinator.cpp:
1149         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1150         (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView):
1151         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
1152         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
1153         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
1154         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1155         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1156         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
1157         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
1158         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
1159         (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices):
1160         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
1161         * page/scrolling/ScrollingCoordinatorTypes.h:
1162         * platform/ScrollTypes.h:
1163         * platform/ScrollableArea.h:
1164         (WebCore::ScrollableArea::scrollingNodeID const):
1165         (WebCore::ScrollableArea::scrollLayerID const): Deleted.
1166         * rendering/RenderLayerCompositor.cpp:
1167         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
1168         (WebCore::RenderLayerCompositor::detachRootLayer):
1169
1170 2019-01-31  Myles C. Maxfield  <mmaxfield@apple.com>
1171
1172         [WHLSL] Expressions can't be copyable
1173         https://bugs.webkit.org/show_bug.cgi?id=194116
1174
1175         Reviewed by Keith Rollin.
1176
1177         Expressions have UniqueRef members, which can't be copied. Describe this constraint explicitly rather than implicitly.
1178
1179         No new tests because there is no behavior change.
1180
1181         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
1182         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
1183
1184 2019-01-31  Takashi Komori  <Takashi.Komori@sony.com>
1185
1186         [Curl] Remove unnecessary member from NetworkStorageSession.
1187         https://bugs.webkit.org/show_bug.cgi?id=194137
1188
1189         Reviewed by Don Olmstead.
1190
1191         No new tests since there is no behavior change.
1192
1193         * platform/network/NetworkStorageSession.h:
1194         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1195         (WebCore::NetworkStorageSession::NetworkStorageSession):
1196         (WebCore::NetworkStorageSession::context const): Deleted.
1197
1198 2019-01-31  Jer Noble  <jer.noble@apple.com>
1199
1200         NSInvalidArgumentException in [WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]
1201         https://bugs.webkit.org/show_bug.cgi?id=194123
1202         <rdar://problem/47721094>
1203
1204         Reviewed by Eric Carlson.
1205
1206         According to crash logs, AVSampleBufferDisplayLayer.error can go from an NSError* to nil; when such a change is KVO'd,
1207         the NSKeyValueChangeNewKey is a NSNull. Detect this state and bail out early.
1208
1209         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1210         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
1211
1212 2019-01-31  Jer Noble  <jer.noble@apple.com>
1213
1214         [Cocoa][EME] AirPlaying a FairPlay-protected HLS stream fails to decrypt
1215         https://bugs.webkit.org/show_bug.cgi?id=194114
1216
1217         Reviewed by Eric Carlson.
1218
1219         The AVAssetResourceLoaderDelegate must explicitly... delegate responsibility for FairPlay key
1220         requests to the AVContentKeySession.
1221
1222         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1223         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1224
1225 2019-01-31  Megan Gardner  <megan_gardner@apple.com>
1226
1227         Don't insert spaces at the beginning of a newline when using smart-copy-paste
1228         https://bugs.webkit.org/show_bug.cgi?id=194070
1229
1230         Reviewed by Tim Horton.
1231
1232         If our inserted content end is at the beginning of a paragraph, do not insert a space.
1233         Also, if our inserted content beginning is at the end of a paragraph, do not insert a space.
1234
1235         Test: editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html
1236
1237         * editing/ReplaceSelectionCommand.cpp:
1238         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
1239
1240 2019-01-31  Justin Fan  <justin_fan@apple.com>
1241
1242         [WebGPU] Build fix: disable MTLCopyAllDevices call on non-Mac platforms
1243         https://bugs.webkit.org/show_bug.cgi?id=194120
1244
1245         Unreviewed build fix. 
1246
1247         No new tests; no change in behavior.
1248
1249         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
1250         (WebCore::GPUDevice::create): Wrap problem code in #if PLATFORM(MAC).
1251
1252 2019-01-31  Simon Fraser  <simon.fraser@apple.com>
1253
1254         Basic scrollability for async overflow scrolling on macOS
1255         https://bugs.webkit.org/show_bug.cgi?id=194093
1256
1257         Reviewed by Antti Koivisto.
1258
1259         Give a ScrollingTreeOverflowScrollingNodeMac a ScrollingTreeScrollingNodeDelegateMac and have it keep track
1260         of its layers so basic scrolling works for async overflow scroll.
1261
1262         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1263         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1264         (WebCore::ScrollingTreeOverflowScrollingNodeMac::create):
1265         (WebCore::ScrollingTreeOverflowScrollingNodeMac::ScrollingTreeOverflowScrollingNodeMac):
1266         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
1267         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
1268         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
1269         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
1270         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
1271         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
1272         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
1273         * rendering/RenderLayerBacking.cpp:
1274         (WebCore::RenderLayerBacking::updateScrollingLayers):
1275
1276 2019-01-31  Simon Fraser  <simon.fraser@apple.com>
1277
1278         Generalize ScrollingTreeScrollingNodeDelegate for use in macOS too, add a macOS subclass for frame/overflow scrolling
1279         https://bugs.webkit.org/show_bug.cgi?id=194080
1280
1281         Reviewed by Antti Koivisto.
1282
1283         To share code between ScrollingTreeFrameScrollingNodeMac and ScrollingTreeOverflowScrollingNodeMac, build ScrollingTreeScrollingNodeDelegate
1284         for macOS too, and add some helper functions to ScrollingTreeScrollingNodeDelegate.
1285
1286         Add a macOS subclass, ScrollingTreeScrollingNodeDelegateMac, which takes over the basic scrolling, rubber-banding
1287         and scroll snapping functionality from ScrollingTreeFrameScrollingNodeMac. The delegate owns the ScrollController and
1288         implements ScrollControllerClient.
1289
1290         ScrollingTreeFrameScrollingNodeMac now owns a ScrollingTreeScrollingNodeDelegateMac. A future patch
1291         will add one to ScrollingTreeOverflowScrollingNodeMac.
1292
1293         No behavior change.
1294
1295         * SourcesCocoa.txt:
1296         * WebCore.xcodeproj/project.pbxproj:
1297         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1298         (WebCore::ScrollingTreeFrameScrollingNode::scrollBy): Deleted.
1299         (WebCore::ScrollingTreeFrameScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
1300         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1301         (WebCore::ScrollingTreeFrameScrollingNode::frameScaleFactor const):
1302         * page/scrolling/ScrollingTreeNode.cpp:
1303         (WebCore::ScrollingTreeNode::isRootNode const):
1304         * page/scrolling/ScrollingTreeNode.h:
1305         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1306         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
1307         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1308         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints):
1309         * page/scrolling/ScrollingTreeScrollingNode.h:
1310         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const):
1311         * page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp:
1312         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
1313         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const):
1314         (WebCore::ScrollingTreeScrollingNodeDelegate::minimumScrollPosition const):
1315         (WebCore::ScrollingTreeScrollingNodeDelegate::maximumScrollPosition const):
1316         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollableAreaSize const):
1317         (WebCore::ScrollingTreeScrollingNodeDelegate::totalContentsSize const):
1318         (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledHorizontalScrollbar const):
1319         (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledVerticalScrollbar const):
1320         (WebCore::ScrollingTreeScrollingNodeDelegate::horizontalScrollElasticity const):
1321         (WebCore::ScrollingTreeScrollingNodeDelegate::verticalScrollElasticity const):
1322         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1323         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1324         (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
1325         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1326         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1327         (WebCore::ScrollingTreeFrameScrollingNodeMac::minimumScrollPosition const):
1328         (WebCore::ScrollingTreeFrameScrollingNodeMac::maximumScrollPosition const):
1329         (WebCore::newGestureIsStarting): Deleted.
1330         (WebCore::ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture): Deleted.
1331         (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching): Deleted.
1332         (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching): Deleted.
1333         (WebCore::ScrollingTreeFrameScrollingNodeMac::stretchAmount): Deleted.
1334         (WebCore::ScrollingTreeFrameScrollingNodeMac::pinnedInDirection): Deleted.
1335         (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollHorizontally): Deleted.
1336         (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollVertically): Deleted.
1337         (WebCore::ScrollingTreeFrameScrollingNodeMac::shouldRubberBandInDirection): Deleted.
1338         (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollBy): Deleted.
1339         (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollByWithoutContentEdgeConstraints): Deleted.
1340         (WebCore::ScrollingTreeFrameScrollingNodeMac::stopSnapRubberbandTimer): Deleted.
1341         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustScrollPositionToBoundsIfNecessary): Deleted.
1342         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollOffset const): Deleted.
1343         (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollOnAxis): Deleted.
1344         (WebCore::ScrollingTreeFrameScrollingNodeMac::pageScaleFactor const): Deleted.
1345         (WebCore::ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer): Deleted.
1346         (WebCore::ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer): Deleted.
1347         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollExtent const): Deleted.
1348         (WebCore::ScrollingTreeFrameScrollingNodeMac::viewportSize const): Deleted.
1349         (WebCore::ScrollingTreeFrameScrollingNodeMac::deferTestsForReason const): Deleted.
1350         (WebCore::ScrollingTreeFrameScrollingNodeMac::removeTestDeferralForReason const): Deleted.
1351         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h.
1352         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: Added.
1353         (WebCore::ScrollingTreeScrollingNodeDelegateMac::ScrollingTreeScrollingNodeDelegateMac):
1354         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollSnapPoints):
1355         (WebCore::ScrollingTreeScrollingNodeDelegateMac::setActiveScrollSnapIndexForAxis):
1356         (WebCore::ScrollingTreeScrollingNodeDelegateMac::activeScrollSnapIndexForAxis const):
1357         (WebCore::ScrollingTreeScrollingNodeDelegateMac::activeScrollSnapIndexDidChange const):
1358         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
1359         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isScrollSnapInProgress const):
1360         (WebCore::newGestureIsStarting):
1361         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
1362         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching):
1363         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching):
1364         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
1365         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
1366         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollHorizontally):
1367         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollVertically):
1368         (WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandInDirection):
1369         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollBy):
1370         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
1371         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopSnapRubberbandTimer):
1372         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
1373         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
1374         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
1375         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pageScaleFactor const):
1376         (WebCore::ScrollingTreeScrollingNodeDelegateMac::startScrollSnapTimer):
1377         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopScrollSnapTimer):
1378         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollExtent const):
1379         (WebCore::ScrollingTreeScrollingNodeDelegateMac::viewportSize const):
1380         (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const):
1381         (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const):
1382
1383 2019-01-31  Jer Noble  <jer.noble@apple.com>
1384
1385         [Mac] Requesting PiP from two different WebViews gets PiP window "stuck"
1386         https://bugs.webkit.org/show_bug.cgi?id=194099
1387         <rdar://problem/47271323>
1388
1389         Reviewed by Eric Carlson.
1390
1391         When a different client requests the PiP window, the PiP framework will call -pipDidClose: without
1392         first calling -pipActionStop:. This leaves the internal fullscreen state in a confused state where
1393         the WebView will attempt to re-enter PiP once it gets focus, and can lead to a state where the two
1394         WebViews will constantly try to steal PiP from one another, ad infinitum.
1395
1396         When receiving a notification that the PiP window closed when our internal state tells us that the
1397         close was not requested, notify the client that PiP mode was exited, allowing them to set their
1398         expected state to a correct and sane value.
1399
1400         * platform/mac/VideoFullscreenInterfaceMac.mm:
1401         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1402
1403 2019-01-31  Keith Rollin  <krollin@apple.com>
1404
1405         WebCore::WHLSL::AST::Expression copy constructor needs to be be default, not delete
1406         https://bugs.webkit.org/show_bug.cgi?id=194055
1407         <rdar://problem/47684570>
1408
1409         Reviewed by Myles C. Maxfield.
1410
1411         WebCore::WHLSL::AST::Expression has a deleted copy constructor.
1412         EnumerationMemberLiteral, a subclass, has a default copy constructor.
1413         Some compilers may complain that the latter's c'tor can't access the
1414         former's, because it doesn't exist. Fix this by marking Expression's
1415         c'tor as default.
1416
1417         No new tests since there should be no observable behavior difference.
1418
1419         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
1420
1421 2019-01-31  Alex Christensen  <achristensen@webkit.org>
1422
1423         Revert r238819 which is unneeded and caused a performance regression.
1424         https://bugs.webkit.org/show_bug.cgi?id=192272
1425         <rdar://problem/46664625>
1426
1427         * loader/EmptyFrameLoaderClient.h:
1428         * loader/FrameLoader.cpp:
1429         (WebCore::FrameLoader::prepareForLoadStart):
1430         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1431         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
1432         * loader/FrameLoader.h:
1433         * loader/FrameLoaderClient.h:
1434
1435 2019-01-31  Justin Fan  <justin_fan@apple.com>
1436
1437         [WebGPU] WebGPUAdapterDescriptor -> GPURequestAdapterOptions and take powerPreference into account
1438         https://bugs.webkit.org/show_bug.cgi?id=194068
1439         <rdar://problem/47680215>
1440
1441         Reviewed by Dean Jackson.
1442         
1443         Per the Web GPU IDL, WebGPUAdapterDescriptor is now known as GPURequestAdapterOptions and is optional.
1444         In addition, Web GPU now actually attempts to return an integrated GPU when a low-power adapter is requested.
1445
1446         Test: adapter-options.html
1447
1448         * Modules/webgpu/GPURequestAdapterOptions.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.idl.
1449         * Modules/webgpu/WebGPU.cpp:
1450         (WebCore::WebGPU::requestAdapter const):
1451         * Modules/webgpu/WebGPU.h:
1452         * Modules/webgpu/WebGPU.idl:
1453         * Modules/webgpu/WebGPUAdapter.cpp:
1454         (WebCore::WebGPUAdapter::create):
1455         (WebCore::WebGPUAdapter::WebGPUAdapter):
1456         * Modules/webgpu/WebGPUAdapter.h:
1457         (WebCore::WebGPUAdapter::options const):
1458         * Modules/webgpu/WebGPUDevice.cpp:
1459         (WebCore::WebGPUDevice::create):
1460         * platform/graphics/gpu/GPUDevice.h:
1461         * platform/graphics/gpu/GPURequestAdapterOptions.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.h.
1462         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
1463         (WebCore::GPUDevice::create):
1464
1465 2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
1466
1467         Formalize WebKitAdditions mechanism of LoadOptimizer
1468         https://bugs.webkit.org/show_bug.cgi?id=193886
1469         <rdar://problem/47696809>
1470
1471         Reviewed by Brent Fulgham.
1472
1473         Covered by existing tests.
1474
1475         * platform/network/ResourceRequestBase.h:
1476         Export isolatedCopy().
1477
1478 2019-01-31  Jer Noble  <jer.noble@apple.com>
1479
1480         [Cocoa][EME] Modern EME uses a different path for SecureStop data than Legacy EME
1481         https://bugs.webkit.org/show_bug.cgi?id=193988
1482
1483         Reviewed by Jon Lee.
1484
1485         Modern EME is writing SecureStop data as a file at the same path as the
1486         directory used by Legacy EME; meaning, when Modern EME attempts to write
1487         to that file, it will fail because a directory exists at the same path.
1488
1489         Add a migration step to take care of those instances where Modern EME Secure
1490         Stop data was already written to disk, and move that previously written data
1491         to the correct file path.
1492
1493         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1494         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1495         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
1496         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
1497         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
1498         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession):
1499         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
1500         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSession):
1501
1502 2019-01-31  Antti Koivisto  <antti@apple.com>
1503
1504         Call the frame main contents layer "rootContentsLayer" consistently.
1505         https://bugs.webkit.org/show_bug.cgi?id=194089
1506
1507         Reviewed by Simon Fraser.
1508
1509         This is currently called "rootContentLayer" in the compositor and "scrolledContentsLayer" in the scrolling tree.
1510         We want to reserve term "scrolledContentsLayer" to mean the direct child layer of the  scroll container layer
1511         without any positioning oddities (which this isn't).
1512
1513         * page/scrolling/AsyncScrollingCoordinator.cpp:
1514         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
1515         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1516         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
1517
1518         Set the rootContentsLayer for frame. It is only used by the Mac frame scrolling code.
1519
1520         * page/scrolling/AsyncScrollingCoordinator.h:
1521         * page/scrolling/ScrollingCoordinator.cpp:
1522         (WebCore::ScrollingCoordinator::rootContentsLayerForFrameView):
1523         (WebCore::ScrollingCoordinator::rootContentLayerForFrameView): Deleted.
1524         * page/scrolling/ScrollingCoordinator.h:
1525         (WebCore::ScrollingCoordinator::setNodeLayers):
1526         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1527         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1528         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
1529         (WebCore::ScrollingStateFrameScrollingNode::setRootContentsLayer):
1530         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
1531         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1532
1533         Introduce rootContentLayer for frames only.
1534
1535         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1536         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1537         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1538         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1539
1540         Switch to using rootContentsLayer.
1541
1542         * rendering/RenderLayerCompositor.cpp:
1543         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
1544         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1545         (WebCore::RenderLayerCompositor::updateRootContentLayerClipping):
1546         (WebCore::RenderLayerCompositor::layerTreeAsText):
1547         (WebCore::RenderLayerCompositor::rootGraphicsLayer const):
1548         (WebCore::RenderLayerCompositor::updateRootLayerPosition):
1549         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
1550         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
1551         (WebCore::RenderLayerCompositor::updateLayerForHeader):
1552         (WebCore::RenderLayerCompositor::updateLayerForFooter):
1553         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
1554         (WebCore::RenderLayerCompositor::ensureRootLayer):
1555         (WebCore::RenderLayerCompositor::destroyRootLayer):
1556         (WebCore::RenderLayerCompositor::attachRootLayer):
1557         (WebCore::RenderLayerCompositor::detachRootLayer):
1558         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1559         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
1560
1561         Pass rootContentsLayer separately for frames only.
1562         Pass null as frame scrolledContentsLayer until these are rearranged (it is not used).
1563
1564         * rendering/RenderLayerCompositor.h:
1565
1566 2019-01-31  Keith Rollin  <krollin@apple.com>
1567
1568         GCGamepad is deprecated
1569         https://bugs.webkit.org/show_bug.cgi?id=194056
1570         <rdar://problem/47685010>
1571
1572         Reviewed by Brady Eidson.
1573
1574         GCGamepad is deprecated, resulting in compiler warnings. Address this
1575         for now by employing ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
1576
1577         No new tests since there should be no observable behavior difference.
1578
1579         * platform/gamepad/cocoa/GameControllerGamepad.mm:
1580         (WebCore::GameControllerGamepad::setupAsGamepad):
1581
1582 2019-01-31  Darin Adler  <darin@apple.com>
1583
1584         Simplify and streamline code that creates an appropriate document based on MIME type
1585         https://bugs.webkit.org/show_bug.cgi?id=193756
1586
1587         Reviewed by Chris Dumez.
1588
1589         * dom/DOMImplementation.cpp:
1590         (WebCore::DOMImplementation::createDocument): Use equalLettersIgnoringASCIICase rather
1591         than == for all the MIME type checks. Use MIMETypeRegistry::isSupportedImageMIMEType
1592         instead of Image::supportsType. Rearranged checks so that all the combinations that
1593         that take precedence over plug-ins are checked first, fixing some unimportant edge
1594         cases where the plug-in database is initialized and doesn't need to be. Straightened
1595         out the logic for various special types so that the checks are more independent from
1596         each other and hence easier to understand.
1597
1598 2019-01-31  Alicia Boya García  <aboya@igalia.com>
1599
1600         [MSE][GStreamer] Unreviewed debug build fix, obsolete assert
1601
1602         Since m_playerPrivate is now a reference, it no longer has a default
1603         cast to bool. But there is also no longer a need to assert it's non
1604         null, so just remove the assert.
1605
1606         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1607         (WebCore::MediaSourceClientGStreamerMSE::append):
1608
1609 2019-01-31  Alicia Boya García  <aboya@igalia.com>
1610
1611         [MSE][GStreamer] Use reference instead of pointer in m_playerPrivate
1612         https://bugs.webkit.org/show_bug.cgi?id=194091
1613
1614         Reviewed by Xabier Rodriguez-Calvar.
1615
1616         Since the pointer is initialized with the class, it's never null and
1617         never changes, it's preferrable to use a reference instead of a
1618         pointer.
1619
1620         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1621         (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
1622         (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
1623         (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
1624         (WebCore::MediaSourceClientGStreamerMSE::abort):
1625         (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
1626         (WebCore::MediaSourceClientGStreamerMSE::append):
1627         (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
1628         (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
1629         (WebCore::MediaSourceClientGStreamerMSE::flush):
1630         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
1631         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
1632         (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
1633         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1634
1635 2019-01-31  Alexander Mikhaylenko  <exalm7659@gmail.com>
1636
1637         [GTK] Momentum scrolling stops abruptly before websites end
1638         https://bugs.webkit.org/show_bug.cgi?id=193350
1639
1640         Reviewed by Carlos Garcia Campos.
1641
1642         Don't immediately set velocity to 0 when position reaches upper or bottom limit.
1643         Instead, set it to the overshot distance, so that position exactly matches upper
1644         or lower limit on the next frame, and then clamp velocity to 0 using the existing
1645         mechanism.
1646
1647         * platform/ScrollAnimationKinetic.cpp:
1648         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
1649
1650 2019-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
1651
1652         Unreviewed, fix incorrect string format
1653         https://bugs.webkit.org/show_bug.cgi?id=193907
1654         <rdar://problem/47604080>
1655
1656         * page/scrolling/ScrollingTree.cpp:
1657         (WebCore::ScrollingTree::commitTreeState):
1658
1659 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
1660
1661         [Mac] Implement basic hit testing in the scrolling tree
1662         https://bugs.webkit.org/show_bug.cgi?id=172917
1663         <rdar://problem/34215516>
1664
1665         Reviewed by Antti Koivisto.
1666
1667         First steps to getting hit testing of scrolling nodes in the scrolling tree. Based on patch
1668         by Frédéric Wang.
1669
1670         First we pipe the "async scrolling enabled" setting through to the ScrollingTree via
1671         the root node (like the other settings; weird, but that's how it's done). For now,
1672         we hit test in the scrolling tree if either async overflow or frame scrolling are enabled
1673         (it's hard to deal with one without the other).
1674
1675         Nodes in the scrolling tree implement scrollingNodeForPoint() to implement hit testing.
1676         Two helper functions exist to simplify coordinate conversion: parentToLocalPoint()
1677         and localToContentsPoint(). Child nodes are hit-testing in reverse order to find nodes
1678         hightest in Z first. Only scrolling nodes are returned (not sure if we'll ever need
1679         to hit-test non-scrolling nodes). Nodes use parentRelativeScrollableRect and scroll positions
1680         to do these point mappings.
1681
1682         handleWheelEvent() is changed to return a ScrollingEventResult.
1683
1684         Latching is not correct with this change when async frame scrolling is enabled. That needs
1685         to be fixed separately.
1686
1687         No tests yet; for ease of testing, I'd like to add an Internals API to hit-test the
1688         scrolling tree, rather than doing eventSender stuff everywhere.
1689
1690         * page/scrolling/AsyncScrollingCoordinator.cpp:
1691         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1692         (WebCore::AsyncScrollingCoordinator::asyncFrameOrOverflowScrollingEnabled const):
1693         * page/scrolling/AsyncScrollingCoordinator.h:
1694         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1695         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1696         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
1697         (WebCore::ScrollingStateFrameScrollingNode::setAsyncFrameOrOverflowScrollingEnabled):
1698         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1699         * page/scrolling/ScrollingTree.cpp:
1700         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
1701         (WebCore::ScrollingTree::handleWheelEvent):
1702         (WebCore::ScrollingTree::commitTreeState):
1703         (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
1704         * page/scrolling/ScrollingTree.h:
1705         (WebCore::ScrollingTree::asyncFrameOrOverflowScrollingEnabled const):
1706         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1707         (WebCore::ScrollingTreeFrameHostingNode::parentToLocalPoint const):
1708         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1709         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1710         (WebCore::ScrollingTreeFrameScrollingNode::parentToLocalPoint const):
1711         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
1712         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1713         * page/scrolling/ScrollingTreeNode.cpp:
1714         (WebCore::ScrollingTreeNode::scrollingNodeForPoint const):
1715         * page/scrolling/ScrollingTreeNode.h:
1716         (WebCore::ScrollingTreeNode::children const):
1717         (WebCore::ScrollingTreeNode::parentToLocalPoint const):
1718         (WebCore::ScrollingTreeNode::localToContentsPoint const):
1719         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1720         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
1721         (WebCore::ScrollingTreeScrollingNode::parentToLocalPoint const):
1722         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
1723         (WebCore::ScrollingTreeScrollingNode::scrollingNodeForPoint const):
1724         * page/scrolling/ScrollingTreeScrollingNode.h:
1725         * page/scrolling/ThreadedScrollingTree.cpp:
1726         (WebCore::ThreadedScrollingTree::handleWheelEvent):
1727         * page/scrolling/ThreadedScrollingTree.h:
1728         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
1729         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
1730         (WebCore::ScrollingTreeFrameScrollingNodeIOS::handleWheelEvent):
1731         * page/scrolling/ios/ScrollingTreeIOS.h:
1732         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1733         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1734         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1735         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1736
1737 2019-01-31  Alicia Boya García  <aboya@igalia.com>
1738
1739         [MSE][GStreamer] Remove unused GstFlowReturn in AppendPipeline methods
1740         https://bugs.webkit.org/show_bug.cgi?id=194067
1741
1742         Reviewed by Xabier Rodriguez-Calvar.
1743
1744         A couple methods in AppendPipeline were returning GstFlowReturn
1745         despite there being no codepath (sans assertions) where values other
1746         than GST_FLOW_OK are returned.
1747
1748         Therefore, it makes sense to just make these methods return void.
1749
1750         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1751         (WebCore::AppendPipeline::pushNewBuffer):
1752         (WebCore::AppendPipeline::handleAppsinkNewSampleFromStreamingThread):
1753         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1754         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1755         (WebCore::MediaSourceClientGStreamerMSE::append):
1756         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1757         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1758         (WebCore::SourceBufferPrivateGStreamer::append):
1759
1760 2019-01-31  Alicia Boya García  <aboya@igalia.com>
1761
1762         [MSE][GStreamer] Remove if (m_playerPrivate) from MediaSourceClientGStreamerMSE
1763         https://bugs.webkit.org/show_bug.cgi?id=194069
1764
1765         Reviewed by Xabier Rodriguez-Calvar.
1766
1767         m_playerPrivate is non-NULL since MediaSourceClientGStreamerMSE
1768         creation well until its destruction.
1769
1770         The only case that could make a NULL m_playerPrivate is
1771         clearPlayerPrivate() but that method is not used anymore.
1772
1773         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1774         (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
1775         (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
1776         (WebCore::MediaSourceClientGStreamerMSE::abort):
1777         (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
1778         (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
1779         (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
1780         (WebCore::MediaSourceClientGStreamerMSE::flush):
1781         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
1782         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
1783         (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
1784         (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate): Deleted.
1785         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1786
1787 2019-01-31  Thibault Saunier  <tsaunier@igalia.com>
1788
1789         [GStreamer][WebRTC] Avoid returning FLUSHING when it is not the case in GStreamerMediaStreamSource
1790         https://bugs.webkit.org/show_bug.cgi?id=194087
1791
1792         Basically GstFlowCombiner was mostly designed for element that have 1 sinkpad and several srcpad
1793         meaning that it makes sense that when any of the downstream pad is returning flushing, you should
1794         return FLUSHING upstream. But in our case we have several sinkpads and FLUSHING should be returned
1795         *only* if the internally linked srcpad is FLUSHING otherwise we might end up setting the upstream
1796         source element task to PAUSED (because downstream returned flushing) on a branch that was not
1797         flushing!
1798
1799         Reviewed by Philippe Normand.
1800
1801         This is a theorical race we can't really cover with tests.
1802
1803         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1804         (WebCore::webkitMediaStreamSrcChain):
1805
1806 2019-01-31  Zalan Bujtas  <zalan@apple.com>
1807
1808         [LFC] Margin before/after/start/end initial value is 0 and not auto.
1809         https://bugs.webkit.org/show_bug.cgi?id=194090
1810
1811         Reviewed by Antti Koivisto.
1812
1813         Don't treat it like auto.
1814
1815         * layout/FormattingContextGeometry.cpp:
1816         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1817         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1818
1819 2019-01-31  Zalan Bujtas  <zalan@apple.com>
1820
1821         [LFC] Use the used margin values in outOfFlowReplacedHorizontalGeometry consistently
1822         https://bugs.webkit.org/show_bug.cgi?id=194074
1823
1824         Reviewed by Antti Koivisto.
1825
1826         Check the used margin variables whether we already computed start/end values.
1827
1828         Test: fast/block/block-only/absolute-position-with-margin-auto-simple2.html
1829
1830         * layout/FormattingContextGeometry.cpp:
1831         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1832
1833 2019-01-31  Zalan Bujtas  <zalan@apple.com>
1834
1835         [LFC][BFC] Add support for block level replaced box.
1836         https://bugs.webkit.org/show_bug.cgi?id=194071
1837
1838         Reviewed by Antti Koivisto.
1839
1840         * layout/layouttree/LayoutBox.cpp:
1841         (WebCore::Layout::Box::Box):
1842         * layout/layouttree/LayoutBox.h:
1843         * layout/layouttree/LayoutTreeBuilder.cpp:
1844         (WebCore::Layout::TreeBuilder::createSubTree):
1845         (WebCore::Layout::outputLayoutBox):
1846
1847 2019-01-31  Chris Fleizach  <cfleizach@apple.com>
1848
1849         ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNotification
1850         https://bugs.webkit.org/show_bug.cgi?id=189094
1851         <rdar://problem/43853526>
1852
1853         Reviewed by Zalan Bujtas.
1854
1855         Protect against access to objects and cache's that can be removed while an object is still in memory.
1856
1857         Unskipped flaky tests on mac-wk2.
1858
1859         * accessibility/mac/AXObjectCacheMac.mm:
1860         (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
1861         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1862         (textMarkerForVisiblePosition):
1863         (textMarkerRangeFromVisiblePositions):
1864
1865 2019-01-30  Chris Dumez  <cdumez@apple.com>
1866
1867         Regression(PSON) History navigations to twitter.com lead to a 403 HTTP error
1868         https://bugs.webkit.org/show_bug.cgi?id=194023
1869         <rdar://problem/47417981>
1870
1871         Reviewed by Geoffrey Garen.
1872
1873         The issue was caused by the 'isTopSite' flag not getting properly set on the network request
1874         in case of a cross-site history navigation (with process-swap). As a result, twitter.com was
1875         not getting its same-site lax cookies.
1876
1877         The 'isTopSite' flag normally gets set by FrameLoader::addExtraFieldsToRequest(), but we were
1878         bypassing this method entirely when continuing a load in a new process after a swap. This was
1879         intentional as the network request is normally already fully populated by the previous process
1880         and we do not want the new process to modify the request in any way (e.g. we would not want to
1881         add a Origin header back after it was removed by the previous process). However, in case of a
1882         History navigation, we do not actually pass a request along from one process to another. Instead,
1883         we pass a HistoryItem and then build a fresh new request from the HistoryItem in the new process.
1884         In this case, we *want* addExtraFieldsToRequest() to be called on the new request, even though
1885         we are technically continuing a load in a new process.
1886
1887         We thus address the issue by bypassing FrameLoader::addExtraFieldsToRequest() only if we're
1888         continuing a load with a request and not when we're continuing a load with a HistoryItem.
1889
1890         Test: http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php
1891
1892         * loader/FrameLoader.cpp:
1893         (WebCore::FrameLoader::load):
1894         (WebCore::FrameLoader::loadWithDocumentLoader):
1895         (WebCore::FrameLoader::addExtraFieldsToRequest):
1896         (WebCore::FrameLoader::loadDifferentDocumentItem):
1897         * loader/FrameLoader.h:
1898         (WebCore::FrameLoader::shouldTreatCurrentLoadAsContinuingLoad const):
1899
1900 2019-01-30  Justin Fan  <justin_fan@apple.com>
1901
1902         [WebGPU] Support GPUDepthStencilStateDescriptor
1903         https://bugs.webkit.org/show_bug.cgi?id=194048
1904         <rdar://problem/46289645>
1905
1906         Reviewed by Dean Jackson.
1907
1908         Implement GPUDepthStencilStateDescriptor to specify a MTLDepthStencilState that is set on the command encoder.
1909
1910         Existing tests cover changes to pipeline. Behavior does not change as DepthStencilState has no effect 
1911         without a depth texture attached.
1912
1913         New interface files added:
1914         * Modules/webgpu/GPUCompareFunction.idl:
1915         * Modules/webgpu/GPUDepthStencilStateDescriptor.idl:
1916         * platform/graphics/gpu/GPUCompareFunction.h:
1917         * platform/graphics/gpu/GPUDepthStencilStateDescriptor.h:
1918
1919         Modifications:
1920         * Modules/webgpu/WebGPUDevice.cpp: Include depthStencilState when creating pipeline.
1921         (WebCore::WebGPUDevice::createRenderPipeline const):
1922         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Add depthStencilState to the descriptor.
1923         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
1924         * platform/graphics/gpu/GPURenderPipeline.h: Ditto.
1925         (WebCore::GPURenderPipeline::depthStencilState const): Getter.
1926         (WebCore::GPURenderPipeline::platformRenderPipeline const):
1927         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Update constructor to take depthStencilState.
1928         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
1929         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Setting pipeline also sets the included depthStencilState.
1930         (WebCore::GPURenderPassEncoder::setPipeline):
1931         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Convert DepthStencilStateDescriptor to MTLDepthStencilState.
1932         (WebCore::validateAndConvertDepthCompareFunctionToMtl):
1933         (WebCore::tryCreateMtlDepthStencilState):
1934         (WebCore::tryCreateMtlRenderPipelineState): Refactored logic out of GPURenderPipeline::create.
1935         (WebCore::GPURenderPipeline::create):
1936         (WebCore::GPURenderPipeline::GPURenderPipeline):
1937
1938         Added symbols for CompareFunction, DepthStencilStateDescriptor to the project:
1939         * CMakeLists.txt:
1940         * DerivedSources.make:
1941         * Sources.txt:
1942         * WebCore.xcodeproj/project.pbxproj:
1943
1944         * Modules/webgpu/WebGPUDevice.idl: Cleaned up IDL to match current version.
1945
1946 2019-01-30  Jer Noble  <jer.noble@apple.com>
1947
1948         [Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove()
1949         https://bugs.webkit.org/show_bug.cgi?id=193984
1950
1951         Reviewed by Eric Carlson.
1952
1953         MediaKeySession.sessionId is empty during the CDMInstance->requestLicense success callback handler. The
1954         KVO notification that AVContentKeySession.contentProtectionSessionIdentifier changed isn't called until
1955         after the -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
1956         completion handler is called.
1957
1958         Explicitly ask for the -contentProtectionSessionIdentifier inside that handler, and just in case the sessionID
1959         changes after that, add a new client callback method to notify the MediaKeySession that the ID has changed.
1960
1961         * Modules/encryptedmedia/MediaKeySession.cpp:
1962         (WebCore::MediaKeySession::sessionIdChanged):
1963         * Modules/encryptedmedia/MediaKeySession.h:
1964         * platform/encryptedmedia/CDMInstanceSession.h:
1965         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1966         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
1967         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
1968
1969 2019-01-30  Keith Rollin  <krollin@apple.com>
1970
1971         FloatWithRect has invalid and inaccessible default constructor
1972         https://bugs.webkit.org/show_bug.cgi?id=194057
1973         <rdar://problem/47685211>
1974
1975         Reviewed by Zalan Bujtas.
1976
1977         FloatWithRect has a default constructor declared as 'default'. This
1978         constructor is invalid because FloatWithRect has a data member that's
1979         a reference that will not get initialized with this constructor. Since
1980         it's invalid, and since it's private and not accessed by anything,
1981         remove this constructor.
1982
1983         No new tests since there should be no observable behavior difference.
1984
1985         * rendering/line/LineLayoutState.h:
1986
1987 2019-01-30  Daniel Bates  <dabates@apple.com>
1988
1989         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
1990         https://bugs.webkit.org/show_bug.cgi?id=192824
1991         <rdar://problem/47100332>
1992
1993         Reviewed by Wenson Hsieh.
1994
1995         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
1996         now that hardware key events to non-editable elements use the same code path as for editable elements. 
1997
1998         * platform/ios/KeyEventIOS.mm:
1999         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
2000         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
2001         (WebCore::isFunctionKey): Ditto.
2002         * platform/ios/WebEvent.mm:
2003         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
2004         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
2005
2006 2019-01-30  Jer Noble  <jer.noble@apple.com>
2007
2008         Ensure ENABLE_MEDIA_SOURCE is defined inside DerivedSources.make
2009         https://bugs.webkit.org/show_bug.cgi?id=194063
2010
2011         Reviewed by Jon Lee.
2012
2013         * DerivedSources.make:
2014
2015 2019-01-30  Youenn Fablet  <youenn@apple.com>
2016
2017         Refactor ServiceWorkerJob management by ServiceWorkerContainer to make it more memory safe
2018         https://bugs.webkit.org/show_bug.cgi?id=193747
2019         <rdar://problem/47498196>
2020
2021         Reviewed by Chris Dumez.
2022
2023         Make ServiceWorkerJob be no longer ref counted.
2024         Instead its lifetime is fully controlled by ServiceWorkerContainer.
2025
2026         Make sure that a failing load will remove the job from ServiceWorkerContainer job map.
2027         This allows to ensure that these jobs do not stay forever.
2028         Before the patch, the jobs map was never cleared, which is creating a ref cycle whenever a job is not succesful.
2029
2030         Before the patch, unsetPendingActivity was only called for successful jobs finishing.
2031         In case of failing loads, ServiceWorkerContainer would leak.
2032         Make sure that setPendingActivity/unsetPendingActivity is balanced by storing
2033         a pending activity in the job map next to the job.
2034
2035         When ServiceWorkerContainer is stopped, notify that all jobs are cancelled to NetworkProcess.
2036         This makes these jobs in NetworkProcess-side to not stay until the corresponding WebProcess is gone.
2037
2038         Simplify ServiceWorkerJob promise rejection handling so that it is clear when promise is rejected and when it is not.
2039         Update type of exception to be SecurityError when load fails due to AccessControl.
2040
2041         Covered by existing tests.
2042
2043         * workers/service/ServiceWorkerContainer.cpp:
2044         (WebCore::ServiceWorkerContainer::addRegistration):
2045         (WebCore::ServiceWorkerContainer::removeRegistration):
2046         (WebCore::ServiceWorkerContainer::updateRegistration):
2047         (WebCore::ServiceWorkerContainer::scheduleJob):
2048         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2049         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2050         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2051         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2052         (WebCore::ServiceWorkerContainer::jobDidFinish):
2053         (WebCore::ServiceWorkerContainer::stop):
2054         (WebCore::ServiceWorkerContainer::job):
2055         * workers/service/ServiceWorkerContainer.h:
2056         * workers/service/ServiceWorkerJob.cpp:
2057         (WebCore::ServiceWorkerJob::failedWithException):
2058         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
2059         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
2060         (WebCore::ServiceWorkerJob::startScriptFetch):
2061         (WebCore::ServiceWorkerJob::didReceiveResponse):
2062         (WebCore::ServiceWorkerJob::notifyFinished):
2063         (WebCore::ServiceWorkerJob::cancelPendingLoad):
2064         * workers/service/ServiceWorkerJob.h:
2065         (WebCore::ServiceWorkerJob::hasPromise const):
2066         (WebCore::ServiceWorkerJob::takePromise):
2067         * workers/service/ServiceWorkerJobClient.h:
2068         * workers/service/server/SWServerJobQueue.cpp:
2069         (WebCore::SWServerJobQueue::scriptFetchFinished):
2070
2071 2019-01-30  Dean Jackson  <dino@apple.com>
2072
2073         PointerEvents - tiltX and tiltY are reversed
2074         https://bugs.webkit.org/show_bug.cgi?id=194032
2075         <rdar://problem/47674184>
2076
2077         Reviewed by Jon Lee.
2078
2079         I got tiltX and tiltY the wrong way around.
2080
2081         * dom/ios/PointerEventIOS.cpp: Flip the values.
2082
2083 2019-01-30  Zalan Bujtas  <zalan@apple.com>
2084
2085         [LFC][IFC] nextBreakablePosition returns the same position on hyphen characters
2086         https://bugs.webkit.org/show_bug.cgi?id=194001
2087
2088         Reviewed by Antti Koivisto.
2089
2090         Skip to the next position manually. This is exactly what we do in simple line layout.
2091
2092         * layout/inlineformatting/InlineRunProvider.cpp:
2093         (WebCore::Layout::InlineRunProvider::moveToNextBreakablePosition):
2094
2095 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
2096
2097         Add some basic geometry information to the scrolling tree
2098         https://bugs.webkit.org/show_bug.cgi?id=194002
2099         rdar://problem/47656294
2100
2101         Reviewed by Antti Koivisto.
2102
2103         To allow hit-testing in the scrolling tree, store a parent-relative scrollable
2104         rect in "scrolling" and "frame hosting" nodes. This is a rect whose size is the size
2105         of the scrollable area, and whose origin is relative to the parent scrolling tree node.
2106         
2107         Frame hosting nodes need this rect because they take care of the geometry offset between
2108         an iframe and its scrolling tree ancestor in the parent document.
2109         
2110         Based on a patch by Frédéric Wang in bug 172917.
2111
2112         * page/scrolling/AsyncScrollingCoordinator.cpp:
2113         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry):
2114         * page/scrolling/ScrollingStateFrameHostingNode.cpp:
2115         (WebCore::ScrollingStateFrameHostingNode::ScrollingStateFrameHostingNode):
2116         (WebCore::ScrollingStateFrameHostingNode::setAllPropertiesChanged):
2117         (WebCore::ScrollingStateFrameHostingNode::setParentRelativeScrollableRect):
2118         (WebCore::ScrollingStateFrameHostingNode::dumpProperties const):
2119         * page/scrolling/ScrollingStateFrameHostingNode.h:
2120         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
2121         (WebCore::ScrollingTreeFrameHostingNode::commitStateBeforeChildren):
2122         (WebCore::ScrollingTreeFrameHostingNode::dumpProperties const):
2123         * page/scrolling/ScrollingTreeFrameHostingNode.h:
2124         (WebCore::ScrollingTreeFrameHostingNode::parentRelativeScrollableRect const):
2125         * rendering/RenderLayer.h:
2126         * rendering/RenderLayerBacking.cpp:
2127         (WebCore::RenderLayerBacking::updateScrollingLayers):
2128         * rendering/RenderLayerCompositor.cpp:
2129         (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const):
2130         (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const):
2131         (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const):
2132         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2133         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
2134         (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView const):
2135         (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView): Deleted.
2136         * rendering/RenderLayerCompositor.h:
2137
2138 2019-01-30  Zalan Bujtas  <zalan@apple.com>
2139
2140         [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently
2141         https://bugs.webkit.org/show_bug.cgi?id=194020
2142
2143         Reviewed by Antti Koivisto.
2144
2145         Check the used margin variables whether we already computed before/after values.
2146
2147         Test: fast/block/block-only/absolute-position-with-margin-auto-simple.html
2148
2149         * layout/FormattingContextGeometry.cpp:
2150         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2151
2152 2019-01-30  Chris Fleizach  <cfleizach@apple.com>
2153
2154         AX: Support color well on iOS
2155         https://bugs.webkit.org/show_bug.cgi?id=194010
2156
2157         Reviewed by Joanmarie Diggs.
2158
2159         Test: accessibility/ios-simulator/color-well.html
2160
2161         Add support for color well on iOS.
2162
2163         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2164         (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
2165         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2166         (-[WebAccessibilityObjectWrapper accessibilityRoleDescription]):
2167         (-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
2168         * en.lproj/Localizable.strings:
2169         * platform/LocalizedStrings.cpp:
2170         (WebCore::AXColorWellText):
2171         * platform/LocalizedStrings.h:
2172
2173 2019-01-30  Chris Fleizach  <cfleizach@apple.com>
2174
2175         AX: Role=switch not returning correct accessibilityValue
2176         https://bugs.webkit.org/show_bug.cgi?id=194006
2177
2178         Reviewed by Joanmarie Diggs.
2179
2180         Return the toggle state of a role=switch element.        
2181
2182         Test: accessibility/ios-simulator/role-switch.html
2183
2184         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2185         (-[WebAccessibilityObjectWrapper accessibilityValue]):
2186
2187 2019-01-29  Rob Buis  <rbuis@igalia.com>
2188
2189         Align with Fetch on data: URLs
2190         https://bugs.webkit.org/show_bug.cgi?id=182325
2191
2192         Reviewed by Alex Christensen.
2193
2194         Implement most remaining steps for data: URL processing [1].
2195         Serialization is still to be implemented.
2196
2197         To make the code in DataURLDecoder::parseMediaType more efficient,
2198         refactor ParsedContentType so that validation and parsing is done
2199         in one pass.
2200
2201         Test: web-platform-tests/fetch/data-urls/processing.any.js
2202
2203         [1] https://fetch.spec.whatwg.org/#data-urls
2204
2205         * Modules/encryptedmedia/CDM.cpp:
2206         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
2207         * platform/network/DataURLDecoder.cpp:
2208         (WebCore::DataURLDecoder::parseMediaType):
2209         (WebCore::DataURLDecoder::DecodeTask::process):
2210         * platform/network/MIMEHeader.cpp:
2211         (WebCore::MIMEHeader::parseHeader):
2212         * platform/network/ParsedContentType.cpp:
2213         (WebCore::containsNewline):
2214         (WebCore::ParsedContentType::parseContentType):
2215         (WebCore::ParsedContentType::create):
2216         (WebCore::isValidContentType):
2217         (WebCore::ParsedContentType::ParsedContentType):
2218         (WebCore::DummyParsedContentType::setContentType const): Deleted.
2219         (WebCore::DummyParsedContentType::setContentTypeParameter const): Deleted.
2220         (WebCore::parseContentType): Deleted.
2221         * platform/network/ParsedContentType.h:
2222
2223 2019-01-29  Eric Carlson  <eric.carlson@apple.com>
2224
2225         [MSE] add more source buffer logging
2226         https://bugs.webkit.org/show_bug.cgi?id=193995
2227         <rdar://problem/47650399>
2228
2229         Reviewed by Jon Lee.
2230
2231         No new tests, no functional change.
2232
2233         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2234         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
2235         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
2236         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2237         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2238         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2239         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
2240
2241 2019-01-29  Simon Fraser  <simon.fraser@apple.com>
2242
2243         Add nodes to the scrolling tree in z-index order.
2244         https://bugs.webkit.org/show_bug.cgi?id=192529
2245         <rdar://problem/47402708>
2246
2247         Reviewed by Dean Jackson.
2248
2249         We currently add nodes to the scrolling tree via RenderLayerBacking::updateGeometry() and some other places.
2250         This is sub-optimal, because we don't readily know the scrolling ancestor at these times, so have to do RenderLayer
2251         walks to find them.
2252
2253         With this change we update the scrolling tree during the RenderLayerCompositor::updateBackingAndHierarchy()
2254         tree walk, storing state along the way so we always know our scrolling tree ancestor, and the sibling index
2255         (which makes it so that the scrolling tree correctly reflects layer z-order).
2256
2257         The reattachSubframeScrollLayers() code path is removed, since we can now reliably parent frame nodes via FrameHosting
2258         nodes in their parent document.
2259
2260         There is also some minor cleanup around RenderLayerBacking teardown; it used to be the case that cleanup in ~RenderLayerBacking
2261         was hard because the backing was already disconnected from its owning RenderLayer, so I added RenderLayerBacking::willBeDestroyed()
2262         to do work that requires that layer->backing() is still valid. This allows for fewer callsites for detachFromScrollingCoordinator().
2263
2264         updateScrollCoordinatedLayersAfterFlushIncludingSubframes() is now iOS-only because it's only relevant for iOS WK1,
2265         and m_scrollCoordinatedLayers can be moved to LegacyWebKitScrollingLayerCoordinator.
2266
2267         Tests: scrollingcoordinator/scrolling-tree/overflow-in-fixed.html
2268                scrollingcoordinator/scrolling-tree/scrolling-tree-is-z-order.html
2269
2270         * page/scrolling/ScrollingStateTree.cpp:
2271         (WebCore::ScrollingStateTree::insertNode):
2272         * page/scrolling/ScrollingTreeNode.cpp:
2273         (WebCore::ScrollingTreeNode::~ScrollingTreeNode):
2274         * platform/Logging.cpp:
2275         (WebCore::initializeLogChannelsIfNecessary):
2276         * rendering/RenderLayer.cpp:
2277         (WebCore::RenderLayer::setParent):
2278         (WebCore::RenderLayer::calculateClipRects const):
2279         * rendering/RenderLayerBacking.cpp:
2280         (WebCore::RenderLayerBacking::~RenderLayerBacking):
2281         (WebCore::RenderLayerBacking::willBeDestroyed):
2282         (WebCore::RenderLayerBacking::updateGeometry):
2283         (WebCore::RenderLayerBacking::updateBackgroundLayer):
2284         (WebCore::RenderLayerBacking::coordinatedScrollingRoles const):
2285         * rendering/RenderLayerBacking.h:
2286         * rendering/RenderLayerCompositor.cpp:
2287         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2288         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
2289         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
2290         (WebCore::frameHostingNodeForFrame):
2291         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2292         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2293         (WebCore::RenderLayerCompositor::updateBacking):
2294         (WebCore::RenderLayerCompositor::layerWillBeRemoved):
2295         (WebCore::RenderLayerCompositor::setIsInWindow):
2296         (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants):
2297         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
2298         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
2299         (WebCore::RenderLayerCompositor::attachScrollingNode):
2300         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerWithRole):
2301         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
2302         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
2303         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2304         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
2305         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
2306         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
2307         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
2308         (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
2309         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
2310         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeLayer):
2311         (WebCore::LegacyWebKitScrollingLayerCoordinator::addViewportConstrainedLayer):
2312         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeViewportConstrainedLayer):
2313         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush): Deleted.
2314         (WebCore::RenderLayerCompositor::setCompositingParent): Deleted. This was always called with a null parentLayer, so was a no-op.
2315         (WebCore::RenderLayerCompositor::removeCompositedChildren): Deleted.
2316         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged): Deleted. The work happens via didChangePlatformLayerForLayer() now.
2317         (WebCore::canCoordinateScrollingForLayer): Deleted.
2318         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Deleted.
2319         (WebCore::enclosingScrollingNodeID): Deleted.
2320         (WebCore::scrollCoordinatedAncestorInParentOfFrame): Deleted.
2321         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Deleted.
2322         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Deleted.
2323         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Deleted.
2324         * rendering/RenderLayerCompositor.h:
2325
2326 2019-01-29  Brent Fulgham  <bfulgham@apple.com>
2327
2328         Make sure we have a frame before trying to access its loader 
2329         https://bugs.webkit.org/show_bug.cgi?id=193985
2330         <rdar://problem/47618239>
2331
2332         Reviewed by Ryosuke Niwa.
2333
2334         * loader/ResourceLoadObserver.cpp:
2335         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2336
2337 2019-01-29  Andy Estes  <aestes@apple.com>
2338
2339         Try to fix the watchOS build.
2340
2341         * dom/Element.cpp:
2342
2343 2019-01-29  Simon Fraser  <simon.fraser@apple.com>
2344
2345         REGRESSION(r240553): [iOS] Crash in ScrollingTree::updateTreeFromStateNode when attempting to log in to icloud.com
2346         https://bugs.webkit.org/show_bug.cgi?id=193907
2347         rdar://problem/47604080
2348
2349         Reviewed by Frédéric Wang.
2350
2351         Recent scrolling tree changes can trigger unparenting and reparenting of subtrees in the
2352         state tree. If a subframe's state tree nodes are unparented, a scrolling tree commit would
2353         show these as nodes being destroyed, which destroyed the tree nodes. When re-parented, the
2354         commit would re-create the tree node, but the state node would only have a subset of the
2355         change flags set, so the new tree node would fail to get all of the state (for example, it
2356         would be missing layers and scrolling geometry).
2357
2358         Fix by ensuring that when we reparent state node subtrees, we set all the change flags
2359         so that the full set of data is sent to the scrolling tree (the UI process, in the case of iOS WK2).
2360         Annoyingly, virtual setAllPropertiesChanged() functions are needed so each state node subclass can
2361         set the right change flags.
2362
2363         This patch also gets rid of m_nodesRemovedSinceLastCommit in the state tree. We can gain the same
2364         information by using copying all of the nodeIDs in m_nodeMap into a HashSet, and removing nodes
2365         as we encounter them in the tree walk.
2366         
2367         Rename m_latchedNode to m_latchedNodeID in ScrollingTree, since it's a nodeID, not a node pointer.
2368
2369         Test: compositing/geometry/composited-frame-contents.html
2370
2371         * page/scrolling/ScrollingStateFixedNode.cpp:
2372         (WebCore::ScrollingStateFixedNode::setAllPropertiesChanged):
2373         * page/scrolling/ScrollingStateFixedNode.h:
2374         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2375         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
2376         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2377         * page/scrolling/ScrollingStateNode.cpp:
2378         (WebCore::ScrollingStateNode::setPropertyChanged):
2379         (WebCore::ScrollingStateNode::setAllPropertiesChanged):
2380         * page/scrolling/ScrollingStateNode.h:
2381         (WebCore::ScrollingStateNode::setPropertyChangedBit):
2382         * page/scrolling/ScrollingStateScrollingNode.cpp:
2383         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
2384         * page/scrolling/ScrollingStateScrollingNode.h:
2385         * page/scrolling/ScrollingStateStickyNode.cpp:
2386         (WebCore::ScrollingStateStickyNode::setAllPropertiesChanged):
2387         * page/scrolling/ScrollingStateStickyNode.h:
2388         * page/scrolling/ScrollingStateTree.cpp:
2389         (WebCore::ScrollingStateTree::insertNode): Add a RELEASE_ASSERT on the type of the node created
2390         if parentID == 0, since mistakes here can associate a ScrollingNodeType::MainFrame node with some
2391         other nodeID which can result in type confusion later.
2392         (WebCore::ScrollingStateTree::nodeWasReattachedRecursive):
2393         (WebCore::ScrollingStateTree::commit):
2394         (WebCore::ScrollingStateTree::willRemoveNode):
2395         (WebCore::ScrollingStateTree::setRemovedNodes): Deleted.
2396         * page/scrolling/ScrollingStateTree.h:
2397         (WebCore::ScrollingStateTree::removedNodes const): Deleted.
2398         * page/scrolling/ScrollingTree.cpp:
2399         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
2400         (WebCore::ScrollingTree::commitTreeState):
2401         (WebCore::ScrollingTree::updateTreeFromStateNode):
2402         (WebCore::ScrollingTree::latchedNode):
2403         (WebCore::ScrollingTree::setLatchedNode):
2404         (WebCore::ScrollingTree::clearLatchedNode):
2405         (WebCore::ScrollingTree::scrollingTreeAsText):
2406         (WebCore::ScrollingTree::removeDestroyedNodes): Deleted.
2407         * page/scrolling/ScrollingTree.h:
2408         (WebCore::ScrollingTree::hasLatchedNode const):
2409         * rendering/RenderLayerCompositor.cpp:
2410         (WebCore::RenderLayerCompositor::ensureRootLayer): The scroll layer needs a 0,0,0 anchor point so that
2411         setting its position doesn't offset it relative to the center.
2412
2413 2019-01-29  Justin Fan  <justin_fan@apple.com>
2414
2415         [WebGPU] Fix and add validation to WebGPURenderPipeline and MTLVertexDescriptor
2416         https://bugs.webkit.org/show_bug.cgi?id=193926
2417         <rdar://problem/47327648>
2418
2419         Reviewed by Myles C. Maxfield.
2420
2421         Update vertex input to properly utilize inputSlot and shaderLocation fields, and add some validation.
2422
2423         Test: webgpu/vertex-buffer-triangle-strip.html
2424
2425         * Modules/webgpu/WebGPUVertexInputDescriptor.idl: 
2426         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
2427         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2428         (WebCore::setInputStateForPipelineDescriptor): Properly retain Metal types.
2429         (WebCore::GPURenderPipeline::create): Provide error logging for MTLRenderPipelineState creation.
2430
2431 2019-01-29  Keith Rollin  <krollin@apple.com>
2432
2433         Add .xcfilelists to Run Script build phases
2434         https://bugs.webkit.org/show_bug.cgi?id=193792
2435         <rdar://problem/47201785>
2436
2437         Reviewed by Alex Christensen.
2438
2439         As part of supporting XCBuild, update the necessary Run Script build
2440         phases in their Xcode projects to refer to their associated
2441         .xcfilelist files.
2442
2443         Note that the addition of these files bumps the Xcode project version
2444         number to something that's Xcode 10 compatible. This change means that
2445         older versions of the Xcode IDE can't read these projects. Nor can it
2446         fully load workspaces that refer to these projects (the updated
2447         projects are shown as non-expandable placeholders). `xcodebuild` can
2448         still build these projects; it's just that the IDE can't open them.
2449
2450         Make special accommodations for incorporating .xcfilelists from
2451         WebKitAdditions.
2452
2453         No new tests since there should be no observable behavior difference.
2454
2455         * Configurations/Base.xcconfig:
2456         * Configurations/DebugRelease.xcconfig:
2457         * WebCore.xcodeproj/project.pbxproj:
2458
2459 2019-01-29  John Wilander  <wilander@apple.com>
2460
2461         Add data abstraction and validation for Ad Click Attribution
2462         https://bugs.webkit.org/show_bug.cgi?id=193916
2463         <rdar://problem/47603481>
2464
2465         Reviewed by Daniel Bates, Brent Fulgham, and Alex Christensen.
2466
2467         New API tests added.
2468
2469         Ad click attribution has two steps. First, the storage of an ad
2470         campaign ID for a click that takes the user to a destination
2471         site. Second, a conversion on the destination site that can be
2472         attributed to the ad click.
2473
2474         This patch adds a class that represents a request for ad click
2475         attribution. Validation makes sure that the bits of entropy
2476         reported through this mechanism is limited.
2477
2478         This feature is experimental and off by default.
2479
2480         * Sources.txt:
2481             Added loader/AdClickAttribution.cpp.
2482         * WebCore.xcodeproj/project.pbxproj:
2483         * loader/AdClickAttribution.cpp: Added.
2484         (WebCore::AdClickAttribution::isValid const):
2485         (WebCore::AdClickAttribution::setConversion):
2486         (WebCore::AdClickAttribution::url const):
2487         (WebCore::AdClickAttribution::referrer const):
2488         * loader/AdClickAttribution.h: Added.
2489         (WebCore::AdClickAttribution::Campaign::Campaign):
2490         (WebCore::AdClickAttribution::Campaign::isValid const):
2491         (WebCore::AdClickAttribution::Source::Source):
2492         (WebCore::AdClickAttribution::Destination::Destination):
2493         (WebCore::AdClickAttribution::Priority::Priority):
2494         (WebCore::AdClickAttribution::Conversion::Conversion):
2495         (WebCore::AdClickAttribution::Conversion::isValid const):
2496         (WebCore::AdClickAttribution::AdClickAttribution):
2497         (WebCore::AdClickAttribution::earliestTimeToSend const):
2498         * loader/DocumentLoader.cpp:
2499             Added missing #include "RuntimeEnabledFeatures.h".
2500
2501 2019-01-29  Zalan Bujtas  <zalan@apple.com>
2502
2503         [MathML] Move enum class ScriptType to MathMLScriptsElement.
2504         https://bugs.webkit.org/show_bug.cgi?id=193969
2505
2506         Reviewed by Antti Koivisto.
2507
2508         * mathml/MathMLScriptsElement.cpp:
2509         (WebCore::scriptTypeOf):
2510         * mathml/MathMLScriptsElement.h:
2511         * rendering/mathml/RenderMathMLScripts.cpp:
2512         (WebCore::RenderMathMLScripts::scriptType const):
2513         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren):
2514         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths):
2515         (WebCore::RenderMathMLScripts::verticalMetrics):
2516         (WebCore::RenderMathMLScripts::layoutBlock):
2517         * rendering/mathml/RenderMathMLScripts.h:
2518         * rendering/mathml/RenderMathMLUnderOver.cpp:
2519         (WebCore::RenderMathMLUnderOver::isValid const):
2520         (WebCore::RenderMathMLUnderOver::under const):
2521         (WebCore::RenderMathMLUnderOver::over const):
2522         (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths):
2523         (WebCore::RenderMathMLUnderOver::hasAccent const):
2524         (WebCore::RenderMathMLUnderOver::layoutBlock):
2525
2526 2019-01-29  Chris Dumez  <cdumez@apple.com>
2527
2528         Make sure WTF::generateObjectIdentifier() internal counter does not get duplicated
2529         https://bugs.webkit.org/show_bug.cgi?id=193848
2530
2531         Reviewed by Youenn Fablet.
2532
2533         * dom/Document.cpp:
2534         * dom/MessageChannel.cpp:
2535         (WebCore::MessageChannel::MessageChannel):
2536         * dom/ScriptExecutionContext.cpp:
2537         (WebCore::ScriptExecutionContext::contextIdentifier const):
2538         * history/HistoryItem.cpp:
2539         (WebCore::HistoryItem::HistoryItem):
2540         * loader/DocumentLoader.cpp:
2541         (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
2542         * page/DOMWindow.cpp:
2543         (WebCore::DOMWindow::DOMWindow):
2544         * platform/Process.cpp:
2545         (WebCore::Process::identifier):
2546         * workers/service/ServiceWorkerJobData.cpp:
2547         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
2548         * workers/service/server/RegistrationDatabase.cpp:
2549         (WebCore::RegistrationDatabase::importRecords):
2550         * workers/service/server/SWServer.cpp:
2551         (WebCore::SWServer::Connection::Connection):
2552         (WebCore::SWServer::updateWorker):
2553         * workers/service/server/SWServerRegistration.cpp:
2554         (WebCore::generateServiceWorkerRegistrationIdentifier):
2555         * workers/service/server/SWServerToContextConnection.cpp:
2556         (WebCore::generateServerToContextConnectionIdentifier):
2557
2558
2559 2019-01-29  Alex Christensen  <achristensen@webkit.org>
2560
2561         Use lambdas instead of member pointer functions for TransactionOperationImpl
2562         https://bugs.webkit.org/show_bug.cgi?id=193933
2563
2564         Reviewed by Tim Horton.
2565
2566         No change in behavior.  This just makes it easier to add new parameters to these functions in a straightforward manner.
2567
2568         * Modules/indexeddb/IDBObjectStore.cpp:
2569         (WebCore::IDBObjectStore::putOrAdd):
2570         * Modules/indexeddb/IDBTransaction.cpp:
2571         (WebCore::IDBTransaction::internalAbort):
2572         (WebCore::IDBTransaction::commit):
2573         (WebCore::IDBTransaction::createObjectStore):
2574         (WebCore::IDBTransaction::renameObjectStore):
2575         (WebCore::IDBTransaction::createIndex):
2576         (WebCore::IDBTransaction::renameIndex):
2577         (WebCore::IDBTransaction::doRequestOpenCursor):
2578         (WebCore::IDBTransaction::iterateCursor):
2579         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
2580         (WebCore::IDBTransaction::requestGetAllIndexRecords):
2581         (WebCore::IDBTransaction::requestGetRecord):
2582         (WebCore::IDBTransaction::requestIndexRecord):
2583         (WebCore::IDBTransaction::requestCount):
2584         (WebCore::IDBTransaction::requestDeleteRecord):
2585         (WebCore::IDBTransaction::requestClearObjectStore):
2586         (WebCore::IDBTransaction::requestPutOrAdd):
2587         (WebCore::IDBTransaction::deleteObjectStore):
2588         (WebCore::IDBTransaction::deleteIndex):
2589         * Modules/indexeddb/IDBTransaction.h:
2590         * Modules/indexeddb/client/TransactionOperation.h:
2591         (WebCore::IDBClient::TransactionOperation::doComplete):
2592         (WebCore::IDBClient::createTransactionOperation): Deleted.
2593
2594 2019-01-29  Zalan Bujtas  <zalan@apple.com>
2595
2596         [LFC][BFC][MarginCollapsing] Remove incorrect downcast<Container>
2597         https://bugs.webkit.org/show_bug.cgi?id=193964
2598
2599         Reviewed by Antti Koivisto.
2600
2601         * layout/blockformatting/BlockMarginCollapse.cpp:
2602         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
2603
2604 2019-01-29  Zalan Bujtas  <zalan@apple.com>
2605
2606         [LFC][BFC] Do not ignore next sibling box while laying out BFC.
2607         https://bugs.webkit.org/show_bug.cgi?id=193954
2608
2609         Reviewed by Antti Koivisto.
2610
2611         When a block box has no child (<img style="display: block">), we should not ignore the next sibling (move the container check to the function to keep layout logic simple)
2612         Also inFlowNonReplacedWidthAndMargin() is called through inFlowReplacedWidthAndMargin() to compute margins.
2613
2614         * layout/blockformatting/BlockFormattingContext.cpp:
2615         (WebCore::Layout::BlockFormattingContext::layout const):
2616         (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren const):
2617         * layout/blockformatting/BlockFormattingContext.h:
2618         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2619         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2620
2621 2019-01-29  Zalan Bujtas  <zalan@apple.com>
2622
2623         [LFC][BFC][MarginCollapsing] Remove quirk from MarginCollapse::marginsCollapseThrough
2624         https://bugs.webkit.org/show_bug.cgi?id=193948
2625
2626         Reviewed by Antti Koivisto.
2627
2628         This is now implemented in BlockFormattingContext::Quirks::stretchedInFlowHeight().
2629
2630         * layout/blockformatting/BlockMarginCollapse.cpp:
2631         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
2632
2633 2019-01-29  Zalan Bujtas  <zalan@apple.com>
2634
2635         [LFC][BFC][MarginCollapsing] Anonymous block container's margin before does not collapse with previous inflow sibling margin after.
2636         https://bugs.webkit.org/show_bug.cgi?id=193952
2637
2638         Reviewed by Antti Koivisto.
2639
2640         * layout/blockformatting/BlockMarginCollapse.cpp:
2641         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
2642
2643 2019-01-29  Frederic Wang  <fwang@igalia.com>
2644
2645         Allow scrolling tree nodes to exist in a detached state
2646         https://bugs.webkit.org/show_bug.cgi?id=193754
2647
2648         Unreviewed build warning fix.
2649
2650         * page/scrolling/ScrollingStateTree.cpp:
2651         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): Remove
2652         unused variable.
2653
2654 2019-01-28  Ryosuke Niwa  <rniwa@webkit.org>
2655
2656         User agent string override for navigator.userAgent should be site specific quirks
2657         https://bugs.webkit.org/show_bug.cgi?id=193950
2658
2659         Reviewed by Brent Fulgham.
2660
2661         In order to make it possible to toggle the UA string override just for navigator.userAgent via Web Inspector,
2662         we need to put this override behind the site specific quirks. Because WebInspector overrides Page's setting
2663         without updating WKPreferences, there is no way for WKWebView client's to know whether the site specific quirks
2664         had been disabled or not.
2665
2666         * loader/DocumentLoader.h:
2667         (WebCore::DocumentLoader::setCustomJavaScriptUserAgentAsSiteSpecificQuirks):
2668         (WebCore::DocumentLoader::customJavaScriptUserAgentAsSiteSpecificQuirks const):
2669         (WebCore::DocumentLoader::setCustomJavaScriptUserAgent): Deleted.
2670         (WebCore::DocumentLoader::customJavaScriptUserAgent const): Deleted.
2671         * loader/FrameLoader.cpp:
2672         (WebCore::FrameLoader::userAgentForJavaScript const):
2673
2674 2019-01-28  Devin Rousso  <drousso@apple.com>
2675
2676         Web Inspector: provide a way to edit page WebRTC settings on a remote target
2677         https://bugs.webkit.org/show_bug.cgi?id=193863
2678         <rdar://problem/47572764>
2679
2680         Reviewed by Joseph Pecoraro.
2681
2682         Test: inspector/page/overrideSetting-ICECandidateFilteringEnabled.html
2683               inspector/page/overrideSetting-MockCaptureDevicesEnabled.html
2684
2685         * inspector/agents/InspectorPageAgent.cpp:
2686
2687         * page/Settings.yaml:
2688         * page/SettingsBase.h:
2689         * page/SettingsBase.cpp:
2690         (SettingsBase::iceCandidateFilteringEnabledChanged): Added.
2691         (SettingsBase::mockCaptureDevicesEnabledChanged): Added.
2692         * Scripts/GenerateSettings.rb:
2693         * Scripts/SettingsTemplates/Settings.cpp.erb:
2694         Add page-level settings for WebRTC preferences.
2695
2696         * Modules/mediastream/UserMediaController.cpp:
2697         (WebCore::UserMediaController::canCallGetUserMedia):
2698
2699         * testing/InternalSettings.cpp:
2700         (WebCore::InternalSettings::setMediaCaptureRequiresSecureConnection):
2701
2702         * testing/Internals.h:
2703         * testing/Internals.cpp:
2704         (WebCore::Internals::Internals):
2705         (WebCore::Internals::setMockMediaCaptureDevicesEnabled):
2706         (WebCore::Internals::setMediaCaptureRequiresSecureConnection): Added.
2707
2708         * page/DeprecatedGlobalSettings.h:
2709         * page/DeprecatedGlobalSettings.cpp:
2710         (WebCore::DeprecatedGlobalSettings::mockCaptureDevicesEnabled): Deleted.
2711         (WebCore::DeprecatedGlobalSettings::setMockCaptureDevicesEnabled): Deleted.
2712         (WebCore::DeprecatedGlobalSettings::mediaCaptureRequiresSecureConnection): Deleted.
2713         (WebCore::DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection): Deleted.
2714
2715 2019-01-28  Jer Noble  <jer.noble@apple.com>
2716
2717         webkitcurrentplaybacktargetiswirelesschanged and webkitCurrentPlaybackIsWireless are non-deterministic.
2718         https://bugs.webkit.org/show_bug.cgi?id=193923
2719         <rdar://problem/45956595>
2720
2721         Reviewed by Eric Carlson.
2722
2723         The value of webkitCurrentPlaybackTargetIsWireless can change in between when the event is scheduled
2724         and when it's actually dispatched. To make this more deterministic, use a GenericTaskQueue to enqueue
2725         setting m_isPlayingToWirelessTarget and dispatch the changed event in the same run-loop.
2726
2727         * html/HTMLMediaElement.cpp:
2728         (WebCore::HTMLMediaElement::clearMediaPlayer):
2729         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2730         (WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget):
2731         (WebCore::HTMLMediaElement::dispatchEvent):
2732         * html/HTMLMediaElement.h:
2733
2734 2019-01-28  Ross Kirsling  <ross.kirsling@sony.com>
2735
2736         Remove unnecessary `using namespace WTF`s (or at least restrict their scope).
2737         https://bugs.webkit.org/show_bug.cgi?id=193941
2738
2739         Reviewed by Alex Christensen.
2740
2741         * css/CSSBasicShapes.cpp:
2742         * css/CSSPrimitiveValue.cpp:
2743         * css/parser/CSSParser.cpp:
2744         * css/parser/CSSParserSelector.cpp:
2745         * css/parser/CSSPropertyParser.cpp:
2746         * dom/Document.cpp:
2747         * dom/EventListenerMap.cpp:
2748         * dom/EventTarget.cpp:
2749         * editing/Editor.cpp:
2750         * html/HTMLElement.cpp:
2751         * html/HTMLFontElement.cpp:
2752         * html/parser/HTMLTokenizer.cpp:
2753         * html/track/TrackBase.cpp:
2754         * loader/FTPDirectoryParser.cpp:
2755         * loader/TextResourceDecoder.cpp:
2756         * loader/cache/CachedResource.cpp:
2757         * page/ContextMenuController.cpp:
2758         * page/Navigator.cpp:
2759         * platform/Length.cpp:
2760         * platform/cocoa/KeyEventCocoa.mm:
2761         * platform/graphics/FontCascade.cpp:
2762         * platform/graphics/WidthIterator.cpp:
2763         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2764         * platform/ios/KeyEventIOS.mm:
2765         * platform/mac/KeyEventMac.mm:
2766         * platform/network/HTTPParsers.cpp:
2767         * platform/text/TextCodecUTF8.cpp:
2768         * platform/text/TextEncodingRegistry.cpp:
2769         * platform/win/KeyEventWin.cpp:
2770         * rendering/BidiRun.cpp:
2771         * rendering/FloatingObjects.cpp:
2772         * rendering/RenderBlock.cpp:
2773         * rendering/RenderListMarker.cpp:
2774         * rendering/RenderText.cpp:
2775
2776 2019-01-28  Fujii Hironori  <Hironori.Fujii@sony.com>
2777
2778         [Win] WebCore/platform/Process.h is conflicting with process.h
2779         https://bugs.webkit.org/show_bug.cgi?id=193944
2780
2781         Reviewed by Ross Kirsling.
2782
2783         Windows has process.h. Rename Process.h to ProcessIdentifier.h.
2784
2785         No new tests because there is no behavior change.
2786
2787         * Sources.txt:
2788         * UnifiedSources-input.xcfilelist:
2789         * WebCore.xcodeproj/project.pbxproj:
2790         * dom/MessagePortIdentifier.h:
2791         * dom/messageports/MessagePortChannel.h:
2792         * dom/messageports/MessagePortChannelProvider.h:
2793         * dom/messageports/MessagePortChannelRegistry.h:
2794         * history/BackForwardItemIdentifier.h:
2795         * page/GlobalWindowIdentifier.h:
2796         * platform/ProcessIdentifier.cpp: Renamed from Source/WebCore/platform/Process.cpp.
2797         (WebCore::Process::setIdentifier):
2798         (WebCore::Process::identifier):
2799         * platform/ProcessIdentifier.h: Renamed from Source/WebCore/platform/Process.h.
2800
2801 2019-01-28  Antoine Quint  <graouts@apple.com>
2802
2803         Implement capture for Pointer Events on iOS
2804         https://bugs.webkit.org/show_bug.cgi?id=193917
2805         <rdar://problem/47605689>
2806
2807         Reviewed by Dean Jackson.
2808
2809         We add a new PointerCaptureController object which gets notified upon dispatch of pointer events
2810         to implement implicit pointer capture, dispatch the gotpointercapture and lostpointercaptiure events,
2811         and implement the Element APIs for pointer capture: hasPointerCapture(), setPointerCapture() and
2812         releasePointerCapture().
2813
2814         Tests: pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html
2815                pointerevents/ios/pointer-events-implicit-capture-release-exception.html
2816                pointerevents/ios/pointer-events-implicit-capture-release.html
2817                pointerevents/ios/pointer-events-implicit-capture.html
2818                pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html
2819
2820         * Sources.txt:
2821         * WebCore.xcodeproj/project.pbxproj:
2822         * dom/Element.cpp:
2823         (WebCore::Element::setPointerCapture):
2824         (WebCore::Element::releasePointerCapture):
2825         (WebCore::Element::hasPointerCapture):
2826         * dom/Element.h:
2827         * dom/Element.idl:
2828         * dom/EventNames.h:
2829         * dom/PointerEvent.h:
2830         * page/Page.cpp:
2831         (WebCore::Page::Page):
2832         * page/Page.h:
2833         (WebCore::Page::pointerCaptureController const):
2834         * page/PointerCaptureController.cpp: Added.
2835         (WebCore::PointerCaptureController::PointerCaptureController):
2836         (WebCore::PointerCaptureController::setPointerCapture):
2837         (WebCore::PointerCaptureController::releasePointerCapture):
2838         (WebCore::PointerCaptureController::hasPointerCapture):
2839         (WebCore::PointerCaptureController::pointerLockWasApplied):
2840         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
2841         (WebCore::PointerCaptureController::pointerEventWillBeDispatched):
2842         (WebCore::PointerCaptureController::pointerEventWasDispatched):
2843         (WebCore::PointerCaptureController::processPendingPointerCapture):
2844         * page/PointerCaptureController.h: Added.
2845         * page/PointerLockController.cpp:
2846         (WebCore::PointerLockController::requestPointerLock):
2847         * page/PointerLockController.h:
2848
2849 2019-01-28  Andy Estes  <aestes@apple.com>
2850
2851         [watchOS] Enable Parental Controls content filtering
2852         https://bugs.webkit.org/show_bug.cgi?id=193939
2853         <rdar://problem/46641912>
2854
2855         Reviewed by Ryosuke Niwa.
2856
2857         * Configurations/FeatureDefines.xcconfig:
2858
2859 2019-01-28  Dean Jackson  <dino@apple.com>
2860
2861         Produce "pen" Pointer Events if using a stylus (e.g. Apple Pencil)
2862         https://bugs.webkit.org/show_bug.cgi?id=193945
2863         <rdar://problem/47618922>
2864
2865         Reviewed by Antoine Quint.
2866
2867         Calculate the pressure, tiltX and tiltY values for incoming
2868         Pointer Events, which have values when the PlatformTouchEvent
2869         originated from a stylus.
2870
2871         Test: pointerevents/ios/pointer-events-dispatch-on-stylus.html
2872
2873         * dom/PointerEvent.h: Default to "mouse".
2874         * dom/ios/PointerEventIOS.cpp: Calculate the values.
2875
2876 2019-01-28  Timothy Hatcher  <timothy@apple.com>
2877
2878         Make it easier for non-Apple ports to enable dark mode CSS support.
2879         https://bugs.webkit.org/show_bug.cgi?id=193882
2880
2881         Reviewed by Megan Gardner.
2882
2883         * page/FrameView.cpp:
2884         (WebCore::FrameView::updateBackgroundRecursively): Limit use of system
2885         background color to the Mac platform.
2886         * rendering/RenderTheme.cpp:
2887         (WebCore::RenderTheme::purgeCaches): Purge m_darkColorCache.
2888         (WebCore::RenderTheme::platformColorsDidChange): Reset m_darkColorCache.
2889         (WebCore::RenderTheme::colorCache const): Added m_darkColorCache.
2890         * rendering/RenderTheme.h:
2891         (WebCore::RenderTheme::colorCache const): Deleted.
2892         * rendering/RenderThemeMac.h:
2893         * rendering/RenderThemeMac.mm:
2894         (WebCore::RenderThemeMac::purgeCaches): Removed m_darkColorCache.
2895         (WebCore::RenderThemeMac::platformColorsDidChange): Deleted.
2896         (WebCore::RenderThemeMac::colorCache const): Deleted.
2897
2898 2019-01-28  Simon Fraser  <simon.fraser@apple.com>
2899
2900         svg/text/select-text-inside-non-static-position.html crashes under ScrollingStateTree::unparentChildrenAndDestroyNode()
2901         https://bugs.webkit.org/show_bug.cgi?id=193930
2902
2903         Reviewed by Tim Horton.
2904
2905         ScrollingStateTree::unparentChildrenAndDestroyNode() should make a copy of the 'children' vector
2906         before iterating, since iteration mutates the array.
2907
2908         Tested by ASan tests.
2909
2910         * page/scrolling/ScrollingStateNode.h:
2911         (WebCore::ScrollingStateNode::takeChildren):
2912         * page/scrolling/ScrollingStateTree.cpp:
2913         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode):
2914
2915 2019-01-28  Simon Fraser  <simon.fraser@apple.com>
2916
2917         css3/filters/blur-filter-page-scroll-self.html crashes under WebCore::ScrollingStateNode::ScrollingStateNode
2918         https://bugs.webkit.org/show_bug.cgi?id=193925
2919
2920         Reviewed by Tim Horton.
2921
2922         Some css3/filters/ tests disable accelerated compositing (which is crazy). Make these
2923         tests not crash by ensuring that unparentNode() and unparentChildrenAndDestroyNode() clears the root
2924         node if it's the node being unparented or destroyed.
2925
2926         Tested by existing tests.
2927
2928         * page/scrolling/ScrollingStateTree.cpp:
2929         (WebCore::ScrollingStateTree::unparentNode):
2930         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode):
2931
2932 2019-01-28  Daniel Bates  <dabates@apple.com>
2933
2934         [iOS] Make Window virtual key code computation match Mac
2935         https://bugs.webkit.org/show_bug.cgi?id=193452
2936
2937         Reviewed by Ryosuke Niwa.
2938
2939         Use the same approach for computing the Windows virtual key code on iOS as we do on Mac for
2940         web compatibility. On Mac, we prefer to compute the  Windows virtual key code from the input
2941         strings of the key event and use the key event's keycode as a last resort.
2942
2943         Test: fast/events/ios/key-events-meta-alt-combinations.html
2944
2945         * platform/ios/PlatformEventFactoryIOS.h:
2946         * platform/ios/PlatformEventFactoryIOS.mm:
2947         (WebCore::isKeypadEvent): Added.
2948         (WebCore::windowsKeyCodeForKeyEvent): Added.
2949         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Modified to call
2950         WebCore::windowsKeyCodeForKeyEvent() to compute the Windows virtual key code.
2951
2952 2019-01-28  Antoine Quint  <graouts@apple.com>
2953
2954         Limit user-agent interactions based on the touch-action property on iOS
2955         https://bugs.webkit.org/show_bug.cgi?id=193447
2956
2957         Unreviewed build fix.
2958
2959         * dom/Element.cpp:
2960         (WebCore::parentCrossingFrameBoundaries):
2961
2962 2019-01-28  Eric Carlson  <eric.carlson@apple.com>
2963
2964         AVStreamSession isn't always available, make a HAVE compile flag for it
2965         https://bugs.webkit.org/show_bug.cgi?id=193889
2966         <rdar://problem/47452863>
2967
2968         Reviewed by Jer Noble.
2969
2970         No new tests, no functional change.
2971
2972         * page/Settings.yaml:
2973         * page/SettingsBase.cpp:
2974         (WebCore::SettingsBase::platformDefaultMediaSourceEnabled):
2975         * page/SettingsBase.h:
2976         * page/cocoa/SettingsBaseCocoa.mm:
2977         (WebCore::SettingsBase::platformDefaultMediaSourceEnabled):
2978         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
2979         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession):
2980         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2981         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2982
2983         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2984         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2985         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged): Fix logging.
2986         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2987
2988         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2989         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2990         
2991         Use a HashMap to associate CMSampleBuffer with SourceBufferPrivateAVFObjC.
2992
2993         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): isEqualTo
2994         -> isEqualToString.
2995         (WebCore::sourceBufferMap):
2996         (WebCore::nextMapID):
2997         (WebCore::bufferWasConsumedCallback):
2998         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
2999         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
3000         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
3001         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3002         (WebCore::SourceBufferPrivateAVFObjC::append):
3003         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
3004         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
3005         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
3006         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
3007         (-[WebBufferConsumedContext initWithParent:]): Deleted.
3008         (-[WebBufferConsumedContext parent]): Deleted.
3009
3010 2019-01-28  Rob Buis  <rbuis@igalia.com>
3011
3012         Update MIME type parser
3013         https://bugs.webkit.org/show_bug.cgi?id=180526
3014
3015         Reviewed by Frédéric Wang.
3016
3017         I overlooked step 11.9.3 [1], for Mimesniff we should not
3018         bail out on missing subtype, but keep trying. Note
3019         that Rfc2045 does require bailing out, as before.
3020
3021         Test: ParsedContentType unittest
3022
3023         [1] https://mimesniff.spec.whatwg.org/#parse-a-mime-type
3024
3025         * platform/network/ParsedContentType.cpp:
3026         (WebCore::parseToken):
3027         (WebCore::parseContentType):
3028
3029 2019-01-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3030
3031         Unreviewed follow-up to r240557, restore a call to makeString
3032         https://bugs.webkit.org/show_bug.cgi?id=192742
3033         <rdar://problem/46757369>
3034
3035         It works if we add this #include that was missing. I got confused by the error messages and
3036         missed that there were two similarly-named headers.
3037
3038         * rendering/RenderLayerCompositor.cpp:
3039         (WebCore::RenderLayerCompositor::logLayerInfo):
3040
3041 2019-01-28  Oriol Brufau  <obrufau@igalia.com>
3042
3043         [css-logical] Reject unitless length quirk in 'inset' shorthand
3044         https://bugs.webkit.org/show_bug.cgi?id=193773
3045
3046         Reviewed by Manuel Rego Casasnovas.
3047
3048         Even though its longhands ('top', 'right', 'bottom', 'left') accept the
3049         unitless length quirk, the 'inset' shorthand is a new CSS property and
3050         should reject it. This was resolved by the CSS WG in
3051         https://github.com/w3c/csswg-drafts/issues/3525#issuecomment-456902648
3052
3053         Tests: imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-001.html
3054                imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-002.html
3055                imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-003.html
3056                imported/w3c/web-platform-tests/quirks/unitless-length/limited-quirks.html
3057                imported/w3c/web-platform-tests/quirks/unitless-length/no-quirks.html
3058                imported/w3c/web-platform-tests/quirks/unitless-length/quirks.html
3059
3060         * css/parser/CSSPropertyParser.cpp:
3061         (WebCore::CSSPropertyParser::parseSingleValue):
3062
3063 2019-01-28  Zalan Bujtas  <zalan@apple.com>
3064
3065         [LFC][MarginCollapsing][Quirks] Quirk margin values get propagated through margin collapsing
3066         https://bugs.webkit.org/show_bug.cgi?id=193896
3067
3068         Reviewed by Antti Koivisto.
3069
3070         This patch implements quirk margin value collapsing. There are a few "quirk" rules when it comes to margin collapsing.
3071
3072         1. Collapsed quirk margin values are ignored on quirk containers
3073
3074             <body>
3075               <p> p elements have 1em vertical (top/bottom) quirk margin
3076             </body>
3077
3078             In quirk mode, <p> and <body> (quirk container) collapses their vertical margins but <p>'s quirk values(1qem -> 16px) are ignored.
3079             Used vertical margin values on the <body> are top: 8px bottom: 8px.
3080
3081         2. Quirk margin values are turned into non-quirk values when collapsed with non-zero, non-quirk margins.
3082
3083             <body>
3084               <div style="margin-top: 1px">
3085                 <p> p elements have 1em vertical (top/bottom) quirk margin
3086               </div>
3087             </body>
3088
3089             When <p>'s vertical margin collapses with the parent <div>,
3090             - the collapsed before value becomes 16px (max(1qem, 1px)) and this collapsed value is now considered as a non-quirk value
3091             - the collapsed after value stays 1qem quirk value.
3092
3093             When <div> collapses with <body>
3094             - the collapsed before value becomes 16px (max(16px, 8px))
3095             - the <div>'s quirk after value gets ignored and the collapsed after value stays 8px.
3096             Used vertical margin values on the <body> are top: 16px (1em) bottom: 8px.
3097
3098         * layout/MarginTypes.h:
3099         (WebCore::Layout::PositiveAndNegativeVerticalMargin::Values::isNonZero const):
3100         * layout/blockformatting/BlockFormattingContext.h:
3101         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3102         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreCollapsedQuirkMargin):
3103         (WebCore::Layout::hasMarginBeforeQuirkValue): Deleted.
3104         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginBefore): Deleted.
3105         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter): Deleted.
3106         * layout/blockformatting/BlockMarginCollapse.cpp:
3107         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
3108         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore):
3109         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
3110         (WebCore::Layout::computedPositiveAndNegativeMargin):
3111         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
3112         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
3113
3114 2019-01-28  Zalan Bujtas  <zalan@apple.com>
3115
3116         [LFC][BFC] Remove redundant vertical positioning in BlockFormattingContext::computeFloatingPosition
3117         https://bugs.webkit.org/show_bug.cgi?id=193872
3118
3119         Reviewed by Antti Koivisto.
3120
3121         This is taken care of by verticalPositionWithMargin() in BlockFormattingContext::computeHeightAndMargin(). 
3122
3123         * layout/blockformatting/BlockFormattingContext.cpp:
3124         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
3125
3126 2019-01-28  cathie chen  <cathiechen@igalia.com>
3127
3128         Add missing #include in ScrollingTreeFrameScrollingNode.cpp
3129         https://bugs.webkit.org/show_bug.cgi?id=193905
3130
3131         Reviewed by Frédéric Wang.
3132
3133         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: Add
3134         #include "ScrollingStateFrameScrollingNode.h"
3135
3136 2019-01-28  Zalan Bujtas  <zalan@apple.com>
3137
3138         [LFC][BFC][Quirk] Ignore collapsed(through) margin after when stretching body height.
3139         https://bugs.webkit.org/show_bug.cgi?id=193894
3140
3141         Reviewed by Antti Koivisto.
3142
3143         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3144         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
3145
3146 2019-01-28  Antoine Quint  <graouts@apple.com>
3147
3148         Limit user-agent interactions based on the touch-action property on iOS
3149         https://bugs.webkit.org/show_bug.cgi?id=193447
3150         <rdar://problem/47283874>
3151
3152         Reviewed by Antti Koivisto and Simon Fraser.
3153
3154         We now compile a list of elements with a non-auto touch-action property that is updated whenever an element has its style changed
3155         or is removed from its document. When the content of that list changes, we inform the scrolling coordinator such that it can compile
3156         a list of TouchActionData structures which hold the touch-action value, the ID of the nearest scroll node and the Region containing
3157         the bounds of each of those elements to send it up to the UI process along with touch regions. Computing the list of allowed touch
3158         actions for a given element accounts for not only the value specified directly on that element's style, but also in its hierarchy,
3159         crossing any frame boundary towards the top-level document's root node.
3160
3161         Tests: pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html
3162                pointerevents/ios/touch-action-none-on-iframe.html
3163                pointerevents/ios/touch-action-none-on-parent.html
3164                pointerevents/ios/touch-action-none.html
3165                pointerevents/ios/touch-action-pan-x-pan-y.html
3166                pointerevents/ios/touch-action-pan-x.html
3167                pointerevents/ios/touch-action-pan-y.html
3168                pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html
3169                pointerevents/ios/touch-action-pinch-zoom-prevents-scrolling.html
3170
3171         * WebCore.xcodeproj/project.pbxproj: Update how certain headers are exposed such that they can be used from WebKit.
3172         * dom/Document.cpp:
3173         (WebCore::Document::invalidateRenderingDependentRegions):
3174         (WebCore::Document::nodeWillBeRemoved): Ensure a node that is being removed from this document is no longer listed in its
3175         list of elements with a non-auto touch-action property.
3176         (WebCore::Document::absoluteEventRegionForNode):
3177         (WebCore::Document::absoluteRegionForEventTargets):
3178         (WebCore::Document::updateTouchActionElements): Create a list of elements with a non-auto touch-action property if one doesn't
3179         exist yet and update it to add the given element if it contains a non-auto touch-action, or remove it if it doesn't. If the contents
3180         of that list changed as a result, the scrolling coordinator is informed.
3181         * dom/Document.h:
3182         (WebCore::Document:: const):
3183         * dom/Element.cpp:
3184         (WebCore::parentCrossingFrameBoundaries):
3185         (WebCore::Element::computedTouchActions const): Provide the list of allowed touch actions accounting for the "touch-action" property
3186         specified on this element and all of its hierarchy, crossing frame boundary.
3187         (WebCore::Element::nearestScrollingNodeIDUsingTouchOverflowScrolling const): Provide the ScrollingNodeID, if any, for the nearest scrolling node
3188         for that element. This will allow the UI process to identify which scroll view's behavior to customize to reflect the element's allowed
3189         touch actions.
3190         * dom/Element.h:
3191         * page/scrolling/ScrollingCoordinator.cpp:
3192         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const): Compute the region for all elements with a non-auto touch-action property
3193         throughout the provided frame and all of its subframes.
3194         * page/scrolling/ScrollingCoordinator.h:
3195         (WebCore::ScrollableAreaParameters::operator== const): Deleted.
3196         * page/scrolling/ScrollingCoordinatorTypes.h: Added.
3197         (WebCore::ScrollableAreaParameters::operator== const):
3198         * page/scrolling/ScrollingTree.cpp:
3199         (WebCore::ScrollingTree::touchActionDataAtPoint const): Query the list of TouchActionData objects for a match based on the provided point. Right
3200         now the logic is pretty crude, stopping at the first TouchActionData for which the region contains the provided point, but future patches will
3201         account for overlap and nesting.
3202         * page/scrolling/ScrollingTree.h:
3203         * page/scrolling/ScrollingTreeNode.h:
3204         * platform/EventTrackingRegions.cpp:
3205         (WebCore::operator==):
3206         * platform/EventTrackingRegions.h:
3207         (WebCore::operator!=):
3208         * style/StyleTreeResolver.cpp:
3209         (WebCore::Style::TreeResolver::resolveElement): Update the list of elements with a non-auto touch-action property when an element's style changes.
3210
3211 2019-01-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3212
3213         Unreviewed, fix WPE/GTK debug builds after r240557
3214         https://bugs.webkit.org/show_bug.cgi?id=192742
3215         <rdar://problem/46757369>
3216
3217         Also fix an improper format string that was recently added in a different commit.
3218
3219         * rendering/RenderLayerCompositor.cpp:
3220         (WebCore::RenderLayerCompositor::logLayerInfo):
3221         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
3222
3223 2018-12-15  Darin Adler  <darin@apple.com>
3224
3225         Replace many uses of String::format with more type-safe alternatives
3226         https://bugs.webkit.org/show_bug.cgi?id=192742
3227
3228         Reviewed by Mark Lam.
3229
3230         A while back, String::format was more efficient than string concatenation,
3231         but that is no longer true, and we should prefer String::number, makeString,
3232         or concatenation with the "+" operator to String::format for new code.
3233
3234         This is not as good for programmers who are fond of printf formatting
3235         style, and in some cases it's a little harder to read the strings
3236         interspersed with variables rather than a format string, but it's better
3237         in a few ways:
3238
3239         - more efficient (I didn't measure the difference, but it's definitely
3240           slower to use String::Format which calls vsnprintf twice than to use
3241           the WTF code)
3242         - works in a type-safe way without a need to use a format specifier such
3243           as "%" PRIu64 or "%tu" making it much easier to avoid problems due to
3244           subtle differences between platforms
3245         - allows us to use StringView in some cases to sidestep the need to
3246           allocate temporary WTF::String objects
3247         - does not require converting each WTF::String to a C string, allowing
3248           us to remove many cases of ".utf8().data()" and similar expressions,
3249           eliminating the allocation of temporary WTF::CString objects
3250
3251         This patch covers a batch of easiest-to-convert call sites.
3252         Later patches will allow us to deprecate or remove String::format.
3253
3254         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3255         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use makeString.
3256         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
3257         (WebCore::IDBCursorInfo::loggingString const): Ditto.
3258         * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
3259         (WebCore::IDBGetAllRecordsData::loggingString const): Ditto.
3260         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
3261         (WebCore::IDBGetRecordData::loggingString const): Ditto.
3262         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
3263         (WebCore::IDBIndexInfo::loggingString const): Ditto.
3264         (WebCore::IDBIndexInfo::condensedLoggingString const): Ditto.
3265         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
3266         (WebCore::IDBIterateCursorData::loggingString const): Ditto.
3267         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
3268         (WebCore::IDBObjectStoreInfo::condensedLoggingString const): Ditto.
3269         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
3270         (WebCore::IDBResourceIdentifier::loggingString const): Ditto.
3271         * Modules/webdatabase/Database.cpp:
3272         (WebCore::formatErrorMessage): Ditto.
3273         * Modules/webdatabase/SQLError.h:
3274         (WebCore::SQLError::create): Ditto.
3275
3276         * bindings/scripts/CodeGeneratorJS.pm:
3277         (GenerateImplementation): Use makeString.
3278
3279         * bindings/scripts/test/JS/JSInterfaceName.cpp:
3280         * bindings/scripts/test/JS/JSMapLike.cpp:
3281         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3282         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3283         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3284         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3285         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
3286         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
3287         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
3288         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3289         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3290         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3291         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3292         * bindings/scripts/test/JS/JSTestException.cpp:
3293         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3294         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3295         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
3296         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
3297         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3298         * bindings/scripts/test/JS/JSTestInterface.cpp:
3299         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
3300         * bindings/scripts/test/JS/JSTestIterable.cpp:
3301         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3302         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
3303         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
3304         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3305         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3306         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
3307         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
3308         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3309         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
3310         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
3311         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
3312         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
3313         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
3314         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
3315         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3316         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3317         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3318         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
3319         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3320         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3321         * bindings/scripts/test/JS/JSTestNode.cpp:
3322         * bindings/scripts/test/JS/JSTestObj.cpp:
3323         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3324         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3325         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3326         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
3327         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3328         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3329         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
3330         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3331         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3332         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3333         * bindings/scripts/test/JS/JSTestStringifier.cpp:
3334         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
3335         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
3336         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
3337         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
3338         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
3339         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
3340         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3341         Updated expected results.
3342 :
3343         * css/parser/CSSPropertyParserHelpers.cpp:
3344         (WebCore::CSSPropertyParserHelpers::parseHexColor): Use String::number
3345         and makeString.
3346
3347         * html/HTMLSelectElement.cpp:
3348         (WebCore::HTMLSelectElement::setLength): Use makeString.
3349         * html/ImageDocument.cpp:
3350         (WebCore::ImageDocument::imageUpdated): Ditto.
3351         * html/parser/XSSAuditor.cpp:
3352         (WebCore::XSSAuditor::init): Ditto.
3353         * inspector/InspectorFrontendClientLocal.cpp:
3354         (WebCore::InspectorFrontendClientLocal::setDockingUnavailable): Ditto.
3355         (WebCore::InspectorFrontendClientLocal::setAttachedWindow): Ditto.
3356         (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled): Ditto.
3357         (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled): Ditto.
3358         (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame): Ditto.
3359         * inspector/agents/InspectorCSSAgent.cpp: Ditto.
3360         * inspector/agents/InspectorIndexedDBAgent.cpp: Ditto.
3361         * page/MemoryRelease.cpp:
3362         (WebCore::logMemoryStatisticsAtTimeOfDeath): Ditto.
3363
3364         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3365         (WebCore::formatByteNumber): Use String::number.
3366         (WebCore::ResourceUsageOverlay::platformDraw): Use string concatenation.
3367
3368         * page/cocoa/ResourceUsageThreadCocoa.mm:
3369         (WebCore::logFootprintComparison): Use makeString.
3370         * platform/animation/TimingFunction.cpp:
3371         (WebCore::TimingFunction::cssText const): Ditto.
3372
3373         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
3374         (WebCore::AVTrackPrivateAVFObjCImpl::id const): Use AtomicString::number.
3375         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
3376         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Ditto.
3377
3378         * platform/graphics/ca/GraphicsLayerCA.cpp:
3379         (WebCore::GraphicsLayerCA::setContentsToSolidColor): Use makeString.
3380         (WebCore::GraphicsLayerCA::updateContentsImage): Ditto.
3381         (WebCore::GraphicsLayerCA::updateContentsRects): Ditto.
3382         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): Ditto.
3383         * platform/mock/MockRealtimeVideoSource.cpp:
3384         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
3385
3386         * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Use String::number.
3387
3388         * platform/network/ParsedContentRange.cpp:
3389         (WebCore::ParsedContentRange::headerValue const): Use makeString.
3390
3391         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Removed some unnecessary
3392         compiler conditionals and reorganized the start/stop of namespaces.
3393         (WebCore::NetworkStorageSession::switchToNewTestingSession): Use makeString.
3394
3395         * platform/sql/SQLiteDatabase.cpp:
3396         (WebCore::unauthorizedSQLFunction): Use makeString.
3397         * rendering/RenderLayerCompositor.cpp:
3398         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
3399         * workers/service/server/RegistrationDatabase.cpp:
3400         (WebCore::RegistrationDatabase::ensureValidRecordsTable): Ditto.
3401         (WebCore::RegistrationDatabase::importRecords): Ditto.
3402
3403 2019-01-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3404
3405         Remove a couple of PLATFORM defines intended for watchOS
3406         https://bugs.webkit.org/show_bug.cgi?id=193888
3407
3408         Reviewed by Alexey Proskuryakov.
3409
3410         Remove the use of !PLATFORM(WATCH), since this is true on every platform.
3411
3412         * editing/cocoa/DictionaryLookup.mm:
3413
3414 2019-01-27  Jiewen Tan  <jiewen_tan@apple.com>
3415
3416         Use a load optimizer for some sites
3417         https://bugs.webkit.org/show_bug.cgi?id=193881
3418         <rdar://problem/46325455>
3419
3420         Reviewed by Brent Fulgham.
3421
3422         Expose FormData::flatten to be used by the load optimizer.
3423
3424         * WebCore.xcodeproj/project.pbxproj:
3425         * platform/network/FormData.h:
3426
3427 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
3428
3429         Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node
3430         https://bugs.webkit.org/show_bug.cgi?id=193879
3431
3432         Reviewed by Antti Koivisto.
3433
3434         Currently we parent iframe scrolling tree nodes by finding the closest ancestor layer with a scrolling tree node.
3435         This results in scrolling tree nodes being connected across iframe boundaries in some arbitrary ancestor. This
3436         makes updating scrolling tree geometry very error-prone, since changes in the parent document will need to trigger
3437         updates of the scrolling tree node in an iframe.
3438         
3439         To address this, I already added a new "FrameHosting" scrolling node type. This patch actually instantiates these
3440         nodes, which are owned by the RenderIFrame's composited layer. Connecting across frame boundaries is theforefore
3441         simply a case of getting the FrameHosting node from the ownerElement's renderer; this is very similar to how we
3442         connect GraphicsLayers together.
3443         
3444         RenderLayerBacking gains another scrolling role for FrameHosting and ScrollingNodeID.
3445
3446         Tested by existing tests.
3447
3448         * page/FrameView.h:
3449         * rendering/RenderLayer.cpp:
3450         (WebCore::outputPaintOrderTreeRecursive):
3451         * rendering/RenderLayerBacking.cpp:
3452         (WebCore::RenderLayerBacking::updateConfiguration):
3453         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3454         * rendering/RenderLayerCompositor.cpp:
3455         (WebCore::frameContentsRenderView):
3456         (WebCore::RenderLayerCompositor::frameContentsCompositor):
3457         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
3458         (WebCore::RenderLayerCompositor::isLayerForIFrameWithScrollCoordinatedContents const):
3459         (WebCore::RenderLayerCompositor::detachRootLayer):
3460         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
3461         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
3462         (WebCore::scrollCoordinatedAncestorInParentOfFrame):
3463         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
3464         (WebCore::RenderLayerCompositor::attachScrollingNode):
3465         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
3466         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3467         * rendering/RenderLayerCompositor.h:
3468         * testing/Internals.cpp:
3469         (WebCore::Internals::scrollingStateTreeAsText const):
3470
3471 2019-01-27  Chris Fleizach  <cfleizach@apple.com>
3472
3473         AX: Introduce a static accessibility tree
3474         https://bugs.webkit.org/show_bug.cgi?id=193348
3475         <rdar://problem/47203295>
3476
3477         Reviewed by Ryosuke Niwa.
3478
3479         In order to improve performance when requesting the accessibility hierarchy, we introduce the idea of a "static accessibility tree" which 
3480         could be accessed on a different thread by assistive technologies.
3481         That is accomplished by storing all the data needed to answer accessibility attribute queries in a static object that mirrors the 
3482         "live" AccessibilityObjects (which interact with both DOM and Render trees).
3483         These static objects are generally created after layout is done and final tasks are being performed. They are then stored in the static tree 
3484         representation and able to be read from anywhere.
3485         Tactically this is done with AXIsolatedTreeNodes inside of an AXIsolatedTree. The TreeNodes implement an AccessibilityObjectInterface shared 
3486         with AccessibilityObject.
3487         This allows the wrappers to access either one depending on conditions and platforms without significant code duplication or re-organization.
3488
3489         * CMakeLists.txt:
3490         * Configurations/FeatureDefines.xcconfig:
3491         * Sources.txt:
3492         * WebCore.xcodeproj/project.pbxproj:
3493         * accessibility/AXObjectCache.cpp:
3494         (WebCore::AXObjectCache::remove):
3495         (WebCore::AXObjectCache::createIsolatedAccessibilityTree):
3496         (WebCore::AXObjectCache::generateStaticAccessibilityTreeIfNeeded):
3497         * accessibility/AXObjectCache.h:
3498         * accessibility/AccessibilityObject.h:
3499         * accessibility/AccessibilityObjectInterface.h: Added.
3500         * accessibility/isolatedtree: Added.
3501         * accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
3502         (WebCore::AXIsolatedTree::treeCache):
3503         (WebCore::AXIsolatedTree::AXIsolatedTree):
3504         (WebCore::AXIsolatedTree::create):
3505         (WebCore::AXIsolatedTree::treeForID):
3506         (WebCore::AXIsolatedTree::treeForPageID):
3507         (WebCore::AXIsolatedTree::nodeForID const):
3508         (WebCore::AXIsolatedTree::rootNode):
3509         (WebCore::AXIsolatedTree::removeNode):
3510         (WebCore::AXIsolatedTree::appendNodeChanges):
3511         (WebCore::AXIsolatedTree::applyPendingChanges):
3512         * accessibility/isolatedtree/AXIsolatedTree.h: Added.
3513         (WebCore::AXIsolatedTree::treeIdentifier const):
3514         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
3515             To note: we don't mark the attribute map const because even though attributes don't change after initial creation,
3516             we may copy an existing node and replace specific values.
3517         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
3518         (WebCore::AXIsolatedTreeNode::create):
3519         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
3520         (WebCore::AXIsolatedTreeNode::setProperty):
3521         (WebCore::AXIsolatedTreeNode::doubleAttributeValue const):
3522         (WebCore::AXIsolatedTreeNode::unsignedAttributeValue const):
3523         (WebCore::AXIsolatedTreeNode::boolAttributeValue const):
3524         (WebCore::AXIsolatedTreeNode::stringAttributeValue const):
3525         (WebCore::AXIsolatedTreeNode::intAttributeValue const):
3526         * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
3527         * accessibility/mac/AXObjectCacheMac.mm:
3528         (WebCore::AXObjectCache::associateIsolatedTreeNode):
3529         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
3530         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3531         (-[WebAccessibilityObjectWrapperBase initWithAccessibilityObject:]):
3532         (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
3533         (-[WebAccessibilityObjectWrapperBase detach]):
3534         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
3535         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
3536         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
3537         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3538         (-[WebAccessibilityObjectWrapper role]):
3539         (-[WebAccessibilityObjectWrapper subrole]):
3540         (-[WebAccessibilityObjectWrapper roleDescription]):
3541         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3542         * dom/Document.cpp:
3543         (WebCore::Document::pageID const):
3544         * dom/Document.h:
3545
3546 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
3547
3548         Allow scrolling tree nodes to exist in a detached state
3549         https://bugs.webkit.org/show_bug.cgi?id=193754
3550
3551         Reviewed by Zalan Bujtas.
3552
3553         One of the (questionable?) design decisions of the scrolling tree is that the tree implementation
3554         is hidden behind the ScrollingCoordinator interface. That interface only allowed nodes to exist
3555         in a connected state; attachToStateTree() required a non-zero parent for any node that was not
3556         the root.
3557
3558         This makes it impossible to coordinate the hookup of the scrolling tree across frame boundaries;
3559         the scrolling tree has to have been fully constructed in ancestor frames before subframe nodes
3560         can be attached. This is a significant difference from compositing, where a subframe can create
3561         GraphicsLayers which don't have to be parented right away, and actually get parented later via
3562         a compositing update in the parent frame.
3563
3564         We want to be able to hook up the scrolling tree via the same code paths as GraphicsLayer
3565         connection (anything else is too confusing). So we need to be able to instantiate scrolling
3566         tree nodes in a disconnected state, and attach them later.
3567
3568         To achieve this, add the notion of "unparented" nodes to ScrollingCoordinator and the ScrollingStateTree.
3569         Allow clients to create unparented nodes, which can be attached later. ScrollingCoordinator stores
3570         the roots of unparented subtrees in an owning HashMap. Nodes in unparented trees are still referenced
3571         by m_stateNodeMap, so it's possible to find them and set state on them.
3572
3573         Clean up the ScrollingCoordinator interface to remove "state tree" terminology; the state vs. scrolling tree
3574         is really an implementation detail.
3575
3576         This also removes the special-casing of ScrollingNodeType::Subframe nodes which ScrollingStateTree stored
3577         in m_orphanedSubframeNodes; now the unparenting is controlled by the client.
3578
3579         Currently no code creates unparented nodes so there is no behavior change.
3580
3581         * dom/Document.cpp:
3582         (WebCore::Document::setPageCacheState):
3583         * page/scrolling/AsyncScrollingCoordinator.cpp:
3584         (WebCore::AsyncScrollingCoordinator::createNode):
3585         (WebCore::AsyncScrollingCoordinator::insertNode):
3586         (WebCore::AsyncScrollingCoordinator::unparentNode):
3587         (WebCore::AsyncScrollingCoordinator::unparentChildrenAndDestroyNode):
3588         (WebCore::AsyncScrollingCoordinator::detachAndDestroySubtree):
3589         (WebCore::AsyncScrollingCoordinator::clearAllNodes):
3590         (WebCore::AsyncScrollingCoordinator::parentOfNode const):
3591         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
3592         (WebCore::AsyncScrollingCoordinator::attachToStateTree): Deleted.
3593         (WebCore::AsyncScrollingCoordinator::detachFromStateTree): Deleted.
3594         (WebCore::AsyncScrollingCoordinator::clearStateTree): Deleted.
3595         * page/scrolling/AsyncScrollingCoordinator.h:
3596         * page/scrolling/ScrollingCoordinator.h:
3597         (WebCore::ScrollingCoordinator::handleWheelEvent):
3598         (WebCore::ScrollingCoordinator::createNode):
3599         (WebCore::ScrollingCoordinator::insertNode):
3600         (WebCore::ScrollingCoordinator::unparentNode):
3601         (WebCore::ScrollingCoordinator::unparentChildrenAndDestroyNode):
3602         (WebCore::ScrollingCoordinator::detachAndDestroySubtree):
3603         (WebCore::ScrollingCoordinator::clearAllNodes):
3604         (WebCore::ScrollingCoordinator::parentOfNode const):
3605         (WebCore::ScrollingCoordinator::childrenOfNode const):
3606         (WebCore::ScrollingCoordinator::attachToStateTree): Deleted.
3607         (WebCore::ScrollingCoordinator::detachFromStateTree): Deleted.
3608         (WebCore::ScrollingCoordinator::clearStateTree): Deleted.
3609         * page/scrolling/ScrollingStateNode.cpp:
3610         (WebCore::ScrollingStateNode::removeFromParent):
3611         (WebCore::ScrollingStateNode::removeChild):
3612         * page/scrolling/ScrollingStateNode.h:
3613         * page/scrolling/ScrollingStateTree.cpp:
3614         (WebCore::ScrollingStateTree::ScrollingStateTree):
3615         (WebCore::ScrollingStateTree::createUnparentedNode):
3616         (WebCore::ScrollingStateTree::insertNode):
3617         (WebCore::ScrollingStateTree::unparentNode):
3618         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode):
3619         (WebCore::ScrollingStateTree::detachAndDestroySubtree):
3620         (WebCore::ScrollingStateTree::clear):
3621         (WebCore::ScrollingStateTree::commit):
3622         (WebCore::ScrollingStateTree::removeNodeAndAllDescendants):
3623         (WebCore::ScrollingStateTree::recursiveNodeWillBeRemoved):
3624         (showScrollingStateTree):
3625         (WebCore::ScrollingStateTree::attachNode): Deleted.
3626         (WebCore::ScrollingStateTree::detachNode): Deleted.
3627         * page/scrolling/ScrollingStateTree.h:
3628         (WebCore::ScrollingStateTree::nodeCount const):
3629         * rendering/RenderLayerBacking.cpp:
3630         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3631         * rendering/RenderLayerCompositor.cpp:
3632         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
3633         (WebCore::RenderLayerCompositor::attachScrollingNode):
3634
3635 2019-01-26  Devin Rousso  <drousso@apple.com>
3636
3637         Web Inspector: provide a way to edit the user agent of a remote target
3638         https://bugs.webkit.org/show_bug.cgi?id=193862
3639         <rdar://problem/47359292>
3640
3641         Reviewed by Joseph Pecoraro.
3642
3643         Test: inspector/page/overrideUserAgent.html
3644
3645         * loader/FrameLoader.cpp:
3646         (WebCore::FrameLoader::userAgent const):
3647         (WebCore::FrameLoader::userAgentForJavaScript const):
3648
3649         * inspector/InspectorInstrumentation.h:
3650         (WebCore::InspectorInstrumentation::applyUserAgentOverride): Added.
3651         * inspector/InspectorInstrumentation.cpp:
3652         (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl): Added.
3653
3654         * inspector/agents/InspectorPageAgent.h:
3655         * inspector/agents/InspectorPageAgent.cpp:
3656         (WebCore::InspectorPageAgent::disable):
3657         (WebCore::InspectorPageAgent::overrideUserAgent): Added.
3658         (WebCore::InspectorPageAgent::applyUserAgentOverride): Added.
3659
3660 2019-01-26  Zalan Bujtas  <zalan@apple.com>
3661
3662         [LFC] The initial values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
3663         https://bugs.webkit.org/show_bug.cgi?id=193867
3664
3665         Reviewed by Antti Koivisto.
3666
3667         The initial content top/bottom value is the border top + padding top.
3668
3669         This is only a problem when the box has float children only. While computing the height using the bottom-most float,
3670         we call "top = std::min(floatTop, top)". With 0 initial top value, this returns an incorrect result when the box
3671         has (top)border/padding.
3672
3673         Test: fast/block/block-only/abs-pos-with-border-padding-and-float-child.html
3674
3675         * layout/FormattingContextGeometry.cpp:
3676         (WebCore::Layout::contentHeightForFormattingContextRoot):
3677
3678 2019-01-26  Zalan Bujtas  <zalan@apple.com>
3679
3680         [LFC][BFC] Ignore last inflow child's collapsed through margin after when computing containing block's height.
3681         https://bugs.webkit.org/show_bug.cgi?id=193865
3682
3683         Reviewed by Antti Koivisto.
3684
3685         Height computation ->
3686         // 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible'
3687         // ...the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom
3688         // margin does not collapse with the element's bottom margin
3689
3690         <div style="border: 1px solid green">
3691           <div style="margin-top: 100px;"></div>
3692         </div>
3693
3694         When the child vertical margins collapse through (margin-top = margin-bottom = 100px), the bottom edge of the bottom margin is
3695         the same as the bottom edge of the top margin which is alredy taken into use while positioning so technically the bottom margin value should be ignored. 
3696
3697         Test: fast/block/margin-collapse/collapsed-through-child-simple.html
3698
3699         * layout/MarginTypes.h:
3700         (WebCore::Layout::UsedVerticalMargin::isCollapsedThrough const):
3701         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3702         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3703         * layout/displaytree/DisplayBox.h:
3704         (WebCore::Display::Box::hasCollapsedThroughMargin const):
3705
3706 2019-01-26  Zalan Bujtas  <zalan@apple.com>
3707
3708         [LFC][BFC][MarginCollapsing] marginAfterCollapsesWithParentMarginAfter/marginAfterCollapsesWithLastInFlowChildMarginAfter should check for border/padding after values.
3709         https://bugs.webkit.org/show_bug.cgi?id=193864
3710
3711         Reviewed by Antti Koivisto.
3712
3713         * layout/blockformatting/BlockMarginCollapse.cpp:
3714         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
3715         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
3716
3717 2019-01-26  Zalan Bujtas  <zalan@apple.com>
3718
3719         [LFC] Box::nextInFlowOrFloatingSibling() should always return sibling floats as well.
3720         https://bugs.webkit.org/show_bug.cgi?id=193855
3721
3722         Reviewed by Antti Koivisto.
3723
3724         Use iterative algorithm to find next/previous siblings.
3725
3726         * layout/layouttree/LayoutBox.cpp:
3727         (WebCore::Layout::Box::nextInFlowOrFloatingSibling const):
3728
3729 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
3730
3731         Need a mechanism to override navigator.userAgent
3732         https://bugs.webkit.org/show_bug.cgi?id=193762
3733         <rdar://problem/47504939>
3734
3735         Reviewed by Brent Fulgham.
3736
3737         Added the ability to specify user agent string just for navigator.userAgent via DocumentLoader.
3738
3739         * loader/DocumentLoader.h:
3740         (WebCore::DocumentLoader::setCustomJavaScriptUserAgent):
3741         (WebCore::DocumentLoader::customJavaScriptUserAgent const):
3742         * loader/FrameLoader.cpp:
3743         (WebCore::FrameLoader::userAgentForJavaScript const):
3744         * loader/FrameLoader.h:
3745         * page/Navigator.cpp:
3746         (WebCore::Navigator::userAgent const):
3747
3748 2019-01-25  Devin Rousso  <drousso@apple.com>
3749
3750         Web Inspector: provide a way to edit page settings on a remote target
3751         https://bugs.webkit.org/show_bug.cgi?id=193813
3752         <rdar://problem/47359510>
3753
3754         Reviewed by Joseph Pecoraro.
3755
3756         Test: inspector/page/overrideSetting.html
3757
3758         * page/Settings.yaml:
3759         * Scripts/GenerateSettings.rb:
3760         * Scripts/SettingsTemplates/Settings.cpp.erb:
3761         * Scripts/SettingsTemplates/Settings.h.erb:
3762         Add support for an `inspectorOverride` boolean value for each setting that will take
3763         precedence over the actual `Setting`'s value when set.
3764
3765         * inspector/agents/InspectorPageAgent.h:
3766         * inspector/agents/InspectorPageAgent.cpp:
3767         (WebCore::InspectorPageAgent::disable):
3768         (WebCore::InspectorPageAgent::overrideSetting): Added.
3769
3770         * inspector/InspectorFrontendHost.idl:
3771         * inspector/InspectorFrontendHost.h:
3772         * inspector/InspectorFrontendHost.cpp:
3773         (WebCore::InspectorFrontendHost::isRemote const): Added.
3774         * inspector/InspectorFrontendClient.h:
3775         (WebCore::InspectorFrontendClient::isRemote const): Added.
3776         * inspector/InspectorFrontendClientLocal.h:
3777         (WebCore::InspectorFrontendClientLocal::isRemote const): Added.
3778
3779 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3780
3781         Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element
3782         https://bugs.webkit.org/show_bug.cgi?id=193843
3783
3784         Reviewed by Zalan Bujtas.
3785
3786         * dom/Document.cpp:
3787         (WebCore::Document::updateMainArticleElementAfterLayout):
3788
3789         This function currently does a bit of wasted work after every layout, on clients that don't listen to the
3790         "significant rendered text" layout milestone and therefore don't need to guess the main article element. Simply
3791         don't bother keeping the main article element up to date in this scenario by bailing from
3792         FrameView::updateHasReachedSignificantRenderedTextThreshold if the client doesn't care about the significant
3793         rendered text milestone.
3794
3795         * page/FrameView.cpp:
3796         (WebCore::FrameView::updateHasReachedSignificantRenderedTextThreshold):
3797
3798 2019-01-25  Jer Noble  <jer.noble@apple.com>
3799
3800         <video> elements not in the DOM should be allowed to AirPlay
3801         https://bugs.webkit.org/show_bug.cgi?id=193837
3802         <rdar://42559491>
3803
3804         Reviewed by Eric Carlson.
3805
3806         Test: media/airplay-allows-buffering.html
3807
3808         Some websites will switch between <video> elements backed by MSE to one backed by
3809         a media file in order to implement an AirPlay control. But when a <video> element is
3810         removed from the DOM and paused, further buffering is blocked. For some ports (namely
3811         Cocoa ones), this keeps AirPlay from engaging. Relax this buffering restriction for
3812         elements who have been asked to play wirelessly, but whose wireless playback has not
3813         started yet.
3814
3815         * html/MediaElementSession.cpp:
3816         (WebCore::MediaElementSession::dataBufferingPermitted const):
3817         (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
3818
3819 2019-01-25  Keith Rollin  <krollin@apple.com>
3820
3821         Update Xcode projects with "Check .xcfilelists" build phase
3822         https://bugs.webkit.org/show_bug.cgi?id=193790
3823         <rdar://problem/47201374>
3824
3825         Reviewed by Alex Christensen.
3826
3827         Support for XCBuild includes specifying inputs and outputs to various
3828         Run Script build phases. These inputs and outputs are specified as
3829         .xcfilelist files. Once created, these .xcfilelist files need to be
3830         kept up-to-date. In order to check that they are up-to-date or not,
3831         add an Xcode build step that invokes an external script that performs
3832         the checking. If the .xcfilelists are found to be out-of-date, update
3833         them, halt the build, and instruct the developer to restart the build
3834         with up-to-date files.
3835
3836         At this time, the checking and regenerating is performed only if the
3837         WK_ENABLE_CHECK_XCFILELISTS environment variable is set to 1. People
3838         who want to use this facility can set this variable and test out the
3839         checking/regenerating. Once it seems like there are no egregious
3840         issues that upset a developer's workflow, we'll unconditionally enable
3841         this facility.
3842
3843         No new tests since there should be no observable behavior difference.
3844
3845         * Scripts/check-xcfilelists.sh: Added.
3846         * WebCore.xcodeproj/project.pbxproj:
3847
3848 2019-01-25  Joseph Pecoraro  <pecoraro@apple.com>
3849
3850         Web Inspector: Exclude Debugger Threads from CPU Usage values in Web Inspector
3851         https://bugs.webkit.org/show_bug.cgi?id=193796
3852         <rdar://problem/47532910>
3853
3854         Reviewed by Devin Rousso.
3855
3856         * page/ResourceUsageData.h:
3857         * inspector/agents/InspectorCPUProfilerAgent.cpp:
3858         (WebCore::InspectorCPUProfilerAgent::collectSample):
3859         Show the CPU usage without debugger threads in the Web Inspector's timeline.
3860
3861         * page/ResourceUsageThread.h:
3862         * page/cocoa/ResourceUsageThreadCocoa.mm:
3863         (WebCore::ResourceUsageThread::platformSaveStateBeforeStarting):
3864         For OS(DARWIN) ports, when starting to observe resource usage,
3865         we grab the mach_port_t of SamplingProfiler on the main thread
3866         in a thread safe way. For our purposes (Web Inspector timelines),
3867         this will be good enough to identify the SamplingProfiler thread
3868         during timeline recording. The SamplingProfiler thread won't change
3869         during a timeline recording and recording start/stops will never
3870         miss the SamplingProfiler changing.
3871
3872         (WebCore::filterThreads):
3873         (WebCore::threadSendRights):
3874         (WebCore::threadSendRightsExcludingDebuggerThreads):
3875         (WebCore::cpuUsage):
3876         (WebCore::ResourceUsageThread::platformCollectCPUData):
3877         Calculate CPU usage twice, the second time excluding some threads.
3878
3879         * page/linux/ResourceUsageThreadLinux.cpp:
3880         (WebCore::ResourceUsageThread::platformSaveStateBeforeStarting):
3881         (WebCore::ResourceUsageThread::platformCollectCPUData):
3882         Stubs for linux ports.
3883
3884 2019-01-25  Zalan Bujtas  <zalan@apple.com>
3885
3886         Remove FrameView::m_significantRenderedTextMilestonePending
3887         https://bugs.webkit.org/show_bug.cgi?id=193842
3888
3889         Reviewed by Wenson Hsieh.
3890
3891         Currently we keep processing the incoming text content until after the "SignificantRenderedTextMilestone" has been reached.
3892         We can actually stop doing it right when the text content is above the threshold (regardless of whether all the conditions are met for the milestone).
3893         This patch also ensures that we don't update Document::m_mainArticleElement once the threshold is reached.
3894
3895         * page/FrameView.cpp:
3896         (WebCore::FrameView::resetLayoutMilestones):
3897         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
3898         (WebCore::FrameView::hasReachedSignificantRenderedTextThreashold):
3899         (WebCore::FrameView::qualifiesAsSignificantRenderedText const):
3900         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
3901         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded): Deleted.
3902         * page/FrameView.h:
3903
3904 2019-01-25  Keith Rollin  <krollin@apple.com>
3905
3906         Update Xcode projects with "Apply Configuration to XCFileLists" build target
3907         https://bugs.webkit.org/show_bug.cgi?id=193781
3908         <rdar://problem/47201153>
3909
3910         Reviewed by Alex Christensen.
3911
3912         Part of generating the .xcfilelists used as part of adopting XCBuild
3913         includes running `make DerivedSources.make` from a standalone script.
3914         It’s important for this invocation to have the same environment as
3915         when the actual build invokes `make DerivedSources.make`. If the
3916         environments are different, then the two invocations will provide
3917         different results. In order to get the same environment in the
3918         standalone script, have the script launch xcodebuild targeting the
3919         "Apply Configuration to XCFileLists" build target, which will then
3920         re-invoke our standalone script. The script is now running again, this
3921         time in an environment with all workspace, project, target, xcconfig
3922         and other environment variables established.
3923
3924         The "Apply Configuration to XCFileLists" build target accomplishes
3925         this task via a small embedded shell script that consists only of:
3926
3927             eval "${WK_SUBLAUNCH_SCRIPT_PARAMETERS[@]}"
3928
3929         The process that invokes "Apply Configuration to XCFileLists" first
3930         sets WK_SUBLAUNCH_SCRIPT_PARAMETERS to an array of commands to be
3931         evaluated and exports it into the shell environment. When xcodebuild
3932         is invoked, it inherits the value of this variable and can `eval` the
3933         contents of that variable. Our external standalone script can then set
3934         WK_SUBLAUNCH_SCRIPT_PARAMETERS to the path to itself, along with a set
3935         of command-line parameters needed to restart itself in the appropriate
3936         state.
3937
3938         No new tests since there should be no observable behavior difference.
3939
3940         * WebCore.xcodeproj/project.pbxproj:
3941
3942 2019-01-25  Keith Rollin  <krollin@apple.com>