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