Support boundingBoxRect and elementRect in AXIsolatedObject.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-11-21  Andres Gonzalez  <andresg_22@apple.com>
2
3         Support boundingBoxRect and elementRect in AXIsolatedObject.
4         https://bugs.webkit.org/show_bug.cgi?id=204431
5
6         Reviewed by Chris Fleizach.
7
8         - Implementation of boundingBoxRect and elementRect in AXIsolatedObject.
9         - Templatized rectAttributeValue generalize retrieval of cached rects for different types of rects.
10
11         * accessibility/AccessibilityObject.h:
12         * accessibility/AccessibilityObjectInterface.h:
13         (WebCore::AXCoreObject::pixelSnappedBoundingBoxRect const): Moved from AccessibilityObject.
14         (WebCore::AXCoreObject::size const): Moved from AccessibilityObject.
15         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
16         (WebCore::AXIsolatedObject::initializeAttributeData): Caching of boundingBox and element rects.
17         (WebCore::AXIsolatedObject::rectAttributeValue const): Templatized version.
18         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
19
20 2019-11-20  Conrad Shultz  <conrad_shultz@apple.com>
21
22         Crash at com.apple.WebCore: -[WebRevealHighlight revealContext:drawRectsForItem:]
23         https://bugs.webkit.org/show_bug.cgi?id=204434
24
25         Reviewed by Megan Gardner.
26
27         _attributedString was not retained, leading to a potential use-after-dealloc. Fix
28         this by wrapping it in a RetainPtr. While we're here, remove explicit ivars and
29         property synthesis and copy the string during assignment.
30
31         Reveal functionality is currently not testable.
32
33         * editing/cocoa/DictionaryLookup.mm:
34         (SOFT_LINK_CLASS_OPTIONAL):
35         (-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):
36
37 2019-11-20  Fujii Hironori  <Hironori.Fujii@sony.com>
38
39         [MSVC] error C2039: 'weakPtrFactory': is not a member of 'WebCore::DocumentStorageAccess::requestStorageAccess::<lambda_3f2cfd7704f93d8fe19d5b5f064f8add>'
40         https://bugs.webkit.org/show_bug.cgi?id=204437
41
42         Unreviewed build fix.
43
44         MSVC has a bug of a outer lambda's captured 'this' can't be used as
45         a lambda capture initializer of a inner lambda.
46
47         * dom/DocumentStorageAccess.cpp:
48         (WebCore::DocumentStorageAccess::requestStorageAccess): Replaced '*this' in the lambda capture initializer with '*weakThis'.
49
50 2019-11-20  Simon Fraser  <simon.fraser@apple.com>
51
52         getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
53         https://bugs.webkit.org/show_bug.cgi?id=15562
54
55         Reviewed by Antti Koivisto.
56
57         The computed value of z-index should be the specified value, but Style::Adjuster::adjust() set z-index
58         to auto on non-positioned elements, so we reported the incorrect computed value.
59
60         Fix by storing the specified value in RenderStyle as "zIndex", and the used value as "effectiveZIndex", and
61         converting all rendering code to use the "effective" variants. getComputedStyle reads "zIndex".
62
63         Style::Adjuster::adjust() copies zIndex to effectiveZIndex for positioned elements.
64
65         Tests: fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html
66
67         * animation/KeyframeEffect.cpp:
68         (WebCore::KeyframeEffect::apply):
69         * css/CSSComputedStyleDeclaration.cpp:
70         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
71         * css/CSSProperties.json:
72         * html/HTMLInputElement.cpp:
73         (WebCore::HTMLInputElement::createInnerTextStyle):
74         * page/animation/CSSPropertyAnimation.cpp:
75         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
76         * page/animation/CompositeAnimation.cpp:
77         (WebCore::CompositeAnimation::animate):
78         * rendering/RenderBox.cpp:
79         (WebCore::isCandidateForOpaquenessTest):
80         * rendering/RenderBox.h:
81         * rendering/RenderElement.cpp:
82         (WebCore::RenderElement::styleWillChange):
83         * rendering/RenderFullScreen.cpp:
84         (WebCore::createFullScreenStyle):
85         * rendering/RenderLayer.cpp:
86         (WebCore::canCreateStackingContext):
87         (WebCore::RenderLayer::shouldBeCSSStackingContext const):
88         (WebCore::RenderLayer::calculateClipRects const):
89         * rendering/RenderLayer.h:
90         * rendering/RenderLayerCompositor.cpp:
91         (WebCore::RenderLayerCompositor::logLayerInfo):
92         * rendering/RenderLayerModelObject.cpp:
93         (WebCore::RenderLayerModelObject::styleWillChange):
94         * rendering/RenderTreeAsText.cpp:
95         (WebCore::RenderTreeAsText::writeRenderObject):
96         * rendering/style/RenderStyle.cpp:
97         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
98         * rendering/style/RenderStyle.h:
99         (WebCore::RenderStyle::specifiedZIndex const):
100         (WebCore::RenderStyle::hasAutoSpecifiedZIndex const):
101         (WebCore::RenderStyle::setSpecifiedZIndex):
102         (WebCore::RenderStyle::setHasAutoSpecifiedZIndex):
103         (WebCore::RenderStyle::usedZIndex const):
104         (WebCore::RenderStyle::hasAutoUsedZIndex const):
105         (WebCore::RenderStyle::setUsedZIndex):
106         (WebCore::RenderStyle::setHasAutoUsedZIndex):
107         (WebCore::RenderStyle::hasAutoZIndex const): Deleted.
108         (WebCore::RenderStyle::setHasAutoZIndex): Deleted.
109         (WebCore::RenderStyle::zIndex const): Deleted.
110         (WebCore::RenderStyle::setZIndex): Deleted.
111         * rendering/style/StyleBoxData.cpp:
112         (WebCore::StyleBoxData::StyleBoxData):
113         (WebCore::StyleBoxData::operator== const):
114         * rendering/style/StyleBoxData.h:
115         (WebCore::StyleBoxData::specifiedZIndex const):
116         (WebCore::StyleBoxData::hasAutoSpecifiedZIndex const):
117         (WebCore::StyleBoxData::usedZIndex const):
118         (WebCore::StyleBoxData::hasAutoUsedZIndex const):
119         (WebCore::StyleBoxData::zIndex const): Deleted.
120         (WebCore::StyleBoxData::hasAutoZIndex const): Deleted.
121         * style/StyleAdjuster.cpp:
122         (WebCore::Style::Adjuster::adjust const):
123
124 2019-11-19  Ryosuke Niwa  <rniwa@webkit.org>
125
126         MicrotaskQueue should be accessed via EventLoop
127         https://bugs.webkit.org/show_bug.cgi?id=204397
128
129         Reviewed by Antti Koivisto.
130
131         This patch refactors the existing code so that a microtask is always queued via EventLoopTaskGroup.
132         It preserves all other (broken) semantics and behavior like all origins sharing a single microtask queue.
133
134         The singleton MicrotaskQueue for the main thread has been moved from MicrotaskQueue::mainThreadQueue
135         to WindowEventLoop, and an instance of MicrotaskQueue for each worker has been moved from WorkerGlobalScope
136         to WorkerEventLoop.
137
138         * animation/DocumentTimeline.cpp:
139         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
140         * animation/WebAnimation.cpp:
141         (WebCore::WebAnimation::updateFinishedState):
142         * bindings/js/JSDOMGlobalObjectTask.cpp:
143         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
144         * bindings/js/JSDOMWindowBase.cpp:
145         (WebCore::JSDOMWindowBase::queueMicrotaskToEventLoop): Renamed from queueTaskToEventLoop.
146         * bindings/js/JSDOMWindowBase.h:
147         * bindings/js/JSExecState.cpp:
148         (WebCore::JSExecState::didLeaveScriptContext):
149         * bindings/js/JSRemoteDOMWindowBase.cpp:
150         * bindings/js/JSWorkerGlobalScopeBase.cpp:
151         (WebCore::JSWorkerGlobalScopeBase::queueMicrotaskToEventLoop): Renamed from queueTaskToEventLoop.
152         * bindings/js/JSWorkerGlobalScopeBase.h:
153         * bindings/js/JSWorkletGlobalScopeBase.cpp:
154         * bindings/js/JSWorkletGlobalScopeBase.h:
155         * dom/CustomElementReactionQueue.cpp:
156         (WebCore::BackupElementQueueMicrotask): Deleted.
157         (WebCore::CustomElementReactionQueue::enqueueElementOnAppropriateElementQueue):
158         (WebCore::CustomElementReactionQueue::ensureBackupQueue):
159         * dom/CustomElementReactionQueue.h:
160         * dom/Document.cpp:
161         (WebCore::Document::finishedParsing):
162         * dom/DocumentStorageAccess.cpp:
163         (WebCore::DocumentStorageAccess::requestStorageAccess):
164         * dom/EventLoop.cpp:
165         (WebCore::EventLoop::queueMicrotask): Added.
166         (WebCore::EventLoop::performMicrotaskCheckpoint): Added.
167         (WebCore::EventLoopTaskGroup::queueMicrotaskCallback): Added.
168         (WebCore::EventLoopTaskGroup::queueMicrotask): Added.
169         (WebCore::EventLoopTaskGroup::performMicrotaskCheckpoint): Added.
170         * dom/EventLoop.h:
171         (WebCore::EventLoopTaskGroup::microtaskQueue):
172         * dom/Microtasks.cpp:
173         (WebCore::MicrotaskQueue::mainThreadQueue): Deleted.
174         (WebCore::MicrotaskQueue::contextQueue): Deleted.
175         * dom/Microtasks.h:
176         * dom/MutationObserver.cpp:
177         (WebCore::MutationObserverMicrotask): Deleted.
178         (WebCore::MutationObserver::queueMutationObserverCompoundMicrotask): Made this a member function
179         so that it can call notifyMutationObservers in its lambda.
180         (WebCore::MutationObserver::enqueueMutationRecord):
181         (WebCore::MutationObserver::enqueueSlotChangeEvent):
182         (WebCore::MutationObserver::setHasTransientRegistration):
183         * dom/MutationObserver.h:
184         * dom/MutationObserverRegistration.cpp:
185         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
186         * dom/WindowEventLoop.cpp:
187         (WebCore::WindowEventLoop::microtaskQueue):
188         * dom/WindowEventLoop.h:
189         * html/parser/HTMLDocumentParser.cpp:
190         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
191         * html/parser/HTMLScriptRunner.cpp:
192         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
193         (WebCore::HTMLScriptRunner::runScript):
194         * inspector/agents/InspectorCanvasAgent.cpp:
195         (WebCore::InspectorCanvasAgent::recordCanvasAction):
196         * testing/Internals.cpp:
197         (WebCore::Internals::queueMicroTask):
198         * workers/WorkerEventLoop.cpp:
199         (WebCore::WorkerEventLoop::~WorkerEventLoop):
200         (WebCore::WorkerEventLoop::microtaskQueue):
201         (WebCore::WorkerEventLoop::clearMicrotaskQueue):
202         * workers/WorkerEventLoop.h:
203         * workers/WorkerGlobalScope.cpp:
204         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
205         (WebCore::WorkerGlobalScope::prepareForTermination):
206         * workers/WorkerGlobalScope.h:
207         (WebCore::WorkerGlobalScope::microtaskQueue const): Deleted.
208
209 2019-11-20  Wenson Hsieh  <wenson_hsieh@apple.com>
210
211         Unreviewed, remove an unnecessary null check after r252561
212         https://bugs.webkit.org/show_bug.cgi?id=204287
213
214         Address post-review feedback.
215
216         * Modules/async-clipboard/Clipboard.cpp:
217         (WebCore::Clipboard::writeText):
218
219 2019-11-20  ChangSeok Oh  <changseok@webkit.org>
220
221         [GTK] Add ANGLE backend to GTK port
222         https://bugs.webkit.org/show_bug.cgi?id=199060
223
224         Reviewed by Žan Doberšek.
225
226         This change aims to bring ANGLE support for WebGL to GTK port. The port
227         wants to have a gl context for texture mapper and a gles/egl context for webgl
228         simultaneously, we adopt the readPixel-copyToTexture approach for now because
229         sharing textures between the two different contextes is not a feasible direction.
230         Also, to avoid conflicts between gl and gles calls, we use non-prototype functions
231         of ANGLE for WebGL context (i.e., GraphicsContext3D). Although many combinations
232         of graphic configurations exist, only default configuration (Nicosia layers
233         running on ANGLE + GLX is supported. Other combinations like ANGLE + GLES or WPE
234         will be covered by following patches.
235
236         No new tests since no functionality changed.
237
238         * Headers.cmake:
239         * PlatformGTK.cmake:
240         * SourcesGTK.txt:
241         * platform/TextureMapper.cmake:
242         * platform/graphics/ANGLEWebKitBridge.h:
243         * platform/graphics/GLContext.cpp:
244         * platform/graphics/GLContext.h:
245         * platform/graphics/GraphicsContext3D.h:
246         * platform/graphics/OpenGLShims.cpp:
247         (WebCore::initializeOpenGLShims):
248         * platform/graphics/OpenGLShims.h:
249         * platform/graphics/PlatformDisplay.cpp:
250         * platform/graphics/angle/GraphicsContext3DANGLE.cpp:
251         (WebCore::GraphicsContext3D::reshapeFBOs):
252         (WebCore::GraphicsContext3D::prepareTexture):
253         * platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.cpp: Added.
254         (Nicosia::GC3DANGLELayer::ANGLEContext::errorString):
255         (Nicosia::GC3DANGLELayer::ANGLEContext::lastErrorString):
256         (Nicosia::GC3DANGLELayer::ANGLEContext::createContext):
257         (Nicosia::GC3DANGLELayer::ANGLEContext::ANGLEContext):
258         (Nicosia::GC3DANGLELayer::ANGLEContext::~ANGLEContext):
259         (Nicosia::GC3DANGLELayer::ANGLEContext::makeContextCurrent):
260         (Nicosia::GC3DANGLELayer::ANGLEContext::platformContext):
261         (Nicosia::GC3DANGLELayer::GC3DANGLELayer):
262         (Nicosia::GC3DANGLELayer::~GC3DANGLELayer):
263         (Nicosia::GC3DANGLELayer::makeContextCurrent):
264         (Nicosia::GC3DANGLELayer::platformContext):
265         * platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.h: Copied from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h.
266         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
267         (Nicosia::GC3DLayer::GC3DLayer):
268         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
269         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h:
270         * platform/graphics/texmap/BitmapTextureGL.cpp:
271         (WebCore::BitmapTextureGL::setPendingContents):
272         (WebCore::BitmapTextureGL::updatePendingContents):
273         * platform/graphics/texmap/BitmapTextureGL.h:
274         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
275         (WebCore::GraphicsContext3D::create):
276         (WebCore::GraphicsContext3D::GraphicsContext3D):
277         (WebCore::GraphicsContext3D::~GraphicsContext3D):
278         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
279         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
280         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
281         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):
282
283 2019-11-20  Zalan Bujtas  <zalan@apple.com>
284
285         Flexbox sizing logic triggers full repaint on the flex items.
286         https://bugs.webkit.org/show_bug.cgi?id=204380
287         <rdar://problem/57236404>
288
289         Reviewed by Simon Fraser.
290
291         RenderFlexibleBox::applyStretchAlignmentToChild explicitly sets the child renderer's height to 0 before issuing layout on it.
292         This confuses the child's repaint logic and could trigger unnecessary repaints on complete subtrees.
293
294         Many ::layout functions plant a LayoutRepainter stack object to track and report paint invalidations.
295         It works as long as the renderer's geometry change happens within the scope of this LayoutRepainter.
296         When the parent (RenderFlexibleBox) mutates the renderer's geometry, the LayoutRepainter object sees
297         this already mutated state as the initial state and will happily issue repaints even when the final
298         geometry remains the same.
299
300         This patch addresses the redundant repaint by pushing the height reset from the parent down to the child, inside the LayoutRepainter scope.
301
302         * rendering/RenderBlock.h: Restrict it to RenderBlock level for now. It might need to go all the way up to RenderBox.
303         (WebCore::RenderBlock::shouldResetChildLogicalHeightBeforeLayout const):
304         * rendering/RenderBlockFlow.cpp:
305         (WebCore::RenderBlockFlow::layoutBlock):
306         * rendering/RenderBlockFlow.h:
307         * rendering/RenderBox.cpp:
308         (WebCore::RenderBox::resetLogicalHeightBeforeLayoutIfNeeded):
309         * rendering/RenderBox.h:
310         (WebCore::RenderBox::shouldResetLogicalHeightBeforeLayout const):
311         * rendering/RenderDeprecatedFlexibleBox.cpp:
312         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
313         * rendering/RenderFlexibleBox.cpp:
314         (WebCore::RenderFlexibleBox::layoutBlock):
315         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
316         * rendering/RenderFlexibleBox.h:
317         * rendering/RenderGrid.cpp:
318         (WebCore::RenderGrid::layoutBlock):
319         * rendering/RenderGrid.h:
320         * rendering/RenderTable.cpp:
321         (WebCore::RenderTable::layout):
322         * rendering/RenderTable.h:
323
324 2019-11-20  Myles C. Maxfield  <mmaxfield@apple.com>
325
326         [Cocoa] Add ui-sans-serif as a sibling to ui-serif, ui-monospace, and ui-rounded
327         https://bugs.webkit.org/show_bug.cgi?id=204188
328
329         Reviewed by Simon Fraser.
330
331         As per https://github.com/w3c/csswg-drafts/commit/cd0059a32a74c5a48630ce7c77292642dac70fd9#diff-dd2d54c50c872e1e303daebd4794d642
332
333         Test: fast/text/design-system-ui-sans-serif.html
334
335         * platform/graphics/cocoa/FontCacheCoreText.cpp:
336         (WebCore::fontWithFamilySpecialCase):
337         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
338         (WebCore::matchSystemFontUse):
339
340 2019-11-19  Brian Burg  <bburg@apple.com>
341
342         [Cocoa] Add _WKRemoteWebInspectorViewController SPI to set diagnostic logging delegate
343         https://bugs.webkit.org/show_bug.cgi?id=204371
344
345         Reviewed by Devin Rousso.
346
347         Expose whether a diagnostic logging delegate has been configured for the frontend's WKWebView.
348         In a later patch, WI.DiagnosticController will start and stop recording as availability changes.
349
350         * inspector/InspectorFrontendClient.h:
351         (WebCore::InspectorFrontendClient::diagnosticLoggingAvailable):
352         * inspector/InspectorFrontendHost.cpp:
353         (WebCore::InspectorFrontendHost::diagnosticLoggingAvailable):
354         * inspector/InspectorFrontendHost.h:
355
356 2019-11-20  Simon Fraser  <simon.fraser@apple.com>
357
358         Turn off antialiasing when rendering with Ahem, for testing
359         https://bugs.webkit.org/show_bug.cgi?id=204197
360         <rdar://problem/57190712>
361
362         Reviewed by Myles C. Maxfield.
363
364         If the font family name matches "Ahem", turn off antialiasing when rendering text,
365         because many CSS tests assume that Ahem glyphs can be compared with positioned elements
366         in ref tests.
367
368         Since Ahem is a font only used for testing, I don't think this behavior needs to be
369         controlled by a setting.
370
371         * platform/graphics/Font.cpp:
372         (WebCore::Font::Font):
373         * platform/graphics/Font.h:
374         (WebCore::Font::allowsAntialiasing const):
375         * platform/graphics/cocoa/FontCascadeCocoa.mm:
376         (WebCore::FontCascade::drawGlyphs):
377         * platform/graphics/cocoa/FontCocoa.mm:
378         (WebCore::isAhemFont):
379         (WebCore::Font::platformInit):
380
381 2019-11-20  Zalan Bujtas  <zalan@apple.com>
382
383         [LFC][IFC] Cache InlinteTextItem width when possible
384         https://bugs.webkit.org/show_bug.cgi?id=204412
385         <rdar://problem/57359366>
386
387         Reviewed by Antti Koivisto.
388
389         This helps when subsequent inline layouts use the same set of InlineTextItems and they would
390         keep re-measuring them on each layout frame (e.g. view resize).
391
392         * layout/inlineformatting/InlineLineLayout.cpp:
393         (WebCore::Layout::inlineItemWidth):
394         * layout/inlineformatting/InlineTextItem.cpp:
395         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
396         (WebCore::Layout::InlineTextItem::createWhitespaceItem):
397         (WebCore::Layout::InlineTextItem::createNonWhitespaceItem):
398         (WebCore::Layout::InlineTextItem::createSegmentBreakItem):
399         (WebCore::Layout::InlineTextItem::InlineTextItem):
400         (WebCore::Layout::InlineTextItem::left const):
401         (WebCore::Layout::InlineTextItem::right const):
402         * layout/inlineformatting/InlineTextItem.h:
403         (WebCore::Layout::InlineTextItem::width const):
404         * layout/inlineformatting/text/TextUtil.h:
405         (WebCore::Layout::TextUtil::width):
406
407 2019-11-20  Jer Noble  <jer.noble@apple.com>
408
409         HTML5 audio .ended event not fired when app in background or phone screen is off
410         https://bugs.webkit.org/show_bug.cgi?id=173332
411         <rdar://problem/32757402>
412
413         Reviewed by Eric Carlson.
414
415         Test: media/audio-background-playback-playlist.html
416
417         In addition to the necessary WebKit part of this patch, there are behaviors which prevent
418         websites from enqueuing new playback while in the background. Namely, the platform will
419         prevent background playback from any application which is not currently the "Now Playing"
420         application, so in order to allow pages to switch sources, we must ensure we do not give
421         up "Now Playing" status. To do so, we will change the implementation of canProduceAudio()
422         to include any media element which previously could produce audio but currently has no
423         source.
424
425         Also, MediaElementSession::canShowControlsManager() will be modified to only check for
426         a RequireUserGestureToControlControlsManager restriction if the purpose passed in is
427         is "ControlsManager" and not "NowPlaying".
428
429         * html/HTMLMediaElement.cpp:
430         (WebCore::HTMLMediaElement::canProduceAudio const):
431         * html/MediaElementSession.cpp:
432         (WebCore::MediaElementSession::canShowControlsManager const):
433
434 2019-11-20  Simon Fraser  <simon.fraser@apple.com>
435
436         REGRESSION (r252161): box-shadow with inset and rounded borders is clipped
437         https://bugs.webkit.org/show_bug.cgi?id=204348
438
439         Reviewed by Zalan Bujtas.
440
441         r252161 introduced a bug for inset shadows where we passed the wrong rect to areaCastingShadowInHole().
442         Clean the code up a little, and make the xOffset stuff more similar to the outset shadow path.
443         We could still do a better job of pixel snapping here.
444
445         Test: fast/box-shadow/inset-box-shadow.html
446
447         * rendering/RenderBoxModelObject.cpp:
448         (WebCore::RenderBoxModelObject::paintBoxShadow):
449
450 2019-11-20  Zalan Bujtas  <zalan@apple.com>
451
452         [LFC][IFC] TextUtil::width should use FontCascade::widthForSimpleText when applicable
453         https://bugs.webkit.org/show_bug.cgi?id=204393
454         <rdar://problem/57347144>
455
456         Reviewed by Antti Koivisto.
457
458         This is one of reasons why simple line layout performs better than complex line layout.
459
460         * WebCore.xcodeproj/project.pbxproj:
461         * layout/blockformatting/BlockFormattingContext.cpp:
462         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
463         * layout/inlineformatting/InlineLine.cpp:
464         (WebCore::Layout::Line::Run::expand):
465         (WebCore::Layout::Line::appendTextContent):
466         * layout/inlineformatting/InlineTextItem.cpp:
467         (WebCore::Layout::moveToNextNonWhitespacePosition):
468         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
469         * layout/inlineformatting/text/TextUtil.cpp:
470         (WebCore::Layout::TextUtil::width):
471         (WebCore::Layout::TextUtil::fixedPitchWidth):
472         * layout/inlineformatting/text/TextUtil.h:
473         * layout/layouttree/LayoutBox.cpp:
474         (WebCore::Layout::Box::Box):
475         (WebCore::Layout::Box::setTextContext):
476         (WebCore::Layout::Box::hasTextContent const):
477         (WebCore::Layout::Box::textContext const):
478         (WebCore::Layout::Box::setTextContent): Deleted.
479         (WebCore::Layout::Box::textContent const): Deleted.
480         * layout/layouttree/LayoutBox.h:
481         * layout/layouttree/LayoutTreeBuilder.cpp:
482         (WebCore::Layout::canUseSimplifiedTextMeasuring):
483         (WebCore::Layout::TreeBuilder::createLayoutBox):
484         (WebCore::Layout::outputLayoutBox):
485
486 2019-11-19  Devin Rousso  <drousso@apple.com>
487
488         Web Inspector: DOM.highlightSelector should work for "div, div::before"
489         https://bugs.webkit.org/show_bug.cgi?id=204306
490
491         Reviewed by Brian Burg.
492
493         In r252436, the implementation of `DOM.highlightSelector` was changed from just calling
494         `document.querySelectorAll` to actually attempting to mimic what the CSS selector matching
495         engine does. Basically, this meant adding logic to walk the entire DOM tree and for each
496         node test each `CSSSelector` of the given `selector` string to see if it matched.
497
498         At the time, I had incorrectly assumed that once a selector was found that matched the
499         current node, it wouldn't need to be checked against ever again. This would be a fine
500         assumption if we didn't care about `:before`/`:after`, but since `DOM.highlightSelector`
501         also wants to match those, it is necessary to test every `CSSSelector` in case a later one
502         in the given `selector` string matches a pseudo-element (e.g. `div, div:before`).
503
504         The fix is simply to change `break` to `continue` and to ensure that every item in the
505         generated `NodeList` is unique (otherwise the overlay for a node may be drawn twice).
506
507         * inspector/agents/InspectorDOMAgent.cpp:
508         (WebCore::InspectorDOMAgent::highlightSelector):
509
510 2019-11-19  Youenn Fablet  <youenn@apple.com>
511
512         getUserMedia echoCancellation constraint has no affect
513         https://bugs.webkit.org/show_bug.cgi?id=179411
514
515         Reviewed by Eric Carlson.
516
517         Update implementation to properly report echoCancellation is supported and can take true or false.
518         Update CoreAudioCaptureSource to initialize its state in constructor from the audio unit.
519         This allows getUserMedia constraints to kick in after construction and update the source parameters.
520         Audio unit parameters will then be set when the source will be asked to produce data.
521
522         To enable testing, the mock audio is now adding a high frequency hum when echo cancellation is off.
523
524         Covered by updated test.
525
526         * Modules/mediastream/MediaStreamTrack.cpp:
527         (WebCore::capabilityStringVector):
528         (WebCore::capabilityBooleanVector):
529         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
530         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
531         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
532         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
533         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
534         * platform/mediastream/mac/MockAudioSharedUnit.mm:
535         (WebCore::MockAudioSharedUnit::reconfigure):
536         * platform/mock/MockRealtimeAudioSource.cpp:
537         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
538
539 2019-11-19  Peng Liu  <peng.liu6@apple.com>
540
541         Assertion failure in HTMLMediaElement::enterFullscreen()
542         https://bugs.webkit.org/show_bug.cgi?id=204376
543
544         Reviewed by Eric Carlson.
545
546         Test: media/video-set-presentation-mode-to-inline.html
547
548         * html/HTMLVideoElement.cpp:
549         (WebCore::HTMLVideoElement::setFullscreenMode):
550
551 2019-11-19  Sihui Liu  <sihui_liu@apple.com>
552
553         IndexedDB: pass along error of IDBBackingStore operations
554         https://bugs.webkit.org/show_bug.cgi?id=204381
555
556         Reviewed by Brady Eidson.
557
558         Covered by existing tests.
559
560         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
561         (WebCore::IDBServer::UniqueIDBDatabase::performCreateObjectStore):
562         (WebCore::IDBServer::UniqueIDBDatabase::performDeleteObjectStore):
563         (WebCore::IDBServer::UniqueIDBDatabase::performClearObjectStore):
564         (WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
565
566 2019-11-19  Sihui Liu  <sihui_liu@apple.com>
567
568         IndexedDB: overflow of KeyGenerator in MemoryIDBBackingStore
569         https://bugs.webkit.org/show_bug.cgi?id=204366
570
571         Reviewed by Brady Eidson.
572
573         Do not set KeyGenerator if it is key is bigger than 2^53.
574
575         Test: storage/indexeddb/key-generator-private.html
576
577         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
578         (WebCore::IDBServer::MemoryIDBBackingStore::maybeUpdateKeyGeneratorNumber):
579
580 2019-11-19  Sihui Liu  <sihui_liu@apple.com>
581
582         IndexedDB: update m_objectStoresByName after renaming object store
583         https://bugs.webkit.org/show_bug.cgi?id=204373
584
585         Reviewed by Brady Eidson.
586
587         Tests: storage/indexeddb/put-after-objectstore-rename-private.html
588                storage/indexeddb/put-after-objectstore-rename.html
589
590         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
591         (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):
592
593 2019-11-19  Sunny He  <sunny_he@apple.com>
594
595         Nullptr crash in Node::setTextContent via Document::setTitle if title element is removed before setTextContent call.
596         https://bugs.webkit.org/show_bug.cgi?id=204332
597
598         Reviewed by Ryosuke Niwa.
599
600         Test: fast/dom/Document/title-property-set-with-dom-event.html
601
602         * dom/Document.cpp:
603         (WebCore::Document::setTitle):
604
605 2019-11-19  Youenn Fablet  <youenn@apple.com>
606
607         Introduce a mock implementation of CoreAudioSharedUnit
608         https://bugs.webkit.org/show_bug.cgi?id=204290
609
610         Reviewed by Eric Carlson.
611
612         Introduce BaseAudioSharedUnit as a base class to CoreAudioSharedUnit.
613         Make CoreAudioCaptureSource use either CoreAudioSharedUnit singleton or an override.
614         Implement a MockAudioSharedUnit and use the override to implement mock audio capture sources.
615
616         Remove some code from CoreAudioCaptureSource related to reference data, which is not used currently.
617
618         Covered by existing tests.
619
620         * SourcesCocoa.txt:
621         * WebCore.xcodeproj/project.pbxproj:
622         * platform/mediastream/mac/BaseAudioSharedUnit.cpp: Added.
623         (WebCore::BaseAudioSharedUnit::addClient):
624         (WebCore::BaseAudioSharedUnit::removeClient):
625         (WebCore::BaseAudioSharedUnit::forEachClient const):
626         (WebCore::BaseAudioSharedUnit::clearClients):
627         (WebCore::BaseAudioSharedUnit::startProducingData):
628         (WebCore::BaseAudioSharedUnit::resume):
629         (WebCore::BaseAudioSharedUnit::prepareForNewCapture):
630         (WebCore::BaseAudioSharedUnit::captureFailed):
631         (WebCore::BaseAudioSharedUnit::stopProducingData):
632         (WebCore::BaseAudioSharedUnit::suspend):
633         (WebCore::BaseAudioSharedUnit::audioSamplesAvailable):
634         * platform/mediastream/mac/BaseAudioSharedUnit.h: Added.
635         (WebCore::BaseAudioSharedUnit::delaySamples):
636         (WebCore::BaseAudioSharedUnit::isSuspended const):
637         (WebCore::BaseAudioSharedUnit::volume const):
638         (WebCore::BaseAudioSharedUnit::sampleRate const):
639         (WebCore::BaseAudioSharedUnit::enableEchoCancellation const):
640         (WebCore::BaseAudioSharedUnit::setVolume):
641         (WebCore::BaseAudioSharedUnit::setSampleRate):
642         (WebCore::BaseAudioSharedUnit::setEnableEchoCancellation):
643         (WebCore::BaseAudioSharedUnit::sampleRateCapacities const):
644         (WebCore::BaseAudioSharedUnit::hasClients const):
645         (WebCore::BaseAudioSharedUnit::setSuspended):
646         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
647         (WebCore::CoreAudioSharedUnit::unit):
648         (WebCore::CoreAudioSharedUnit::CoreAudioSharedUnit):
649         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
650         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
651         (WebCore::CoreAudioSharedUnit::configureSpeakerProc):
652         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
653         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
654         (WebCore::initializeCoreAudioCaptureSource):
655         (WebCore::CoreAudioCaptureSource::create):
656         (WebCore::CoreAudioCaptureSource::createForTesting):
657         (WebCore::CoreAudioCaptureSource::unit):
658         (WebCore::CoreAudioCaptureSourceFactory::devicesChanged):
659         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
660         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
661         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
662         (WebCore::CoreAudioCaptureSource::startProducingData):
663         (WebCore::CoreAudioCaptureSource::stopProducingData):
664         (WebCore::CoreAudioCaptureSource::capabilities):
665         (WebCore::CoreAudioCaptureSource::settingsDidChange):
666         (WebCore::CoreAudioCaptureSource::scheduleReconfiguration):
667         (WebCore::CoreAudioCaptureSource::beginInterruption):
668         (WebCore::CoreAudioCaptureSource::endInterruption):
669         (WebCore::CoreAudioCaptureSource::interrupted const):
670         (WebCore::CoreAudioCaptureSource::delaySamples):
671         * platform/mediastream/mac/CoreAudioCaptureSource.h:
672         * platform/mediastream/mac/MockAudioSharedUnit.h: Added.
673         * platform/mediastream/mac/MockAudioSharedUnit.mm: Added.
674         (WebCore::MockRealtimeAudioSource::create):
675         (WebCore::MockAudioSharedUnit::singleton):
676         (WebCore::MockAudioSharedUnit::MockAudioSharedUnit):
677         (WebCore::MockAudioSharedUnit::hasAudioUnit const):
678         (WebCore::MockAudioSharedUnit::setCaptureDevice):
679         (WebCore::MockAudioSharedUnit::reconfigureAudioUnit):
680         (WebCore::MockAudioSharedUnit::cleanupAudioUnit):
681         (WebCore::MockAudioSharedUnit::startInternal):
682         (WebCore::MockAudioSharedUnit::stopInternal):
683         (WebCore::MockAudioSharedUnit::isProducingData const):
684         (WebCore::MockAudioSharedUnit::tick):
685         (WebCore::MockAudioSharedUnit::delaySamples):
686         (WebCore::MockAudioSharedUnit::reconfigure):
687         (WebCore::MockAudioSharedUnit::emitSampleBuffers):
688         (WebCore::MockAudioSharedUnit::render):
689         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h: Removed.
690
691 2019-11-19  Ross Kirsling  <ross.kirsling@sony.com>
692
693         Unreviewed non-unified build fixes.
694
695         * Modules/async-clipboard/ClipboardItem.cpp:
696         * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
697         * Modules/async-clipboard/ClipboardItemBindingsDataSource.h:
698         * Modules/async-clipboard/ClipboardItemDataSource.h:
699         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
700         * animation/WebAnimation.cpp:
701         * html/canvas/WebGLRenderingContextBase.cpp:
702         * xml/parser/XMLDocumentParserLibxml2.cpp:
703
704 2019-11-19  Brady Eidson  <beidson@apple.com>
705
706         Fix null deref when a DocumentLoader's policy decision is delivered.
707         <rdar://problem/54847830> and https://bugs.webkit.org/show_bug.cgi?id=204378
708
709         Reviewed by Ryosuke Niwa.
710
711         Definitely a required null check, as all async entries into DocumentLoader should (and most do!)
712         
713         No new tests, as no steps to reproduce are known.
714
715         * loader/DocumentLoader.cpp:
716         (WebCore::DocumentLoader::continueAfterContentPolicy): Null check m_frame.
717
718 2019-11-19  Yusuke Suzuki  <ysuzuki@apple.com>
719
720         Unreviewed, follow-up after r252642
721         https://bugs.webkit.org/show_bug.cgi?id=204346
722
723         * Modules/indexeddb/IDBActiveDOMObject.h:
724         * Modules/indexeddb/client/TransactionOperation.h:
725         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
726         (WebCore::IDBClient::TransactionOperation::perform):
727         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
728         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
729         (WebCore::IDBClient::TransactionOperation::doComplete):
730         * platform/Supplementable.h:
731         (WebCore::Supplementable::provideSupplement):
732         (WebCore::Supplementable::removeSupplement):
733         (WebCore::Supplementable::requireSupplement):
734         * platform/Timer.cpp:
735         (WebCore::TimerBase::~TimerBase):
736         (WebCore::TimerBase::start):
737         (WebCore::TimerBase::stop):
738         (WebCore::TimerBase::setNextFireTime):
739
740 2019-11-19  Daniel Bates  <dabates@apple.com>
741
742         ASSERTION FAILURE: useDownstream ? (result > vp) : (result < vp) in WebCore::nextSentenceBoundaryInDirection()
743         https://bugs.webkit.org/show_bug.cgi?id=204370
744         <rdar://problem/57332559>
745
746         Reviewed by Wenson Hsieh.
747
748         Only positions whose anchor nodes are in a document and in the same tree scope can be
749         compared using the operator< overload. Otherwise, the result is non-deterministic by
750         spec. <https://dom.spec.whatwg.org/#dom-node-comparedocumentposition> (13 November 2019):
751
752                 6. If node1 or node2 is null, or node1's root is not node2's root, then return the result of
753                 adding DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either
754                 DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, with the constraint that this is
755                 to be consistent, together.
756
757                 NOTE: Whether to return DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING is typically
758                 implemented via pointer comparison. In JavaScript implementations a cached Math.random()
759                 value can be used.
760
761         * dom/Node.cpp:
762         (WebCore::areNodesConnectedInSameTreeScope): Added; extracted from compareDocumentPosition().
763         (WebCore::Node::compareDocumentPosition): Write in terms of areNodesConnectedInSameTreeScope().
764         * dom/Node.h:
765         * editing/VisiblePosition.cpp:
766         (WebCore::areVisiblePositionsInSameTreeScope): Added. Write in terms of areNodesConnectedInSameTreeScope().
767         * editing/VisiblePosition.h:
768         * editing/VisibleUnits.cpp:
769         (WebCore::nextSentenceBoundaryInDirection): Update assert. We can only compare positions
770         if areVisiblePositionsInSameTreeScope() returns true.
771
772 2019-11-18  Ryosuke Niwa  <rniwa@webkit.org>
773
774         Rename AbstractEventLoop to EventLoop and move to its own cpp file
775         https://bugs.webkit.org/show_bug.cgi?id=204335
776
777         Reviewed by Antti Koivisto.
778
779         This patch renames AbstractEventLoop to EventLoop and move to its own cpp file since
780         r252607 consolidated the event loop implementations in WindowEventLoop and WorkerEventLoop.
781
782         * Modules/cache/DOMCache.cpp:
783         * Modules/cache/DOMCacheStorage.cpp:
784         * Modules/encryptedmedia/MediaKeySession.cpp:
785         * Modules/encryptedmedia/MediaKeys.cpp:
786         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
787         * Sources.txt:
788         * WebCore.xcodeproj/project.pbxproj:
789         * animation/WebAnimation.cpp:
790         * bindings/js/JSDOMPromiseDeferred.h:
791         * css/FontFaceSet.cpp:
792         * dom/ActiveDOMObject.cpp:
793         * dom/Document.h:
794         * dom/ScriptExecutionContext.h:
795         * dom/WindowEventLoop.cpp:
796         (WebCore::AbstractEventLoop::queueTask): Deleted.
797         (WebCore::AbstractEventLoop::resumeGroup): Deleted.
798         (WebCore::AbstractEventLoop::stopGroup): Deleted.
799         (WebCore::AbstractEventLoop::scheduleToRunIfNeeded): Deleted.
800         (WebCore::AbstractEventLoop::run): Deleted.
801         (WebCore::AbstractEventLoop::clearAllTasks): Deleted.
802         (WebCore::EventLoopFunctionDispatchTask::EventLoopFunctionDispatchTask): Deleted.
803         (WebCore::EventLoopTaskGroup::queueTask): Deleted.
804         * dom/WindowEventLoop.h:
805         * fileapi/FileReader.cpp:
806         * testing/Internals.cpp:
807         * workers/WorkerEventLoop.h:
808         * workers/service/ServiceWorkerContainer.cpp:
809
810 2019-11-19  Yusuke Suzuki  <ysuzuki@apple.com>
811
812         [IndexedDB] IndexedDB's threading assertion should respect Web thread
813         https://bugs.webkit.org/show_bug.cgi?id=204346
814
815         Reviewed by Daniel Bates.
816
817         Previously we are doing pointer-comparison between Thread::current() and origin-thread to
818         assert the thread affinity. But this does not respect Web thread: we can create an object
819         in Web Thread, and touch it in the main thread if web thread lock is correctly held.
820
821         This patch replaces pointer-comparison with WTF::canAccessThreadLocalDataForThread helper
822         function which appropriately respects Web thread status.
823
824         No behavior change.
825
826         * Modules/indexeddb/IDBActiveDOMObject.h:
827         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
828         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
829         * Modules/indexeddb/IDBCursor.cpp:
830         (WebCore::IDBCursor::IDBCursor):
831         (WebCore::IDBCursor::~IDBCursor):
832         (WebCore::IDBCursor::sourcesDeleted const):
833         (WebCore::IDBCursor::transaction const):
834         (WebCore::IDBCursor::update):
835         (WebCore::IDBCursor::advance):
836         (WebCore::IDBCursor::continueFunction):
837         (WebCore::IDBCursor::uncheckedIterateCursor):
838         (WebCore::IDBCursor::deleteFunction):
839         (WebCore::IDBCursor::setGetResult):
840         * Modules/indexeddb/IDBDatabase.cpp:
841         (WebCore::IDBDatabase::~IDBDatabase):
842         (WebCore::IDBDatabase::hasPendingActivity const):
843         (WebCore::IDBDatabase::name const):
844         (WebCore::IDBDatabase::version const):
845         (WebCore::IDBDatabase::objectStoreNames const):
846         (WebCore::IDBDatabase::renameObjectStore):
847         (WebCore::IDBDatabase::renameIndex):
848         (WebCore::IDBDatabase::createObjectStore):
849         (WebCore::IDBDatabase::transaction):
850         (WebCore::IDBDatabase::deleteObjectStore):
851         (WebCore::IDBDatabase::close):
852         (WebCore::IDBDatabase::connectionToServerLost):
853         (WebCore::IDBDatabase::maybeCloseInServer):
854         (WebCore::IDBDatabase::activeDOMObjectName const):
855         (WebCore::IDBDatabase::stop):
856         (WebCore::IDBDatabase::startVersionChangeTransaction):
857         (WebCore::IDBDatabase::didStartTransaction):
858         (WebCore::IDBDatabase::willCommitTransaction):
859         (WebCore::IDBDatabase::didCommitTransaction):
860         (WebCore::IDBDatabase::willAbortTransaction):
861         (WebCore::IDBDatabase::didAbortTransaction):
862         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
863         (WebCore::IDBDatabase::fireVersionChangeEvent):
864         (WebCore::IDBDatabase::dispatchEvent):
865         (WebCore::IDBDatabase::didCreateIndexInfo):
866         (WebCore::IDBDatabase::didDeleteIndexInfo):
867         * Modules/indexeddb/IDBIndex.cpp:
868         (WebCore::IDBIndex::IDBIndex):
869         (WebCore::IDBIndex::~IDBIndex):
870         (WebCore::IDBIndex::name const):
871         (WebCore::IDBIndex::setName):
872         (WebCore::IDBIndex::objectStore):
873         (WebCore::IDBIndex::keyPath const):
874         (WebCore::IDBIndex::unique const):
875         (WebCore::IDBIndex::multiEntry const):
876         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
877         (WebCore::IDBIndex::doOpenCursor):
878         (WebCore::IDBIndex::doOpenKeyCursor):
879         (WebCore::IDBIndex::doCount):
880         (WebCore::IDBIndex::doGet):
881         (WebCore::IDBIndex::doGetKey):
882         (WebCore::IDBIndex::doGetAll):
883         (WebCore::IDBIndex::doGetAllKeys):
884         (WebCore::IDBIndex::markAsDeleted):
885         * Modules/indexeddb/IDBObjectStore.cpp:
886         (WebCore::IDBObjectStore::IDBObjectStore):
887         (WebCore::IDBObjectStore::~IDBObjectStore):
888         (WebCore::IDBObjectStore::name const):
889         (WebCore::IDBObjectStore::setName):
890         (WebCore::IDBObjectStore::keyPath const):
891         (WebCore::IDBObjectStore::indexNames const):
892         (WebCore::IDBObjectStore::transaction):
893         (WebCore::IDBObjectStore::autoIncrement const):
894         (WebCore::IDBObjectStore::doOpenCursor):
895         (WebCore::IDBObjectStore::doOpenKeyCursor):
896         (WebCore::IDBObjectStore::get):
897         (WebCore::IDBObjectStore::getKey):
898         (WebCore::IDBObjectStore::putOrAdd):
899         (WebCore::IDBObjectStore::doDelete):
900         (WebCore::IDBObjectStore::clear):
901         (WebCore::IDBObjectStore::createIndex):
902         (WebCore::IDBObjectStore::index):
903         (WebCore::IDBObjectStore::deleteIndex):
904         (WebCore::IDBObjectStore::doCount):
905         (WebCore::IDBObjectStore::doGetAll):
906         (WebCore::IDBObjectStore::doGetAllKeys):
907         (WebCore::IDBObjectStore::markAsDeleted):
908         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
909         * Modules/indexeddb/IDBOpenDBRequest.cpp:
910         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
911         (WebCore::IDBOpenDBRequest::onError):
912         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
913         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
914         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
915         (WebCore::IDBOpenDBRequest::dispatchEvent):
916         (WebCore::IDBOpenDBRequest::onSuccess):
917         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
918         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
919         (WebCore::IDBOpenDBRequest::requestCompleted):
920         (WebCore::IDBOpenDBRequest::requestBlocked):
921         * Modules/indexeddb/IDBRequest.cpp:
922         (WebCore::IDBRequest::~IDBRequest):
923         (WebCore:: const):
924         (WebCore::IDBRequest::setSource):
925         (WebCore::IDBRequest::setVersionChangeTransaction):
926         (WebCore::IDBRequest::transaction const):
927         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
928         (WebCore::IDBRequest::sourceIndexIdentifier const):
929         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
930         (WebCore::IDBRequest::requestedIndexRecordType const):
931         (WebCore::IDBRequest::eventTargetInterface const):
932         (WebCore::IDBRequest::activeDOMObjectName const):
933         (WebCore::IDBRequest::hasPendingActivity const):
934         (WebCore::IDBRequest::stop):
935         (WebCore::IDBRequest::enqueueEvent):
936         (WebCore::IDBRequest::dispatchEvent):
937         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
938         (WebCore::IDBRequest::setResult):
939         (WebCore::IDBRequest::setResultToStructuredClone):
940         (WebCore::IDBRequest::setResultToUndefined):
941         (WebCore::IDBRequest::resultCursor):
942         (WebCore::IDBRequest::willIterateCursor):
943         (WebCore::IDBRequest::didOpenOrIterateCursor):
944         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
945         (WebCore::IDBRequest::onError):
946         (WebCore::IDBRequest::onSuccess):
947         * Modules/indexeddb/IDBTransaction.cpp:
948         (WebCore::IDBTransaction::IDBTransaction):
949         (WebCore::IDBTransaction::~IDBTransaction):
950         (WebCore::IDBTransaction::objectStoreNames const):
951         (WebCore::IDBTransaction::db):
952         (WebCore::IDBTransaction::error const):
953         (WebCore::IDBTransaction::objectStore):
954         (WebCore::IDBTransaction::abortDueToFailedRequest):
955         (WebCore::IDBTransaction::transitionedToFinishing):
956         (WebCore::IDBTransaction::abort):
957         (WebCore::IDBTransaction::internalAbort):
958         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
959         (WebCore::IDBTransaction::activeDOMObjectName const):
960         (WebCore::IDBTransaction::hasPendingActivity const):
961         (WebCore::IDBTransaction::stop):
962         (WebCore::IDBTransaction::isActive const):
963         (WebCore::IDBTransaction::isFinishedOrFinishing const):
964         (WebCore::IDBTransaction::addRequest):
965         (WebCore::IDBTransaction::removeRequest):
966         (WebCore::IDBTransaction::scheduleOperation):
967         (WebCore::IDBTransaction::trySchedulePendingOperationTimer):
968         (WebCore::IDBTransaction::pendingOperationTimerFired):
969         (WebCore::IDBTransaction::operationCompletedOnServer):
970         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
971         (WebCore::IDBTransaction::completedOperationTimerFired):
972         (WebCore::IDBTransaction::commit):
973         (WebCore::IDBTransaction::commitOnServer):
974         (WebCore::IDBTransaction::finishAbortOrCommit):
975         (WebCore::IDBTransaction::didStart):
976         (WebCore::IDBTransaction::notifyDidAbort):
977         (WebCore::IDBTransaction::didAbort):
978         (WebCore::IDBTransaction::didCommit):
979         (WebCore::IDBTransaction::fireOnComplete):
980         (WebCore::IDBTransaction::fireOnAbort):
981         (WebCore::IDBTransaction::enqueueEvent):
982         (WebCore::IDBTransaction::dispatchEvent):
983         (WebCore::IDBTransaction::createObjectStore):
984         (WebCore::IDBTransaction::createObjectStoreOnServer):
985         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
986         (WebCore::IDBTransaction::renameObjectStore):
987         (WebCore::IDBTransaction::renameObjectStoreOnServer):
988         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
989         (WebCore::IDBTransaction::createIndex):
990         (WebCore::IDBTransaction::createIndexOnServer):
991         (WebCore::IDBTransaction::didCreateIndexOnServer):
992         (WebCore::IDBTransaction::renameIndex):
993         (WebCore::IDBTransaction::renameIndexOnServer):
994         (WebCore::IDBTransaction::didRenameIndexOnServer):
995         (WebCore::IDBTransaction::requestOpenCursor):
996         (WebCore::IDBTransaction::doRequestOpenCursor):
997         (WebCore::IDBTransaction::openCursorOnServer):
998         (WebCore::IDBTransaction::didOpenCursorOnServer):
999         (WebCore::IDBTransaction::iterateCursor):
1000         (WebCore::IDBTransaction::iterateCursorOnServer):
1001         (WebCore::IDBTransaction::didIterateCursorOnServer):
1002         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
1003         (WebCore::IDBTransaction::requestGetAllIndexRecords):
1004         (WebCore::IDBTransaction::getAllRecordsOnServer):
1005         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
1006         (WebCore::IDBTransaction::requestGetRecord):
1007         (WebCore::IDBTransaction::requestGetValue):
1008         (WebCore::IDBTransaction::requestGetKey):
1009         (WebCore::IDBTransaction::requestIndexRecord):
1010         (WebCore::IDBTransaction::getRecordOnServer):
1011         (WebCore::IDBTransaction::didGetRecordOnServer):
1012         (WebCore::IDBTransaction::requestCount):
1013         (WebCore::IDBTransaction::getCountOnServer):
1014         (WebCore::IDBTransaction::didGetCountOnServer):
1015         (WebCore::IDBTransaction::requestDeleteRecord):
1016         (WebCore::IDBTransaction::deleteRecordOnServer):
1017         (WebCore::IDBTransaction::didDeleteRecordOnServer):
1018         (WebCore::IDBTransaction::requestClearObjectStore):
1019         (WebCore::IDBTransaction::clearObjectStoreOnServer):
1020         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
1021         (WebCore::IDBTransaction::requestPutOrAdd):
1022         (WebCore::IDBTransaction::putOrAddOnServer):
1023         (WebCore::IDBTransaction::didPutOrAddOnServer):
1024         (WebCore::IDBTransaction::deleteObjectStore):
1025         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
1026         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
1027         (WebCore::IDBTransaction::deleteIndex):
1028         (WebCore::IDBTransaction::deleteIndexOnServer):
1029         (WebCore::IDBTransaction::didDeleteIndexOnServer):
1030         (WebCore::IDBTransaction::operationCompletedOnClient):
1031         (WebCore::IDBTransaction::establishOnServer):
1032         (WebCore::IDBTransaction::activate):
1033         (WebCore::IDBTransaction::deactivate):
1034         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1035         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
1036         (WebCore::IDBClient::setMatchingItemsContextSuspended):
1037         * Modules/indexeddb/client/TransactionOperation.h:
1038         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
1039         (WebCore::IDBClient::TransactionOperation::perform):
1040         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
1041         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
1042         (WebCore::IDBClient::TransactionOperation::doComplete):
1043         * dom/ActiveDOMObject.cpp:
1044         (WebCore::ActiveDOMObject::~ActiveDOMObject):
1045         * platform/Supplementable.h:
1046         (WebCore::Supplementable::provideSupplement):
1047         (WebCore::Supplementable::removeSupplement):
1048         (WebCore::Supplementable::requireSupplement):
1049         * platform/Timer.cpp:
1050         (WebCore::TimerBase::~TimerBase):
1051         (WebCore::TimerBase::start):
1052         (WebCore::TimerBase::stop):
1053         (WebCore::TimerBase::setNextFireTime):
1054
1055 2019-11-19  John Wilander  <wilander@apple.com>
1056
1057         Resource Load Statistics: Count third-party script loads under top frame
1058         https://bugs.webkit.org/show_bug.cgi?id=204262
1059         <rdar://problem/57244945>
1060
1061         Reviewed by Alex Christensen.
1062
1063         Third-party scripts running in the first-party context are a significant privacy
1064         and security risk. This change captures the number of such script loads which will
1065         allow ITP to take action.
1066
1067         Tests: http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html
1068                http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html
1069                http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html
1070                http/tests/resourceLoadStatistics/count-third-party-script-loads.html
1071
1072         * loader/FrameLoader.cpp:
1073         (WebCore::FrameLoader::loadResourceSynchronously):
1074             Now sends the ResourceLoadObserver::FetchDestinationIsScriptLike parameter to
1075             ResourceLoadObserver::logSubresourceLoading().
1076         * loader/ResourceLoadObserver.h:
1077         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1078             Now takes a FetchDestinationIsScriptLike parameter.
1079         * loader/ResourceLoadStatistics.cpp:
1080         (WebCore::ResourceLoadStatistics::encode const):
1081         (WebCore::ResourceLoadStatistics::decode):
1082         (WebCore::ResourceLoadStatistics::toString const):
1083             Output of the new topFrameLoadedThirdPartyScripts category.
1084             Removed the lastSeen output since it may differ between test runs.
1085         (WebCore::ResourceLoadStatistics::merge):
1086             Handling of the new topFrameLoadedThirdPartyScripts category.
1087         * loader/ResourceLoadStatistics.h:
1088             Added the new topFrameLoadedThirdPartyScripts category.
1089         * loader/SubresourceLoader.cpp:
1090         (WebCore::SubresourceLoader::willSendRequestInternal):
1091             Now sends the ResourceLoadObserver::FetchDestinationIsScriptLike parameter to
1092             ResourceLoadObserver::logSubresourceLoading().
1093
1094 2019-11-19  Zalan Bujtas  <zalan@apple.com>
1095
1096         [LFC][IFC] Display::Run:TextContext should use StringView
1097         https://bugs.webkit.org/show_bug.cgi?id=204356
1098         <rdar://problem/57323695>
1099
1100         Reviewed by Antti Koivisto.
1101
1102         We could just use StringView instead of String here (though this is all temporary until We figure out the relationship
1103         between the layout and the display trees e.g. how to reference content from the display tree). 
1104
1105         * layout/displaytree/DisplayRun.h:
1106         (WebCore::Display::Run::TextContext::TextContext):
1107         (WebCore::Display::Run::TextContext::content const):
1108         (WebCore::Display::Run::TextContext::expand):
1109         * layout/inlineformatting/InlineLine.cpp:
1110         (WebCore::Layout::Line::Run::expand):
1111         (WebCore::Layout::Line::appendTextContent):
1112
1113 2019-11-19  Antti Koivisto  <antti@apple.com>
1114
1115         Rename CSSDefaultStyleSheets to UserAgentStyle
1116         https://bugs.webkit.org/show_bug.cgi?id=204357
1117
1118         Reviewed by Zalan Bujtas.
1119
1120         Also move it to Style namespace and directory, along with InspectorCSSOMWrappers.
1121
1122         * Sources.txt:
1123         * WebCore.xcodeproj/project.pbxproj:
1124         * page/ProcessWarming.cpp:
1125         (WebCore::ProcessWarming::prewarmGlobally):
1126         * style/ElementRuleCollector.cpp:
1127         (WebCore::Style::ElementRuleCollector::matchUARules):
1128         * style/InspectorCSSOMWrappers.cpp: Renamed from Source/WebCore/css/InspectorCSSOMWrappers.cpp.
1129         (WebCore::Style::InspectorCSSOMWrappers::collectDocumentWrappers):
1130         (WebCore::Style::InspectorCSSOMWrappers::collectScopeWrappers):
1131         * style/InspectorCSSOMWrappers.h: Renamed from Source/WebCore/css/InspectorCSSOMWrappers.h.
1132         * style/PageRuleCollector.cpp:
1133         (WebCore::Style::PageRuleCollector::matchAllPageRules):
1134         * style/RuleData.h:
1135         * style/RuleSet.h:
1136         * style/StyleResolver.cpp:
1137         (WebCore::Style::Resolver::Resolver):
1138         (WebCore::Style::Resolver::styleForElement):
1139         * style/StyleScopeRuleSets.cpp:
1140         (WebCore::Style::ScopeRuleSets::updateUserAgentMediaQueryStyleIfNeeded const):
1141         (WebCore::Style::ScopeRuleSets::collectFeatures const):
1142         * style/StyleScopeRuleSets.h:
1143         (WebCore::Style::ScopeRuleSets::features const):
1144         (WebCore::Style::ScopeRuleSets::mutableFeatures):
1145         * style/StyleSharingResolver.h:
1146         * style/UserAgentStyle.cpp: Renamed from Source/WebCore/css/CSSDefaultStyleSheets.cpp.
1147         (WebCore::Style::UserAgentStyle::initDefaultStyle):
1148         (WebCore::Style::UserAgentStyle::addToDefaultStyle):
1149         (WebCore::Style::UserAgentStyle::loadFullDefaultStyle):
1150         (WebCore::Style::UserAgentStyle::loadSimpleDefaultStyle):
1151         (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
1152         * style/UserAgentStyle.h: Renamed from Source/WebCore/css/CSSDefaultStyleSheets.h.
1153
1154 2019-11-19  Zalan Bujtas  <zalan@apple.com>
1155
1156         [LFC][IFC] Assign inlineCapacity to various inline run vectors.
1157         https://bugs.webkit.org/show_bug.cgi?id=204354
1158         <rdar://problem/57322347>
1159
1160         Reviewed by Antti Koivisto.
1161
1162         Inline capacity values are mainly based off of the equivalent simple line layout vectors.
1163
1164         * layout/blockformatting/BlockFormattingContext.cpp:
1165         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1166         * layout/inlineformatting/InlineFormattingState.h:
1167         * layout/inlineformatting/InlineLine.h:
1168         * rendering/updating/RenderTreeUpdater.cpp:
1169         (WebCore::RenderTreeUpdater::updateRendererStyle): Apparently 'newStyle' is moved out at this point.
1170
1171 2019-11-19  Sihui Liu  <sihui_liu@apple.com>
1172
1173         Update expectations for bufferedAmount-unchanged-by-sync-xhr.any.worker.html
1174         https://bugs.webkit.org/show_bug.cgi?id=204313
1175
1176         Reviewed by Alex Christensen.
1177
1178         Add some logging to help debug the flaky timeout of bufferedAmount-unchanged-by-sync-xhr.any.worker.html on 
1179         commit-queue bot.
1180
1181         * Modules/websockets/WebSocketChannel.cpp:
1182         (WebCore::WebSocketChannel::fail):
1183         (WebCore::WebSocketChannel::didFailSocketStream):
1184         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1185         (WebCore::SocketStreamHandleImpl::scheduleStreams):
1186         (WebCore::SocketStreamHandleImpl::readStreamCallback):
1187         * testing/InternalSettings.cpp:
1188         (WebCore::InternalSettings::Backup::restoreTo):Remove a duplicate setting.
1189
1190 2019-11-19  Eric Carlson  <eric.carlson@apple.com>
1191
1192         OverConstrainedError is missing 'name' property
1193         https://bugs.webkit.org/show_bug.cgi?id=204069
1194
1195         Reviewed by Youenn Fablet.
1196
1197         No new tests, existing test and results updated.
1198
1199         * Modules/mediastream/OverconstrainedError.h:
1200         (WebCore::OverconstrainedError::name const):
1201         * Modules/mediastream/OverconstrainedError.idl:
1202
1203 2019-11-19  Chris Dumez  <cdumez@apple.com>
1204
1205         Unreviewed iOS build fix.
1206
1207         * style/StyleAdjuster.cpp:
1208
1209 2019-11-19  Antti Koivisto  <antti@apple.com>
1210
1211         Move RuleData to a file of its own
1212         https://bugs.webkit.org/show_bug.cgi?id=204351
1213
1214         Reviewed by Anders Carlsson.
1215     
1216         * Sources.txt:
1217         * WebCore.xcodeproj/project.pbxproj:
1218         * style/RuleData.cpp: Added.
1219         (WebCore::Style::computeMatchBasedOnRuleHash):
1220         (WebCore::Style::selectorCanMatchPseudoElement):
1221         (WebCore::Style::isCommonAttributeSelectorAttribute):
1222         (WebCore::Style::computeContainsUncommonAttributeSelector):
1223         (WebCore::Style::determinePropertyWhitelistType):
1224         (WebCore::Style::RuleData::RuleData):
1225         * style/RuleData.h: Added.
1226         (WebCore::Style::RuleData::position const):
1227         (WebCore::Style::RuleData::rule const):
1228         (WebCore::Style::RuleData::selector const):
1229         (WebCore::Style::RuleData::selectorIndex const):
1230         (WebCore::Style::RuleData::selectorListIndex const):
1231         (WebCore::Style::RuleData::canMatchPseudoElement const):
1232         (WebCore::Style::RuleData::matchBasedOnRuleHash const):
1233         (WebCore::Style::RuleData::containsUncommonAttributeSelector const):
1234         (WebCore::Style::RuleData::linkMatchType const):
1235         (WebCore::Style::RuleData::propertyWhitelistType const):
1236         (WebCore::Style::RuleData::descendantSelectorIdentifierHashes const):
1237         (WebCore::Style::RuleData::disableSelectorFiltering):
1238         * style/RuleSet.cpp:
1239         (WebCore::Style::computeMatchBasedOnRuleHash): Deleted.
1240         (WebCore::Style::selectorCanMatchPseudoElement): Deleted.
1241         (WebCore::Style::isCommonAttributeSelectorAttribute): Deleted.
1242         (WebCore::Style::computeContainsUncommonAttributeSelector): Deleted.
1243         (WebCore::Style::determinePropertyWhitelistType): Deleted.
1244         (WebCore::Style::RuleData::RuleData): Deleted.
1245         * style/RuleSet.h:
1246         (WebCore::Style::RuleData::position const): Deleted.
1247         (WebCore::Style::RuleData::rule const): Deleted.
1248         (WebCore::Style::RuleData::selector const): Deleted.
1249         (WebCore::Style::RuleData::selectorIndex const): Deleted.
1250         (WebCore::Style::RuleData::selectorListIndex const): Deleted.
1251         (WebCore::Style::RuleData::canMatchPseudoElement const): Deleted.
1252         (WebCore::Style::RuleData::matchBasedOnRuleHash const): Deleted.
1253         (WebCore::Style::RuleData::containsUncommonAttributeSelector const): Deleted.
1254         (WebCore::Style::RuleData::linkMatchType const): Deleted.
1255         (WebCore::Style::RuleData::propertyWhitelistType const): Deleted.
1256         (WebCore::Style::RuleData::descendantSelectorIdentifierHashes const): Deleted.
1257         (WebCore::Style::RuleData::disableSelectorFiltering): Deleted.
1258
1259 2019-11-19  Antti Koivisto  <antti@apple.com>
1260
1261         Move ElementRuleCollector to Style namespace
1262         https://bugs.webkit.org/show_bug.cgi?id=204329
1263
1264         Reviewed by Sam Weinig.
1265
1266         Also move PageRuleCollector.
1267
1268         * Sources.txt:
1269         * WebCore.xcodeproj/project.pbxproj:
1270         * bindings/js/CallTracerTypes.h:
1271         * css/DOMCSSRegisterCustomProperty.cpp:
1272         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
1273         * dom/Document.cpp:
1274         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
1275         * html/canvas/CanvasRenderingContext2D.cpp:
1276         (WebCore::CanvasRenderingContext2D::setFont):
1277         * html/canvas/CanvasRenderingContext2DBase.cpp:
1278         (WebCore::toStyleVariant):
1279         (WebCore::CanvasRenderingContext2DBase::strokeStyle const):
1280         (WebCore::CanvasRenderingContext2DBase::setStrokeStyle):
1281         (WebCore::CanvasRenderingContext2DBase::fillStyle const):
1282         (WebCore::CanvasRenderingContext2DBase::setFillStyle):
1283
1284         Rename CanvasRenderingContext2DBase::Style to StyleVariant to avoid name conflicts.
1285
1286         (WebCore::toStyle): Deleted.
1287         * html/canvas/CanvasRenderingContext2DBase.h:
1288         * inspector/InspectorCanvas.cpp:
1289         (WebCore::InspectorCanvas::buildAction):
1290         * page/FrameView.cpp:
1291         (WebCore::FrameView::styleHidesScrollbarWithOrientation const):
1292         (WebCore::FrameView::updateScrollCorner):
1293         * rendering/RenderElement.cpp:
1294         (WebCore::RenderElement::getCachedPseudoStyle const):
1295         (WebCore::RenderElement::getUncachedPseudoStyle const):
1296         (WebCore::RenderElement::selectionPseudoStyle const):
1297         * rendering/RenderElement.h:
1298         * rendering/RenderLayer.cpp:
1299         (WebCore::RenderLayer::calculateClipRects const):
1300         * rendering/RenderObject.h:
1301         * rendering/RenderScrollbar.cpp:
1302         (WebCore::RenderScrollbar::getScrollbarPseudoStyle const):
1303         * rendering/updating/RenderTreeUpdater.cpp:
1304         (WebCore::pseudoStyleCacheIsInvalid):
1305         * style/ElementRuleCollector.cpp: Renamed from Source/WebCore/css/ElementRuleCollector.cpp.
1306         (WebCore::Style::MatchRequest::MatchRequest):
1307         (WebCore::Style::ElementRuleCollector::ElementRuleCollector):
1308         (WebCore::Style::ElementRuleCollector::addMatchedRule):
1309         (WebCore::Style::ElementRuleCollector::collectMatchingRules):
1310         (WebCore::Style::ElementRuleCollector::transferMatchedRules):
1311         (WebCore::Style::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
1312         (WebCore::Style::ElementRuleCollector::matchHostPseudoClassRules):
1313         (WebCore::Style::ElementRuleCollector::matchSlottedPseudoElementRules):
1314         (WebCore::Style::ElementRuleCollector::matchPartPseudoElementRulesForScope):
1315         (WebCore::Style::ElementRuleCollector::collectSlottedPseudoElementRulesForSlot):
1316         (WebCore::Style::ElementRuleCollector::matchUARules):
1317         (WebCore::Style::ElementRuleCollector::ruleMatches):
1318         (WebCore::Style::ElementRuleCollector::collectMatchingRulesForList):
1319         (WebCore::Style::ElementRuleCollector::matchAllRules):
1320         (WebCore::Style::ElementRuleCollector::hasAnyMatchingRules):
1321         (WebCore::Style::ElementRuleCollector::addMatchedProperties):
1322         * style/ElementRuleCollector.h: Renamed from Source/WebCore/css/ElementRuleCollector.h.
1323         (WebCore::Style::PseudoElementRequest::PseudoElementRequest):
1324         (WebCore::Style::ElementRuleCollector::setPseudoElementRequest):
1325         (WebCore::Style::ElementRuleCollector::styleRelations const):
1326         (WebCore::Style::ElementRuleCollector::transferMatchedRules):
1327         * style/PageRuleCollector.cpp: Renamed from Source/WebCore/css/PageRuleCollector.cpp.
1328         (WebCore::Style::PageRuleCollector::matchPageRules):
1329         * style/PageRuleCollector.h: Renamed from Source/WebCore/css/PageRuleCollector.h.
1330         (WebCore::Style::PageRuleCollector::PageRuleCollector):
1331         * style/StyleResolver.cpp:
1332         (WebCore::Style::Resolver::pseudoStyleForElement):
1333         (WebCore::Style::Resolver::pseudoStyleRulesForElement):
1334         * style/StyleResolver.h:
1335
1336 2019-11-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1337
1338         [Clipboard API] Add support for Clipboard.readText()
1339         https://bugs.webkit.org/show_bug.cgi?id=204310
1340         <rdar://problem/57292754>
1341
1342         Reviewed by Ryosuke Niwa.
1343
1344         Implements readText; see below for more detail.
1345
1346         Tests: editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html
1347                editing/async-clipboard/clipboard-read-text-from-platform.html
1348                editing/async-clipboard/clipboard-read-text-same-origin.html
1349                editing/async-clipboard/clipboard-read-text.html
1350
1351         * Modules/async-clipboard/Clipboard.cpp:
1352         (WebCore::Clipboard::readText):
1353
1354         Implement the method. This works similarly to Clipboard::read, but immediately reads text data for the first
1355         clipboard item with data for "text/plain", instead of exposing a list of clipboard items.
1356
1357         * dom/DataTransfer.cpp:
1358         (WebCore::DataTransfer::commitToPasteboard):
1359
1360         If the custom pasteboard data object is empty, then don't bother trying to write it to the platform pasteboard.
1361         This avoids hitting an assertion in WebDragClient::beginDrag that checks to make sure there's no data on the
1362         pasteboard right before beginning a drag in the UI process which was getting hit because we'd otherwise end up
1363         writing just the pasteboard data origin; it also has an added bonus of avoiding an unnecessary sync IPC message.
1364
1365         * platform/mac/PlatformPasteboardMac.mm:
1366         (WebCore::PlatformPasteboard::write):
1367
1368         Write the custom data type ("com.apple.WebKit.custom-pasteboard-data") when writing PasteboardCustomData to the
1369         pasteboard on macOS, even when the custom pasteboard data only contains an origin. This allows DOM paste
1370         requests to automatically accept when exchanging text data between the same origin via the async clipboard API.
1371
1372 2019-11-19  Chris Dumez  <cdumez@apple.com>
1373
1374         http/tests/navigation/page-cache-mediastream.html is a flaky crash
1375         https://bugs.webkit.org/show_bug.cgi?id=204321
1376
1377         Reviewed by Eric Carlson.
1378
1379         Make sure the MediaStreamTrack stays alive if there is a pending ended event to dispatch.
1380
1381         No new tests, covered by existing test.
1382
1383         * Modules/mediastream/MediaStreamTrack.cpp:
1384         (WebCore::MediaStreamTrack::hasPendingActivity const):
1385
1386 2019-11-19  Thibault Saunier  <tsaunier@igalia.com>
1387
1388         REGRESSION(r249428): [GStreamer] VP9 video rendered green
1389         https://bugs.webkit.org/show_bug.cgi?id=201422
1390
1391         Reviewed by Philippe Normand.
1392
1393         Avoid forcing a video conversion in software we end up and make
1394         it happen in GL with a sensibly simpler pipeline, this is possible as
1395         `glcolorconvert` properly setups the converted GL buffers.
1396
1397         Without that patch we are getting "random" not negotiated issues with
1398         MediaStream sources related to the `GLMemory` caps feature during
1399         renegotiation between the software `videoconvert` and our sink.
1400
1401         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1402         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
1403
1404 2019-11-18  John Wilander  <wilander@apple.com>
1405
1406         Check if ITP is on before applying third-party cookie blocking
1407         https://bugs.webkit.org/show_bug.cgi?id=204322
1408         <rdar://problem/57120772>
1409
1410         Reviewed by Chris Dumez and Alexey Proskuryakov.
1411
1412         This change makes sure WebCore::NetworkStorageSession knows
1413         whether ITP is on or off and checks that first thing in
1414         WebCore::NetworkStorageSession::shouldBlockCookies().
1415
1416         This check was never needed before since if ITP was off,
1417         there would be no classified domains and thus the function
1418         would always return false. However,
1419         https://trac.webkit.org/changeset/251353/webkit introduced
1420         full third-party cookie blocking for websites without user
1421         interaction and that rule is checked before checking domain
1422         classification. The effect was unconditional third-party
1423         cookie blocking if ITP is off. This changes fixes that bug.
1424
1425         Note that this patch already landed as branch-specific in
1426         https://trac.webkit.org/changeset/252549/webkit
1427
1428         Test: http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html
1429
1430         * platform/network/NetworkStorageSession.cpp:
1431         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
1432         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookiesButKeepFirstPartyCookiesFor const):
1433         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1434             Now checks whether ITP is on or off.
1435         * platform/network/NetworkStorageSession.h:
1436         (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled):
1437
1438 2019-11-18  Simon Fraser  <simon.fraser@apple.com>
1439
1440         -webkit-font-smoothing: none leaves subsequent elements unantialiased
1441         https://bugs.webkit.org/show_bug.cgi?id=204334
1442
1443         Reviewed by Myles C. Maxfield.
1444
1445         FontCascade::drawGlyphs() never called context.setShouldAntialias(true) for the
1446         FontSmoothingMode::AutoSmoothing state, leaving it off for later elements.
1447
1448         Fix this function to save and restore antialiasing and smoothing in similar ways, and rather
1449         than handle FontSmoothingMode::AutoSmoothing as "do nothing and let the platform decide"
1450         (which caused this bug), explicitly treat it as equivalent to
1451         FontSmoothingMode::SubpixelAntialiased. Note that FontSmoothingMode::SubpixelAntialiased
1452         does not render with subpixel antialiasing on macOS Mojave and later.
1453
1454         Test: fast/text/font-antialiasing-save-restore.html
1455
1456         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1457         (WebCore::FontCascade::drawGlyphs):
1458
1459 2019-11-18  Zalan Bujtas  <zalan@apple.com>
1460
1461         Flex layout triggers excessive layout on height percentage descendants
1462         https://bugs.webkit.org/show_bug.cgi?id=204319
1463         <rdar://problem/57236652>
1464
1465         Reviewed by Simon Fraser.
1466
1467         This is very similar to r252562, except in this case the layout is explicitly triggered by the flex layout logic.
1468         The patch ensures that we don't try to lay out percent height descendants with out-of-flow ancestors (see r252562 or webkit.org/b/204255 for more info).
1469         (Unfortunately this is not testable but the subsequent repaint fix will include a test which would fail if we regressed this.)
1470
1471         * rendering/RenderFlexibleBox.cpp:
1472         (WebCore::RenderFlexibleBox::hasPercentHeightDescendants const):
1473         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
1474         * rendering/RenderFlexibleBox.h:
1475
1476 2019-11-18  Devin Rousso  <drousso@apple.com>
1477
1478         Web Inspector: Local Resource Overrides: allow substitution based on a url pattern
1479         https://bugs.webkit.org/show_bug.cgi?id=202375
1480
1481         Reviewed by Brian Burg.
1482
1483         Test: http/tests/inspector/network/local-resource-override-isRegex.html
1484
1485         Often, websites will load content with a timestamp-based URL query parameter for
1486         cache-busting or logging purposes. If a developer is trying to override these resources (or
1487         is trying to have an existing override also match these resources), they'd need to edit the
1488         local override's URL to match in addition to editing the resource that loads it (e.g. change
1489         the <script> in an HTML file), which can sometimes be tricky of the content is dynamically
1490         loaded (e.g. an XHR with a non-hardcoded URL).
1491
1492         Allowing for local overrides to be set using a regular expression pattern would help resolve
1493         this limitation.
1494
1495         * inspector/agents/InspectorNetworkAgent.h:
1496         (WebCore::InspectorNetworkAgent::Intercept): Added.
1497         (WebCore::InspectorNetworkAgent::Intercept::operator== const): Added.
1498         * inspector/agents/InspectorNetworkAgent.cpp:
1499         (WebCore::InspectorNetworkAgent::disable):
1500         (WebCore::InspectorNetworkAgent::shouldIntercept): Added.
1501         (WebCore::InspectorNetworkAgent::addInterception):
1502         (WebCore::InspectorNetworkAgent::removeInterception):
1503         (WebCore::InspectorNetworkAgent::willInterceptRequest):
1504         (WebCore::InspectorNetworkAgent::shouldInterceptResponse):
1505
1506 2019-11-18  Andres Gonzalez  <andresg_22@apple.com>
1507
1508         Run AccessibilityController::rootElement on secondary thread to simulate HIServices during LayoutTests.
1509         https://bugs.webkit.org/show_bug.cgi?id=204226
1510
1511         Reviewed by Chris Fleizach.
1512
1513         No new tests, no new functionality.
1514
1515         Added AXObjectCahce::canUseSecondaryAXThread to support
1516         WTR::AccessibilityController spawning of a secondary thread to simulate
1517         execution of isolated tree code.
1518
1519         * accessibility/AXObjectCache.cpp:
1520         (WebCore::AXObjectCache::canUseSecondaryAXThread):
1521         * accessibility/AXObjectCache.h:
1522
1523 2019-11-15  Ryosuke Niwa  <rniwa@webkit.org>
1524
1525         Share more code between WindowEventLoop and WorkerEventLoop by introducing EventLoopTaskGroup
1526         https://bugs.webkit.org/show_bug.cgi?id=204263
1527
1528         Reviewed by Antti Koivisto.
1529
1530         This patch abstracts the logic in WindowEventLoop to deal with a set of tasks associated with
1531         a particular documents all suspending, resuming, or stopping at the same time using a new abstraction
1532         called EventLoopTaskGroup in order to group tasks for media code and elsewhere.
1533
1534         Each task is now represented as an instance of a concrete subclass of EventLoopTask, which has
1535         a pure virtual execute() member function. Its primary purpose is to know EventLoopTaskGroup to which
1536         each task belongs. One of subclasss, EventLoopFunctionDispatchTask, is used to store a callback function
1537         and another subclass, ActiveDOMObjectEventDispatchTask, is used to dispatch an async event.
1538
1539         ScriptExecutionContext's eventLoop() method now returns EventLoopTaskGroup. Because this group is
1540         specific to a given ScriptExecutionContext, we no longer have to pass the ScriptExecutionContext
1541         in each call to queueTask everywhere in our codebase.
1542
1543         For now, I kept all the code in WindowEventLoop.cpp to make the patch reviewable. My plan is to create
1544         a new cpp file (e.g. AbstractEventLoop.cpp) and move most of code there instead as a follow up.
1545
1546         No new tests since there should be no observable behavior change.
1547
1548         * Modules/encryptedmedia/MediaKeys.cpp:
1549         (WebCore::MediaKeys::setServerCertificate):
1550         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
1551         (WebCore::FileSystemDirectoryEntry::getEntry):
1552         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
1553         (WebCore::FileSystemDirectoryReader::readEntries):
1554         * Modules/entriesapi/FileSystemEntry.cpp:
1555         (WebCore::FileSystemEntry::getParent):
1556         * Modules/entriesapi/FileSystemFileEntry.cpp:
1557         (WebCore::FileSystemFileEntry::file):
1558         * Modules/mediarecorder/MediaRecorder.cpp:
1559         (WebCore::MediaRecorder::scheduleDeferredTask):
1560         * Modules/notifications/Notification.cpp:
1561         (WebCore::Notification::queueTask):
1562         * Modules/webdatabase/Database.cpp:
1563         (WebCore::Database::runTransaction):
1564         * Modules/webdatabase/DatabaseManager.cpp:
1565         (WebCore::DatabaseManager::openDatabase):
1566         * Modules/webdatabase/SQLTransaction.cpp:
1567         (WebCore::SQLTransaction::callErrorCallbackDueToInterruption):
1568         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
1569         (WebCore::SQLTransaction::deliverSuccessCallback):
1570         * bindings/js/JSDOMPromiseDeferred.cpp:
1571         (WebCore::DeferredPromise::callFunction):
1572         (WebCore::DeferredPromise::whenSettled):
1573         * dom/AbstractEventLoop.h:
1574         (WebCore::EventLoopTask): Added.
1575         (WebCore::EventLoopTask::taskSource): Added.
1576         (WebCore::EventLoopTask::group const): Added.
1577         (WebCore::EventLoopTask::EventLoopTask): Added.
1578         (WebCore::EventLoopTaskGroup): Added. This class represents a group of tasks. For now, each group is
1579         a distinct ScriptExecutionContext.
1580         (WebCore::EventLoopTaskGroup::matchesTask const): Added.
1581         (WebCore::EventLoopTaskGroup::startRunning): Added.
1582         (WebCore::EventLoopTaskGroup::stopAndDiscardAllTasks): Added.
1583         (WebCore::EventLoopTaskGroup::suspend): Added.
1584         (WebCore::EventLoopTaskGroup::resume): Added.
1585         (WebCore::EventLoopTaskGroup::isStoppedPermanently): Added.
1586         (WebCore::EventLoopTaskGroup::isSuspended): Added.
1587         (WebCore::EventLoopTaskGroup::hasScheduledTasks const): Added.
1588         (WebCore::EventLoopTaskGroup::queueTask): Added.
1589         * dom/ActiveDOMObject.cpp:
1590         (WebCore::ActiveDOMObject::queueTaskInEventLoop):
1591         (WebCore::ActiveDOMObjectEventDispatchTask): Added; A subclass of EventLoopTask to dispatch an async event.
1592         (WebCore::ActiveDOMObjectEventDispatchTask::ActiveDOMObjectEventDispatchTask): Added.
1593         (WebCore::ActiveDOMObjectEventDispatchTask::~ActiveDOMObjectEventDispatchTask): Added.
1594         (WebCore::ActiveDOMObject::queueTaskToDispatchEventInternal): Added.
1595         * dom/ActiveDOMObject.h:
1596         * dom/Document.cpp:
1597         (WebCore::Document::suspendActiveDOMObjects):
1598         (WebCore::Document::resumeActiveDOMObjects):
1599         (WebCore::Document::stopActiveDOMObjects):
1600         (WebCore::Document::eventLoop): Creates EventLoopTaskGroup for this document.
1601         * dom/Document.h:
1602         * dom/IdleCallbackController.cpp:
1603         (WebCore::IdleCallbackController::queueTaskToStartIdlePeriod):
1604         (WebCore::IdleCallbackController::queueTaskToInvokeIdleCallbacks):
1605         * dom/ScriptExecutionContext.h:
1606         * dom/WindowEventLoop.cpp:
1607         (WebCore::AbstractEventLoop::queueTask): The implementation moved from WindowEventLoop to AbstractEventLoop.
1608         (WebCore::AbstractEventLoop::suspend): Removed.
1609         (WebCore::AbstractEventLoop::resumeGroup): Ditto.
1610         (WebCore::AbstractEventLoop::stopGroup): Ditto.
1611         (WebCore::WindowEventLoop::scheduleToRun): Renamed from WindowEventLoop::scheduleToRunIfNeeded.
1612         (WebCore::AbstractEventLoop::scheduleToRunIfNeeded): Extracted from WindowEventLoop::scheduleToRunIfNeeded.
1613         (WebCore::WindowEventLoop::isContextThread const): Added.
1614         (WebCore::AbstractEventLoop::run): The implementation moved from WindowEventLoop to AbstractEventLoop.
1615         (WebCore::AbstractEventLoop::clearAllTasks): Added.
1616         (WebCore::EventLoopFunctionDispatchTask): Added; A subclass of EventLoopTask to call a function.
1617         (WebCore::EventLoopFunctionDispatchTask::EventLoopFunctionDispatchTask): Added.
1618         (WebCore::EventLoopTaskGroup::queueTask): Added.
1619         * dom/WindowEventLoop.h:
1620         * fileapi/FileReader.cpp:
1621         (WebCore::FileReader::enqueueTask):
1622         * testing/Internals.cpp:
1623         (WebCore::Internals::queueTask):
1624         * workers/WorkerEventLoop.cpp:
1625         (WebCore::WorkerEventLoop::WorkerEventLoop):
1626         (WebCore::WorkerEventLoop::queueTask): Deleted.
1627         (WebCore::WorkerEventLoop::activeDOMObjectName const): Deleted.
1628         (WebCore::WorkerEventLoop::suspend): Deleted.
1629         (WebCore::WorkerEventLoop::resume): Deleted.
1630         (WebCore::WorkerEventLoop::stop): Deleted.
1631         (WebCore::WorkerEventLoop::scheduleToRun): Extracted from scheduleToRunIfNeeded.
1632         (WebCore::WorkerEventLoop::scheduleToRunIfNeeded): Deleted.
1633         (WebCore::WorkerEventLoop::run): Deleted.
1634         (WebCore::WorkerEventLoop::isContextThread const): Added.
1635         * workers/WorkerEventLoop.h:
1636         (WebCore::WorkerEventLoop): This class is no longer an active DOM object. WorkerGlobalScope and WorkerGlobalScope
1637         manually stop the task group associated with it.
1638         * workers/WorkerGlobalScope.cpp:
1639         (WebCore::WorkerGlobalScope::eventLoop): Create the default task group for this script execution context.
1640         (WebCore::WorkerGlobalScope::prepareForTermination): Stop the default task group.
1641         * workers/WorkerGlobalScope.h:
1642         * worklets/WorkletGlobalScope.cpp:
1643         (WebCore::WorkletGlobalScope::prepareForDestruction): Similar to WorkerGlobalScope::prepareForTermination.
1644         (WebCore::WorkletGlobalScope::eventLoop): Similar to WorkerGlobalScope::eventLoop.
1645         * worklets/WorkletGlobalScope.h:
1646
1647 2019-11-18  Antti Koivisto  <antti@apple.com>
1648
1649         Move RuleSet to Style namespace
1650         https://bugs.webkit.org/show_bug.cgi?id=204307
1651
1652         Reviewed by Zalan Bujtas.
1653
1654         Also move RuleFeature.
1655         Move to style/ directory.
1656
1657         * Sources.txt:
1658         * WebCore.xcodeproj/project.pbxproj:
1659         * css/CSSDefaultStyleSheets.cpp:
1660         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
1661         (WebCore::CSSDefaultStyleSheets::loadSimpleDefaultStyle):
1662         * css/CSSDefaultStyleSheets.h:
1663         * css/CSSStyleRule.cpp:
1664         (WebCore::CSSStyleRule::setSelectorText):
1665         * css/ElementRuleCollector.cpp:
1666         (WebCore::MatchRequest::MatchRequest):
1667         (WebCore::ElementRuleCollector::ElementRuleCollector):
1668         (WebCore::ElementRuleCollector::addMatchedRule):
1669         (WebCore::ElementRuleCollector::collectSlottedPseudoElementRulesForSlot):
1670         (WebCore::ElementRuleCollector::matchUARules):
1671         (WebCore::ElementRuleCollector::ruleMatches):
1672         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
1673         (WebCore::ElementRuleCollector::hasAnyMatchingRules):
1674         * css/ElementRuleCollector.h:
1675         * css/PageRuleCollector.cpp:
1676         (WebCore::PageRuleCollector::matchPageRules):
1677         * css/PageRuleCollector.h:
1678         * css/StyleSheetContents.cpp:
1679         (WebCore::StyleSheetContents::parserAppendRule):
1680         (WebCore::StyleSheetContents::wrapperInsertRule):
1681         * style/RuleFeature.cpp: Renamed from Source/WebCore/css/RuleFeature.cpp.
1682         * style/RuleFeature.h: Renamed from Source/WebCore/css/RuleFeature.h.
1683         * style/RuleSet.cpp: Renamed from Source/WebCore/css/RuleSet.cpp.
1684         (WebCore::Style::computeContainsUncommonAttributeSelector):
1685         (WebCore::Style::RuleData::RuleData):
1686         (WebCore::Style::RuleSet::addChildRules):
1687         (WebCore::Style::RuleSet::addRulesFromSheet):
1688         * style/RuleSet.h: Renamed from Source/WebCore/css/RuleSet.h.
1689         * style/StyleInvalidator.h:
1690
1691 2019-11-18  Alex Christensen  <achristensen@webkit.org>
1692
1693         Use SecTrustEvaluateWithError instead of SecTrustEvaluate where available
1694         https://bugs.webkit.org/show_bug.cgi?id=204159
1695         <rdar://problem/45894288>
1696
1697         Reviewed by Darin Adler.
1698
1699         * platform/network/cocoa/ResourceResponseCocoa.mm:
1700         (WebCore::ResourceResponse::platformCertificateInfo const):
1701
1702 2019-11-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1703
1704         Fix getTotalLength() and getPointAtLength() for optimized rect and ellipse renderers
1705         https://bugs.webkit.org/show_bug.cgi?id=204213
1706
1707         Reviewed by Simon Fraser.
1708
1709         If the renderer does not create a Path to draw the shape, we need to create
1710         a temporary Path from the SVGElement then use it to answer the questions
1711         of these functions and finally delete it.
1712
1713         * platform/graphics/Path.cpp:
1714         (WebCore::Path::traversalStateAtLength const):
1715         (WebCore::Path::pointAtLength const):
1716         No need for the 'success'. It is never used.
1717
1718         (WebCore::Path::normalAngleAtLength const): Deleted.
1719         This function is not used.
1720
1721         * platform/graphics/Path.h:
1722         * rendering/svg/RenderSVGShape.cpp:
1723         (WebCore::RenderSVGShape::updateShapeFromElement):
1724         Creating the Path from the SVGELement is moved to createPath().
1725
1726         (WebCore::RenderSVGShape::getTotalLength const):
1727         (WebCore::RenderSVGShape::getPointAtLength const):
1728         Create a temporary Path if the renderer draws the shape without creating
1729         the Path.
1730
1731         (WebCore::RenderSVGShape::createPath const):
1732         * rendering/svg/RenderSVGShape.h:
1733
1734         * rendering/svg/SVGTextLayoutEngine.cpp:
1735         (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
1736         * svg/SVGAnimateMotionElement.cpp:
1737         (WebCore::SVGAnimateMotionElement::buildTransformForProgress):
1738         Use PathTraversalState.success() to check instead of getting the same
1739         value through an argument to traversalStateAtLength().
1740
1741 2019-11-18  Zalan Bujtas  <zalan@apple.com>
1742
1743         Block layout invalidation logic triggers excessive layout on height percentage descendants
1744         https://bugs.webkit.org/show_bug.cgi?id=204255
1745         rdar://problem/57236490
1746
1747         Reviewed by Simon Fraser.
1748
1749         This patch attempts to optimize the height percentage invalidation logic by skipping boxes with out-of-flow ancestors.
1750
1751         The normal box invalidation logic works at the parent-child level (a.k.a when the parent is dirty it walks its direct
1752         children list and marks them dirty if needed). However percent height values require containing block-child type of invalidation
1753         which atm we manage using RenderBlock's percentHeightDescendantsMap (this map contains all the height percentage descendants).
1754         As part of this extra invalidation logic, the block container always marks all of these height descendants dirty.
1755         In certain cases, this leads to excessive and unnecessary layouts, since the
1756         "walk the ancestor chain and mark boxes dirty all the way to the RenderView" code ends up descending back to these height percentage boxes
1757         marking entire subtrees dirty.
1758
1759         We could optimize it slightly by checking if there's a height percentage containing block in the ancestor chain.
1760         In such cases, we know that the descendant's height used value computation will eventually stop at this out-of-flow containing block.
1761
1762         Test: fast/block/height-percentage-descendants-with-absolute-pos-containingblock.html
1763
1764         * rendering/RenderBlock.cpp:
1765         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
1766
1767 2019-11-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1768
1769         [Clipboard API] Add support for Clipboard.writeText()
1770         https://bugs.webkit.org/show_bug.cgi?id=204287
1771         <rdar://problem/57270440>
1772
1773         Reviewed by Tim Horton.
1774
1775         Implements the `writeText` method on Clipboard.
1776
1777         Tests: editing/async-clipboard/clipboard-write-text-requires-user-gesture.html
1778                editing/async-clipboard/clipboard-write-text.html
1779
1780         * Modules/async-clipboard/Clipboard.cpp:
1781         (WebCore::shouldProceedWithClipboardWrite):
1782
1783         Move this helper function further up the file.
1784
1785         (WebCore::Clipboard::writeText):
1786
1787         Implement the API, by populating a single PasteboardCustomData and writing it to the system clipboard.
1788
1789 2019-11-18  Antoine Quint  <graouts@apple.com>
1790
1791         Return value of CSSPropertyAnimation::blendProperties() isn't used anywhere
1792         https://bugs.webkit.org/show_bug.cgi?id=204299
1793
1794         Reviewed by Dean Jackson.
1795
1796         There is no code calling CSSPropertyAnimation::blendProperties() that uses its returen value, so we change
1797         that function to return void. Also, since this function contains the only call site to
1798         CSSPropertyBlendingClient::isAccelerated(), we delete that function too.
1799
1800         * animation/CSSPropertyBlendingClient.h:
1801         * animation/KeyframeEffect.h:
1802         (WebCore::KeyframeEffect::isAccelerated const):
1803         * page/animation/AnimationBase.h:
1804         (WebCore::AnimationBase::isAccelerated const):
1805         * page/animation/CSSPropertyAnimation.cpp:
1806         (WebCore::CSSPropertyAnimation::blendProperties):
1807         * page/animation/CSSPropertyAnimation.h:
1808
1809 2019-11-18  Antti Koivisto  <antti@apple.com>
1810
1811         Rename DocumentRuleSets to Style::ScopeRuleSets
1812         https://bugs.webkit.org/show_bug.cgi?id=204301
1813
1814         Reviewed by Zalan Bujtas.
1815
1816         The current name is misleading, these objects are per style scope, not per document.
1817         Also switch to Style namespace and directory.
1818
1819         * Sources.txt:
1820         * WebCore.xcodeproj/project.pbxproj:
1821         * css/ElementRuleCollector.cpp:
1822         (WebCore::ElementRuleCollector::ElementRuleCollector):
1823         * css/ElementRuleCollector.h:
1824         * css/PageRuleCollector.h:
1825         (WebCore::PageRuleCollector::PageRuleCollector):
1826         * style/AttributeChangeInvalidation.h:
1827         * style/ClassChangeInvalidation.h:
1828         * style/StyleInvalidationFunctions.h:
1829         * style/StyleResolver.h:
1830         (WebCore::Style::Resolver::ruleSets):
1831         (WebCore::Style::Resolver::ruleSets const):
1832         * style/StyleScopeRuleSets.cpp: Renamed from Source/WebCore/css/DocumentRuleSets.cpp.
1833         (WebCore::Style::ScopeRuleSets::ScopeRuleSets):
1834         (WebCore::Style::ScopeRuleSets::~ScopeRuleSets):
1835         (WebCore::Style::ScopeRuleSets::userAgentMediaQueryStyle const):
1836         (WebCore::Style::ScopeRuleSets::updateUserAgentMediaQueryStyleIfNeeded const):
1837         (WebCore::Style::ScopeRuleSets::userStyle const):
1838         (WebCore::Style::ScopeRuleSets::initializeUserStyle):
1839         (WebCore::Style::ScopeRuleSets::collectRulesFromUserStyleSheets):
1840         (WebCore::Style::ScopeRuleSets::resetAuthorStyle):
1841         (WebCore::Style::ScopeRuleSets::resetUserAgentMediaQueryStyle):
1842         (WebCore::Style::ScopeRuleSets::appendAuthorStyleSheets):
1843         (WebCore::Style::ScopeRuleSets::collectFeatures const):
1844         (WebCore::Style::ScopeRuleSets::classInvalidationRuleSets const):
1845         (WebCore::Style::ScopeRuleSets::attributeInvalidationRuleSets const):
1846         (WebCore::Style::ScopeRuleSets::hasComplexSelectorsForStyleAttribute const):
1847         * style/StyleScopeRuleSets.h: Renamed from Source/WebCore/css/DocumentRuleSets.h.
1848         (WebCore::Style::ScopeRuleSets::features const):
1849         (WebCore::Style::ScopeRuleSets::mutableFeatures):
1850         * style/StyleSharingResolver.cpp:
1851         (WebCore::Style::SharingResolver::SharingResolver):
1852         * style/StyleSharingResolver.h:
1853
1854 2019-11-18  Benjamin Nham  <nham@apple.com>
1855
1856         Delete unused visually non-empty methods from FrameView
1857         https://bugs.webkit.org/show_bug.cgi?id=204303
1858
1859         Reviewed by Zalan Bujtas.
1860
1861         FrameView's updateIsVisuallyNonEmpty and updateSignificantRenderedTextMilestoneIfNeeded
1862         methods are in its header, but aren't implemented or used. Remove them.
1863
1864         * page/FrameView.h:
1865
1866 2019-11-18  Simon Fraser  <simon.fraser@apple.com>
1867
1868         Fix alpha value rounding to match the CSS Color spec
1869         https://bugs.webkit.org/show_bug.cgi?id=203597
1870         <rdar://problem/56728546>
1871
1872         Reviewed by Tim Horton.
1873         
1874         The serialization of CSS color alpha values is described at https://drafts.csswg.org/cssom/#serializing-css-values,
1875         so implement that. Use 255 as the multiplication factor for float alpha values in the fast and slow
1876         parser code paths.
1877         
1878         Based on Chromium commit 13a86c2faeebcbc12dd4a7e8dea54318da635c19.
1879
1880         Tested by WPT and fast/css tests.
1881
1882         * css/parser/CSSParserFastPaths.cpp:
1883         (WebCore::parseColorIntOrPercentage):
1884         (WebCore::parseAlphaValue):
1885         * css/parser/CSSPropertyParserHelpers.cpp:
1886         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
1887         * platform/graphics/Color.cpp:
1888         (WebCore::Color::cssText const):
1889         * rendering/shapes/Shape.cpp:
1890         (WebCore::Shape::createRasterShape): Alpha rounding for shapes has to match alpha rounding for colors.
1891
1892 2019-11-18  Antti Koivisto  <antti@apple.com>
1893
1894         Move StyleResolver to Style namespace
1895         https://bugs.webkit.org/show_bug.cgi?id=204294
1896
1897         Reviewed by Zalan Bujtas.
1898
1899         Most subparts are already in Style namespace.
1900
1901         Also rename it to Style::Resolver and move files to WebCore/style subdirectory.
1902
1903         * Sources.txt:
1904         * WebCore.xcodeproj/project.pbxproj:
1905         * animation/KeyframeEffect.cpp:
1906         (WebCore::KeyframeEffect::updateBlendingKeyframes):
1907         * css/DOMCSSRegisterCustomProperty.cpp:
1908         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
1909         * css/DocumentRuleSets.cpp:
1910         (WebCore::DocumentRuleSets::DocumentRuleSets):
1911         (WebCore::DocumentRuleSets::collectRulesFromUserStyleSheets):
1912         (WebCore::DocumentRuleSets::appendAuthorStyleSheets):
1913         * css/DocumentRuleSets.h:
1914         * css/MediaQueryEvaluator.cpp:
1915         (WebCore::MediaQueryEvaluator::evaluate const):
1916         * css/MediaQueryEvaluator.h:
1917         * css/PageRuleCollector.h:
1918         (WebCore::PageRuleCollector::PageRuleCollector):
1919         * css/RuleSet.cpp:
1920         (WebCore::RuleSet::addChildRules):
1921         (WebCore::RuleSet::addRulesFromSheet):
1922         * css/RuleSet.h:
1923         * dom/Document.cpp:
1924         (WebCore::Document::userAgentShadowTreeStyleResolver):
1925         * dom/Document.h:
1926         * dom/Element.cpp:
1927         (WebCore::Element::styleResolver):
1928         (WebCore::Element::resolveStyle):
1929         (WebCore::Element::resolveCustomStyle):
1930         * dom/Element.h:
1931         * editing/EditingStyle.cpp:
1932         (WebCore::EditingStyle::mergeStyleFromRules):
1933         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
1934         (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
1935         * editing/FrameSelection.cpp:
1936         (WebCore::FrameSelection::focusedOrActiveStateChanged):
1937         * html/shadow/SliderThumbElement.cpp:
1938         (WebCore::SliderThumbElement::resolveCustomStyle):
1939         (WebCore::SliderContainerElement::resolveCustomStyle):
1940         * html/shadow/SliderThumbElement.h:
1941         * html/shadow/TextControlInnerElements.cpp:
1942         (WebCore::TextControlInnerContainer::resolveCustomStyle):
1943         (WebCore::TextControlInnerElement::resolveCustomStyle):
1944         (WebCore::TextControlInnerTextElement::resolveCustomStyle):
1945         (WebCore::TextControlPlaceholderElement::resolveCustomStyle):
1946         * html/shadow/TextControlInnerElements.h:
1947         * inspector/agents/InspectorCSSAgent.cpp:
1948         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
1949         (WebCore::InspectorCSSAgent::buildObjectForRule):
1950         (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
1951         * inspector/agents/InspectorCSSAgent.h:
1952         * page/DOMWindow.cpp:
1953         (WebCore::DOMWindow::getMatchedCSSRules const):
1954         * page/Page.cpp:
1955         (WebCore::Page::updateStyleAfterChangeInEnvironment):
1956         * page/animation/CompositeAnimation.cpp:
1957         (WebCore::CompositeAnimation::animate):
1958         * rendering/RenderTheme.h:
1959         * rendering/style/RenderStyle.cpp:
1960         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
1961         * rendering/style/RenderStyle.h:
1962         * style/StyleResolver.cpp: Renamed from Source/WebCore/css/StyleResolver.cpp.
1963         (WebCore::Style::Resolver::Resolver):
1964         (WebCore::Style::Resolver::addCurrentSVGFontFaceRules):
1965         (WebCore::Style::Resolver::appendAuthorStyleSheets):
1966         (WebCore::Style::Resolver::addKeyframeStyle):
1967         (WebCore::Style::Resolver::~Resolver):
1968         (WebCore::Style::Resolver::State::State):
1969         (WebCore::Style::Resolver::State::setStyle):
1970         (WebCore::Style::Resolver::State::setParentStyle):
1971         (WebCore::Style::Resolver::builderContext):
1972         (WebCore::Style::Resolver::styleForElement):
1973         (WebCore::Style::Resolver::styleForKeyframe):
1974         (WebCore::Style::Resolver::isAnimationNameValid):
1975         (WebCore::Style::Resolver::keyframeStylesForAnimation):
1976         (WebCore::Style::Resolver::pseudoStyleForElement):
1977         (WebCore::Style::Resolver::styleForPage):
1978         (WebCore::Style::Resolver::defaultStyleForElement):
1979         (WebCore::Style::Resolver::styleRulesForElement):
1980         (WebCore::Style::Resolver::pseudoStyleRulesForElement):
1981         (WebCore::Style::Resolver::invalidateMatchedDeclarationsCache):
1982         (WebCore::Style::Resolver::clearCachedDeclarationsAffectedByViewportUnits):
1983         (WebCore::Style::Resolver::applyMatchedProperties):
1984         (WebCore::Style::Resolver::addViewportDependentMediaQueryResult):
1985         (WebCore::Style::Resolver::hasMediaQueriesAffectedByViewportChange const):
1986         (WebCore::Style::Resolver::addAccessibilitySettingsDependentMediaQueryResult):
1987         (WebCore::Style::Resolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
1988         (WebCore::Style::Resolver::addAppearanceDependentMediaQueryResult):
1989         (WebCore::Style::Resolver::hasMediaQueriesAffectedByAppearanceChange const):
1990         * style/StyleResolver.h: Renamed from Source/WebCore/css/StyleResolver.h.
1991         (WebCore::Style::ElementStyle::ElementStyle):
1992         (WebCore::Style::Resolver::hasSelectorForAttribute const):
1993         (WebCore::Style::Resolver::hasSelectorForId const):
1994         * style/StyleScope.cpp:
1995         (WebCore::Style::Scope::resolver):
1996         (WebCore::Style::Scope::resolverIfExists):
1997         (WebCore::Style::Scope::analyzeStyleSheetChange):
1998         (WebCore::Style::invalidateHostAndSlottedStyleIfNeeded):
1999         (WebCore::Style::Scope::updateActiveStyleSheets):
2000         (WebCore::Style::Scope::updateResolver):
2001         (WebCore::Style::Scope::scheduleUpdate):
2002         (WebCore::Style::Scope::evaluateMediaQueriesForViewportChange):
2003         (WebCore::Style::Scope::evaluateMediaQueriesForAccessibilitySettingsChange):
2004         (WebCore::Style::Scope::evaluateMediaQueriesForAppearanceChange):
2005         (WebCore::Style::Scope::updateStyleResolver): Deleted.
2006         * style/StyleScope.h:
2007         * style/StyleSharingResolver.cpp:
2008         (WebCore::Style::elementHasDirectionAuto):
2009         * style/StyleTreeResolver.cpp:
2010         (WebCore::Style::TreeResolver::Scope::Scope):
2011         (WebCore::Style::TreeResolver::Scope::~Scope):
2012         (WebCore::Style::TreeResolver::styleForElement):
2013         (WebCore::Style::TreeResolver::resolveElement):
2014         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2015         (WebCore::Style::TreeResolver::resolve):
2016         * style/StyleTreeResolver.h:
2017         * svg/SVGElement.cpp:
2018         (WebCore::SVGElement::resolveCustomStyle):
2019         * svg/SVGElement.h:
2020         
2021 2019-11-18  Chris Dumez  <cdumez@apple.com>
2022
2023         REGRESSION (r252497): Multiple mediacapturefromelement tests are crashing on mac debug
2024         https://bugs.webkit.org/show_bug.cgi?id=204267
2025         <rdar://problem/57248130>
2026
2027         Reviewed by Eric Carlson.
2028
2029         No new tests, covered by fast/mediacapturefromelement/CanvasCaptureMediaStream-creation.html.
2030
2031         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2032         (WebCore::CanvasCaptureMediaStreamTrack::activeDOMObjectName const):
2033         (WebCore::CanvasCaptureMediaStreamTrack::clone):
2034         We were failing to call suspendIfNeeded() on the track after constructing it.
2035
2036         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2037         * Modules/mediastream/MediaStreamTrack.h:
2038
2039         * dom/ActiveDOMObject.cpp:
2040         (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const):
2041         Add logging when the suspendIfNeeded assertion fails to facilitate debugging such issues
2042         in the future.
2043
2044 2019-11-18  Zalan Bujtas  <zalan@apple.com>
2045
2046         [LFC][Invalidation] Force rebuild layout tree on tree mutation
2047         https://bugs.webkit.org/show_bug.cgi?id=204295
2048         <rdar://problem/57283650>
2049
2050         Reviewed by Antti Koivisto.
2051
2052         This should evolve into a fine grained tree invalidation. 
2053
2054         * rendering/updating/RenderTreeBuilder.cpp:
2055         (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
2056         (WebCore::RenderTreeBuilder::detachFromRenderElement):
2057         * rendering/updating/RenderTreeUpdater.cpp:
2058         (WebCore::RenderTreeUpdater::updateRendererStyle):
2059
2060 2019-11-18  Zalan Bujtas  <zalan@apple.com>
2061
2062         [LFC][Invalidation] Do not collect inline items multiple times
2063         https://bugs.webkit.org/show_bug.cgi?id=204296
2064         <rdar://problem/57283761>
2065
2066         Reviewed by Antti Koivisto.
2067
2068         When inline layout is preceded by preferred width computation, we don't need to re-collect the inline items again. 
2069
2070         * layout/inlineformatting/InlineFormattingContext.cpp:
2071         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2072         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
2073         (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
2074         (WebCore::Layout::InlineFormattingContext::collectInlineContent): Deleted.
2075         * layout/inlineformatting/InlineFormattingContext.h:
2076
2077 2019-11-18  Philippe Normand  <pnormand@igalia.com>
2078
2079         Unreviewed, fix build (again) for a11y disabled, after r252417.
2080
2081         * accessibility/AXObjectCache.h:
2082         (WebCore::AXObjectCache::rootObject):
2083
2084 2019-11-17  Ryosuke Niwa  <rniwa@webkit.org>
2085
2086         Focusing a shadow host which delegates focus should skip inner shadow hosts which delegate focus
2087         https://bugs.webkit.org/show_bug.cgi?id=203869
2088
2089         Reviewed by Antti Koivisto.
2090
2091         Fixed the bug that WebKit doesn't skip a shadow host with delegatesFocus set when looking for
2092         the first programatically focusable element.
2093
2094         Test: imported/w3c/web-platform-tests/shadow-dom/focus/focus-method-delegatesFocus.html
2095
2096         * dom/Element.cpp:
2097         (WebCore::shadowRootWithDelegatesFocus): Added.
2098         (WebCore::isProgramaticallyFocusable): Updated to return false on a shadow host with delegatesFocus.
2099         (WebCore::Element::focus): Don't move the focus if the shadow host only contains a focused element
2100         per https://github.com/w3c/webcomponents/issues/840.
2101
2102 2019-11-17  Zalan Bujtas  <zalan@apple.com>
2103
2104         [LFC] Move layout state initialization out of LayoutContext
2105         https://bugs.webkit.org/show_bug.cgi?id=204285
2106         <rdar://problem/57262858>
2107
2108         Reviewed by Antti Koivisto.
2109
2110         Move layout initialization to FrameViewLayoutContext::layoutUsingFormattingContext. This is now pretty close to
2111         what the final initialization will look like.
2112
2113         * layout/LayoutContext.cpp:
2114         (WebCore::Layout::initializeLayoutState): Deleted.
2115         (WebCore::Layout::LayoutContext::runLayout): Deleted.
2116         (WebCore::Layout::LayoutContext::runLayoutAndVerify): Deleted.
2117         (WebCore::Layout::LayoutContext::createLayoutState): Deleted.
2118         * layout/LayoutContext.h:
2119         (WebCore::Layout::LayoutContext::layoutState):
2120         * layout/LayoutState.cpp:
2121         (WebCore::Layout::LayoutState::LayoutState):
2122         * layout/LayoutState.h:
2123         (WebCore::Layout::LayoutState::root const):
2124         (WebCore::Layout::LayoutState::rootRenderer const):
2125         (WebCore::Layout::LayoutState::setQuirksMode):
2126         (WebCore::Layout::LayoutState::layoutBoxForRenderer const): Deleted.
2127         * layout/layouttree/LayoutTreeBuilder.cpp:
2128         (WebCore::Layout::LayoutTreeContent::LayoutTreeContent):
2129         (WebCore::Layout::TreeBuilder::buildLayoutTree):
2130         (WebCore::Layout::TreeBuilder::buildTree):
2131         (WebCore::Layout::TreeBuilder::createLayoutBox):
2132         (WebCore::Layout::printLayoutTreeForLiveDocuments):
2133         * layout/layouttree/LayoutTreeBuilder.h:
2134         (WebCore::Layout::LayoutTreeContent::rootLayoutBox const):
2135         (WebCore::Layout::LayoutTreeContent::rootLayoutBox):
2136         (WebCore::Layout::LayoutTreeContent::rootRenderer const):
2137         (WebCore::Layout::LayoutTreeContent::layoutBoxForRenderer):
2138         (WebCore::Layout::LayoutTreeContent::addLayoutBoxForRenderer):
2139         * page/FrameViewLayoutContext.cpp:
2140         (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
2141         (WebCore::FrameViewLayoutContext::invalidateLayoutTreeContent):
2142         * page/FrameViewLayoutContext.h:
2143         (WebCore::FrameViewLayoutContext::layoutTreeContent const):
2144         * rendering/updating/RenderTreeUpdater.cpp:
2145         (WebCore::RenderTreeUpdater::updateRendererStyle):
2146
2147 2019-11-17  Zalan Bujtas  <zalan@apple.com>
2148
2149         [LFC] Pass in the content area to LayoutContext::layout
2150         https://bugs.webkit.org/show_bug.cgi?id=204284
2151         <rdar://problem/57262690>
2152
2153         Reviewed by Antti Koivisto.
2154
2155         Note that we never layout the root box. It has to have an already computed geometry (in case of ICB, it's the view geometry).
2156
2157         * layout/LayoutContext.cpp:
2158         (WebCore::Layout::LayoutContext::layout):
2159         (WebCore::Layout::LayoutContext::runLayout):
2160         (WebCore::Layout::LayoutContext::runLayoutAndVerify):
2161         * layout/LayoutContext.h:
2162         * layout/layouttree/LayoutTreeBuilder.cpp:
2163         (WebCore::Layout::printLayoutTreeForLiveDocuments):
2164         * page/FrameViewLayoutContext.cpp:
2165         (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
2166
2167 2019-11-17  Zalan Bujtas  <zalan@apple.com>
2168
2169         [LFC][Out-of-flow] Collect out-of-flow boxes lazily
2170         https://bugs.webkit.org/show_bug.cgi?id=204282
2171         <rdar://problem/57259302>
2172
2173         Reviewed by Antti Koivisto.
2174
2175         Eventually we need to turn it into a register-self as boxes are being inserted.
2176
2177         * layout/FormattingContext.cpp:
2178         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
2179         (WebCore::Layout::FormattingContext::collectOutOfFlowDescendantsIfNeeded):
2180         * layout/FormattingContext.h:
2181         * layout/LayoutContext.cpp:
2182         (WebCore::Layout::initializeLayoutState):
2183
2184 2019-11-17  Zalan Bujtas  <zalan@apple.com>
2185
2186         [LFC][Invalidation] Add support for simple inline invalidation
2187         https://bugs.webkit.org/show_bug.cgi?id=204268
2188         <rdar://problem/57248995>
2189
2190         Reviewed by Antti Koivisto.
2191
2192         Eventually invalidateFormattingState() will take care of cleaning up the state based on the current InvalidationState.
2193
2194         * layout/blockformatting/BlockFormattingContext.cpp:
2195         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
2196         * layout/inlineformatting/InlineFormattingContext.cpp:
2197         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2198         (WebCore::Layout::InlineFormattingContext::invalidateFormattingState):
2199         * layout/inlineformatting/InlineFormattingContext.h:
2200         * layout/inlineformatting/InlineFormattingState.h:
2201         (WebCore::Layout::InlineFormattingState::resetInlineRuns):
2202
2203 2019-11-17  Zalan Bujtas  <zalan@apple.com>
2204
2205         [LFC][IFC] Optimize Line::isVisuallyEmpty for the most common inline content.
2206         https://bugs.webkit.org/show_bug.cgi?id=204259
2207         <rdar://problem/57243610>
2208
2209         Reviewed by Antti Koivisto.
2210
2211         Move the check on text content to the front.
2212
2213         * layout/inlineformatting/InlineLine.cpp:
2214         (WebCore::Layout::Line::isVisuallyEmpty const):
2215
2216 2019-11-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2217
2218         [iOS] [UIWKDocumentContext] Add the ability to request all marked text rects
2219         https://bugs.webkit.org/show_bug.cgi?id=204278
2220         <rdar://problem/56527803>
2221
2222         Reviewed by Tim Horton.
2223
2224         Mark a constructor as WEBCORE_EXPORT. See WebKit ChangeLog for more details.
2225
2226         * editing/TextIterator.h:
2227
2228 2019-11-16  Philippe Normand  <pnormand@igalia.com>
2229
2230         Unreviewed, rolling out r252526.
2231
2232         broke iOS and mac builds
2233
2234         Reverted changeset:
2235
2236         "Unreviewed, rolling out r252455."
2237         https://bugs.webkit.org/show_bug.cgi?id=204272
2238         https://trac.webkit.org/changeset/252526
2239
2240 2019-11-16  Commit Queue  <commit-queue@webkit.org>
2241
2242         Unreviewed, rolling out r252455.
2243         https://bugs.webkit.org/show_bug.cgi?id=204272
2244
2245         Broke a layout-test on iOS (Requested by aakashja_ on
2246         #webkit).
2247
2248         Reverted changeset:
2249
2250         "[Web Animations] Retargeted transitions targeting accelerated
2251         properties do not stop the original transition"
2252         https://bugs.webkit.org/show_bug.cgi?id=204116
2253         https://trac.webkit.org/changeset/252455
2254
2255 2019-11-15  Chris Dumez  <cdumez@apple.com>
2256
2257         REGRESSION (r252497): Multiple mediacapturefromelement tests are crashing on mac debug
2258         https://bugs.webkit.org/show_bug.cgi?id=204267
2259         <rdar://problem/57248130>
2260
2261         Reviewed by Alexey Proskuryakov.
2262
2263         Make sure the CanvasCaptureMediaStreamTrack factory function calls suspendIfNeeded()
2264         since the class inhehits ActiveDOMObject.
2265
2266         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2267         (WebCore::CanvasCaptureMediaStreamTrack::create):
2268
2269 2019-11-15  Eric Carlson  <eric.carlson@apple.com>
2270
2271         Don't use AVCapture on watchOS and tvOS
2272         https://bugs.webkit.org/show_bug.cgi?id=204254
2273         <rdar://problem/45508044>
2274
2275         Reviewed by Youenn Fablet.
2276
2277         * Configurations/FeatureDefines.xcconfig:
2278
2279 2019-11-15  Eric Carlson  <eric.carlson@apple.com>
2280
2281         [iOS] Audio capture fails when a track is unmuted
2282         https://bugs.webkit.org/show_bug.cgi?id=204202
2283         <rdar://problem/57005820>
2284
2285         Reviewed by Jer Noble.
2286
2287         No new tests, this fixes an API test broken by r252470.
2288
2289         * platform/mediastream/RealtimeMediaSource.cpp:
2290         (WebCore::RealtimeMediaSource::setMuted):
2291
2292 2019-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
2293
2294         [Apple] Enable variation fonts on all Apple platforms
2295         https://bugs.webkit.org/show_bug.cgi?id=198100
2296
2297         Reviewed by Simon Fraser.
2298
2299         * Configurations/FeatureDefines.xcconfig:
2300
2301 2019-11-15  Chris Fleizach  <cfleizach@apple.com>
2302
2303         AX: Update style of lambda in isolated tree
2304         https://bugs.webkit.org/show_bug.cgi?id=204233
2305         <rdar://problem/57232085>
2306
2307         Reviewed by Darin Adler.
2308
2309         Remove unnecessary & capture and Optional<AXID>.
2310
2311         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
2312         (WebCore::AXIsolatedObject::initializeAttributeData):
2313         (WebCore::AXIsolatedObject::objectAttributeValue const):
2314         (WebCore::AXIsolatedObject::rectAttributeValue const):
2315         (WebCore::AXIsolatedObject::doubleAttributeValue const):
2316         (WebCore::AXIsolatedObject::unsignedAttributeValue const):
2317         (WebCore::AXIsolatedObject::boolAttributeValue const):
2318         (WebCore::AXIsolatedObject::stringAttributeValue const):
2319         (WebCore::AXIsolatedObject::intAttributeValue const):
2320
2321 2019-11-15  Jer Noble  <jer.noble@apple.com>
2322
2323         CRASH in SourceBuffer::removeCodedFrames()
2324         https://bugs.webkit.org/show_bug.cgi?id=204248
2325
2326         Reviewed by Eric Carlson.
2327
2328         Speculative fix for rare crash. It's possible that the startTime and endTime inputs to
2329         removeCodedFrames() are out-of-order, which could lead to iterating off the end of the
2330         SampleMap. Verify that startTime < endTime and bail out early if not true.
2331
2332         * Modules/mediasource/SourceBuffer.cpp:
2333         (WebCore::SourceBuffer::removeCodedFrames):
2334
2335 2019-11-14  Ryosuke Niwa  <rniwa@webkit.org>
2336
2337         JS wrappers of scroll event targets can get prematurely collected by GC
2338         https://bugs.webkit.org/show_bug.cgi?id=204219
2339
2340         Reviewed by Keith Miller.
2341
2342         This patch addresses the bug that the JS wrappers of the pending scroll event targets can be
2343         collected by GC before scroll events are fired. This bug has always existed but it's worse after
2344         r252205 because there is more of a time delay between an element is scrolled in RenderLayer sense
2345         and when the corresponding scroll event is fired on the element.
2346
2347         Fixed the bug by using GCReachableRef to store the pending scroll event targets introduced in r252205
2348         to keep the JS wrappers of those elements & document alive.
2349
2350         Test: fast/scrolling/scrolling-event-target-gc.html
2351
2352         * dom/Document.cpp:
2353         (WebCore::Document::PendingScrollEventTargetList): Added. Wraps Vector<GCReachableRef<ContainerNode>>
2354         to avoid including GCReachableRef.h in Document.h.
2355         (WebCore::Document::commonTeardown): Clear m_pendingScrollEventTargetList to avoid document leaks.
2356         (WebCore::Document::addPendingScrollEventTarget):
2357         (WebCore::Document::runScrollSteps):
2358         * dom/Document.h:
2359
2360 2019-11-15  Jer Noble  <jer.noble@apple.com>
2361
2362         Unreviewed Mojave build fix after r252501; wrap calls to AVContentKeyRequest.options in
2363         ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN / ALLOW_NEW_API_WITHOUT_GUARDS_END.
2364
2365         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2366         (WebCore::initTypeForRequest):
2367         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
2368
2369 2019-11-15  Jer Noble  <jer.noble@apple.com>
2370
2371         REGRESSION(r251895) - 'sinf' init data flow generates 'cenc' style encrypted messages
2372         https://bugs.webkit.org/show_bug.cgi?id=204239
2373         <rdar://problem/57166445>
2374
2375         Reviewed by Eric Carlson.
2376
2377         Track what kind of initialization data was used for a given AVContentKeyRequest, and
2378         generate that initialiazation data type of MediaKeySession message.
2379
2380         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2381         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2382         (WebCore::keyIDsForRequest):
2383         (WebCore::initTypeForRequest):
2384         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
2385         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
2386         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
2387         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
2388         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
2389         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
2390         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
2391         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
2392         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
2393         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::lastKeyRequest const):
2394         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
2395
2396 2019-11-15  Chris Dumez  <cdumez@apple.com>
2397
2398         Regression: http/tests/navigation/page-cache-getUserMedia-pending-promise.html is crashing in Debug
2399         https://bugs.webkit.org/show_bug.cgi?id=204232
2400
2401         Reviewed by Eric Carlson.
2402
2403         No new tests, covered by http/tests/navigation/page-cache-getUserMedia-pending-promise.html.
2404
2405         * Modules/mediastream/MediaStreamTrack.cpp:
2406         (WebCore::MediaStreamTrack::create):
2407         (WebCore::MediaStreamTrack::MediaStreamTrack):
2408         Call suspendIfNeeded() in the factory and not in the constructor. It is never safe to call
2409         suspendIfNeeded() from inside the constructor because it may call the suspend() method, which
2410         may ref |this|.
2411
2412         * Modules/mediastream/UserMediaRequest.cpp:
2413         (WebCore::UserMediaRequest::allow):
2414         Queue a task on the HTML event loop when the user media request is approved. This way, if the
2415         page is suspended when this happens, we delay constructing the media stream (among other things)
2416         until the page actually resumes.
2417
2418 2019-11-15  Zalan Bujtas  <zalan@apple.com>
2419
2420         [LFC][Invalidation] Reuse FrameViewLayoutContext::m_layoutState for incremental layout
2421         https://bugs.webkit.org/show_bug.cgi?id=204225
2422         <rdar://problem/57227259>
2423
2424         Reviewed by Antti Koivisto.
2425
2426         Let's rely on the invalidation logic instead of reconstructing the layout state on each layout frame. 
2427
2428         * layout/LayoutContext.cpp:
2429         (WebCore::Layout::initializeLayoutState):
2430         (WebCore::Layout::LayoutContext::runLayoutAndVerify):
2431         (WebCore::Layout::LayoutContext::createLayoutState):
2432         * layout/LayoutContext.h:
2433         * layout/LayoutState.h:
2434         (WebCore::Layout::LayoutState::rootRenderer const):
2435         * layout/Verification.cpp:
2436         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
2437         * page/FrameView.cpp:
2438         (WebCore::FrameView::paintContents):
2439         * page/FrameViewLayoutContext.cpp:
2440         (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
2441         * page/FrameViewLayoutContext.h:
2442         (WebCore::FrameViewLayoutContext::layoutFormattingState const):
2443         (WebCore::FrameViewLayoutContext::initialLayoutState const): Deleted.
2444         * rendering/updating/RenderTreeUpdater.cpp:
2445         (WebCore::RenderTreeUpdater::updateRendererStyle):
2446
2447 2019-11-15  Simon Fraser  <simon.fraser@apple.com>
2448
2449         The image is flashing if falls out and has an animation transform: rotate
2450         https://bugs.webkit.org/show_bug.cgi?id=203613
2451
2452         Reviewed by Antti Koivisto.
2453         
2454         Code added in r218735 that maps the animation extent through the current animating transform
2455         worked for translations, but not rotation where anchor point matters. This matrix
2456         needs to take anchor point into account.
2457
2458         Shared some code that applies anchor point to a matrix.
2459
2460         Test: compositing/backing/backing-store-attachment-with-rotation.html
2461
2462         * platform/graphics/ca/GraphicsLayerCA.cpp:
2463         (WebCore::GraphicsLayerCA::layerTransform const):
2464         (WebCore::GraphicsLayerCA::transformByApplyingAnchorPoint const):
2465         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2466         * platform/graphics/ca/GraphicsLayerCA.h:
2467
2468 2019-11-15  Zalan Bujtas  <zalan@apple.com>
2469
2470         [LFC][Invalidation] Introduce LayoutBox::updateStyle
2471         https://bugs.webkit.org/show_bug.cgi?id=204224
2472         <rdar://problem/57226354>
2473
2474         Reviewed by Antti Koivisto.
2475
2476         This is in preparation for being able to do incremental layouts on partial style change (currently we re-build the tree on each layout frame).
2477
2478         * layout/LayoutState.h:
2479         (WebCore::Layout::LayoutState::layoutBoxForRenderer const):
2480         * layout/layouttree/LayoutBox.cpp:
2481         (WebCore::Layout::Box::updateStyle):
2482         * layout/layouttree/LayoutBox.h:
2483         * rendering/updating/RenderTreeUpdater.cpp:
2484         (WebCore::RenderTreeUpdater::updateRendererStyle):
2485
2486 2019-11-15  Zalan Bujtas  <zalan@apple.com>
2487
2488         [LFC][Invalidation] Add a temporary RenderObject to Layout::Box map
2489         https://bugs.webkit.org/show_bug.cgi?id=204218
2490         <rdar://problem/57215201>
2491
2492         Reviewed by Antti Koivisto.
2493
2494         LayoutTreeContent::renderObjectToLayoutBox map enables us to find the associated Layout::Box when style changes on a renderer.
2495         This is temporary until after we implement fully integrate LFC with the style system.
2496
2497         * layout/LayoutContext.cpp:
2498         (WebCore::Layout::LayoutContext::runLayoutAndVerify):
2499         * layout/LayoutState.cpp:
2500         (WebCore::Layout::LayoutState::LayoutState):
2501         * layout/LayoutState.h:
2502         (WebCore::Layout::LayoutState::root const):
2503         * layout/blockformatting/BlockFormattingContext.cpp:
2504         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
2505         * layout/layouttree/LayoutTreeBuilder.cpp:
2506         (WebCore::Layout::TreeBuilder::buildLayoutTree):
2507         (WebCore::Layout::LayoutTreeContent::LayoutTreeContent):
2508         (WebCore::Layout::TreeBuilder::TreeBuilder):
2509         (WebCore::Layout::TreeBuilder::buildTree):
2510         (WebCore::Layout::TreeBuilder::createLayoutBox):
2511         (WebCore::Layout::TreeBuilder::buildTableStructure):
2512         (WebCore::Layout::TreeBuilder::buildSubTree):
2513         (WebCore::Layout::printLayoutTreeForLiveDocuments):
2514         (WebCore::Layout::TreeBuilder::createLayoutTree): Deleted.
2515         (WebCore::Layout::TreeBuilder::createTableStructure): Deleted.
2516         (WebCore::Layout::TreeBuilder::createSubTree): Deleted.
2517         * layout/layouttree/LayoutTreeBuilder.h:
2518
2519 2019-11-15  Rob Buis  <rbuis@igalia.com>
2520
2521         IDL: remove [PrimaryGlobal]
2522         https://bugs.webkit.org/show_bug.cgi?id=180469
2523
2524         Reviewed by Sam Weinig.
2525
2526         Remove support for [PrimaryGlobal] from the code
2527         generator and the existing IDL.
2528
2529         * bindings/scripts/CodeGeneratorJS.pm:
2530         (IsGlobalOrPrimaryGlobalInterface):
2531         * page/DOMWindow.idl:
2532         * page/RemoteDOMWindow.idl:
2533
2534 2019-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2535
2536         Crash when setting HTMLInputElement.checked for a disconnected radio button in a shadow root
2537         https://bugs.webkit.org/show_bug.cgi?id=204208
2538         <rdar://problem/57045830>
2539
2540         Reviewed by Tim Horton.
2541
2542         r251110 refactored logic in RadioButtonGroup::updateCheckedState, such that it assumes that m_nameToGroupMap
2543         always contains an entry for the given input element's name. Prior to r251110, it would bail if m_nameToGroupMap
2544         didn't exist. In this particular case, a named input element is added to a shadow root that is disconnected from
2545         the document. This means that in HTMLInputElement::didFinishInsertingNode(), we will avoid adding the element to
2546         the radio button group, even though it has a tree scope due to the `isConnected()` check.
2547
2548         Later, when we try to set the `checked` attribute, we invoke updateCheckedState which sees that we have a tree
2549         scope and assumes that we must have previously added the input element to the radio button map; this leads to a
2550         nullptr deref, as the map is empty. Thus, to fix this, we change the `isConnected()` check to `isInTreeScope()`.
2551
2552         Test: fast/forms/radio-input-in-shadow-root-crash.html
2553
2554         * html/HTMLInputElement.cpp:
2555         (WebCore::HTMLInputElement::didFinishInsertingNode):
2556
2557 2019-11-14  Jiewen Tan  <jiewen_tan@apple.com>
2558
2559         Unreviewed, update the feature status of WebAuthn
2560
2561         * features.json:
2562
2563 2019-11-07  Youenn Fablet  <youenn@apple.com> and Thibault Saunier <tsaunier@igalia.com>
2564
2565         Update libwebrtc to M78
2566         https://bugs.webkit.org/show_bug.cgi?id=203897
2567
2568         Reviewed by Eric Carlson.
2569
2570         Update include paths and binding code.
2571         Covered by existing tests.
2572
2573         * Modules/mediastream/RTCStatsReport.idl:
2574         Removed no longer standard codec stat.
2575         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
2576         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2577         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2578         (WebCore::LibWebRTCMediaEndpoint::setConfiguration):
2579         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2580         * Modules/mediastream/libwebrtc/LibWebRTCObservers.h:
2581         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
2582         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2583         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
2584         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
2585         (WebCore::fillInboundRTPStreamStats):
2586         (WebCore::fillOutboundRTPStreamStats):
2587         (WebCore::fillRTCCodecStats):
2588         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h:
2589         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2590         * platform/mediastream/RealtimeIncomingAudioSource.h:
2591         * platform/mediastream/RealtimeIncomingVideoSource.h:
2592         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2593         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2594         * platform/mediastream/gstreamer/GStreamerCapturer.cpp:
2595         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2596         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h:
2597         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
2598         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2599         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2600         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h:
2601         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2602         (WebCore::BasicPacketSocketFactory::CreateClientTcpSocket):
2603         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2604         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2605         * testing/MockLibWebRTCPeerConnection.cpp:
2606         * testing/MockLibWebRTCPeerConnection.h:
2607
2608 2019-11-14  Eric Carlson  <eric.carlson@apple.com>
2609
2610         [iOS] Audio capture fails when a track is unmuted
2611         https://bugs.webkit.org/show_bug.cgi?id=204202
2612         <rdar://problem/57005820>
2613
2614         Reviewed by Youenn Fablet.
2615
2616         Tested manually.
2617
2618         * platform/audio/PlatformMediaSession.cpp:
2619         (WebCore::PlatformMediaSession::canProduceAudioChanged): Remove unused "client" parameter.
2620         * platform/audio/PlatformMediaSessionManager.cpp:
2621         (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
2622         * platform/audio/PlatformMediaSessionManager.h:
2623
2624         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
2625         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
2626         (MediaSessionManagerCocoa::sessionCanProduceAudioChanged): Ditto.
2627
2628         * platform/mediastream/RealtimeMediaSource.cpp:
2629         (WebCore::RealtimeMediaSource::setMuted): Change m_muted before calling start/stop so the
2630         muted method will return the correct value.
2631
2632         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2633         (WebCore::CoreAudioSharedUnit::startInternal): Call sessionCanProduceAudioChanged before
2634         starting the audio unit so the audio session category is set correctly. ASSERT if the
2635         audio session category is incorrect.
2636         
2637         * platform/mock/MockRealtimeAudioSource.cpp:
2638         (WebCore::MockRealtimeAudioSource::startProducingData): Ditto.
2639
2640 2019-11-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2641
2642         The CSSParser should not consume negative or unit-less lengths for the SVG properties 'r', 'rx' and 'ry'
2643         https://bugs.webkit.org/show_bug.cgi?id=204200
2644
2645         Reviewed by Simon Fraser.
2646
2647         Both the CSSParser and SVGElement::parseAttribute() should be consistent
2648         when parsing these properties.
2649
2650         The type of these properties is <length-percentage>, which requires specifying
2651         the unit for the length: https://www.w3.org/TR/css-values/#length-value.
2652
2653         * css/parser/CSSParserFastPaths.cpp:
2654         (WebCore::isSimpleLengthPropertyID):
2655         * css/parser/CSSPropertyParser.cpp:
2656         (WebCore::consumeRxOrRy):
2657         (WebCore::CSSPropertyParser::parseSingleValue):
2658
2659 2019-11-14  Zalan Bujtas  <zalan@apple.com>
2660
2661         [LFC][Invalidation] Skip non-dirty out-of-flow boxes.
2662         https://bugs.webkit.org/show_bug.cgi?id=204196
2663
2664         Reviewed by Antti Koivisto.
2665
2666         Use the InvalidationState to decide whether the current out-of-flow box needs layout.
2667
2668         * layout/FormattingContext.cpp:
2669         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
2670
2671 2019-11-14  Antoine Quint  <graouts@apple.com>
2672
2673         [Web Animations] Accelerated transitions do not always remove their backing accelerated animation
2674         https://bugs.webkit.org/show_bug.cgi?id=204198
2675         <rdar://problem/45847205>
2676
2677         Reviewed by Dean Jackson.
2678
2679         Test: webanimations/accelerated-animation-removal-upon-transition-completion.html
2680
2681         There could be several calls to KeyframeEffect::updateAcceleratedAnimationState() made after an animation had completed but
2682         before any pending accelerated actions would be processed during the next animation frame. In the first call, we would correctly
2683         set add Accelerated::Stop to the list of pending accelerated actions, but on a further call, wrongly assuming that the fact that
2684         we'd already recorded an Accelerated::Stop action meant that it had been committed, we would clear that action and the animation
2685         would never be explicitly removed.
2686
2687         Additionally, we would schedule animation resolution on the DocumentTimeline in the wrong function, we now do that in the function
2688         where animations with an effect pending accelerated actions is added rather than in the function where we track which elements have
2689         accelerated animations.
2690
2691         * animation/DocumentTimeline.cpp:
2692         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
2693         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
2694         * animation/KeyframeEffect.cpp:
2695         (WebCore::KeyframeEffect::updateAcceleratedAnimationState):
2696
2697 2019-11-14  Zalan Bujtas  <zalan@apple.com>
2698
2699         [LFC][Invalidation] Use InvalidationState to populate LayoutQueue
2700         https://bugs.webkit.org/show_bug.cgi?id=204191
2701         <rdar://problem/57179614>
2702
2703         Reviewed by Antti Koivisto.
2704
2705         Start using the InvalidationState in BlockFormattingContext::layoutInFlowContent() to filter out
2706         non-dirty boxes (currently InvalidationState returns true for every box).
2707
2708         * layout/FormattingContext.cpp:
2709         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
2710         * layout/FormattingContext.h: InvalidationState should not be const as we keep adding additional dirty boxes during layout.
2711         * layout/LayoutContext.cpp:
2712         (WebCore::Layout::LayoutContext::layout):
2713         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
2714         * layout/LayoutContext.h:
2715         * layout/blockformatting/BlockFormattingContext.cpp:
2716         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
2717         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
2718         * layout/blockformatting/BlockFormattingContext.h:
2719         * layout/inlineformatting/InlineFormattingContext.cpp:
2720         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2721         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
2722         * layout/inlineformatting/InlineFormattingContext.h:
2723         * layout/invalidation/InvalidationState.cpp:
2724         (WebCore::Layout::InvalidationState::needsLayout const):
2725         * layout/invalidation/InvalidationState.h:
2726         * layout/tableformatting/TableFormattingContext.cpp:
2727         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
2728         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
2729         * layout/tableformatting/TableFormattingContext.h:
2730
2731 2019-11-14  Chris Fleizach  <cfleizach@apple.com>
2732
2733         AX: Implement isolated tree support for math objects
2734         https://bugs.webkit.org/show_bug.cgi?id=204056
2735         <rdar://problem/57054644>
2736
2737         Reviewed by Zalan Bujtas.
2738
2739         Implement isolated tree support for math objects.
2740         Add a method for setting and getting objects.
2741
2742         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
2743         (WebCore::AXIsolatedObject::AXIsolatedObject):
2744         (WebCore::AXIsolatedObject::create):
2745         (WebCore::AXIsolatedObject::initializeAttributeData):
2746         (WebCore::AXIsolatedObject::setObjectProperty):
2747         (WebCore::AXIsolatedObject::objectAttributeValue const):
2748         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
2749
2750 2019-11-14  Antoine Quint  <graouts@apple.com>
2751
2752         [Web Animations] Retargeted transitions targeting accelerated properties do not stop the original transition
2753         https://bugs.webkit.org/show_bug.cgi?id=204116
2754         <rdar://problem/57116961>
2755
2756         Reviewed by Dean Jackson.
2757
2758         Test: webanimations/css-transition-in-flight-reversal-accelerated.html
2759
2760         There were two problems with the reversal of in-flight transitions targeting accelerated properties. The first issue
2761         was that the animated value for the accelerated property would be missing from the before-change style since animating
2762         acceelerated properties do not update RenderStyle while running. As such, we would not detect the need to reverse a
2763         transition, but rather simply cancel the initial transition with no new transition to reverse its effect, since the
2764         value in the before-change and after-change styles were the same. We now fix this by figuring out whether the running
2765         transition for that property is accelerated in AnimationTimeline::updateCSSTransitionsForElementAndProperty() and
2766         applying the animated value to the before-change style.
2767
2768         The second issue was that canceling an accelerated transition had no visible effect since the accelerated animation
2769         was not stopped. We now have a new AnimationEffect::animationWasCanceled() virtual method which KeyframeEffect overrides
2770         to add AcceleratedAction::Stop to the list of pending acceleration actions for this effect. We also ensure that the document
2771         timeline knows to run DocumentTimeline::updateAnimationsAndSendEvents() if there are pending accelerated actions, even if
2772         there aren't any animations waiting to be resolved, since a single canceled transition would prevent this method from
2773         completing.
2774
2775         * animation/AnimationEffect.h:
2776         * animation/AnimationTimeline.cpp:
2777         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
2778         * animation/DocumentTimeline.cpp:
2779         (WebCore::DocumentTimeline::removeAnimation):
2780         (WebCore::DocumentTimeline::scheduleAnimationResolution):
2781         (WebCore::DocumentTimeline::shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState const):
2782         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
2783         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
2784         * animation/DocumentTimeline.h:
2785         * animation/KeyframeEffect.cpp:
2786         (WebCore::KeyframeEffect::animationWasCanceled):
2787         * animation/KeyframeEffect.h:
2788         * animation/WebAnimation.cpp:
2789         (WebCore::WebAnimation::cancel):
2790
2791 2019-11-13  Nikolas Zimmermann  <nzimmermann@igalia.com>
2792
2793         Fix GTK/WPE builds after enabling POINTER_EVENTS support
2794         https://bugs.webkit.org/show_bug.cgi?id=204164
2795
2796         Reviewed by Žan Doberšek.
2797
2798         Our g++ 8.3.0 yields "error: call to non-constexpr function
2799         WTFReportAssertionFailure" when compiling rendering/EventRegion.cpp
2800         since r252366.
2801
2802         Turn both toTouchAction() / toIndex() into static inline instead of
2803         constexpr functions to appease g++ 8.3.0.
2804
2805         * rendering/EventRegion.cpp:
2806         (WebCore::toIndex):
2807         (WebCore::toTouchAction):
2808
2809 2019-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2810
2811         [Clipboard API] Add support for Clipboard.write()
2812         https://bugs.webkit.org/show_bug.cgi?id=204078
2813         <rdar://problem/57087756>
2814
2815         Reviewed by Ryosuke Niwa.
2816
2817         This patch adds support for the write() method on Clipboard, forgoing sanitization for now (this will be added
2818         in the next patch). See below for more details.
2819
2820         Tests: editing/async-clipboard/clipboard-change-data-while-writing.html
2821                editing/async-clipboard/clipboard-write-basic.html
2822                editing/async-clipboard/clipboard-write-items-twice.html
2823
2824         * Modules/async-clipboard/Clipboard.cpp:
2825         (WebCore::Clipboard::~Clipboard):
2826         (WebCore::shouldProceedWithClipboardWrite):
2827         (WebCore::Clipboard::write):
2828
2829         Implement this method by creating a new ItemWriter and loading data from all the ClipboardItems that are being
2830         written. If the previous writer is still in progress, make sure that we invalidate it first (rejecting the
2831         promise) before proceeding.
2832
2833         (WebCore::Clipboard::didResolveOrReject):
2834         (WebCore::Clipboard::ItemWriter::ItemWriter):
2835         (WebCore::Clipboard::ItemWriter::write):
2836         (WebCore::Clipboard::ItemWriter::invalidate):
2837         (WebCore::Clipboard::ItemWriter::setData):
2838         (WebCore::Clipboard::ItemWriter::didSetAllData):
2839         (WebCore::Clipboard::ItemWriter::reject):
2840
2841         Introduce a private helper class to collect clipboard data for writing from a list of ClipboardItems, and
2842         resolve or reject the given promise when finished.
2843
2844         * Modules/async-clipboard/Clipboard.h:
2845         * platform/ios/PlatformPasteboardIOS.mm:
2846         (WebCore::createItemProviderRegistrationList):
2847
2848         Fix a stray bug where the empty string could not be read back as plain text or URLs from the platform pasteboard
2849         on iOS. This is exercised by the new layout test clipboard-write-basic.html.
2850
2851         * platform/mac/PlatformPasteboardMac.mm:
2852         (WebCore::PlatformPasteboard::write):
2853
2854         Address another issue where we would sometimes try and declare the empty string as a pasteboard type when
2855         writing to the platform pasteboard. While benign in a real NSPasteboard, there's no reason to include it in this
2856         list of declared pasteboard types.
2857
2858 2019-11-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
2859
2860         [SVG2] Add the 'orient' property of the interface SVGMarkerElement
2861         https://bugs.webkit.org/show_bug.cgi?id=203646
2862
2863         Reviewed by Simon Fraser.
2864
2865         This patch does the following:
2866
2867         1. Adding the 'orient' property of the interface SVGMarkerElement:
2868            The specs link is:
2869            https://www.w3.org/TR/SVG2/painting.html#InterfaceSVGMarkerElement
2870
2871         2. Keeping the pair properties <orientAngle, orientType> in sync when
2872            when one of them changes to keep them in consistent state.
2873
2874         3. Setting the value of SVGMarkerOrientAutoStartReverse: The specs
2875            https://www.w3.org/TR/SVG2/painting.html#__svg__SVGMarkerElement__orient
2876            says that when setting the 'orient' attribute to "auto-start-reverse",
2877            the value of orientType should be SVG_MARKER_ORIENT_UNKNOWN. Therefore
2878            SVGMarkerOrientAutoStartReverse has to be equal to SVGMarkerOrientUnknown.
2879
2880         * svg/SVGAngle.h:
2881         (WebCore::SVGAngle::unitType const):
2882         (WebCore::SVGAngle::valueForBindings const):
2883         (WebCore::SVGAngle::valueInSpecifiedUnits const):
2884         (WebCore::SVGAngle::unitType): Deleted.
2885         (WebCore::SVGAngle::valueForBindings): Deleted.
2886         (WebCore::SVGAngle::valueInSpecifiedUnits): Deleted.
2887         Make these functions const.
2888
2889         * svg/SVGElement.cpp:
2890         (WebCore::SVGElement::commitPropertyChange):
2891         Calling SVGPropertyRegistry::setAnimatedPropertDirty() to set the dirty
2892         flag of the animated  property through its accessor.
2893
2894         * svg/SVGMarkerElement.cpp:
2895         (WebCore::SVGMarkerElement::orient const):
2896         (WebCore::SVGMarkerElement::setOrient):
2897         Add the new property handlers.
2898
2899         (WebCore::SVGMarkerElement::setOrientToAuto):
2900         (WebCore::SVGMarkerElement::setOrientToAngle):
2901         Fix the bug of not setting the unitType of the SVGAngle in orientAngle.
2902
2903         * svg/SVGMarkerElement.h:
2904         Delete unused enum value SVG_MARKER_ORIENT_AUTOSTARTREVERSE.
2905
2906         * svg/SVGMarkerElement.idl:
2907
2908         * svg/SVGMarkerTypes.h:
2909         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
2910         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
2911         Fix the value of SVGMarkerOrientAutoStartReverse. No need for 
2912         highestExposedEnumValue() since all the enum values are now exposed.
2913
2914         * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
2915         Keep the pair properties <orientAngle, orientType> in sync.
2916
2917         * svg/properties/SVGMemberAccessor.h:
2918         (WebCore::SVGMemberAccessor::setDirty const):
2919         This is what SVGElement::commitPropertyChange() used to do for all properties.
2920
2921         * svg/properties/SVGPropertyOwnerRegistry.h:
2922         * svg/properties/SVGPropertyRegistry.h:
2923
2924 2019-11-13  Jer Noble  <jer.noble@apple.com>
2925
2926         Link mediaDataLoadsAutomatically setting to AutoplayPolicy
2927         https://bugs.webkit.org/show_bug.cgi?id=201738
2928         <rdar://problem/55315194>
2929
2930         Reviewed by Eric Carlson.
2931
2932         This change has two effects: on Mac, when the embedding app sets an AutoplayPolicy to
2933         deny autoplay, this will also deny the ability to load media data beyond "preload"; on iOS
2934         when the embedding app sets an AutoplayPolicy to allow autoplay, this will also allow media
2935         data to load beyond "preload".
2936
2937         * dom/Document.cpp:
2938         (WebCore::Document::mediaDataLoadsAutomatically const):
2939         * dom/Document.h:
2940         * html/HTMLMediaElement.cpp:
2941         (WebCore::HTMLMediaElement::finishInitialization):
2942         * html/MediaElementSession.cpp:
2943         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
2944
2945 2019-11-13  Devin Rousso  <drousso@apple.com>
2946
2947         Web Inspector: DOM.highlightSelector should work for "a:visited"
2948         https://bugs.webkit.org/show_bug.cgi?id=146161
2949         <rdar://problem/21467303>
2950
2951         Reviewed by Antti Koivisto.
2952
2953         * inspector/agents/InspectorDOMAgent.cpp:
2954         (WebCore::InspectorDOMAgent::highlightSelector):
2955         Rather than use `document.querySelectorAll`, which doesn't match pseudo-selectors, attempt
2956         to mimic how CSS actually matches nodes.
2957
2958         * rendering/style/RenderStyleConstants.h:
2959         (WebCore::PseudoIdSet::remove): Added.
2960
2961 2019-11-13  Myles C. Maxfield  <mmaxfield@apple.com>
2962
2963         [Mac] Fix build
2964         https://bugs.webkit.org/show_bug.cgi?id=204136
2965
2966         Reviewed by Alex Christensen.
2967
2968         Remove deprecation warnings.
2969
2970         * platform/ios/ScrollViewIOS.mm:
2971         (WebCore::ScrollView::platformSetCanBlitOnScroll):
2972         (WebCore::ScrollView::platformCanBlitOnScroll const):
2973         * platform/mac/ScrollViewMac.mm:
2974         (WebCore::ScrollView::platformSetCanBlitOnScroll):
2975         (WebCore::ScrollView::platformCanBlitOnScroll const):
2976         * platform/mac/WidgetMac.mm:
2977         (WebCore::Widget::paint):
2978         * rendering/RenderThemeMac.mm:
2979         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
2980         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
2981         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
2982         (WebCore::RenderThemeMac::systemColor const):
2983         (WebCore::paintAttachmentTitleBackground):
2984
2985 2019-11-13  Benjamin Nham  <nham@apple.com>
2986
2987         VeryHigh priority loads are actually loading at VeryLow priority
2988         https://bugs.webkit.org/show_bug.cgi?id=203423
2989         <rdar://problem/56621789>
2990
2991         Reviewed by Antti Koivisto.
2992
2993         There are two issues with the way we translate ResourceLoadPriority to
2994         CFURLRequestPriority:
2995
2996         1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few
2997         priority levels. This means VeryHigh priority loads are actually out
2998         of bounds, which causes CFNetwork to set the priority level back to 0
2999         in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
3000         call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
3001         levels.
3002
3003         2. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession
3004         right now (<rdar://problem/56621205>), so we have to map to the default
3005         number of CFURLRequestPriority levels, which is 4. Right now we have 5
3006         ResourceLoadPriority levels, so there will be some aliasing involved.
3007         After this patch VeryLow gets a priority of -1 and Low gets a priority
3008         of 0, but due to the aforementioned clamping behavior both VeryLow and
3009         Low will effectively both have a CFURLRequestPriority of 0.
3010
3011         * platform/network/cf/ResourceRequestCFNet.cpp:
3012         (WebCore::initializeMaximumHTTPConnectionCountPerHost):
3013         (WebCore::initializeHTTPConnectionSettingsOnStartup):
3014         * platform/network/cf/ResourceRequestCFNet.h:
3015         (WebCore::toResourceLoadPriority):
3016         (WebCore::toPlatformRequestPriority):
3017
3018 2019-11-13  Dean Jackson  <dino@apple.com>
3019
3020         Fix some WebGPU demos
3021         https://bugs.webkit.org/show_bug.cgi?id=204167
3022         <rdar://problem/57160316>
3023
3024         Reviewed by Myles C. Maxfield.
3025
3026         Add a note referencing a bug I detected while fixing this demo.
3027         And a drive-by typo.
3028
3029         * Modules/webgpu/WebGPUBuffer.cpp:
3030         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
3031         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
3032         (WebCore::GPUCommandBuffer::copyBufferToTexture):
3033
3034 2019-11-13  Antti Koivisto  <antti@apple.com>
3035
3036         Google Docs spreadsheet tiles render very slowly (because of event region painting)
3037         https://bugs.webkit.org/show_bug.cgi?id=204160
3038         <rdar://problem/57073401>
3039
3040         Reviewed by Simon Fraser.
3041
3042         Content of a overflow:scroll area on this page doesn't cover the entire scrollable area and we end
3043         up generating a complex shape for the event region. This is unnecessary as touches within scrollers
3044         always scroll the content.
3045
3046         Test: fast/scrolling/ios/event-region-scrolled-contents-layer.html
3047
3048         * rendering/RenderLayerBacking.cpp:
3049         (WebCore::RenderLayerBacking::updateEventRegion):
3050
3051         Initialize event region for scrolled contents layer with layer-sized event region. This optimizes away
3052         event region mutations. We still need to to do the event region paint to capture touch-action regions.
3053
3054         In future we should also improve Region type to not have pathological worst-case performance with complex
3055         shapes.
3056
3057 2019-11-13  Andres Gonzalez  <andresg_22@apple.com>
3058
3059         AXObjectCache::rootObject should generate the isolated tree.
3060         https://bugs.webkit.org/show_bug.cgi?id=204131
3061
3062         Reviewed by Chris Fleizach.
3063
3064         No new tests, no change in functionality.
3065
3066         AXObjectCache::rootObject now returns an AccessibilityObject or an
3067         IsolatedObject. This makes it possible for client code to use the
3068         isolated tree seamlessly, as long as the client call happens on a
3069         secondary thread. This allows WKTR AccessibilityController to use the
3070         isolated tree in LayoutTests.
3071         
3072         * accessibility/AXObjectCache.cpp:
3073         (WebCore::AXObjectCache::clientSupportsIsolatedTree):
3074         (WebCore::AXObjectCache::rootObject):
3075         (WebCore::AXObjectCache::createIsolatedTreeHierarchy):
3076         (WebCore::AXObjectCache::generateIsolatedTree):
3077         (WebCore::AXObjectCache::rootWebArea):
3078         (WebCore::AXObjectCache::createIsolatedAccessibilityTreeHierarchy): Renamed.
3079         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree): renamed.
3080         * accessibility/AXObjectCache.h:
3081
3082 2019-11-13  Zalan Bujtas  <zalan@apple.com>
3083
3084         [LFC][Invalidation] Introduce InvalidationState and Context
3085         https://bugs.webkit.org/show_bug.cgi?id=204140
3086         <rdar://problem/57142106>
3087
3088         Reviewed by Antti Koivisto.
3089
3090         InvalidationContext take style/content changes and turn them into "dirty layout boxes" (stored in InvalidationState).
3091         InvalidationState is the input to the (partial)subsequent layout.
3092
3093         * Sources.txt:
3094         * WebCore.xcodeproj/project.pbxproj:
3095         * layout/Invalidation.h: Removed.
3096         * layout/LayoutContext.cpp:
3097         (WebCore::Layout::LayoutContext::layout):
3098         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
3099         (WebCore::Layout::LayoutContext::runLayout):
3100         (WebCore::Layout::LayoutContext::styleChanged): Deleted.
3101         (WebCore::Layout::LayoutContext::markNeedsUpdate): Deleted.
3102         * layout/LayoutContext.h:
3103         (WebCore::Layout::LayoutContext::updateAll): Deleted.
3104         * layout/blockformatting/BlockInvalidation.cpp: Removed.
3105         * layout/blockformatting/BlockInvalidation.h: Removed.
3106         * layout/invalidation/InvalidationContext.cpp: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp.
3107         (WebCore::Layout::InvalidationContext::InvalidationContext):
3108         (WebCore::Layout::InvalidationContext::styleChanged):
3109         (WebCore::Layout::InvalidationContext::contentChanged):
3110         (WebCore::Layout::InvalidationContext::subtreeChanged):
3111         * layout/invalidation/InvalidationContext.h: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.h.
3112         * layout/invalidation/InvalidationState.cpp: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.cpp.
3113         (WebCore::Layout::InvalidationState::InvalidationState):
3114         (WebCore::Layout::InvalidationState::markNeedsUpdate):
3115         * layout/invalidation/InvalidationState.h: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.h.
3116         (WebCore::Layout::InvalidationState::formattingContextRoots const):
3117         * layout/layouttree/LayoutTreeBuilder.cpp:
3118         (WebCore::Layout::printLayoutTreeForLiveDocuments):
3119
3120 2019-11-13  Commit Queue  <commit-queue@webkit.org>
3121
3122         Unreviewed, rolling out r252402.
3123         https://bugs.webkit.org/show_bug.cgi?id=204157
3124
3125         This change broke the iOS and macOS build (Requested by
3126         aakashja_ on #webkit).
3127
3128         Reverted changeset:
3129
3130         "Unreviewed, fix GTK/WPE builds after enabling POINTER_EVENTS
3131         support."
3132         https://trac.webkit.org/changeset/252402
3133
3134 2019-11-13  Nikolas Zimmermann  <nzimmermann@igalia.com>
3135
3136         Unreviewed, fix GTK/WPE builds after enabling POINTER_EVENTS support.
3137
3138         Our g++ 8.3.0 yields "error: call to non-constexpr function
3139         WTFReportAssertionFailure" when compiling rendering/EventRegion.cpp
3140         since r252366.
3141
3142         Simply remove the ASSERT_NOT_REACHED() from toIndex(): a missing value
3143         in the switch statement will be caught by compiler warnings. Remove the
3144         constexpr flag from toTouchAction(): in this case, the
3145         ASSERT_NOT_REACHED() is useful and should stay.
3146
3147         Rubber-stamped by Philippe Normand.
3148
3149         * rendering/EventRegion.cpp:
3150         (WebCore::toIndex): Remove call to ASSERT_NOT_REACHED().
3151         (WebCore::toTouchAction): Keep ASSERT_NOT_REACHED(), removed constexpr.
3152
3153 2019-11-13  Philippe Normand  <pnormand@igalia.com>
3154
3155         Unreviewed, fix build for accessibility disabled.
3156
3157         * accessibility/AXObjectCache.h:
3158         (WebCore::AXObjectCache::focusedUIElementForPage):
3159         (WebCore::AXObjectCache::attachWrapper):
3160         (WebCore::AXObjectCache::postNotification):
3161         (WebCore::AXObjectCache::postPlatformNotification):
3162         (WebCore::AXObjectCache::characterOffsetForIndex):
3163         * accessibility/AccessibilityObject.h:
3164         (WebCore::AccessibilityObject::children):
3165         (WebCore::AccessibilityObject::updateBackingStore):
3166
3167 2019-11-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3168
3169         [GStreamer] Several issues while trying to play a video on NextCloud
3170         https://bugs.webkit.org/show_bug.cgi?id=203194
3171
3172         Reviewed by Philippe Normand.
3173
3174         First problem was the loader not being restarted in PAUSED, so
3175         sometimes playback never started since buffering never reached
3176         100%.
3177
3178         Then, after investigating blocksizes and not being a viable
3179         solution, reducing the 200_ms to 100_ms wait for new data was the
3180         trick to avoid choppyness.
3181
3182         During investigation several issues were fixed like turning
3183         GstQuery* into GRefPtr for MediaPlayerPrivateGStreamer::buffered,
3184         making blocksize unsigned instead of uint64_t as it is in
3185         GStreamer and creating and using WEBKIT_WEB_SRC_CAST since many
3186         uses of WEBKIT_WEB_SRC cast were already protected by
3187         WEBKIT_IS_WEB_SRC.
3188
3189         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3190         (WebCore::MediaPlayerPrivateGStreamer::buffered const): GRefPtr<GstQuery>.
3191         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3192         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup):
3193         (WebCore::MediaPlayerPrivateGStreamer::didPassCORSAccessCheck const):
3194         Use WEBKIT_WEB_SRC_CAST.
3195         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3196         (webKitWebSrcCreate): Reduce wait for data down to 100_ms and
3197         request download restart also in PAUSED.
3198         (CachedResourceStreamingClient::checkUpdateBlocksize): Turn
3199         blocksize to unsigned.
3200         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add
3201         WEBKIT_WEB_SRC_CAST.
3202
3203 2019-11-13  Rob Buis  <rbuis@igalia.com>
3204
3205         Support stale-while-revalidate cache strategy
3206         https://bugs.webkit.org/show_bug.cgi?id=201461
3207
3208         Reviewed by Youenn Fablet.
3209
3210         Start parsing the stale-while-revalidate Cache-Control directive
3211         and expose it on ResourceResponse.
3212
3213         Tests: imported/w3c/web-platform-tests/fetch/stale-while-revalidate/fetch-sw.https.html
3214                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/fetch.html
3215                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-css.html
3216                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-image.html
3217                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-script.html
3218
3219         * platform/network/CacheValidation.cpp:
3220         (WebCore::parseCacheControlDirectives):
3221         * platform/network/CacheValidation.h:
3222         * platform/network/ResourceResponseBase.cpp:
3223         (WebCore::ResourceResponseBase::cacheControlStaleWhileRevalidate const):
3224         * platform/network/ResourceResponseBase.h:
3225
3226 2019-11-12  Simon Fraser  <simon.fraser@apple.com>
3227
3228         Move CSSUnitType enum to its own file
3229         https://bugs.webkit.org/show_bug.cgi?id=204139
3230
3231         Reviewed by Antti Koivisto.
3232
3233         Pull CSSUnitType and CSSUnitCategory enums into their own file, since more future
3234         code will use them and not CSSPrimitiveValue.
3235
3236         * Headers.cmake:
3237         * Sources.txt:
3238         * WebCore.xcodeproj/project.pbxproj:
3239         * css/CSSPrimitiveValue.cpp:
3240         (WebCore::unitCategory): Deleted.
3241         * css/CSSPrimitiveValue.h:
3242         * css/CSSUnits.cpp: Added.
3243         (WebCore::unitCategory):
3244         * css/CSSUnits.h: Added.
3245
3246 2019-11-12  Simon Fraser  <simon.fraser@apple.com>
3247
3248         Convert CSSPrimitiveValue::UnitType to an enum class, and cleanup
3249         https://bugs.webkit.org/show_bug.cgi?id=204101
3250
3251         Reviewed by Antti Koivisto.
3252         
3253         Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
3254         CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
3255         use in calc() and in the CSS OM.
3256         
3257         Remove some comments about quirky units behavior which is now the standard behavior.
3258         
3259         The compiler warned about some units not handled in CSSPrimitiveValue::formatNumberForCustomCSSText()
3260         and CSSPrimitiveValue::equals() which may reveal bugs; assert for now.
3261
3262         * css/CSSCalculationValue.cpp:
3263         (WebCore::calcUnitCategory):
3264         (WebCore::hasDoubleValue):
3265         (WebCore::CSSCalcOperation::createSimplified):
3266         (WebCore::CSSCalcOperation::primitiveType const):
3267         (WebCore::CSSCalcExpressionNodeParser::parseValue):
3268         (WebCore::createBlendHalf):
3269         (WebCore::createCSS):
3270         (WebCore::unitCategory): Deleted.
3271         * css/CSSCalculationValue.h:
3272         * css/CSSComputedStyleDeclaration.cpp:
3273         (WebCore::valueForImageSliceSide):
3274         (WebCore::valueForNinePieceImageQuad):
3275         (WebCore::zoomAdjustedPixelValue):
3276         (WebCore::zoomAdjustedNumberValue):
3277         (WebCore::valueForReflection):
3278         (WebCore::percentageOrZoomAdjustedValue):
3279         (WebCore::matrixTransformValue):
3280         (WebCore::adjustLengthForZoom):
3281         (WebCore::ComputedStyleExtractor::valueForFilter):
3282         (WebCore::specifiedValueForGridTrackBreadth):
3283         (WebCore::specifiedValueForGridTrackSize):
3284         (WebCore::OrderedNamedLinesCollector::appendLines const):
3285         (WebCore::valueForGridPosition):
3286         (WebCore::createTransitionPropertyValue):
3287         (WebCore::delayValue):
3288         (WebCore::durationValue):
3289         (WebCore::textUnderlineOffsetToCSSValue):
3290         (WebCore::textDecorationThicknessToCSSValue):
3291         (WebCore::altTextToCSSValue):
3292         (WebCore::contentToCSSValue):
3293         (WebCore::counterToCSSValue):
3294         (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
3295         (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
3296         (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
3297         (WebCore::fontShorthandValueForSelectionProperties):
3298         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
3299         * css/CSSCrossfadeValue.cpp:
3300         (WebCore::CSSCrossfadeValue::blend const):
3301         * css/CSSCustomPropertyValue.cpp:
3302         (WebCore::CSSCustomPropertyValue::customCSSText const):
3303         * css/CSSFontFace.cpp:
3304         (WebCore::calculateItalicRange):
3305         * css/CSSFontStyleValue.h:
3306         * css/CSSGradientValue.cpp:
3307         (WebCore::compareStops):
3308         (WebCore::CSSGradientValue::computeStops):
3309         (WebCore::appendGradientStops):
3310         (WebCore::CSSLinearGradientValue::createGradient):
3311         (WebCore::CSSConicGradientValue::createGradient):
3312         * css/CSSImageValue.cpp:
3313         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const):
3314         * css/CSSPrimitiveValue.cpp:
3315         (WebCore::isValidCSSUnitTypeForDoubleConversion):
3316         (WebCore::isStringType):
3317         (WebCore::unitCategory):
3318         (WebCore::CSSPrimitiveValue::primitiveType const):
3319         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3320         (WebCore::CSSPrimitiveValue::init):
3321         (WebCore::CSSPrimitiveValue::cleanup):
3322         (WebCore::CSSPrimitiveValue::computeDegrees const):
3323         (WebCore::CSSPrimitiveValue::computeLengthDouble const):
3324         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
3325         (WebCore::CSSPrimitiveValue::setFloatValue):
3326         (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
3327         (WebCore::CSSPrimitiveValue::getFloatValue const):
3328         (WebCore::CSSPrimitiveValue::doubleValue const):
3329         (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
3330         (WebCore::CSSPrimitiveValue::doubleValueInternal const):
3331         (WebCore::CSSPrimitiveValue::setStringValue):
3332         (WebCore::CSSPrimitiveValue::getStringValue const):
3333         (WebCore::CSSPrimitiveValue::stringValue const):
3334         (WebCore:: const):
3335         (WebCore::CSSPrimitiveValue::getRGBColorValue const):
3336         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
3337         (WebCore::CSSPrimitiveValue::equals const):
3338         (WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const):
3339         (WebCore::CSSPrimitiveValue::collectDirectRootComputationalDependencies const):
3340         (WebCore::CSSPrimitiveValue::unitCategory): Deleted.
3341         * css/CSSPrimitiveValue.h:
3342         (WebCore::CSSPrimitiveValue::isAngle const):
3343         (WebCore::CSSPrimitiveValue::isFontRelativeLength):
3344         (WebCore::CSSPrimitiveValue::isLength):
3345         (WebCore::CSSPrimitiveValue::isResolution):
3346         (WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
3347         (WebCore::CSSPrimitiveValue::computeTime const):
3348         * css/CSSPrimitiveValueMappings.h:
3349         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3350         (WebCore::CSSPrimitiveValue::operator short const):
3351         (WebCore::CSSPrimitiveValue::operator unsigned short const):
3352         (WebCore::CSSPrimitiveValue::operator int const):
3353         (WebCore::CSSPrimitiveValue::operator unsigned const):
3354         (WebCore::CSSPrimitiveValue::operator float const):
3355         (WebCore::CSSPrimitiveValue::operator LineClampValue const):
3356         (WebCore::CSSPrimitiveValue::operator ColumnFill const):
3357         (WebCore::CSSPrimitiveValue::operator ColumnSpan const):
3358         (WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const):
3359         (WebCore::CSSPrimitiveValue::operator ImageOrientation const):
3360         * css/CSSStyleDeclaration.cpp:
3361         (WebCore::CSSStyleDeclaration::namedItem):
3362         * css/CSSToStyleMap.cpp:
3363         (WebCore::CSSToStyleMap::mapNinePieceImageSlice):
3364         (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
3365         * css/CSSValue.h:
3366         * css/CSSValuePool.cpp:
3367         (WebCore::CSSValuePool::CSSValuePool):
3368         (WebCore::CSSValuePool::createValue):
3369         * css/CSSValuePool.h:
3370         (WebCore::CSSValuePool::createValue):
3371         * css/DeprecatedCSSOMPrimitiveValue.cpp:
3372         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
3373         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
3374         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
3375         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
3376         * css/DeprecatedCSSOMPrimitiveValue.h:
3377         * css/DeprecatedCSSOMRGBColor.h:
3378         * css/MediaQueryEvaluator.cpp:
3379         (WebCore::doubleValue):
3380         (WebCore::evaluateResolution):
3381         * css/MediaQueryExpression.cpp:
3382         (WebCore::featureWithValidIdent):
3383         * css/SVGCSSComputedStyleDeclaration.cpp:
3384         (WebCore::glyphOrientationToCSSPrimitiveValue):
3385         (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
3386         (WebCore::ComputedStyleExtractor::svgPropertyValue):
3387         * css/StyleProperties.cpp:
3388         (WebCore::StyleProperties::asText const):
3389         * css/parser/CSSParserFastPaths.cpp:
3390         (WebCore::parseSimpleLength):
3391         (WebCore::parseSimpleAngle):
3392         (WebCore::parseSimpleLengthValue):
3393         (WebCore::parseColorIntOrPercentage):
3394         (WebCore::fastParseColorInternal):
3395         (WebCore::parseTransformTranslateArguments):
3396         (WebCore::parseTransformAngleArgument):
3397         (WebCore::parseTransformNumberArguments):
3398         * css/parser/CSSParserToken.cpp:
3399         (WebCore::cssPrimitiveValueUnitFromTrie):
3400         (WebCore::stringToUnitType):
3401         (WebCore::CSSParserToken::CSSParserToken):
3402         (WebCore::CSSParserToken::convertToPercentage):
3403         * css/parser/CSSParserToken.h:
3404         (WebCore::CSSParserToken::unitType const):
3405         * css/parser/CSSPropertyParser.cpp:
3406         (WebCore::CSSPropertyParser::consumeTransformOrigin):
3407         (WebCore::consumeFontStyle):
3408         (WebCore::consumeFontStyleRange):
3409         (WebCore::consumeCounter):
3410         (WebCore::consumeAnimationName):
3411         (WebCore::consumePerspective):
3412         (WebCore::consumePositionLonghand):
3413         (WebCore::consumeAttr):