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