Don't use AVCapture on watchOS and tvOS
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-11-15  Eric Carlson  <eric.carlson@apple.com>
2
3         Don't use AVCapture on watchOS and tvOS
4         https://bugs.webkit.org/show_bug.cgi?id=204254
5         <rdar://problem/45508044>
6
7         Reviewed by Youenn Fablet.
8
9         * Configurations/FeatureDefines.xcconfig:
10
11 2019-11-15  Eric Carlson  <eric.carlson@apple.com>
12
13         [iOS] Audio capture fails when a track is unmuted
14         https://bugs.webkit.org/show_bug.cgi?id=204202
15         <rdar://problem/57005820>
16
17         Reviewed by Jer Noble.
18
19         No new tests, this fixes an API test broken by r252470.
20
21         * platform/mediastream/RealtimeMediaSource.cpp:
22         (WebCore::RealtimeMediaSource::setMuted):
23
24 2019-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
25
26         [Apple] Enable variation fonts on all Apple platforms
27         https://bugs.webkit.org/show_bug.cgi?id=198100
28
29         Reviewed by Simon Fraser.
30
31         * Configurations/FeatureDefines.xcconfig:
32
33 2019-11-15  Chris Fleizach  <cfleizach@apple.com>
34
35         AX: Update style of lambda in isolated tree
36         https://bugs.webkit.org/show_bug.cgi?id=204233
37         <rdar://problem/57232085>
38
39         Reviewed by Darin Adler.
40
41         Remove unnecessary & capture and Optional<AXID>.
42
43         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
44         (WebCore::AXIsolatedObject::initializeAttributeData):
45         (WebCore::AXIsolatedObject::objectAttributeValue const):
46         (WebCore::AXIsolatedObject::rectAttributeValue const):
47         (WebCore::AXIsolatedObject::doubleAttributeValue const):
48         (WebCore::AXIsolatedObject::unsignedAttributeValue const):
49         (WebCore::AXIsolatedObject::boolAttributeValue const):
50         (WebCore::AXIsolatedObject::stringAttributeValue const):
51         (WebCore::AXIsolatedObject::intAttributeValue const):
52
53 2019-11-15  Jer Noble  <jer.noble@apple.com>
54
55         CRASH in SourceBuffer::removeCodedFrames()
56         https://bugs.webkit.org/show_bug.cgi?id=204248
57
58         Reviewed by Eric Carlson.
59
60         Speculative fix for rare crash. It's possible that the startTime and endTime inputs to
61         removeCodedFrames() are out-of-order, which could lead to iterating off the end of the
62         SampleMap. Verify that startTime < endTime and bail out early if not true.
63
64         * Modules/mediasource/SourceBuffer.cpp:
65         (WebCore::SourceBuffer::removeCodedFrames):
66
67 2019-11-14  Ryosuke Niwa  <rniwa@webkit.org>
68
69         JS wrappers of scroll event targets can get prematurely collected by GC
70         https://bugs.webkit.org/show_bug.cgi?id=204219
71
72         Reviewed by Keith Miller.
73
74         This patch addresses the bug that the JS wrappers of the pending scroll event targets can be
75         collected by GC before scroll events are fired. This bug has always existed but it's worse after
76         r252205 because there is more of a time delay between an element is scrolled in RenderLayer sense
77         and when the corresponding scroll event is fired on the element.
78
79         Fixed the bug by using GCReachableRef to store the pending scroll event targets introduced in r252205
80         to keep the JS wrappers of those elements & document alive.
81
82         Test: fast/scrolling/scrolling-event-target-gc.html
83
84         * dom/Document.cpp:
85         (WebCore::Document::PendingScrollEventTargetList): Added. Wraps Vector<GCReachableRef<ContainerNode>>
86         to avoid including GCReachableRef.h in Document.h.
87         (WebCore::Document::commonTeardown): Clear m_pendingScrollEventTargetList to avoid document leaks.
88         (WebCore::Document::addPendingScrollEventTarget):
89         (WebCore::Document::runScrollSteps):
90         * dom/Document.h:
91
92 2019-11-15  Jer Noble  <jer.noble@apple.com>
93
94         Unreviewed Mojave build fix after r252501; wrap calls to AVContentKeyRequest.options in
95         ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN / ALLOW_NEW_API_WITHOUT_GUARDS_END.
96
97         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
98         (WebCore::initTypeForRequest):
99         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
100
101 2019-11-15  Jer Noble  <jer.noble@apple.com>
102
103         REGRESSION(r251895) - 'sinf' init data flow generates 'cenc' style encrypted messages
104         https://bugs.webkit.org/show_bug.cgi?id=204239
105         <rdar://problem/57166445>
106
107         Reviewed by Eric Carlson.
108
109         Track what kind of initialization data was used for a given AVContentKeyRequest, and
110         generate that initialiazation data type of MediaKeySession message.
111
112         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
113         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
114         (WebCore::keyIDsForRequest):
115         (WebCore::initTypeForRequest):
116         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
117         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
118         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
119         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
120         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
121         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
122         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
123         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
124         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
125         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::lastKeyRequest const):
126         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
127
128 2019-11-15  Chris Dumez  <cdumez@apple.com>
129
130         Regression: http/tests/navigation/page-cache-getUserMedia-pending-promise.html is crashing in Debug
131         https://bugs.webkit.org/show_bug.cgi?id=204232
132
133         Reviewed by Eric Carlson.
134
135         No new tests, covered by http/tests/navigation/page-cache-getUserMedia-pending-promise.html.
136
137         * Modules/mediastream/MediaStreamTrack.cpp:
138         (WebCore::MediaStreamTrack::create):
139         (WebCore::MediaStreamTrack::MediaStreamTrack):
140         Call suspendIfNeeded() in the factory and not in the constructor. It is never safe to call
141         suspendIfNeeded() from inside the constructor because it may call the suspend() method, which
142         may ref |this|.
143
144         * Modules/mediastream/UserMediaRequest.cpp:
145         (WebCore::UserMediaRequest::allow):
146         Queue a task on the HTML event loop when the user media request is approved. This way, if the
147         page is suspended when this happens, we delay constructing the media stream (among other things)
148         until the page actually resumes.
149
150 2019-11-15  Zalan Bujtas  <zalan@apple.com>
151
152         [LFC][Invalidation] Reuse FrameViewLayoutContext::m_layoutState for incremental layout
153         https://bugs.webkit.org/show_bug.cgi?id=204225
154         <rdar://problem/57227259>
155
156         Reviewed by Antti Koivisto.
157
158         Let's rely on the invalidation logic instead of reconstructing the layout state on each layout frame. 
159
160         * layout/LayoutContext.cpp:
161         (WebCore::Layout::initializeLayoutState):
162         (WebCore::Layout::LayoutContext::runLayoutAndVerify):
163         (WebCore::Layout::LayoutContext::createLayoutState):
164         * layout/LayoutContext.h:
165         * layout/LayoutState.h:
166         (WebCore::Layout::LayoutState::rootRenderer const):
167         * layout/Verification.cpp:
168         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
169         * page/FrameView.cpp:
170         (WebCore::FrameView::paintContents):
171         * page/FrameViewLayoutContext.cpp:
172         (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
173         * page/FrameViewLayoutContext.h:
174         (WebCore::FrameViewLayoutContext::layoutFormattingState const):
175         (WebCore::FrameViewLayoutContext::initialLayoutState const): Deleted.
176         * rendering/updating/RenderTreeUpdater.cpp:
177         (WebCore::RenderTreeUpdater::updateRendererStyle):
178
179 2019-11-15  Simon Fraser  <simon.fraser@apple.com>
180
181         The image is flashing if falls out and has an animation transform: rotate
182         https://bugs.webkit.org/show_bug.cgi?id=203613
183
184         Reviewed by Antti Koivisto.
185         
186         Code added in r218735 that maps the animation extent through the current animating transform
187         worked for translations, but not rotation where anchor point matters. This matrix
188         needs to take anchor point into account.
189
190         Shared some code that applies anchor point to a matrix.
191
192         Test: compositing/backing/backing-store-attachment-with-rotation.html
193
194         * platform/graphics/ca/GraphicsLayerCA.cpp:
195         (WebCore::GraphicsLayerCA::layerTransform const):
196         (WebCore::GraphicsLayerCA::transformByApplyingAnchorPoint const):
197         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
198         * platform/graphics/ca/GraphicsLayerCA.h:
199
200 2019-11-15  Zalan Bujtas  <zalan@apple.com>
201
202         [LFC][Invalidation] Introduce LayoutBox::updateStyle
203         https://bugs.webkit.org/show_bug.cgi?id=204224
204         <rdar://problem/57226354>
205
206         Reviewed by Antti Koivisto.
207
208         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).
209
210         * layout/LayoutState.h:
211         (WebCore::Layout::LayoutState::layoutBoxForRenderer const):
212         * layout/layouttree/LayoutBox.cpp:
213         (WebCore::Layout::Box::updateStyle):
214         * layout/layouttree/LayoutBox.h:
215         * rendering/updating/RenderTreeUpdater.cpp:
216         (WebCore::RenderTreeUpdater::updateRendererStyle):
217
218 2019-11-15  Zalan Bujtas  <zalan@apple.com>
219
220         [LFC][Invalidation] Add a temporary RenderObject to Layout::Box map
221         https://bugs.webkit.org/show_bug.cgi?id=204218
222         <rdar://problem/57215201>
223
224         Reviewed by Antti Koivisto.
225
226         LayoutTreeContent::renderObjectToLayoutBox map enables us to find the associated Layout::Box when style changes on a renderer.
227         This is temporary until after we implement fully integrate LFC with the style system.
228
229         * layout/LayoutContext.cpp:
230         (WebCore::Layout::LayoutContext::runLayoutAndVerify):
231         * layout/LayoutState.cpp:
232         (WebCore::Layout::LayoutState::LayoutState):
233         * layout/LayoutState.h:
234         (WebCore::Layout::LayoutState::root const):
235         * layout/blockformatting/BlockFormattingContext.cpp:
236         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
237         * layout/layouttree/LayoutTreeBuilder.cpp:
238         (WebCore::Layout::TreeBuilder::buildLayoutTree):
239         (WebCore::Layout::LayoutTreeContent::LayoutTreeContent):
240         (WebCore::Layout::TreeBuilder::TreeBuilder):
241         (WebCore::Layout::TreeBuilder::buildTree):
242         (WebCore::Layout::TreeBuilder::createLayoutBox):
243         (WebCore::Layout::TreeBuilder::buildTableStructure):
244         (WebCore::Layout::TreeBuilder::buildSubTree):
245         (WebCore::Layout::printLayoutTreeForLiveDocuments):
246         (WebCore::Layout::TreeBuilder::createLayoutTree): Deleted.
247         (WebCore::Layout::TreeBuilder::createTableStructure): Deleted.
248         (WebCore::Layout::TreeBuilder::createSubTree): Deleted.
249         * layout/layouttree/LayoutTreeBuilder.h:
250
251 2019-11-15  Rob Buis  <rbuis@igalia.com>
252
253         IDL: remove [PrimaryGlobal]
254         https://bugs.webkit.org/show_bug.cgi?id=180469
255
256         Reviewed by Sam Weinig.
257
258         Remove support for [PrimaryGlobal] from the code
259         generator and the existing IDL.
260
261         * bindings/scripts/CodeGeneratorJS.pm:
262         (IsGlobalOrPrimaryGlobalInterface):
263         * page/DOMWindow.idl:
264         * page/RemoteDOMWindow.idl:
265
266 2019-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
267
268         Crash when setting HTMLInputElement.checked for a disconnected radio button in a shadow root
269         https://bugs.webkit.org/show_bug.cgi?id=204208
270         <rdar://problem/57045830>
271
272         Reviewed by Tim Horton.
273
274         r251110 refactored logic in RadioButtonGroup::updateCheckedState, such that it assumes that m_nameToGroupMap
275         always contains an entry for the given input element's name. Prior to r251110, it would bail if m_nameToGroupMap
276         didn't exist. In this particular case, a named input element is added to a shadow root that is disconnected from
277         the document. This means that in HTMLInputElement::didFinishInsertingNode(), we will avoid adding the element to
278         the radio button group, even though it has a tree scope due to the `isConnected()` check.
279
280         Later, when we try to set the `checked` attribute, we invoke updateCheckedState which sees that we have a tree
281         scope and assumes that we must have previously added the input element to the radio button map; this leads to a
282         nullptr deref, as the map is empty. Thus, to fix this, we change the `isConnected()` check to `isInTreeScope()`.
283
284         Test: fast/forms/radio-input-in-shadow-root-crash.html
285
286         * html/HTMLInputElement.cpp:
287         (WebCore::HTMLInputElement::didFinishInsertingNode):
288
289 2019-11-14  Jiewen Tan  <jiewen_tan@apple.com>
290
291         Unreviewed, update the feature status of WebAuthn
292
293         * features.json:
294
295 2019-11-07  Youenn Fablet  <youenn@apple.com> and Thibault Saunier <tsaunier@igalia.com>
296
297         Update libwebrtc to M78
298         https://bugs.webkit.org/show_bug.cgi?id=203897
299
300         Reviewed by Eric Carlson.
301
302         Update include paths and binding code.
303         Covered by existing tests.
304
305         * Modules/mediastream/RTCStatsReport.idl:
306         Removed no longer standard codec stat.
307         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
308         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
309         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
310         (WebCore::LibWebRTCMediaEndpoint::setConfiguration):
311         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
312         * Modules/mediastream/libwebrtc/LibWebRTCObservers.h:
313         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
314         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
315         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
316         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
317         (WebCore::fillInboundRTPStreamStats):
318         (WebCore::fillOutboundRTPStreamStats):
319         (WebCore::fillRTCCodecStats):
320         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h:
321         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
322         * platform/mediastream/RealtimeIncomingAudioSource.h:
323         * platform/mediastream/RealtimeIncomingVideoSource.h:
324         * platform/mediastream/RealtimeOutgoingAudioSource.h:
325         * platform/mediastream/RealtimeOutgoingVideoSource.h:
326         * platform/mediastream/gstreamer/GStreamerCapturer.cpp:
327         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
328         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h:
329         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
330         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
331         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
332         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h:
333         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
334         (WebCore::BasicPacketSocketFactory::CreateClientTcpSocket):
335         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
336         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
337         * testing/MockLibWebRTCPeerConnection.cpp:
338         * testing/MockLibWebRTCPeerConnection.h:
339
340 2019-11-14  Eric Carlson  <eric.carlson@apple.com>
341
342         [iOS] Audio capture fails when a track is unmuted
343         https://bugs.webkit.org/show_bug.cgi?id=204202
344         <rdar://problem/57005820>
345
346         Reviewed by Youenn Fablet.
347
348         Tested manually.
349
350         * platform/audio/PlatformMediaSession.cpp:
351         (WebCore::PlatformMediaSession::canProduceAudioChanged): Remove unused "client" parameter.
352         * platform/audio/PlatformMediaSessionManager.cpp:
353         (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
354         * platform/audio/PlatformMediaSessionManager.h:
355
356         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
357         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
358         (MediaSessionManagerCocoa::sessionCanProduceAudioChanged): Ditto.
359
360         * platform/mediastream/RealtimeMediaSource.cpp:
361         (WebCore::RealtimeMediaSource::setMuted): Change m_muted before calling start/stop so the
362         muted method will return the correct value.
363
364         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
365         (WebCore::CoreAudioSharedUnit::startInternal): Call sessionCanProduceAudioChanged before
366         starting the audio unit so the audio session category is set correctly. ASSERT if the
367         audio session category is incorrect.
368         
369         * platform/mock/MockRealtimeAudioSource.cpp:
370         (WebCore::MockRealtimeAudioSource::startProducingData): Ditto.
371
372 2019-11-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
373
374         The CSSParser should not consume negative or unit-less lengths for the SVG properties 'r', 'rx' and 'ry'
375         https://bugs.webkit.org/show_bug.cgi?id=204200
376
377         Reviewed by Simon Fraser.
378
379         Both the CSSParser and SVGElement::parseAttribute() should be consistent
380         when parsing these properties.
381
382         The type of these properties is <length-percentage>, which requires specifying
383         the unit for the length: https://www.w3.org/TR/css-values/#length-value.
384
385         * css/parser/CSSParserFastPaths.cpp:
386         (WebCore::isSimpleLengthPropertyID):
387         * css/parser/CSSPropertyParser.cpp:
388         (WebCore::consumeRxOrRy):
389         (WebCore::CSSPropertyParser::parseSingleValue):
390
391 2019-11-14  Zalan Bujtas  <zalan@apple.com>
392
393         [LFC][Invalidation] Skip non-dirty out-of-flow boxes.
394         https://bugs.webkit.org/show_bug.cgi?id=204196
395
396         Reviewed by Antti Koivisto.
397
398         Use the InvalidationState to decide whether the current out-of-flow box needs layout.
399
400         * layout/FormattingContext.cpp:
401         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
402
403 2019-11-14  Antoine Quint  <graouts@apple.com>
404
405         [Web Animations] Accelerated transitions do not always remove their backing accelerated animation
406         https://bugs.webkit.org/show_bug.cgi?id=204198
407         <rdar://problem/45847205>
408
409         Reviewed by Dean Jackson.
410
411         Test: webanimations/accelerated-animation-removal-upon-transition-completion.html
412
413         There could be several calls to KeyframeEffect::updateAcceleratedAnimationState() made after an animation had completed but
414         before any pending accelerated actions would be processed during the next animation frame. In the first call, we would correctly
415         set add Accelerated::Stop to the list of pending accelerated actions, but on a further call, wrongly assuming that the fact that
416         we'd already recorded an Accelerated::Stop action meant that it had been committed, we would clear that action and the animation
417         would never be explicitly removed.
418
419         Additionally, we would schedule animation resolution on the DocumentTimeline in the wrong function, we now do that in the function
420         where animations with an effect pending accelerated actions is added rather than in the function where we track which elements have
421         accelerated animations.
422
423         * animation/DocumentTimeline.cpp:
424         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
425         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
426         * animation/KeyframeEffect.cpp:
427         (WebCore::KeyframeEffect::updateAcceleratedAnimationState):
428
429 2019-11-14  Zalan Bujtas  <zalan@apple.com>
430
431         [LFC][Invalidation] Use InvalidationState to populate LayoutQueue
432         https://bugs.webkit.org/show_bug.cgi?id=204191
433         <rdar://problem/57179614>
434
435         Reviewed by Antti Koivisto.
436
437         Start using the InvalidationState in BlockFormattingContext::layoutInFlowContent() to filter out
438         non-dirty boxes (currently InvalidationState returns true for every box).
439
440         * layout/FormattingContext.cpp:
441         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
442         * layout/FormattingContext.h: InvalidationState should not be const as we keep adding additional dirty boxes during layout.
443         * layout/LayoutContext.cpp:
444         (WebCore::Layout::LayoutContext::layout):
445         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
446         * layout/LayoutContext.h:
447         * layout/blockformatting/BlockFormattingContext.cpp:
448         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
449         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
450         * layout/blockformatting/BlockFormattingContext.h:
451         * layout/inlineformatting/InlineFormattingContext.cpp:
452         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
453         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
454         * layout/inlineformatting/InlineFormattingContext.h:
455         * layout/invalidation/InvalidationState.cpp:
456         (WebCore::Layout::InvalidationState::needsLayout const):
457         * layout/invalidation/InvalidationState.h:
458         * layout/tableformatting/TableFormattingContext.cpp:
459         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
460         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
461         * layout/tableformatting/TableFormattingContext.h:
462
463 2019-11-14  Chris Fleizach  <cfleizach@apple.com>
464
465         AX: Implement isolated tree support for math objects
466         https://bugs.webkit.org/show_bug.cgi?id=204056
467         <rdar://problem/57054644>
468
469         Reviewed by Zalan Bujtas.
470
471         Implement isolated tree support for math objects.
472         Add a method for setting and getting objects.
473
474         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
475         (WebCore::AXIsolatedObject::AXIsolatedObject):
476         (WebCore::AXIsolatedObject::create):
477         (WebCore::AXIsolatedObject::initializeAttributeData):
478         (WebCore::AXIsolatedObject::setObjectProperty):
479         (WebCore::AXIsolatedObject::objectAttributeValue const):
480         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
481
482 2019-11-14  Antoine Quint  <graouts@apple.com>
483
484         [Web Animations] Retargeted transitions targeting accelerated properties do not stop the original transition
485         https://bugs.webkit.org/show_bug.cgi?id=204116
486         <rdar://problem/57116961>
487
488         Reviewed by Dean Jackson.
489
490         Test: webanimations/css-transition-in-flight-reversal-accelerated.html
491
492         There were two problems with the reversal of in-flight transitions targeting accelerated properties. The first issue
493         was that the animated value for the accelerated property would be missing from the before-change style since animating
494         acceelerated properties do not update RenderStyle while running. As such, we would not detect the need to reverse a
495         transition, but rather simply cancel the initial transition with no new transition to reverse its effect, since the
496         value in the before-change and after-change styles were the same. We now fix this by figuring out whether the running
497         transition for that property is accelerated in AnimationTimeline::updateCSSTransitionsForElementAndProperty() and
498         applying the animated value to the before-change style.
499
500         The second issue was that canceling an accelerated transition had no visible effect since the accelerated animation
501         was not stopped. We now have a new AnimationEffect::animationWasCanceled() virtual method which KeyframeEffect overrides
502         to add AcceleratedAction::Stop to the list of pending acceleration actions for this effect. We also ensure that the document
503         timeline knows to run DocumentTimeline::updateAnimationsAndSendEvents() if there are pending accelerated actions, even if
504         there aren't any animations waiting to be resolved, since a single canceled transition would prevent this method from
505         completing.
506
507         * animation/AnimationEffect.h:
508         * animation/AnimationTimeline.cpp:
509         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
510         * animation/DocumentTimeline.cpp:
511         (WebCore::DocumentTimeline::removeAnimation):
512         (WebCore::DocumentTimeline::scheduleAnimationResolution):
513         (WebCore::DocumentTimeline::shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState const):
514         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
515         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
516         * animation/DocumentTimeline.h:
517         * animation/KeyframeEffect.cpp:
518         (WebCore::KeyframeEffect::animationWasCanceled):
519         * animation/KeyframeEffect.h:
520         * animation/WebAnimation.cpp:
521         (WebCore::WebAnimation::cancel):
522
523 2019-11-13  Nikolas Zimmermann  <nzimmermann@igalia.com>
524
525         Fix GTK/WPE builds after enabling POINTER_EVENTS support
526         https://bugs.webkit.org/show_bug.cgi?id=204164
527
528         Reviewed by Žan Doberšek.
529
530         Our g++ 8.3.0 yields "error: call to non-constexpr function
531         WTFReportAssertionFailure" when compiling rendering/EventRegion.cpp
532         since r252366.
533
534         Turn both toTouchAction() / toIndex() into static inline instead of
535         constexpr functions to appease g++ 8.3.0.
536
537         * rendering/EventRegion.cpp:
538         (WebCore::toIndex):
539         (WebCore::toTouchAction):
540
541 2019-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
542
543         [Clipboard API] Add support for Clipboard.write()
544         https://bugs.webkit.org/show_bug.cgi?id=204078
545         <rdar://problem/57087756>
546
547         Reviewed by Ryosuke Niwa.
548
549         This patch adds support for the write() method on Clipboard, forgoing sanitization for now (this will be added
550         in the next patch). See below for more details.
551
552         Tests: editing/async-clipboard/clipboard-change-data-while-writing.html
553                editing/async-clipboard/clipboard-write-basic.html
554                editing/async-clipboard/clipboard-write-items-twice.html
555
556         * Modules/async-clipboard/Clipboard.cpp:
557         (WebCore::Clipboard::~Clipboard):
558         (WebCore::shouldProceedWithClipboardWrite):
559         (WebCore::Clipboard::write):
560
561         Implement this method by creating a new ItemWriter and loading data from all the ClipboardItems that are being
562         written. If the previous writer is still in progress, make sure that we invalidate it first (rejecting the
563         promise) before proceeding.
564
565         (WebCore::Clipboard::didResolveOrReject):
566         (WebCore::Clipboard::ItemWriter::ItemWriter):
567         (WebCore::Clipboard::ItemWriter::write):
568         (WebCore::Clipboard::ItemWriter::invalidate):
569         (WebCore::Clipboard::ItemWriter::setData):
570         (WebCore::Clipboard::ItemWriter::didSetAllData):
571         (WebCore::Clipboard::ItemWriter::reject):
572
573         Introduce a private helper class to collect clipboard data for writing from a list of ClipboardItems, and
574         resolve or reject the given promise when finished.
575
576         * Modules/async-clipboard/Clipboard.h:
577         * platform/ios/PlatformPasteboardIOS.mm:
578         (WebCore::createItemProviderRegistrationList):
579
580         Fix a stray bug where the empty string could not be read back as plain text or URLs from the platform pasteboard
581         on iOS. This is exercised by the new layout test clipboard-write-basic.html.
582
583         * platform/mac/PlatformPasteboardMac.mm:
584         (WebCore::PlatformPasteboard::write):
585
586         Address another issue where we would sometimes try and declare the empty string as a pasteboard type when
587         writing to the platform pasteboard. While benign in a real NSPasteboard, there's no reason to include it in this
588         list of declared pasteboard types.
589
590 2019-11-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
591
592         [SVG2] Add the 'orient' property of the interface SVGMarkerElement
593         https://bugs.webkit.org/show_bug.cgi?id=203646
594
595         Reviewed by Simon Fraser.
596
597         This patch does the following:
598
599         1. Adding the 'orient' property of the interface SVGMarkerElement:
600            The specs link is:
601            https://www.w3.org/TR/SVG2/painting.html#InterfaceSVGMarkerElement
602
603         2. Keeping the pair properties <orientAngle, orientType> in sync when
604            when one of them changes to keep them in consistent state.
605
606         3. Setting the value of SVGMarkerOrientAutoStartReverse: The specs
607            https://www.w3.org/TR/SVG2/painting.html#__svg__SVGMarkerElement__orient
608            says that when setting the 'orient' attribute to "auto-start-reverse",
609            the value of orientType should be SVG_MARKER_ORIENT_UNKNOWN. Therefore
610            SVGMarkerOrientAutoStartReverse has to be equal to SVGMarkerOrientUnknown.
611
612         * svg/SVGAngle.h:
613         (WebCore::SVGAngle::unitType const):
614         (WebCore::SVGAngle::valueForBindings const):
615         (WebCore::SVGAngle::valueInSpecifiedUnits const):
616         (WebCore::SVGAngle::unitType): Deleted.
617         (WebCore::SVGAngle::valueForBindings): Deleted.
618         (WebCore::SVGAngle::valueInSpecifiedUnits): Deleted.
619         Make these functions const.
620
621         * svg/SVGElement.cpp:
622         (WebCore::SVGElement::commitPropertyChange):
623         Calling SVGPropertyRegistry::setAnimatedPropertDirty() to set the dirty
624         flag of the animated  property through its accessor.
625
626         * svg/SVGMarkerElement.cpp:
627         (WebCore::SVGMarkerElement::orient const):
628         (WebCore::SVGMarkerElement::setOrient):
629         Add the new property handlers.
630
631         (WebCore::SVGMarkerElement::setOrientToAuto):
632         (WebCore::SVGMarkerElement::setOrientToAngle):
633         Fix the bug of not setting the unitType of the SVGAngle in orientAngle.
634
635         * svg/SVGMarkerElement.h:
636         Delete unused enum value SVG_MARKER_ORIENT_AUTOSTARTREVERSE.
637
638         * svg/SVGMarkerElement.idl:
639
640         * svg/SVGMarkerTypes.h:
641         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
642         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
643         Fix the value of SVGMarkerOrientAutoStartReverse. No need for 
644         highestExposedEnumValue() since all the enum values are now exposed.
645
646         * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
647         Keep the pair properties <orientAngle, orientType> in sync.
648
649         * svg/properties/SVGMemberAccessor.h:
650         (WebCore::SVGMemberAccessor::setDirty const):
651         This is what SVGElement::commitPropertyChange() used to do for all properties.
652
653         * svg/properties/SVGPropertyOwnerRegistry.h:
654         * svg/properties/SVGPropertyRegistry.h:
655
656 2019-11-13  Jer Noble  <jer.noble@apple.com>
657
658         Link mediaDataLoadsAutomatically setting to AutoplayPolicy
659         https://bugs.webkit.org/show_bug.cgi?id=201738
660         <rdar://problem/55315194>
661
662         Reviewed by Eric Carlson.
663
664         This change has two effects: on Mac, when the embedding app sets an AutoplayPolicy to
665         deny autoplay, this will also deny the ability to load media data beyond "preload"; on iOS
666         when the embedding app sets an AutoplayPolicy to allow autoplay, this will also allow media
667         data to load beyond "preload".
668
669         * dom/Document.cpp:
670         (WebCore::Document::mediaDataLoadsAutomatically const):
671         * dom/Document.h:
672         * html/HTMLMediaElement.cpp:
673         (WebCore::HTMLMediaElement::finishInitialization):
674         * html/MediaElementSession.cpp:
675         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
676
677 2019-11-13  Devin Rousso  <drousso@apple.com>
678
679         Web Inspector: DOM.highlightSelector should work for "a:visited"
680         https://bugs.webkit.org/show_bug.cgi?id=146161
681         <rdar://problem/21467303>
682
683         Reviewed by Antti Koivisto.
684
685         * inspector/agents/InspectorDOMAgent.cpp:
686         (WebCore::InspectorDOMAgent::highlightSelector):
687         Rather than use `document.querySelectorAll`, which doesn't match pseudo-selectors, attempt
688         to mimic how CSS actually matches nodes.
689
690         * rendering/style/RenderStyleConstants.h:
691         (WebCore::PseudoIdSet::remove): Added.
692
693 2019-11-13  Myles C. Maxfield  <mmaxfield@apple.com>
694
695         [Mac] Fix build
696         https://bugs.webkit.org/show_bug.cgi?id=204136
697
698         Reviewed by Alex Christensen.
699
700         Remove deprecation warnings.
701
702         * platform/ios/ScrollViewIOS.mm:
703         (WebCore::ScrollView::platformSetCanBlitOnScroll):
704         (WebCore::ScrollView::platformCanBlitOnScroll const):
705         * platform/mac/ScrollViewMac.mm:
706         (WebCore::ScrollView::platformSetCanBlitOnScroll):
707         (WebCore::ScrollView::platformCanBlitOnScroll const):
708         * platform/mac/WidgetMac.mm:
709         (WebCore::Widget::paint):
710         * rendering/RenderThemeMac.mm:
711         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
712         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
713         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
714         (WebCore::RenderThemeMac::systemColor const):
715         (WebCore::paintAttachmentTitleBackground):
716
717 2019-11-13  Benjamin Nham  <nham@apple.com>
718
719         VeryHigh priority loads are actually loading at VeryLow priority
720         https://bugs.webkit.org/show_bug.cgi?id=203423
721         <rdar://problem/56621789>
722
723         Reviewed by Antti Koivisto.
724
725         There are two issues with the way we translate ResourceLoadPriority to
726         CFURLRequestPriority:
727
728         1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few
729         priority levels. This means VeryHigh priority loads are actually out
730         of bounds, which causes CFNetwork to set the priority level back to 0
731         in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
732         call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
733         levels.
734
735         2. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession
736         right now (<rdar://problem/56621205>), so we have to map to the default
737         number of CFURLRequestPriority levels, which is 4. Right now we have 5
738         ResourceLoadPriority levels, so there will be some aliasing involved.
739         After this patch VeryLow gets a priority of -1 and Low gets a priority
740         of 0, but due to the aforementioned clamping behavior both VeryLow and
741         Low will effectively both have a CFURLRequestPriority of 0.
742
743         * platform/network/cf/ResourceRequestCFNet.cpp:
744         (WebCore::initializeMaximumHTTPConnectionCountPerHost):
745         (WebCore::initializeHTTPConnectionSettingsOnStartup):
746         * platform/network/cf/ResourceRequestCFNet.h:
747         (WebCore::toResourceLoadPriority):
748         (WebCore::toPlatformRequestPriority):
749
750 2019-11-13  Dean Jackson  <dino@apple.com>
751
752         Fix some WebGPU demos
753         https://bugs.webkit.org/show_bug.cgi?id=204167
754         <rdar://problem/57160316>
755
756         Reviewed by Myles C. Maxfield.
757
758         Add a note referencing a bug I detected while fixing this demo.
759         And a drive-by typo.
760
761         * Modules/webgpu/WebGPUBuffer.cpp:
762         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
763         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
764         (WebCore::GPUCommandBuffer::copyBufferToTexture):
765
766 2019-11-13  Antti Koivisto  <antti@apple.com>
767
768         Google Docs spreadsheet tiles render very slowly (because of event region painting)
769         https://bugs.webkit.org/show_bug.cgi?id=204160
770         <rdar://problem/57073401>
771
772         Reviewed by Simon Fraser.
773
774         Content of a overflow:scroll area on this page doesn't cover the entire scrollable area and we end
775         up generating a complex shape for the event region. This is unnecessary as touches within scrollers
776         always scroll the content.
777
778         Test: fast/scrolling/ios/event-region-scrolled-contents-layer.html
779
780         * rendering/RenderLayerBacking.cpp:
781         (WebCore::RenderLayerBacking::updateEventRegion):
782
783         Initialize event region for scrolled contents layer with layer-sized event region. This optimizes away
784         event region mutations. We still need to to do the event region paint to capture touch-action regions.
785
786         In future we should also improve Region type to not have pathological worst-case performance with complex
787         shapes.
788
789 2019-11-13  Andres Gonzalez  <andresg_22@apple.com>
790
791         AXObjectCache::rootObject should generate the isolated tree.
792         https://bugs.webkit.org/show_bug.cgi?id=204131
793
794         Reviewed by Chris Fleizach.
795
796         No new tests, no change in functionality.
797
798         AXObjectCache::rootObject now returns an AccessibilityObject or an
799         IsolatedObject. This makes it possible for client code to use the
800         isolated tree seamlessly, as long as the client call happens on a
801         secondary thread. This allows WKTR AccessibilityController to use the
802         isolated tree in LayoutTests.
803         
804         * accessibility/AXObjectCache.cpp:
805         (WebCore::AXObjectCache::clientSupportsIsolatedTree):
806         (WebCore::AXObjectCache::rootObject):
807         (WebCore::AXObjectCache::createIsolatedTreeHierarchy):
808         (WebCore::AXObjectCache::generateIsolatedTree):
809         (WebCore::AXObjectCache::rootWebArea):
810         (WebCore::AXObjectCache::createIsolatedAccessibilityTreeHierarchy): Renamed.
811         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree): renamed.
812         * accessibility/AXObjectCache.h:
813
814 2019-11-13  Zalan Bujtas  <zalan@apple.com>
815
816         [LFC][Invalidation] Introduce InvalidationState and Context
817         https://bugs.webkit.org/show_bug.cgi?id=204140
818         <rdar://problem/57142106>
819
820         Reviewed by Antti Koivisto.
821
822         InvalidationContext take style/content changes and turn them into "dirty layout boxes" (stored in InvalidationState).
823         InvalidationState is the input to the (partial)subsequent layout.
824
825         * Sources.txt:
826         * WebCore.xcodeproj/project.pbxproj:
827         * layout/Invalidation.h: Removed.
828         * layout/LayoutContext.cpp:
829         (WebCore::Layout::LayoutContext::layout):
830         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
831         (WebCore::Layout::LayoutContext::runLayout):
832         (WebCore::Layout::LayoutContext::styleChanged): Deleted.
833         (WebCore::Layout::LayoutContext::markNeedsUpdate): Deleted.
834         * layout/LayoutContext.h:
835         (WebCore::Layout::LayoutContext::updateAll): Deleted.
836         * layout/blockformatting/BlockInvalidation.cpp: Removed.
837         * layout/blockformatting/BlockInvalidation.h: Removed.
838         * layout/invalidation/InvalidationContext.cpp: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp.
839         (WebCore::Layout::InvalidationContext::InvalidationContext):
840         (WebCore::Layout::InvalidationContext::styleChanged):
841         (WebCore::Layout::InvalidationContext::contentChanged):
842         (WebCore::Layout::InvalidationContext::subtreeChanged):
843         * layout/invalidation/InvalidationContext.h: Renamed from Source/WebCore/layout/inlineformatting/InlineInvalidation.h.
844         * layout/invalidation/InvalidationState.cpp: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.cpp.
845         (WebCore::Layout::InvalidationState::InvalidationState):
846         (WebCore::Layout::InvalidationState::markNeedsUpdate):
847         * layout/invalidation/InvalidationState.h: Renamed from Source/WebCore/layout/tableformatting/TableInvalidation.h.
848         (WebCore::Layout::InvalidationState::formattingContextRoots const):
849         * layout/layouttree/LayoutTreeBuilder.cpp:
850         (WebCore::Layout::printLayoutTreeForLiveDocuments):
851
852 2019-11-13  Commit Queue  <commit-queue@webkit.org>
853
854         Unreviewed, rolling out r252402.
855         https://bugs.webkit.org/show_bug.cgi?id=204157
856
857         This change broke the iOS and macOS build (Requested by
858         aakashja_ on #webkit).
859
860         Reverted changeset:
861
862         "Unreviewed, fix GTK/WPE builds after enabling POINTER_EVENTS
863         support."
864         https://trac.webkit.org/changeset/252402
865
866 2019-11-13  Nikolas Zimmermann  <nzimmermann@igalia.com>
867
868         Unreviewed, fix GTK/WPE builds after enabling POINTER_EVENTS support.
869
870         Our g++ 8.3.0 yields "error: call to non-constexpr function
871         WTFReportAssertionFailure" when compiling rendering/EventRegion.cpp
872         since r252366.
873
874         Simply remove the ASSERT_NOT_REACHED() from toIndex(): a missing value
875         in the switch statement will be caught by compiler warnings. Remove the
876         constexpr flag from toTouchAction(): in this case, the
877         ASSERT_NOT_REACHED() is useful and should stay.
878
879         Rubber-stamped by Philippe Normand.
880
881         * rendering/EventRegion.cpp:
882         (WebCore::toIndex): Remove call to ASSERT_NOT_REACHED().
883         (WebCore::toTouchAction): Keep ASSERT_NOT_REACHED(), removed constexpr.
884
885 2019-11-13  Philippe Normand  <pnormand@igalia.com>
886
887         Unreviewed, fix build for accessibility disabled.
888
889         * accessibility/AXObjectCache.h:
890         (WebCore::AXObjectCache::focusedUIElementForPage):
891         (WebCore::AXObjectCache::attachWrapper):
892         (WebCore::AXObjectCache::postNotification):
893         (WebCore::AXObjectCache::postPlatformNotification):
894         (WebCore::AXObjectCache::characterOffsetForIndex):
895         * accessibility/AccessibilityObject.h:
896         (WebCore::AccessibilityObject::children):
897         (WebCore::AccessibilityObject::updateBackingStore):
898
899 2019-11-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
900
901         [GStreamer] Several issues while trying to play a video on NextCloud
902         https://bugs.webkit.org/show_bug.cgi?id=203194
903
904         Reviewed by Philippe Normand.
905
906         First problem was the loader not being restarted in PAUSED, so
907         sometimes playback never started since buffering never reached
908         100%.
909
910         Then, after investigating blocksizes and not being a viable
911         solution, reducing the 200_ms to 100_ms wait for new data was the
912         trick to avoid choppyness.
913
914         During investigation several issues were fixed like turning
915         GstQuery* into GRefPtr for MediaPlayerPrivateGStreamer::buffered,
916         making blocksize unsigned instead of uint64_t as it is in
917         GStreamer and creating and using WEBKIT_WEB_SRC_CAST since many
918         uses of WEBKIT_WEB_SRC cast were already protected by
919         WEBKIT_IS_WEB_SRC.
920
921         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
922         (WebCore::MediaPlayerPrivateGStreamer::buffered const): GRefPtr<GstQuery>.
923         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
924         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup):
925         (WebCore::MediaPlayerPrivateGStreamer::didPassCORSAccessCheck const):
926         Use WEBKIT_WEB_SRC_CAST.
927         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
928         (webKitWebSrcCreate): Reduce wait for data down to 100_ms and
929         request download restart also in PAUSED.
930         (CachedResourceStreamingClient::checkUpdateBlocksize): Turn
931         blocksize to unsigned.
932         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add
933         WEBKIT_WEB_SRC_CAST.
934
935 2019-11-13  Rob Buis  <rbuis@igalia.com>
936
937         Support stale-while-revalidate cache strategy
938         https://bugs.webkit.org/show_bug.cgi?id=201461
939
940         Reviewed by Youenn Fablet.
941
942         Start parsing the stale-while-revalidate Cache-Control directive
943         and expose it on ResourceResponse.
944
945         Tests: imported/w3c/web-platform-tests/fetch/stale-while-revalidate/fetch-sw.https.html
946                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/fetch.html
947                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-css.html
948                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-image.html
949                imported/w3c/web-platform-tests/fetch/stale-while-revalidate/stale-script.html
950
951         * platform/network/CacheValidation.cpp:
952         (WebCore::parseCacheControlDirectives):
953         * platform/network/CacheValidation.h:
954         * platform/network/ResourceResponseBase.cpp:
955         (WebCore::ResourceResponseBase::cacheControlStaleWhileRevalidate const):
956         * platform/network/ResourceResponseBase.h:
957
958 2019-11-12  Simon Fraser  <simon.fraser@apple.com>
959
960         Move CSSUnitType enum to its own file
961         https://bugs.webkit.org/show_bug.cgi?id=204139
962
963         Reviewed by Antti Koivisto.
964
965         Pull CSSUnitType and CSSUnitCategory enums into their own file, since more future
966         code will use them and not CSSPrimitiveValue.
967
968         * Headers.cmake:
969         * Sources.txt:
970         * WebCore.xcodeproj/project.pbxproj:
971         * css/CSSPrimitiveValue.cpp:
972         (WebCore::unitCategory): Deleted.
973         * css/CSSPrimitiveValue.h:
974         * css/CSSUnits.cpp: Added.
975         (WebCore::unitCategory):
976         * css/CSSUnits.h: Added.
977
978 2019-11-12  Simon Fraser  <simon.fraser@apple.com>
979
980         Convert CSSPrimitiveValue::UnitType to an enum class, and cleanup
981         https://bugs.webkit.org/show_bug.cgi?id=204101
982
983         Reviewed by Antti Koivisto.
984         
985         Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
986         CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
987         use in calc() and in the CSS OM.
988         
989         Remove some comments about quirky units behavior which is now the standard behavior.
990         
991         The compiler warned about some units not handled in CSSPrimitiveValue::formatNumberForCustomCSSText()
992         and CSSPrimitiveValue::equals() which may reveal bugs; assert for now.
993
994         * css/CSSCalculationValue.cpp:
995         (WebCore::calcUnitCategory):
996         (WebCore::hasDoubleValue):
997         (WebCore::CSSCalcOperation::createSimplified):
998         (WebCore::CSSCalcOperation::primitiveType const):
999         (WebCore::CSSCalcExpressionNodeParser::parseValue):
1000         (WebCore::createBlendHalf):
1001         (WebCore::createCSS):
1002         (WebCore::unitCategory): Deleted.
1003         * css/CSSCalculationValue.h:
1004         * css/CSSComputedStyleDeclaration.cpp:
1005         (WebCore::valueForImageSliceSide):
1006         (WebCore::valueForNinePieceImageQuad):
1007         (WebCore::zoomAdjustedPixelValue):
1008         (WebCore::zoomAdjustedNumberValue):
1009         (WebCore::valueForReflection):
1010         (WebCore::percentageOrZoomAdjustedValue):
1011         (WebCore::matrixTransformValue):
1012         (WebCore::adjustLengthForZoom):
1013         (WebCore::ComputedStyleExtractor::valueForFilter):
1014         (WebCore::specifiedValueForGridTrackBreadth):
1015         (WebCore::specifiedValueForGridTrackSize):
1016         (WebCore::OrderedNamedLinesCollector::appendLines const):
1017         (WebCore::valueForGridPosition):
1018         (WebCore::createTransitionPropertyValue):
1019         (WebCore::delayValue):
1020         (WebCore::durationValue):
1021         (WebCore::textUnderlineOffsetToCSSValue):
1022         (WebCore::textDecorationThicknessToCSSValue):
1023         (WebCore::altTextToCSSValue):
1024         (WebCore::contentToCSSValue):
1025         (WebCore::counterToCSSValue):
1026         (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
1027         (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
1028         (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
1029         (WebCore::fontShorthandValueForSelectionProperties):
1030         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
1031         * css/CSSCrossfadeValue.cpp:
1032         (WebCore::CSSCrossfadeValue::blend const):
1033         * css/CSSCustomPropertyValue.cpp:
1034         (WebCore::CSSCustomPropertyValue::customCSSText const):
1035         * css/CSSFontFace.cpp:
1036         (WebCore::calculateItalicRange):
1037         * css/CSSFontStyleValue.h:
1038         * css/CSSGradientValue.cpp:
1039         (WebCore::compareStops):
1040         (WebCore::CSSGradientValue::computeStops):
1041         (WebCore::appendGradientStops):
1042         (WebCore::CSSLinearGradientValue::createGradient):
1043         (WebCore::CSSConicGradientValue::createGradient):
1044         * css/CSSImageValue.cpp:
1045         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const):
1046         * css/CSSPrimitiveValue.cpp:
1047         (WebCore::isValidCSSUnitTypeForDoubleConversion):
1048         (WebCore::isStringType):
1049         (WebCore::unitCategory):
1050         (WebCore::CSSPrimitiveValue::primitiveType const):
1051         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1052         (WebCore::CSSPrimitiveValue::init):
1053         (WebCore::CSSPrimitiveValue::cleanup):
1054         (WebCore::CSSPrimitiveValue::computeDegrees const):
1055         (WebCore::CSSPrimitiveValue::computeLengthDouble const):
1056         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
1057         (WebCore::CSSPrimitiveValue::setFloatValue):
1058         (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
1059         (WebCore::CSSPrimitiveValue::getFloatValue const):
1060         (WebCore::CSSPrimitiveValue::doubleValue const):
1061         (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
1062         (WebCore::CSSPrimitiveValue::doubleValueInternal const):
1063         (WebCore::CSSPrimitiveValue::setStringValue):
1064         (WebCore::CSSPrimitiveValue::getStringValue const):
1065         (WebCore::CSSPrimitiveValue::stringValue const):
1066         (WebCore:: const):
1067         (WebCore::CSSPrimitiveValue::getRGBColorValue const):
1068         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
1069         (WebCore::CSSPrimitiveValue::equals const):
1070         (WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const):
1071         (WebCore::CSSPrimitiveValue::collectDirectRootComputationalDependencies const):
1072         (WebCore::CSSPrimitiveValue::unitCategory): Deleted.
1073         * css/CSSPrimitiveValue.h:
1074         (WebCore::CSSPrimitiveValue::isAngle const):
1075         (WebCore::CSSPrimitiveValue::isFontRelativeLength):
1076         (WebCore::CSSPrimitiveValue::isLength):
1077         (WebCore::CSSPrimitiveValue::isResolution):
1078         (WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
1079         (WebCore::CSSPrimitiveValue::computeTime const):
1080         * css/CSSPrimitiveValueMappings.h:
1081         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1082         (WebCore::CSSPrimitiveValue::operator short const):
1083         (WebCore::CSSPrimitiveValue::operator unsigned short const):
1084         (WebCore::CSSPrimitiveValue::operator int const):
1085         (WebCore::CSSPrimitiveValue::operator unsigned const):
1086         (WebCore::CSSPrimitiveValue::operator float const):
1087         (WebCore::CSSPrimitiveValue::operator LineClampValue const):
1088         (WebCore::CSSPrimitiveValue::operator ColumnFill const):
1089         (WebCore::CSSPrimitiveValue::operator ColumnSpan const):
1090         (WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const):
1091         (WebCore::CSSPrimitiveValue::operator ImageOrientation const):
1092         * css/CSSStyleDeclaration.cpp:
1093         (WebCore::CSSStyleDeclaration::namedItem):
1094         * css/CSSToStyleMap.cpp:
1095         (WebCore::CSSToStyleMap::mapNinePieceImageSlice):
1096         (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
1097         * css/CSSValue.h:
1098         * css/CSSValuePool.cpp:
1099         (WebCore::CSSValuePool::CSSValuePool):
1100         (WebCore::CSSValuePool::createValue):
1101         * css/CSSValuePool.h:
1102         (WebCore::CSSValuePool::createValue):
1103         * css/DeprecatedCSSOMPrimitiveValue.cpp:
1104         (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
1105         (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
1106         (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
1107         (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
1108         * css/DeprecatedCSSOMPrimitiveValue.h:
1109         * css/DeprecatedCSSOMRGBColor.h:
1110         * css/MediaQueryEvaluator.cpp:
1111         (WebCore::doubleValue):
1112         (WebCore::evaluateResolution):
1113         * css/MediaQueryExpression.cpp:
1114         (WebCore::featureWithValidIdent):
1115         * css/SVGCSSComputedStyleDeclaration.cpp:
1116         (WebCore::glyphOrientationToCSSPrimitiveValue):
1117         (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
1118         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1119         * css/StyleProperties.cpp:
1120         (WebCore::StyleProperties::asText const):
1121         * css/parser/CSSParserFastPaths.cpp:
1122         (WebCore::parseSimpleLength):
1123         (WebCore::parseSimpleAngle):
1124         (WebCore::parseSimpleLengthValue):
1125         (WebCore::parseColorIntOrPercentage):
1126         (WebCore::fastParseColorInternal):
1127         (WebCore::parseTransformTranslateArguments):
1128         (WebCore::parseTransformAngleArgument):
1129         (WebCore::parseTransformNumberArguments):
1130         * css/parser/CSSParserToken.cpp:
1131         (WebCore::cssPrimitiveValueUnitFromTrie):
1132         (WebCore::stringToUnitType):
1133         (WebCore::CSSParserToken::CSSParserToken):
1134         (WebCore::CSSParserToken::convertToPercentage):
1135         * css/parser/CSSParserToken.h:
1136         (WebCore::CSSParserToken::unitType const):
1137         * css/parser/CSSPropertyParser.cpp:
1138         (WebCore::CSSPropertyParser::consumeTransformOrigin):
1139         (WebCore::consumeFontStyle):
1140         (WebCore::consumeFontStyleRange):
1141         (WebCore::consumeCounter):
1142         (WebCore::consumeAnimationName):
1143         (WebCore::consumePerspective):
1144         (WebCore::consumePositionLonghand):
1145         (WebCore::consumeAttr):
1146         (WebCore::consumeCounterContent):
1147         (WebCore::consumeReflect):
1148         (WebCore::consumeGridBreadth):
1149         (WebCore::CSSPropertyParser::consumeSystemFont):
1150         (WebCore::CSSPropertyParser::consumeFlex):
1151         * css/parser/CSSPropertyParserHelpers.cpp:
1152         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeInteger):
1153         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
1154         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1155         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
1156         (WebCore::CSSPropertyParserHelpers::consumeLength):
1157         (WebCore::CSSPropertyParserHelpers::consumePercent):
1158         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1159         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
1160         (WebCore::CSSPropertyParserHelpers::consumeTime):
1161         (WebCore::CSSPropertyParserHelpers::consumeResolution):
1162         (WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
1163         (WebCore::CSSPropertyParserHelpers::consumeString):
1164         (WebCore::CSSPropertyParserHelpers::consumeUrl):
1165         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
1166         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1167         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1168         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
1169         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
1170         * css/parser/MediaQueryParser.cpp:
1171         (WebCore::MediaQueryParser::readFeatureValue):
1172         * css/parser/SizesAttributeParser.cpp:
1173         (WebCore::SizesAttributeParser::computeLength):
1174         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
1175         * css/parser/SizesAttributeParser.h:
1176         * css/typedom/StylePropertyMapReadOnly.cpp:
1177         (WebCore::StylePropertyMapReadOnly::reifyValue):
1178         * dom/StyledElement.cpp:
1179         (WebCore::StyledElement::setInlineStyleProperty):
1180         (WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
1181         * dom/StyledElement.h:
1182         * editing/ApplyStyleCommand.cpp:
1183         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
1184         (WebCore::ApplyStyleCommand::computedFontSize):
1185         * editing/EditingStyle.cpp:
1186         (WebCore::legacyFontSizeFromCSSValue):
1187         * editing/FontAttributeChanges.cpp:
1188         (WebCore::FontChanges::createStyleProperties const):
1189         (WebCore::cssValueListForShadow):
1190         * editing/cocoa/HTMLConverter.mm:
1191         (stringFromCSSValue):
1192         (floatValueFromPrimitiveValue):
1193         * html/HTMLElement.cpp:
1194         (WebCore::HTMLElement::applyBorderAttributeToStyle):
1195         * html/HTMLEmbedElement.cpp:
1196         (WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute):
1197         * html/HTMLHRElement.cpp:
1198         (WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
1199         * html/HTMLIFrameElement.cpp:
1200         (WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute):
1201         * html/HTMLInputElement.cpp:
1202         (WebCore::autoFillStrongPasswordMaskImage):
1203         * html/HTMLMeterElement.cpp:
1204         (WebCore::HTMLMeterElement::didElementStateChange):
1205         * html/HTMLTableElement.cpp:
1206         (WebCore::HTMLTableElement::collectStyleForPresentationAttribute):
1207         (WebCore::HTMLTableElement::createSharedCellStyle):
1208         * html/ValidationMessage.cpp:
1209         (WebCore::adjustBubblePosition):
1210         * html/shadow/MediaControlElements.cpp:
1211         (WebCore::MediaControlPanelElement::setPosition):
1212         (WebCore::MediaControlPanelElement::makeOpaque):
1213         (WebCore::MediaControlPanelElement::makeTransparent):
1214         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
1215         (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation):
1216         * html/shadow/ProgressShadowElement.cpp:
1217         (WebCore::ProgressValueElement::setWidthPercentage):
1218         * html/shadow/TextControlInnerElements.cpp:
1219         (WebCore::TextControlInnerElement::resolveCustomStyle):
1220         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
1221         (WebCore::ImageControlsButtonElementMac::tryCreate):
1222         * html/track/TextTrackCueGeneric.cpp:
1223         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1224         (WebCore::TextTrackCueGeneric::setFontSize):
1225         * html/track/VTTCue.cpp:
1226         (WebCore::VTTCueBox::applyCSSProperties):
1227         (WebCore::VTTCue::getDisplayTree):
1228         * html/track/VTTRegion.cpp:
1229         (WebCore::VTTRegion::displayLastTextTrackCueBox):
1230         (WebCore::VTTRegion::willRemoveTextTrackCueBox):
1231         (WebCore::VTTRegion::prepareRegionDisplayTree):
1232         * page/DragController.cpp:
1233         (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
1234         * page/PrintContext.cpp:
1235         (WebCore::PrintContext::computedPageMargin):
1236         * page/animation/CSSPropertyAnimation.cpp:
1237         (WebCore::crossfadeBlend):
1238         * rendering/RenderLayer.cpp:
1239         (WebCore::RenderLayer::resize):
1240         * rendering/RenderThemeIOS.mm:
1241         (WebCore::applyCommonButtonPaddingToStyle):
1242         (WebCore::RenderThemeIOS::adjustButtonStyle const):
1243         * style/StyleBuilderConverter.h:
1244         (WebCore::Style::BuilderConverter::convertNumber):
1245         (WebCore::Style::BuilderConverter::convertWebkitHyphenateLimitLines):
1246         (WebCore::Style::BuilderConverter::convertClipPath):
1247         (WebCore::Style::BuilderConverter::convertTextStrokeWidth):
1248         (WebCore::Style::BuilderConverter::convertFontStyleFromValue):
1249         * style/StyleBuilderCustom.h:
1250         (WebCore::Style::BuilderCustom::mmLength):
1251         (WebCore::Style::BuilderCustom::inchLength):
1252         (WebCore::Style::BuilderCustom::applyValueImageResolution):
1253         * svg/SVGLengthValue.cpp:
1254         (WebCore::primitiveTypeToLengthType):
1255         (WebCore::lengthTypeToPrimitiveType):
1256
1257 2019-11-12  Keith Miller  <keith_miller@apple.com>
1258
1259         AudioScheduledSourceNodes leak if they have an attached onended EventTarget
1260         https://bugs.webkit.org/show_bug.cgi?id=204087
1261         <rdar://problem/56772102>
1262
1263         Reviewed by Jer Noble.
1264
1265         Previously, if an AudioNode had any attributes that were event
1266         targets we would leak the node as long as the AudioContext was
1267         alive. This patch makes all the AudioNodes with EventTarget
1268         attributes subclasses of ActiveDOMObject. For,
1269         AudioScheduledSourceNodes we will mark the node as non-active when
1270         either the node becomes eligible for deletion from the graph or
1271         the onended event fires. For, ScriptProcessorNodes we mark the
1272         node as non-active when the node becomes eligible for deletion.
1273
1274         Tests: webaudio/finished-audio-buffer-source-nodes-should-be-collectable.html
1275                webaudio/audiobuffersource-not-gced-until-ended.html
1276
1277         * Modules/webaudio/AudioBufferSourceNode.cpp:
1278         (WebCore::AudioBufferSourceNode::startLater):
1279         (WebCore::AudioBufferSourceNode::start): Deleted.
1280         * Modules/webaudio/AudioBufferSourceNode.h:
1281         * Modules/webaudio/AudioBufferSourceNode.idl:
1282         * Modules/webaudio/AudioContext.h:
1283         * Modules/webaudio/AudioNode.cpp:
1284         (WebCore::AudioNode::deref):
1285         (WebCore::AudioNode::finishDeref):
1286         * Modules/webaudio/AudioNode.h:
1287         (WebCore::AudioNode::didBecomeMarkedForDeletion):
1288         * Modules/webaudio/AudioNode.idl:
1289         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1290         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
1291         (WebCore::AudioScheduledSourceNode::startLater):
1292         (WebCore::AudioScheduledSourceNode::stopLater):
1293         (WebCore::AudioScheduledSourceNode::didBecomeMarkedForDeletion):
1294         (WebCore::AudioScheduledSourceNode::finish):
1295         (WebCore::AudioScheduledSourceNode::start): Deleted.
1296         (WebCore::AudioScheduledSourceNode::stop): Deleted.
1297         (WebCore::AudioScheduledSourceNode::addEventListener): Deleted.
1298         (WebCore::AudioScheduledSourceNode::removeEventListener): Deleted.
1299         (WebCore::AudioScheduledSourceNode::removeAllEventListeners): Deleted.
1300         * Modules/webaudio/AudioScheduledSourceNode.h:
1301         * Modules/webaudio/OscillatorNode.h:
1302         * Modules/webaudio/OscillatorNode.idl:
1303         * Modules/webaudio/ScriptProcessorNode.cpp:
1304         (WebCore::ScriptProcessorNode::ScriptProcessorNode):
1305         (WebCore::ScriptProcessorNode::~ScriptProcessorNode):
1306         (WebCore::ScriptProcessorNode::didBecomeMarkedForDeletion):
1307         (WebCore::ScriptProcessorNode::process):
1308         (WebCore::ScriptProcessorNode::addEventListener): Deleted.
1309         (WebCore::ScriptProcessorNode::removeEventListener): Deleted.
1310         (WebCore::ScriptProcessorNode::removeAllEventListeners): Deleted.
1311         * Modules/webaudio/ScriptProcessorNode.h:
1312         * Modules/webaudio/ScriptProcessorNode.idl:
1313         * Sources.txt:
1314         * bindings/js/JSAudioNodeCustom.cpp: Removed.
1315
1316 2019-11-12  Zalan Bujtas  <zalan@apple.com>
1317
1318         [LFC] InlineFormattingState::addInlineRun should take a unique_ptr<Display::Run>
1319         https://bugs.webkit.org/show_bug.cgi?id=204099
1320         <rdar://problem/57102586>
1321
1322         Reviewed by Antti Koivisto.
1323
1324         It's rather wasteful to create a Display::Run just to pass it in to InlineFormattingState::addInlineRun.
1325
1326         * layout/inlineformatting/InlineFormattingContext.cpp:
1327         (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
1328         * layout/inlineformatting/InlineFormattingState.h:
1329         (WebCore::Layout::InlineFormattingState::addInlineRun):
1330
1331 2019-11-12  Antti Koivisto  <antti@apple.com>
1332
1333         Skip matched declarations cache only for length resolution affecting font properties
1334         https://bugs.webkit.org/show_bug.cgi?id=204098
1335
1336         Reviewed by Zalan Bujtas.
1337
1338         * css/CSSPrimitiveValue.cpp:
1339         (WebCore::CSSPrimitiveValue::equalForLengthResolution):
1340
1341         Put this next to the length resolution function, hopefully helping to keep them in sync.
1342
1343         * css/CSSPrimitiveValue.h:
1344         * css/StyleResolver.cpp:
1345         (WebCore::StyleResolver::applyMatchedProperties):
1346
1347         Replace test for font declaration change with a narrower test that only looks for those properties that affect length resolution.
1348
1349         * style/MatchedDeclarationsCache.cpp:
1350         (WebCore::Style::MatchedDeclarationsCache::Entry::isUsableAfterHighPriorityProperties const):
1351
1352         Factor into function.
1353
1354         * style/MatchedDeclarationsCache.h:
1355
1356 2019-11-12  Peng Liu  <peng.liu6@apple.com>
1357
1358         Picture-in-Picture events are not fired if we switch the Picture-in-Picture mode through modern media controls
1359         https://bugs.webkit.org/show_bug.cgi?id=203933
1360
1361         Reviewed by Eric Carlson.
1362
1363         When the Picture-in-Picture API is not available, we need to call webkitSetPresentationMode()
1364         of the video element to implement the picture-in-picture feature.
1365
1366         No new tests, covered by test: media/modern-media-controls/pip-support/pip-support-click.html
1367
1368         * Modules/modern-media-controls/media/pip-support.js:
1369         (PiPSupport.prototype.buttonWasPressed):
1370
1371 2019-11-13  Simon Fraser  <simon.fraser@apple.com>
1372
1373         REGRESSION (r249434): flashy menus on wellsfargo.com
1374         https://bugs.webkit.org/show_bug.cgi?id=204175
1375         <rdar://problem/56654512>
1376
1377         Reviewed by Zalan Bujtas.
1378
1379         Test: compositing/backing/backing-for-clipping.html
1380         
1381         r249434 made overflow an "indirect compositing reason" (i.e. we composite for overflow:hidden
1382         when necessary to clip a composited descendant). However this made a clause in RenderLayerCompositor::requiresOwnBackingStore()
1383         return early when this reason is set, skipping the bounds check, so we need to do the bound check first.
1384         This is similar to the fix in r252070.
1385
1386         The change to the perspective test relates to the "FIXME"; we don't use the correct ancestor for the
1387         bounds check, so sometimes layers can have backing store when they don't need it until that's fixed.
1388
1389         * rendering/RenderLayerCompositor.cpp:
1390         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
1391
1392 2019-11-11  Per Arne Vollan  <pvollan@apple.com>
1393
1394         Many legacy animation tests are timing out with VS2019
1395         https://bugs.webkit.org/show_bug.cgi?id=204000
1396
1397         Reviewed by Brent Fulgham.
1398
1399         When compiling with VS2019, there is a compiler issue, where an Optional without a value is returned
1400         when it should definitely have a value. Work around this issue by moving the local Optional value
1401         when returning.
1402
1403         No new tests, covered by existing tests.
1404
1405         * page/animation/ImplicitAnimation.cpp:
1406         (WebCore::ImplicitAnimation::timeToNextService):
1407         * page/animation/KeyframeAnimation.cpp:
1408         (WebCore::KeyframeAnimation::timeToNextService):
1409
1410 2019-11-11  Youenn Fablet  <youenn@apple.com>
1411
1412         DOMFormData should be available in workers
1413         https://bugs.webkit.org/show_bug.cgi?id=176674
1414
1415         Reviewed by Alex Christensen.
1416
1417         Expose DOMFormData and File to workers.
1418         Covered by existing tests.
1419
1420         * Modules/beacon/NavigatorBeacon.cpp:
1421         (WebCore::NavigatorBeacon::sendBeacon):
1422         * Modules/fetch/FetchBody.cpp:
1423         (WebCore::FetchBody::bodyAsFormData const):
1424         * Modules/fetch/FetchBody.h:
1425         * Modules/fetch/FetchRequest.cpp:
1426         (WebCore::FetchRequest::resourceRequest const):
1427         * fileapi/File.cpp:
1428         (WebCore::File::computeNameAndContentType):
1429         Isolate string as this might now get called from background threads.
1430         * fileapi/File.idl:
1431         * html/DOMFormData.cpp:
1432         (WebCore::DOMFormData::DOMFormData):
1433         * html/DOMFormData.idl:
1434         * platform/network/FormData.cpp:
1435
1436 2019-11-11  Youenn Fablet  <youenn@apple.com>
1437
1438         Fail cross-origin redirection loads in case of CORS with redirection URLs having credentials
1439         https://bugs.webkit.org/show_bug.cgi?id=204036
1440
1441         Reviewed by Alex Christensen.
1442
1443         Update checks in SubresourceLoader according networking process.
1444         Make error messages consistent,
1445         Test: http/tests/navigation/page-cache-mediastream.html
1446
1447         * loader/CrossOriginAccessControl.cpp:
1448         (WebCore::validateCrossOriginRedirectionURL):
1449         (WebCore::isValidCrossOriginRedirectionURL): Deleted.
1450         * loader/CrossOriginAccessControl.h:
1451         * loader/SubresourceLoader.cpp:
1452         (WebCore::SubresourceLoader::didReceiveResponse):
1453         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
1454
1455 2019-11-11  Jer Noble  <jer.noble@apple.com>
1456
1457         ASSERT at PlatformCALayerCocoa::avPlayerLayer(): [platformLayer() sublayers].count == 1
1458         https://bugs.webkit.org/show_bug.cgi?id=204077
1459         <rdar://problem/56640423>
1460
1461         Reviewed by Simon Fraser.
1462
1463         Make PlatformCALayerCocoa::avPlayer() more robust against underlying layer changes.
1464
1465         Promote WebVideoContainerLayer to its own header file and give the class a "playerLayer" property. In
1466         PlatformCALayerCocoa::avPlayer(), use that new property to retrieve the AVPlayerLayer.
1467
1468         Drive-by fix: Make PlatformCALayerCocoa::create() return a Ref<PlatformCALayerCocoa> rather than its parent class type.
1469
1470         * SourcesCocoa.txt:
1471         * WebCore.xcodeproj/project.pbxproj:
1472         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
1473         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
1474         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
1475         (-[WebVideoContainerLayer setBounds:]): Deleted.
1476         (-[WebVideoContainerLayer setPosition:]): Deleted.
1477         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
1478         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1479         (WebCore::PlatformCALayerCocoa::create):
1480         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
1481         (WebCore::PlatformCALayerCocoa::clone const):
1482         (WebCore::PlatformCALayerCocoa::avPlayerLayer const):
1483         * platform/graphics/ca/cocoa/WebVideoContainerLayer.h: Added.
1484         * platform/graphics/ca/cocoa/WebVideoContainerLayer.mm: Added.
1485         (-[WebVideoContainerLayer initWithPlayerLayer:]):
1486         (-[WebVideoContainerLayer playerLayer]):
1487         (-[WebVideoContainerLayer setBounds:]):
1488         (-[WebVideoContainerLayer setPosition:]):
1489
1490 2019-11-11  Antti Koivisto  <antti@apple.com>
1491
1492         Always use matched declarations cache fully when parent inherited style matches
1493         https://bugs.webkit.org/show_bug.cgi?id=204083
1494
1495         Reviewed by Zalan Bujtas.
1496
1497         * css/StyleResolver.cpp:
1498         (WebCore::StyleResolver::applyMatchedProperties):
1499
1500         We used inheritedDataShared check here since it is always just pointer compare.
1501         However instrumentation shows we miss out from singificant amount of cache benefit
1502         due to this and the full check is not expensive.
1503
1504         * rendering/style/RenderStyle.cpp:
1505         (WebCore::RenderStyle::inheritedEqual const):
1506         (WebCore::RenderStyle::inheritedNotEqual const): Deleted.
1507
1508         Reverse the logic.
1509
1510         (WebCore::RenderStyle::inheritedDataShared const): Deleted.
1511
1512         Not used anymore.
1513
1514         * rendering/style/RenderStyle.h:
1515         * rendering/style/SVGRenderStyle.cpp:
1516         (WebCore::SVGRenderStyle::inheritedEqual const):
1517         (WebCore::SVGRenderStyle::inheritedNotEqual const): Deleted.
1518         * rendering/style/SVGRenderStyle.h:
1519         * style/StyleChange.cpp:
1520         (WebCore::Style::determineChange):
1521         * style/StyleTreeResolver.cpp:
1522         (WebCore::Style::createInheritedDisplayContentsStyleIfNeeded):
1523
1524 2019-11-11  Antti Koivisto  <antti@apple.com>
1525
1526         Empty property sets should not mark MatchedProperties uncacheable
1527         https://bugs.webkit.org/show_bug.cgi?id=204079
1528
1529         Reviewed by Zalan Bujtas.
1530
1531         * css/ElementRuleCollector.cpp:
1532         (WebCore::ElementRuleCollector::addElementStyleProperties):
1533
1534         Bail out if there are no incoming properties.
1535
1536 2019-11-11  Andy Estes  <aestes@apple.com>
1537
1538         PaymentRequest / PaymentResponse should not prevent entering the back/forward cache
1539         https://bugs.webkit.org/show_bug.cgi?id=203101
1540         <rdar://problem/56744409>
1541
1542         Reviewed by Chris Dumez.
1543
1544         Removed PaymentRequest's and PaymentResponse's override of
1545         ActiveDOMObject::shouldPreventEnteringBackForwardCache_DEPRECATED and implemented
1546         ActiveDOMObject::suspend instead.
1547
1548         Tests: http/tests/paymentrequest/page-cache-closed-payment-request.https.html
1549                http/tests/paymentrequest/page-cache-completed-payment-response.https.html
1550                http/tests/paymentrequest/page-cache-created-payment-request.https.html
1551                http/tests/paymentrequest/page-cache-created-payment-response.https.html
1552                http/tests/paymentrequest/page-cache-interactive-payment-request.https.html
1553                http/tests/paymentrequest/page-cache-retried-payment-response.https.html
1554
1555         * Modules/paymentrequest/PaymentRequest.cpp:
1556         (WebCore::PaymentRequest::suspend):
1557         (WebCore::PaymentRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.
1558         * Modules/paymentrequest/PaymentRequest.h:
1559         * Modules/paymentrequest/PaymentResponse.cpp:
1560         (WebCore::PaymentResponse::suspend):
1561         (WebCore::PaymentResponse::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.
1562         * Modules/paymentrequest/PaymentResponse.h:
1563         * bindings/js/JSDOMPromiseDeferred.cpp:
1564         (WebCore::DeferredPromise::callFunction):
1565
1566 2019-11-11  Youenn Fablet  <youenn@apple.com>
1567
1568         Make MediaStream/MediaStreamTrack page cache friendly
1569         https://bugs.webkit.org/show_bug.cgi?id=204030
1570
1571         Reviewed by Chris Dumez.
1572
1573         Test: http/tests/navigation/page-cache-mediastream.html
1574
1575         * Modules/mediastream/MediaStream.cpp:
1576         Remove the unnneeded opt-out of page cache in case of MediaStream.
1577         * Modules/mediastream/MediaStream.h:
1578         * Modules/mediastream/MediaStreamTrack.cpp:
1579         (WebCore::MediaStreamTrack::suspend):
1580         In case of a capture track, end it at suspend time  but fire ended event at resume time.
1581         * Modules/mediastream/MediaStreamTrack.h:
1582
1583 2019-11-11  Matt Lewis  <jlewis3@apple.com>
1584
1585         Unreviewed, rolling out r252076.
1586
1587         This broke internal builds and tests. For more information
1588         discuss with your reviewers.
1589
1590         * css/CSSComputedStyleDeclaration.cpp:
1591         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
1592         * css/CSSPrimitiveValueMappings.h:
1593         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1594         * css/CSSProperties.json:
1595         * css/parser/CSSParserFastPaths.cpp:
1596         (WebCore::CSSParserFastPaths::isPartialKeywordPropertyID): Deleted.
1597         * css/parser/CSSParserFastPaths.h:
1598         * css/parser/CSSPropertyParser.cpp:
1599         (WebCore::CSSPropertyParser::parseSingleValue):
1600         * rendering/RenderListMarker.cpp:
1601         (WebCore::effectiveListMarkerType):
1602         (WebCore::listMarkerSuffix):
1603         (WebCore::listMarkerText):
1604         (WebCore::RenderListMarker::styleDidChange):
1605         (WebCore::RenderListMarker::paint):
1606         (WebCore::RenderListMarker::updateContent):
1607         (WebCore::RenderListMarker::computePreferredLogicalWidths):
1608         (WebCore::RenderListMarker::updateMargins):
1609         (WebCore::RenderListMarker::suffix const):
1610         (WebCore::RenderListMarker::getRelativeMarkerRect):
1611         * rendering/style/CounterContent.h:
1612         (WebCore::CounterContent::CounterContent):
1613         * rendering/style/RenderStyle.h:
1614         (WebCore::RenderStyle::initialListStylePosition):
1615         (WebCore::RenderStyle::listStyleStringValue const): Deleted.
1616         (WebCore::RenderStyle::setListStyleStringValue): Deleted.
1617         (WebCore::RenderStyle::initialListStyleStringValue): Deleted.
1618         * rendering/style/RenderStyleConstants.cpp:
1619         (WebCore::operator<<):
1620         * rendering/style/RenderStyleConstants.h:
1621         * rendering/style/StyleRareInheritedData.cpp:
1622         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1623         (WebCore::StyleRareInheritedData::operator== const):
1624         * rendering/style/StyleRareInheritedData.h:
1625         * style/StyleBuilderCustom.h:
1626         (WebCore::Style::BuilderCustom::applyInheritListStyleType): Deleted.
1627         (WebCore::Style::BuilderCustom::applyInitialListStyleType): Deleted.
1628         (WebCore::Style::BuilderCustom::applyValueListStyleType): Deleted.
1629
1630 2019-11-11  Matt Lewis  <jlewis3@apple.com>
1631
1632         Unreviewed, rolling out r252151.
1633
1634         This broke internal builds and tests along with
1635         https://bugs.webkit.org/show_bug.cgi?id=167729#c18. For more
1636         information discuss with your reviewers.
1637
1638         Reverted changeset:
1639
1640         "Keep None value at the end of the ListStyleType enum"
1641         https://bugs.webkit.org/show_bug.cgi?id=203883
1642         https://trac.webkit.org/changeset/252151
1643
1644 2019-11-11  Jer Noble  <jer.noble@apple.com>
1645
1646         Ensure MediaRemote callback always called.
1647         https://bugs.webkit.org/show_bug.cgi?id=204072
1648         <rdar://problem/56301651>
1649
1650         Reviewed by Eric Carlson.
1651
1652         MediaRemote.framework will complain if the callback passed in via MRMediaRemoteAddAsyncCommandHandlerBlock()
1653         is not called for each invocation of the handler. Make sure we always call the completion handler, even in
1654         the case of unsupported commands, or if the listener object has already been destroyed.
1655
1656         * platform/mac/RemoteCommandListenerMac.mm:
1657         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
1658
1659 2019-11-11  Peng Liu  <peng.liu6@apple.com>
1660
1661         [Picture-in-Picture Web API] Support picture-in-picture CSS pseudo-class
1662         https://bugs.webkit.org/show_bug.cgi?id=203493
1663
1664         Reviewed by Dean Jackson.
1665
1666         Add CSS pseudo class ":picture-in-picture" for a video element in the picture-in-picture mode.
1667
1668         Test: media/picture-in-picture/picture-in-picture-api-css-selector.html
1669
1670         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
1671         (WebCore::HTMLVideoElementPictureInPicture::didEnterPictureInPicture):
1672         (WebCore::HTMLVideoElementPictureInPicture::didExitPictureInPicture):
1673         * css/CSSSelector.cpp:
1674         (WebCore::CSSSelector::selectorText const):
1675         * css/CSSSelector.h:
1676         * css/SelectorChecker.cpp:
1677         (WebCore::SelectorChecker::checkOne const):
1678         * css/SelectorCheckerTestFunctions.h:
1679         (WebCore::matchesPictureInPicturePseudoClass):
1680         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
1681         * cssjit/SelectorCompiler.cpp:
1682         (WebCore::SelectorCompiler::addPseudoClassType):
1683
1684 2019-11-11  Commit Queue  <commit-queue@webkit.org>
1685
1686         Unreviewed, rolling out r251460.
1687         https://bugs.webkit.org/show_bug.cgi?id=204070
1688
1689         This patch caused a crash due to synchronous event firing
1690         (Requested by jernoble on #webkit).
1691
1692         Reverted changeset:
1693
1694         "media/W3C/video/networkState/networkState_during_progress.html
1695         is flaky"
1696         https://bugs.webkit.org/show_bug.cgi?id=76280
1697         https://trac.webkit.org/changeset/251460
1698
1699 2019-11-11  Zalan Bujtas  <zalan@apple.com>
1700
1701         [LFC][IFC] Line::m_trimmableRuns does not need to be a ListHashSet
1702         https://bugs.webkit.org/show_bug.cgi?id=204061
1703         <rdar://problem/57064178>
1704
1705         Reviewed by Antti Koivisto.
1706
1707         Switch from ListHashSet to Vector.
1708
1709         * layout/inlineformatting/InlineLine.cpp:
1710         (WebCore::Layout::Line::removeTrailingTrimmableContent):
1711         (WebCore::Layout::Line::appendTextContent):
1712         * layout/inlineformatting/InlineLine.h:
1713
1714 2019-11-10  Zalan Bujtas  <zalan@apple.com>
1715
1716         [LFC][IFC] Move Line::Run's line layout specific logic to InlineItemRun
1717         https://bugs.webkit.org/show_bug.cgi?id=204055
1718         <rdar://problem/57053232>
1719
1720         Reviewed by Antti Koivisto.
1721
1722         Line::Run started getting a bit overloaded through supporting the line layout logic and providing the 'run' interface
1723         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
1724         is expanded some of the properties do not make sense anymore. It makes part of the Run's logic unnecessarily complicated).
1725         This patch introduces the InlineItemRun structure to support the line layout logic. We construct InlineItemRuns
1726         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).
1727
1728         * layout/displaytree/DisplayRun.h:
1729         (WebCore::Display::Run::TextContext::setExpansion):
1730         (WebCore::Display::Run::Run):
1731         (WebCore::Display::Run::TextContext::resetExpansion): Deleted.
1732         * layout/inlineformatting/InlineFormattingContext.cpp:
1733         (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
1734         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
1735         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
1736         * layout/inlineformatting/InlineLine.cpp:
1737         (WebCore::Layout::InlineItemRun::layoutBox const):
1738         (WebCore::Layout::InlineItemRun::logicalRect const):
1739         (WebCore::Layout::InlineItemRun::textContext const):
1740         (WebCore::Layout::InlineItemRun::isText const):
1741         (WebCore::Layout::InlineItemRun::isBox const):
1742         (WebCore::Layout::InlineItemRun::isContainerStart const):
1743         (WebCore::Layout::InlineItemRun::isContainerEnd const):
1744         (WebCore::Layout::InlineItemRun::type const):
1745         (WebCore::Layout::InlineItemRun::setIsCollapsed):
1746         (WebCore::Layout::InlineItemRun::isCollapsed const):
1747         (WebCore::Layout::InlineItemRun::isCollapsedToZeroAdvanceWidth const):
1748         (WebCore::Layout::InlineItemRun::isCollapsible const):
1749         (WebCore::Layout::InlineItemRun::isWhitespace const):
1750         (WebCore::Layout::InlineItemRun::hasExpansionOpportunity const):
1751         (WebCore::Layout::InlineItemRun::InlineItemRun):
1752         (WebCore::Layout::InlineItemRun::setCollapsesToZeroAdvanceWidth):
1753         (WebCore::Layout::Line::Run::Run):
1754         (WebCore::Layout::Line::Run::adjustExpansionBehavior):
1755         (WebCore::Layout::Line::Run::expansionBehavior const):
1756         (WebCore::Layout::Line::Run::setHasExpansionOpportunity):
1757         (WebCore::Layout::Line::Run::setComputedHorizontalExpansion):
1758         (WebCore::Layout::Line::Run::expand):
1759         (WebCore::Layout::Line::~Line):
1760         (WebCore::Layout::Line::isVisuallyEmpty const):
1761         (WebCore::Layout::Line::close):
1762         (WebCore::Layout::Line::alignContentVertically const):
1763         (WebCore::Layout::Line::justifyRuns const):
1764         (WebCore::Layout::Line::alignContentHorizontally const):
1765         (WebCore::Layout::Line::removeTrailingTrimmableContent):
1766         (WebCore::Layout::Line::trailingTrimmableWidth const):
1767         (WebCore::Layout::Line::appendNonBreakableSpace):
1768         (WebCore::Layout::Line::appendTextContent):
1769         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1770         (WebCore::Layout::Line::appendReplacedInlineBox): Need to find a better place for setImage.
1771         (WebCore::Layout::Line::appendLineBreak):
1772         (WebCore::Layout::Line::alignContentVertically): Deleted.
1773         (WebCore::Layout::Line::justifyRuns): Deleted.
1774         (WebCore::Layout::Line::alignContentHorizontally): Deleted.
1775         * layout/inlineformatting/InlineLine.h:
1776         (WebCore::Layout::Line::Run::layoutBox const):
1777         (WebCore::Layout::Line::Run::logicalRect const):
1778         (WebCore::Layout::Line::Run::textContext const):
1779         (WebCore::Layout::Line::Run::isCollapsedToVisuallyEmpty const):
1780         (WebCore::Layout::Line::Run::adjustLogicalTop):
1781         (WebCore::Layout::Line::Run::moveHorizontally):
1782         (WebCore::Layout::Line::Run::moveVertically):
1783         (WebCore::Layout::Line::Run::setTextContext):
1784         (WebCore::Layout::Line::Run::setIsCollapsedToVisuallyEmpty):
1785         (WebCore::Layout::Line::Run::hasExpansionOpportunity const):
1786         (WebCore::Layout::Line::Run::expansionOpportunityCount const):
1787         (WebCore::Layout::Line::Run::displayRun const): Deleted.
1788         (WebCore::Layout::Line::Run::isCollapsed const): Deleted.
1789         (WebCore::Layout::Line::Run::isCollapsible const): Deleted.
1790         (WebCore::Layout::Line::Run::hasTrailingCollapsedContent const): Deleted.
1791         (WebCore::Layout::Line::Run::isWhitespace const): Deleted.
1792         (WebCore::Layout::Line::Run::setIsCollapsed): Deleted.
1793         (WebCore::Layout::Line::Run::isCollapsedToZeroAdvanceWidth const): Deleted.
1794         (WebCore::Layout::Line::Run::setCollapsesToZeroAdvanceWidth): Deleted.
1795         (WebCore::Layout::Line::Run::expansionBehavior const): Deleted.
1796         (WebCore::Layout::Line::Run::setHasExpansionOpportunity): Deleted.
1797         (WebCore::Layout::Line::Run::adjustExpansionBehavior): Deleted.
1798         (WebCore::Layout::Line::Run::setComputedHorizontalExpansion): Deleted.
1799
1800 2019-11-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1801
1802         [Clipboard API] Add some infrastructure to resolve ClipboardItems into pasteboard data for writing
1803         https://bugs.webkit.org/show_bug.cgi?id=203707
1804
1805         Reviewed by Ryosuke Niwa.
1806
1807         Implements a new method that will be used in a future patch to aggregate data vended by ClipboardItems when
1808         writing items to the platform pasteboard. See below for more details; no new tests, since there is no change in
1809         behavior yet.
1810
1811         * Modules/async-clipboard/ClipboardItem.cpp:
1812         (WebCore::ClipboardItem::collectDataForWriting):
1813
1814         Add a new virtual `collectDataForWriting` method, which is used when writing ClipboardItem data to the
1815         pasteboard. This allows ClipboardItems to asynchronously convert data to a PasteboardCustomData after resolving
1816         promises to strings or blobs; or alternately, cancel all data loading if a promise is rejected.
1817
1818         In order to convert items into a list of PasteboardCustomData, we do the following:
1819
1820         set up a PasteboardCustomData corresponding to each clipboard item
1821         for each clipboard item:
1822             for each type in the clipboard item:
1823                 try to resolve the promise
1824                 if the promise resolved to a string:
1825                     write the string to custom data under the type
1826                 if the promise resolved to a blob:
1827                     load the blob data as either text or an ArrayBuffer (depending on the type)
1828                     write either the loaded string or buffer to custom data under the type
1829                 if the promise rejected or resolved to an unsupported value, bail from these steps
1830
1831         * Modules/async-clipboard/ClipboardItem.h:
1832         * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
1833         (WebCore::documentFromClipboard):
1834         (WebCore::readTypeForMIMEType):
1835         (WebCore::ClipboardItemBindingsDataSource::collectDataForWriting):
1836         (WebCore::ClipboardItemBindingsDataSource::invokeCompletionHandler):
1837         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::ClipboardItemTypeLoader):
1838         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::~ClipboardItemTypeLoader):
1839
1840         Add a helper class to hold state associated with loading each clipboard type. This includes the final data
1841         itself (a variant that holds either a String or Blob), as well as a FileReaderLoader which may be present in the
1842         case where the clipboard item type resolves to a blob.
1843
1844         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFinishLoading):
1845         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFail):
1846
1847         Each ClipboardItemType is also the client for its FileReaderLoader, if present; when the FileReaderLoader
1848         finishes loading or fails, we then extract data from the loader and invoke the completion handler.
1849
1850         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::invokeCompletionHandler):
1851         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didResolveToBlob):
1852         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFailToResolve):
1853         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didResolveToString):
1854
1855         One of these three methods is called when the promise corresponding to a clipboard type is either resolved or
1856         rejected. If rejected or resolved to an incompatible type, we call the completion handler immediately with no
1857         data; if we resolve to a string, we simply store the string in `m_data` and invoke the completion handler;
1858         otherwise, if we resolve to a blob, we create a new loader to fetch either the string or data buffer for the
1859         blob, and wait until either didFinishLoading or didFail is called.
1860
1861         * Modules/async-clipboard/ClipboardItemBindingsDataSource.h:
1862         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::create):
1863         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::type):
1864         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::data):
1865         * Modules/async-clipboard/ClipboardItemDataSource.h:
1866         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
1867         (WebCore::ClipboardItemPasteboardDataSource::collectDataForWriting):
1868
1869         For the time being, leave this unimplemented; a future patch will add support for writing ClipboardItems that
1870         came from the platform pasteboard, as opposed to those created by the page.
1871
1872         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.h:
1873
1874 2019-11-10  Antti Koivisto  <antti@apple.com>
1875
1876         Stack allocate StyleResolver state
1877         https://bugs.webkit.org/show_bug.cgi?id=204053
1878
1879         Reviewed by Zalan Bujtas.
1880
1881         State is currently awkwardly a member that gets cleared. It should be stack allocated and
1882         passed around where needed.
1883
1884         * animation/KeyframeEffect.cpp:
1885         (WebCore::KeyframeEffect::updateBlendingKeyframes):
1886         * css/DOMCSSRegisterCustomProperty.cpp:
1887         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
1888         * css/StyleResolver.cpp:
1889         (WebCore::StyleResolver::builderContext):
1890
1891         Helper for initializing Style::Builder from resolver state.
1892
1893         (WebCore::StyleResolver::styleForElement):
1894         (WebCore::StyleResolver::styleForKeyframe):
1895         (WebCore::StyleResolver::keyframeStylesForAnimation):
1896         (WebCore::StyleResolver::pseudoStyleForElement):
1897         (WebCore::StyleResolver::styleForPage):
1898         (WebCore::StyleResolver::defaultStyleForElement):
1899         (WebCore::StyleResolver::pseudoStyleRulesForElement):
1900         (WebCore::StyleResolver::applyMatchedProperties):
1901         (WebCore::StyleResolver::State::clear): Deleted.
1902
1903         Nothing to clear, state is transient.
1904
1905         (WebCore::StyleResolver::setNewStateWithElement): Deleted.
1906         (WebCore::StyleResolver::applyPropertyToStyle): Deleted.
1907         (WebCore::StyleResolver::applyPropertyToCurrentStyle): Deleted.
1908
1909         Style::Builder can be used directly to apply properties instead of via these functions that require state setup.
1910
1911         (WebCore::StyleResolver::initializeFontStyle): Deleted.
1912         * css/StyleResolver.h:
1913         (WebCore::StyleResolver::inspectorCSSOMWrappers):
1914         (WebCore::StyleResolver::style const): Deleted.
1915         (WebCore::StyleResolver::parentStyle const): Deleted.
1916         (WebCore::StyleResolver::rootElementStyle const): Deleted.
1917         (WebCore::StyleResolver::element const): Deleted.
1918         (WebCore::StyleResolver::state): Deleted.
1919         (WebCore::StyleResolver::state const): Deleted.
1920         * html/canvas/CanvasRenderingContext2D.cpp:
1921         (WebCore::CanvasRenderingContext2D::setFont):
1922
1923         Use Style::Builder directly to apply properties.
1924
1925         * style/StyleBuilder.cpp:
1926         (WebCore::Style::Builder::Builder):
1927
1928         Encapsulte immutable arguments into BuilderContext type.
1929
1930         (WebCore::Style::Builder::applyPropertyValue):
1931         * style/StyleBuilder.h:
1932         * style/StyleBuilderState.cpp:
1933         (WebCore::Style::BuilderState::BuilderState):
1934         (WebCore::Style::BuilderState::updateFontForZoomChange):
1935         (WebCore::Style::BuilderState::updateFontForGenericFamilyChange):
1936         * style/StyleBuilderState.h:
1937         (WebCore::Style::BuilderState::parentStyle const):
1938         (WebCore::Style::BuilderState::rootElementStyle const):
1939         (WebCore::Style::BuilderState::document const):
1940         (WebCore::Style::BuilderState::element const):
1941         (WebCore::Style::BuilderState::parentFontDescription):
1942
1943 2019-11-09  Antti Koivisto  <antti@apple.com>
1944
1945         Move style adjustment code out of StyleResolver and into a class of its own
1946         https://bugs.webkit.org/show_bug.cgi?id=204041
1947
1948         Reviewed by Zalan Bujtas.
1949
1950         Introduce Style::Adjuster.
1951
1952         * Sources.txt:
1953         * WebCore.xcodeproj/project.pbxproj:
1954         * css/StyleResolver.cpp:
1955         (WebCore::StyleResolver::styleForElement):
1956         (WebCore::StyleResolver::styleForKeyframe):
1957         (WebCore::StyleResolver::pseudoStyleForElement):
1958         (WebCore::addIntrinsicMargins): Deleted.
1959         (WebCore::equivalentBlockDisplay): Deleted.
1960         (WebCore::doesNotInheritTextDecoration): Deleted.
1961         (WebCore::isScrollableOverflow): Deleted.
1962         (WebCore::hasEffectiveDisplayNoneForDisplayContents): Deleted.
1963         (WebCore::adjustDisplayContentsStyle): Deleted.
1964         (WebCore::StyleResolver::adjustSVGElementStyle): Deleted.
1965         (WebCore::computeEffectiveTouchActions): Deleted.
1966         (WebCore::hasTextChild): Deleted.
1967         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): Deleted.
1968         (WebCore::StyleResolver::adjustRenderStyle): Deleted.
1969         (WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks): Deleted.
1970         * css/StyleResolver.h:
1971         * page/Page.cpp:
1972         (WebCore::Page::recomputeTextAutoSizingInAllFrames):
1973         * rendering/RenderTheme.cpp:
1974         (WebCore::RenderTheme::adjustStyle):
1975
1976         None of this code uses the StyleResolver argument so remove it.
1977
1978         (WebCore::RenderTheme::adjustCheckboxStyle const):
1979         (WebCore::RenderTheme::adjustRadioStyle const):
1980         (WebCore::RenderTheme::adjustButtonStyle const):
1981         (WebCore::RenderTheme::adjustInnerSpinButtonStyle const):
1982         (WebCore::RenderTheme::adjustTextFieldStyle const):
1983         (WebCore::RenderTheme::adjustTextAreaStyle const):
1984         (WebCore::RenderTheme::adjustMenuListStyle const):
1985         (WebCore::RenderTheme::adjustMeterStyle const):
1986         (WebCore::RenderTheme::adjustCapsLockIndicatorStyle const):
1987         (WebCore::RenderTheme::adjustAttachmentStyle const):
1988         (WebCore::RenderTheme::adjustListButtonStyle const):
1989         (WebCore::RenderTheme::adjustProgressBarStyle const):
1990         (WebCore::RenderTheme::adjustMenuListButtonStyle const):
1991         (WebCore::RenderTheme::adjustMediaControlStyle const):
1992         (WebCore::RenderTheme::adjustSliderTrackStyle const):
1993         (WebCore::RenderTheme::adjustSliderThumbStyle const):
1994         (WebCore::RenderTheme::adjustSearchFieldStyle const):
1995         (WebCore::RenderTheme::adjustSearchFieldCancelButtonStyle const):
1996         (WebCore::RenderTheme::adjustSearchFieldDecorationPartStyle const):
1997         (WebCore::RenderTheme::adjustSearchFieldResultsDecorationPartStyle const):
1998         (WebCore::RenderTheme::adjustSearchFieldResultsButtonStyle const):
1999         * rendering/RenderTheme.h:
2000         (WebCore::RenderTheme::adjustApplePayButtonStyle const):
2001         * rendering/RenderThemeCocoa.h:
2002         * rendering/RenderThemeCocoa.mm:
2003         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):
2004         * rendering/RenderThemeGtk.cpp:
2005         (WebCore::RenderThemeGtk::adjustButtonStyle const):
2006         (WebCore::RenderThemeGtk::adjustMenuListStyle const):
2007         (WebCore::RenderThemeGtk::adjustMenuListButtonStyle const):
2008         (WebCore::RenderThemeGtk::adjustTextFieldStyle const):
2009         (WebCore::RenderThemeGtk::adjustSearchFieldResultsButtonStyle const):
2010         (WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle const):
2011         (WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle const):
2012         (WebCore::RenderThemeGtk::adjustListButtonStyle const):
2013         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
2014         (WebCore::RenderThemeGtk::adjustSliderTrackStyle const):
2015         (WebCore::RenderThemeGtk::adjustSliderThumbStyle const):
2016         (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle const):
2017         (WebCore::RenderThemeGtk::adjustProgressBarStyle const):
2018         * rendering/RenderThemeGtk.h:
2019         * rendering/RenderThemeIOS.h:
2020         * rendering/RenderThemeIOS.mm:
2021         (WebCore::RenderThemeIOS::adjustCheckboxStyle const):
2022         (WebCore::RenderThemeIOS::adjustRadioStyle const):
2023         (WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
2024         (WebCore::RenderThemeIOS::adjustSliderTrackStyle const):
2025         (WebCore::RenderThemeIOS::adjustSearchFieldStyle const):
2026         (WebCore::RenderThemeIOS::adjustButtonStyle const):
2027         * rendering/RenderThemeMac.h:
2028         * rendering/RenderThemeMac.mm:
2029         (WebCore::RenderThemeMac::setFontFromControlSize const):
2030         (WebCore::RenderThemeMac::adjustListButtonStyle const):
2031         (WebCore::RenderThemeMac::adjustTextFieldStyle const):
2032         (WebCore::RenderThemeMac::adjustTextAreaStyle const):
2033         (WebCore::RenderThemeMac::adjustProgressBarStyle const):
2034         (WebCore::RenderThemeMac::adjustMenuListStyle const):
2035         (WebCore::RenderThemeMac::adjustMenuListButtonStyle const):
2036         (WebCore::RenderThemeMac::adjustSliderTrackStyle const):
2037         (WebCore::RenderThemeMac::adjustSliderThumbStyle const):
2038         (WebCore::RenderThemeMac::adjustSearchFieldStyle const):
2039         (WebCore::RenderThemeMac::adjustSearchFieldCancelButtonStyle const):
2040         (WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle const):
2041         (WebCore::RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle const):
2042         (WebCore::RenderThemeMac::adjustSearchFieldResultsButtonStyle const):
2043         * style/StyleAdjuster.cpp: Added.
2044         (WebCore::Style::Adjuster::Adjuster):
2045         (WebCore::Style::addIntrinsicMargins):
2046         (WebCore::Style::equivalentBlockDisplay):
2047         (WebCore::Style::isAtShadowBoundary):
2048         (WebCore::Style::doesNotInheritTextDecoration):
2049         (WebCore::Style::isScrollableOverflow):
2050         (WebCore::Style::computeEffectiveTouchActions):
2051         (WebCore::Style::Adjuster::adjust const):
2052         (WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
2053         (WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
2054         (WebCore::Style::Adjuster::adjustSVGElementStyle):
2055         (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
2056         (WebCore::Style::hasTextChild):
2057         (WebCore::Style::Adjuster::adjustForTextAutosizing):
2058         * style/StyleAdjuster.h: Added.
2059         * svg/SVGElement.cpp:
2060         (WebCore::SVGElement::resolveCustomStyle):
2061
2062 2019-11-08  Antoine Quint  <graouts@apple.com>
2063
2064         [Web Animations] Optimize animation resolution to not re-compute whether effects only contain accelerated animation properties
2065         https://bugs.webkit.org/show_bug.cgi?id=204009
2066
2067         Reviewed by Dean Jackson.
2068
2069         A KeyframeEffect already exposes whether it only affects CSS properties that can be accelerated, so use this information instead
2070         of iterating over an effect's animated properties during resolution to get at the same information. 
2071
2072         No tests or changes to existed test expectations as this should not yield any change in behavior.
2073
2074         * dom/Element.cpp:
2075         (WebCore::Element::applyKeyframeEffects):
2076
2077 2019-11-08  Chris Dumez  <cdumez@apple.com>
2078
2079         Add back/forward cache quirk for Vimeo.com
2080         https://bugs.webkit.org/show_bug.cgi?id=204025
2081         <rdar://problem/56996057>
2082
2083         Reviewed by Antti Koivisto.
2084
2085         Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
2086         We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
2087         because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
2088         when coming back from the back/forward cache (e.g. in 'pageshow' event handler).
2089
2090         To address the issue, this patch introduces a quirk to restore pre-r250437 on Vimeo.com, until they get
2091         a chance to fix their content.
2092
2093         * history/BackForwardCache.cpp:
2094         (WebCore::canCacheFrame):
2095         * page/DiagnosticLoggingKeys.cpp:
2096         (WebCore::DiagnosticLoggingKeys::siteSpecificQuirkKey):
2097         * page/DiagnosticLoggingKeys.h:
2098         * page/Quirks.cpp:
2099         (WebCore::Quirks::shouldBypassBackForwardCache const):
2100         * page/Quirks.h:
2101
2102 2019-11-08  Youenn Fablet  <youenn@apple.com>
2103
2104         SWServerWorker in redundant state do not need to process messages from the context process
2105         https://bugs.webkit.org/show_bug.cgi?id=204019
2106
2107         Reviewed by Chris Dumez.
2108
2109         When a service worker is marked as redundant in network process, it might still receive some messages like didFinishActivation or didFinishInstall.
2110         In that state, we do not need to process these messages.
2111         Did some refactoring to directly pass the service worker to the job queue.
2112         This makes it clear the registration and service worker are the correct ones.
2113
2114         * workers/service/server/SWServer.cpp:
2115         (WebCore::SWServer::didFinishInstall):
2116         Pass the worker instead of its identifier.
2117         * workers/service/server/SWServerJobQueue.cpp:
2118         (WebCore::SWServerJobQueue::didFinishInstall):
2119         Now that we are given the service worker, get its registration directly.
2120         * workers/service/server/SWServerJobQueue.h:
2121         * workers/service/server/SWServerWorker.cpp:
2122         (WebCore::SWServerWorker::didFinishInstall):
2123         Exit early in redundant state.
2124         (WebCore::SWServerWorker::didFinishActivation):
2125         Exit early in redundant state.
2126
2127 2019-11-08  youenn fablet  <youenn@apple.com>
2128
2129         XMLHttpRequestUpload should be exposed in dedicated workers
2130         https://bugs.webkit.org/show_bug.cgi?id=203901
2131
2132         Reviewed by Alex Christensen.
2133
2134         Covered by rebased test.
2135
2136         * xml/XMLHttpRequestUpload.idl:
2137
2138 2019-11-08  Jiewen Tan  <jiewen_tan@apple.com>
2139
2140         [WebAuthn] Add quirk needed to support legacy Google NFC Titan security keys
2141         https://bugs.webkit.org/show_bug.cgi?id=204024
2142         <rdar://problem/56962320>
2143
2144         Reviewed by Brent Fulgham.
2145
2146         Covered by manual tests.
2147
2148         * Modules/webauthn/fido/FidoConstants.h:
2149
2150 2019-11-08  Peng Liu  <peng.liu6@apple.com>
2151
2152         Entering/Exiting Picture-in-Picture mode through webkitSetPresentationMode() does not fire events (enterpictureinpicture and leavepictureinpicture) defined in the spec
2153         https://bugs.webkit.org/show_bug.cgi?id=203989
2154
2155         Reviewed by Eric Carlson.
2156
2157         Instantiate a HTMLVideoElementPictureInPicture object when we create a new video element
2158         so that the events defined in the spec will be fired no matter which interface is used
2159         to enter/exit the Picture-in-Picture mode.
2160
2161         Test: media/picture-in-picture/picture-in-picture-events.html
2162
2163         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
2164         (WebCore::HTMLVideoElementPictureInPicture::providePictureInPictureTo):
2165         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.h:
2166         * WebCore.xcodeproj/project.pbxproj:
2167         * html/HTMLVideoElement.cpp:
2168         (WebCore::HTMLVideoElement::create):
2169
2170 2019-11-08  Chris Dumez  <cdumez@apple.com>
2171
2172         Make DeferredPromise behave nicely with regards to the back/forward cache
2173         https://bugs.webkit.org/show_bug.cgi?id=203976
2174
2175         Reviewed by Ryosuke Niwa.
2176
2177         Previously, DeferredPromise would ignore requests to fulfill the promise if
2178         reject/resolve/settle got called while the promise's script execution context
2179         is suspended in the back/forward cache. This is really never the right thing to
2180         do though because this means the promise will never be fulfilled if the user
2181         ever goes back to this page.
2182
2183         To address the issue, DeferredPromise now schedules a task on the event loop if
2184         it gets fulfilled while its script execution context is suspended. As a result,
2185         the promise will properly get fulfilled if the document ever comes out of the
2186         back/forward cache and developers using DeferredPromise do not have to worry
2187         about suspension.
2188
2189         Now that DeferredPromise properly deals with suspended documents, this patch also
2190         reverts changes I made recently in code using DeferredPromise. I had made them
2191         queue a task on the event loop before fulfilling the promise, which did not match
2192         their specification and is no longer needed.
2193
2194         Note that capturing the Strong<> in the lambda is correct here because we want
2195         the resolution value to survive until either:
2196         1. The task is processed by the event loop and the promise is resolved.
2197         2. The back/forward cache entry containing this document is destroyed
2198
2199         Note that we do not leak here because when the back/forward cache's CachedFrame
2200         gets destroyed, it will call Document::prepareForDestruction(), which will call
2201         WindowEventLoop::stop() and destroys all pending tasks associated with this
2202         document. This will therefore destroy the Strong captured in the task.
2203
2204         No new tests, covered by existing back/forward cache tests.
2205
2206         * Modules/cache/DOMCacheStorage.cpp:
2207         (WebCore::DOMCacheStorage::doSequentialMatch):
2208         (WebCore::DOMCacheStorage::match):
2209         (WebCore::DOMCacheStorage::has):
2210         (WebCore::DOMCacheStorage::open):
2211         (WebCore::DOMCacheStorage::doOpen):
2212         (WebCore::DOMCacheStorage::remove):
2213         (WebCore::DOMCacheStorage::doRemove):
2214         (WebCore::DOMCacheStorage::keys):
2215         * Modules/cache/DOMCacheStorage.h:
2216         * Modules/fetch/FetchBodyOwner.cpp:
2217         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
2218         (WebCore::FetchBodyOwner::blobLoadingFailed):
2219         (WebCore::FetchBodyOwner::blobChunk):
2220         * Modules/fetch/FetchBodyOwner.h:
2221         * Modules/mediastream/UserMediaRequest.cpp:
2222         (WebCore::UserMediaRequest::allow):
2223         (WebCore::UserMediaRequest::deny):
2224         * WebCore.xcodeproj/project.pbxproj:
2225         * bindings/IDLTypes.h:
2226         * bindings/js/JSDOMGuardedObject.h:
2227         * bindings/js/JSDOMPromiseDeferred.cpp:
2228         (WebCore::DeferredPromise::callFunction):
2229         (WebCore::DeferredPromise::whenSettled):
2230         (WebCore::DeferredPromise::reject):
2231         * bindings/js/JSDOMPromiseDeferred.h:
2232         (WebCore::DeferredPromise::resolve):
2233         (WebCore::DeferredPromise::resolveWithNewlyCreated):
2234         (WebCore::DeferredPromise::resolveCallbackValueWithNewlyCreated):
2235         (WebCore::DeferredPromise::reject):
2236         (WebCore::DeferredPromise::resolveWithCallback):
2237         (WebCore::DeferredPromise::rejectWithCallback):
2238         (WebCore::DeferredPromise::shouldIgnoreRequestToFulfill const):
2239         * css/FontFaceSet.cpp:
2240         (WebCore::FontFaceSet::didFirstLayout):
2241         (WebCore::FontFaceSet::completedLoading):
2242         (WebCore::FontFaceSet::faceFinished):
2243         * dom/ActiveDOMCallback.cpp:
2244         (WebCore::ActiveDOMCallback::activeDOMObjectsAreSuspended const):
2245         (WebCore::ActiveDOMCallback::activeDOMObjectAreStopped const):
2246         * dom/ActiveDOMCallback.h:
2247         * dom/Element.h:
2248         * dom/ScriptExecutionContext.h:
2249         * page/DOMWindow.h:
2250         * page/RemoteDOMWindow.h:
2251
2252 2019-11-08  Antti Koivisto  <antti@apple.com>
2253
2254         StyleResolver state should store user agent appearance style as RenderStyle
2255         https://bugs.webkit.org/show_bug.cgi?id=204008
2256
2257         Reviewed by Zalan Bujtas.
2258
2259         Generate and pass around user agent style as RenderStyle for apperance computation instead
2260         of awkwardly passing around separate property values.
2261
2262         * css/StyleResolver.cpp:
2263         (WebCore::StyleResolver::styleForElement):
2264         (WebCore::StyleResolver::styleForKeyframe):
2265         (WebCore::StyleResolver::pseudoStyleForElement):
2266         (WebCore::StyleResolver::adjustRenderStyle):
2267         (WebCore::StyleResolver::applyMatchedProperties):
2268         (WebCore::StyleResolver::State::cacheBorderAndBackground): Deleted.
2269         * css/StyleResolver.h:
2270         (WebCore::StyleResolver::element const):
2271         (WebCore::StyleResolver::State::userAgentAppearanceStyle const):
2272         (WebCore::StyleResolver::State::setUserAgentAppearanceStyle):
2273         (WebCore::StyleResolver::element): Deleted.
2274         (WebCore::StyleResolver::State::hasUAAppearance const): Deleted.
2275         (WebCore::StyleResolver::State::borderData const): Deleted.
2276         (WebCore::StyleResolver::State::backgroundData const): Deleted.
2277         (WebCore::StyleResolver::State::backgroundColor const): Deleted.
2278         * rendering/RenderTheme.cpp:
2279         (WebCore::RenderTheme::adjustStyle):
2280         (WebCore::RenderTheme::isControlStyled const):
2281         * rendering/RenderTheme.h:
2282         * rendering/RenderThemeIOS.h:
2283         * rendering/RenderThemeIOS.mm:
2284         (WebCore::RenderThemeIOS::isControlStyled const):
2285         * rendering/RenderThemeMac.h:
2286         * rendering/RenderThemeMac.mm:
2287         (WebCore::RenderThemeMac::isControlStyled const):
2288         * style/StyleBuilder.cpp:
2289         (WebCore::Style::Builder::Builder):
2290
2291         Allow providing style separately from StyleResolver state.
2292
2293         * style/StyleBuilder.h:
2294
2295 2019-11-08  Daniel Bates  <dabates@apple.com>
2296
2297         Add WebKit Legacy SPI to retrieve editable elements in rect
2298         https://bugs.webkit.org/show_bug.cgi?id=204006
2299         <rdar://problem/57024093>
2300
2301         Reviewed by Wenson Hsieh.
2302
2303         Extract code to retrieve the editable elements inside a specified rect from WebKit
2304         to WebCore so that it can be shared by both Modern WebKit and Legacy WebKit.
2305
2306         * page/Page.cpp:
2307         (WebCore::isEditableTextInputElement):
2308         (WebCore::Page::editableElementsInRect const):
2309         * page/Page.h:
2310
2311 2019-11-08  Antoine Quint  <graouts@apple.com>
2312
2313         [Web Animations] Use a keyframe effect stack to resolve animations on an element
2314         https://bugs.webkit.org/show_bug.cgi?id=204010
2315
2316         Reviewed by Dean Jackson.
2317
2318         Until now, when resolving animations for an element, we would call animationsForElement() during each resolution which
2319         means doing several hash table lookups to locate the various classes of animations for that given element, sorting each
2320         of those animations and inserting them into a new Vector.
2321
2322         We now use a KeyframeEffectStack which keeps a list of KeyframeEffect objects that apply to a given target, provided the
2323         effect also has a valid animation and that animation has a valid timeline, all pre-conditions for that effect to produce
2324         an animated value. Any time one of those pre-conditions change, we update the membership of that effect in the stack.
2325         The KeyframeEffectStack is a new member of ElementRareData.
2326
2327         Now, each time we resolve an animation for an element, we iterate over the KeyframeEffect objects returned by calling
2328         sortEffects() on the KeyframeEffectStack which will sort the stack's effects only if a new effect had been added since
2329         the last iteration, which means that simple animations that are not mutated will require sorting of the stack just once,
2330         and the addition of several animations in a single animation frame will require sorting just once as well.
2331
2332         It was also found while doing this work that Style::TreeResolver::createAnimatedElementUpdate would call RenderStyle::clonePtr()
2333         for any element that was part of a document containing a timeline, regardless of whether that element had any animations. Now
2334         we check whether that element's KeyframeEffectStack contains any effects prior to cloning the style.
2335
2336         No tests or changes to existed test expectations as this should not yield any change in behavior.
2337
2338         * Sources.txt: Add the new KeyframeEffectStack.
2339         * WebCore.xcodeproj/project.pbxproj:
2340         * animation/AnimationEffect.h:
2341         (WebCore::AnimationEffect::setAnimation):
2342         * animation/AnimationTimeline.cpp:
2343         (WebCore::AnimationTimeline::removeAnimation):
2344         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Since we need to know the order of CSS @keyframes rules listed in animation-name
2345         when sorting effects, we must compile the ordered list of those @keyframe rules as we update CSS animations for an element and store it on its
2346         KeyframeEffectStack.
2347         * animation/DocumentTimeline.cpp:
2348         (WebCore::DocumentTimeline::resolveAnimationsForElement): Deleted. Replaced by Element::applyKeyframeEffects().
2349         * animation/DocumentTimeline.h:
2350         * animation/KeyframeEffect.cpp:
2351         (WebCore::KeyframeEffect::animationTimelineDidChange):
2352         (WebCore::KeyframeEffect::setAnimation):
2353         (WebCore::KeyframeEffect::setTarget):
2354         * animation/KeyframeEffect.h:
2355         * animation/KeyframeEffectStack.cpp: Added.
2356         (WebCore::KeyframeEffectStack::KeyframeEffectStack):
2357         (WebCore::KeyframeEffectStack::~KeyframeEffectStack):
2358         (WebCore::KeyframeEffectStack::addEffect):
2359         (WebCore::KeyframeEffectStack::removeEffect):
2360         (WebCore::KeyframeEffectStack::sortedEffects):
2361         (WebCore::KeyframeEffectStack::ensureEffectsAreSorted):
2362         (WebCore::KeyframeEffectStack::setCSSAnimationNames):
2363         * animation/KeyframeEffectStack.h: Added.
2364         (WebCore::KeyframeEffectStack::hasEffects const):
2365         * animation/WebAnimation.cpp:
2366         (WebCore::WebAnimation::setTimelineInternal):
2367         (WebCore::WebAnimation::persist):
2368         * dom/Element.cpp:
2369         (WebCore::Element::ensureKeyframeEffectStack):
2370         (WebCore::Element::hasKeyframeEffects const):
2371         (WebCore::Element::applyKeyframeEffects):
2372         * dom/Element.h:
2373         * dom/ElementRareData.cpp:
2374         * dom/ElementRareData.h:
2375         (WebCore::ElementRareData::keyframeEffectStack):
2376         (WebCore::ElementRareData::setKeyframeEffectStack):
2377         * style/StyleTreeResolver.cpp:
2378         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2379
2380 2019-11-07  Dean Jackson  <dino@apple.com>
2381
2382         Add ANGLE backend for iOS device
2383         https://bugs.webkit.org/show_bug.cgi?id=202159
2384         <rdar://57000166>
2385
2386         Reviewed by Myles Maxfield.
2387
2388         Use the ANGLE for iOS backend.
2389
2390         Mostly this was just moving some code around so that it would compile
2391         on iOS when USE(ANGLE) is true. The actual code to render WebGL is
2392         similar between macOS and iOS - both now using a CALayer with
2393         a set of IOSurfaces that are used as swap textures.
2394
2395         The main difference is that macOS (OpenGL) binds to TEXTURE_RECTANGLE,
2396         and iOS (OpenGL ES) binds to the regular TEXTURE_2D.
2397
2398         The remaining missing piece is getting video textures into ANGLE
2399         efficiently (without leaving the GPU). We can ask CoreVideo
2400         to give us raw GL textures, but with ANGLE we no longer have direct access
2401         to the underlying OpenGL context.
2402
2403         This is not enabled in the builds yet, so no tests. However, when
2404         enabled it will be tested against the official WebGL conformance suite.
2405
2406         * html/canvas/WebGLRenderingContextBase.cpp:
2407         (WebCore::WebGLRenderingContextBase::validateVertexAttributes):
2408         * platform/cocoa/CoreVideoSoftLink.cpp:
2409         * platform/cocoa/CoreVideoSoftLink.h:
2410         * platform/graphics/GraphicsContext3D.h:
2411         * platform/graphics/angle/GraphicsContext3DANGLE.cpp:
2412         (WebCore::GraphicsContext3D::reshapeFBOs):
2413         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2414         (WebCore::GraphicsContext3D::GraphicsContext3D):
2415         (WebCore::GraphicsContext3D::allocateIOSurfaceBackingStore):
2416         (WebCore::GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer):
2417         * platform/graphics/cocoa/WebGLLayer.h:
2418         * platform/graphics/cocoa/WebGLLayer.mm:
2419         (-[WebGLLayer initWithGraphicsContext3D:]):
2420         (-[WebGLLayer display]):
2421         (-[WebGLLayer setEGLDisplay:config:]):
2422         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
2423         (-[WebGLLayer bindFramebufferToNextAvailableSurface]):
2424         (-[WebGLLayer setEGLDisplay:andConfig:]): Deleted.
2425         * platform/graphics/cv/TextureCacheCV.mm:
2426         (WebCore::TextureCacheCV::textureFromImage):
2427         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2428         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
2429         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
2430         * platform/graphics/opengl/TemporaryOpenGLSetting.h:
2431
2432 2019-11-08  Chris Dumez  <cdumez@apple.com>
2433
2434         Regression r252209: Layout Test fast/workers/worker-close-more.html is failing
2435         https://bugs.webkit.org/show_bug.cgi?id=203995
2436         <rdar://problem/57020558>
2437
2438         Reviewed by Ryosuke Niwa.
2439
2440         We should not dispatch events on a MessagePort objects in a WorkerGlobalScope which is
2441         closing (i.e. WorkerGlobalScope.close() has been called).
2442
2443         No new tests, covered by fast/workers/worker-close-more.html.
2444
2445         * dom/MessagePort.cpp:
2446         (WebCore::MessagePort::dispatchEvent):
2447
2448 2019-11-08  Peng Liu  <peng.liu6@apple.com>
2449
2450         Picture-in-Picture events are not fired when enter/exit the Picture-in-Picture mode through modern media controls
2451         https://bugs.webkit.org/show_bug.cgi?id=203933
2452
2453         Reviewed by Eric Carlson.
2454
2455         Covered by existing layout test cases. No new test is required.
2456
2457         * Modules/modern-media-controls/media/pip-support.js:
2458         (PiPSupport.prototype.buttonWasPressed):
2459         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
2460         (WebCore::HTMLVideoElementPictureInPicture::didEnterPictureInPicture):
2461         (WebCore::HTMLVideoElementPictureInPicture::didExitPictureInPicture):
2462
2463 2019-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2464
2465         'Strikethrough' editing command reported as 'formatUnderline'
2466         https://bugs.webkit.org/show_bug.cgi?id=203944
2467
2468         Reviewed by Adrian Perez de Castro.
2469
2470         Add an EditAction for strikeThrough command.
2471
2472         Test: fast/events/input-events-strikethrough-type.html
2473
2474         * editing/EditAction.cpp:
2475         (WebCore::undoRedoLabel): Handle StrikeThrough action.
2476         * editing/EditAction.h:
2477         * editing/EditCommand.cpp:
2478         (WebCore::inputTypeNameForEditingAction): Ditto.
2479         * editing/EditorCommand.cpp:
2480         (WebCore::executeStrikethrough): Use StrikeThrough action instead of Underline.
2481
2482 2019-11-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
2483
2484         Default NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject>
2485         https://bugs.webkit.org/show_bug.cgi?id=203868
2486
2487         Reviewed by Ryosuke Niwa.
2488
2489         Ensure that we don't cross boundaries from HTML to SVG when traversing
2490         the tree of nodes upward. We need to stop at the foreignObject if it is
2491         one of the ancestors of the contextElement.
2492
2493         Tests: svg/foreignObject/foreign-object-dynamic-parsing.svg
2494
2495         * html/HTMLTableCellElement.cpp:
2496         (WebCore::HTMLTableCellElement::HTMLTableCellElement):
2497         This assertion should not fire if the tag has a prefix like <h:th> or
2498         <h:td> where 'h' is a defined namespace.
2499
2500         * xml/parser/XMLDocumentParser.cpp:
2501         (WebCore::XMLDocumentParser::parseDocumentFragment):
2502         Stop at the first SVG <foreignObject> ancestor when calculating the
2503         defaultNamespaceURI.
2504
2505         * xml/parser/XMLDocumentParser.h:
2506         * xml/parser/XMLDocumentParserLibxml2.cpp:
2507         (WebCore::XMLDocumentParser::XMLDocumentParser):
2508
2509         (WebCore::XMLDocumentParser::startElementNs):
2510         We need to special case setting the namespaceURI of the SVGElmenets. The
2511         defaultNamespaceURI can be wrong for them if the context element is an
2512         HTML element, <div> for example, and the innerHTML is set to something
2513         like: '<svg><rect/></svg>'.
2514
2515 2019-11-07  Chris Dumez  <cdumez@apple.com>
2516
2517         Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache
2518         https://bugs.webkit.org/show_bug.cgi?id=203985
2519
2520         Reviewed by Ryosuke Niwa.
2521
2522         Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache and drop DOMCache::enqueueTask().
2523
2524         * Modules/cache/DOMCache.cpp:
2525         (WebCore::DOMCache::match):
2526         (WebCore::DOMCache::matchAll):
2527         (WebCore::DOMCache::addAll):
2528         (WebCore::DOMCache::putWithResponseData):
2529         (WebCore::DOMCache::put):
2530         (WebCore::DOMCache::remove):
2531         (WebCore::DOMCache::keys):
2532         (WebCore::DOMCache::enqueueTask): Deleted.
2533         * Modules/cache/DOMCache.h:
2534
2535 2019-11-07  Kenneth Russell  <kbr@chromium.org>
2536
2537         Please support WEBGL_compressed_texture_etc1 extension (and possibly WEBGL_compressed_texture_etc too)
2538         https://bugs.webkit.org/show_bug.cgi?id=197900
2539
2540         Reviewed by Dean Jackson.
2541
2542         Support the ETC1 and ETC2 compressed texture formats in WebKit's WebGL
2543         implementation.
2544
2545         Tested by changing the code to allocate an OpenGL ES 3.0 context for WebGL,
2546         and running in the iOS Simulator. The WebGL conformance tests
2547         webgl-compressed-texture-etc.html and webgl-compressed-texture-etc1.html all
2548         pass with these changes.
2549
2550         When an ANGLE backend is supported on iOS, these extensions will
2551         automatically be supported, and some of the new validation code can be
2552         removed.
2553
2554         * CMakeLists.txt:
2555         * DerivedSources-input.xcfilelist:
2556         * DerivedSources-output.xcfilelist:
2557         * DerivedSources.make:
2558         * Sources.txt:
2559         * WebCore.xcodeproj/project.pbxproj:
2560         * bindings/js/JSDOMConvertWebGL.cpp:
2561         (WebCore::convertToJSValue):
2562         * html/canvas/WebGL2RenderingContext.cpp:
2563         (WebCore::WebGL2RenderingContext::getExtension):
2564         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
2565         * html/canvas/WebGLCompressedTextureETC.cpp: Added.
2566         (WebCore::WebGLCompressedTextureETC::WebGLCompressedTextureETC):
2567         (WebCore::WebGLCompressedTextureETC::getName const):
2568         (WebCore::WebGLCompressedTextureETC::supported):
2569         * html/canvas/WebGLCompressedTextureETC.h: Added.
2570         * html/canvas/WebGLCompressedTextureETC.idl: Added.
2571         * html/canvas/WebGLCompressedTextureETC1.cpp: Added.
2572         (WebCore::WebGLCompressedTextureETC1::WebGLCompressedTextureETC1):
2573         (WebCore::WebGLCompressedTextureETC1::getName const):
2574         (WebCore::WebGLCompressedTextureETC1::supported):
2575         * html/canvas/WebGLCompressedTextureETC1.h: Added.
2576         * html/canvas/WebGLCompressedTextureETC1.idl: Added.
2577         * html/canvas/WebGLExtension.h:
2578         * html/canvas/WebGLRenderingContext.cpp:
2579         (WebCore::WebGLRenderingContext::getExtension):
2580         (WebCore::WebGLRenderingContext::getSupportedExtensions):
2581         * html/canvas/WebGLRenderingContextBase.cpp:
2582         (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
2583         (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
2584         (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
2585         (WebCore::WebGLRenderingContextBase::validateCompressedTexSubDimensions):
2586         * html/canvas/WebGLRenderingContextBase.h:
2587         * platform/graphics/Extensions3D.h:
2588         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2589         (WebCore::GraphicsContext3D::GraphicsContext3D):
2590         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
2591         (WebCore::Extensions3DOpenGL::supportsExtension):
2592
2593 2019-11-07  Ryosuke Niwa  <rniwa@webkit.org>
2594
2595         WindowEventLoop should be shared among similar origin documents
2596         https://bugs.webkit.org/show_bug.cgi?id=203882
2597
2598         Reviewed by Wenson Hsieh.
2599
2600         Made WindowEventLoop shared across similar origin documents.
2601
2602         Also added internals.queueTask to directly test the event loop behavior
2603         since implicitly testing it via other features has been very cumbersome.
2604
2605         This will help test other features that use the HTML5 event loop as well.
2606
2607         Tests: http/tests/eventloop/queue-task-across-cross-site-frames.html
2608                http/tests/eventloop/queue-task-across-frames.html
2609
2610         * dom/Document.cpp:
2611         (WebCore::Document::eventLoop): Use WindowEventLoop::ensureForRegistrableDomain.
2612         * dom/WindowEventLoop.cpp:
2613         (WebCore::WindowEventLoop::ensureForRegistrableDomain): Added. Replaces create,
2614         and returns an existing WindowEventLoop if the RegistrableDomain matches.
2615         (WebCore::WindowEventLoop::WindowEventLoop): Added.
2616         (WebCore::WindowEventLoop::~WindowEventLoop): Added. Removes itself from the map.
2617         * dom/WindowEventLoop.h:
2618         * testing/Internals.cpp:
2619         (WebCore::Internals::queueTask): Added.
2620         * testing/Internals.h:
2621         * testing/Internals.idl:
2622
2623 2019-11-07  Chris Dumez  <cdumez@apple.com>
2624
2625         Drop GenericEventQueue class now that it is unused
2626         https://bugs.webkit.org/show_bug.cgi?id=203980
2627
2628         Reviewed by Ryosuke Niwa.
2629
2630         Drop GenericEventQueue class now that it is unused. All users have been ported to the HTML
2631         event loop. MainThreadGenericEventQueue remains for now but will get dropped in a follow-up
2632         patch, once it is no longer used.
2633
2634         * dom/GenericEventQueue.cpp:
2635         (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
2636         (WebCore::MainThreadGenericEventQueue::enqueueEvent):
2637         (WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
2638         (WebCore::MainThreadGenericEventQueue::close):
2639         (WebCore::MainThreadGenericEventQueue::cancelAllEvents):
2640         (WebCore::MainThreadGenericEventQueue::hasPendingEvents const):
2641         (WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
2642         (WebCore::MainThreadGenericEventQueue::setPaused):
2643         (WebCore::MainThreadGenericEventQueue::suspend):
2644         (WebCore::MainThreadGenericEventQueue::resume):
2645         (WebCore::MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded):
2646         (WebCore::MainThreadGenericEventQueue::stop):
2647         (WebCore::MainThreadGenericEventQueue::activeDOMObjectName const):
2648         (WebCore::TaskQueueConstructor::construct): Deleted.
2649         (WebCore::TaskQueueConstructor<Timer>::construct): Deleted.
2650         (WebCore::GenericEventQueueBase<T>::GenericEventQueueBase): Deleted.
2651         (WebCore::GenericEventQueueBase<T>::enqueueEvent): Deleted.
2652         (WebCore::GenericEventQueueBase<T>::dispatchOneEvent): Deleted.
2653         (WebCore::GenericEventQueueBase<T>::close): Deleted.
2654         (WebCore::GenericEventQueueBase<T>::cancelAllEvents): Deleted.
2655         (WebCore::GenericEventQueueBase<T>::hasPendingEvents const): Deleted.
2656         (WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const): Deleted.
2657         (WebCore::GenericEventQueueBase<T>::setPaused): Deleted.
2658         (WebCore::GenericEventQueueBase<T>::suspend): Deleted.
2659         (WebCore::GenericEventQueueBase<T>::resume): Deleted.
2660         (WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded): Deleted.
2661         (WebCore::GenericEventQueueBase<T>::stop): Deleted.
2662         (WebCore::GenericEventQueueBase<T>::activeDOMObjectName const): Deleted.
2663         (WebCore::GenericEventQueue::create): Deleted.
2664         * dom/GenericEventQueue.h:
2665         (WebCore::GenericEventQueueBase::isSuspended const): Deleted.
2666         (WebCore::GenericEventQueueBase::isSuspendedOrPausedByClient const): Deleted.
2667         (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue): Deleted.
2668         (WebCore::GenericEventQueue::GenericEventQueue): Deleted.
2669
2670 2019-11-07  Chris Dumez  <cdumez@apple.com>
2671
2672         Port Worker to the HTML5 event loop
2673         https://bugs.webkit.org/show_bug.cgi?id=203919
2674
2675         Reviewed by Ryosuke Niwa.
2676
2677         * dom/ActiveDOMObject.h:
2678         * workers/Worker.cpp:
2679         (WebCore::Worker::Worker):
2680         (WebCore::Worker::terminate):
2681         (WebCore::Worker::hasPendingActivity const):
2682         (WebCore::Worker::notifyFinished):
2683         (WebCore::Worker::dispatchEvent):
2684         (WebCore::Worker::enqueueEvent): Deleted.
2685         * workers/Worker.h:
2686         * workers/WorkerMessagingProxy.cpp:
2687         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
2688         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
2689
2690 2019-11-07  Chris Dumez  <cdumez@apple.com>
2691
2692         Port MessagePort to the HTML5 event loop
2693         https://bugs.webkit.org/show_bug.cgi?id=203960
2694
2695         Reviewed by Ryosuke Niwa.
2696
2697         * dom/MessagePort.cpp:
2698         (WebCore::MessagePort::MessagePort):
2699         (WebCore::MessagePort::close):
2700         (WebCore::MessagePort::dispatchMessages):
2701         (WebCore::MessagePort::dispatchEvent):
2702         * dom/MessagePort.h:
2703         * dom/TaskSource.h:
2704
2705 2019-11-07  Antti Koivisto  <antti@apple.com>
2706
2707         Factor matched declarations cache into a class
2708         https://bugs.webkit.org/show_bug.cgi?id=203972
2709
2710         Reviewed by Zalan Bujtas.
2711
2712         Move the code out from StyleResolver and rename "matched properties cache" -> "matched declarations cache"
2713         to better describe it.
2714
2715         * Sources.txt:
2716         * WebCore.xcodeproj/project.pbxproj:
2717         * css/ElementRuleCollector.cpp:
2718         (WebCore::ElementRuleCollector::declarationsForOrigin):
2719
2720         Add a helper.
2721
2722         (WebCore::ElementRuleCollector::transferMatchedRules):
2723
2724         Reserve vector capacity before adding rules.
2725
2726         (WebCore::ElementRuleCollector::addMatchedProperties):
2727         * css/ElementRuleCollector.h:
2728         (WebCore::MatchResult::operator== const):
2729         (WebCore::MatchResult::operator!= const):
2730
2731         Remove the unneeded inline capacity so we can just use MatchResult itself in the cache.
2732
2733         * css/RuleSet.cpp:
2734         (WebCore::RuleSet::addChildRules):
2735         * css/StyleResolver.cpp:
2736         (WebCore::StyleResolver::StyleResolver):
2737         (WebCore::StyleResolver::invalidateMatchedDeclarationsCache):
2738         (WebCore::StyleResolver::clearCachedDeclarationsAffectedByViewportUnits):
2739         (WebCore::StyleResolver::applyMatchedProperties):
2740         (WebCore::StyleResolver::sweepMatchedPropertiesCache): Deleted.
2741         (WebCore::StyleResolver::computeMatchedPropertiesHash): Deleted.
2742         (WebCore::StyleResolver::findFromMatchedPropertiesCache): Deleted.
2743         (WebCore::StyleResolver::addToMatchedPropertiesCache): Deleted.
2744         (WebCore::StyleResolver::invalidateMatchedPropertiesCache): Deleted.
2745         (WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits): Deleted.
2746         (WebCore::isCacheableInMatchedPropertiesCache): Deleted.
2747         * css/StyleResolver.h:
2748         (WebCore::StyleResolver::MatchedPropertiesCacheItem::MatchedPropertiesCacheItem): Deleted.
2749         * dom/Document.cpp:
2750         (WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
2751         (WebCore::Document::updateViewportUnitsOnResize):
2752         * page/Page.cpp:
2753         (WebCore::Page::updateStyleAfterChangeInEnvironment):
2754         * style/MatchedDeclarationsCache.cpp: Added.
2755         (WebCore::Style::MatchedDeclarationsCache::MatchedDeclarationsCache):
2756         (WebCore::Style::MatchedDeclarationsCache::isCacheable):
2757         (WebCore::Style::MatchedDeclarationsCache::computeHash):
2758         (WebCore::Style::MatchedDeclarationsCache::find):
2759         (WebCore::Style::MatchedDeclarationsCache::add):
2760         (WebCore::Style::MatchedDeclarationsCache::invalidate):
2761         (WebCore::Style::MatchedDeclarationsCache::clearEntriesAffectedByViewportUnits):
2762         (WebCore::Style::MatchedDeclarationsCache::sweep):
2763         * style/MatchedDeclarationsCache.h: Added.
2764         * style/StyleTreeResolver.cpp:
2765         (WebCore::Style::TreeResolver::resolveElement):
2766
2767 2019-11-07  Eric Carlson  <eric.carlson@apple.com>
2768
2769         UserMediaController::from(document) can return nullptr
2770         https://bugs.webkit.org/show_bug.cgi?id=203977
2771         <rdar://problem/56908013>
2772
2773         Reviewed by Jer Noble.
2774
2775         * Modules/mediastream/MediaDevices.cpp:
2776         (WebCore::MediaDevices::stop): NULL-check the UserMediaController.
2777
2778 2019-11-07  Chris Dumez  <cdumez@apple.com>
2779
2780         Port ServiceWorkerContainer to the HTML5 event loop
2781         https://bugs.webkit.org/show_bug.cgi?id=203963
2782
2783         Reviewed by Ryosuke Niwa.
2784
2785         * workers/service/ServiceWorkerContainer.cpp:
2786         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
2787         (WebCore::ServiceWorkerContainer::startMessages):
2788         (WebCore::ServiceWorkerContainer::postMessage):
2789         * workers/service/ServiceWorkerContainer.h:
2790
2791 2019-11-06  Ryosuke Niwa  <rniwa@webkit.org>
2792
2793         Integrate scroll event into HTML5 event loop
2794         https://bugs.webkit.org/show_bug.cgi?id=203839
2795         <rdar://problem/56890922>
2796
2797         Reviewed by Simon Fraser.
2798
2799         Dispatch scroll events on each pending scroll event targets inside the update-the-rendering step
2800         of the event loop as specified in the HTML5 and CSSOM View Module specifications:
2801         https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering
2802         https://drafts.csswg.org/cssom-view/#run-the-scroll-steps
2803
2804         The new behavior also matches that of Chrome and Firefox.
2805
2806         Like resize event, the current visual viewport specification does not specify when scroll event
2807         is dispatched on visualViewport interface: https://github.com/WICG/visual-viewport/issues/66
2808         For now, we always dispatch upon it after dispatching on all pending scroll event targets.
2809
2810         Tests: fast/events/scroll-multiple-elements-in-rendering-update.html
2811                fast/events/scroll-subframe-in-rendering-update.html
2812                fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe.html
2813
2814         * dom/Document.cpp:
2815         (WebCore::Document::addPendingScrollEventTarget): Added.
2816         (WebCore::Document::setNeedsVisualViewportScrollEvent): Added.
2817         (WebCore::Document::runScrollSteps): Added. This implements run the scroll steps in CSS OM View.
2818         * dom/Document.h:
2819         * dom/DocumentEventQueue.cpp:
2820         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent): Deleted.
2821         (WebCore::DocumentEventQueue::enqueueScrollEvent): Deleted.
2822         * dom/DocumentEventQueue.h:
2823         * page/EventHandler.cpp:
2824         (WebCore::EventHandler::sendScrollEvent):
2825         * page/Page.cpp:
2826         (WebCore::Page::updateRendering): Invoke runScrollSteps on each document in the frame tree order.
2827         * page/VisualViewport.cpp:
2828         (WebCore::VisualViewport::update):
2829         (WebCore::VisualViewport::enqueueScrollEvent): Deleted.
2830         * page/VisualViewport.h:
2831         * rendering/RenderLayer.cpp:
2832         (WebCore::RenderLayer::scrollTo):
2833         * rendering/RenderListBox.cpp:
2834         (WebCore::RenderListBox::scrollTo):
2835
2836 2019-11-08  Simon Fraser  <simon.fraser@apple.com>
2837
2838         Captcha images render as blank white space
2839         https://bugs.webkit.org/show_bug.cgi?id=204013
2840         rdar://problem/50095458
2841
2842         Reviewed by Zalan Bujtas.
2843         
2844         If updating z-order lists adds layers to the paint-order lists that have
2845         dirty bits, we need to propagate those dirty bits up the tree so that
2846         later dirty bit propagation doesn't stop prematurely. This could happen
2847         when content triggered visibility, and the missing dirty bits caused
2848         subframe layers to not get parented, resulting in missing layers with reCaptcha.
2849         We do this by accumulating dirty bits inside of collectLayers().
2850
2851         Test: compositing/visibility/visibility-change-in-subframe.html
2852
2853         * rendering/RenderLayer.cpp:
2854         (WebCore::RenderLayer::rebuildZOrderLists):
2855         (WebCore::RenderLayer::collectLayers):
2856         (WebCore::RenderLayer::calculateClipRects const):
2857         * rendering/RenderLayer.h:
2858         * rendering/RenderLayerCompositor.cpp:
2859         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2860         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2861         (WebCore::RenderLayerCompositor::layerTreeAsText): Log so that debugging test failures is easier.
2862
2863 2019-11-07  Zalan Bujtas  <zalan@apple.com>
2864
2865         [LFC][MarginCollapsing] Drag anonymous block level boxes into margin collapsing
2866         https://bugs.webkit.org/show_bug.cgi?id=203927
2867         <rdar://problem/56963636>
2868
2869         Reviewed by Antti Koivisto.
2870
2871         We've been ignoring anonymous block level boxes in the context of margin collapsing. Now with IFC, we can't really do that anymore.
2872         This patch removes the early bailout on anon boxes and addresses the fallout.
2873
2874         * layout/MarginTypes.h:
2875         * layout/blockformatting/BlockMarginCollapse.cpp:
2876         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
2877         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const):
2878         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const):
2879         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
2880         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
2881         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling):
2882         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const):
2883         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
2884         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough):
2885         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
2886
2887 2019-11-07  Alex Christensen  <achristensen@webkit.org>
2888
2889         Re-enable NSURLSession isolation after r252116
2890         https://bugs.webkit.org/show_bug.cgi?id=203934
2891         <rdar://problem/56921584>
2892
2893         Reviewed by Chris Dumez.
2894
2895         * platform/network/StoredCredentialsPolicy.h:
2896
2897 2019-11-07  Andres Gonzalez  <andresg_22@apple.com>
2898
2899         Rename AXIsolatedTreeNode to AXIsolatedObject for consistency with AXCoreObject and AccessibilityObject.
2900         https://bugs.webkit.org/show_bug.cgi?id=203913
2901
2902         Reviewed by Chris Fleizach.
2903
2904         No new tests needed, no new functionality.
2905
2906         - Renamed AXIsolatedTreeNode as AXIsolatedObject.
2907         - This makes the naming consistent with AXCoreObject and AccessibilityObject.
2908         - Some code cleanup in WebAccessibilityObjectWrapperBase.h.
2909
2910         * accessibility/AXObjectCache.cpp:
2911         (WebCore::AXObjectCache::createIsolatedAccessibilityTreeHierarchy):
2912         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
2913         * accessibility/AXObjectCache.h:
2914         * accessibility/isolatedtree/AXIsolatedTree.cpp:
2915         (WebCore::AXIsolatedTree::nodeInTreeForID):
2916         (WebCore::AXIsolatedTree::nodeForID const):
2917         (WebCore::AXIsolatedTree::focusedUIElement):
2918         (WebCore::AXIsolatedTree::rootNode):
2919         (WebCore::AXIsolatedTree::setRoot):
2920         (WebCore::AXIsolatedTree::appendNodeChanges):
2921         (WebCore::AXIsolatedTree::applyPendingChanges):
2922         * accessibility/isolatedtree/AXIsolatedTree.h:
2923         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
2924         (WebCore::AXIsolatedObject::AXIsolatedObject):
2925         (WebCore::AXIsolatedObject::create):
2926         (WebCore::AXIsolatedObject::initializeAttributeData):
2927         (WebCore::AXIsolatedObject::setProperty):
2928         (WebCore::AXIsolatedObject::appendChild):
2929         (WebCore::AXIsolatedObject::setParent):
2930         (WebCore::AXIsolatedObject::setTreeIdentifier):
2931         (WebCore::AXIsolatedObject::children):
2932         (WebCore::AXIsolatedObject::focusedUIElement const):
2933         (WebCore::AXIsolatedObject::parentObjectUnignored const):
2934         (WebCore::AXIsolatedObject::accessibilityHitTest const):
2935         (WebCore::AXIsolatedObject::tree const):
2936         (WebCore::AXIsolatedObject::rectAttributeValue const):
2937         (WebCore::AXIsolatedObject::doubleAttributeValue const):
2938         (WebCore::AXIsolatedObject::unsignedAttributeValue const):
2939         (WebCore::AXIsolatedObject::boolAttributeValue const):
2940         (WebCore::AXIsolatedObject::stringAttributeValue const):
2941         (WebCore::AXIsolatedObject::intAttributeValue const):
2942         (WebCore::AXIsolatedObject::updateBackingStore):
2943         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode): Deleted.
2944         (WebCore::AXIsolatedTreeNode::create): Deleted.
2945         (WebCore::AXIsolatedTreeNode::initializeAttributeData): Deleted.
2946         (WebCore::AXIsolatedTreeNode::setProperty): Deleted.
2947         (WebCore::AXIsolatedTreeNode::appendChild): Deleted.
2948         (WebCore::AXIsolatedTreeNode::setParent): Deleted.
2949         (WebCore::AXIsolatedTreeNode::setTreeIdentifier): Deleted.
2950         (WebCore::AXIsolatedTreeNode::children): Deleted.
2951         (WebCore::AXIsolatedTreeNode::focusedUIElement const): Deleted.
2952         (WebCore::AXIsolatedTreeNode::parentObjectUnignored const): Deleted.
2953         (WebCore::AXIsolatedTreeNode::accessibilityHitTest const): Deleted.
2954         (WebCore::AXIsolatedTreeNode::tree const): Deleted.
2955         (WebCore::AXIsolatedTreeNode::rectAttributeValue const): Deleted.
2956         (WebCore::AXIsolatedTreeNode::doubleAttributeValue const): Deleted.
2957         (WebCore::AXIsolatedTreeNode::unsignedAttributeValue const): Deleted.
2958         (WebCore::AXIsolatedTreeNode::boolAttributeValue const): Deleted.
2959         (WebCore::AXIsolatedTreeNode::stringAttributeValue const): Deleted.
2960         (WebCore::AXIsolatedTreeNode::intAttributeValue const): Deleted.
2961         (WebCore::AXIsolatedTreeNode::updateBackingStore): Deleted.
2962         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
2963         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
2964
2965 2019-11-07  Andres Gonzalez  <andresg_22@apple.com>
2966
2967         Implement AXIsolatedTreeNode::roleDescription.
2968         https://bugs.webkit.org/show_bug.cgi?id=203863
2969         <rdar://problem/56934443>
2970
2971         Reviewed by Chris Fleizach.
2972
2973         No new tests needed, no new functionality.
2974
2975         AccessibilityObjectWrapper cannot call any of the AX.*Text functions to
2976         retrieve localized role descriptions, because when running on the
2977         secondary thread, those AtomStrings are not accessible. Moreover, some
2978         of the special cases require access to DOM objects that are not
2979         available in the secondary thread. Therefore, added
2980         AXCoreObject::rolePlatformDescription that runs in the main thread to
2981         initialize the corresponding attribute in AXIsolatedTreeNode.
2982         rolePlatformString, createPlatformRoleMap, roleToPlatformString,
2983         ariaLandmarkRoleDescription, are helper functions. The platform
2984         functions allow to customize the behavior of roleDescription in each
2985         platform. The platform overrides are implemented for mac. Other
2986         platforms are pending.
2987
2988         * accessibility/AccessibilityObject.cpp:
2989         (WebCore::AccessibilityObject::rolePlatformString const):
2990         (WebCore::AccessibilityObject::rolePlatformDescription const):
2991         (WebCore::AccessibilityObject::ariaLandmarkRoleDescription const):
2992         (WebCore::AccessibilityObject::roleDescription const):
2993         (WebCore::Accessibility::createPlatformRoleMap):
2994         (WebCore::Accessibility::roleToPlatformString):
2995         * accessibility/AccessibilityObject.h:
2996         * accessibility/AccessibilityObjectInterface.h:
2997         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
2998         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
2999         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
3000         * accessibility/mac/AccessibilityObjectMac.mm:
3001         (WebCore::AccessibilityObject::rolePlatformString const):
3002         (WebCore::AccessibilityObject::rolePlatformDescription const):
3003         (WebCore::Accessibility::createPlatformRoleMap):
3004         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3005         (-[WebAccessibilityObjectWrapperBase accessibilityObject]):
3006         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]): Implementation moved to AccessibilityObject.
3007         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3008         (-[WebAccessibilityObjectWrapper role]): Special cases moved to rolePlatformString.
3009         (-[WebAccessibilityObjectWrapper roleDescription]):
3010         (createAccessibilityRoleMap): Deleted, became Accessibility::createPlatformRoleMap.
3011         (roleValueToNSString): Deleted, became Accessibility::roleToPlatformString.
3012         * platform/LocalizedStrings.cpp:
3013         (WebCore::AXARIAContentGroupText):
3014         (WebCore::AXHorizontalRuleDescriptionText):
3015         (WebCore::AXMarkText):
3016         * platform/LocalizedStrings.h:
3017         * platform/cocoa/LocalizedStringsCocoa.mm:
3018         (WebCore::AXARIAContentGroupText): Deleted, moved to LocalizedStrings.cpp.
3019         (WebCore::AXHorizontalRuleDescriptionText): Deleted, moved to LocalizedStrings.cpp.
3020         (WebCore::AXMarkText): Deleted, moved to LocalizedStrings.cpp.
3021
3022 2019-11-07  Chris Lord  <clord@igalia.com>
3023
3024         Indentation in ThreadGlobalData.h is incorrect
3025         https://bugs.webkit.org/show_bug.cgi?id=203895
3026
3027         Reviewed by Žan Doberšek.
3028
3029         No new tests -- no change in behavior.
3030
3031         * platform/ThreadGlobalData.h:
3032         (WebCore::ThreadGlobalData::ThreadGlobalData::cachedResourceRequestInitiators):
3033         (WebCore::ThreadGlobalData::ThreadGlobalData::eventNames):
3034         (WebCore::ThreadGlobalData::ThreadGlobalData::threadTimers):
3035         (WebCore::ThreadGlobalData::ThreadGlobalData::qualifiedNameCache):
3036         (WebCore::ThreadGlobalData::ThreadGlobalData::cachedConverterICU):
3037         (WebCore::ThreadGlobalData::ThreadGlobalData::currentState const):
3038         (WebCore::ThreadGlobalData::ThreadGlobalData::setCurrentState):
3039         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
3040         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
3041
3042 2019-11-05  Sergio Villar Senin  <svillar@igalia.com>
3043
3044         VRDisplay should not prevent entering the back/forward cache
3045         https://bugs.webkit.org/show_bug.cgi?id=203105
3046
3047         Reviewed by Chris Dumez.
3048
3049         VRDisplay schedules asynchronous execution of events using the WindowEventLoop instead of
3050         synchronously firing them. WindowEventLoop does correctly suspend while in cache.
3051
3052         Apart from that suspend()/resume() were implemented by forcing m_scriptedAnimationController
3053         to suspend the VR request animation frame machinery while in cache.
3054
3055         Last but not least, stopPresenting() is now also called on suspension.
3056
3057         No new tests were added as there is no testing machinery for WebVR so far. It's unclear how
3058         this unreleased feature will evolve as it's being replaced by WebXR.
3059
3060         * Modules/webvr/VRDisplay.cpp:
3061         (WebCore::VRDisplay::dispatchVRDisplayEventInWindowEventLoop):
3062         (WebCore::VRDisplay::platformDisplayConnected): Use dispatchVRDisplayEventInWindowEventLoop.
3063         (WebCore::VRDisplay::platformDisplayDisconnected): Ditto.
3064         (WebCore::VRDisplay::platformDisplayMounted): Ditto.
3065         (WebCore::VRDisplay::platformDisplayUnmounted): Ditto.
3066         (WebCore::VRDisplay::suspend): Added.
3067         (WebCore::VRDisplay::resume): Added.
3068         (WebCore::VRDisplay::stop): Call stopPresenting().
3069         (WebCore::VRDisplay::shouldPreventEnteringBackForwardCache_DEPRECATED const): Deleted.
3070         * Modules/webvr/VRDisplay.h:
3071
3072 2019-11-06  Devin Rousso  <drousso@apple.com>
3073
3074         Remove unimplemented property error log in when getting a property value from a computed style
3075         https://bugs.webkit.org/show_bug.cgi?id=203943
3076
3077         Reviewed by Simon Fraser.
3078
3079         In r251581, the list of computed CSS properties was changed to be autogenerated from 'CSSProperties.json'.
3080         One issue that arose from this was that `-webkit-text-decorations-in-effect` was no longer part of the
3081         `CSSComputedStyleDeclaration`, which caused a number of editing tests to fail, as that property is used
3082         for holding internal state related to various editing commands (e.g. `document.execCommand(...)`). In
3083         order to get around this, `ComputedStyleExtractor::copyProperties()` was modified to instead copy all CSS
3084         properties, regardless of whether they're part of the set of computed CSS properties. Unfortunately, this
3085         had a side effect of triggering a longstanding `LOG_ERROR` (added in r6178) when attempting to retrieve
3086         the value of certain CSS properties (e.g. `-internal-text-autosizing-status`).
3087
3088         Since this code path can be triggered by JavaScript (e.g. `getComputedStyle(node).getPropertyCSSValue("...")`),
3089         it doesn't add much benefit to have this log, especially since the code itself is already annotated with
3090         comments/FIXMEs for CSS properties that don't have a computed value.
3091
3092         * css/CSSComputedStyleDeclaration.cpp:
3093         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
3094         (WebCore::logUnimplementedPropertyID): Deleted.
3095         * css/SVGCSSComputedStyleDeclaration.cpp:
3096         (WebCore::ComputedStyleExtractor::svgPropertyValue):
3097
3098 2019-11-06  Eric Liang  <ericliang@apple.com>
3099
3100         AX: WKWebView does not shift Accessibility Focus for Catalyst (203798)
3101         https://bugs.webkit.org/show_bug.cgi?id=203798
3102
3103         Reviewed by Chris Fleizach.
3104
3105         Changed to use the new cocoa directory instead of macOS only
3106
3107         * accessibility/mac/AXObjectCacheMac.mm:
3108         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3109
3110 2019-11-06  Fujii Hironori  <Hironori.Fujii@sony.com>
3111
3112         WEBCORE_TESTSUPPORT_EXPORT should be used only for WebCoreTestSupport, not for WebCore
3113         https://bugs.webkit.org/show_bug.cgi?id=203876
3114
3115         Reviewed by Ross Kirsling.
3116
3117         WEBCORE_TESTSUPPORT_EXPORT shouldn't be used for WebCore. It is
3118         only for WebCoreTestSupport module.
3119
3120         WebCoreTestSupport symbols don't need to export on Windows because
3121         it is a static library on it. WEBCORE_TESTSUPPORT_EXPORT should be
3122         empty.
3123
3124         No behavioral changes.
3125
3126         * Modules/encryptedmedia/MediaKeyEncryptionScheme.idl:
3127         * Modules/encryptedmedia/MediaKeySessionType.idl:
3128         * Modules/encryptedmedia/MediaKeysRequirement.idl:
3129         * Modules/mediastream/NavigatorMediaDevices.h:
3130         * bindings/scripts/test/JS/JSTestNode.h:
3131         * bindings/scripts/test/TestNode.idl:
3132         * workers/service/context/ServiceWorkerThreadProxy.h:
3133         Replaced wrongly marked WEBCORE_TESTSUPPORT_EXPORT with WEBCORE_EXPORT.
3134
3135         * testing/js/WebCoreTestSupportPrefix.h: Define WEBCORE_TESTSUPPORT_EXPORT empty.
3136         * WebCorePrefix.h: Removed WEBCORE_TESTSUPPORT_EXPORT definition.
3137
3138 2019-11-06  Simon Fraser  <simon.fraser@apple.com>
3139
3140         Change the UIWebView layer border colors to more strongly differentiate them from WKWebView's colors
3141         https://bugs.webkit.org/show_bug.cgi?id=203940
3142         rdar://problem/56708548
3143
3144         Reviewed by Tim Horton, Wenson Hsieh.
3145
3146         Change layer border colors (which also affect the repaint counter) in UIWebView to use
3147         a chartreuse color, so it's easy to tell at a glance whether an app is using the deprecated
3148         UIWebView.
3149
3150         * platform/ios/LegacyTileCache.mm:
3151         (WebCore::LegacyTileCache::colorForGridTileBorder const):
3152
3153 2019-11-06  Jer Noble  <jer.noble@apple.com>
3154
3155         Screen locks while watching previously-muted-then-unmuted video
3156         https://bugs.webkit.org/show_bug.cgi?id=203906
3157         <rdar://problem/55821375>
3158
3159         Reviewed by Eric Carlson.
3160
3161         Test: media/video-unmuted-after-play-holds-sleep-assertion.html
3162
3163         * html/HTMLMediaElement.cpp:
3164         (WebCore::HTMLMediaElement::setMuted):
3165
3166 2019-11-06  Oriol Brufau  <obrufau@igalia.com>
3167
3168         Keep None value at the end of the ListStyleType enum
3169         https://bugs.webkit.org/show_bug.cgi?id=203883
3170
3171         Reviewed by Manuel Rego Casasnovas.
3172
3173         Bug 203837 added a String value at the end of the ListStyleType enum.
3174         This patch moves it before None, in order to keep None at the end.
3175
3176         * rendering/style/RenderStyleConstants.h:
3177
3178 2019-11-06  Zalan Bujtas  <zalan@apple.com>
3179
3180         [LFC][MarginCollapsing] Add Line::isConsideredEmpty
3181         https://bugs.webkit.org/show_bug.cgi?id=203800
3182         <rdar://problem/56854192>
3183
3184         Reviewed by Antti Koivisto.
3185
3186         https://www.w3.org/TR/CSS22/visuren.html#inline-formatting
3187         Line boxes that contain no text, no preserved white space, no inline elements with non-zero margins, padding, or borders,
3188         and no other in-flow content (such as images, inline blocks or inline tables), and do not end with a preserved newline
3189         must be treated as zero-height line boxes for the purposes of determining the positions of any elements inside of them,
3190         and must be treated as not existing for any other purpose.
3191
3192         Note that it does not necessarily mean visually non-empty line
3193         <span style="font-size: 0px">this is still considered non-empty</span>
3194
3195         * layout/blockformatting/BlockMarginCollapse.cpp:
3196         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
3197         * layout/inlineformatting/InlineLine.cpp:
3198         (WebCore::Layout::Line::appendNonBreakableSpace):
3199         (WebCore::Layout::Line::appendTextContent):
3200         (WebCore::Layout::Line::appendNonReplacedInlineBox):
3201         (WebCore::Layout::Line::appendReplacedInlineBox):
3202         (WebCore::Layout::Line::appendLineBreak):
3203         * layout/inlineformatting/InlineLineBox.h:
3204         (WebCore::Layout::LineBox::isConsideredEmpty const):
3205         (WebCore::Layout::LineBox::setIsConsideredNonEmpty):
3206
3207 2019-11-06  Chris Lord  <clord@igalia.com>
3208
3209         [Cairo] Cairo graphics backend uses ImageBuffer::copyImage just to access native image buffer handles
3210         https://bugs.webkit.org/show_bug.cgi?id=203884
3211
3212         Reviewed by Carlos Garcia Campos.
3213
3214         The Cairo graphics backend uses ImageBuffer::copyImage(DontCopyBackingStore) frequently just to access
3215         the native image pointer. This makes several functions unusable off-main-thread, so add an accessor
3216         function to avoid doing this.
3217
3218         No new tests -- no change in behavior.
3219
3220         * platform/graphics/ImageBuffer.h:
3221         * platform/graphics/cairo/CairoOperations.cpp:
3222         (WebCore::Cairo::drawShadowLayerBuffer):
3223         (WebCore::Cairo::drawShadowImage):
3224         (WebCore::Cairo::fillShadowBuffer):
3225         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3226         (WebCore::GraphicsContext::clipToImageBuffer):
3227         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
3228         (WebCore::GraphicsContextImplCairo::clipToImageBuffer):
3229         * platform/graphics/cairo/ImageBufferCairo.cpp:
3230         (WebCore::ImageBuffer::nativeImage const):
3231
3232 2019-11-06  Philippe Normand  <philn@igalia.com>
3233
3234         REGRESSION(r249428): [GStreamer] VP9 video rendered green
3235         https://bugs.webkit.org/show_bug.cgi?id=201422
3236         <rdar://problem/55945741>
3237
3238         Reviewed by Carlos Garcia Campos.
3239
3240         Enable the texture upload GStreamer meta code path. Until
3241         GStreamer 1.16.2 this workaround is needed to fix VP9 (vp9dec)
3242         rendering. For downstream users cherry-picking the corresponding
3243         GStreamer patch[0], an environment variable can be set to bypass
3244         the reintroduced slow color conversion: $WEBKIT_GST_NO_RGBA_CONVERSION.
3245
3246         [0] https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/commit/8d32de090554cf29fe359f83aa46000ba658a693
3247
3248         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3249         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
3250
3251 2019-11-06  youenn fablet  <youenn@apple.com>
3252
3253         There is no need to clean the content type header of a request if it is null
3254         https://bugs.webkit.org/show_bug.cgi?id=203853
3255
3256         Reviewed by Geoffrey Garen.
3257
3258         No change of behavior.
3259
3260         * loader/CrossOriginAccessControl.cpp:
3261         (WebCore::cleanHTTPRequestHeadersForAccessControl):
3262         Stop early if content type is null so that we do not log an error that is not a real error.
3263
3264 2019-11-05  Ryosuke Niwa  <rniwa@webkit.org>
3265
3266         Integrate visualViewport's resize event with HTML5 event loop
3267         https://bugs.webkit.org/show_bug.cgi?id=203842
3268
3269         Reviewed by Simon Fraser.
3270
3271         Integrate the visual viewport API's resize event with HTML5 event loop
3272         as intended in r251867.
3273
3274         Test: fast/events/resize-subframe-in-rendering-update.html
3275
3276         * dom/DocumentEventQueue.cpp:
3277         (WebCore::DocumentEventQueue::enqueueResizeEvent): Deleted.
3278         * dom/DocumentEventQueue.h:
3279         * page/VisualViewport.cpp:
3280         (WebCore::VisualViewport::update):
3281         (WebCore::VisualViewport::enqueueResizeEvent): Deleted.
3282
3283 2019-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3284
3285         Unreviewed, rolling out r251908.
3286
3287         This workaround is not needed after r252086.
3288
3289         Reverted changeset:
3290
3291         "[WinCairo][Clang] Unreviewed build fix"
3292         https://bugs.webkit.org/show_bug.cgi?id=203663
3293         https://trac.webkit.org/changeset/251908
3294
3295         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3296         (WebCore::ServiceWorkerThreadProxy::identifier const): Deleted.
3297         * workers/service/context/ServiceWorkerThreadProxy.h:
3298
3299 2019-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3300
3301         [Win][CMake] Build WebCore as an OBJECT library unless Apple internal builds
3302         https://bugs.webkit.org/show_bug.cgi?id=203663
3303
3304         Reviewed by Ross Kirsling.
3305
3306         No behavioral changes.
3307
3308         * CMakeLists.txt: Changed WebCoreTestSupport not to link with
3309         WebCore for Windows. Because WebKit.dll exports WebCore symbols,
3310         they will be duplicated with WebCore.
3311
3312 2019-11-05  Ryosuke Niwa  <rniwa@webkit.org>
3313
3314         REGRESSION (r251930): Flaky WK1 crash in printing/pseudo-class-outside-page.html
3315         https://bugs.webkit.org/show_bug.cgi?id=203855
3316
3317         Reviewed by Simon Fraser.
3318
3319         Exit early when executing media queries removes FrameView.
3320
3321         * page/Frame.cpp:
3322         (WebCore::Frame::setPrinting):
3323
3324 2019-11-05  Ryosuke Niwa  <rniwa@webkit.org>
3325
3326         Adding logging to diagnose crashes resulting from provisional document loader unexpectedly being nullptr
3327         https://bugs.webkit.org/show_bug.cgi?id=203837
3328
3329         Reviewed by Geoffrey Garen.
3330
3331         Added various logging for DocumentLoader and FrameLoader to figure out why
3332         FrameLoader::m_provisionalDocumentLoader can be nullptr in some cases.
3333
3334         * loader/DocumentLoader.cpp:
3335         (WebCore::DocumentLoader::setRequest):
3336         (WebCore::DocumentLoader::willSendRequest):
3337         * loader/FrameLoader.cpp:
3338         (WebCore::FrameLoader::setupForReplace):
3339         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
3340         (WebCore::FrameLoader::stopAllLoaders):
3341         (WebCore::FrameLoader::stopForBackForwardCache):
3342         (WebCore::FrameLoader::clearProvisionalLoad):
3343         (WebCore::FrameLoader::transitionToCommitted):
3344         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
3345         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3346
3347 2019-11-05  Oriol Brufau  <obrufau@igalia.com>
3348
3349         [css-lists] Implement list-style-type: <string>
3350         https://bugs.webkit.org/show_bug.cgi?id=167729
3351
3352         Reviewed by Antti Koivisto.
3353
3354         This patch extends the syntax of the list-style-type property to accept
3355         arbitrary string values in order to customize the marker contents.
3356
3357         When a string is specified for list-style-type, the patch sets it to a
3358         special ListStyleType::String, and the string value is stored in an
3359         extra field.
3360
3361         Tests: imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-001a.html
3362                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-001b.html
3363                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-002.html
3364                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-003.html
3365                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-004.html
3366                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-005a.html
3367                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-005b.html
3368                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-006.html
3369                imported/w3c/web-platform-tests/css/css-lists/list-style-type-string-007.html
3370                imported/w3c/web-platform-tests/css/css-lists/parsing/list-style-type-computed.html
3371                imported/w3c/web-platform-tests/css/css-lists/parsing/list-style-type-valid.html
3372
3373         Some tests fail because mixed-bidi is not supported in markers
3374         (https://bugs.webkit.org/show_bug.cgi?id=202849).
3375
3376         * css/CSSComputedStyleDeclaration.cpp:
3377         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
3378         * css/CSSPrimitiveValueMappings.h:
3379         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3380         * css/CSSProperties.json:
3381         * css/parser/CSSParserFastPaths.cpp:
3382         (WebCore::CSSParserFastPaths::isPartialKeywordPropertyID):
3383         * css/parser/CSSParserFastPaths.h:
3384         * css/parser/CSSPropertyParser.cpp:
3385         (WebCore::CSSPropertyParser::parseSingleValue):
3386         * rendering/RenderListMarker.cpp:
3387         (WebCore::effectiveListMarkerType):
3388         (WebCore::listMarkerSuffix):
3389         (WebCore::listMarkerText):
3390         (WebCore::RenderListMarker::styleDidChange):
3391         (WebCore::RenderListMarker::paint):
3392         (WebCore::RenderListMarker::updateContent):
3393         (WebCore::RenderListMarker::computePreferredLogicalWidths):
3394         (WebCore::RenderListMarker::updateMargins):
3395         (WebCore::RenderListMarker::suffix const):
3396         (WebCore::RenderListMarker::getRelativeMarkerRect):
3397         * rendering/style/CounterContent.h:
3398         (WebCore::CounterContent::CounterContent):
3399         * rendering/style/RenderStyle.h:
3400         (WebCore::RenderStyle::listStyleStringValue const):
3401         (WebCore::RenderStyle::setListStyleStringValue):
3402         (WebCore::RenderStyle::initialListStyleStringValue):
3403         * rendering/style/RenderStyleConstants.cpp:
3404         (WebCore::operator<<):
3405         * rendering/style/RenderStyleConstants.h:
3406         * rendering/style/StyleRareInheritedData.cpp:
3407         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3408         (WebCore::StyleRareInheritedData::operator== const):