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