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