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