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