blob: 230272d092470285fbe9865e05cab6fe60bc8940 [file] [log] [blame]
2021-03-24 Yusuke Suzuki <ysuzuki@apple.com>
All string resources from UserAgentStyleSheets / UserAgentScripts should be used as non-copying StringImpl
https://bugs.webkit.org/show_bug.cgi?id=223685
Reviewed by Saam Barati.
We use StringImpl::createWithoutCopying for string resources from UserAgentStyleSheets / UserAgentScripts to make sure that
these resources do not allocate heap strings.
This patch also fixes HTMLMeterElement's bug (and imageOverlayUserAgentStyleSheet's bug). Previously, we are using String::ConstructFromLiteral,
but this only accepts string literal as it says. As a result, we are dropping the last character since UserAgentStyleSheets's last character is not \0.
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::quickTimePluginReplacementScript):
* WebCoreMacros.cmake:
* dom/Document.cpp:
(WebCore::Document::ensurePlugInsInjectedScript):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::extraDefaultStyleSheet):
(WebCore::RenderThemeAdwaita::extraMediaControlsStyleSheet):
(WebCore::RenderThemeAdwaita::mediaControlsScripts):
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsStyleSheet):
(WebCore::RenderThemeCocoa::mediaControlsScripts):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::extraDefaultStyleSheet):
(WebCore::RenderThemeWin::extraQuirksStyleSheet):
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::initDefaultStyleSheet):
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
2021-03-24 Chris Dumez <cdumez@apple.com>
bindings/js/JSEventListener.cpp:281:91: runtime error: reference binding to null pointer of type 'WebCore::ScriptExecutionContext'
https://bugs.webkit.org/show_bug.cgi?id=223719
Reviewed by Darin Adler.
Make sure we null check the scriptExecutionContext before we dereference it.
* bindings/js/JSEventListener.cpp:
(WebCore::eventHandlerAttribute):
(WebCore::windowEventHandlerAttribute):
2021-03-24 Chris Dumez <cdumez@apple.com>
Port FontDescriptionKey::computeHash() from legacy IntegerHasher to Hasher
https://bugs.webkit.org/show_bug.cgi?id=223701
Reviewed by Darin Adler.
Port FontDescriptionKey::computeHash() from legacy IntegerHasher to Hasher. Hasher
has the benefit of having add() overloads that take in signed integer types.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::computeHash const):
2021-03-24 Chris Dumez <cdumez@apple.com>
Extend WebAudio heap allocation assertions to cover the pre & post-rendering phases
https://bugs.webkit.org/show_bug.cgi?id=223640
Reviewed by Sam Weinig.
Extend WebAudio heap allocation assertions to cover the pre & post-rendering phases. I had to add
exceptions for some heap allocations that are currently happening during this phase but I
will work to reduce the number of exceptions in follow-ups.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::render):
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::updateInternalBus):
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::updateInternalBus):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::addAutomaticPullNode):
(WebCore::BaseAudioContext::updateAutomaticPullNodes):
* platform/audio/AudioDSPKernelProcessor.cpp:
(WebCore::AudioDSPKernelProcessor::initialize):
2021-03-24 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r274983.
* Modules/mediasession/MediaSession.h:
2021-03-24 Chris Dumez <cdumez@apple.com>
Move TelephoneNumberDetector preloading off the main thread
https://bugs.webkit.org/show_bug.cgi?id=223715
Reviewed by Geoffrey Garen.
Move TelephoneNumberDetector preloading off the main thread. We have evidence that prewarmGlobally() can be slow and hang the main
thread for too long (rdar://75279383). As a result, it is a good idea to prewarm things off the main thread whenever possible.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/TelephoneNumberDetector.h:
* platform/cocoa/TelephoneNumberDetectorCocoa.cpp:
(WebCore::TelephoneNumberDetector::phoneNumbersScanner):
(WebCore::TelephoneNumberDetector::prewarm):
2021-03-24 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Add Experimental MediaSession coordinator
https://bugs.webkit.org/show_bug.cgi?id=222158
<rdar://problem/74508862>
Reviewed by Jer Noble.
Add an experimental MediaSession coordinator, an object that provides an interface
that allows script to coordinate changes to MediaSession with the User Agent. Also
add an experimental MediaSession playlist interface.
The changes are behind new experimental feature flags,
MediaSessionCoordinatorEnabled and MediaSessionPlaylistEnabled.
Test: media/media-session/mock-coordinator.html
* DerivedSources-input.xcfilelist: Add new IDL files.
* DerivedSources-output.xcfilelist: Add new derived sources.
* DerivedSources.make: Add new IDL.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::create): Set trackIdentifier from init data.
(WebCore::MediaMetadata::setTrackIdentifier): trackIdentifier setter.
* Modules/mediasession/MediaMetadata.h:
(WebCore::MediaMetadata::trackIdentifier const):
* Modules/mediasession/MediaMetadata.idl:
* Modules/mediasession/MediaMetadataInit.h: Add trackIdentifier.
(WebCore::MediaMetadataInit::encode const):
(WebCore::MediaMetadataInit::decode):
* Modules/mediasession/MediaMetadataInit.idl:
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Initialize MainThreadGenericEventQueue.
(WebCore::MediaSession::setMetadata): metadataUpdated -> notifyMetadataObservers.
(WebCore::MediaSession::setReadyState): Session readyState setter.
(WebCore::MediaSession::setCoordinator): Coordinator setter. Post 'coordinatorchange'
event after change.
(WebCore::MediaSession::setPlaylist): Playlist setter.
(WebCore::MediaSession::setActionHandler): Call notifyActionHandlerObservers.
(WebCore::MediaSession::setPositionState): Call notifyPositionStateObservers.
(WebCore::MediaSession::metadataUpdated): Call notifyMetadataObservers.
(WebCore::MediaSession::addObserver): New.
(WebCore::MediaSession::removeObserver): New.
(WebCore::MediaSession::forEachObserver): New.
(WebCore::MediaSession::notifyMetadataObservers): New.
(WebCore::MediaSession::notifyPositionStateObservers): New.
(WebCore::MediaSession::notifyPlaybackStateObservers): New.
(WebCore::MediaSession::notifyActionHandlerObservers): New.
(WebCore::MediaSession::notifyReadyStateObservers): New.
* Modules/mediasession/MediaSession.h:
(WebCore::MediaSession::coordinator const):
(WebCore::MediaSession::playlist const):
(WebCore::MediaSession::logger const):
* Modules/mediasession/MediaSession.idl:
* Modules/mediasession/MediaSessionAction.h:
* Modules/mediasession/MediaSessionAction.idl:
* Modules/mediasession/MediaSessionActionDetails.h:
* Modules/mediasession/MediaSessionActionDetails.idl:
MediaSessionCoordinator proxies calls through the PlatformMediaSessionCoordinator,
and then calls the equivalent MediaSession methode if the platform coordinator
is successful.
* Modules/mediasession/MediaSessionCoordinator.cpp: Added.
(WebCore::nextCoordinatorLogIdentifier):
(WebCore::MediaSessionCoordinator::create):
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::seekTo):
(WebCore::MediaSessionCoordinator::play):
(WebCore::MediaSessionCoordinator::pause):
(WebCore::MediaSessionCoordinator::setTrack):
(WebCore::MediaSessionCoordinator::setMediaSession):
(WebCore::MediaSessionCoordinator::logChannel):
* Modules/mediasession/MediaSessionCoordinator.h: New.
(WebCore::MediaSessionCoordinator::logger const):
(WebCore::MediaSessionCoordinator::logIdentifier const):
(WebCore::MediaSessionCoordinator::logClassName):
* Modules/mediasession/MediaSessionCoordinator.idl: New.
* Modules/mediasession/NavigatorMediaSession.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/EventNames.h:
* dom/EventTargetFactory.in:
* platform/graphics/PlatformMediaSessionCoordinator.h: Added.
(WebCore::PlatformMediaSessionCoordinator::setLogger):
(WebCore::PlatformMediaSessionCoordinator::loggerPtr const):
(WebCore::PlatformMediaSessionCoordinator::logIdentifier const):
(WebCore::PlatformMediaSessionCoordinator::logClassName const):
(WebCore::PlatformMediaSessionCoordinator::logChannel const):
* testing/Internals.cpp:
(WebCore::Internals::registerMockMediaSessionCoordinator): Register the mock
media session coordinator for testing.
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockMediaSessionCoordinator.cpp: Added.
(WebCore::MockMediaSessionCoordinator::create):
(WebCore::MockMediaSessionCoordinator::MockMediaSessionCoordinator):
(WebCore::MockMediaSessionCoordinator::seekTo):
(WebCore::MockMediaSessionCoordinator::play):
(WebCore::MockMediaSessionCoordinator::pause):
(WebCore::MockMediaSessionCoordinator::setTrack):
* testing/MockMediaSessionCoordinator.h: New.
2021-03-24 Chris Dumez <cdumez@apple.com>
Preload graphics drivers on a background thread instead of the main thread
https://bugs.webkit.org/show_bug.cgi?id=223713
Reviewed by Simon Fraser.
Preload graphics drivers on a background thread instead of the main thread. We have evidence of prewarmGlobally() hanging
the main thread (rdar://75279383) so we should do pre-warming off the main thread whenever possible.
r265418 introduced this graphics loader preloading and an earlier version of this patch was simply calling MTLCopyAllDevices()
on a background queue. However, that patch was updated before landing to do the work on the main thread. I think we should go
back to the earlier iteration.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::prewarm):
* platform/graphics/gpu/dawn/GPUDeviceDawn.cpp:
(WebCore::GPUDevice::prewarm):
2021-03-24 Antoine Quint <graouts@webkit.org>
Fix interpolation of the border-spacing property
https://bugs.webkit.org/show_bug.cgi?id=223702
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/css/css-tables/animations/border-spacing-interpolation.html
While we already supported animation of border-spacing, we did not correctly clip the interpolated
value to 0.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-24 Simon Fraser <simon.fraser@apple.com>
Add DisplayLink log channels in WebCore and WebKit
https://bugs.webkit.org/show_bug.cgi?id=223669
Reviewed by Tim Horton.
DisplayRefreshMonitor code involves some non-trivial object
fan-out and WebProcess/UI Process interaction, and it deserves
a log channel.
* platform/Logging.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
2021-03-24 Philippe Normand <pnormand@igalia.com>
REGRESSION(r274870) fast/canvas/webgl/texImage2D-mse-flipY-true.html and fast/canvas/webgl/texImage2D-mse-flipY-false.html are crashing
https://bugs.webkit.org/show_bug.cgi?id=223674
Reviewed by Kenneth Russell.
When the srcObject is directly set on a media element, the corresponding URL might still be
empty, so we need to ensure the URI corresponding to the MediaSource blob is not empty,
otherwise uridecodebin would fail to create the right source element.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
2021-03-24 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r273154): [iOS] Two magnifier symbols on google.com
https://bugs.webkit.org/show_bug.cgi?id=223700
<rdar://problem/75357965>
Reviewed by Tim Horton.
The iOS form control refresh added a magnifier symbol to
the default appearance of <input type="search">. On iPhone, google.com
uses <input type="search"> for their search field, while drawing their
own magnifier symbol. As a result, two magnifier symbols appear.
Note that on macOS and iPadOS, google.com uses an <input type="text">,
which means this problem is only observed on iPhone. Ideally, google.com
should adopt <input type="text"> on the iPhone version of the site,
matching the other platforms. However, in the meantime, we can hide our
symbol using a quirk.
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
Hide the symbol if the quirk applies.
* page/Quirks.cpp:
(WebCore::Quirks::shouldHideSearchFieldResultsButton const):
Add a quirk to hide the magnifier symbol on google.com and other country
domains.
* page/Quirks.h:
2021-03-24 Youenn Fablet <youenn@apple.com>
Add logging to check whether RealtimeOutgoingVideoSource is applying rotation or not
https://bugs.webkit.org/show_bug.cgi?id=223691
Reviewed by Eric Carlson.
No change of behavior.
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
2021-03-24 Chris Dumez <cdumez@apple.com>
Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type 'int'
https://bugs.webkit.org/show_bug.cgi?id=223697
Reviewed by Darin Adler.
Make sure FrameView::incrementVisuallyNonEmptyPixelCount() deals with overflows in a well-defined
manner. This fixes the following reports from UBSan:
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65536 * 65536 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 1116300 * 558150 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: -33554432 * -33554432 cannot be represented in type 'int'
* page/FrameView.h:
(WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):
2021-03-24 Rob Buis <rbuis@igalia.com>
[css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252
Reviewed by Sam Weinig.
Address post land review comments.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
* rendering/style/RenderStyleConstants.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueContain):
2021-03-24 Sam Weinig <weinig@apple.com>
Update CSS Color 5 color-mix() implementation to match the latest draft spec
https://bugs.webkit.org/show_bug.cgi?id=223665
Reviewed by Simon Fraser.
Update to the latest draft spec, which dramatically reduces the complexity of color-mix()
by remove per-component adjusters.
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::normalizeWhitenessBlackness):
(WebCore::CSSPropertyParserHelpers::consumeColorMixColorSpaceAndComma):
(WebCore::CSSPropertyParserHelpers::consumeColorMixComponent):
(WebCore::CSSPropertyParserHelpers::normalizedMixPercentages):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HWBA<float>>):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HSLA<float>>):
(WebCore::CSSPropertyParserHelpers::fixupHueComponentsPriorToMix):
(WebCore::CSSPropertyParserHelpers::mixColorComponentsInColorSpace):
(WebCore::CSSPropertyParserHelpers::mixColorComponents):
(WebCore::CSSPropertyParserHelpers::parseColorMixFunctionParameters):
(WebCore::CSSPropertyParserHelpers::HueColorAdjuster::fixupAnglesForInterpolation): Deleted.
(WebCore::CSSPropertyParserHelpers::HueColorAdjuster::HueColorAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::ColorAdjuster::ColorAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAndUpdateAdjusterAtIndex): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAndUpdateAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAdjusters): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeMixComponents): Deleted.
(WebCore::CSSPropertyParserHelpers::normalizeAdjusterValues): Deleted.
(WebCore::CSSPropertyParserHelpers::remainingAdjustment): Deleted.
(WebCore::CSSPropertyParserHelpers::mixComponent): Deleted.
(WebCore::CSSPropertyParserHelpers::mixComponentAtIndex): Deleted.
(WebCore::CSSPropertyParserHelpers::mix): Deleted.
(WebCore::CSSPropertyParserHelpers::parseColorMixFunctionParametersUsingAdjusters): Deleted.
Update to the new syntax and remove component adjusters. They may come back for color-adjust()
in the future.
* platform/graphics/ColorModels.h:
* platform/graphics/ColorTypes.h:
(WebCore::clampedComponent):
(WebCore::assertInRange):
* platform/graphics/ColorUtilities.h:
(WebCore::invertedColorWithOverriddenAlpha):
Add support in the color models for annotating more about each component, now including
the type (angle, number or percentage). This allows algorithms generic algorithms to
operate on abstract color type components without specializing for each color type.
2021-03-24 Zan Dobersek <zdobersek@igalia.com>
[GStreamer] Use imxvideoconvert_g2d element inside the sink when available
https://bugs.webkit.org/show_bug.cgi?id=223693
Reviewed by Philippe Normand.
On some iMX platforms we require the use of imxvideoconvert_g2d element
in order to properly convert the visual buffers before they can be
rendered through our pipeline. We expect to require this buffer if it's
present in the GStreamer plugin registry on the system.
We search for this element and, if found, add it to the sink and
position it at the beginning, before the glupload element.
Based on an approach outlined by Gabriel Valcazar.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
2021-03-24 Antoine Quint <graouts@webkit.org>
Support animation of the tab-size CSS property
https://bugs.webkit.org/show_bug.cgi?id=223688
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/css/css-text/animations/tab-size-interpolation.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/TabSize.h:
(WebCore::TabSize::value const):
(WebCore::TabSize::operator bool const):
2021-03-24 Rob Buis <rbuis@igalia.com>
[css-grid] Do not allow negative heights
https://bugs.webkit.org/show_bug.cgi?id=221439
Reviewed by Javier Fernandez.
Do not allow negative heights in calculations.
Test: fast/css-grid-layout/zero-height-crash.html
* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::setup):
* rendering/GridTrackSizingAlgorithm.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
(WebCore::RenderGrid::gridGap const):
(WebCore::RenderGrid::computeTrackSizesForIndefiniteSize const):
(WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const):
2021-03-23 Tim Horton <timothy_horton@apple.com>
Consolidate Books bundle checks
https://bugs.webkit.org/show_bug.cgi?id=223664
<rdar://problem/75754750>
Reviewed by Wenson Hsieh.
No new tests, no change in behavior.
* Modules/geolocation/Geolocation.cpp:
(WebCore::isRequestFromIBooks):
* bindings/js/CommonVM.cpp:
(WebCore::globalConstRedeclarationShouldThrow):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::initMouseEventQuirk):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::currentRunLoop):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::CocoaApplication::isIBooks):
(WebCore::MacApplication::isIBooks): Deleted.
(WebCore::IOSApplication::isIBooks): Deleted.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::synchronousWillSendRequestEnabled):
* rendering/RenderBox.cpp:
(WebCore::allowMinMaxPercentagesInAutoHeightBlocksQuirk):
Transition to a single bundle check for Books, since the quirks are generally
about book content, not about the app's behavior. Long-term, we should
get rid of these entirely (some are no longer necessary, and the rest
should turn into switches that Books can toggle).
2021-03-23 Simon Fraser <simon.fraser@apple.com>
Add DisplayRefreshMonitorFactory.
https://bugs.webkit.org/show_bug.cgi?id=223648
Reviewed by Chris Dumez.
Future work will require that it's possible to create a DisplayRefreshMonitor
without having a DisplayRefreshMonitorClient. It was also weird that the way to
create a DisplayRefreshMonitor was via the DisplayRefreshMonitorClient, so
this change fixes both by adding DisplayRefreshMonitorFactory.
In WK2, the drawing areas are DisplayRefreshMonitorFactories. If there is no
factory, we fall back to the default implementations.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::EmptyDisplayRefreshMonitorFactory::sharedEmptyDisplayRefreshMonitorFactory):
(WebCore::EmptyChromeClient::displayRefreshMonitorFactory const):
(WebCore::EmptyChromeClient::createDisplayRefreshMonitor const): Deleted.
* loader/EmptyClients.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::displayRefreshMonitorFactory const):
(WebCore::ChromeClient::createDisplayRefreshMonitor const): Deleted.
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::displayRefreshMonitorFactory const):
(WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const): Deleted.
* page/RenderingUpdateScheduler.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::create):
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::DisplayRefreshMonitorClient): Deleted.
* platform/graphics/DisplayRefreshMonitorClient.h:
* platform/graphics/DisplayRefreshMonitorFactory.h: Copied from Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp.
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
* platform/graphics/GraphicsLayerUpdater.cpp:
(WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater):
(WebCore::GraphicsLayerUpdater::displayRefreshMonitorFactory const):
(WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor const): Deleted.
* platform/graphics/GraphicsLayerUpdater.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::displayRefreshMonitorFactory):
(WebCore::RenderLayerCompositor::createDisplayRefreshMonitor const): Deleted.
* rendering/RenderLayerCompositor.h:
2021-03-23 Kate Cheney <katherine_cheney@apple.com>
Service worker loads are not marked as app-bound
https://bugs.webkit.org/show_bug.cgi?id=222635
<rdar://problem/74395950>
Reviewed by Youenn Fablet.
Fix capitalization error. Add a new function to mark the service
worker document loader as app-bound.
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setLastNavigationWasAppBound):
(WebCore::DocumentLoader::setlastNavigationWasAppBound): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppBound):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-23 Simon Fraser <simon.fraser@apple.com>
Use FramesPerSecond in more places in WebCore
https://bugs.webkit.org/show_bug.cgi?id=223656
Reviewed by Tim Horton.
Use FramesPerSecond rather than 'unsigned' in more places in WebCore.
* page/Chrome.h:
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange):
* page/Page.h:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::windowScreenDidChange):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::windowScreenDidChange):
* page/scrolling/ScrollingTree.h:
* platform/HostWindow.h:
2021-03-23 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Functor for WeakGCMap::ensureValue must not invoke GC
https://bugs.webkit.org/show_bug.cgi?id=223629
Reviewed by Mark Lam.
Test: js/dom/weak-gc-map-ensure-value-should-not-invoke-gc.html
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::createCrossOriginFunction):
(WebCore::JSDOMGlobalObject::createCrossOriginGetterSetter):
2021-03-23 Chris Dumez <cdumez@apple.com>
Unreviewed, rebaseline bindings tests after r274906.
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
* bindings/scripts/test/JS/JSTestDomainSecurity.cpp:
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOperationConditional.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
2021-03-23 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r274832.
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
2021-03-23 Adrian Perez de Castro <aperez@igalia.com>
[CMake] Use an imported target for the LCMS2 library
https://bugs.webkit.org/show_bug.cgi?id=223442
Reviewed by Carlos Garcia Campos.
No new tests needed.
* PlatformGTK.cmake: Use the LCMS::LCMS2 imported target, only with USE_LCMS enabled.
* PlatformWPE.cmake: Ditto.
2021-03-23 Jer Noble <jer.noble@apple.com>
[Cocoa][Opus] Protect against variable frame duration packets
https://bugs.webkit.org/show_bug.cgi?id=223623
Reviewed by Eric Carlson.
Because frames-per-packet and frame duration are carried within the TOC of each individual
frame, it's theoretically possible to construct an Opus stream where those values change
without a new initialization segment, a situation which CoreAudio does not currently
support. In the case such a stream is encountered, bail with an error code during parsing,
rather than passing such data on to CoreAudio for decoding.
To do so, extract some of the Opus private data parsing code from
createOpusAudioFormatDescription(), into its own method parseOpusPrivateData(). Create a new
struct type OpusCookieContents to recieve this parsed data. And to avoid excessive
allocations during parsing, ensure that these methods support stack-based structures through
an out-param (as opposed to returning an Optional<> struct).
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h:
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:
(WebCore::parseOpusPrivateData):
(WebCore::cookieFromOpusCookieContents):
(WebCore::createOpusAudioFormatDescription):
(WebCore::cookieFromOpusCodecPrivate): Deleted.
2021-03-23 Chris Dumez <cdumez@apple.com>
[UBSan] dom/Document.cpp:2722:23: runtime error: reference binding to null pointer of type 'JSC::CallFrame'
https://bugs.webkit.org/show_bug.cgi?id=223642
Reviewed by Darin Adler.
Use a raw pointer instead of a reference for the JSC::CallFrame and null check it to make sure
the code is safe and its behavior is defined.
* dom/Document.cpp:
(WebCore::Document::shouldBypassMainWorldContentSecurityPolicy const):
2021-03-23 Jiewen Tan <jiewen_tan@apple.com>
Provide a way to specify platform vs security key when requesting an assertion in the SPI
https://bugs.webkit.org/show_bug.cgi?id=223547
<rdar://74034746>
Reviewed by Brent Fulgham.
Covered by API tests.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webauthn/AuthenticatorAttachment.h: Added.
* Modules/webauthn/AuthenticatorAttachment.idl: Added.
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
* Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
* Modules/webauthn/PublicKeyCredentialRequestOptions.h:
* WebCore.xcodeproj/project.pbxproj:
2021-03-23 Sihui Liu <sihui_liu@apple.com>
Add write barrier to JSValueInWrappedObject for garbage collection
https://bugs.webkit.org/show_bug.cgi?id=198319
Reviewed by Filip Pizlo.
* bindings/js/JSValueInWrappedObject.h:
(WebCore::cachedPropertyValue):
2021-03-23 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Add pressed state for button-like controls
https://bugs.webkit.org/show_bug.cgi?id=223208
<rdar://problem/72399087>
Reviewed by Simon Fraser.
Add a pressed state for buttons, checkboxes, radio buttons, select
elements and date inputs. The pressed state has a 75% opacity applied
to the text and background colors.
* css/html.css:
Explicitly set the default active style on buttons to ensure styles are
are adjusted when the element is pressed.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
The style adjustment is only performed if the -webkit-appearance property
is not set to none. This ensures we do not override the colors for
custom styled form controls.
(WebCore::adjustInputElementButtonStyle):
(WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
(WebCore::RenderThemeIOS::adjustButtonStyle const):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
Factored out the background color determination for checkboxes and
radio buttons into a common method.
(WebCore::RenderThemeIOS::checkboxRadioIndicatorColor):
Factored out the indicator color determination for checkboxes and
radio buttons into a common method.
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
2021-03-23 Peng Liu <peng.liu6@apple.com>
Enable the quirk to disable firing "webkitendfullscreen" event when a video enters picture-in-picture from fullscreen on espn.com
https://bugs.webkit.org/show_bug.cgi?id=223610
Reviewed by Jer Noble.
A video element entering picture-in-picture from fullscreen will fire a "webkitendfullscreen"
event since r266728, but some sites (e.g., espn.com) do not handle the event properly.
Because they assume the video will resume to inline after exiting fullscreen.
This patch enables the quirk for espn.com to disable firing "webkitendfullscreen" event
in that scenario before they fix the issue in the event handler.
* page/Quirks.cpp:
(WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk const):
2021-03-23 Chris Dumez <cdumez@apple.com>
dom/WheelEvent.cpp:47:58: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
https://bugs.webkit.org/show_bug.cgi?id=223605
Reviewed by Darin Adler.
Fix issues found by UBSan in the WheelEvent constructor:
- wheelDeltaX / wheelDeltaY have type int and we negate those values to compute deltaX / deltaY (which have type double).
If wheelDeltaX / wheelDeltaY where INT_MIN, then -INT_MIN would overflow. To address the issue, we now cast to double
*before* negating the value.
- When wheelDeltaX / wheelDeltaY are initially 0, we compute their value from deltaX / deltaY. However, deltaX & deltaY
use type double while wheelDeltaX / wheelDeltaY use type int. As a result, values for deltaX / deltaY could end up
being out of range and not fit in wheelDeltaX / wheelDeltaY. To address the issue, we use clampTo<int>() to clamp to
the correct destination range.
Test: fast/events/wheelevent-delta-overflow.html
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWebKitWheelEvent):
2021-03-23 Jean-Yves Avenard <jya@apple.com>
Only send image across XPC to GPU process if it changes.
https://bugs.webkit.org/show_bug.cgi?id=223298
<rdar://problem/75559236>
Reviewed by Eric Carlson.
No change in observable functionality.
* platform/NowPlayingManager.cpp:
(WebCore::NowPlayingManager::setNowPlayingInfo): On first image change we store it to a local member variable and set imageData to null.
(WebCore::NowPlayingManager::setNowPlayingInfoPrivate): Check if imageData is null, and if so use cache value.
* platform/NowPlayingManager.h: New member to store cache.
2021-03-23 Chris Dumez <cdumez@apple.com>
Add assertions to guard against heap allocations on the audio thread
https://bugs.webkit.org/show_bug.cgi?id=223226
Reviewed by Darin Adler.
Add assertions to guard against heap allocations on the audio thread during
audio processing, since those are bad for performance. I fixed any of the
issues found by these assertions in dependency bugs. Some issues remain
and are protected by DisableMallocRestrictionsForCurrentThreadScope to avoid
tripping the new assertions.
Right now, the assertions only protect audio processing, not pre/post quantum
rendering casts. Ideally, we'd expand the scope of these assertions to cover
everything that's done on the audio thread but this will require more fixes.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::render):
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::fireProcessorErrorOnMainThread):
* Modules/webaudio/AudioWorkletProcessor.cpp:
(WebCore::AudioWorkletProcessor::process):
* Modules/webaudio/MediaStreamAudioSourceCocoa.cpp:
(WebCore::MediaStreamAudioSource::consumeAudio):
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::process):
2021-03-23 Philippe Normand <pnormand@igalia.com>
[MSE][GStreamer] SIGSEV in webKitMediaSrcFreeStream
https://bugs.webkit.org/show_bug.cgi?id=220091
Reviewed by Xabier Rodriguez-Calvar.
The pipeline used by the MSE player is now able reload the MediaSource from the beginning if
a seek to 0 was requested. The problem was that uridecodebin was creating a new source
element and notifying the player which was then trying to dispose underlying platform track
informations, and also related appsrc elements. The latter was specially problematic because
the appsrc elements ownership was badly handled (elements added to a bin should not be
reused, unless an extra ref is added), leading to racy crashes.
So now when uridecodebin creates a new source element, the player detects this is a new
source and transfers track-related informations to the new element. Additionally, new appsrc
elements are created for the new element and track signals emitted so that the player is
still fully aware of the MSE tracks topology.
No new tests but two existing tests are now passing.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
(WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::open):
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
(WebCore::PlaybackPipeline::addSourceBuffer):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcFinalize):
(webKitMediaSrcChangeState):
(webKitMediaSrcFreeStream):
(webKitMediaSrcRestoreTracks):
(webKitMediaSrcSignalTracks):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
2021-03-23 Philippe Normand <pnormand@igalia.com>
[GTK] X11 build fixes
https://bugs.webkit.org/show_bug.cgi?id=223577
Reviewed by Adrian Perez de Castro.
X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF
enum values. As a workaround, we explicitly undef them.
* platform/graphics/GLContext.h:
* platform/graphics/GraphicsContext.h:
2021-03-23 Frédéric Wang <fwang@igalia.com>
Nullptr deref in WebCore::ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=223364
Reviewed by Ryosuke Niwa.
When the editing code creates a span to apply font style change, it may not have editable
style if the document sets extra style (e.g. user-select: all). This is causing a debug
ASSERT in AppendNodeCommand::AppendNodeCommand when the span is inserted and a nullptr
dereference later in release mode. This patch ensures that we skip the font style change
when that happens.
Test: editing/style/apply-font-style-change-crash.html
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Skip the font style change if
the span insertion failed.
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): After inserting the new element,
ensure that the conditions from the ASSERT of AppendNodeCommand::AppendNodeCommand hold and
return failure if they don't.
* editing/ApplyStyleCommand.h: Return a boolean indicating success.
2021-03-23 Zalan Bujtas <zalan@apple.com>
[ContentChangeObserver] Unable to view state details on CDC COVID map
https://bugs.webkit.org/show_bug.cgi?id=223620
<rdar://74284133>
Reviewed by Simon Fraser.
When the content change observer sees some visibility change, it checks if the newly visible content is actionable (e.g. something the user can click on).
A non-actionable content is considered less important than the action behind the "click". So while we trigger the hover state we immediately proceed with click as well.
(e.g. on youtube.com, hovering over the controls (settings, volume etc) brings up a (non-actionable) tooltip and the subsequent click triggers the associated action.
Now on iPadOS, it would require 2 taps on the mute/unmute button to actually mute/unmute the video, if we stopped at the hover state)
This patch implements a quirk for the CDC Covid map so that tapping on the map brings up the numbers dialog and we only submit the click event on the subsequent tap.
* page/Quirks.cpp:
(WebCore::Quirks::shouldTooltipPreventFromProceedingWithClick const):
* page/Quirks.h:
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::isConsideredActionableContent const): moved the isConsideredClickable logic to a lambda function. Call it when we don't apply the quirk.
(WebCore::ContentChangeObserver::didFinishTransition):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::isConsideredClickable): Deleted.
* page/ios/ContentChangeObserver.h:
2021-03-23 Frédéric Wang <fwang@igalia.com>
Nullopt in DOMSelection::getRangeAt
https://bugs.webkit.org/show_bug.cgi?id=223361
Reviewed by Ryosuke Niwa.
When extending the selection toward a pseudo element, it's possible to reach the
corresponding debug ASSERT in WebCore::Position::Position and later a nullptr dereference in
release mode. This patch fixes start/endPositionForLine to avoid that issue.
Test: editing/selection/modify-by-lineboundary-toward-pseudo-element.html
* editing/VisibleUnits.cpp: Make the two branches of LineEndpointComputationMode consistent
and merge them.
(WebCore::startPositionForLine): For logical ordering, try a non-pseudo element after.
(WebCore::endPositionForLine): For logical ordering, try a non-pseudo element before.
2021-03-23 Frédéric Wang <fwang@igalia.com>
Nullptr crash in HTMLConverter::convert
https://bugs.webkit.org/show_bug.cgi?id=221719
Reviewed by Ryosuke Niwa.
When the "Undo" command is called after DOM changes, one of the selection's position anchors
may have been moved to a new document. In that case, just clear the selection. Also add
asserts to ensure the selection is in good state after unapply and reapply commands.
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::unapply): Add security assert to ensure selection is in
good state.
(WebCore::EditCommandComposition::reapply): Ditto.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): If the selection's
position anchors have been moved to a new document then just clear the selection.
(WebCore::FrameSelection::isConnectedToDocument const): New method to verify that all the
positions of the visible selection are in m_document.
* editing/FrameSelection.h: Declare new method.
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::document const): New method that returns a common document for
all positions or nullptr otherwise.
* editing/VisibleSelection.h: Declare new method.
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
REGRESSION(r274860): error: ‘class WebCore::ExtensionsGLOpenGLCommon’ has no member named ‘drawArraysInstancedANGLE’
https://bugs.webkit.org/show_bug.cgi?id=223633
Unreviewed build fix.
Fix WPE build by adding the functions to ExtensionsGLOpenGLCommon as pure virtual functions.
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
Move instanced drawing functionality from ExtensionsGL to GraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=223179
Reviewed by Kenneth Russell.
Remove unused instanced rendering functions from ExtensionsGL.
They are already in GraphicsContextGL interfaces.
ExtensionsGL is being removed as it is redundant. The extension object
is the same object as the context object and not useful.
* platform/graphics/ExtensionsGL.h:
* platform/graphics/angle/ExtensionsGLANGLE.cpp:
* platform/graphics/angle/ExtensionsGLANGLE.h:
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
ANGLE is missing the explicit context headers
https://bugs.webkit.org/show_bug.cgi?id=223470
Reviewed by Alexey Proskuryakov.
* platform/graphics/angle/ANGLEHeaders.h:
Remove the hack that was needed when including ANGLE without
the explicit context headers.
2021-03-23 Martin Robinson <mrobinson@igalia.com>
No scrolling momentum with 'scroll-snap-type: x mandatory' if the scroller scrolls vertically
https://bugs.webkit.org/show_bug.cgi?id=213571
<rdar://problem/64715507>
Reviewed by Simon Fraser.
When handling momentum scrolling for scroll containers that snap, use the
predicted momentum scroll destination for axes that do not snap. Using
the initial scroll offset here was causing momentum scrolling in these axes
to end prematurely.
Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Use the predicted
scroll offset. Even though the startOffset parameter is no longer used, do not remove
it because it will be used in the fix for https://bugs.webkit.org/show_bug.cgi?id=223406.
2021-03-23 Said Abou-Hallawa <said@apple.com>
SVG links navigate only to internal animation elements and <view> anchors
https://bugs.webkit.org/show_bug.cgi?id=223161
Reviewed by Ryosuke Niwa.
The specs for the SVG anchor element <a> have changed in SVG2.
Link: https://svgwg.org/svg2-draft/linking.html#Links
After deprecating the xlink namespace, the SVG anchor element <a> became
very similar to HTML’s <a> element. They both use attributes in the default
namespace.
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
2021-03-22 Venky Dass <yaranamavenkataramana@apple.com>
Nullptr crash in WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.
https://bugs.webkit.org/show_bug.cgi?id=223409
Reviewed by Ryosuke Niwa.
When the check for LineBreak is performed the BR elmement NULL check is not performed. Which results in a crash
The fix therefore is to check for NULL.
Test: LayoutTests/editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
2021-03-22 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::doApply()
https://bugs.webkit.org/show_bug.cgi?id=223545
Reviewed by Ryosuke Niwa.
Test: editing/execCommand/insert-image-in-composed-list.html
Add a missing check in ReplaceSelectionCommand::doApply()
to prevent calling splitTreeToNode() with nullptr.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
2021-03-22 Ryosuke Niwa <rniwa@webkit.org>
Use JSValueInWrappedObject to keep the JSObject alive for QuickTimePluginReplacement
https://bugs.webkit.org/show_bug.cgi?id=223561
<rdar://75634407>
Reviewed by Geoffrey Garen.
This patch replaces QuickTimePluginReplacement's m_scriptObject member variable by
JSValueInWrappedObject in HTMLPlugInElement and hooks it up with the slot visitor.
Also use WeakPtr instead of a raw pointer for the back reference to the plugin element
in QuickTimePluginReplacement and YouTubePluginReplacement.
* Modules/plugins/PluginReplacement.h:
(WebCore::PluginReplacement::InstallResult): Added; a boolean indicating the installation
had succeeded and the script object for QuickTimePluginReplacement.
(WebCore::PluginReplacement::scriptObject): Deleted.
* Modules/plugins/QuickTimePluginReplacement.h:
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::QuickTimePluginReplacement): Deployed WeakPtr.
(WebCore::QuickTimePluginReplacement::~QuickTimePluginReplacement): Removed
the superflous de-initialization of the member variables.
(WebCore::QuickTimePluginReplacement::installReplacement): Now returns JSValue
instead of storing it in m_scriptObject.
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::YouTubePluginReplacement): Deployed WeakPtr.
(WebCore::YouTubePluginReplacement::installReplacement):
* Modules/plugins/YouTubePluginReplacement.h:
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren): Generate visitChildren when an IDL has Plugin attribute.
(GenerateImplementation): Visit the newly added JSValueInWrappedObject.
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Store the script object returned
by QuickTimePluginReplacement::installReplacement in the newly added member variable.
(WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Updated.
* html/HTMLPlugInElement.h:
(WebCore::HTMLPlugInElement::pluginReplacementScriptObject): Added. Used by visitChildren.
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 1: Add a GetImageData display list item
https://bugs.webkit.org/show_bug.cgi?id=223544
Unreviewed.
I accidentally forgot to commit one line of the patch!!
* platform/graphics/displaylists/DisplayListItems.h:
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 1: Add a GetImageData display list item
https://bugs.webkit.org/show_bug.cgi?id=223544
Reviewed by Wenson Hsieh.
We're moving to a design for getImageData() where the web process and the GPU process
set up a shmem + semaphore ahead-of-time, so that when we encounter a call to getImageData(),
the GPU process can just write into the shmem and signal the semaphore. The web process just
encodes the getImageData() call into the regular display list, flushAsync()s to kick the GPU
process, then just waits on the semaphore. Initial performance testing shows that this is
way, way faster than sending messages containing pixel color data payloads.
This patch is just the first step: Adding a GetImageData display list item. The item
currently gets recorded in the web process and applied in the GPU process, but the application
process currently does nothing.
No new tests because there is no behavior change yet.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemBuffer.h:
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::PutImageData::apply const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::GetImageData::GetImageData):
(WebCore::DisplayList::GetImageData::outputFormat const):
(WebCore::DisplayList::GetImageData::srcRect const):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::getImageData):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-03-22 Sam Weinig <weinig@apple.com>
[WebIDL] Remove the need to specify [MayThrowException]
https://bugs.webkit.org/show_bug.cgi?id=180019
Reviewed by Darin Adler and Chris Dumez.
Removes the need to specify [MayThrowException] by deducing it from the bound
signature's return value. Any function returning an ExceptionOr is one that throws.
In most cases, this was already handled by toJS<>(..., impl.func()), which had
overloads for the case that the value was an ExceptionOr. The cases this didn't
work for were funtions that returned void, as toJS<>(..., impl.func()) would not
compile. To work around this, toJS<>() can now take a lambda as its value, and
can determine via the lambda's return type if it needs to throw. For instance,
an IDL operation like:
[MayThrowException] undefined func();
used to generate a bindings body that looked like the following :
auto& impl = castedThis->wrapped();
throwScope.release();
propagateException(*lexicalGlobalObject, throwScope, impl.func());
return JSValue::encode(jsUndefined());
will now generate a bindings body that looks like:
auto& impl = castedThis->wrapped();
RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.func(); })));
which closely mirrors a non-undefined return operation. This wrapped lambda form
is only used for operations returning undefined or promises, as those are the only
functions that can return void, but it would be correct to use them for all types,
if not a bit more noisy and perhaps a tiny compile time cost.
NOTE: The use of `-> decltype(auto)` explicit return type on the lambda is required
to perfectly forward reference types, such as those used by owned promises. Otherwise,
a copy constructor is invoked.
In addition to supporting all operations, this also removes the requirement to annotate
named and indexed getters/setters. This mostly just means always defining a throw scope,
but for named getters it also meant adding a new helper, `visibleNamedPropertyItemAccessorFunctor`
which constructors the item accessor functor for the `accessVisibleNamedProperty`
algorithm rather than hard coding it in the generator.
Due to increased use of toJS, the code generator is now checking more return types
(via AddToImplIncludesForIDLType) so the code generator was able to find a few invalid
return types (e.g. use of Promise<bool> rather than Promise<boolean>, etc.) and these
have been fixed and will be an error going forward. Would be a nice improvement to
the code generator to do type checking up front, rather than as a side effect of
code generation, but we will leave that for another day.
* bindings/js/JSDOMAbstractOperations.h:
(WebCore::visibleNamedPropertyItemAccessorFunctor):
Added. Moves the getterFunctor lambda creation from the GenerateNamedGetterLambda
subroutine in CodeGeneratorJS.pm, but uses deduction and constexpr to determine
if the getter throws.
(WebCore::accessVisibleNamedProperty):
Rename Functor to ItemAccessor to make it a bit more clear what the type does.
* bindings/js/JSDOMConvertBase.h:
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
Replace SFINAE-based overloading of toJS/toJSNewlyCreated with constexpr based
conditionals and add the ability to pass in a functor rather than value. If a
functor is used, additional code paths for void and ExpectionOr<void> are added
which explicitly return jsUndefined().
* bindings/js/JSDOMConvertDate.cpp:
Remove incorrect comment about ExecStates that hasn't applied for a while.
* bindings/js/JSDOMConvertSequences.h:
Fix comment, replacing ExecState with JSGlobalObject. This has been wrong for
a while, and this is just a drive by fix.
* bindings/js/JSDOMExceptionHandling.h:
(WebCore::invokeFunctorPropagatingExceptionIfNecessary):
Use an explicit else as part of the constexpr expression to ensure the functor
is not called, even in debug builds.
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::createDeferredPromise): Deleted.
* bindings/js/JSDOMPromiseDeferred.h:
Remove unused createDeferredPromise function.
* bindings/scripts/CodeGeneratorJS.pm:
(AddMapLikeAttributesAndOperationIfNeeded):
(AddSetLikeAttributesAndOperationIfNeeded):
Fix return type of mapped clear operation to be `any` rather than `undefined`
to match the implementation, which returns a JSValue (e.g. `any`). This is now
required as we actually look at the return type via deduction and need it to match.
(GenerateNamedGetterLambda):
Replace most of the implementation with a call to the new `visibleNamedPropertyItemAccessorFunctor`
helper which returns a lambda with the correct behavior depending on the return type of the inner
lambda passed.
(GenerateGetOwnPropertySlot):
(GenerateGetOwnPropertySlotByIndex):
(GenerateAttributeGetterBodyDefinition):
Match most other parts of the generator and always create a throw scope.
(GenerateOperationDefinition):
Remove explicit call to propagateException now that toJS() will handle that for us.
(GenerateParametersCheck):
Remove explicit call to propagateException now that toJS() will handle that for us.
(GenerateImplementationFunctionCall):
Simplify by using invokeFunctorPropagatingExceptionIfNecessary helper for the "returnArgumentName"
case and relying on toJS handling the other cases.
(NativeToJSValueMayThrow):
Add operation to the list of things that might always throw.
(NativeToJSValue):
Use the lambda wrapped version of toJS for undefined and promise types, which might both
return void and thus require it. To keep most code unchanged, and avoid unnecessary compiler
work, we only use the wrapped version when it might be necessary. If it turns out to be
cheep enough, it might make sense to always use this form for simplicity.
(NeedsExplicitPropagateExceptionCall): Deleted.
* bindings/scripts/IDLAttributes.json:
Remove MayThrowException.
* dom/Element.idl:
* dom/Element.h:
(WebCore::Element::removeAttributeForBindings):
(WebCore::Element::removeAttributeNSForBindings):
Add bindings specific versions of `removeAttribute` and `removeAttributeNS` which
have a void return type (rather than the bool used by the main implementation)
as it is now a requirement that that the bound functions signature match the IDL.
* Modules/cache/DOMCache.idl:
Use the correct interface name, `FetchRequest`, not `Request`.
* Modules/cache/DOMCacheStorage.idl:
Use the correct interface name, `DOMCache`, not `Cache`.
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeys.idl:
* dom/Document+StorageAccess.idl:
* page/Navigator+IsLoggedIn.idl:
Use the correct IDL type, `boolean`, not `bool`.
* dom/AbortSignal.idl:
Update whenSignalAborted to match the return type of implementation, which is `boolean`,
not `undefined`.
* testing/ServiceWorkerInternals.idl:
Use the correct interface name, `FetchResponse`, not `Response`.
* workers/service/ServiceWorkerClients.idl:
Use the correct interface names, `ServiceWorkerClient`, not `Client`, and `ServiceWorkerWindowClient`, not `WindowClient`.
* workers/service/ServiceWorkerWindowClient.idl:
Use the correct interface names, `ServiceWorkerWindowClient`, not `WindowClient`.
* Modules/applepay/ApplePaySession.idl:
* Modules/beacon/Navigator+Beacon.idl:
* Modules/cache/DOMWindow+Caches.idl:
* Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl:
* Modules/encryptedmedia/legacy/WebKitMediaKeys.idl:
* Modules/fetch/FetchHeaders.idl:
* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/mediarecorder/MediaRecorder.idl:
* Modules/mediasession/MediaMetadata.idl:
* Modules/mediasession/MediaSession.idl:
* Modules/mediasource/MediaSource.idl:
* Modules/mediasource/SourceBuffer.idl:
* Modules/mediastream/RTCDTMFSender.idl:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpReceiver+Transform.idl:
* Modules/mediastream/RTCRtpSFrameTransform.idl:
* Modules/mediastream/RTCRtpScriptTransformer.idl:
* Modules/mediastream/RTCRtpSender+Transform.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpTransceiver.idl:
* Modules/paymentrequest/MerchantValidationEvent.idl:
* Modules/paymentrequest/PaymentRequestUpdateEvent.idl:
* Modules/speech/SpeechRecognition.idl:
* Modules/webaudio/AudioBuffer.idl:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioListener.idl:
* Modules/webaudio/AudioNode.idl:
* Modules/webaudio/AudioParam.idl:
* Modules/webaudio/AudioScheduledSourceNode.idl:
* Modules/webaudio/AudioWorkletGlobalScope.idl:
* Modules/webaudio/AudioWorkletProcessor.idl:
* Modules/webaudio/BaseAudioContext.idl:
* Modules/webaudio/BiquadFilterNode.idl:
* Modules/webaudio/IIRFilterNode.idl:
* Modules/webaudio/PannerNode.idl:
* Modules/webaudio/WebKitAudioBufferSourceNode.idl:
* Modules/webaudio/WebKitAudioContext.idl:
* Modules/webdatabase/SQLResultSetRowList.idl:
* Modules/webdatabase/SQLTransaction.idl:
* Modules/websockets/WebSocket.idl:
* Modules/webxr/WebXRFrame.idl:
* Modules/webxr/WebXRReferenceSpace.idl:
* Modules/webxr/WebXRSession.idl:
* Modules/webxr/WebXRWebGLLayer.idl:
* animation/Animatable.idl:
* animation/AnimationEffect.idl:
* animation/KeyframeEffect.idl:
* animation/WebAnimation.idl:
* css/CSSGroupingRule.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSStyleSheet.idl:
* css/DOMCSSNamespace+CSSPropertiesandValues.idl:
* css/DOMMatrix.idl:
* css/DOMMatrixReadOnly.idl:
* css/DeprecatedCSSOMPrimitiveValue.idl:
* css/FontFaceSet.idl:
* css/MediaList.idl:
* dom/CharacterData.idl:
* dom/ChildNode.idl:
* dom/CustomElementRegistry.idl:
* dom/DOMImplementation.idl:
* dom/DOMPointReadOnly.idl:
* dom/DataTransferItemList.idl:
* dom/Document+HTML.idl:
* dom/Document.idl:
* dom/Element+DOMParsing.idl:
* dom/Element+PointerEvents.idl:
* dom/EventTarget.idl:
* dom/MessagePort.idl:
* dom/MutationObserver.idl:
* dom/NamedNodeMap.idl:
* dom/Node.idl:
* dom/NodeIterator.idl:
* dom/ParentNode.idl:
* dom/Range+DOMParsing.idl:
* dom/Range.idl:
* dom/Text.idl:
* dom/TextDecoder.idl:
* dom/TextDecoderStreamDecoder.idl:
* dom/TreeWalker.idl:
* fileapi/Blob.idl:
* fileapi/FileReader.idl:
* fileapi/FileReaderSync.idl:
* html/DOMTokenList.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLDialogElement.idl:
* html/HTMLEmbedElement.idl:
* html/HTMLFrameElement.idl:
* html/HTMLIFrameElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLMediaElement.idl:
* html/HTMLObjectElement.idl:
* html/HTMLOptionsCollection.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTableElement.idl:
* html/HTMLTableRowElement.idl:
* html/HTMLTableSectionElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLVideoElement.idl:
* html/OffscreenCanvas.idl:
* html/TimeRanges.idl:
* html/canvas/CanvasDrawImage.idl:
* html/canvas/CanvasFillStrokeStyles.idl:
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasImageData.idl:
* html/canvas/CanvasPath.idl:
* html/canvas/CanvasPattern.idl:
* html/canvas/CanvasTransform.idl:
* html/canvas/ImageBitmapRenderingContext.idl:
* html/canvas/Path2D.idl:
* html/canvas/WebGL2RenderingContext.idl:
* html/canvas/WebGLRenderingContextBase.idl:
* html/track/TextTrack.idl:
* inspector/InspectorAuditAccessibilityObject.idl:
* inspector/InspectorAuditDOMObject.idl:
* inspector/InspectorAuditResourcesObject.idl:
* loader/appcache/DOMApplicationCache.idl:
* page/Crypto.idl:
* page/DOMSelection.idl:
* page/DOMWindow.idl:
* page/History.idl:
* page/Location.idl:
* page/NavigatorServiceWorker.idl:
* page/Performance+UserTiming.idl:
* page/PerformanceObserver.idl:
* page/UndoManager.idl:
* page/UserMessageHandler.idl:
* page/WindowOrWorkerGlobalScope.idl:
* storage/Storage.idl:
* svg/SVGAngle.idl:
* svg/SVGGeometryElement.idl:
* svg/SVGGraphicsElement.idl:
* svg/SVGLength.idl:
* svg/SVGLengthList.idl:
* svg/SVGMatrix.idl:
* svg/SVGNumberList.idl:
* svg/SVGPathSegList.idl:
* svg/SVGPointList.idl:
* svg/SVGStringList.idl:
* svg/SVGTextContentElement.idl:
* svg/SVGTransform.idl:
* svg/SVGTransformList.idl:
* testing/InternalSettings.idl:
* testing/Internals.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.idl:
* workers/WorkerGlobalScope.idl:
* workers/service/ExtendableEvent.idl:
* workers/service/FetchEvent.idl:
* workers/service/ServiceWorker.idl:
* workers/service/ServiceWorkerClient.idl:
* worklets/PaintWorkletGlobalScope.idl:
* xml/DOMParser.idl:
* xml/XMLHttpRequest.idl:
* xml/XPathEvaluatorBase.idl:
* xml/XPathExpression.idl:
* xml/XPathResult.idl:
Remove use of [MayThrowException].
* bindings/scripts/test/JS/*:
Remove uses of [MayThrowException] in the tests and update all the test results.
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
Unreviewed build fix for AppleWin after r274827
https://bugs.webkit.org/show_bug.cgi?id=223500
<rdar://problem/75706741>
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Move management of RemoteCommandListener from MediaSessionManagerCocoa into NowPlayingManager.
https://bugs.webkit.org/show_bug.cgi?id=223435
<rdar://problem/75567198>
Reviewed by Eric Carlson.
NowPlaying and RemoteCommandListener kind of do the same things, as such it make sense to combine the two
and hide the implementation details from consumers.
We move the handling of setting and clearing the NowPlayingInfo information to an expanded
NowPlayingManager which now also runs in the webcontent process.
The job to ensure a RemoteCommandListener is set is now up to the NowPlayingManager as well as
dealing with changes in NowPlayingInfo content.
Ideally we would prefer to remove all code related to MediaRemote from MediaSessionManagerCocoa;
however for ease we leave it there to avoid having to deal with objective-C interface in NowPlayingManager.
No change in observable behavior.
* platform/MediaStrategy.h: The two existing methods dealing with NowPlayingInfo are removed, instead we can override the entire creation of the NowPlayingManager.
* platform/MediaStrategy.cpp:
(WebCore::MediaStrategy::createNowPlayingManager const): default implementation for createNowPlayingManager
* platform/NowPlayingManager.cpp: Add methods used in MediaSessionManagerCocoa used to deal with RemoteCommandListener.
(WebCore::NowPlayingManager::didReceiveRemoteControlCommand):
(WebCore::NowPlayingManager::addClient): Add explicit method to add a RemoteCommandListener listener, to be called before calling setNowPlayingInfo if needed.
(WebCore::NowPlayingManager::removeClient): renamed from clearNowPlayingInfoClient.
(WebCore::NowPlayingManager::clearNowPlayingInfo):
(WebCore::NowPlayingManager::clearNowPlayingInfoPrivate): Virtual class with default implementation which will immediately communicate with MediaRemote.
(WebCore::NowPlayingManager::setNowPlayingInfo):
(WebCore::NowPlayingManager::setNowPlayingInfoPrivate): Virtual class with default implementation which will immediately communicate with MediaRemote.
(WebCore::NowPlayingManager::setSupportsSeeking): We explicitly set a different setSupportsSeeking method for code clarity.
(WebCore::NowPlayingManager::addSupportedCommand):
(WebCore::NowPlayingManager::removeSupportedCommand):
(WebCore::NowPlayingManager::setSupportedRemoteCommands):
(WebCore::NowPlayingManager::updateSupportedCommands):
(WebCore::NowPlayingManager::ensureRemoteCommandListenerCreated):
(WebCore::NowPlayingManager::clearNowPlayingInfoClient): Deleted.
* platform/NowPlayingManager.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.h: Remove now unused members
* platform/audio/cocoa/MediaSessionManagerCocoa.mm: Amended to use new NowPlayingManager.
(WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
(WebCore::MediaSessionManagerCocoa::scheduleSessionStatusUpdate):
(WebCore::MediaSessionManagerCocoa::addSession):
(WebCore::MediaSessionManagerCocoa::removeSession):
(WebCore::MediaSessionManagerCocoa::setCurrentSession):
(WebCore::MediaSessionManagerCocoa::addSupportedCommand):
(WebCore::MediaSessionManagerCocoa::removeSupportedCommand):
(WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo):
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
Unreviewed build fix for AppleWin after r274791
https://bugs.webkit.org/show_bug.cgi?id=223500
<rdar://problem/75706741>
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
2021-03-22 Chris Fleizach <cfleizach@apple.com>
AX: textRectsFromMarkers always fails
https://bugs.webkit.org/show_bug.cgi?id=223556
<rdar://74256003>
Reviewed by Zalan Bujtas.
The textRectsFromMarkers:text: method is always failing to return a valid answer because when we try to extend
the search range of text to search, we're creating a range that can't be iterated with a CharacterIterator
Test: accessibility/ios-simulator/text-rects-for-range-matches.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::rangeMatchesTextNearRange):
2021-03-22 Ian Gilbert <iang@apple.com>
[Web Animations] nullptr crash in updatePlaybackRate() with no timeline
https://bugs.webkit.org/show_bug.cgi?id=223095
Reviewed by Ryosuke Niwa.
Changed to WebAnimation::remove() to use setTimeline() instead of setTimelineInternal()
to ensure the animation is in the correct play state.
No new tests as this relies on navigating while updating the playback rate and I was unable to make
a reliable test case.
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::remove): Changed setTimelineInternal() to setTimeline() in order to
ensure the animation has the correct play state.
2021-03-22 Patrick Angle <pangle@apple.com>
Web Inspector: Port grid overlay drawing to iOS
https://bugs.webkit.org/show_bug.cgi?id=223396
Reviewed by BJ Burg.
Enable Grid Overlays to be drawn on iOS be including computed overlay objects in the
`InspectorOverlay::Highlight`. Some refactoring was also done to reduce code duplication in the normal and iOS
paths.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
- FloatLine should be accessible from `WebKit::*`
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::getHighlight):
- Add `GridHighlightOverlay`s to the highlight object for iOS.
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::buildLabel):
(WebCore::InspectorOverlay::buildGridOverlay):
- Refactored actual drawing into a separate method to reduce the amount of code duplication needed between the
normal path and the iOS path.
* inspector/InspectorOverlay.h:
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::decode):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::decode):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Area::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Area::decode):
- Support encode/decode for sending new Highlight components to the UIProcess.
* platform/graphics/FloatLine.h:
(WebCore::FloatLine::encode const):
(WebCore::FloatLine::decode):
- Support encode/decode as part of serialization of `InspectorOverlay::Highlight`
2021-03-22 Ada Chan <ada.chan@apple.com>
[WebXR] Enumerate XR devices via ChromeClient in WebXRSystem
https://bugs.webkit.org/show_bug.cgi?id=223520
Reviewed by Sam Weinig.
We want to avoid using singletons in the WebProcess and be able
to proxy the devices from the UI process.
* Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::ensureImmersiveXRDeviceIsSelected):
Instead of getting the devices from the singleton PlatformXR::Instance,
get them from the ChromeClient.
* WebCore.xcodeproj/project.pbxproj:
Mark PlatformXR.h private so it's visible to WebKit.
* page/ChromeClient.h:
(WebCore::ChromeClient::enumerateImmersiveXRDevices):
The default implementation will call PlatformXR::Instance::enumerateImmersiveXRDevices()
to keep current functionality.
* platform/xr/PlatformXR.h:
Export methods that are now called in ChromeClient.
2021-03-22 Eric Carlson <eric.carlson@apple.com>
AVAudioSessionCaptureDeviceManager should use crossThreadCopy
https://bugs.webkit.org/show_bug.cgi?id=223565
<rdar://75480589>
Reviewed by Youenn Fablet.
Tested manually, this can only be tested on device.
* platform/mediastream/CaptureDevice.h: Change access restriction for member
variables from `private:` to `protected:` so derived classes can access them
directly.
* platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
* platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
(WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
`WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
to main thread.
(WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
2021-03-22 Patrick Angle <pangle@apple.com>
REGRESSION(r272433): Inspector should not instrument inside `WebCore::Node::setRenderer`
https://bugs.webkit.org/show_bug.cgi?id=223559
Reviewed by Ryosuke Niwa and Devin Rousso.
Existing test coverage:
- inspector/css/nodeLayoutContextTypeChanged.html
- inspector/css/setLayoutContextTypeChangedMode.html
The previous approach to observing render changes was most likely a performance regression in a very hot code
path (`Node::setRenderer`). This patch resolves this by not instrumenting in this the hot path. Instead we call
inspector instrumentation inside the constructors/destructors of only the RenderObject subclasses we are
interested in observing layout changes for.
Additionally, layout change events are now added to a `Vector` of pending changes, which will be sent to the
front-end later in order to avoid evaluating JavaScript inside a destructor in WK1 with the new instrumentation
points.
* dom/Element.cpp:
(WebCore::Element::didChangeRenderer): Deleted.
* dom/Element.h:
* dom/Node.h:
(WebCore::Node::didChangeRenderer): Deleted.
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::nodeLayoutContextChangedImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::nodeLayoutContextChanged):
* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::InspectorCSSAgent):
(WebCore::InspectorCSSAgent::reset):
(WebCore::InspectorCSSAgent::nodeLayoutContextTypeChanged):
(WebCore::InspectorCSSAgent::layoutContextTypeChangedTimerFired):
- Moved layout change events behind a timer firing.
* inspector/agents/InspectorCSSAgent.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::RenderGrid):
(WebCore::RenderGrid::~RenderGrid):
- Move instrumentation from `Node::setRenderer` to `RenderGrid`.
* rendering/RenderObject.h:
(WebCore::Node::setRenderer):
2021-03-22 Peng Liu <peng.liu6@apple.com>
[GPUP] Add a "wallTime" field to struct RemoteMediaPlayerState
https://bugs.webkit.org/show_bug.cgi?id=223523
Reviewed by Eric Carlson.
No new tests. Fix test failures:
- media/video-controller-child-rate.html
- media/media-controller-unpause.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::currentMediaTime const): A minor fix for the comment.
2021-03-22 Rob Buis <rbuis@igalia.com>
Enable ability to prevent scrolling in Element.focus()
https://bugs.webkit.org/show_bug.cgi?id=178583
Reviewed by Simon Fraser.
Add FocusOptions parameter to the focus method [1] both
to the IDL as the C++ side. Change Element.focus to not
scroll if FocusOptions.preventScroll is true.
Behavior matches Chrome and Firefox.
Tests: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea.html
imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html
Test: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Element.cpp:
(WebCore::Element::focus):
* dom/Element.h:
(WebCore::Element::focus):
* dom/FocusOptions.h: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
* dom/FocusOptions.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::didAttachRenderers):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::focus):
* html/HTMLLabelElement.h:
* html/HTMLLegendElement.cpp:
(WebCore::HTMLLegendElement::focus):
* html/HTMLLegendElement.h:
* html/HTMLOrForeignElement.idl:
* html/InputType.cpp:
(WebCore::InputType::accessKeyAction):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::advanceFocusDirectionallyInContainer):
2021-03-22 Devin Rousso <drousso@apple.com>
Remove unused JS and CSS files of media controls
https://bugs.webkit.org/show_bug.cgi?id=214955
<rdar://problem/66604040>
Reviewed by Eric Carlson.
Cocoa platforms are already using modern media controls so there's no reason to keep the old
media controls resources/logic around any longer. It just wastes space.
The non-iOS Apple controls must be kept though as they are still used on Windows.
* Modules/mediacontrols/assets-apple-iOS.svg: Removed.
* Modules/mediacontrols/mediaControlsiOS.css: Removed.
* Modules/mediacontrols/mediaControlsiOS.js: Removed.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::modernMediaControlsStyleSheet): Deleted.
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::purgeCaches): Added.
(WebCore::RenderThemeCocoa::mediaControlsStyleSheet): Added.
(WebCore::RenderThemeCocoa::mediaControlsScripts): Added.
(WebCore::RenderThemeCocoa::mediaControlsBase64StringForIconNameAndType): Added.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeIOS::modernMediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeIOS::purgeCaches): Deleted.
(WebCore::RenderThemeIOS::mediaControlsScripts): Deleted.
(WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType): Deleted.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeMac::modernMediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeMac::purgeCaches): Deleted.
(WebCore::RenderThemeMac::mediaControlsScripts): Deleted.
(WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType): Deleted.
Move media controls functions to `RenderThemeCocoa` since they are identical.
* Modules/mediacontrols/MediaControlsHost.idl:
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::shadowRootCSSText):
* css/mediaControls.css:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::defaultEventHandler):
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setModernMediaControlsEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::modernMediaControlsEnabled const): Deleted.
Replace `ModernMediaControlsEnabled` setting with `ENABLE_MODERN_MEDIA_CONTROLS` build flag.
* html/track/TextTrackCueGeneric.cpp:
Update the static `DEFAULTCAPTIONFONTSIZE` value for modern media controls.
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
* Modules/modern-media-controls/controls/text-tracks.css:
Update comments.
* css/mediaControlsiOS.css: Removed.
This file was never included anywhere.
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::resetHaveEverRegisteredAsNowPlayingApplicationForTesting): added.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::resetHaveEverRegisteredAsNowPlayingApplicationForTesting): added.
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
Drive-by: Reset `haveEverRegisteredAsNowPlayingApplication` to a consistent state between tests.
This is expected by `LayoutTests/media/now-playing-status-without-media.html`.
* bindings/js/WebCoreBuiltinNames.h:
* WebCore.xcodeproj/project.pbxproj:
2021-03-22 Chris Dumez <cdumez@apple.com>
Reduce number of heap allocations on the audio thread in AudioSampleDataSource
https://bugs.webkit.org/show_bug.cgi?id=223549
Reviewed by Darin Adler.
Reduce number of heap allocations on the audio thread in AudioSampleDataSource
for performance reasons. I got rid of the heap allocations that I could easily
address. Some trickier ones remain.
* platform/audio/cocoa/AudioSampleDataSource.h:
(WebCore::AudioSampleDataSource::inputDescription const):
- Use Optional<> type for m_inputDescription & m_outputDescription data members instead of
std::unique_ptr<> so that we can initialize them without heap allocation.
- Use UniqueRef<> instead of std::unique_ptr<> for m_ringBuffer now that it gets
initialized in the constructor (on the main thread).
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::AudioSampleDataSource):
Initialize m_ringBuffer in the constructor which runs on the main thread, instead of
doing it lazily later on, on the audio rendering thread.
(WebCore::AudioSampleDataSource::~AudioSampleDataSource):
Stop nulling data members out unnecessarily in the destructor.
(WebCore::AudioSampleDataSource::setInputFormat):
Initialize m_inputDescription without doing a heap allocation.
(WebCore::AudioSampleDataSource::setOutputFormat):
- Initialize m_outputDescription without doing a heap allocation.
- Drop initialization of m_ringBuffer now that it is done eagerly in the constructor.
- Drop RunLoop::main().dispatch() just to do logging since this was causing heap allocations.
(WebCore::AudioSampleDataSource::pushSamplesInternal):
(WebCore::AudioSampleDataSource::pushSamples):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
(WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
(WebCore::AudioSampleDataSource::pullSamples):
Drop null checks for m_ringBuffer now that it is initialized eagerly in the constructor
and thus can never be null.
2021-03-22 Devin Rousso <drousso@apple.com>
Fix incorrect fallback values in `PlaybackSessionModelMediaElement` after r274249
https://bugs.webkit.org/show_bug.cgi?id=223584
Reviewed by Eric Carlson.
These values were something I was experimenting with as a way of knowing "has this ever
been changed", but as it turned out there were other ways of achieving this and/or it was
unnecessary to do so.
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::defaultPlaybackRate const):
(WebCore::PlaybackSessionModelMediaElement::playbackRate const):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Always perform image decoding in the web content process.
https://bugs.webkit.org/show_bug.cgi?id=223290
<rdar://problem/75559243>
Reviewed by Eric Carlson.
No change in externally observable behaviour.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished): We decode the image into a BitmapImage and handle all potential failures getting there.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): remove FIXME comment.
2021-03-22 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Composition text is not initially highlighted when typing in text fields using Pinyin keyboard
https://bugs.webkit.org/show_bug.cgi?id=223563
<rdar://problem/75564516>
Reviewed by Antti Koivisto.
When enabling line layout integration, composition highlights on iOS don't appear when typing an input string
using the Pinyin keyboard for the first time. This is because the text renderer for the inserted composition
text does not contain inline text boxes when painting the composition text on iOS, so the marked text painting
codepath is never triggered.
On macOS, this isn't an issue because the process of setting the composition changes the selection, which then
changes the highlight state of the `RenderText`, which subsequently calls into `ensureLineBoxes()`. However,
since selections are drawn using UIKit in the UI process on iOS, we don't end up ensuring that inline text boxes
are constructed for the inserted text.
To address this, we follow macOS behavior by ensuring line box construction on the rendered composition text
when setting the composition.
Test: editing/input/composition-underline-in-search-field.html
* editing/Editor.cpp:
(WebCore::Editor::setComposition):
2021-03-22 Chris Dumez <cdumez@apple.com>
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html is failing
https://bugs.webkit.org/show_bug.cgi?id=223583
Reviewed by Eric Carlson.
As per https://webaudio.github.io/web-audio-api/#computation-of-value, we should replace NaN values with
the default value, when computing the value for an AudioParam.
No new tests, rebaselined existing test.
* Modules/webaudio/AudioParam.cpp:
(WebCore::replaceNaNValues):
(WebCore::AudioParam::calculateFinalValues):
2021-03-22 Rob Buis <rbuis@igalia.com>
[css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252
Reviewed by Darin Adler.
Parse CSS contain property according to the specification [1].
This patch also adds the experimental feature CSSContainment and
makes contain invisible from style when disabled.
[1] https://drafts.csswg.org/css-contain-1/#contain-property
Test: fast/css/contain-invalidate-if-disabled.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::contain const):
(WebCore::RenderStyle::setContain):
(WebCore::RenderStyle::initialContainment):
(WebCore::RenderStyle::strictContainment):
(WebCore::RenderStyle::contentContainment):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialContain):
(WebCore::Style::BuilderCustom::applyInheritContain):
(WebCore::Style::BuilderCustom::applyValueContain):
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] ASSERTION FAILED: isMainThread() in GPU process for some canvas/philip/tests tests
https://bugs.webkit.org/show_bug.cgi?id=223500
Reviewed by Alex Christensen.
Added a new member of FontPlatformData::CreationData to
FontCustomPlatformData struct to transfer custom fonts to GPU
process for WinCairo port.
* PlatformWin.cmake:
* platform/graphics/FontPlatformData.h:
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
* platform/graphics/win/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
(WebCore::createFontCustomPlatformData):
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
2021-03-22 Youenn Fablet <youenn@apple.com>
RealtimeMediaSource does not need to be a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=223573
<rdar://75583258>
Reviewed by Eric Carlson.
Remove use of WeakPtr and ref the source instead.
Covered by existing tests.
* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::OnChanged):
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::OnChanged):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::updateHasStartedProducingData):
* platform/mediastream/RealtimeMediaSource.h:
2021-03-22 Philippe Normand <pnormand@igalia.com>
[GStreamer] gst_audio_format_fill_silence() is deprecated in GStreamer 1.20
https://bugs.webkit.org/show_bug.cgi?id=223562
Reviewed by Xabier Rodriguez-Calvar.
Fix GStreamer deprecation warnings.
* platform/graphics/gstreamer/GStreamerCommon.h:
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp:
(WebCore::MockRealtimeAudioSourceGStreamer::render):
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
2021-03-22 Youenn Fablet <youenn@apple.com>
Async Clipboard read prevents WebRTC IOSurfaces from being released
https://bugs.webkit.org/show_bug.cgi?id=223489
<rdar://problem/75601433>
Reviewed by Eric Carlson.
Instead of dispatching a task to main thread, the task refing a MediaSample,
we store the MediaSample in MediaPlayerPrivateMediaStreamAVFObjC on the background thread and
access it on main thread with a lock.
This ensures that we do not keep more than one media sample per MediaPlayerPrivateMediaStreamAVFObjC, even if main thread is blocked.
Make sure to reset the video transformation according hasChangedOrientation even if there is no media sample available anymore.
Covered by existing tests.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Fix typo introduced in r274586 and revert fix from r274667 to get around compilation error following typo.
https://bugs.webkit.org/show_bug.cgi?id=223554
Reviewed by Eric Carlson.
No test needed.
* testing/Internals.cpp:
(WebCore::Internals::loadArtworkImage):
2021-03-22 Chris Dumez <cdumez@apple.com>
Better validate JSArrays in AudioWorkletProcessor
https://bugs.webkit.org/show_bug.cgi?id=223548
Reviewed by Geoffrey Garen.
Better validate JSArrays in AudioWorkletProcessor. Replaces debug assertions with runtime
checks for robustness.
* Modules/webaudio/AudioWorkletProcessor.cpp:
(WebCore::copyDataFromBusesToJSArray):
(WebCore::copyDataFromParameterMapToJSObject):
(WebCore::zeroJSArray):
(WebCore::AudioWorkletProcessor::buildJSArguments):
2021-03-22 Zalan Bujtas <zalan@apple.com>
[ macOS debug arm64 ] ASSERTION FAILED: count >= 1 ./rendering/RenderMultiColumnSet.cpp(450) : unsigned int WebCore::RenderMultiColumnSet::columnCount() const
https://bugs.webkit.org/show_bug.cgi?id=223144
<rdar://problem/75381496>
Reviewed by Simon Fraser.
Overflow height computation with infinite constraint should not produce a negative height value.
During the column balancing, we use the "max layout unit" value to indicate infinite available space.
However this max value confuses the height computation in expandToEncompassFragmentedFlowContentsIfNeeded and produces a negative height value.
Let's also ensure that we never trigger undefined behavior as the result of implicitly converting (negative)float to unsigned.
* rendering/RenderFragmentContainerSet.cpp:
(WebCore::RenderFragmentContainerSet::expandToEncompassFragmentedFlowContentsIfNeeded):
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnCount const):
2021-03-22 Chris Dumez <cdumez@apple.com>
Implement AbortSignal.abort()
https://bugs.webkit.org/show_bug.cgi?id=223071
<rdar://problem/75575483>
Reviewed by Darin Adler.
Implement AbortSignal.abort() which creates and returns an already aborted AbortSignal:
- https://github.com/whatwg/dom/pull/960
- https://github.com/web-platform-tests/wpt/pull/28003
No new tests, covered by updated test.
* dom/AbortSignal.cpp:
(WebCore::AbortSignal::createAborted):
(WebCore::AbortSignal::AbortSignal):
* dom/AbortSignal.h:
* dom/AbortSignal.idl:
2021-03-22 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Context menu should account for image overlay content
https://bugs.webkit.org/show_bug.cgi?id=223518
<rdar://problem/75505210>
Reviewed by Devin Rousso.
Make some adjustments to allow context menu items for text selection to show up when right clicking on text in
an image overlay.
Test: fast/images/image-extraction/mac/copy-image-overlay-text-with-context-menu.html
* editing/Editor.cpp:
(WebCore::Editor::performCutOrCopy):
Adjust this logic so that we only attempt to write plain text to the system pasteboard when copying text inside
image overlays (this matches the behavior of copying selected text in `textarea` elements and text fields).
* html/HTMLElement.cpp:
(WebCore::HTMLElement::hasImageOverlay const):
(WebCore::imageOverlayHost):
(WebCore::HTMLElement::isInsideImageOverlay):
Add a helper function to determine whether or not a given range in the DOM is inside an image overlay shadow
root. To avoid code duplication, pull out some logic to grab the image overlay's element host (if it exists) out
into a separate static helper function (`imageOverlayHost`), and use it here and also in `isImageOverlayText`.
(WebCore::HTMLElement::isImageOverlayText):
Move the UA shadow root check into `HTMLElement::hasImageOverlay`, so that `hasImageOverlay` can be invoked for
elements with non-UA shadow roots without hitting an assertion.
* html/HTMLElement.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Pull logic that determines whether or not we should show text-selection-related context menu items out into a
separate lambda function, so that it's easier to take advantage of early returns; then, in the case where we
have an image URL, additionally show selected text options if the selection is inside the image overlay.
2021-03-22 Sam Weinig <weinig@apple.com>
Use the PropertyName parameter passed to custom getters/setters rather than a redundant const char* in DOM attribute prologues
https://bugs.webkit.org/show_bug.cgi?id=223542
Reviewed by Alexey Shvayka.
Use the PropertyName parameter passed to custom getters/setters rather than a
redundant const char* in DOM attribute prologues. This will allow us to share
IDLAttribute prologue implementations in cases where the same bound function
should be called for multiple attributes, as will be the case for CSSStyleDeclaration.
Also took the opertunity to do some cleanup
- Made CastedThisErrorBehavior conditions use if constexpr to ensure the non-requested
cases are compiled out, even in debug builds.
- Moves all attribute Getter/Setter TypeError related functions to JSC, where there
were already some, to remove duplication of strings and prepare for hoisting setter
prologues in the future (as is already done for getters).
- Remove AttributeSetter::call as it was redundant with invokeFunctorPropagatingExceptionIfNecessary.
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::set):
(WebCore::IDLAttribute::setStatic):
(WebCore::IDLAttribute::get):
(WebCore::IDLAttribute::getStatic):
(WebCore::AttributeSetter::call): Deleted.
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::rejectPromiseWithGetterTypeError):
(WebCore::makeGetterTypeErrorMessage): Deleted.
(WebCore::throwGetterTypeError): Deleted.
(WebCore::throwSetterTypeError): Deleted.
* bindings/js/JSDOMExceptionHandling.h:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
* bindings/js/JSDOMOperation.h:
(WebCore::IDLOperation::call):
* bindings/js/JSDOMOperationReturningPromise.h:
(WebCore::IDLOperationReturningPromise::call):
(WebCore::IDLOperationReturningPromise::callReturningOwnPromise):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeGetterTrampolineDefinition):
(GenerateAttributeSetterBodyDefinition):
(GenerateAttributeSetterTrampolineDefinition):
* bindings/scripts/test/JS/*:
Update test results.
2021-03-22 Chris Dumez <cdumez@apple.com>
Avoid heap allocation under AudioNodeInput::disable() / AudioNodeInput::enable()
https://bugs.webkit.org/show_bug.cgi?id=223529
Reviewed by Eric Carlson.
Avoid heap allocation under AudioNodeInput::disable() / AudioNodeInput::enable() since those can
get called on the audio thread.
AudioNodeInput used to have a m_disabledOutputs container to keep disabled outputs separated
from enabled ones (in m_outputs). Instead, we now store all outputs in m_outputs with a 'isEnabled'
flag. As a result, we no longer need to make any heap allocations when enabling/disabling an
output, we merely need to flip a flag in m_outputs.
For convenience, since clients of rendering outputs only care about enabled outputs, I introduced
a new RenderingOutputCollection container with iterators. This way clients do not need to worry
about disabled outputs.
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect):
(WebCore::AudioNodeInput::disconnect):
(WebCore::AudioNodeInput::didDisableOutput):
(WebCore::AudioNodeInput::didEnableOutput):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
* Modules/webaudio/AudioNodeInput.h:
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::disable):
(WebCore::AudioNodeOutput::enable):
* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::calculateFinalValues):
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::numberOfConnections const):
(WebCore::AudioSummingJunction::addOutput):
(WebCore::AudioSummingJunction::removeOutput):
(WebCore::AudioSummingJunction::updateRenderingState):
(WebCore::AudioSummingJunction::maximumNumberOfChannels const):
(WebCore::AudioSummingJunction::didDisableOutput):
(WebCore::AudioSummingJunction::didEnableOutput):
(WebCore::AudioSummingJunction::RenderingOutputCollection::RenderingOutput::RenderingOutput):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::remove):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::setEnabled):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::RenderingOutputCollection):
* Modules/webaudio/AudioSummingJunction.h:
(WebCore::AudioSummingJunction::RenderingOutputCollection::isEmpty const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::size const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::clear):
(WebCore::AudioSummingJunction::RenderingOutputCollection::append):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::ConstIterator):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator* const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator!= const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator++):
(WebCore::AudioSummingJunction::RenderingOutputCollection::begin const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::end const):
(WebCore::AudioSummingJunction::renderingOutputs const):
(WebCore::AudioSummingJunction::isConnected const):
* Modules/webaudio/WebKitAudioPannerNode.cpp:
(WebCore::WebKitAudioPannerNode::notifyAudioSourcesConnectedToNode):
2021-03-22 Youenn Fablet <youenn@apple.com>
Implement RTCDataChannel transfer out of process
https://bugs.webkit.org/show_bug.cgi?id=223443
Reviewed by Eric Carlson.
Add support for serialization/deserialization of RTCDataChannel information so that it can be MessagePort transfered or transfered to out-of-process contexts like Window or Service Worker.
Add infrastructure for remote sources (that allows to send data or close data channels) and remote handlers which receive messages from out-of-process data channels.
Covered by API tests.
* Modules/mediastream/DetachedRTCDataChannel.h: Added.
(WebCore::DetachedRTCDataChannel::DetachedRTCDataChannel):
(WebCore::DetachedRTCDataChannel::memoryCost const):
(WebCore::DetachedRTCDataChannel::encode const):
(WebCore::DetachedRTCDataChannel::decode):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::RTCDataChannel):
(WebCore::rtcDataChannelLocalMap):
(WebCore::RTCDataChannel::handlerFromIdentifier):
(WebCore::RTCDataChannel::create):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannelRemoteHandler.cpp: Added.
(WebCore::RTCDataChannelRemoteHandler::create):
(WebCore::RTCDataChannelRemoteHandler::RTCDataChannelRemoteHandler):
(WebCore::RTCDataChannelRemoteHandler::~RTCDataChannelRemoteHandler):
(WebCore::RTCDataChannelRemoteHandler::didChangeReadyState):
(WebCore::RTCDataChannelRemoteHandler::didReceiveStringData):
(WebCore::RTCDataChannelRemoteHandler::didReceiveRawData):
(WebCore::RTCDataChannelRemoteHandler::didDetectError):
(WebCore::RTCDataChannelRemoteHandler::bufferedAmountIsDecreasing):
(WebCore::RTCDataChannelRemoteHandler::readyToSend):
(WebCore::RTCDataChannelRemoteHandler::setClient):
(WebCore::RTCDataChannelRemoteHandler::sendStringData):
(WebCore::RTCDataChannelRemoteHandler::sendRawData):
(WebCore::RTCDataChannelRemoteHandler::close):
* Modules/mediastream/RTCDataChannelRemoteHandler.h: Added.
* Modules/mediastream/RTCDataChannelRemoteSource.cpp: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
(WebCore::RTCDataChannelRemoteSource::RTCDataChannelRemoteSource):
(WebCore::RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource):
* Modules/mediastream/RTCDataChannelRemoteSource.h: Added.
(WebCore::RTCDataChannelRemoteSource::create):
(WebCore::RTCDataChannelRemoteSource::sendStringData):
(WebCore::RTCDataChannelRemoteSource::sendRawData):
(WebCore::RTCDataChannelRemoteSource::close):
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::postTask):
* Modules/webaudio/AudioWorkletMessagingProxy.cpp:
(WebCore::AudioWorkletMessagingProxy::createRTCDataChannelRemoteHandlerConnection):
* Modules/webaudio/AudioWorkletMessagingProxy.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::SerializedScriptValue):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::encode const):
(WebCore::SerializedScriptValue::decode):
* dom/Document.cpp:
(WebCore::Document::createRTCDataChannelRemoteHandlerConnection):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::createRTCDataChannelRemoteHandlerConnection):
* platform/ScriptExecutionContextIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelState.h.
* platform/mediastream/RTCDataChannelHandler.h:
(WebCore::RTCDataChannelInit::encode const):
(WebCore::RTCDataChannelInit::decode):
* platform/mediastream/RTCDataChannelIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
(WebCore::RTCDataChannelIdentifier::encode const):
(WebCore::RTCDataChannelIdentifier::decode):
* platform/mediastream/RTCDataChannelRemoteHandlerConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
* platform/mediastream/RTCDataChannelRemoteSourceConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
* platform/mediastream/RTCDataChannelState.h:
* platform/mediastream/RTCPriorityType.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::createRTCDataChannelRemoteHandlerConnection):
* workers/WorkerGlobalScope.h:
* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::createRTCDataChannelRemoteHandlerConnection):
* workers/WorkerMessagingProxy.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::createRTCDataChannelRemoteHandlerConnection):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-22 Simon Fraser <simon.fraser@apple.com>
Fix a mistake in r274725 spotted by Darin.
I accidentally removed the case statement for CSSPropertyWebkitTextSizeAdjust.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
2021-03-22 Simon Fraser <simon.fraser@apple.com>
Rename WebCore's DisplayRefreshMonitorMac to indicate that it's only used in legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=223543
Reviewed by Tim Horton.
DisplayRefreshMonitorMac in WebCore is only used for WebKitLegacy; WebProcess doesn't have
WindowServer access so is unable to create CVDisplayLinkRefs.
Rename it to indicate this, and reduce confusion with DisplayRefreshMonitorMac in WebKit2.
Also add an assertion that LegacyDisplayRefreshMonitorMac is not being created in the
WebProcess.
For EmptyPageClients (like the Page used by createPageForSanitizingWebContent()) we need
a DisplayRefreshMonitor implementation that doesn't try to CVDisplayLinkRefs in the
Web Process, so add an EmptyDisplayRefreshMonitor that never fires.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::EmptyDisplayRefreshMonitor::create):
(WebCore::EmptyDisplayRefreshMonitor::EmptyDisplayRefreshMonitor):
(WebCore::EmptyChromeClient::createDisplayRefreshMonitor const):
* loader/EmptyClients.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp: Renamed from Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp.
(WebCore::LegacyDisplayRefreshMonitorMac::LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::~LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::stop):
(WebCore::displayLinkCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::requestRefreshCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h: Renamed from Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h.
(WebCore::LegacyDisplayRefreshMonitorMac::create):
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Style: Remove unnecessary { }s from case statements in DisplayListItemBuffer.cpp
https://bugs.webkit.org/show_bug.cgi?id=223550
Reviewed by Wenson Hsieh.
They're unnecessary, and none of the other case statements in displaylists/ have them.
Deleting them allows more of the program to fit on the screen at a time.
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
2021-03-19 Dean Jackson <dino@apple.com>
Link against the ANGLE Shared Library
https://bugs.webkit.org/show_bug.cgi?id=218539
<rdar://problem/69062211>
Reviewed by Tim Horton.
Weak link against libANGLE-shared.dylib.
* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* Sources.txt:
* SourcesGTK.txt:
* SourcesWPE.txt:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isANGLEAvailable):
(WebCore::GraphicsContextGLOpenGL::create):
2021-03-19 Lauro Moura <lmoura@igalia.com>
Unreviewed. WPE Debug build fix after r274695
* platform/xr/openxr/PlatformXROpenXR.cpp:
(PlatformXR::OpenXRDevice::submitFrame):
2021-03-19 Kate Cheney <katherine_cheney@apple.com>
Cannot login to microsoftonline.com without allowing storage access
https://bugs.webkit.org/show_bug.cgi?id=223510
<rdar://problem/75619058>
Reviewed by John Wilander.
This patch introduces two changes:
1. Activate the storage access quirks for default browsers only. This
is the main place we test them, and can lead to unexpected behavior in
apps otherwise.
2. Doesn't cancel the click even if the user denies storage access.
Previously we we were not allowing the click because it produces
unexpected behavior. But, sites like login.microsoftonline.com are used
by multiple Microsoft login flows. Since only a subset require storage
access, canceling the click across the board could be considered
regressing behavior.
Since storage access data is stored in the network process, we
currently cancel the user's click on quirked sites while we wait
asyncronously for the IPC response. If the user grants storage access,
we store this in the web content process and dispatch a synthetic
click. In this case, when the click triggers another storage access
check, we can allow the click because we no longer need to wait for
information from the network process.
We need some heuristic in the web content process to handle the case
of the user denying storage access to know whether to allow a
synthetic click to happen. This patch introduces
hasDeniedCrossPageStorageAccess which stores domains in the web
content process which have been denied storage access via quirk. If
a user has previously denied storage access in that web content
process, we don't prompt again. A new web content process will give them
another opportunity to allow/deny storage access.
* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent):
* loader/FrameLoaderClient.h:
Add a client function to check if the parent process is a full web
browser, and pass this to the place we apply the quirks.
* loader/ResourceLoadObserver.h:
(WebCore::ResourceLoadObserver::setHasDeniedCrossPageStorageAccess):
(WebCore::ResourceLoadObserver::hasDeniedCrossPageStorageAccess const):
* page/Quirks.cpp:
(WebCore::hasDeniedCrossPageStorageAccess):
(WebCore::Quirks::requestStorageAccessAndHandleClick const):
(WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
* page/Quirks.h:
2021-03-19 Zalan Bujtas <zalan@apple.com>
Unreviewed, reverting r274596.
Google logo is not visible on google.com
Reverted changeset:
"[css-grid] Incorrect track sizing when using relative sized
items in 'auto' column tracks"
https://bugs.webkit.org/show_bug.cgi?id=191627
https://commits.webkit.org/r274596
2021-03-19 Cameron McCormack <heycam@apple.com>
Anonymous table rows do not collapse if there are any other non-anonymous table row siblings.
https://bugs.webkit.org/show_bug.cgi?id=223490
Reviewed by Zalan Bujtas.
Currently, when a RenderTableRow is detached from its parent, we will
check whether all of the remaining RenderTableRow siblings are anonymous
before deciding to merge them. This means that if removing the
RenderTableRow would produce a sequence of anonymous RenderTableRows
that could be collapsed, but we have some other non-anonymous
RenderTableRow as a sibling, then we'll incorrectly skip the collapsing.
Instead we should look only to the previous and next sibling, and
collapse them together if they're both anonymous.
Test: fast/table/table-anonymous-row-collapse.html
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
Change from requiring all siblings after the detachment to be anonymous, to
looking only at the previous and following siblings.
2021-03-19 Jer Noble <jer.noble@apple.com>
Many media/media-fragments/ tests are crashing due to other tests that run before them.
https://bugs.webkit.org/show_bug.cgi?id=223277
<rdar://problem/75492360>
Reviewed by Eric Carlson.
Work around the crashing function by pre-conforming the fragment identifier according
to the format required by the crashing function.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::hasBrokenFragmentSupport):
(WebCore::conformFragmentIdentifierForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2021-03-19 Youenn Fablet <youenn@apple.com>
Custom scheme handled origins should be considered secure
https://bugs.webkit.org/show_bug.cgi?id=223423
Reviewed by Alex Christensen.
If an app registers 'custom' as scheme handler, 'custom://localhost/page.html' is considered secure context
but 'custom://test/page.html' is not.
This patch makes it so that any 'custom://XXX/' origin will be considered secure context if 'custom' is a registered scheme handler.
Covered by API test and new test.
Test: http/tests/events/device-orientation-motion-insecure-context.html
* WebCore.xcodeproj/project.pbxproj:
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsPotentiallyTrustworthy):
2021-03-19 ChangSeok Oh <changseok@webkit.org>
Animated AVIF support
https://bugs.webkit.org/show_bug.cgi?id=222804
<rdar://problem/75362181>
Reviewed by Philippe Normand.
This change implements animation of the avif sequence. The decoding approach
is similar to ones for other image formats, i.e., decoding frames in BGRA pixels
then bit-copying them into ScalableImageDecoderFrame. The decoded frames are cached
for future use. The repetition is missing in this change. It will be addressed
in separate patches.
The added avif animation test compares the last frame of each avifs and a static
avif image. The embeded avifs images are originated from corresponding webp images
for animated-webp.html, and encoded with timescale 100 (i.e., the duration of each frame
is 0.01s). The total duration and the track duration are same so the added avifs samples
are supposed to be played one time.
Test: fast/images/animated-avif.html
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
(WebCore::AVIFImageDecoder::repetitionCount const):
(WebCore::AVIFImageDecoder::findFirstRequiredFrameToDecode):
(WebCore::AVIFImageDecoder::frameBufferAtIndex):
(WebCore::AVIFImageDecoder::isComplete):
(WebCore::AVIFImageDecoder::tryDecodeSize):
(WebCore::AVIFImageDecoder::decode):
* platform/image-decoders/avif/AVIFImageDecoder.h:
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::decodeFrame):
(WebCore::AVIFImageReader::imageCount const):
(WebCore::AVIFImageReader::~AVIFImageReader): Deleted.
* platform/image-decoders/avif/AVIFImageReader.h:
2021-03-19 Martin Robinson <mrobinson@igalia.com>
scroll-snap-stop: always not respected during momentum scrolling
https://bugs.webkit.org/show_bug.cgi?id=223406
Reviewed by Simon Fraser.
Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-stop-momentum-scroll.html
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Enable directional scroll
snapping when handling momentum scrolling. This turns on scroll-snap-stop as well as a few other
features.
2021-03-19 Simon Fraser <simon.fraser@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=223141
Runtime-disabled CSS features still still appear enabled via two-arg CSS.supports()
Address post-landing review comments from Darin.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
2021-03-19 Sam Weinig <weinig@apple.com>
Add PropertyName parameter to custom setters to allow shared implementations to do late name lookup
https://bugs.webkit.org/show_bug.cgi?id=223413
Reviewed by Alexey Shvayka.
Update bindings to account for new PropertyName parameter being passed to custom setters.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeSetterTrampolineDefinition):
* bindings/scripts/test/JS/JSDOMWindow.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCSSProperty.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSON.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestEnabledForContext.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSWorkletGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
2021-03-19 Rob Buis <rbuis@igalia.com>
Protect frame before calling didBeginDocument
https://bugs.webkit.org/show_bug.cgi?id=217185
Reviewed by Alex Christensen.
Protect frame before calling didBeginDocument
since it could potentially delete the frame
through event handling.
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
2021-03-19 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] Remove DRM resources release
https://bugs.webkit.org/show_bug.cgi?id=223436
Reviewed by Philippe Normand.
Releasing DRM resources should not be needed according to the
spec. If we needed this in the future because of whatever reason
we need to study it again in some other way.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMInstanceProxy::trackSession): Deleted.
(WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy): Deleted.
* platform/encryptedmedia/CDMProxy.h:
(WebCore::CDMProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceProxy::removeSession): Deleted.
(WebCore::CDMInstanceProxy::releaseDecryptionResources): Deleted.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceClearKey::createSession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::releaseDecryptionResources): Deleted.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h:
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceThunder::createSession):
(WebCore::CDMInstanceSessionThunder::requestLicense):
(WebCore::CDMInstanceSessionThunder::closeSession):
(WebCore::CDMInstanceSessionThunder::removeSessionData):
* platform/graphics/gstreamer/eme/CDMThunder.h:
2021-03-19 Devin Rousso <drousso@apple.com>
CSP headers can block default <video> controls
https://bugs.webkit.org/show_bug.cgi?id=223422
<rdar://problem/41192193>
Reviewed by Antoine Quint.
Covered by existing tests.
* Modules/modern-media-controls/controls/icon-service.js:
(IconService.prototype.imageForIconAndLayoutTraits):
In order for an `<img>` to skip CSP checks it must be `isInUserAgentShadowTree` before setting `src`.
* Modules/modern-media-controls/main.js:
(createControls):
Provide the UA `shadowRoot` to the `iconService` so it can temporarily attach the `<img>`.
* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
Web Inspector should be notified about new UA shadow roots before they're modified.
2021-03-19 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274706.
https://bugs.webkit.org/show_bug.cgi?id=223506
Attempt to fix WPE debug build failed
Reverted changeset:
"Unreviewed, fix WPE debug build after r274695"
https://trac.webkit.org/changeset/274706
2021-03-19 Youenn Fablet <youenn@apple.com>
Disable SFrame compatibility mode for audio senders and receivers
https://bugs.webkit.org/show_bug.cgi?id=223391
<rdar://problem/75538500>
Reviewed by Eric Carlson.
Add RTCRtpSFrameTransformer::setMediaType to allow setting the authentication size.
In case mode is H264/VP8 and media type is audio, set back mode to none.
Covered by API test.
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::initializeTransformer):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
(WebCore::RTCRtpSFrameTransformer::setMediaType):
* WebCore.xcodeproj/project.pbxproj:
2021-03-17 Sergio Villar Senin <svillar@igalia.com>
[css-flex] Make {main|cross}SizeForPercentageResolution() return booleans instead of actual sizes
https://bugs.webkit.org/show_bug.cgi?id=223377
Reviewed by Manuel Rego Casasnovas.
These two methods were only called by childLogicalHeightForPercentageResolution() and they either returned
WTF::nullopt or the overridingContentLogicalHeight(). We could simplify a bit the code by returning a boolean
which means whether the overriding content logical height should be used to resolve a percentage or not. Apart
from changing the return value we're also improving the naming so it becomes obvious that we are dealing with
flex items and not the flex container.
We're also removing some comments in those methods that were not really accurate.
No new tests as there is no change in functionality.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
(WebCore::RenderBox::availableLogicalHeightUsing const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::useChildOverridingCrossSizeForPercentageResolution): Renamed from crossSizeForPercentageResolution.
(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): Renamed from mainSizeForPercentageResolution.
(WebCore::RenderFlexibleBox::useChildOverridingLogicalHeightForPercentageResolution): Renamed from childLogicalHeightForPercentageResolution.
(WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Deleted.
(WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Deleted.
(WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution): Deleted.
* rendering/RenderFlexibleBox.h:
2021-03-19 Diego Pino Garcia <dpino@igalia.com>
Unreviewed, fix WPE debug build after r274695
* platform/xr/openxr/PlatformXROpenXR.cpp:
(PlatformXR::OpenXRDevice::submitFrame):
2021-03-19 Yusuke Suzuki <ysuzuki@apple.com>
WebCore::ThreadGlobalData should not initialize fields eagerly
https://bugs.webkit.org/show_bug.cgi?id=223481
Reviewed by Chris Dumez.
ThreadGlobalData is used in various cases. For example, WebCore::Timer uses it, and
this is even also used in GPUProcess. We observed something (e.g. EventNames, QualifiedNameCache etc.)
is initialized even in GPUProcess just because GPUProcess's audio stack uses WebCore::Timer.
This patch makes these fields lazily-allocated to avoid initializing eagerly in the threads that
are not interested in DOM etc.
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::initializeCachedResourceRequestInitiators):
(WebCore::ThreadGlobalData::initializeEventNames):
(WebCore::ThreadGlobalData::initializeQualifiedNameCache):
(WebCore::ThreadGlobalData::initializeMimeTypeRegistryThreadGlobalData):
(WebCore::ThreadGlobalData::mimeTypeRegistryThreadGlobalData): Deleted.
* platform/ThreadGlobalData.h:
(WebCore::ThreadGlobalData::ThreadGlobalData::cachedResourceRequestInitiators):
(WebCore::ThreadGlobalData::ThreadGlobalData::eventNames):
(WebCore::ThreadGlobalData::ThreadGlobalData::qualifiedNameCache):
(WebCore::ThreadGlobalData::ThreadGlobalData::mimeTypeRegistryThreadGlobalData):
(WebCore::ThreadGlobalData::ThreadGlobalData::threadTimers):
2021-03-18 Simon Fraser <simon.fraser@apple.com>
Attempt to fix the macOS build after r274695.
* platform/graphics/GraphicsContextGL.h:
* testing/WebFakeXRDevice.cpp:
* testing/WebFakeXRDevice.h:
== Rolled over to ChangeLog-2021-03-18 ==