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