2020-02-20 Alan Coon Revert r256995. rdar://problem/59478837 2020-02-20 Alan Coon Apply patch. rdar://problem/59298138 Apply the second patch. 2020-02-20 Eric Carlson Captions sometimes render at the wrong size when in fullscreen and PiP https://bugs.webkit.org/show_bug.cgi?id=207389 The TextTrackRepresentation, used to render captions when in fullscreen and PiP on iOS and and in PiP on macOS, frequently rendered captions before layout completed immediately after it was created. Fix this by having it not render until a layout happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's backing layer when cues are not visible instead of destroying the whole object. Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC. * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): (WebCore::HTMLMediaElement::configureTextTrackDisplay): * html/HTMLMediaElementEnums.h: (WTF::LogArgument::toString): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): (WebCore::MediaControlTextTrackContainerElement::updateDisplay): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): (WebCore::MediaControlTextTrackContainerElement::updateSizes): (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): (WebCore::MediaControlTextTrackContainerElement::logger const): (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted. (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted. * platform/graphics/TextTrackRepresentation.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::logChannel const): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): (WebCore::VideoFullscreenLayerManagerObjC::logChannel const): * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]): (TextTrackRepresentationCocoa::setHidden const): (TextTrackRepresentationCocoa::boundsChanged): * rendering/RenderMediaControlElements.cpp: (WebCore::RenderTextTrackContainerElement::layout): 2020-02-19 Alan Coon Apply patch. rdar://problem/59465474 2020-02-19 Antoine Quint [Web Animations] Ensure CSS Transition and CSS Animation events are queued, sorted and dispatched by their timeline https://bugs.webkit.org/show_bug.cgi?id=207364 Reviewed by Simon Fraser. Until now, AnimationPlaybackEvent events, which are new events introduced by the Web Animations spec, were enqueued in a shared queue on the DocumentTimeline and dispatched during the "update animations and send events" procedure. However, AnimationEvent and TransitionEvent events, dispatched by CSS Animations and CSS Transitions, were dispatched via a dedicated per-animation queue, which meant typically that those events were dispathed one runloop after the AnimationPlaybackEvent events. We now remove the dedicated per-animation queue and enqueue all events in the shared DocumentTimeline queue for dispatch during the "update animations and send events" procedure. To do this correctly, we need to do a couple of other things that ensure we don't regress tests. First, we update the DocumentTimeline::shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState() to account for whether there are pending animation events, guaranteeing that an animation update is scheduled should there be any. Second, when animation events are enqueued in DocumentTimeline::enqueueAnimationEvent() we schedule an animation update if needed, since we know we now have pending events that will need to be delivered in an upcoming update. We also maintain a flag between the start of the "update animations and send events" procedure and the moment when the pending animation events queue is cleared prior to dispatching events so that events enqueued in the meantime do not prematurely schedule animation resolution. The need for a new animation resolution will be checked at the end of the procedure. Finally, declarative animations used to have a special suclass of WebAnimation::needsTick() that would check whether they had any pending events, ensuring they would not be removed prematurely. We now reset a flag to false as WebAnimation::tick() is called (as part of the "update animations and send events" procedure) and set it to true in case an animation is enqueued. This flag is then used in needsTick() to guarantee the animation is not removed before the DocumentTimeline has had a chance to dispatch the enqueued event. Note also that, for clarity, the DocumentTimeline::unscheduleAnimationResolution() was renamed to DocumentTimeline::clearTickScheduleTimer() since it wouldn't actually cancel a previous animation resolution schedule. * animation/CSSTransition.h: Fix a newly found build error due to the missing wtf/MonotonicTime.h header. * animation/DeclarativeAnimation.cpp: Remove all code related to the dedicated per-animation queue and instead call the new WebAnimation::enqueueAnimationEvent() method to enqueue events on the DocumentTimeline. (WebCore::DeclarativeAnimation::DeclarativeAnimation): (WebCore::DeclarativeAnimation::tick): (WebCore::DeclarativeAnimation::enqueueDOMEvent): * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::detachFromDocument): Ensure the pending events queue is cleared when the timeline is detached from a document, ensuring that there no longer events that would cause a ref-cycle (DocumentTimeline -> AnimationPlaybackEvent -> WebAnimation -> DocumentTimeline). (WebCore::DocumentTimeline::suspendAnimations): (WebCore::DocumentTimeline::removeAnimation): (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::clearTickScheduleTimer): (WebCore::DocumentTimeline::shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState const): (WebCore::DocumentTimeline::updateCurrentTime): (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): (WebCore::DocumentTimeline::scheduleNextTick): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): (WebCore::DocumentTimeline::enqueueAnimationEvent): * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): (WebCore::WebAnimation::enqueueAnimationEvent): (WebCore::WebAnimation::needsTick const): (WebCore::WebAnimation::tick): * animation/WebAnimation.h: 2020-02-14 Antoine Quint [Web Animations] Make all animation event types inherit from the same base class https://bugs.webkit.org/show_bug.cgi?id=207629 Reviewed by Simon Fraser. Currently we dispatch events CSS Transitions and CSS Animations events using a dedicated event queue on DeclarativeAnimation, while the events added by the Web Animations specification (of type AnimationPlaybackEvent) are dispatched using a shared queue on the DocumentTimeline that is processed during the "update animations and send events procedure". The Web Animations specification dictates that all events should be dispatched during that procedure, which includes sorting of such events based on their timeline time and associated animation relative composite order. In this patch, we prepare the work towards spec compliance for animation events dispatch by making all event types (AnimationPlaybackEvent, TransitionEvent and AnimationEvent) inherit from a single AnimationEventBase interface. This will allow DocumentTimeline to enqueue, sort and dispatch all such events with a single queue in a future patch. Due to CSSAnimationController, we must make the "timeline time" and "animation" parameters optional. When we drop support for CSSAnimationController we'll be able to enforce stronger requirements for these. No new test since this should not introduce any behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEventBase.cpp: Added. (WebCore::AnimationEventBase::AnimationEventBase): * animation/AnimationEventBase.h: Added. (WebCore::AnimationEventBase::create): (WebCore::AnimationEventBase::isAnimationPlaybackEvent const): (WebCore::AnimationEventBase::isAnimationEvent const): (WebCore::AnimationEventBase::isTransitionEvent const): (WebCore::AnimationEventBase::timelineTime const): (WebCore::AnimationEventBase::animation const): * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationPlaybackEvent.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::createEvent): * animation/CSSAnimation.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::createEvent): * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::enqueueDOMEvent): * animation/DeclarativeAnimation.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): * dom/AnimationEvent.cpp: (WebCore::AnimationEvent::AnimationEvent): * dom/AnimationEvent.h: * dom/TransitionEvent.cpp: (WebCore::TransitionEvent::TransitionEvent): * dom/TransitionEvent.h: * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle): 2020-02-19 Alan Coon Cherry-pick r256632. rdar://problem/59478906 NetworkLoadMetrics should be shared by multiple ResourceResponse instances https://bugs.webkit.org/show_bug.cgi?id=207747 Reviewed by Keith Miller. Source/WebCore: ResourceResponse is value data, and it is copied multiple times in various places, (1) to create a new ResourceResponse which has slightly different fields, or (1) to hold ResourceResponse even after loading finishes. For example, DocumentLoader has Vector to replay response dispatching in the case of loading from BackForwardCache. The problem is that ResourceResponse is very large: 440 bytes. While we sometimes copy ResourceResponse to modify some part of it, NetworkLoadMetrics is immutable. It is set when response is created, and is never changed. And NetworkLoadMetrics is large: sizeof(NetworkLoadMetrics) is 184 bytes. Given that we have multiple copies of ResourceResponse in WebCore, we should share NetworkLoadMetrics by them. This patch puts Box in ResourceResponse to share it with all copied ResourceResponses. We do not make NetworkLoadMetrics RefCounted<> for now since some legit data structures embed NetworkLoadMetrics. This patch adds ArgumentCoder for Box so that we can encode / decode Box in ResourceResponse in IPC. To ensure NetworkLoadMetrics in ResourceResponse immutable, we add ResourceResponse::setDeprecatedNetworkLoadMetrics instead of modifying NetworkLoadMetrics already created in ResourceResponse. We also attempt to compact ResourceResponse more by using bit-fields. And removing m_isValid field in ParsedContentRange since this can be represented by the different field. These changes make sizeof(ResourceResponse) from 440 to 248. No behavior change. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): * inspector/agents/InspectorNetworkAgent.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::domainLookupStart const): (WebCore::PerformanceTiming::domainLookupEnd const): (WebCore::PerformanceTiming::connectStart const): (WebCore::PerformanceTiming::connectEnd const): (WebCore::PerformanceTiming::secureConnectionStart const): (WebCore::PerformanceTiming::requestStart const): (WebCore::PerformanceTiming::responseStart const): * platform/network/NetworkLoadMetrics.h: * platform/network/ParsedContentRange.cpp: (WebCore::areContentRangeValuesValid): (WebCore::parseContentRange): (WebCore::ParsedContentRange::ParsedContentRange): (WebCore::ParsedContentRange::headerValue const): * platform/network/ParsedContentRange.h: (WebCore::ParsedContentRange::isValid const): (WebCore::ParsedContentRange::invalidValue): (WebCore::ParsedContentRange::MarkableTraits::isEmptyValue): (WebCore::ParsedContentRange::MarkableTraits::emptyValue): (WebCore::ParsedContentRange::ParsedContentRange): Deleted. * platform/network/ResourceHandle.h: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::ResourceResponseBase): (WebCore::ResourceResponseBase::crossThreadData const): (WebCore::ResourceResponseBase::fromCrossThreadData): (WebCore::ResourceResponseBase::compare): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetricsOrNull const): (WebCore::ResourceResponseBase::setDeprecatedNetworkLoadMetrics): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics const): Deleted. * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::ResourceResponse): * platform/network/cocoa/NetworkLoadMetrics.mm: (WebCore::copyTimingData): * platform/network/curl/CurlResourceHandleDelegate.cpp: (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse): * platform/network/curl/ResourceResponse.h: * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics): Deleted. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::getConnectionTimingData): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): Source/WebKit: Add ArgumentCoder support for Box. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): Tools: * TestWebKitAPI/Tests/WebCore/ParsedContentRange.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256632 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Yusuke Suzuki NetworkLoadMetrics should be shared by multiple ResourceResponse instances https://bugs.webkit.org/show_bug.cgi?id=207747 Reviewed by Keith Miller. ResourceResponse is value data, and it is copied multiple times in various places, (1) to create a new ResourceResponse which has slightly different fields, or (1) to hold ResourceResponse even after loading finishes. For example, DocumentLoader has Vector to replay response dispatching in the case of loading from BackForwardCache. The problem is that ResourceResponse is very large: 440 bytes. While we sometimes copy ResourceResponse to modify some part of it, NetworkLoadMetrics is immutable. It is set when response is created, and is never changed. And NetworkLoadMetrics is large: sizeof(NetworkLoadMetrics) is 184 bytes. Given that we have multiple copies of ResourceResponse in WebCore, we should share NetworkLoadMetrics by them. This patch puts Box in ResourceResponse to share it with all copied ResourceResponses. We do not make NetworkLoadMetrics RefCounted<> for now since some legit data structures embed NetworkLoadMetrics. This patch adds ArgumentCoder for Box so that we can encode / decode Box in ResourceResponse in IPC. To ensure NetworkLoadMetrics in ResourceResponse immutable, we add ResourceResponse::setDeprecatedNetworkLoadMetrics instead of modifying NetworkLoadMetrics already created in ResourceResponse. We also attempt to compact ResourceResponse more by using bit-fields. And removing m_isValid field in ParsedContentRange since this can be represented by the different field. These changes make sizeof(ResourceResponse) from 440 to 248. No behavior change. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): * inspector/agents/InspectorNetworkAgent.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::domainLookupStart const): (WebCore::PerformanceTiming::domainLookupEnd const): (WebCore::PerformanceTiming::connectStart const): (WebCore::PerformanceTiming::connectEnd const): (WebCore::PerformanceTiming::secureConnectionStart const): (WebCore::PerformanceTiming::requestStart const): (WebCore::PerformanceTiming::responseStart const): * platform/network/NetworkLoadMetrics.h: * platform/network/ParsedContentRange.cpp: (WebCore::areContentRangeValuesValid): (WebCore::parseContentRange): (WebCore::ParsedContentRange::ParsedContentRange): (WebCore::ParsedContentRange::headerValue const): * platform/network/ParsedContentRange.h: (WebCore::ParsedContentRange::isValid const): (WebCore::ParsedContentRange::invalidValue): (WebCore::ParsedContentRange::MarkableTraits::isEmptyValue): (WebCore::ParsedContentRange::MarkableTraits::emptyValue): (WebCore::ParsedContentRange::ParsedContentRange): Deleted. * platform/network/ResourceHandle.h: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::ResourceResponseBase): (WebCore::ResourceResponseBase::crossThreadData const): (WebCore::ResourceResponseBase::fromCrossThreadData): (WebCore::ResourceResponseBase::compare): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetricsOrNull const): (WebCore::ResourceResponseBase::setDeprecatedNetworkLoadMetrics): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics const): Deleted. * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::ResourceResponse): * platform/network/cocoa/NetworkLoadMetrics.mm: (WebCore::copyTimingData): * platform/network/curl/CurlResourceHandleDelegate.cpp: (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse): * platform/network/curl/ResourceResponse.h: * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics): Deleted. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::getConnectionTimingData): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): 2020-02-19 Alan Coon Cherry-pick r256610. rdar://problem/59478918 [Web Animations] Make all animation event types inherit from the same base class https://bugs.webkit.org/show_bug.cgi?id=207629 Reviewed by Simon Fraser. Currently we dispatch events CSS Transitions and CSS Animations events using a dedicated event queue on DeclarativeAnimation, while the events added by the Web Animations specification (of type AnimationPlaybackEvent) are dispatched using a shared queue on the DocumentTimeline that is processed during the "update animations and send events procedure". The Web Animations specification dictates that all events should be dispatched during that procedure, which includes sorting of such events based on their timeline time and associated animation relative composite order. In this patch, we prepare the work towards spec compliance for animation events dispatch by making all event types (AnimationPlaybackEvent, TransitionEvent and AnimationEvent) inherit from a single AnimationEventBase interface. This will allow DocumentTimeline to enqueue, sort and dispatch all such events with a single queue in a future patch. Due to CSSAnimationController, we must make the "timeline time" and "animation" parameters optional. When we drop support for CSSAnimationController we'll be able to enforce stronger requirements for these. No new test since this should not introduce any behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEventBase.cpp: Added. (WebCore::AnimationEventBase::AnimationEventBase): * animation/AnimationEventBase.h: Added. (WebCore::AnimationEventBase::create): (WebCore::AnimationEventBase::isAnimationPlaybackEvent const): (WebCore::AnimationEventBase::isAnimationEvent const): (WebCore::AnimationEventBase::isTransitionEvent const): (WebCore::AnimationEventBase::timelineTime const): (WebCore::AnimationEventBase::animation const): * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationPlaybackEvent.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::createEvent): * animation/CSSAnimation.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::createEvent): * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::enqueueDOMEvent): * animation/DeclarativeAnimation.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): * dom/AnimationEvent.cpp: (WebCore::AnimationEvent::AnimationEvent): * dom/AnimationEvent.h: * dom/TransitionEvent.cpp: (WebCore::TransitionEvent::TransitionEvent): * dom/TransitionEvent.h: * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256610 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Antoine Quint [Web Animations] Make all animation event types inherit from the same base class https://bugs.webkit.org/show_bug.cgi?id=207629 Reviewed by Simon Fraser. Currently we dispatch events CSS Transitions and CSS Animations events using a dedicated event queue on DeclarativeAnimation, while the events added by the Web Animations specification (of type AnimationPlaybackEvent) are dispatched using a shared queue on the DocumentTimeline that is processed during the "update animations and send events procedure". The Web Animations specification dictates that all events should be dispatched during that procedure, which includes sorting of such events based on their timeline time and associated animation relative composite order. In this patch, we prepare the work towards spec compliance for animation events dispatch by making all event types (AnimationPlaybackEvent, TransitionEvent and AnimationEvent) inherit from a single AnimationEventBase interface. This will allow DocumentTimeline to enqueue, sort and dispatch all such events with a single queue in a future patch. Due to CSSAnimationController, we must make the "timeline time" and "animation" parameters optional. When we drop support for CSSAnimationController we'll be able to enforce stronger requirements for these. No new test since this should not introduce any behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEventBase.cpp: Added. (WebCore::AnimationEventBase::AnimationEventBase): * animation/AnimationEventBase.h: Added. (WebCore::AnimationEventBase::create): (WebCore::AnimationEventBase::isAnimationPlaybackEvent const): (WebCore::AnimationEventBase::isAnimationEvent const): (WebCore::AnimationEventBase::isTransitionEvent const): (WebCore::AnimationEventBase::timelineTime const): (WebCore::AnimationEventBase::animation const): * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationPlaybackEvent.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::createEvent): * animation/CSSAnimation.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::createEvent): * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::enqueueDOMEvent): * animation/DeclarativeAnimation.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): * dom/AnimationEvent.cpp: (WebCore::AnimationEvent::AnimationEvent): * dom/AnimationEvent.h: * dom/TransitionEvent.cpp: (WebCore::TransitionEvent::TransitionEvent): * dom/TransitionEvent.h: * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle): 2020-02-19 Alan Coon Cherry-pick r256513. rdar://problem/59446986 REGRESSION (r255037): Zooming in and out on Quip in macOS Safari can cause the content to be offset to the side https://bugs.webkit.org/show_bug.cgi?id=207674 rdar://problem/59404866 Reviewed by Antti Koivisto. Source/WebCore: Remove the early return in ScrollingStateScrollingNode::setRequestedScrollData(); comparing with the last m_requestedScrollData is wrong, because requested scroll positions are not "state" in the scrolling tree, they are requests to scroll. Ideally, they would be represented in some different way in the scrolling tree. Test: fast/scrolling/programmatic-scroll-to-zero-zero.html * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::setRequestedScrollData): LayoutTests: Test that does a programmatic scroll to 0,0, does a user scroll, then a second programmatic scroll to 0,0, which is expected to work. * fast/scrolling/programmatic-scroll-to-zero-zero-expected.html: Added. * fast/scrolling/programmatic-scroll-to-zero-zero.html: Added. * platform/ios/TestExpectations: Skip the new test on iOS (it relies on eventSender) and sort the grouping. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256513 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-13 Simon Fraser REGRESSION (r255037): Zooming in and out on Quip in macOS Safari can cause the content to be offset to the side https://bugs.webkit.org/show_bug.cgi?id=207674 rdar://problem/59404866 Reviewed by Antti Koivisto. Remove the early return in ScrollingStateScrollingNode::setRequestedScrollData(); comparing with the last m_requestedScrollData is wrong, because requested scroll positions are not "state" in the scrolling tree, they are requests to scroll. Ideally, they would be represented in some different way in the scrolling tree. Test: fast/scrolling/programmatic-scroll-to-zero-zero.html * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::setRequestedScrollData): 2020-02-19 Alan Coon Cherry-pick r256400. rdar://problem/59446986 Unreviewed, partial rollout of r255037. * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::applyLayerPositions): * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::computeLayerPosition const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256400 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Ryan Haddad Unreviewed, partial rollout of r255037. * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::applyLayerPositions): * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::computeLayerPosition const): 2020-02-19 Alan Coon Cherry-pick r256191. rdar://problem/59447003 Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Source/WebCore: Reviewed by Brent Fulgham. Inspired by . Block setting the base URL to a data URL or JavaScript URL as such usage is questionable. This makes WebKit match the behavior of Chrome and Firefox and is in the spirit of the discussion in . On Mac and iOS, this restriction is applied only to apps linked against a future SDK to avoid breaking shipped apps. For all other ports, this restriction is enabled by default. Tests: fast/url/relative2.html fast/url/segments-from-data-url2.html http/tests/security/allowed-base-url-data-url-via-setting.html http/tests/security/denied-base-url-data-url.html http/tests/security/denied-base-url-javascript-url.html * dom/Document.cpp: (WebCore::Document::processBaseElement): Condition updating the parsed base URL on whether is has an allowed scheme, if restrictions are enabled. Otherwise, do what we do now. If the scheme is disallowed then log a message to the console to explain this to web developers. * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::scan): Pass whether to apply restrictons to the base URL to updatePredictedBaseURL(). This depends on whether the setting is enabled or not. (WebCore::TokenPreloadScanner::updatePredictedBaseURL): Modifed to take a boolean as to whether to apply restrictions. If restrictions are not to be applied do what we do now. Otherwise, only do what we do now if the scheme for the predicated base URL is allowed. * html/parser/HTMLPreloadScanner.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::isBaseURLSchemeAllowed): Added. * page/SecurityPolicy.h: * page/Settings.yaml: Add a setting to toggle restrictions on the base URL scheme. Source/WebKit: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WKWebView _setupPageConfiguration:]): Update settings. * UIProcess/Cocoa/VersionChecks.h: Source/WebKitLegacy/mac: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Misc/WebKitVersionChecks.h: * WebView/WebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WebView _commonInitializationWithFrameName:groupName:]): Update settings. Source/WTF: Reviewed by Brent Fulgham. Add some more macro definitions. * wtf/spi/darwin/dyldSPI.h: LayoutTests: RReviewed by Brent Fulgham. Add some tests. Update others to toggle the setting to apply or unapply the new behavior. The test denied-base-url-javascript-url.html is derived from the test base-url-javascript.html, included in . * fast/url/relative-expected.txt: * fast/url/relative.html: * fast/url/relative2-expected.txt: Copied from LayoutTests/fast/url/relative-expected.txt. * fast/url/relative2.html: Copied from LayoutTests/fast/url/relative.html. * fast/url/resources/utilities.js: (setShouldEllipsizeFileURLPaths): Added. Toggles ellipsizing the path portion of a file URL to simplify matching. Otherwise, file URLs could be machine-specific. (canonicalizedPathname): Added. (segments): Modified to optionally call canonicalizedPathname. (canonicalize): Ditto. * fast/url/segments-from-data-url-expected.txt: * fast/url/segments-from-data-url.html: * fast/url/segments-from-data-url2-expected.txt: Copied from LayoutTests/fast/url/segments-from-data-url-expected.txt. * fast/url/segments-from-data-url2.html: Copied from LayoutTests/fast/url/segments-from-data-url.html. * fetch/fetch-url-serialization-expected.txt: * http/tests/plugins/navigation-during-load-embed.html: * http/tests/plugins/navigation-during-load.html: * http/tests/security/allowed-base-url-data-url-via-setting-expected.txt: Added. * http/tests/security/allowed-base-url-data-url-via-setting.html: Added. * http/tests/security/denied-base-url-data-url-expected.txt: Added. * http/tests/security/denied-base-url-data-url.html: Added. * http/tests/security/denied-base-url-javascript-url-expected.txt: Added. * http/tests/security/denied-base-url-javascript-url.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256191 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Daniel Bates Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Reviewed by Brent Fulgham. Inspired by . Block setting the base URL to a data URL or JavaScript URL as such usage is questionable. This makes WebKit match the behavior of Chrome and Firefox and is in the spirit of the discussion in . On Mac and iOS, this restriction is applied only to apps linked against a future SDK to avoid breaking shipped apps. For all other ports, this restriction is enabled by default. Tests: fast/url/relative2.html fast/url/segments-from-data-url2.html http/tests/security/allowed-base-url-data-url-via-setting.html http/tests/security/denied-base-url-data-url.html http/tests/security/denied-base-url-javascript-url.html * dom/Document.cpp: (WebCore::Document::processBaseElement): Condition updating the parsed base URL on whether is has an allowed scheme, if restrictions are enabled. Otherwise, do what we do now. If the scheme is disallowed then log a message to the console to explain this to web developers. * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::scan): Pass whether to apply restrictons to the base URL to updatePredictedBaseURL(). This depends on whether the setting is enabled or not. (WebCore::TokenPreloadScanner::updatePredictedBaseURL): Modifed to take a boolean as to whether to apply restrictions. If restrictions are not to be applied do what we do now. Otherwise, only do what we do now if the scheme for the predicated base URL is allowed. * html/parser/HTMLPreloadScanner.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::isBaseURLSchemeAllowed): Added. * page/SecurityPolicy.h: * page/Settings.yaml: Add a setting to toggle restrictions on the base URL scheme. 2020-02-19 Alan Coon Revert r256989. rdar://problem/59298138 2020-02-19 Alan Coon Revert r256963. rdar://problem/59478837 2020-02-19 Alan Coon Apply patch. rdar://problem/59298138 2020-02-19 Eric Carlson Captions sometimes render at the wrong size when in fullscreen and PiP https://bugs.webkit.org/show_bug.cgi?id=207389 The TextTrackRepresentation, used to render captions when in fullscreen and PiP on iOS and and in PiP on macOS, frequently rendered captions before layout completed immediately after it was created. Fix this by having it not render until a layout happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's backing layer when cues are not visible instead of destroying the whole object. Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC. * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): (WebCore::HTMLMediaElement::configureTextTrackDisplay): * html/HTMLMediaElementEnums.h: (WTF::LogArgument::toString): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): (WebCore::MediaControlTextTrackContainerElement::updateDisplay): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): (WebCore::MediaControlTextTrackContainerElement::updateSizes): (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): (WebCore::MediaControlTextTrackContainerElement::logger const): (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted. (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted. * platform/graphics/TextTrackRepresentation.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::logChannel const): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): (WebCore::VideoFullscreenLayerManagerObjC::logChannel const): * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]): (TextTrackRepresentationCocoa::setHidden const): (TextTrackRepresentationCocoa::boundsChanged): * rendering/RenderMediaControlElements.cpp: (WebCore::RenderTextTrackContainerElement::layout): 2020-02-19 Russell Epstein Apply patch. rdar://problem/59478837 2020-02-19 Antoine Quint [Web Animations] Style changes due to Web Animations should not trigger CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=207760 Reviewed by Simon Fraser. While we would consider the unanimated style of CSS Animations specifically when considering what the "start" style values (before-change style in spec terminology) should be when considering whether to start a CSS Transition during style resolution, we would not consider other types of animations, specifically JS-created Web Animations. However, Web Platform Tests specifically test whether changes made using the Web Animations API may trigger transitions, and until now they would because the RenderStyle used to determine the before-change style was the style from the previous resolution, which would include animated values. To fix this, we make it so that KeyframeEffect objects now keep a copy of the unanimated style used when blending animated values for the very first time. That style is cleared each time keyframes change, which is rare, but may happen through the Web Animations API. Then in AnimationTimeline::updateCSSTransitionsForElementAndProperty(), we look for a KeyframeEffect currently affecting the property for which we're considering starting a CSS Transition, and use its unanimated style. If that unanimated style has not been set yet, this is because the KeyframeEffect has not had a chance to apply itself with a non-null progress. In this case, the before-change and after-change styles should be the same in order to prevent a transition from being triggered as the unanimated style for this keyframe effect will most likely be this after-change style, or any future style change that may happen before the keyframe effect starts blending animated values. Finally, tracking the unanimated style at the KeyframeEffect level means we no longer to track it specifically for CSSAnimation. * animation/AnimationTimeline.cpp: (WebCore::keyframeEffectForElementAndProperty): (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty): * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::create): (WebCore::CSSAnimation::CSSAnimation): * animation/CSSAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::animatesProperty const): Because the backing KeyframeList object may not have been created by the first time we query a KeyframeEffect during CSS Transitions resolution, we provide a method that will check the values provided by the Web Animations API to determine whether it targets a given CSS property. (WebCore::KeyframeEffect::clearBlendingKeyframes): (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::apply): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::unanimatedStyle const): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): 2020-02-17 Alan Coon Revert r256693. rdar://problem/59478981 2020-02-17 Alex Christensen Fix build after r256689 * css/StyleProperties.h: Add missing include that wasn't on the branch. 2020-02-14 Russell Epstein Cherry-pick r256636. rdar://problem/59478734 [Web Animations] Missing call to DocumentTimeline::resumeAnimations() in Frame::resumeActiveDOMObjectsAndAnimations() https://bugs.webkit.org/show_bug.cgi?id=207784 Patch by Antoine Quint on 2020-02-14 Reviewed by Dean Jackson. After auditing the code, there was one call to CSSAnimationController::resumeAnimationsForDocument() that missed a matching DocumentTimeline::resumeAnimations() call should the Web Animations flag be on. * page/Frame.cpp: (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256636 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Antoine Quint [Web Animations] Missing call to DocumentTimeline::resumeAnimations() in Frame::resumeActiveDOMObjectsAndAnimations() https://bugs.webkit.org/show_bug.cgi?id=207784 Reviewed by Dean Jackson. After auditing the code, there was one call to CSSAnimationController::resumeAnimationsForDocument() that missed a matching DocumentTimeline::resumeAnimations() call should the Web Animations flag be on. * page/Frame.cpp: (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): 2020-02-14 Russell Epstein Cherry-pick r256623. rdar://problem/59478938 Ensure animations that lose their effect don't schedule an animation update https://bugs.webkit.org/show_bug.cgi?id=207713 rdar://59174840 Patch by Sunny He on 2020-02-14 Reviewed by Antoine Quint. Source/WebCore: An active animation for which the effect is removed may be considered for an upcoming animation resolution. However, WebAnimation::timeToNextTick() expects a valid effect to be available to be able to determine timing. We now check an animation is relevant before calling timeToNextTick() and add an ASSERT() in that function to catch cases where an animation effect might not be available. Source/WebCore: Test: webanimations/animation-null-effect.html * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleNextTick): * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextTick const): LayoutTests: * webanimations/animation-null-effect-expected.txt: Added. * webanimations/animation-null-effect.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256623 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Sunny He Ensure animations that lose their effect don't schedule an animation update https://bugs.webkit.org/show_bug.cgi?id=207713 rdar://59174840 Reviewed by Antoine Quint. Source/WebCore: An active animation for which the effect is removed may be considered for an upcoming animation resolution. However, WebAnimation::timeToNextTick() expects a valid effect to be available to be able to determine timing. We now check an animation is relevant before calling timeToNextTick() and add an ASSERT() in that function to catch cases where an animation effect might not be available. Test: webanimations/animation-null-effect.html * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleNextTick): * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextTick const): 2020-02-14 Russell Epstein Cherry-pick r256580. rdar://problem/59478981 Dark Mode: In Notes, list item becomes invisible in dark mode after outdenting https://bugs.webkit.org/show_bug.cgi?id=207676 Reviewed by Wenson Hsieh and Timothy Hatcher. Source/WebCore: The bug was caused by EditingStyle::inverseTransformColorIfNeeded converting -apple-system-label to transparent color in ReplaceSelectionCommand when InsertListCommand invokes moveParagraphs. This patch fixes the bug in EditingStyle::inverseTransformColorIfNeeded by treating any semantic color name or semantic RGB color value as if the color was not specified. It also fixes the bug that removeStyleFromRulesAndContext was incapable of removing superflous semantic color names that appear in the inline since the context's computed style only contain RGB values by replacing the inline style's color values with that of the computed style. This fix is necessary to eliminate -apple-system-label in the pasted content, which can cause issues when such a content is sync'ed to other devices via iCloud, etc... Tests: PasteHTML.TransformColorsOfDarkContentButNotSemanticColor PasteHTML.DoesNotTransformColorsOfLightContentDuringOutdent * editing/EditingStyle.cpp: (WebCore::EditingStyle::removeStyleFromRulesAndContext): (WebCore::EditingStyle::inverseTransformColorIfNeeded): Tools: Added regression tests for pasting content with -apple-system-label and outdenting content. * TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm: (PasteHTML.TransformColorsOfDarkContentButNotSemanticColor): (PasteHTML.DoesNotTransformColorsOfLightContentDuringOutdent): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256580 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-13 Ryosuke Niwa Dark Mode: In Notes, list item becomes invisible in dark mode after outdenting https://bugs.webkit.org/show_bug.cgi?id=207676 Reviewed by Wenson Hsieh and Timothy Hatcher. The bug was caused by EditingStyle::inverseTransformColorIfNeeded converting -apple-system-label to transparent color in ReplaceSelectionCommand when InsertListCommand invokes moveParagraphs. This patch fixes the bug in EditingStyle::inverseTransformColorIfNeeded by treating any semantic color name or semantic RGB color value as if the color was not specified. It also fixes the bug that removeStyleFromRulesAndContext was incapable of removing superflous semantic color names that appear in the inline since the context's computed style only contain RGB values by replacing the inline style's color values with that of the computed style. This fix is necessary to eliminate -apple-system-label in the pasted content, which can cause issues when such a content is sync'ed to other devices via iCloud, etc... Tests: PasteHTML.TransformColorsOfDarkContentButNotSemanticColor PasteHTML.DoesNotTransformColorsOfLightContentDuringOutdent * editing/EditingStyle.cpp: (WebCore::EditingStyle::removeStyleFromRulesAndContext): (WebCore::EditingStyle::inverseTransformColorIfNeeded): 2020-02-14 Russell Epstein Cherry-pick r256482. rdar://problem/59478881 Shrink CachedResource https://bugs.webkit.org/show_bug.cgi?id=207618 Reviewed by Mark Lam. Source/WebCore: This patch shrinks sizeof(CachedResource) by 80 bytes by aggressively using bit-fields and Markable<>. For each enum class, we define `bitsOfXXX` value, which indicates # of bits to represent it. And using this value for bit-field's width. No behavior change. * loader/FetchOptions.h: (WebCore::FetchOptions::encode const): * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): (WebCore::ResourceLoaderOptions::loadedFromOpaqueSource): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): (WebCore::CachedImage::shouldDeferUpdateImageData const): (WebCore::CachedImage::didUpdateImageData): * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::load): (WebCore::CachedResource::finish): * loader/cache/CachedResource.h: (WebCore::CachedResource::setStatus): * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::isEmptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::emptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): * platform/network/NetworkLoadMetrics.h: (WebCore::NetworkLoadMetrics::isolatedCopy const): (WebCore::NetworkLoadMetrics::clearNonTimingData): (WebCore::NetworkLoadMetrics::operator== const): (WebCore::NetworkLoadMetrics::encode const): (WebCore::NetworkLoadMetrics::decode): * platform/network/ResourceLoadPriority.h: * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): * platform/network/ResourceResponseBase.h: * platform/network/StoredCredentialsPolicy.h: Source/WTF: * wtf/Markable.h: (WTF::Markable::asOptional const): Add helper method to get Optional easily from Markable. * wtf/ObjectIdentifier.h: (WTF::ObjectIdentifier::MarkableTraits::isEmptyValue): (WTF::ObjectIdentifier::MarkableTraits::emptyValue): (WTF::ObjectIdentifier::ObjectIdentifier): Add MarkableTraits for ObjectIdentifier. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256482 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Yusuke Suzuki Shrink CachedResource https://bugs.webkit.org/show_bug.cgi?id=207618 Reviewed by Mark Lam. This patch shrinks sizeof(CachedResource) by 80 bytes by aggressively using bit-fields and Markable<>. For each enum class, we define `bitsOfXXX` value, which indicates # of bits to represent it. And using this value for bit-field's width. No behavior change. * loader/FetchOptions.h: (WebCore::FetchOptions::encode const): * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): (WebCore::ResourceLoaderOptions::loadedFromOpaqueSource): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): (WebCore::CachedImage::shouldDeferUpdateImageData const): (WebCore::CachedImage::didUpdateImageData): * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::load): (WebCore::CachedResource::finish): * loader/cache/CachedResource.h: (WebCore::CachedResource::setStatus): * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::isEmptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::emptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): * platform/network/NetworkLoadMetrics.h: (WebCore::NetworkLoadMetrics::isolatedCopy const): (WebCore::NetworkLoadMetrics::clearNonTimingData): (WebCore::NetworkLoadMetrics::operator== const): (WebCore::NetworkLoadMetrics::encode const): (WebCore::NetworkLoadMetrics::decode): * platform/network/ResourceLoadPriority.h: * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): * platform/network/ResourceResponseBase.h: * platform/network/StoredCredentialsPolicy.h: 2020-02-14 Russell Epstein Cherry-pick r256423. rdar://problem/59478731 Compress ImmutableStyleProperties by using PackedPtr https://bugs.webkit.org/show_bug.cgi?id=207604 Reviewed by Mark Lam. ImmutableStyleProperties is kept so long and consumes enough memory. We already attempted to compact it by storing CSSProperty's members separately. But we can compact further by using PackedPtr. This patch makes, 1. Use PackedPtr for CSSValue* in ImmutableStyleProperties so that we can cut some bytes 2. Reorder CSSValue* and StylePropertyMetadata arrays since StylePropertyMetadata requires alignment while PackedPtr is not. No behavior change. * css/StyleProperties.cpp: (WebCore::sizeForImmutableStylePropertiesWithPropertyCount): (WebCore::ImmutableStyleProperties::ImmutableStyleProperties): (WebCore::ImmutableStyleProperties::~ImmutableStyleProperties): (WebCore::ImmutableStyleProperties::findCustomPropertyIndex const): * css/StyleProperties.h: (WebCore::ImmutableStyleProperties::valueArray const): (WebCore::ImmutableStyleProperties::metadataArray const): (WebCore::ImmutableStyleProperties::propertyAt const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256423 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Yusuke Suzuki Compress ImmutableStyleProperties by using PackedPtr https://bugs.webkit.org/show_bug.cgi?id=207604 Reviewed by Mark Lam. ImmutableStyleProperties is kept so long and consumes enough memory. We already attempted to compact it by storing CSSProperty's members separately. But we can compact further by using PackedPtr. This patch makes, 1. Use PackedPtr for CSSValue* in ImmutableStyleProperties so that we can cut some bytes 2. Reorder CSSValue* and StylePropertyMetadata arrays since StylePropertyMetadata requires alignment while PackedPtr is not. No behavior change. * css/StyleProperties.cpp: (WebCore::sizeForImmutableStylePropertiesWithPropertyCount): (WebCore::ImmutableStyleProperties::ImmutableStyleProperties): (WebCore::ImmutableStyleProperties::~ImmutableStyleProperties): (WebCore::ImmutableStyleProperties::findCustomPropertyIndex const): * css/StyleProperties.h: (WebCore::ImmutableStyleProperties::valueArray const): (WebCore::ImmutableStyleProperties::metadataArray const): (WebCore::ImmutableStyleProperties::propertyAt const): 2020-02-14 Russell Epstein Cherry-pick r254681. rdar://problem/59474790 [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=206299 Reviewed by Brent Fulgham. .: This patch has been created by don.olmstead@sony.com and pvollan@apple.com. Add target files for WTF and JavaScriptCore. Also, to make sure headers are copied to the forwarding headers directory, add the CMake keywork ALL when adding custom target for copying files. * Source/cmake/TargetJavaScriptCore.cmake: Added. * Source/cmake/TargetWTF.cmake: Added. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Include required target. Build internal builds with VS2019. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.proj: Source/WebCore: Include required targets. Build internal builds with VS2019. * CMakeLists.txt: * WebCore.vcxproj/WebCore.proj: Source/WebKitLegacy: Include required targets. Build internal builds with VS2019. * CMakeLists.txt: * WebKitLegacy.vcxproj/WebKitLegacy.proj: Source/WTF: Build internal builds with VS2019. * WTF.vcxproj/WTF.proj: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254681 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-16 Per Arne Vollan [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=206299 Reviewed by Brent Fulgham. Include required targets. Build internal builds with VS2019. * CMakeLists.txt: * WebCore.vcxproj/WebCore.proj: 2020-02-14 Russell Epstein Cherry-pick r252849. rdar://problem/59446998 Crash in WebCore::ServiceWorkerRegistrationKey::hash() const https://bugs.webkit.org/show_bug.cgi?id=204497 Reviewed by Alex Christensen. Source/WebCore: Update ServiceWorkerContainer::jobResolvedWithRegistration to handle the case of a ServiceWorkerContainer that might have a job whose promise is not related to the same context. In that case, the ServiceWorkerContainer might get stopped, thus its m_ongoingSettledRegistrations be cleared. But the promise may get settled shortly after since its context is not stopped and will then retrieve an empty registration data key. This is difficult to test given we do not control when the resolvedWithRegistration task is posted to the client. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): * workers/service/ServiceWorkerRegistrationKey.h: (WebCore::ServiceWorkerRegistrationKey::encode const): Add release asserts to make sure we do not store/transfer empty registration keys. Source/WebKit: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Add a release assert to be able to further debug the crash. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252849 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-11-25 Youenn Fablet Crash in WebCore::ServiceWorkerRegistrationKey::hash() const https://bugs.webkit.org/show_bug.cgi?id=204497 Reviewed by Alex Christensen. Update ServiceWorkerContainer::jobResolvedWithRegistration to handle the case of a ServiceWorkerContainer that might have a job whose promise is not related to the same context. In that case, the ServiceWorkerContainer might get stopped, thus its m_ongoingSettledRegistrations be cleared. But the promise may get settled shortly after since its context is not stopped and will then retrieve an empty registration data key. This is difficult to test given we do not control when the resolvedWithRegistration task is posted to the client. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): * workers/service/ServiceWorkerRegistrationKey.h: (WebCore::ServiceWorkerRegistrationKey::encode const): Add release asserts to make sure we do not store/transfer empty registration keys. 2020-02-14 Russell Epstein Cherry-pick r256494. rdar://problem/59446989 CSSValuePool's constant CSS values should not be allocated dynamically (and same for Vectors) https://bugs.webkit.org/show_bug.cgi?id=207666 Reviewed by Mark Lam. r252785 changes contents (CSSValues and Vectors) of CSSValuePool from static ones to dynamically allocated ones. This was done since we would like to use static CSSValues even in the other threads (workers etc.) for OffscreenCanvas feature. But this causes memory regression in Membuster since we allocates many CSSValues and large Vectors, and they are kept persistently. This patch removes dynamic allocation part of r252785 to recover memory regression. The key of this patch is introducing Static CSSValue feature. When incrementing / decrementing m_refCount of CSSValue, we add / subtract by 0x2. And we put 0x1 as a static-flag. So, even if this CSSValue is used by multiple threads, we never see that CSSValue gets 0 m_refCount if it is marked as static (having 0x1). This is the same design to our static StringImpl. No behavior change. * css/CSSInheritedValue.h: * css/CSSInitialValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): * css/CSSPrimitiveValue.h: * css/CSSRevertValue.h: * css/CSSUnsetValue.h: * css/CSSValue.cpp: * css/CSSValue.h: (WebCore::CSSValue::ref const): (WebCore::CSSValue::hasOneRef const): (WebCore::CSSValue::refCount const): (WebCore::CSSValue::hasAtLeastOneRef const): (WebCore::CSSValue::deref): (WebCore::CSSValue::makeStatic): * css/CSSValuePool.cpp: (WebCore::StaticCSSValuePool::StaticCSSValuePool): (WebCore::StaticCSSValuePool::init): (WebCore::CSSValuePool::CSSValuePool): (WebCore::CSSValuePool::singleton): (WebCore::CSSValuePool::createIdentifierValue): (WebCore::CSSValuePool::createColorValue): (WebCore::CSSValuePool::createValue): * css/CSSValuePool.h: (WebCore::CSSValuePool::createInheritedValue): (WebCore::CSSValuePool::createImplicitInitialValue): (WebCore::CSSValuePool::createExplicitInitialValue): (WebCore::CSSValuePool::createUnsetValue): (WebCore::CSSValuePool::createRevertValue): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256494 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Yusuke Suzuki CSSValuePool's constant CSS values should not be allocated dynamically (and same for Vectors) https://bugs.webkit.org/show_bug.cgi?id=207666 Reviewed by Mark Lam. r252785 changes contents (CSSValues and Vectors) of CSSValuePool from static ones to dynamically allocated ones. This was done since we would like to use static CSSValues even in the other threads (workers etc.) for OffscreenCanvas feature. But this causes memory regression in Membuster since we allocates many CSSValues and large Vectors, and they are kept persistently. This patch removes dynamic allocation part of r252785 to recover memory regression. The key of this patch is introducing Static CSSValue feature. When incrementing / decrementing m_refCount of CSSValue, we add / subtract by 0x2. And we put 0x1 as a static-flag. So, even if this CSSValue is used by multiple threads, we never see that CSSValue gets 0 m_refCount if it is marked as static (having 0x1). This is the same design to our static StringImpl. No behavior change. * css/CSSInheritedValue.h: * css/CSSInitialValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): * css/CSSPrimitiveValue.h: * css/CSSRevertValue.h: * css/CSSUnsetValue.h: * css/CSSValue.cpp: * css/CSSValue.h: (WebCore::CSSValue::ref const): (WebCore::CSSValue::hasOneRef const): (WebCore::CSSValue::refCount const): (WebCore::CSSValue::hasAtLeastOneRef const): (WebCore::CSSValue::deref): (WebCore::CSSValue::makeStatic): * css/CSSValuePool.cpp: (WebCore::StaticCSSValuePool::StaticCSSValuePool): (WebCore::StaticCSSValuePool::init): (WebCore::CSSValuePool::CSSValuePool): (WebCore::CSSValuePool::singleton): (WebCore::CSSValuePool::createIdentifierValue): (WebCore::CSSValuePool::createColorValue): (WebCore::CSSValuePool::createValue): * css/CSSValuePool.h: (WebCore::CSSValuePool::createInheritedValue): (WebCore::CSSValuePool::createImplicitInitialValue): (WebCore::CSSValuePool::createExplicitInitialValue): (WebCore::CSSValuePool::createUnsetValue): (WebCore::CSSValuePool::createRevertValue): 2020-02-14 Russell Epstein Cherry-pick r256474. rdar://problem/59446973 Web Inspector: inspector/cpu-profiler/threads.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=207588 Reviewed by Yusuke Suzuki. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::ResourceUsageThread::platformCollectCPUData): Use a fence to force Thread to be completely ready for use by other threads prior to storing it. Otherwise, ResourceUsageThread may see it too early. * workers/WorkerThread.cpp: (WebCore::WorkerThread::start): Ignore worker threads that are not fully initialized. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256474 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Brian Burg Web Inspector: inspector/cpu-profiler/threads.html is flaky crashing https://bugs.webkit.org/show_bug.cgi?id=207588 Reviewed by Yusuke Suzuki. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::ResourceUsageThread::platformCollectCPUData): Use a fence to force Thread to be completely ready for use by other threads prior to storing it. Otherwise, ResourceUsageThread may see it too early. * workers/WorkerThread.cpp: (WebCore::WorkerThread::start): Ignore worker threads that are not fully initialized. 2020-02-14 Russell Epstein Cherry-pick r256470. rdar://problem/59446998 ServiceWorkerContainer::jobResolvedWithRegistration scopeExit should capture all lambda parameters by value https://bugs.webkit.org/show_bug.cgi?id=207657 Reviewed by Chris Dumez. shouldNotifyWhenResolved is captured by reference in the notifyIfExitEarly ScopeExit lambda. The ScopeExit is not always called synchronously so it is unsafe to capture values by reference here. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256470 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Youenn Fablet ServiceWorkerContainer::jobResolvedWithRegistration scopeExit should capture all lambda parameters by value https://bugs.webkit.org/show_bug.cgi?id=207657 Reviewed by Chris Dumez. shouldNotifyWhenResolved is captured by reference in the notifyIfExitEarly ScopeExit lambda. The ScopeExit is not always called synchronously so it is unsafe to capture values by reference here. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): 2020-02-14 Russell Epstein Cherry-pick r256447. rdar://problem/59446998 RELEASE_ASSERT() under WebSWClientConnection::didResolveRegistrationPromise() https://bugs.webkit.org/show_bug.cgi?id=207637 Reviewed by Youenn Fablet. We were capturing data by reference in the notifyIfExitEarly ScopeExit lambda and then capturing it in the task posted to the event loop, which was unsafe. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256447 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Chris Dumez RELEASE_ASSERT() under WebSWClientConnection::didResolveRegistrationPromise() https://bugs.webkit.org/show_bug.cgi?id=207637 Reviewed by Youenn Fablet. We were capturing data by reference in the notifyIfExitEarly ScopeExit lambda and then capturing it in the task posted to the event loop, which was unsafe. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): 2020-02-14 Russell Epstein Cherry-pick r256427. rdar://problem/59447029 Fix crash due to uninitialized currentStyle in CSSTransition https://bugs.webkit.org/show_bug.cgi?id=205959 Patch by Sunny He on 2020-02-12 Reviewed by Antoine Quint. Source/WebCore: Test: legacy-animation-engine/transitions/svg-bad-scale-crash.html * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): (WebCore::CSSTransition::CSSTransition): * animation/CSSTransition.h: LayoutTests: Fix crash due to uninitialized currentStyle in CSSTransition * legacy-animation-engine/transitions/svg-bad-scale-crash-expected.txt: Added. * legacy-animation-engine/transitions/svg-bad-scale-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256427 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Sunny He Fix crash due to uninitialized currentStyle in CSSTransition https://bugs.webkit.org/show_bug.cgi?id=205959 Reviewed by Antoine Quint. Test: legacy-animation-engine/transitions/svg-bad-scale-crash.html * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): (WebCore::CSSTransition::CSSTransition): * animation/CSSTransition.h: 2020-02-14 Russell Epstein Cherry-pick r256395. rdar://problem/59447024 Bug 207424: Crash in WebCore::ParsedContentType::parseContentType when parsing invalid MIME type Patch by Rob Buis and David Kilzer on 2020-02-11 Reviewed by Rob Buis. Source/WebCore: Return StringView directly rather than wrapping it in Optional, since StringView's can be null tested. Tests: TestWebKitAPI.ParsedContentType * platform/network/ParsedContentType.cpp: (WebCore::parseToken): (WebCore::parseQuotedString): (WebCore::ParsedContentType::parseContentType): Don't set type parameter if parameterName is null string. Remove unneeded `parameterName` variable; use keyRange.toString() instead. Tools: * TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp: (TestWebKitAPI::TEST): Add more tests. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256395 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Rob Buis Bug 207424: Crash in WebCore::ParsedContentType::parseContentType when parsing invalid MIME type Reviewed by Rob Buis. Return StringView directly rather than wrapping it in Optional, since StringView's can be null tested. Tests: TestWebKitAPI.ParsedContentType * platform/network/ParsedContentType.cpp: (WebCore::parseToken): (WebCore::parseQuotedString): (WebCore::ParsedContentType::parseContentType): Don't set type parameter if parameterName is null string. Remove unneeded `parameterName` variable; use keyRange.toString() instead. 2020-02-14 Russell Epstein Cherry-pick r256377. rdar://problem/59446971 Regression: RTCRtpSender.getCapabilities("video") returns null on iOS 13.4 (17E5223h) https://bugs.webkit.org/show_bug.cgi?id=207325 Reviewed by Eric Carlson. Source/WebCore: Manually tested and covered by API test. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Return true unconditionally on iOS since libwebrtc.dylib is always available. Tools: * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm: (TestWebKitAPI::TEST): Add a test validating that RTCRtpSender.getCapabilities does not return null. * TestWebKitAPI/Tests/WebKit/getUserMedia.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256377 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Youenn Fablet Regression: RTCRtpSender.getCapabilities("video") returns null on iOS 13.4 (17E5223h) https://bugs.webkit.org/show_bug.cgi?id=207325 Reviewed by Eric Carlson. Manually tested and covered by API test. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Return true unconditionally on iOS since libwebrtc.dylib is always available. 2020-02-14 Russell Epstein Cherry-pick r256207. rdar://problem/59447263 Don't update selection when calling setSelectionRange on a disconnected input element https://bugs.webkit.org/show_bug.cgi?id=207357 Reviewed by Antti Koivisto. LayoutTests/imported/w3c: Rebaselined the test that progressed a little. The test now passes offset checks but still fails direction check. * web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application-textarea-expected.txt: Source/WebCore: Don't update FrameSelection when the text form control element is disconnected from document. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): LayoutTests: Rebaselined the test that has progressed with this change. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt: * platform/mac/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256207 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Ryosuke Niwa Don't update selection when calling setSelectionRange on a disconnected input element https://bugs.webkit.org/show_bug.cgi?id=207357 Reviewed by Antti Koivisto. Don't update FrameSelection when the text form control element is disconnected from document. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): 2020-02-13 Russell Epstein Revert r256407. rdar://problem/59299143 2020-02-13 Alan Coon Cherry-pick r256564. rdar://problem/59440718 iOS: Autoscrolling is too fast and way too aggressive https://bugs.webkit.org/show_bug.cgi?id=207717 Reviewed by Simon Fraser. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startSelectionAutoscroll): (WebCore::EventHandler::cancelSelectionAutoscroll): (WebCore::adjustAutoscrollDestinationForInsetEdges): (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): Deleted. Make a few small changes to autoscrolling on iOS to make it feel better: - Store the autoscrolling position in "unscrolled" coordinates, and do all work in this space, converting back when it's time to actually scroll. This fixes the problem where you have to wiggle your finger to autoscroll, because now when the timer fires, the point actually moves (before, it was all stored in "content" coordinates, so wouldn't actually change until the client pushed a new point). - Reintroduce the macOS-style linear scaling of scrolling velocity in (and beyond) the inset region. We scale the fractional distance into the inset region to a 20pt/50ms scroll velocity; when you exit the inset it continues scaling up linearly from there. - Only apply insets in the direction that the autoscroll drag is occurring in. This avoids a problem where e.g. horizontally selecting text on the first visible line of a page would cause us to scroll up, as it sat within the top inset. Instead, we only apply an inset in the direction of the drag, and do not allow its magnitude to exceed the currently dragged distance. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256564 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-13 Tim Horton iOS: Autoscrolling is too fast and way too aggressive https://bugs.webkit.org/show_bug.cgi?id=207717 Reviewed by Simon Fraser. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startSelectionAutoscroll): (WebCore::EventHandler::cancelSelectionAutoscroll): (WebCore::adjustAutoscrollDestinationForInsetEdges): (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): Deleted. Make a few small changes to autoscrolling on iOS to make it feel better: - Store the autoscrolling position in "unscrolled" coordinates, and do all work in this space, converting back when it's time to actually scroll. This fixes the problem where you have to wiggle your finger to autoscroll, because now when the timer fires, the point actually moves (before, it was all stored in "content" coordinates, so wouldn't actually change until the client pushed a new point). - Reintroduce the macOS-style linear scaling of scrolling velocity in (and beyond) the inset region. We scale the fractional distance into the inset region to a 20pt/50ms scroll velocity; when you exit the inset it continues scaling up linearly from there. - Only apply insets in the direction that the autoscroll drag is occurring in. This avoids a problem where e.g. horizontally selecting text on the first visible line of a page would cause us to scroll up, as it sat within the top inset. Instead, we only apply an inset in the direction of the drag, and do not allow its magnitude to exceed the currently dragged distance. 2020-02-13 Russell Epstein Cherry-pick r256485. rdar://problem/59430261 Composition highlight rects should be rounded and inset https://bugs.webkit.org/show_bug.cgi?id=207655 Reviewed by Tim Horton. Source/WebCore: Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked text, in the case where the client specifies attributed marked text with background colors. Test: editing/input/composition-highlights.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintCompositionBackground): In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background rect, and add a slight corner radius around each background rect. * rendering/InlineTextBox.h: Source/WebKit: Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of composition highlight rects we hand to the web process when changing the marked text. * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): LayoutTests: Make this existing layout test work with the new composition highlight appearance by covering up the edges of the composition highlight rect with a black border. Due to subpixel insets around the composition highlight rect, the reference image would be offset by a half pixel without this change (even when changing the spans to have a `border-radius`). * editing/input/composition-highlights-expected.html: * editing/input/composition-highlights.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256485 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Wenson Hsieh Composition highlight rects should be rounded and inset https://bugs.webkit.org/show_bug.cgi?id=207655 Reviewed by Tim Horton. Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked text, in the case where the client specifies attributed marked text with background colors. Test: editing/input/composition-highlights.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintCompositionBackground): In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background rect, and add a slight corner radius around each background rect. * rendering/InlineTextBox.h: 2020-02-13 Russell Epstein Cherry-pick r256230. rdar://problem/59332513 Adjust the minor version number for the desktop user agent string. https://bugs.webkit.org/show_bug.cgi?id=207498 Patch by Keith Rollin on 2020-02-10 Reviewed by Wenson Hsieh. This helps with Netflix compatibility on the iPad. No new tests -- no new or changed functionality. * platform/ios/UserAgentIOS.mm: (WebCore::standardUserAgentWithApplicationName): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256230 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Keith Rollin Adjust the minor version number for the desktop user agent string. https://bugs.webkit.org/show_bug.cgi?id=207498 Reviewed by Wenson Hsieh. This helps with Netflix compatibility on the iPad. No new tests -- no new or changed functionality. * platform/ios/UserAgentIOS.mm: (WebCore::standardUserAgentWithApplicationName): 2020-02-12 Alan Coon Cherry-pick r254859. rdar://problem/59298172 Minor improvements to StorageAreaMap https://bugs.webkit.org/show_bug.cgi?id=206433 Reviewed by Darin Adler. Source/WebCore: Use inline initialization for some of StorageMap's data member. Also specify uint8_t as underlying type of StorageType enum class for better packing. * inspector/InspectorInstrumentation.h: * storage/StorageArea.h: * storage/StorageMap.cpp: (WebCore::StorageMap::StorageMap): * storage/StorageMap.h: * storage/StorageType.h: Source/WebKit: Minor improvements to StorageAreaMap: 1. The class does not need to be RefCounted, as it is solely owned by StorageNamespaceImpl. Having it RefCounted was actually dangerous because StorageAreaMap had a raw pointer data member to its owner: m_storageNamespace. This raw pointer could become stale if you extend the lifetime of the StorageAreaMap object to outlive its StorageNamespaceImpl. 2. Make StorageAreaMap::connect() private as it is never called from outside the class 3. Reorder data members for better packing 4. Use modern loops in the implementation 5. Rename loadValuesIfNeeded() to ensureStorageMap() and have it return the StorageMap object. This makes calls site more concise and it makes it clearer when this method needs to be called. 6. Mark class as final 7. Replace LOG_ERROR() with RELEASE_LOG_ERROR() so that we can see error logging in sysdiagnoses 8. Use more references instead of raw pointers to make it clear when null checks are not needed * WebProcess/WebStorage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::create): (WebKit::StorageAreaImpl::StorageAreaImpl): * WebProcess/WebStorage/StorageAreaImpl.h: * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::StorageAreaMap): (WebKit::StorageAreaMap::length): (WebKit::StorageAreaMap::key): (WebKit::StorageAreaMap::item): (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::contains): (WebKit::StorageAreaMap::resetValues): (WebKit::StorageAreaMap::ensureStorageMap): (WebKit::StorageAreaMap::applyChange): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::dispatchLocalStorageEvent): (WebKit::StorageAreaMap::connect): (WebKit::StorageAreaMap::disconnect): * WebProcess/WebStorage/StorageAreaMap.h: * WebProcess/WebStorage/StorageAreaMap.messages.in: * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::storageArea): * WebProcess/WebStorage/StorageNamespaceImpl.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254859 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Chris Dumez Minor improvements to StorageAreaMap https://bugs.webkit.org/show_bug.cgi?id=206433 Reviewed by Darin Adler. Use inline initialization for some of StorageMap's data member. Also specify uint8_t as underlying type of StorageType enum class for better packing. * inspector/InspectorInstrumentation.h: * storage/StorageArea.h: * storage/StorageMap.cpp: (WebCore::StorageMap::StorageMap): * storage/StorageMap.h: * storage/StorageType.h: 2020-02-12 Alan Coon Revert r256409. rdar://problem/59298138 2020-02-12 Alan Coon Revert r256457. rdar://problem/59298138 2020-02-12 Russell Epstein Cherry-pick r256060. rdar://problem/59298138 Captions sometimes render at the wrong size when in fullscreen and PiP https://bugs.webkit.org/show_bug.cgi?id=207389 Reviewed by Jer Noble. The TextTrackRepresentation, used to render captions when in fullscreen and PiP on iOS and and in PiP on macOS, frequently rendered captions before layout completed immediately after it was created. Fix this by having it not render until a layout happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's backing layer when cues are not visible instead of destroying the whole object. Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC. * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): (WebCore::HTMLMediaElement::configureTextTrackDisplay): * html/HTMLMediaElementEnums.h: (WTF::LogArgument::toString): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): (WebCore::MediaControlTextTrackContainerElement::updateDisplay): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): (WebCore::MediaControlTextTrackContainerElement::updateSizes): (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): (WebCore::MediaControlTextTrackContainerElement::logger const): (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted. (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted. * platform/graphics/TextTrackRepresentation.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::logChannel const): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): (WebCore::VideoFullscreenLayerManagerObjC::logChannel const): * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]): (TextTrackRepresentationCocoa::setHidden const): (TextTrackRepresentationCocoa::boundsChanged): * rendering/RenderMediaControlElements.cpp: (WebCore::RenderTextTrackContainerElement::layout): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256060 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Eric Carlson Captions sometimes render at the wrong size when in fullscreen and PiP https://bugs.webkit.org/show_bug.cgi?id=207389 Reviewed by Jer Noble. The TextTrackRepresentation, used to render captions when in fullscreen and PiP on iOS and and in PiP on macOS, frequently rendered captions before layout completed immediately after it was created. Fix this by having it not render until a layout happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's backing layer when cues are not visible instead of destroying the whole object. Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC. * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): (WebCore::HTMLMediaElement::configureTextTrackDisplay): * html/HTMLMediaElementEnums.h: (WTF::LogArgument::toString): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): (WebCore::MediaControlTextTrackContainerElement::updateDisplay): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): (WebCore::MediaControlTextTrackContainerElement::updateSizes): (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): (WebCore::MediaControlTextTrackContainerElement::logger const): (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted. (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted. * platform/graphics/TextTrackRepresentation.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::logChannel const): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): (WebCore::VideoFullscreenLayerManagerObjC::logChannel const): * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]): (TextTrackRepresentationCocoa::setHidden const): (TextTrackRepresentationCocoa::boundsChanged): * rendering/RenderMediaControlElements.cpp: (WebCore::RenderTextTrackContainerElement::layout): 2020-02-11 Alan Coon Cherry-pick r255668. rdar://problem/59299120 MediaDevices should handle changes of iframe allow attribute value https://bugs.webkit.org/show_bug.cgi?id=207112 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https-expected.txt: * web-platform-tests/mediacapture-streams/MediaStream-feature-policy-none.https-expected.txt: Source/WebCore: MediaDevices was computing whether it could access camera or microphone at creation time. Since the iframe allow attribute can be modified, we cannot do that. Instead, we get the feature policy everytime this is needed. Refactor code to use the newly added routine to check for feature policy. Update logging to give origin and allow attribute value of the frame that fail the feature policy check. Test: http/tests/webrtc/enumerateDevicesInFrames.html * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): (WebCore::MediaDevices::refreshDevices): (WebCore::MediaDevices::enumerateDevices): (WebCore::MediaDevices::listenForDeviceChanges): * Modules/mediastream/MediaDevices.h: * Modules/mediastream/UserMediaController.cpp: (WebCore::UserMediaController::logGetUserMediaDenial): (WebCore::UserMediaController::logGetDisplayMediaDenial): (WebCore::UserMediaController::logEnumerateDevicesDenial): * Modules/mediastream/UserMediaController.h: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::start): * html/FeaturePolicy.cpp: (WebCore::policyTypeName): (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners): * html/FeaturePolicy.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::printErrorMessage const): * page/DOMWindow.h: LayoutTests: * TestExpectations: * fullscreen/full-screen-enabled-expected.txt: * fullscreen/full-screen-enabled-prefixed-expected.txt: * fullscreen/full-screen-iframe-not-allowed-expected.txt: * fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt: * fullscreen/full-screen-restrictions-expected.txt: * http/tests/fullscreen/fullscreen-feature-policy-expected.txt: * http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt: * http/tests/media/media-stream/get-display-media-iframe-allow-attribute-expected.txt: * http/tests/ssl/media-stream/get-user-media-different-host-expected.txt: * http/tests/ssl/media-stream/get-user-media-nested-expected.txt: * http/tests/webrtc/enumerateDevicesInFrames-expected.txt: Added. * http/tests/webrtc/enumerateDevicesInFrames.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255668 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 youenn fablet MediaDevices should handle changes of iframe allow attribute value https://bugs.webkit.org/show_bug.cgi?id=207112 Reviewed by Eric Carlson. MediaDevices was computing whether it could access camera or microphone at creation time. Since the iframe allow attribute can be modified, we cannot do that. Instead, we get the feature policy everytime this is needed. Refactor code to use the newly added routine to check for feature policy. Update logging to give origin and allow attribute value of the frame that fail the feature policy check. Test: http/tests/webrtc/enumerateDevicesInFrames.html * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): (WebCore::MediaDevices::refreshDevices): (WebCore::MediaDevices::enumerateDevices): (WebCore::MediaDevices::listenForDeviceChanges): * Modules/mediastream/MediaDevices.h: * Modules/mediastream/UserMediaController.cpp: (WebCore::UserMediaController::logGetUserMediaDenial): (WebCore::UserMediaController::logGetDisplayMediaDenial): (WebCore::UserMediaController::logEnumerateDevicesDenial): * Modules/mediastream/UserMediaController.h: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::start): * html/FeaturePolicy.cpp: (WebCore::policyTypeName): (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners): * html/FeaturePolicy.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::printErrorMessage const): * page/DOMWindow.h: 2020-02-11 Alan Coon Cherry-pick r255562. rdar://problem/59299120 Do not copy feature policy in isFeaturePolicyAllowedByDocumentAndAllOwners https://bugs.webkit.org/show_bug.cgi?id=207110 Reviewed by Eric Carlson. Use auto& instead of auto to not copy the feature policy object. Add some auto* to improve code readability. No change of behavior. * html/FeaturePolicy.cpp: (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255562 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 youenn fablet Do not copy feature policy in isFeaturePolicyAllowedByDocumentAndAllOwners https://bugs.webkit.org/show_bug.cgi?id=207110 Reviewed by Eric Carlson. Use auto& instead of auto to not copy the feature policy object. Add some auto* to improve code readability. No change of behavior. * html/FeaturePolicy.cpp: (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners): 2020-02-11 Alan Coon Cherry-pick r256073. rdar://problem/59299148 Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content https://bugs.webkit.org/show_bug.cgi?id=207409 rdar://problem/59275641 Patch by Alex Christensen on 2020-02-07 Reviewed by Chris Dumez. Source/WebCore: Covered by an API test. * history/CachedFrame.cpp: (WebCore::CachedFrame::setHasInsecureContent): * history/CachedFrame.h: (WebCore::CachedFrame::usedLegacyTLS const): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::dispatchDidCommitLoad): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: Source/WebKit: * Scripts/webkit/messages.py: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasInsecureContent): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Source/WebKitLegacy/mac: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::dispatchDidCommitLoad): Source/WebKitLegacy/win: * WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::dispatchDidCommitLoad): * WebCoreSupport/WebFrameLoaderClient.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256073 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Alex Christensen Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content https://bugs.webkit.org/show_bug.cgi?id=207409 rdar://problem/59275641 Reviewed by Chris Dumez. Covered by an API test. * history/CachedFrame.cpp: (WebCore::CachedFrame::setHasInsecureContent): * history/CachedFrame.h: (WebCore::CachedFrame::usedLegacyTLS const): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::dispatchDidCommitLoad): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: 2020-02-11 Alan Coon Cherry-pick r255881. rdar://problem/59299143 Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 Reviewed by Eric Carlson. Source/WebCore: * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::setShouldOverrideScreenSupportsHighDynamicRange): Source/WebCore/PAL: * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: Source/WebKit: The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): (WebKit::WebPage::displayID const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): Deleted. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::setScreenProperties): (WebKit::WebProcess::updatePageScreenProperties): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Jer Noble Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 Reviewed by Eric Carlson. * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::setShouldOverrideScreenSupportsHighDynamicRange): 2020-02-11 Alan Coon Cherry-pick r255846. rdar://problem/59299151 Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. Source/WebCore: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::includeCertificateInfo const): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::usedLegacyTLS const): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): Source/WebKit: In PageLoadState::didCommitLoad, I was resetting the value of _negotiatedLegacyTLS to false. That created a race condition when loading the main resource because the NetworkProcess would message the UIProcess setting _negotiatedLegacyTLS to false, while the NetworkProcess would message the WebProcess which would message the UIProcess to call PageLoadState::didCommitLoad which would reset it to false. Now it resets it to the correct value, whatever it is. Updating the ResourceResponseBase serialization code has the desirable side effect that the disk cache will remember whether legacy TLS was used to fetch each resource. This will make it so _negotiatedLegacyTLS is true if we read content from the disk cache that was originally fetched using legacy TLS. In order to not increase the memory footprint of ResourceResponse, I changed m_httpStatusCode from an int to a short. It just needs to be able to cover the values 0-600 or so, which really only needs 10 bits. Covered by new API tests. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): (WebKit::NetworkDataTask::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::notifyDidReceiveResponse): (WebKit::NetworkLoad::throttleDelayCompleted): (WebKit::NetworkLoad::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): Source/WTF: * wtf/persistence/PersistentDecoder.cpp: (WTF::Persistence::Decoder::decode): * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.cpp: (WTF::Persistence::Encoder::encode): * wtf/persistence/PersistentEncoder.h: Tools: HTTPServer now supports HTTPS. Tell your friends! * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm: (testCertificate): (testIdentity): (credentialWithIdentity): * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::webViewWithNavigationDelegate): (TestWebKitAPI::TEST): * TestWebKitAPI/cocoa/HTTPServer.h: * TestWebKitAPI/cocoa/HTTPServer.mm: (TestWebKitAPI::HTTPServer::HTTPServer): (TestWebKitAPI::HTTPServer::request const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255846 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Alex Christensen Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::includeCertificateInfo const): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::usedLegacyTLS const): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): 2020-02-11 Alan Coon Cherry-pick r255162. rdar://problem/59299120 Support 'allow="fullscreen"' feature policy https://bugs.webkit.org/show_bug.cgi?id=206806 Patch by Jer Noble on 2020-01-27 Reviewed by Youenn Fablet. Source/WebCore: Test: http/tests/fullscreen/fullscreen-feature-policy.html The unprefixed version of the Fullscreen API has deprecated the 'allowfullscreen' iframe attribute in favor of the 'allow="fullscreen"' style attribute used by Feature Policy. Add support for such, including the specified handling for the legacy 'allowfullscreen' attribute. Note: this patch will (intentionally) change the default behavior of