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