blob: 0256d484c153fccbe99dd02e85b2072eff0e85cd [file] [log] [blame]
2021-04-16 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Reviewed by Darin Adler.
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed GTK / WinCairo build fix after Antoine's r276141.
Just add the BlendingContext constructor this time because there are too many build failures.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::CSSPropertyBlendingContext::client): Deleted.
* platform/animation/AnimationUtilities.h:
(WebCore::BlendingContext::BlendingContext):
* platform/graphics/nicosia/NicosiaAnimation.cpp:
(Nicosia::blendFunc):
(Nicosia::applyTransformAnimation):
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed attempt to fix GTK's build after Antoine's r276141.
* platform/graphics/nicosia/NicosiaAnimation.cpp:
(Nicosia::blendFunc):
(Nicosia::applyTransformAnimation):
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after Antoine's r276141.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
2021-04-16 Antoine Quint <graouts@webkit.org>
Refactor parameters to blending functions
https://bugs.webkit.org/show_bug.cgi?id=224433
Reviewed by Dean Jackson.
Reduce the number of parameters passed to the blending functions such that we package
the client and progress together and track whether the animation is discrete instead
of computing it several times. This information is now passed as a BlendingContext
parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation.
When we support composite operations, we'll just need to add a new member to that
struct instead of modifying all the method signatures.
Since we are modifying the method signatures, we also change the RenderStyle pointers
to references since we would never pass in a null value.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::blendFunc):
(WebCore::blendFilterOperations):
(WebCore::blendFilter):
(WebCore::crossfadeBlend):
(WebCore::AnimationPropertyWrapperBase::canInterpolate const):
(WebCore::PropertyWrapperGetter::value const):
(WebCore::canInterpolateCaretColor):
(WebCore::CSSPropertyAnimation::blendProperties):
(WebCore::CSSPropertyAnimation::propertiesEqual):
(WebCore::CSSPropertyAnimation::canPropertyBeInterpolated):
* animation/CSSPropertyAnimation.h:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
* css/CSSCrossfadeValue.cpp:
(WebCore::blendFunc):
(WebCore::CSSCrossfadeValue::blend const):
* css/CSSCrossfadeValue.h:
* css/CSSGradientValue.cpp:
(WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::CSSGradientValue::computeStops):
* platform/Length.cpp:
(WebCore::blendMixedTypes):
(WebCore::blend):
* platform/Length.h:
* platform/LengthPoint.h:
(WebCore::blend):
* platform/LengthSize.h:
(WebCore::blend):
* platform/animation/AnimationUtilities.h:
(WebCore::blend):
* platform/graphics/ColorBlending.cpp:
(WebCore::blend):
(WebCore::blendWithoutPremultiply):
* platform/graphics/ColorBlending.h:
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(WebCore::PlatformCAFilters::colorMatrixValueForFilter):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::blend):
(WebCore::BasicComponentTransferFilterOperation::blend):
(WebCore::InvertLightnessFilterOperation::blend):
(WebCore::BlurFilterOperation::blend):
(WebCore::DropShadowFilterOperation::blend):
* platform/graphics/filters/FilterOperation.h:
(WebCore::FilterOperation::blend):
* platform/graphics/transforms/IdentityTransformOperation.h:
* platform/graphics/transforms/Matrix3DTransformOperation.cpp:
(WebCore::createOperation):
(WebCore::Matrix3DTransformOperation::blend):
* platform/graphics/transforms/Matrix3DTransformOperation.h:
* platform/graphics/transforms/MatrixTransformOperation.cpp:
(WebCore::MatrixTransformOperation::blend):
* platform/graphics/transforms/MatrixTransformOperation.h:
* platform/graphics/transforms/PerspectiveTransformOperation.cpp:
(WebCore::PerspectiveTransformOperation::blend):
* platform/graphics/transforms/PerspectiveTransformOperation.h:
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):
* platform/graphics/transforms/RotateTransformOperation.h:
* platform/graphics/transforms/ScaleTransformOperation.cpp:
(WebCore::ScaleTransformOperation::blend):
* platform/graphics/transforms/ScaleTransformOperation.h:
* platform/graphics/transforms/SkewTransformOperation.cpp:
(WebCore::SkewTransformOperation::blend):
* platform/graphics/transforms/SkewTransformOperation.h:
* platform/graphics/transforms/TransformOperation.h:
* platform/graphics/transforms/TransformOperations.cpp:
(WebCore::TransformOperations::blendByMatchingOperations const):
(WebCore::TransformOperations::blendByUsingMatrixInterpolation const):
(WebCore::TransformOperations::blend const):
* platform/graphics/transforms/TransformOperations.h:
* platform/graphics/transforms/TranslateTransformOperation.cpp:
(WebCore::TranslateTransformOperation::blend):
* platform/graphics/transforms/TranslateTransformOperation.h:
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCircle::blend const):
(WebCore::BasicShapeEllipse::blend const):
(WebCore::BasicShapePolygon::blend const):
(WebCore::BasicShapePath::blend const):
(WebCore::BasicShapeInset::blend const):
* rendering/style/BasicShapes.h:
(WebCore::BasicShapeCenterCoordinate::blend const):
(WebCore::BasicShapeRadius::blend const):
* style/Styleable.cpp:
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
* svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::blend):
* svg/SVGPathBlender.cpp:
(WebCore::blendFloatPoint):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendArcToSegment):
2021-04-16 Antoine Quint <graouts@webkit.org>
Blend using calc() when necessary
https://bugs.webkit.org/show_bug.cgi?id=224670
Reviewed by Antti Koivisto.
We need to blend between lengths when their types are not the same. However, we would take
some shortcuts in the following cases and blend using just one value:
1. either the from or to value was a 0 value,
2. progress was 0 or 1.
Now we use the mixed types code path if the types are different or either the from or to
value is a calculated value. The single exception where we don't actually end up generating
a CalculationValue is when we know that one of the two values is 0 and not a percentage, in
which case we run a simple blend.
Due to this approach, we stopped returning the value as-is in some cases where progress was
0 or 1. To avoid regressions in this area, we made the LengthBoxPropertyWrapper clone the from
or to value in the discrete case, as some other areas of the code do not know how to deal with
calculated Length values, for instance valueForImageSliceSide(const Length&).
* animation/CSSPropertyAnimation.cpp:
* platform/Length.cpp:
(WebCore::blendMixedTypes):
(WebCore::blend):
* platform/LengthBox.h:
(WebCore::LengthBox::LengthBox):
* platform/RectEdges.h:
(WebCore::RectEdges::RectEdges):
2021-04-16 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not try to collapse anonymous blocks when cleaning up the first-letter subtree
https://bugs.webkit.org/show_bug.cgi?id=224667
<rdar://76616098>
Reviewed by Antti Koivisto.
We construct a dedicated renderer for the first letter content and in some cases wrap it into an anonymous block.
This subtree needs to be destroyed when the associated RenderText is getting deleted. During this cleanup process
we may find the wrapper anonymous block redundant and initiate a sibling block collapsing. However this collapsing
may interfere with the initial delete (the associated RenderText) and lead to unexpected result.
Let's reserve the anonymous collapsing for the initial remove.
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy):
2021-04-16 Zalan Bujtas <zalan@apple.com>
[IFC] Incorrect box height when scrollbar takes padding box space
https://bugs.webkit.org/show_bug.cgi?id=224546
<rdar://problem/76666402>
Reviewed by Antti Koivisto.
This patch fixes the case when a non-overlay scrollbar can't be accomodated in the padding/content box area (e.g <div style="height: 10px; overflow: scroll">...)
In the legacy render tree the non-overlay scrollbar size is already taken into account when calling RenderBox::contentWidth/Height (paddingBoxHeight/Width), so
we just have to check how much space they actully take (currently maximum of 15px).
Test: fast/inline-block/non-overlay-scrollbar-incorrect-padding.html
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
2021-04-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in ApplyStyleCommand
https://bugs.webkit.org/show_bug.cgi?id=224662
Reviewed by Antti Koivisto.
Deployed smart pointers in ApplyStyleCommand. Also deployed ScriptDisallowedScope around the code
which accesses the render tree in ApplyStyleCommand::applyInlineStyleToPushDown.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::dummySpanAncestorForNode):
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
(WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::highestEmbeddingAncestor):
(WebCore::ApplyStyleCommand::applyInlineStyle):
(WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
(WebCore::containsNonEditableRegion):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
(WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
(WebCore::ApplyStyleCommand::removeInlineStyle):
(WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
(WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
(WebCore::ApplyStyleCommand::joinChildTextNodes):
* editing/ApplyStyleCommand.h:
2021-04-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr/WeakPtr in EditCommand and CompositeEditCommand
https://bugs.webkit.org/show_bug.cgi?id=224659
Reviewed by Antti Koivisto.
Deployed Ref/RefPtr/WeakPtr across CompositeEditCommand and EditCommand.
Also wrapped sections of code that access render tree with ScriptDisallowedScope.
* editing/CompositeEditCommand.cpp:
(WebCore::postTextStateChangeNotification):
(WebCore::CompositeEditCommand::ensureComposition):
(WebCore::CompositeEditCommand::isRemovableBlock): Let a raw pointer to the parent node here
since the only thing we do is to call hasOneChild on it.
(WebCore::CompositeEditCommand::insertNodeBefore):
(WebCore::CompositeEditCommand::insertNodeAfter):
(WebCore::CompositeEditCommand::insertNodeAt):
(WebCore::CompositeEditCommand::removeChildrenInRange):
(WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
(WebCore::CompositeEditCommand::positionOutsideTabSpan):
(WebCore::CompositeEditCommand::textNodeForRebalance const): Renamed from canRebalance and
now returns the text node after downcasting so that rebalanceWhitespaceAt doesn't need to have
a lone downcast without a type check.
(WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
(WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
(WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
(WebCore::CompositeEditCommand::deleteInsignificantText):
(WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
(WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/CompositeEditCommand.h:
(WebCore::CompositeEditCommand): Now inherits from CanMakeWeakPtr.
(WebCore::toCompositeEditCommand): Deleted.
* editing/EditCommand.cpp:
(WebCore::EditCommand::EditCommand): Initialize m_startingSelection and m_endingSelection directly
since setStartingSelection and setEndingSelection now stores "this" pointer in RefPtr.
There is no behavior difference since m_parent and CompositeEditCommand::m_composition if applicable
are both nullptr at this point.
(WebCore::compositionIfPossible):
(WebCore::EditCommand::isEditingTextAreaOrTextInput const): Use enclosingTextFormControl instead
of duplicating the code here.
(WebCore::EditCommand::setStartingSelection):
(WebCore::EditCommand::setEndingSelection):
(WebCore::EditCommand::setParent):
(WebCore::EditCommand::postTextStateChangeNotification):
* editing/EditCommand.h:
(WebCore::EditCommand::parent const):
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply):
2021-04-16 Youenn Fablet <youenn@apple.com>
Remove a no longer necessary callOnMainThread in Worker::createRTCRtpScriptTransformer
https://bugs.webkit.org/show_bug.cgi?id=224539
Reviewed by Darin Adler.
* workers/Worker.cpp:
(WebCore::Worker::createRTCRtpScriptTransformer):
ThreadSafeRefCounted already handles it with the DestructionThread::Main option.
2021-04-15 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276107.
https://bugs.webkit.org/show_bug.cgi?id=224653
It broke non-Cocoa clean builds
Reverted changeset:
"[GPUP] WebContent process should not create AVOutputContext
instances when media in GPU Process is enabled"
https://bugs.webkit.org/show_bug.cgi?id=224469
https://trac.webkit.org/changeset/276107
2021-04-15 Lauro Moura <lmoura@igalia.com>
REGRESSION(r276039) [GTK] Build failures on Ubuntu 18.04
https://bugs.webkit.org/show_bug.cgi?id=224644
<rdar://problem/76742835>
Unreviewed build fix.
* bindings/js/JSDOMSetLike.cpp: Add missing Inlines header as
suggested by Mark.
2021-04-15 Don Olmstead <don.olmstead@sony.com>
Remove TilingData class
https://bugs.webkit.org/show_bug.cgi?id=224643
Reviewed by Yusuke Suzuki.
It doesn't seem to be used anywhere and the code hasn't been touched in almost a decade.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/TilingData.cpp: Removed.
* platform/graphics/gpu/TilingData.h: Removed.
2021-04-15 Don Olmstead <don.olmstead@sony.com>
[CMake] OpenGL libraries not linked when ANGLE isn't used
https://bugs.webkit.org/show_bug.cgi?id=224642
Reviewed by Fujii Hironori.
Move the block linking and including OpenGL libraries outside of the ANGLE related checks
to catch the case where OpenGL is needed but WebGL and ANGLE are disabled.
Also removes an include for the platform/gpu directory as that's only used for WebGPU.
* CMakeLists.txt:
2021-04-15 Sergio Villar Senin <svillar@igalia.com>
Assertion failure in SVGAnimationElement::currentValuesForValuesAnimation
https://bugs.webkit.org/show_bug.cgi?id=222715
Reviewed by Ryosuke Niwa.
Replaced ASSERT_WITH_SECURITY_IMPLICATION by ASSERT. It was added by mistake as part of
r157341 long time ago. There is no security implication because just after the assert
there would be a division by 0 followed by a crash.
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
2021-04-15 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469
Reviewed by Eric Carlson.
This patch modifies `MediaPlaybackTargetContext` to provide interfaces to serialize/deserialize
`AVOutputContext` and modifies `MediaPlaybackTargetCocoa` to use `MediaPlaybackTargetContext` to
manage its `AVOutputContext` instead of keeping a pointer to the `AVOutputContext` object.
With these changes, a WebContent process can forward a serialized `AVOutputContext` object
to other processes (e.g., the GPU process) without deserializing it. Therefore, the WebContent
process does not need access to the CoreMedia routing service. So we can remove the fix (r275669)
for bug 224328.
Covered by existing tests.
* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
* Modules/airplay/WebMediaSessionManager.h:
* Headers.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Modify the project file because `MediaPlaybackTargetContext` is used in Cocoa ports only.
* page/ChromeClient.h:
(WebCore::ChromeClient::setMockMediaPlaybackTargetPickerState):
* page/Page.cpp:
(WebCore::Page::setMockMediaPlaybackTargetPickerState):
* page/Page.h:
* platform/graphics/MediaPlaybackTarget.h:
(WebCore::MediaPlaybackTarget::hasActiveRoute const):
(WebCore::MediaPlaybackTarget::deviceName const):
(WebCore::MediaPlaybackTarget::supportsRemoteVideoPlayback):
(): Deleted.
* platform/graphics/MediaPlaybackTargetContext.h: Removed.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h:
(WebCore::MediaPlaybackTargetCocoa::outputContext const): Deleted.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
(WebCore::MediaPlaybackTargetCocoa::create):
(WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa):
(WebCore::toMediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::targetContext const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::deviceName const): Deleted.
Don't directly use `AVOutputContext` in this class.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
* platform/graphics/cocoa/MediaPlaybackTargetContext.h: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::type const):
(WebCore::MediaPlaybackTargetContext::mockState const):
(WebCore::MediaPlaybackTargetContext::outputContext const):
(WebCore::MediaPlaybackTargetContext::serializedOutputContext const):
(WebCore::MediaPlaybackTargetContext::encodingRequiresPlatformData const):
* platform/graphics/cocoa/MediaPlaybackTargetContext.mm: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::deviceName const):
(WebCore::MediaPlaybackTargetContext::hasActiveRoute const):
(WebCore::MediaPlaybackTargetContext::supportsRemoteVideoPlayback const):
(WebCore::MediaPlaybackTargetContext::serializeOutputContext):
(WebCore::MediaPlaybackTargetContext::deserializeOutputContext):
* platform/mock/MediaPlaybackTargetMock.cpp:
(WebCore::MediaPlaybackTargetMock::create):
(WebCore::MediaPlaybackTargetMock::MediaPlaybackTargetMock):
(WebCore::toMediaPlaybackTargetMock):
(WebCore::MediaPlaybackTargetMock::targetContext const): Deleted.
* platform/mock/MediaPlaybackTargetMock.h:
(WebCore::MediaPlaybackTargetMock::state const):
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable):
(WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::invalidatePlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::setState):
* platform/mock/MediaPlaybackTargetPickerMock.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMockMediaPlaybackTargetPickerState):
2021-04-15 Tim Horton <timothy_horton@apple.com>
Add a mechanism to dump the PlatformCALayer subtree of a GraphicsLayer, for testing
https://bugs.webkit.org/show_bug.cgi?id=224595
Reviewed by Simon Fraser.
Test: fast/harness/platform-layer-tree-as-text.html
Add internals.platformLayerTreeAsText(), which takes a (composited) Element
and returns the recursive PlatformCALayer tree under that element's backing
layer's primary layer.
This is intended to be used in a future patch in order to test a fix
that is only currently testable by observing the platform layer tree.
I've separated it from that patch in order to get the test rebaselining
out of the way in a behavior-neutral patch.
The motivation for a new method instead of a layerTreeAsText() flag
is this: if you make each GraphicsLayerCA dump its PlatformCALayers
(as a "show me the platform sublayers recursively" flag might do),
each GraphicsLayerCA also dumps its children's platform sublayers.
Thus the easiest way to get sane logging for testing is to target
the specific element you're interested in; thus, a new method.
* page/Frame.cpp:
(WebCore::Frame::layerTreeAsText const): Deleted.
* page/Frame.h:
Move layerTreeAsText to RenderLayerCompositor, where it probably belongs.
* page/Page.h: Fix a typo.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::platformLayerTreeAsText const):
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::purposeNameForInnerLayer const):
When dumping a PlatformCALayer, look up its purpose by checking which
layer member it is, instead of having it passed in. This way, we can
look it up even when we've reached this layer by crawling down the
PlatformCALayer tree.
(WebCore::GraphicsLayerCA::dumpInnerLayer const):
Clean up the PlatformCALayer dumping; make it multi-line and more
consistent with GraphicsLayer's dumping (a future patch will add more properties).
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
Use dumpInnerLayer when dumping PlatformCALayers from a GraphicsLayer dump,
but with a bit set to disable dumping children, to maintain the exising output
and avoid each layer also dumping its children's platform layers, as mentioned above.
(WebCore::GraphicsLayerCA::platformLayerTreeAsText const):
(WebCore::dumpInnerLayer): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
Add a getter for the set of sublayers of a PlatformCALayerCocoa that
themselves have PlatformCALayers (thus the -forLogging; I didn't want
anybody to accidentally think that this gets *all* of the sublayers).
(WebCore::PlatformCALayerCocoa::sublayersForLogging):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingForLayerTreeAsTextDump):
Consolidate all of the pre-layer-tree-dumping setup work, so it can
be shared between layerTreeAsText and platformLayerTreeAsText.
(WebCore::RenderLayerCompositor::layerTreeAsText):
(WebCore::RenderLayerCompositor::platformLayerTreeAsText):
* rendering/RenderLayerCompositor.h:
* testing/Internals.cpp:
(WebCore::Internals::layerTreeAsText const):
Adopt the RenderLayerCompositor version of layerTreeAsText.
Don't bother doing layout, RenderLayerCompositor does it.
(WebCore::toPlatformLayerTreeFlags):
(WebCore::Internals::platformLayerTreeAsText const):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-15 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Support the Translate menu item in editable selected text
https://bugs.webkit.org/show_bug.cgi?id=224625
<rdar://problem/76723022>
Reviewed by Tim Horton and Devin Rousso.
Adjust some logic in `ContextMenuController` to ensure that the "Translate" context menu item shows up for
selected text in both editable and non-editable fields. To do this, we pull code for appending the menu items
out into a separate lambda function, which we use in both cases. This also allows us to remove some duplicated
code between the editable and non-editable codepaths.
Test: fast/events/contextmenu-actions-in-selected-text.html
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Additionally, set `selectedText` and `selectionBounds` in both cases, as long as there is selected text.
2021-04-15 Ian Gilbert <iang@apple.com>
Null pointer dereference on MediaStreamAudioSourceNode destructor
https://bugs.webkit.org/show_bug.cgi?id=224573
Reviewed by Eric Carlson.
Add null pointer check in case the capture source no longer exists.
Test: webaudio/destroy-audio-source-node-with-no-track-crash.html
* platform/mediastream/mac/MediaStreamTrackAudioSourceProviderCocoa.cpp:
(WebCore::MediaStreamTrackAudioSourceProviderCocoa::hasNewClient):
2021-04-15 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::mergeEndIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=224587
Reviewed by Ryosuke Niwa.
Return early in mergeEndIfNeeded() if either of our VisiblePositions are null.
Test: editing/inserting/insert-horizontal-rule-with-style-crash.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::mergeEndIfNeeded):
2021-04-15 Manuel Rego Casasnovas <rego@igalia.com>
Move FocusRemovalEventsMode into FocusOptions
https://bugs.webkit.org/show_bug.cgi?id=224549
<rdar://problem/76695885>
Reviewed by Darin Adler.
Follow-up patch to use braces initializer for FocusOptions struct and simplify the code.
* dom/Document.cpp:
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
2021-04-15 Alex Christensen <achristensen@webkit.org>
Add deprecation macros
https://bugs.webkit.org/show_bug.cgi?id=224624
* platform/audio/mac/AudioHardwareListenerMac.cpp:
(WebCore::isAudioHardwareProcessRunning):
(WebCore::currentDeviceSupportedBufferSizes):
(WebCore::processIsRunningPropertyDescriptor):
(WebCore::outputDevicePropertyDescriptor):
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::defaultDevice):
(WebCore::defaultDeviceTransportIsBluetooth):
(WebCore::AudioSessionPrivate::addSampleRateObserverIfNeeded):
(WebCore::AudioSessionPrivate::addBufferSizeObserverIfNeeded):
(WebCore::AudioSession::sampleRate const):
(WebCore::AudioSession::bufferSize const):
(WebCore::AudioSession::maximumNumberOfOutputChannels const):
(WebCore::AudioSession::setPreferredBufferSize):
(WebCore::AudioSession::isMuted const):
(WebCore::AudioSession::addMutedStateObserver):
(WebCore::AudioSession::removeMutedStateObserver):
* platform/graphics/mac/GraphicsChecksMac.cpp:
(WebCore::attachToAppleGraphicsControl):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::getDeviceInfo):
(WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
(WebCore::CoreAudioCaptureDevice::relatedAudioDeviceIDs):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::deviceHasInputStreams):
(WebCore::deviceHasOutputStreams):
(WebCore::isValidCaptureDevice):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::computeAudioDeviceList):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::defaultOutputDevice):
2021-04-15 Don Olmstead <don.olmstead@sony.com>
ANGLE is only being built when WebGL is enabled
https://bugs.webkit.org/show_bug.cgi?id=224555
Reviewed by Fujii Hironori.
Remove any ENABLE(WEBGL) guards that reference functionality that isn't WebGL specific.
Modify the CMakeLists file to build with USE_ANGLE_EGL when ENABLE_WEBGL is OFF.
* CMakeLists.txt:
* platform/graphics/GLContext.h:
* platform/graphics/angle/ANGLEHeaders.h:
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::platformContext):
* platform/graphics/egl/GLContextEGL.h:
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::platformContext):
* platform/graphics/glx/GLContextGLX.h:
* platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
* platform/graphics/opengl/TemporaryOpenGLSetting.h:
2021-04-15 Mark Lam <mark.lam@apple.com>
Optimize the DeferTermination scope to be more efficient.
https://bugs.webkit.org/show_bug.cgi?id=224619
Reviewed by Saam Barati.
* workers/WorkerOrWorkletScriptController.cpp:
2021-04-15 Antoine Quint <graouts@webkit.org>
calc() should not contain 0 values other than percentages
https://bugs.webkit.org/show_bug.cgi?id=224611
Reviewed by Simon Fraser.
A calc() value containing a 0px value, such as calc(10% + 0px), was incorrectly serialized
as-is for the computed style, instead of the simplified form containing on the percentage.
For the correct behavior we need to make four changes in css/CSSCalculationValue.cpp:
1. in createCSS(const CalcExpressionNode&, const RenderStyle&), when dealing with a node
that is CalcExpressionNodeType::Length, we return nullptr in the case then node's Length
is a 0 value that's not a percentage,
2. additionally, in createCSS(const Vector<std::unique_ptr<CalcExpressionNode>>&, const RenderStyle&),
we no longer bail when a nullptr value is returned for a child and instead proceed with the
processing of further children, ensuring that a 0px value in, say, a Sum operation is removed
while retaining other non-zero values,
3. back in createCSS(const CalcExpressionNode&, const RenderStyle&), for CalcExpressionNodeType::Operation
nodes, when there is single parameter to a Sum operation we return that parameter rather than
a Sum operation, and do the same for a Negate operation, making sure we return negated node if
it is the second child,
4. finally, in CSSCalcOperationNode::buildCSSText(const CSSCalcExpressionNode&, StringBuilder&)
when we serialize a calculated value, we do not enclose the value in a `calc()` string if the
node is a CSSCalcPrimitiveValueNode.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::buildCSSText):
(WebCore::createCSS):
2021-04-15 Mark Lam <mark.lam@apple.com>
Refactor inline functions out of HashMapImpl.h into HashMapImplInlines.h.
https://bugs.webkit.org/show_bug.cgi?id=224616
rdar://76713709
Reviewed by Yusuke Suzuki.
* bindings/js/SerializedScriptValue.cpp:
2021-04-15 Alex Christensen <achristensen@webkit.org>
Use WTF::Function instead of std::function in SVGPropertyAnimatorFactory::attributeAnimatorCreator
https://bugs.webkit.org/show_bug.cgi?id=224586
Reviewed by Darin Adler.
sizeof(WTF::Function<void()>) is 8.
sizeof(std::function<void()>) is 48.
* svg/properties/SVGPropertyAnimatorFactory.h:
(WebCore::SVGPropertyAnimatorFactory::attributeAnimatorCreator):
2021-04-14 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Image extraction fails in Google search results
https://bugs.webkit.org/show_bug.cgi?id=224527
<rdar://problem/76500331>
Reviewed by Andy Estes.
Override the `-webkit-user-select` CSS property in Google search results pages, and make a slight adjustment to
the user agent stylesheet.
Test: fast/images/image-extraction/image-overlay-in-image-with-zero-font-size.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
* html/shadow/imageOverlay.css:
(div#image-overlay):
Additionally force a default value for the font size and font family of the image overlay text, so that a
cascading font size of 0 won't end up breaking logic for computing image overlay CSS transforms. See layout test
for more details.
* page/Quirks.cpp:
(WebCore::Quirks::needsToForceUserSelectWhenInstallingImageOverlay const):
* page/Quirks.h:
2021-04-15 Antti Koivisto <antti@apple.com>
Remove unused RunIterator::setAtEnd
https://bugs.webkit.org/show_bug.cgi?id=224597
Reviewed by Zalan Bujtas.
* layout/integration/LayoutIntegrationLineIteratorLegacyPath.h:
(WebCore::LayoutIntegration::LineIteratorLegacyPath::atEnd const):
(WebCore::LayoutIntegration::LineIteratorLegacyPath::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::atEnd const):
(WebCore::LayoutIntegration::LineIteratorModernPath::setAtEnd):
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationRunIterator.h:
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::atEnd const):
(WebCore::LayoutIntegration::RunIteratorLegacyPath::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::atEnd const):
(WebCore::LayoutIntegration::RunIteratorModernPath::setAtEnd):
2021-04-15 Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system
https://bugs.webkit.org/show_bug.cgi?id=202538
<rdar://problem/76047172>
Reviewed by Xabier Rodriguez-Calvar.
Enable the openh264 encoder if it is available, it would be preferred over existing
GStreamer H.264 encoders in such case.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.cpp:
(WebCore::supportedH264Formats):
* platform/mediastream/libwebrtc/GStreamerVideoCommon.h:
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
2021-04-15 Youenn Fablet <youenn@apple.com>
Make RTCEncodedVideoFrameMetadata.contributingSources undefined until properly supported
https://bugs.webkit.org/show_bug.cgi?id=224540
Reviewed by Eric Carlson.
We are not yet ready to expose contributing sources for video.
It seems better to have the corresponding field be undefined instead of an empty array.
Covered by updated test.
* Modules/mediastream/RTCEncodedVideoFrame.idl:
* Modules/mediastream/RTCRtpTransformableFrame.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.cpp:
(WebCore::LibWebRTCRtpTransformableFrame::videoMetadata const):
2021-04-15 Chris Lord <clord@igalia.com>
Make FontFace parsing worker-safe
https://bugs.webkit.org/show_bug.cgi?id=224426
Reviewed by Darin Adler.
Make CSS FontFace property parsing safe to do in a Worker. Instead of
constructing a rule per property and using the full CSSPropertyParser
path, instead factor out the specific, necessary property parsers into a
new CSSPropertyParserWorkerSafe and make sure they're safe to use in a
Worker (mainly by allowing for specifying the CSSValuePool so that
main-thread singletons don't get used).
No new tests, no change in behavior.
* Sources.txt: Add CSSPropertyParserWorkerSafe.cpp/.h
* WebCore.xcodeproj/project.pbxproj:
* css/FontFace.cpp: Call setters with the ScriptExecutionContext so
that we have access to ::cssValuePool() and use new worker-safe
parser functions.
(WebCore::FontFace::create):
(WebCore::FontFace::setFamily):
(WebCore::FontFace::setStyle):
(WebCore::FontFace::setWeight):
(WebCore::FontFace::setStretch):
(WebCore::FontFace::setUnicodeRange):
(WebCore::FontFace::setFeatureSettings):
(WebCore::FontFace::setDisplay):
* css/FontFace.h:
* css/FontFace.idl:
* css/parser/CSSParser.cpp: Move WorkerSafe parsing functions to
CSSPropertyParserWorkerSafe and remove now-unnecessary
parseFontFaceDescriptor.
* css/parser/CSSParser.h:
* css/parser/CSSPropertyParser.cpp: Move FontFace property parsers to
CSSPropertyParserWorkerSafe.
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):
(WebCore::CSSPropertyParser::consumeFont):
* css/parser/CSSPropertyParser.h:
* css/parser/CSSPropertyParserHelpers.cpp: Add WorkerSafe variants for
some of the basic consume helpers.
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeInteger):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumePercent):
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngle):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeFontRaw):
* css/parser/CSSPropertyParserHelpers.h:
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe):
* css/parser/CSSPropertyParserWorkerSafe.cpp: Added.
(WebCore::CSSPropertyParserWorkerSafe::parseFont):
(WebCore::CSSPropertyParserWorkerSafe::parseColor):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceSrc):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStyle):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceWeight):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStretch):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceUnicodeRange):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceFeatureSettings):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceDisplay):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyle):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsolute):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::fontStretchIsWithinRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretch):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceUnicodeRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFeatureTag):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFeatureSettings):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceFontDisplay):
* css/parser/CSSPropertyParserWorkerSafe.h: Added.
* dom/ScriptExecutionContext.cpp: Add ::cssValuePool().
(WebCore::ScriptExecutionContext::cssValuePool):
* dom/ScriptExecutionContext.h:
* html/canvas/CanvasRenderingContext2D.cpp: Update due to refactoring.
(WebCore::CanvasRenderingContext2D::setFontWithoutUpdatingStyle):
* html/canvas/CanvasStyle.cpp:
(WebCore::parseColor):
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::setFont):
* workers/WorkerGlobalScope.h:
2021-04-15 Manuel Rego Casasnovas <rego@igalia.com>
Move FocusRemovalEventsMode into FocusOptions
https://bugs.webkit.org/show_bug.cgi?id=224549
Reviewed by Darin Adler.
This patch is just a refactoring that moves FocusRemovalEventsMode enum into FocusOptions.
This allows us to simplify some method signatures, as they'll just receive a FocusOptions parameter, instead of two parameters for FocusRemovalEventsMode and FocusDirection.
There is no change of behavior, just a code refactoring.
* dom/Document.cpp:
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
(WebCore::Document::setFocusedElement):
* dom/Document.h:
(WebCore::Document::setFocusedElement):
* dom/Element.cpp:
(WebCore::Element::focus):
* dom/FocusOptions.h:
* page/FocusController.cpp:
(WebCore::FocusController::setFocusedElement):
* page/FocusController.h:
(WebCore::FocusController::setFocusedElement):
2021-04-09 Sergio Villar Senin <svillar@igalia.com>
Empty value is added in codePointsFromString in CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts
https://bugs.webkit.org/show_bug.cgi?id=223857
Reviewed by Darin Adler.
Use UnsignedWithZeroKeyHashTraits in codePointsFromString() to avoid it.
* css/CSSFontFaceSet.cpp:
(WebCore::codePointsFromString):
2021-04-15 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Cleanup the inline tree when moving subtrees
https://bugs.webkit.org/show_bug.cgi?id=224342
<rdar://76349279>
Reviewed by Antti Koivisto.
When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) should be invalidated. The safest way to do this is
to destroy the inline tree (the "subtree moving" will eventually be replaced by "destroy followed by construct" activity).
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::move):
2021-04-15 Youenn Fablet <youenn@apple.com>
Update RTCScriptTransform constructor up to spec
https://bugs.webkit.org/show_bug.cgi?id=224447
Reviewed by Eric Carlson.
Remove built-in support for message ports in RTCRtpScriptTransform/RTCRtpScriptTransformer.
Instead pass a transfer object to RTCRtpScriptTransform constructor used jointly with options to enable the same behavior.
This aligns with the change made in https://github.com/w3c/webrtc-encoded-transform/pull/96.
Covered by updated tests.
* Modules/mediastream/RTCRtpScriptTransform.cpp:
(WebCore::RTCRtpScriptTransform::create):
(WebCore::RTCRtpScriptTransform::RTCRtpScriptTransform):
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/RTCRtpScriptTransform.idl:
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::create):
(WebCore::RTCRtpScriptTransformer::RTCRtpScriptTransformer):
(WebCore::RTCRtpScriptTransformer::options):
* Modules/mediastream/RTCRtpScriptTransformer.h:
(WebCore::RTCRtpScriptTransformer::port): Deleted.
* Modules/mediastream/RTCRtpScriptTransformer.idl:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::createRTCRtpScriptTransformer):
* workers/DedicatedWorkerGlobalScope.h:
* workers/Worker.cpp:
(WebCore::Worker::createRTCRtpScriptTransformer):
* workers/Worker.h:
2021-04-15 Youenn Fablet <youenn@apple.com>
REGRESSION(Safari 14): iframe with blob url does not work with sandboxing
https://bugs.webkit.org/show_bug.cgi?id=222312
<rdar://problem/74927624>
Reviewed by Chris Dumez.
In https://trac.webkit.org/r275884, we correctly compute whether a blob is to be considered secure or not.
For that, we need to have the blob URL registered with its document origin.
Update PolicyChecker to properly register the temporoary blob URL with its document origin.
Test: http/tests/security/sandbox-iframe-and-blob.https.html
* loader/PolicyChecker.cpp:
(WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
2021-04-15 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r272900): Nullptr crash in ComposedTreeIterator::traverseNextInShadowTree() via ShadowRoot::hostChildElementDidChange
https://bugs.webkit.org/show_bug.cgi?id=222720
Reviewed by Ryosuke Niwa.
This patch reverts r274064 to apply a different fix. Instead of null-checking the nodes returned by
SlotAssignment::assignedNodesForSlot(), assigned nodes are removed from the list when they are about to be
removed from the parent. That ensures we never return nullptr nodes nor nodes with a nullptr parent from the
assigned nodes vector.
* dom/ComposedTreeIterator.cpp:
(WebCore::ComposedTreeIterator::traverseNextInShadowTree):
(WebCore::ComposedTreeIterator::advanceInSlot):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeBetween):
* dom/Node.h:
(WebCore::Node::hasShadowRootContainingSlots const):
(WebCore::Node::setHasShadowRootContainingSlots):
* dom/ShadowRoot.h:
* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::addSlotElementByName):
(WebCore::SlotAssignment::removeSlotElementByName):
(WebCore::SlotAssignment::willRemoveAssignedNode):
* dom/SlotAssignment.h:
(WebCore::ShadowRoot::willRemoveAssignedNode):
2021-04-15 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in ReplaceSelectionCommand
https://bugs.webkit.org/show_bug.cgi?id=224591
Reviewed by Jiewen Tan.
Deployed Ref/RefPtr in ReplaceSelectionCommand.cpp per guidelines we outlined in
https://lists.webkit.org/pipermail/webkit-dev/2020-September/031386.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::positionAvoidingPrecedingNodes):
(WebCore::ReplacementFragment::ReplacementFragment):
(WebCore::ReplacementFragment::removeUnrenderedNodes):
(WebCore::ReplacementFragment::removeInterchangeNodes):
(WebCore::ReplaceSelectionCommand::shouldMerge):
(WebCore::fragmentNeedsColorTransformed): Protected the code accessing the render tree
with ScriptDisallowedScope::InMainThread.
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
(WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
(WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
(WebCore::ReplaceSelectionCommand::positionAtEndOfInsertedContent const):
(WebCore::handleStyleSpansBeforeInsertion):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
(WebCore::enclosingInline):
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace const):
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
(WebCore::singleChildList):
(WebCore::deepestSingleChildList):
(WebCore::ReplaceSelectionCommand::insertAsListItems):
(WebCore::ReplaceSelectionCommand::performTrivialReplace):
2021-04-14 Antti Koivisto <antti@apple.com>
Preloaded async scripts should use the same priority as the normally loaded ones
https://bugs.webkit.org/show_bug.cgi?id=224537
Reviewed by Sam Weinig.
Use the same priority (medium instead of low) when preloading.
Factor default priorities to a separate type making it easier to keep them in sync.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::load):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
* html/parser/HTMLResourcePreloader.cpp:
(WebCore::PreloadRequest::resourceRequest):
* loader/DefaultResourceLoadPriority.cpp: Added.
(WebCore::DefaultResourceLoadPriority::forResourceType):
* loader/DefaultResourceLoadPriority.h: Added.
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::preloadIfNeeded):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
(WebCore::CachedResource::setLoadPriority):
(WebCore::CachedResource::defaultPriorityForResourceType): Deleted.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::identifierForLoadWithoutResourceLoader const):
2021-04-14 Tim Nguyen <ntim@apple.com>
Omit default position/angle when serializing radial & conic gradients
https://bugs.webkit.org/show_bug.cgi?id=223892
Reviewed by Antti Koivisto.
Test: LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub.html
* css/CSSGradientValue.cpp:
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::CSSLinearGradientValue::customCSSText const):
(WebCore::CSSRadialGradientValue::customCSSText const):
(WebCore::CSSConicGradientValue::customCSSText const):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::isCenterPosition const):
* css/CSSPrimitiveValue.h:
2021-04-14 Don Olmstead <don.olmstead@sony.com>
[Nicosia] NicosiaGCGLLayer is unneeded when ENABLE_WEBGL is OFF
https://bugs.webkit.org/show_bug.cgi?id=224557
Reviewed by Michael Catanzaro.
Add an ENABLE(WEBGL) guard around NicosiaGCGLLayer.
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h:
2021-04-14 Ryosuke Niwa <rniwa@webkit.org>
Avoid indirect load in ContainerNode::hasOneChild()
https://bugs.webkit.org/show_bug.cgi?id=224589
Reviewed by Chris Dumez.
Getting nextSibling() will involve loading the first child into the register.
Avoid that and just check m_firstChild and m_lastChild instead to avoid this extra memory load.
* dom/ContainerNode.h:
(WebCore::ContainerNode::hasOneChild const):
2021-04-14 Ryosuke Niwa <rniwa@webkit.org>
Crash in in ReplaceSelectionCommand::mergeEndIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=222941
Unreviewed. Address Darin's post-commit comment that we don't need to explicitly call copyRef here.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::mergeEndIfNeeded):
2021-04-14 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Make image extraction interactions work for elements inside links
https://bugs.webkit.org/show_bug.cgi?id=224576
<rdar://problem/76664721>
Reviewed by Devin Rousso.
Make a slight adjustment to `EventHandler::canMouseDownStartSelect` to allow selection to begin when handling a
mousedown over text inside an image overlay.
Test: fast/images/image-extraction/mac/select-image-overlay-in-link-with-mouse-drag.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::isImageOverlayText):
Add an overloaded version of this helper method that takes a pointer instead of a reference, and use it in
several places where we current check the nullity of a `Node*` before dereferencing it and passing it into
`isImageOverlayText()`.
* html/HTMLElement.h:
* page/DragController.cpp:
(WebCore::DragController::draggableElement const):
* page/EventHandler.cpp:
(WebCore::EventHandler::canMouseDownStartSelect):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::updateSelectionForMouseDrag):
Additionally, make it so that we only invalidate a click (i.e. prevent mouse release from dispatching a click
event) in `EventHandler::updateSelectionForMouseDrag` in the case where we're selecting text in an image
overlay, if the selection hasn't actually changed.
2021-04-14 Devin Rousso <drousso@apple.com>
[Apple Pay] add WKA hooks for `ApplePayModifier`
https://bugs.webkit.org/show_bug.cgi?id=224585
<rdar://problem/76669793>
Reviewed by Wenson Hsieh.
* Modules/applepay/paymentrequest/ApplePayModifier.h:
2021-04-14 Chris Dumez <cdumez@apple.com>
Flaky crash under AudioSummingJunction::removeOutput() on Debug bots
https://bugs.webkit.org/show_bug.cgi?id=224584
Reviewed by Eric Carlson.
Add DisableMallocRestrictionsForCurrentThreadScope to allow the heap allocation until I can investigate
if we can avoid it.
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::removeOutput):
2021-04-13 BJ Burg <bburg@apple.com>
Web Inspector: add setting to allow inspecting Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=224082
<rdar://75695002>
Reviewed by Devin Rousso.
Add a property to check if inspecting inspector is allowed,
and to enable/disable upon loading the frontend or toggling the setting.
* en.lproj/Localizable.strings:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::inspectInspector):
(WebCore::InspectorFrontendHost::allowsInspectingInspector):
(WebCore::InspectorFrontendHost::setAllowsInspectingInspector):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
2021-04-14 Sam Weinig <weinig@apple.com>
Use range-for loop in target contrast selection to simplify/improve code readability
https://bugs.webkit.org/show_bug.cgi?id=224512
Reviewed by Darin Adler.
Address some additional post landing feedback from Darin.
- Use range-for loop in target contrast selection.
- Use double to represent luminance, lightness and contrast everywhere.
This avoid unnecessary conversions to and from float.
- Rename Color::contrastRatio(Color, Color) to just contrastRatio(Color, Color)
and move it ColorLuminance.h/cpp with the other contrastRatio overloads.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add ColorLuminance.cpp
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::selectFirstColorThatMeetsOrExceedsTargetContrast):
Convert colorsToCompareAgainst to an r-value since vector is never used after
calling this.
(WebCore::CSSPropertyParserHelpers::selectFirstColorWithHighestContrast):
Convert colorsToCompareAgainst to an r-value since vector is never used after
calling this. Also, switch to a range-for loop to aid readability.
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
Move colorsToCompareAgainst to the select functions.
* platform/graphics/Color.h:
* platform/graphics/Color.cpp:
(WebCore::Color::lightness const):
(WebCore::Color::luminance const):
Use double to represent lightness and luminance.
(WebCore::Color::contrastRatio): Deleted.
Moved to ColorLuminance.h/cpp
* platform/graphics/ColorLuminance.cpp: Added.
(WebCore::contrastRatio):
* platform/graphics/ColorLuminance.h:
(WebCore::relativeLuminance):
(WebCore::contrastRatio):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::disabledTextColor const):
* rendering/TextPaintStyle.cpp:
(WebCore::textColorIsLegibleAgainstBackgroundColor):
Use double to represent luminance and constrast everywhere.
2021-04-14 Antti Koivisto <antti@apple.com>
RunIterator::traverseNext/PreviousOnLineIgnoringLineBreak should skip over WBRs
https://bugs.webkit.org/show_bug.cgi?id=224545
rdar://76101143
Reviewed by Zalan Bujtas.
Test: fast/editing/wbr-iterator-crash.html
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::traverseNextOnLineIgnoringLineBreak):
(WebCore::LayoutIntegration::RunIterator::traversePreviousOnLineIgnoringLineBreak):
Skip over (instead of bailing) runs with isLineBreak() set. It is true for <WBR> so there can be multiple on a line.
2021-04-14 Lauro Moura <lmoura@igalia.com>
REGRESSION(r275948) Wrap sh::ShaderVariable into UniqueRef to fit in HashMap
https://bugs.webkit.org/show_bug.cgi?id=224567
Unreviewed build fix.
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
(WebCore::ExtensionsGLOpenGLCommon::getTranslatedShaderSourceANGLE):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::precisionsMatch const):
(WebCore::GraphicsContextGLOpenGL::mappedSymbolInShaderSourceMap):
(WebCore::GraphicsContextGLOpenGL::originalSymbolInShaderSourceMap):
(WebCore::GraphicsContextGLOpenGL::mappedSymbolName):
(WebCore::GraphicsContextGLOpenGL::shaderSource):
2021-04-14 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds()
https://bugs.webkit.org/show_bug.cgi?id=224520
Reviewed by Ryosuke Niwa.
Adopt RefPtr<Node> instead of using plain Node* here to avoid a crash.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
2021-04-14 Devin Rousso <drousso@apple.com>
[iOS] limit how often `WebAVPlayerController` notifies the `PlaybackSessionModel` about changes to playback speed
https://bugs.webkit.org/show_bug.cgi?id=224515
<rdar://problem/75901463>
Reviewed by Eric Carlson.
This change will cause `HTMLMediaElement::setPlaybackRate` to not send IPC back and forth
between the WebProcess and UIProcess, as a modification to the `WebAVPlayerController` in
the UIProcess would notify its `PlaybackSessionModel` "delegate", which would in turn make
it's way back to the related `HTMLMediaElement::setPlaybackRate` in the WebProcess.
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController init]):
(-[WebAVPlayerController dealloc]):
(-[WebAVPlayerController defaultPlaybackRate]): Added.
(-[WebAVPlayerController setDefaultPlaybackRate:]): Added.
(-[WebAVPlayerController rate]): Added.
(-[WebAVPlayerController setRate:]): Added.
(-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
Instead of relying on ObjC KVO on `self` to handle changes to `defaultPlaybackRate` (and
`rate`), create an actual `setDefaultPlaybackRate:` so that we can handle cases where the
value is the same. Limit when we notify the `PlaybackSessionModel` to only when it has a
different value.
* platform/cocoa/PlaybackSessionModel.h:
* platform/cocoa/PlaybackSessionModelMediaElement.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::setPlaybackRate): Added.
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::setPlaybackRate): Added.
Add support for handling when the `rate` of the `AVPlayerController` changes too.
2021-04-14 Kate Cheney <katherine_cheney@apple.com>
Service worker soft-update loads not being marked app-bound
https://bugs.webkit.org/show_bug.cgi?id=223200
<rdar://problem/75438555>
Reviewed by Youenn Fablet.
We need to mark requests initiated by service worker soft updates as
app-bound based on the last navigation. We should get this value from the
NetworkResourceLoader and store it in SWServerRegistration so we can
use it to build a new request.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startScriptFetch):
* workers/service/server/SWServer.h:
Pass the entire SWServerRegistration to SWServer::startScriptFetch
now that we need more than one value from it. Move shouldRefreshCache
logic here instead of SWServerJobQueue::runUpdateJob.
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::runUpdateJob):
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scheduleSoftUpdate):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::isAppBound):
2021-04-14 Eric Carlson <eric.carlson@apple.com>
Allow text tracks to purge cues outside of the buffered range
https://bugs.webkit.org/show_bug.cgi?id=224489
Reviewed by Jer Noble.
TextTrackCues associated in-band tracks live "forever" - until the video element
is deleted or reloaded. This is fine for relatively short files, but not so good
for long lived files (eg. a very long live stream), or for timed metadata where
the "cue" size can be much larger than a text sample.
Allow text tracks to opt in to purging cues who's time range does not intersect
with the `buffered` range, where audio and video data is also not available. Only
AVFoundation backed in-band tracks opt in at this time, because AVFoundation will
redeliver cues if a time range is played again.
Tested manually as the only way to test this currently would be with an HLS stream
that would have to play too long for a layout test, or with an MSE text track but
we won't support text tracks in MSE yet.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerBufferedTimeRangesChanged): Allow tracks
that support purging cues to do so.
* html/HTMLMediaElement.h:
* html/track/InbandDataTextTrack.h: Return true for shouldPurgeCuesFromUnbufferedRanges();
* html/track/InbandGenericTextTrack.h: Ditto.
* html/track/TextTrack.cpp:
(WebCore::TextTrack::removeCuesNotInTimeRanges): Remove all cues who's time range
does not intersect with the buffered range.
* html/track/TextTrack.h:
(WebCore::TextTrack::shouldPurgeCuesFromUnbufferedRanges const):
2021-04-14 Antti Koivisto <antti@apple.com>
Remove unused InlineBox::next/previousLeafOnLineIgnoringLineBreak()
https://bugs.webkit.org/show_bug.cgi?id=224542
Reviewed by Zalan Bujtas.
* rendering/InlineBox.cpp:
(WebCore::InlineBox::nextLeafOnLineIgnoringLineBreak const): Deleted.
(WebCore::InlineBox::previousLeafOnLineIgnoringLineBreak const): Deleted.
* rendering/InlineBox.h:
2021-04-14 Frédéric Wang <fwang@igalia.com>
Crash in RenderBlock::addOverflowFromChildren
https://bugs.webkit.org/show_bug.cgi?id=223539
Reviewed by Ryosuke Niwa.
For an <svg> element that is a direct child of a <foreignObject>, a RenderSVGRoot is
generally created. However, a RenderSVGViewportContainer is currently created instead if
the element is inside a shadow tree. This is leading to bad state during the layout of
the foreign object, causing a debug assertion and a nullptr crash. This patch fixes this
issue by always treating direct <svg> child of <foreignObject> as an outermost SVG element.
Tests: svg/foreignObject/svg-child-of-foreign-object-in-shadow-tree-crash.html
svg/outermost-svg-root.html
* svg/SVGElement.cpp:
(WebCore::SVGElement::isOutermostSVGSVGElement const): Lower down the priority of the rule
"is in shadow tree".
2021-04-14 Zalan Bujtas <zalan@apple.com>
InlineBox should not hold a reference to RenderObject
https://bugs.webkit.org/show_bug.cgi?id=224506
Reviewed by Antti Koivisto.
The InlineBox/RenderObject relationship is somewhat error-prone (see RenderBox::setInlineBoxWrapper vs. InlineElementBox::extractLine) and it's rather easy to delete one without letting the other know.
* rendering/InlineBox.cpp:
(WebCore::InlineBox::showNodeTreeForThis const):
(WebCore::InlineBox::showLineTreeForThis const):
(WebCore::InlineBox::caretMinOffset const):
(WebCore::InlineBox::caretMaxOffset const):
(WebCore::InlineBox::adjustPosition):
(WebCore::InlineBox::selectionState):
(WebCore::InlineBox::canAccommodateEllipsis const):
(WebCore::InlineBox::locationIncludingFlipping const):
(WebCore::InlineBox::flipForWritingMode const):
* rendering/InlineBox.h:
(WebCore::InlineBox::renderer const):
(WebCore::InlineBox::boxModelObject const):
(WebCore::InlineBox::InlineBox):
2021-04-14 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Indeterminate progress bars should update at 60fps
https://bugs.webkit.org/show_bug.cgi?id=224372
<rdar://problem/76416848>
Reviewed by Wenson Hsieh.
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::animationTimerFired):
Added a FIXME to state that progress bar animation should be performed
as part of the rendering update lifecycle. Progress bars have always
maintained their own timers for animation, however, the update interval
may not always match the display's refresh rate.
* rendering/RenderThemeIOS.mm:
Ensure a smoother animation by increasing the frame rate to 60fps.
2021-04-14 Carlos Garcia Campos <cgarcia@igalia.com>
Do not reset computed style for element children with display contents style
https://bugs.webkit.org/show_bug.cgi?id=223794
Reviewed by Antti Koivisto.
We were checking hasDisplayContents() was false before calling resetComputedStyle() on the parent, but we don't
check it when iterating the children.
* dom/Element.cpp:
(WebCore::Element::resetComputedStyle):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveComposedTree):
2021-04-13 Rob Buis <rbuis@igalia.com>
Make SVGElement::getBoundingBox retrieve bbox from RenderObject
https://bugs.webkit.org/show_bug.cgi?id=224482
Reviewed by Zalan Bujtas.
Make SVGElement::getBoundingBox retrieve bbox from RenderObject.
Also make it const and return an Optional.
* dom/Element.cpp:
(WebCore::Element::boundsInRootViewSpace):
(WebCore::Element::absoluteEventBounds):
(WebCore::Element::boundingAbsoluteRectWithoutLayout):
* page/ResizeObservation.cpp:
(WebCore::ResizeObservation::computeObservedSize const):
* svg/SVGElement.cpp:
(WebCore::SVGElement::getBoundingBox const):
(WebCore::SVGElement::getBoundingBox): Deleted.
* svg/SVGElement.h:
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC should lock all multithreaded objects
https://bugs.webkit.org/show_bug.cgi?id=224230
Reviewed by Eric Carlson.
Lock following objects with TapStorage::lock:
AudioSourceProviderAVFObjC::m_tapStorage
AudioSourceProviderAVFObjC::m_avPlayerItem
Do not clear the tapStorage nor the _this pointer from
the audio thread. This is a race that cannot be overcome
since the main thread needs to access the m_tapStorage pointer to
lock the m_tapStorage pointer for modification.
Initialize m_tap in more robust way, in case initialization fails.
Do not leave stale m_tapStorage present when destroying the mixer.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC):
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::initCallback):
(WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
2021-04-13 Fujii Hironori <Hironori.Fujii@sony.com>
Table caption jumps to the bottom of the table after simplified table relayout
https://bugs.webkit.org/show_bug.cgi?id=187903
<rdar://problem/42506245>
Reviewed by Zalan Bujtas.
Test: fast/table/caption-simplified-layout.html
* rendering/RenderTable.cpp:
(WebCore::RenderTable::simplifiedNormalFlowLayout):
Do not call layoutCaptions().
2021-04-13 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 4: Move DisplayList::Iterator to its own .h/.cpp files
https://bugs.webkit.org/show_bug.cgi?id=224146
Reviewed by Wenson Hsieh.
This doesn't actually change any lines of code; it just moves code into different files.
This patch isn't strictly necessary, but I think it helps, because the iterator contains
a non-trivial amount of logic.
No new tests because there is no behavior change.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::begin const):
(WebCore::DisplayList::DisplayList::end const):
(WebCore::DisplayList::DisplayList::iterator::atEnd const): Deleted.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentDrawingItemExtent): Deleted.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem): Deleted.
(WebCore::DisplayList::DisplayList::iterator::advance): Deleted.
(WebCore::DisplayList::DisplayList::iterator::clearCurrentItem): Deleted.
(WebCore::DisplayList::DisplayList::iterator::moveToEnd): Deleted.
(WebCore::DisplayList::DisplayList::iterator::moveCursorToStartOfCurrentBuffer): Deleted.
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::iterator::iterator): Deleted.
(WebCore::DisplayList::DisplayList::iterator::~iterator): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator==): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator!=): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator++): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator* const): Deleted.
(WebCore::DisplayList::DisplayList::iterator::itemBuffer const): Deleted.
(WebCore::DisplayList::DisplayList::begin const): Deleted.
(WebCore::DisplayList::DisplayList::end const): Deleted.
* platform/graphics/displaylists/DisplayListIterator.cpp: Added.
(WebCore::DisplayList::DisplayList::Iterator::atEnd const):
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentDrawingItemExtent):
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
(WebCore::DisplayList::DisplayList::Iterator::advance):
(WebCore::DisplayList::DisplayList::Iterator::clearCurrentItem):
(WebCore::DisplayList::DisplayList::Iterator::moveToEnd):
(WebCore::DisplayList::DisplayList::Iterator::moveCursorToStartOfCurrentBuffer):
* platform/graphics/displaylists/DisplayListIterator.h: Added.
(WebCore::DisplayList::DisplayList::Iterator::Iterator):
(WebCore::DisplayList::DisplayList::Iterator::~Iterator):
(WebCore::DisplayList::DisplayList::Iterator::operator==):
(WebCore::DisplayList::DisplayList::Iterator::operator!=):
(WebCore::DisplayList::DisplayList::Iterator::operator++):
(WebCore::DisplayList::DisplayList::Iterator::operator* const):
(WebCore::DisplayList::DisplayList::Iterator::itemBuffer const):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
2021-04-13 Alex Christensen <achristensen@webkit.org>
Disable YouTube Flash and QuickTime plug in replacements on iOS
https://bugs.webkit.org/show_bug.cgi?id=224453
Reviewed by Chris Dumez.
* page/Settings.yaml:
2021-04-13 Ziran Sun <zsun@igalia.com>
[css-grid] Incorrect track sizing when using relative sized items in 'auto' column tracks
https://bugs.webkit.org/show_bug.cgi?id=191627
Reviewed by Javier Fernandez.
This is a reland of r274596. The original patch was reverted because Google logo is not visible
on google.com.
Containing block for a grid item is the grid area it's located in. During the GridTrackSizingAlgorithm,
we determine that this item has a relative size (percent in this case) and that the grid area is still
indefinite. Hence, we set nullopt for the grid area width and mark the item for layout. During the item's
layout, we call this RenderBox::containingBlockLogicalWidthForContent to determine the available height.
However, this method checks the containing block's width if the overridingContentLogicalWidth is nullopt,
which is incorrect for grid items. We should never use the grid container for resolving grid item's size.
This change is to return 0_lu for grid item when overridingContainingBlockContentLogicalWidth() returns
nullopt rather than use containing block's width. It also comments that there might be an issue with
RenderBox::containingBlockLogicalHeightForContent for grid item. It should return whatever value we get from
overridingContainingBlockContentLogicalHeight(), including WTF::nullopt.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::containingBlockLogicalWidthForContent const):
(WebCore::RenderBox::containingBlockLogicalHeightForContent const):
2021-04-13 Devin Rousso <drousso@apple.com>
[WebIDL] includes for `Conditional` dictionary members should also be guarded
https://bugs.webkit.org/show_bug.cgi?id=224501
<rdar://problem/76598492>
Reviewed by Tim Horton.
WebKitAdditions sometimes needs to conditionally include IDL files and in those cases the
generated `JS*.h` might not get created even though the wrapped C++ type does exist. In
these cases, we should also guard the `#include JS*.h` (in addition to the already guarded
usage of the wrapped C++ type in `convertDictionary`).
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/test/TestDictionary.idl: Added.
* bindings/scripts/test/JS/JSTestDictionary.h: Added.
* bindings/scripts/test/JS/JSTestDictionary.cpp: Added.
* bindings/scripts/test/TestDictionaryWithOnlyConditionalMembers.idl:
* bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.cpp:
* bindings/scripts/test/SupplementalDependencies.dep:
2021-04-13 Said Abou-Hallawa <said@apple.com>
[GPU Process] Make ImageBuffer calculate its memoryCost() from its size
https://bugs.webkit.org/show_bug.cgi?id=224306
Reviewed by Simon Fraser.
Instead of round-trip processes to get the backend memoryCost(), we can
calculate it from the size and the bytes alignment of each row in the
backend. These are static values so in the case of RemoteImageBufferProxy,
there is no need to ensure the backend is created in GPUP and it is mapped
in the Web Process.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateBackendSize):
(WebCore::ImageBufferBackend::calculateMemoryCost):
(WebCore::ImageBufferBackend::ImageBufferBackend):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::calculateExternalMemoryCost):
(WebCore::ImageBufferBackend::memoryCost const): Deleted.
(WebCore::ImageBufferBackend::externalMemoryCost const): Deleted.
(WebCore::ImageBufferBackend::bytesPerRow const): Deleted.
- This is the general case of the backend which is 4-bytes aligned rows.
- calculateSafeBackendSize() returns the size whose bytesPerRow does not
overflow unsigned and whose memoryCost does not not overflow size_t.
* platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateSafeBackendSize):
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateBytesPerRow):
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateMemoryCost):
(WebCore::ImageBufferCairoImageSurfaceBackend::create):
(WebCore::ImageBufferCairoImageSurfaceBackend::bytesPerRow const):
* platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.h:
cairo_format_stride_for_width() is used to calculate the bytesPerRow()
for Cairo port.
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::calculateBytesPerRow):
* platform/graphics/cg/ImageBufferCGBackend.h:
This is the CG case when the backend is 4-bytes aligned rows.
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::calculateSafeBackendSize):
(WebCore::ImageBufferCGBitmapBackend::calculateMemoryCost):
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::bytesPerRow const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
This is the CG bitmap case where the backend is 4-bytes aligned rows.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::calculateSafeBackendSize):
(WebCore::ImageBufferIOSurfaceBackend::calculateBytesPerRow):
(WebCore::ImageBufferIOSurfaceBackend::calculateMemoryCost):
(WebCore::ImageBufferIOSurfaceBackend::calculateExternalMemoryCost):
(WebCore::ImageBufferIOSurfaceBackend::create):
(WebCore::ImageBufferIOSurfaceBackend::context const):
(WebCore::ImageBufferIOSurfaceBackend::calculateBackendSize): Deleted.
(WebCore::ImageBufferIOSurfaceBackend::memoryCost const): Deleted.
(WebCore::ImageBufferIOSurfaceBackend::externalMemoryCost const): Deleted.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
IOSurfaceAlignProperty() is used to align the CG bytesPerRow to the proper
IOSurface alignment.
2021-04-13 Razvan Caliman <rcaliman@apple.com>
Web Inspector: Forced color scheme should reset on page refresh
https://bugs.webkit.org/show_bug.cgi?id=224485
<rdar://76227216>
Reviewed by BJ Burg.
Reset the forced color scheme on page reload to keep in sync with Web Inspector
behavior for other forced states, like pseudo-classes.
* page/Page.cpp:
(WebCore::Page::didCommitLoad):
2021-04-13 Alex Christensen <achristensen@webkit.org>
Remove SharedBuffer's equality operators with Ref<SharedBuffer>
https://bugs.webkit.org/show_bug.cgi?id=224464
Reviewed by Chris Dumez.
No change in behavior.
I'm doing this to make a Ref comparator for all Refs to remove another reason we use RefPtr instead of Ref, even when they're all non-null.
See bug 224412
* platform/SharedBuffer.h:
(WebCore::operator==): Deleted.
(WebCore::operator!=): Deleted.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs const):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC should check for m_client when dispatching setFormat
https://bugs.webkit.org/show_bug.cgi?id=224479
Reviewed by Eric Carlson.
Use a weak pointer to schedule the setFormat client callback.
If client is unset before any callback is run, cancel the
pending callbacks.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::prepare):
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC::setClient should check for m_avAssetTrack
https://bugs.webkit.org/show_bug.cgi?id=224478
Reviewed by Eric Carlson.
Check for m_avAssetTrack when setting the client.
This is done for consistency, it is unclear if this affects
real world content.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::setClient):
(WebCore::AudioSourceProviderAVFObjC::setPlayerItem):
(WebCore::AudioSourceProviderAVFObjC::setAudioTrack):
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
2021-04-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275889.
https://bugs.webkit.org/show_bug.cgi?id=224488
Unintentional commit
Reverted changeset:
https://trac.webkit.org/changeset/275889
2021-04-13 Sihui Liu <sihui_liu@apple.com>
Make WebIDBServer not block main thread during initialization
https://bugs.webkit.org/show_bug.cgi?id=224299
Reviewed by Geoffrey Garen.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
* Modules/indexeddb/server/IDBServer.h:
(WebCore::IDBServer::IDBServer::lock): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::abortActiveTransactions):
2021-04-13 Frédéric Wang <fwang@igalia.com>
ASSERTION FAILED: !m_needExceptionCheck in CloneSerializer::serialize with postMessage({g:42})
https://bugs.webkit.org/show_bug.cgi?id=223785
Reviewed by Yusuke Suzuki.
Test: js/dom/missing-exception-check-in-clone-serializer-serialize.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize): Use a local throw scope within this method and
handle potential exceptions.
(WebCore::CloneBase::shouldTerminate): Deleted.
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GTK][WPE] Avif decoder build broken
https://bugs.webkit.org/show_bug.cgi?id=224232
Reviewed by Carlos Garcia Campos.
libavif 0.9.0 introduces an API break. avifDecoderParse() no
longer takes the image data as input. Instead, an avifIO object
needs to be associated with an avifDecoder and the avifDecoder
calls the read() method of the avifIO object to read image data
incrementally.
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::parseHeader):
(WebCore::AVIFImageReader::decodeFrame):
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GStreamer] CaptureDevice monitoring is not implemented
https://bugs.webkit.org/show_bug.cgi?id=222889
Reviewed by Xabier Rodriguez-Calvar.
GStreamer capture device events are notified through a message bus associated to the the
GstDeviceMonitor, so we need to watch out for those messages and notify the
RealtimeSourceMediaCenter accordingly.
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerCaptureDeviceManager::~GStreamerCaptureDeviceManager):
(WebCore::GStreamerCaptureDeviceManager::captureDevices):
(WebCore::GStreamerCaptureDeviceManager::addDevice):
(WebCore::GStreamerCaptureDeviceManager::refreshCaptureDevices):
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:
2021-04-13 Frédéric Wang <fwang@igalia.com>
ASSERTION FAILED: !m_needExceptionCheck in RTCPeerConnection::CertificateParameters
https://bugs.webkit.org/show_bug.cgi?id=223788
Reviewed by Ryosuke Niwa.
Test: js/dom/missing-exception-check-in-convertNumbers.html
* bindings/js/JSDOMConvertNumbers.h:
(WebCore::Converter<IDLFloat>::convert): Handle potential exceptions thrown by toNumber.
(WebCore::Converter<IDLDouble>::convert): Ditto.
2021-04-13 Rob Buis <rbuis@igalia.com>
Skip style update
https://bugs.webkit.org/show_bug.cgi?id=223365
Reviewed by Ryosuke Niwa.
Skip style update for getting the SVG bounding box
since boundingClientRect already updated style.
* dom/Element.cpp:
(WebCore::Element::boundingAbsoluteRectWithoutLayout):
* svg/SVGElement.cpp:
(WebCore::SVGElement::getBoundingBox):
2021-04-13 Youenn Fablet <youenn@apple.com>
SFrameTransform should be able to take array buffer views as input
https://bugs.webkit.org/show_bug.cgi?id=224437
Reviewed by Eric Carlson.
Add support for processing ArrayBufferView.
We still output ArrayBuffer as output.
Test: webrtc/sframe-transform-buffer-source.html
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::transformFrame):
(WebCore::RTCRtpSFrameTransform::createStreams):
2021-04-12 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] CDC COVID Vaccine Tracker: Safari garbles data table
https://bugs.webkit.org/show_bug.cgi?id=222581
Reviewed by Zalan Bujtas.
With nested flexboxes in which the flex-basis is a percentage the current code that stretches the item forces a relayout
of the children because it thinks it has percentage height descendants. That happens because we call
computePercentageLogicalHeights() with a mock percentage length to check whether a size is definite and that call performs
the addPercentageHeightDescendants() call. We should avoid calling the latter in those cases as we're just trying to
figure out whether we can compute the flex-basis used value or not.
Adding a new parameter to the aforementioned method so that the percentage height descendants map could be left untouched
in those cases where we just want to test size definiteness.
Apart from making the implementation more correct this brings some performance improvements for the cases described in the
first paragraph as it can be seen in the provided performance test (24.5% of improvement).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight const):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis const):
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite const):
(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution):
* rendering/RenderFlexibleBox.h:
2021-04-13 Ryosuke Niwa <rniwa@webkit.org>
Use WTF::compactMap in HTMLSlotElement
https://bugs.webkit.org/show_bug.cgi?id=224470
Reviewed by Antti Koivisto.
Cleaned up the code in assignedNodes and assignedElements with WTF::compactMap.
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::assignedNodes const):
(WebCore::HTMLSlotElement::assignedElements const):
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GStreamer] CaptureDevice monitor used from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=222888
Reviewed by Youenn Fablet .
Move the device observer infrastructure from the WebKit UserMediaProcessManager to the
RealtimeMediaSourceCenter.
* platform/mediastream/CaptureDevice.h:
(WebCore::haveDevicesChanged):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
(WebCore::RealtimeMediaSourceCenter::Observer::~Observer):
(WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver):
(WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver):
(WebCore::RealtimeMediaSourceCenter::captureDevicesChanged):
(WebCore::RealtimeMediaSourceCenter::triggerDevicesChangedObservers):
(WebCore::RealtimeMediaSourceCenter::setDevicesChangedObserver): Deleted.
* platform/mediastream/RealtimeMediaSourceCenter.h:
(WebCore::RealtimeMediaSourceCenter::Observer::devicesChanged):
2021-04-13 Antoine Quint <graouts@webkit.org>
calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376
Reviewed by Simon Fraser.
An expression such as calc(0.5 * (100% + 100px)) should be simplified to calc(50% + 50px). We produce
these types of expressions when blending between a percentage and a dimension, and they can also be
specified explicitly in style.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::combineChildren):
2021-04-13 Said Abou-Hallawa <said@apple.com>
SVG paced value animations overwrite user-provided keyTimes
https://bugs.webkit.org/show_bug.cgi?id=109010
Reviewed by Ryosuke Niwa.
If the calcMode is Paced, the 'keyTimes' attribute is ignored. Distances
between the 'values' are used produce an even pace of change across the
animation.
When changing calcMode, times defined in the 'keyTimes' attribute should
be used instead. To fix this, SVGAnimationElement can maintain two lists
for keyTimes: (1) keyTimesFromAttribute (2) keyTimesForPaced.
One of these lists will be picked by a new function 'keyTimes()' based
on the current calcMode.
Specs: https://www.w3.org/TR/SVG11/animate.html#CalcModeAttribute
Test: svg/animations/animate-calcMode-paced-overwrite-key-times.html
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::parseAttribute):
(WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced):
(WebCore::SVGAnimationElement::keyTimes const):
(WebCore::SVGAnimationElement::calculateKeyTimesIndex const):
(WebCore::SVGAnimationElement::calculatePercentFromKeyPoints const):
(WebCore::SVGAnimationElement::calculatePercentForFromTo const):
(WebCore::SVGAnimationElement::currentValuesFromKeyPoints const):
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
(WebCore::SVGAnimationElement::startedActiveInterval):
(WebCore::SVGAnimationElement::updateAnimation):
* svg/SVGAnimationElement.h:
2021-04-12 Ryosuke Niwa <rniwa@webkit.org>
TextManipulationController should use weak pointers to Node
https://bugs.webkit.org/show_bug.cgi?id=215913
Reviewed by Wenson Hsieh.
Use WeakHashSet for m_manipulatedTextsWithNewContent, m_textNodesWithNewRenderer, and m_manipulatedNodes.
Also made TextManipulationController::removeNode take Node& instead of Node*.
* dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::Node::moveNodeToNewDocument):
* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::observeParagraphs):
(WebCore::TextManipulationController::didCreateRendererForElement):
(WebCore::TextManipulationController::didUpdateContentForText):
(WebCore::TextManipulationController::didCreateRendererForTextNode):
(WebCore::TextManipulationController::scheduleObservationUpdate):
(WebCore::TextManipulationController::replace):
(WebCore::TextManipulationController::removeNode):
* editing/TextManipulationController.h:
2021-04-12 Don Olmstead <don.olmstead@sony.com>
Remove GraphicsContextGLOpenGLPrivate
https://bugs.webkit.org/show_bug.cgi?id=224446
Reviewed by Myles C. Maxfield.
GraphicsContextGLOpenGLPrivate is dead code. It requires AppleWin to turn on WebGL which
it does not. This removes all references to it.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::create): Deleted.
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): Deleted.
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): Deleted.
(WebCore::GraphicsContextGLOpenGL::setContextLostCallback): Deleted.
(WebCore::GraphicsContextGLOpenGL::setErrorMessageCallback): Deleted.
(WebCore::GraphicsContextGLOpenGL::makeContextCurrent): Deleted.
(WebCore::GraphicsContextGLOpenGL::checkGPUStatus): Deleted.
(WebCore::GraphicsContextGLOpenGL::isGLES2Compliant const): Deleted.
(WebCore::GraphicsContextGLOpenGL::platformLayer const): Deleted.
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp: Removed.
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h: Removed.
2021-04-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275793.
https://bugs.webkit.org/show_bug.cgi?id=224466
Caused crashes on <http://facebook.com|facebook.com>
Reverted changeset:
"calc() simplification for a multiplication should apply the
multiplication to each value of an addition"
https://bugs.webkit.org/show_bug.cgi?id=224376
https://trac.webkit.org/changeset/275793
2021-04-12 Zalan Bujtas <zalan@apple.com>
Unreviewed, reverting r275761.
Caused InlineBox invalidation bugs.
Reverted changeset:
"[RenderTreeBuilder] Cleanup the inline box wrappers when
moving subtrees"
https://bugs.webkit.org/show_bug.cgi?id=224342
https://commits.webkit.org/r275761
2021-04-12 BJ Burg <bburg@apple.com>
Modernize uses of ConsoleClient
https://bugs.webkit.org/show_bug.cgi?id=224398
Reviewed by David Kilzer.
ConsoleClient acts like a delegate, so its callers
should be using weak references to it.
* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::initScriptForWindowProxy):
* bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::setDOMWindow):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::initScriptWithSubclass):
2021-04-12 Chris Dumez <cdumez@apple.com>
webaudio/AudioListener/audiolistener-set-position.html is leaking PannerNodes
https://bugs.webkit.org/show_bug.cgi?id=224399
Reviewed by Geoffrey Garen.
The test was leaking all its nodes and contexts due to several logic issues in our code.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-can-only-render-once.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering-with-nodes.html
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
(WebCore::AudioScheduledSourceNode::virtualHasPendingActivity const):
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/AudioScheduledSourceNode.h:
1. Stop using an ActiveDOMObject::PendingActivity to keep our wrapper alive as this was causing
a reference cycle. PendingActivity keeps a ref to |this| and this is ref'ing the PendingActivity.
2 things could break the cycle:
- finish() gets called but the audio context may go away without finish getting called.
- didBecomeMarkedForDeletion() gets called. However, it was getting called from
AudioNode::markNodeForDeletionIfNecessary(). This function would early return if m_normalRefCount
is not 0. Here m_normalRefCount could NOT be 0, since PendingActity was ref'ing the Node.
2. Instead of a PendingActivity, we now override ActiveDOMObject::virtualHasPendingActivity() to keep
the wrapper alive. The behavior is the same since its return true when the state is not finished
and the node has not been marked for deletion. However, I added a condition to make sure it starts
returning false as soon as the context is closed. There is also no need to keep the JS wrapper alive
if there is no 'ended' event listener.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::lazyInitialize):
Early return if lazyInitialize() gets called for an audiocontext is closed. Nothing prevents JS from
creating an AudioNode after the AudioContext is closed. Constructing an AudioNode ends up lazy
initializing the audio context. In such case, we would already early return in release because if the
m_isAudioThreadFinished check. However, we would crash in debug because of the m_isAudioThreadFinished
ASSERT().
* Modules/webaudio/BaseAudioContext.h:
Make clear() member function protected so it can get called by OfflineAudioContext when rendering is
complete.
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::uninitialize):
Stop rejecting the suspend promises when the OfflineAudioContext gets uninitialized. Previously this
would only happen on navigation so we did not notice the issue. However, the OfflineAudioContext now
gets uninitialized as soon as it is done rendering and rejecting those promises in this case would
start causing test failures.
(WebCore::OfflineAudioContext::didFinishOfflineRendering):
- Stop clearing the m_didStartOfflineRendering flag when rendering is finished. This flag is called
[[rendering started]] in the WebAudio specification [1]. As per the specification, it gets set to true
in startRendering() and never gets reset to false. This means that an offline audio context cannot
start rendering again once it is done rendering. I have added a layout test for this behavior change
and verified that this test is passing is both Firefox and Chrome.
[1] https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-startrendering
- Call uninitialize() and clear() when rendering has finished to clear as much memory as possible as
soon as we can. This is acceptable because it is no longer possible to start rendering again once
it's finished. Previously, uninitialize() / clear() would only happen when navigating away and when
the document would get destroyed.
2021-04-12 Chris Dumez <cdumez@apple.com>
OfflineAudioContext with nodes that completed rendering do not get freed until navigating away
https://bugs.webkit.org/show_bug.cgi?id=224439
Reviewed by Geoffrey Garen.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-can-only-render-once.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering-with-nodes.html
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::finishedRendering):
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::didFinishOfflineRendering):
2021-04-12 Ada Chan <ada.chan@apple.com>
Initial implementation of WebChromeClient::enumerateImmersiveXRDevices() and XRDeviceProxy
https://bugs.webkit.org/show_bug.cgi?id=224353
Reviewed by Dean Jackson.
Remove PlatformXRDeviceCocoa as WebKit::XRDeviceProxy will be implementing PlatformXR::Device.
Implement the encode/decode methods to enable PlatformXR::Device::FrameData to
be sent over IPC.
* platform/xr/PlatformXR.h:
(PlatformXR::Device::trackingAndRenderingClient const):
(PlatformXR::Device::FrameData::FloatQuaternion::encode const):
(PlatformXR::Device::FrameData::FloatQuaternion::decode):
(PlatformXR::Device::FrameData::Pose::encode const):
(PlatformXR::Device::FrameData::Pose::decode):
(PlatformXR::Device::FrameData::Fov::encode const):
(PlatformXR::Device::FrameData::Fov::decode):
(PlatformXR::Device::FrameData::View::encode const):
(PlatformXR::Device::FrameData::View::decode):
(PlatformXR::Device::FrameData::StageParameters::encode const):
(PlatformXR::Device::FrameData::StageParameters::decode):
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
(PlatformXR::Device::FrameData::encode const):
(PlatformXR::Device::FrameData::decode):
* platform/xr/cocoa/PlatformXRCocoa.h:
(): Deleted.
2021-04-12 Antoine Quint <graouts@webkit.org>
border-image-width computed values should be a calc() value if it contains a percentage
https://bugs.webkit.org/show_bug.cgi?id=224420
Reviewed by Simon Fraser.
When handling calc() values containing a percentage, we must retain the calc() form when creating
the computed style for border-image-width.
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):
2021-04-12 Youenn Fablet <youenn@apple.com>
Add support for RTCEncodedFrame metadata
https://bugs.webkit.org/show_bug.cgi?id=224430
Reviewed by Eric Carlson.
Expose metadata given from backend.
Audio sender side uses a regular TransformableFrameInterface instead of a TransformableAudioFrameInterface.
Make sure to not call GetHeader() in that case.
Test: http/wpt/webrtc/metadata-transform.html
* Modules/mediastream/RTCEncodedAudioFrame.cpp:
(WebCore::RTCEncodedAudioFrame::timestamp const):
(WebCore::RTCEncodedAudioFrame::getMetadata):
* Modules/mediastream/RTCEncodedAudioFrame.h:
* Modules/mediastream/RTCEncodedAudioFrame.idl:
* Modules/mediastream/RTCEncodedVideoFrame.cpp:
(WebCore::RTCEncodedVideoFrame::timestamp const):
(WebCore::RTCEncodedVideoFrame::getMetadata):
* Modules/mediastream/RTCEncodedVideoFrame.h:
* Modules/mediastream/RTCEncodedVideoFrame.idl:
* Modules/mediastream/RTCRtpTransformableFrame.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp:
(WebCore::LibWebRTCRtpTransformBackend::Transform):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.cpp:
(WebCore::LibWebRTCRtpTransformableFrame::LibWebRTCRtpTransformableFrame):
(WebCore::LibWebRTCRtpTransformableFrame::timestamp const):
(WebCore::LibWebRTCRtpTransformableFrame::audioMetadata const):
(WebCore::LibWebRTCRtpTransformableFrame::videoMetadata const):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.h:
2021-04-12 Sam Weinig <weinig@apple.com>
Remove unused 'DefaultDefineOwnProperty' extended attribute support
https://bugs.webkit.org/show_bug.cgi?id=224436
Reviewed by Antti Koivisto.
The old CSSStyleDeclaration named-getter based implementation was
the last user so this can now be removed.
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceOverridesDefineOwnProperty):
* bindings/scripts/IDLAttributes.json:
2021-04-12 Philippe Normand <pnormand@igalia.com>
[GStreamer][WebRTC] An audio track should be muted when capture is interrupted by the OS.
https://bugs.webkit.org/show_bug.cgi?id=196606
Reviewed by Xabier Rodriguez-Calvar.
Add basic interruption support in the audio capture source and mock audio capture source.
* platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
(WebCore::GStreamerAudioCaptureSource::interrupted const):
(WebCore::GStreamerAudioCaptureSource::setInterruptedForTesting):
* platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerCapturer.cpp:
(WebCore::GStreamerCapturer::setupPipeline):
(WebCore::GStreamerCapturer::interrupted const):
(WebCore::GStreamerCapturer::setInterrupted):
* platform/mediastream/gstreamer/GStreamerCapturer.h:
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp:
(WebCore::MockRealtimeAudioSourceGStreamer::setInterruptedForTesting):
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h:
2021-04-12 Sam Weinig <weinig@apple.com>
Update color-contrast() to support a target contrast ratio
https://bugs.webkit.org/show_bug.cgi?id=224411
Reviewed by Antti Koivisto.
Updated fast/css/parsing-color-contrast.html with new test cases.
* css/CSSValueKeywords.in:
Add new keywords, AA and AA-large which are constants for contrast ratios of 4.5
and 3.0 respectively.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
Remove now incorrect comment about adding support for fallback as fallback
has been removed from the spec.
(WebCore::CSSPropertyParserHelpers::selectFirstColorThatMeetsOrExceedsTargetContrast):
(WebCore::CSSPropertyParserHelpers::selectFirstColorWithHighestContrast):
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
Add support for the new optional target contrast ratio in color-contrast() that was
recently added to CSS Color 5.
2021-04-12 Antti Koivisto <antti@apple.com>
Descendant style relations are sometimes reset when they shouldn't
https://bugs.webkit.org/show_bug.cgi?id=224431
rdar://76267783
Reviewed by Sam Weinig.
Some style relations computed during resolution of descendants are set on a parent element.
The parent element shouldn't reset them unless we are actually also computing the descendants.
Test: fast/css/first-letter-style-relation-crash.html
* dom/Element.cpp:
(WebCore::Element::resetStyleRelations):
(WebCore::Element::resetChildStyleRelations):
(WebCore::Element::resetAllDescendantStyleRelations):
Split resetStyleRelations into separate parts.
* dom/Element.h:
(WebCore::Element::styleAffectedByEmpty const):
(WebCore::Element::childrenAffectedByForwardPositionalRules const):
(WebCore::Element::descendantsAffectedByForwardPositionalRules const):
(WebCore::Element::childrenAffectedByBackwardPositionalRules const):
(WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
(WebCore::Element::childrenAffectedByPropertyBasedBackwardPositionalRules const):
(WebCore::Element::setStyleAffectedByEmpty):
(WebCore::Element::setChildrenAffectedByForwardPositionalRules):
(WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
(WebCore::Element::setChildrenAffectedByBackwardPositionalRules):
(WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
(WebCore::Element::setChildrenAffectedByPropertyBasedBackwardPositionalRules):
* dom/ElementRareData.h:
(WebCore::ElementRareData::resetStyleRelations): Deleted.
* dom/Node.h:
(WebCore::Node::StyleBitfields::clearFlags):
(WebCore::Node::clearStyleFlags):
(WebCore::Node::StyleBitfields::dynamicStyleRelations const): Deleted.
(WebCore::Node::StyleBitfields::setDynamicStyleRelation): Deleted.
(WebCore::Node::StyleBitfields::clearDynamicStyleRelations): Deleted.
(WebCore::Node::hasDynamicStyleRelationFlag const): Deleted.
(WebCore::Node::setDynamicStyleRelationFlag): Deleted.
Remove the meaningless DynamicStyleRelation concept and merge these flags with the others.
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolveComposedTree):
Only clear the descendant or child style relation bits if we are actually re-resolving
descendants or children.
2021-04-12 Rob Buis <rbuis@igalia.com>
Clamp overridingContentLogicalWidth/Height to zero
https://bugs.webkit.org/show_bug.cgi?id=224310
Reviewed by Sergio Villar Senin.
Clamp overridingContentLogicalWidth/Height to zero.
Test: fast/css-grid-layout/negative-overriding-content-logical-height-crash.html
* rendering/RenderBox.h:
(WebCore::RenderBox::overridingContentLogicalWidth const):
(WebCore::RenderBox::overridingContentLogicalHeight const):
2021-04-12 Philippe Normand <pnormand@igalia.com>
[MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none
https://bugs.webkit.org/show_bug.cgi?id=224260
Reviewed by Xabier Rodriguez-Calvar.
Disable delayed loading for the GStreamer MSE player, we want the MSE source element to be
configured ASAP, otherwise the playback pipeline will fail in various ways (duration
notifications sent too early, crashes in addSourceBuffer, crashes in attachTracks, and so
on).
Test: media/media-source/media-source-no-preload-set-duration-crash.html
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
2021-04-12 Youenn Fablet <youenn@apple.com>
Make sure all frames get transformed when overriding a transform with another one
https://bugs.webkit.org/show_bug.cgi?id=224367
Reviewed by Eric Carlson.
We were previously removing the old transform, then attaching the new transforn.
There was a time where no transform was attached and a few samples could get missed.
To prevent this, we add a new code path where we transfer a backend from one transform to another.
In that case, we synchronoulsy change the input callback from the old one to the new one instead of setting it to null in between.
Test: http/wpt/webrtc/change-encoded-transform.html
* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::setTransform):
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpReceiverBackend.h:
* Modules/mediastream/RTCRtpScriptTransform.cpp:
(WebCore::RTCRtpScriptTransform::~RTCRtpScriptTransform):
(WebCore::RTCRtpScriptTransform::willClearBackend):
(WebCore::RTCRtpScriptTransform::clear):
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::clear):
* Modules/mediastream/RTCRtpScriptTransformer.h:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::setTransform):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/RTCRtpTransform.cpp:
(WebCore::RTCRtpTransform::from):
(WebCore::RTCRtpTransform::attachToReceiver):
(WebCore::RTCRtpTransform::attachToSender):
(WebCore::RTCRtpTransform::backendTransferedToNewTransform):
* Modules/mediastream/RTCRtpTransform.h:
(WebCore::RTCRtpTransform::takeBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::LibWebRTCRtpReceiverBackend::rtcRtpTransformBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::LibWebRTCRtpSenderBackend):
(WebCore::LibWebRTCRtpSenderBackend::rtcRtpTransformBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2021-04-12 Frédéric Wang <fwang@igalia.com>
Out of memory crash with find('a'.repeat(2**30))
https://bugs.webkit.org/show_bug.cgi?id=223787
Reviewed by Ryosuke Niwa.
SearchBuffer::SearchBuffer allocates a buffer whose capacity is at least 8 times the size of
the searched text and at least 8192. It's possible to hit an out-of-memory crash by passing
a very long string to window.find. Since there is no reason to search for arbitrary large
text, limit it to a maximum length of 64kB.
Test: editing/find/find-long-string-crash.html
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find const): Exit early if the string length is larger than a limit.
2021-04-12 Chris Lord <clord@igalia.com>
Refactor font loading to make it possible for Worker to implement it
https://bugs.webkit.org/show_bug.cgi?id=224277
Reviewed by Darin Adler.
Introduce FontLoadRequest and FontLoadRequestClient as an abstraction
separate from CachedFont and CachedFontClient to allow for separate
implementations. Also move Document-specific font-loading behaviour
from CSSFontSelector into Document and add non-Document specific
accessors to ScriptExecutionContext.
These changes should allow for custom font loading to be implementable
on a Worker, which will be necessary for FontFace support in
OffscreenCanvas.
No new tests, no change in behavior.
* Headers.cmake: Added FontLoadRequest.h, CachedFontLoadRequest.h
and DocumentFontLoader.h.
* Sources.txt: Added DocumentFontLoader.cpp.
* WebCore.xcodeproj/project.pbxproj: Added files listed above.
* css/CSSFontFace.cpp: Update to not require Document for custom font loading.
(WebCore::CSSFontFace::appendSources):
* css/CSSFontFaceSource.cpp: Update to use FontLoadRequest instead of CachedFont.
(WebCore::CSSFontFaceSource::CSSFontFaceSource):
(WebCore::CSSFontFaceSource::~CSSFontFaceSource):
(WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
(WebCore::CSSFontFaceSource::fontLoaded):
(WebCore::CSSFontFaceSource::load):
(WebCore::CSSFontFaceSource::font):
(WebCore::CSSFontFaceSource::isSVGFontFaceSource const):
* css/CSSFontFaceSource.h:
* css/CSSFontFaceSrcValue.cpp: Update to use FontLoadRequest and
ScriptExecutionContext instead of CachedResourceLoader.
(WebCore::CSSFontFaceSrcValue::fontLoadRequest):
* css/CSSFontFaceSrcValue.h:
* css/CSSFontSelector.cpp: Remove Document-specific code.
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::CSSFontSelector::~CSSFontSelector):
(WebCore::CSSFontSelector::clearFonts):
* css/CSSFontSelector.h:
* dom/Document.cpp: Implement ScriptExecutionContext::fontLoadRequest
and ::beginLoadingFontSoon.
(WebCore::Document::~Document):
(WebCore::Document::removedLastRef):
(WebCore::Document::resolveStyle):
(WebCore::Document::suspendFontLoading):
(WebCore::Document::fontLoadRequest):
(WebCore::Document::beginLoadingFontSoon):
(WebCore::Document::suspend):
(WebCore::Document::resume):
* dom/Document.h:
* dom/DocumentFontLoader.cpp: Added. New class to handle Document-specific
font-loading code that was previously in CSSFontSelector and
CSSFontFaceSrcValue.
(WebCore::DocumentFontLoader::DocumentFontLoader):
(WebCore::DocumentFontLoader::~DocumentFontLoader):
(WebCore::DocumentFontLoader::cachedFont):
(WebCore::DocumentFontLoader::beginLoadingFontSoon):
(WebCore::DocumentFontLoader::loadPendingFonts):
(WebCore::DocumentFontLoader::fontLoadingTimerFired):
(WebCore::DocumentFontLoader::stopLoadingAndClearFonts):
(WebCore::DocumentFontLoader::suspendFontLoading):
(WebCore::DocumentFontLoader::resumeFontLoading):
* dom/DocumentFontLoader.h:
* dom/ScriptExecutionContext.cpp: Add functions to initiate font load requests.
(WebCore::ScriptExecutionContext::fontLoadRequest):
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::beginLoadingFontSoon):
* loader/DocumentLoader.cpp: CSSFontSelector::suspendFontLoadingTimer
is now Document::suspendFontLoading.
(WebCore::DocumentLoader::stopLoading):
* loader/FontLoadRequest.h: Added. An interface to manage font loading
that abstracts some of the behaviour of CachedResource, CachedFont and
CachedFontClient.
(WebCore::FontLoadRequestClient::fontLoaded):
(WebCore::FontLoadRequestClient::isCachedFontLoadRequest const):
* loader/cache/CachedFontLoadRequest.h: Added. An implementation of
FontLoadRequest for CachedFont.
* workers/WorkerGlobalScope.cpp: Remove now-redundant CSSFontSelector call.
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2021-04-12 Adrian Perez de Castro <aperez@igalia.com>
[WPE][GTK] Use g_object_notify_by_pspec() whenever possible
https://bugs.webkit.org/show_bug.cgi?id=224366
Reviewed by Carlos Garcia Campos.
Keep a static array with the GParamSpec pointer for each property, and trigger
property change notifications using g_object_notify_by_pspec() to avoid looking
up by its name each time.
No new tests needed.
* platform/graphics/gstreamer/TextCombinerPadGStreamer.cpp:
(webkit_text_combiner_pad_class_init):
2021-04-12 Youenn Fablet <youenn@apple.com>
Use DestructionThread::Main for RTCRtpScriptTransform
https://bugs.webkit.org/show_bug.cgi?id=224368
<rdar://76404727>
Reviewed by Eric Carlson.
It is safer to make it DestructionThread::Main to guarantee it is destroyed in main thread.
* Modules/mediastream/RTCRtpScriptTransform.h:
2021-04-11 Cameron McCormack <heycam@apple.com>
Fix initial horizontal scrollbar position when vertical scrollbar is on the left.
https://bugs.webkit.org/show_bug.cgi?id=224409
Reviewed by Darin Adler.
Scrollable elements that place their vertical scrollbar on the left
(e.g. when they're `direction: rtl` or when the OS language is RTL and
the relevant setting to always follow OS scrollbar side is used) have
an incorrect scroll origin, which leads to creating a horizontal
scrollbar with an incorrect initial offset. This is because
RenderLayerScrollableArea::computeScrollDimensions runs prior to the
scrollbars being created. So whenever we start or stop having a
(non-overlay) vertical scrollbar on the left, we need to recompute
the scroll origin and fix up the horizontal scrollbar's offset.
Tests: fast/scrolling/rtl-scrollbars-initial-position-dynamic.html
fast/scrolling/rtl-scrollbars-initial-position.html
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::computeScrollDimensions):
(WebCore::RenderLayerScrollableArea::computeScrollOrigin): Split this
out of computeScrollDimensions so we can call it from
updateScrollbarsAfterLayout and updateScrollbarsAfterStyleChange, and
have it ask the horizontal scrollbar to update its offset. We could
condition this on the scroll origin actually having changed, but
that's going to be a similar check that Scrollbar::offsetDidChange
does to ensure the offset value did indeed change. We don't want to
condition this on shouldPlaceBlockDirectionScrollbarOnLeft(), since
that's dependent on the current style, and we may be reacting to a
style change removed the vertical scrollbar on the left.
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
* rendering/RenderLayerScrollableArea.h:
2021-04-11 Darin Adler <darin@apple.com>
[Mac] Add a missing null check to slider thumb focus rendering
https://bugs.webkit.org/show_bug.cgi?id=224418
rdar://76450584
Reviewed by Sam Weinig.
* rendering/RenderThemeMac.h: Changed updateFocusedState to take a pointer.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::updateFocusedState): Check pointer for null. This was the
missing null check.
(WebCore::RenderThemeMac::paintSliderThumb): Pass delegate pointer instead of reference.
Also made sure we always update the focused state. Old code took the approach of just not
updating focus state when it encountered null for the focus delegate, but that's not a
good strategy. In future we may also want to change the focusDelegate function signature
to make it clear it will never return null, but that's not critical right now.
(WebCore::RenderThemeMac::setSearchCellState): Update since updateFocusedState now
takes a pointer.
2021-04-11 Sam Weinig <weinig@apple.com>
Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior
https://bugs.webkit.org/show_bug.cgi?id=222518
<rdar://problem/75136887>
Reviewed by Darin Adler.
Re-implement proper (not using named-getters) support for the CSSStyleDeclaration bindings
using a new DelegateToSharedSyntheticAttribute extended atttribute which allows IDL attributes
to share a custom getter / setter implementation and delegate their implementation to it. When
using this functionality, the synthetic attribute's implementation is passed the original property
name so it can implement functionality based on it.
We use this for CSSStyleDeclaration by breaking the huge list of generated properties into
four groups, each with their own synthetic attribute. The groups are based on the different
transformation rules in the spec.
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::setPassingPropertyName):
(WebCore::IDLAttribute::getPassingPropertyName):
Add overloads of get/set that pass the property name to the provided function. These can't
be simple overloads of get/set as MSVC does not allow overloading with only a non-type
template parameters differentiating.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
Eagerly generate the any synthetic attributes before the rest of code generation,
matching the behavior of other synthetic constructions like map/set/stringifiers.
(GetAttributeGetterName):
(GetAttributeSetterName):
Add special cases to getter/setter name generation to forward to the generated
name of the synthetic attribute when delegating.
(GenerateImplementation):
Extract attribute function forward declaration genation into a new GenerateAttributeGetterAndSetterDeclaration
subroutine and use it for generation of both normal and synthetic attributes. Also adds
synthetic attributes to the list of attributes to generate function implementations for.
(GenerateAttributeGetterAndSetterDeclaration):
Extracted from GenerateImplementation. Adds extra condition to bail if DelegateToSharedSyntheticAttribute
is specified.
(GenerateAttributeGetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.
(GenerateAttributeGetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.
(GenerateAttributeGetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.
(GenerateAttributeSetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.
(GenerateAttributeSetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.
(GenerateAttributeSetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.
(GenerateCallWith):
Add support for the PropertyName value to CallWith.
(MakeSharedSyntheticAttribute):
Helper to generate the synthetic attribute from the base attribute with DelegateToSharedSyntheticAttribute
specefied. Maintains all existing extended attributes of the base attribute except
DelegateToSharedSyntheticAttribute is replaced with IsSharedSyntheticAttribute to avoid
infinite recursion.
(AddSharedSyntheticAttributesIfNeeded):
Helper to find all delegating attributes and generate / store the synthetic attributes.
(GetSharedSyntheticAttribute):
Helper to get the corresponding synthetic attribute given an attribute with
DelegateToSharedSyntheticAttribute specified on it.
* bindings/scripts/IDLAttributes.json:
Removes CSSProperty. Adds DelegateToSharedSyntheticAttribute. Adds PropertyName value to
CallWith and SetterCallWith.
* css/CSSStyleDeclaration.cpp:
(WebCore::lookupCSSPropertyFromIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::namedItem): Deleted.
(WebCore::CSSStyleDeclaration::setNamedItem): Deleted.
(WebCore::CSSStyleDeclaration::supportedPropertyNames const): Deleted.
* css/CSSStyleDeclaration.h:
Replace named-getter based implementation with helpers based on the definitions
in the CSSOM spec (plus one special set for 'epub' specializations we currently
maintain).
* css/CSSStyleDeclaration.idl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.
* css/makeprop.pl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.
Replaces CSSProperty extended attributes with DelegateToSharedSyntheticAttribute and
CallWith=PropertyName, which together allow us to implement all the attributes with just
8 implementation functions.
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestCSSProperty.cpp: Removed.
* bindings/scripts/test/JS/JSTestCSSProperty.h: Removed.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.cpp: Added.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.h: Added.
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestCSSProperty.idl: Removed.
* bindings/scripts/test/TestDelegateToSharedSyntheticAttribute.idl: Added.
Replace CSSProperty tests with DelegateToSharedSyntheticAttribute tests and update results
all around for new generation.
2021-04-11 Rob Buis <rbuis@igalia.com>
Store InputType in a Ref before calling setValueAsDecimal
https://bugs.webkit.org/show_bug.cgi?id=223535
Reviewed by Ryosuke Niwa.
Store InputType in a Ref before calling setValueAsDecimal.
* html/InputType.cpp:
(WebCore::InputType::applyStep):
2021-04-10 Chris Dumez <cdumez@apple.com>
Regression(r275668) Potential null pointer deref in AudioParam::exponentialRampToValueAtTime(float, double)
https://bugs.webkit.org/show_bug.cgi?id=224400
<rdar://76450376>
Reviewed by Ryosuke Niwa.
In r275668, I added null-checks for the AudioContext in AudioParam, now that it holds a WeakPtr to its
context. However, I missed a null-check in AudioParam::exponentialRampToValueAtTime(). This patch adds
the missing check.
Test: webaudio/AudioParam/audioparam-exponentialRampToValueAtTime-nocontext-crash.html
* Modules/webaudio/AudioParam.cpp:
2021-04-10 Chris Dumez <cdumez@apple.com>
[ macOS ] 3 webaudio/OfflineAudioContext/ layout-tests are flakey text failures
https://bugs.webkit.org/show_bug.cgi?id=224387
<rdar://problem/76468058>
Reviewed by Eric Carlson.
Replace internals.numberOfBaseAudioContexts() test infrastructure with
internals.baseAudioContextIdentifier() & internals.isBaseAudioContextAlive().
This allows tests to check if specific BaseAudioContext instances created by the
tests are actually alive. As a result, the tests are no longer impacted by tests
running before them (and potentially leaking, see Bug 224399) or in parallel to
them in the same process.
This is the same approach we used for leak testing Documents (internals.documentIdentifier()
& internals.isDocumentAlive()).
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::generateAudioContextID):
(WebCore::liveAudioContexts):
(WebCore::BaseAudioContext::BaseAudioContext):
(WebCore::BaseAudioContext::~BaseAudioContext):
(WebCore::BaseAudioContext::isContextAlive):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::contextID const):
* testing/Internals.cpp:
(WebCore::Internals::countMatchesForText):
(WebCore::Internals::baseAudioContextIdentifier):
(WebCore::Internals::isBaseAudioContextAlive):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-10 Mark Lam <mark.lam@apple.com>
Enable VMTraps checks in RETURN_IF_EXCEPTION.
https://bugs.webkit.org/show_bug.cgi?id=224078
rdar://75037057
Reviewed by Keith Miller.
1. Add DeferTermination in WorkerOrWorkletScriptController::initScript().
This allows us to avoid having to make all exception checking in
WorkerOrWorkletScriptController::initScript() very thorough and complete.
Currently, they aren't.
2. Fix WorkerOrWorkletScriptController::evaluate() to handle the TerminationException.
3. Fix JSEventListener::handleEvent() to handle the TerminationException correctly.
Previously, in one case, it was checking scope.exception() for the exception,
but the exception has already been taken out of there.
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::evaluate):
(WebCore::WorkerOrWorkletScriptController::initScript):
2021-04-10 Zalan Bujtas <zalan@apple.com>
RenderFlexibleBox::m_hasDefiniteHeight should not need to be mutable
https://bugs.webkit.org/show_bug.cgi?id=224404
Reviewed by Antti Koivisto.
Let's just fix constness instead.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
(WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
(WebCore::RenderFlexibleBox::useChildAspectRatio):
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite):
(WebCore::RenderFlexibleBox::childCrossSizeIsDefinite):
(WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Deleted.
(WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild const): Deleted.
(WebCore::RenderFlexibleBox::useChildAspectRatio const): Deleted.
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite const): Deleted.
(WebCore::RenderFlexibleBox::childCrossSizeIsDefinite const): Deleted.
(WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize const): Deleted.
* rendering/RenderFlexibleBox.h:
2021-04-09 Antoine Quint <graouts@webkit.org>
calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376
Reviewed by Simon Fraser.
An expression such as calc(0.5 * (100% + 100px)) should be simplified to calc(50% + 50px). We produce
these types of expressions when blending between a percentage and a dimension, and they can also be
specified explicitly in style.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::combineChildren):
2021-04-09 Simon Fraser <simon.fraser@apple.com>
scrollingTreeNodeDidScroll() should just trigger a rendering udpate
https://bugs.webkit.org/show_bug.cgi?id=224394
Reviewed by Tim Horton.
After handling wheel events on the scrolling thread,
ThreadedScrollingTree::scrollingTreeNodeDidScroll() appends to a queue of pending updates
and then triggers applyPendingScrollUpdates() on the main thread to process those updates.
However, every rendering update also processes pending scroll updates via
synchronizeStateFromScrollingTree(), so it's simpler if we just trigger a rendering update.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::scrollingThreadAddedPendingUpdate):
(WebCore::AsyncScrollingCoordinator::scheduleRenderingUpdate):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
(WebCore::ScrollingCoordinatorNicosia::scheduleTreeStateCommit):
2021-04-09 Jean-Yves Avenard <jya@apple.com>
Media Session action should default to the MediaElement's default when no MediaSession handler are set
https://bugs.webkit.org/show_bug.cgi?id=224278
<rdar://problem/76339841>
Reviewed by Youenn Fablet .
When a media session doesn't explicitly define an action handler, we use the media element
default action of the same type.
Media Session doesn't track a particular media element, instead it loosely defines a guessed playback state
that tracks if some element in the current document is playing and not muted or otherwise paused.
(see https://w3c.github.io/mediasession/#playback-state-model)
We therefore need to determine what is currently the most suitable media element available in this document.
Unlike the Media Controller and the Now Playing policy that will only ever select a media
if it is currently playing and not muted, for the Media Session we may have to interact with paused media elements.
For this we add a new PlaybackControlsPurpose named MediaSession defining new search criterias.
A media element will be up for selection if it's playable (according to autoplay policy). From then,
the best element will be selected accoring to its visibility, its size, if it's beeing played previously and
the last time it was interacted with.
Test: media/media-session/default-actionHandlers.html
* Modules/mediasession/MediaSession.cpp:
(WebCore::platformCommandForMediaSessionAction): New convenience method to convert one datatype into another.
(WebCore::MediaSession::callActionHandler): Use user defined handler if present or run the related action on
the most suitable media element
(WebCore::MediaSession::activeMediaElement const): Determine the currently active media element in the current
Media Session's document.
* Modules/mediasession/MediaSession.h:
* html/HTMLMediaElement.cpp:
(WebCore::mediaElementSessionInfoForSession): Add new hasEverNotifiedAboutPlaying member.
(WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession): Amend sorting algorithm to cater
for the MediaSession criterias described above.
(WebCore::mediaSessionMayBeConfusedWithMainContent): When using MediaSession purpose, there is no possible
ambiguity, amend as such.
(WebCore::HTMLMediaElement::bestMediaElementForRemoteControls): Renamed from bestMediaElementForShowingPlaybackControlsManager
method to better match how the method is actually used.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager const): Amend for new Media Session criterias.
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Always let MediaSession manage the actions handling.
* html/MediaElementSession.h:
* page/Page.cpp:
(WebCore::Page::playbackControlsManagerUpdateTimerFired): amend following method rename.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::nowPlayingEligibleSession): amend following method rename.
* testing/Internals.cpp:
(WebCore::Internals::bestMediaElementForRemoteControls): Renamed from bestMediaElementForShowingPlaybackControlsManager as above.
(WebCore::Internals::sendMediaSessionAction): amend following method rename.
* testing/Internals.h: Rename method
* testing/Internals.idl: Rename method
2021-04-09 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo][GPUP] GraphicsContextGLOpenGL::paintToCanvas can't paint into a remote canvas
https://bugs.webkit.org/show_bug.cgi?id=224271
Reviewed by Don Olmstead.
WebGL canvas tests were failing for WinCairo port since r274327
enabled GPU process for canvas rendering. In the current
implementation of WebKitTestRunner, 2D canvases are in GPU
process, while WebGL canvases are in WebContent process. Remote
canvases in GPU process failed to drawImage() with a WebGL canvas
what is in WebContent process.
GraphicsContextGLOpenGL::paintToCanvas of Cairo port was painting
directly into PlatformContextCairo. It also should use
GraphicsContext::drawNativeImage as well as CG port does.
* platform/graphics/cairo/GraphicsContextGLCairo.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
2021-04-09 Jer Noble <jer.noble@apple.com>
WTF SoftLinking macros can cause collisions with their target functions
https://bugs.webkit.org/show_bug.cgi?id=224379
<rdar://76434202>
Reviewed by Eric Carlson.
Don't include the SoftLinkLibxslt.h file in the .cpp file.
* xml/SoftLinkLibxslt.cpp:
* xml/SoftLinkLibxslt.h:
2021-04-09 Ziran Sun <zsun@igalia.com>
[css-grid] Set hasIntrinsicWidth & hasIntrinsicHeight properties for SVG element's intrinsic size
https://bugs.webkit.org/show_bug.cgi?id=223504
Reviewed by Javier Fernandez.
In RenderReplaced::computeReplacedLogicalWidth/RenderReplaced::computeReplacedLogicalHeight(),
hasIntrinsicWidth and hasIntrinsicHeight are decided by whether the value is bigger than 0.
This is not alway true. The SVG element sets its hasIntrinsicWidth/hasIntrinsicHeight property
in line with its lengthType(). This change adds checks for SVG element cases specifically.
* platform/graphics/FloatSize.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const):
2021-04-08 Darin Adler <darin@apple.com>
[Cocoa] Reduce usage of autorelease, fix mistakes noticed nearby code using autorelease
https://bugs.webkit.org/show_bug.cgi?id=224340
Reviewed by Anders Carlsson.
* bridge/objc/objc_instance.h: Added a static member function isInStringValue to
help factor the _web_description method better.
* bridge/objc/objc_instance.mm:
(JSC::Bindings::ObjcInstance::stringValue const): Removed unneeded WTF prefixes.
(JSC::Bindings::ObjcInstance::isInStringValue): Added.
(-[NSObject _web_description]): Moved this out of the C++ namespace since it's an
Objective-C class implementation. Refactored for simplicity.
2021-04-08 Antoine Quint <graouts@webkit.org>
calc() values resulting from blending mixed type lengths should be simplified
https://bugs.webkit.org/show_bug.cgi?id=224322
Reviewed by Sam Weinig.
While we simplify calc() values upon parsing such that operations are resolved and
values are sorted (percentages first then alphabetically by unit), we didn't do this
when creating calc() values during blending of lengths of mixed types.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::create const):
2021-04-09 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Cleanup the inline box wrappers when moving subtrees
https://bugs.webkit.org/show_bug.cgi?id=224342
<rdar://76349279>
Reviewed by Antti Koivisto.
When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) should release its inline box wrapper. This inline box wrapper (e.g. InlineFlowBox)
will eventually be destroy during the subsequent line layout of the original BFC.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::move):
2021-04-09 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Bump libsoup3 version to 2.99.3
https://bugs.webkit.org/show_bug.cgi?id=224362
Reviewed by Žan Doberšek.
* platform/network/soup/GUniquePtrSoup.h:
* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::platformSuggestedFilename const):
2021-04-09 Ziran Sun <zsun@igalia.com>
[css-flexbox] max-height percentages are wrongly resolved for replaced grid items in nested percentage flexboxes
https://bugs.webkit.org/show_bug.cgi?id=223931
Reviewed by Javier Fernandez.
This change is to make sure that when overridingContainingBlockContentLogicalHeight of a replaced's containing block
element is indefinite, % max-height of the replaced element is resolved to none.
Test: imported/w3c/web-platform-tests/css/css-flexbox/percentage-max-height-004.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
2021-04-09 Philippe Normand <pnormand@igalia.com>
Unreviewed, GStreamer Thunder decryptor build fix after r275599
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(decrypt):
2021-04-09 Carlos Garcia Campos <cgarcia@igalia.com>
Teardown shadow root renderers on SlotAssignment::didChangeSlot
https://bugs.webkit.org/show_bug.cgi?id=221386
Reviewed by Ryosuke Niwa.
This reverts r272900 to move the call to RenderTreeUpdater::tearDownRenderers() from hostChildElementDidChange()
to didChangeSlot(). This ensures the renderers are also cleared for other shadow root trees not using details
element.
* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::addSlotElementByName):
(WebCore::SlotAssignment::didChangeSlot):
* dom/SlotAssignment.h:
(WebCore::ShadowRoot::hostChildElementDidChange):
2021-04-09 Philippe Normand <pnormand@igalia.com>
[GStreamer] fast/canvas/canvas-createPattern-video-loading.html is failing since r218170
https://bugs.webkit.org/show_bug.cgi?id=173410
Reviewed by Xabier Rodriguez-Calvar.
When a flush has been requested by the GL video sink, allocate a new copy of the sample
which has to be released. The copy is necessary so that the video dimensions can still be
fetched and also for canvas rendering. The release is necessary because the sample might
have been allocated by a hardware decoder and memory might have to be reclaimed by a
non-sysmem buffer pool.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamer::paint):
2021-04-09 Ziran Sun <zsun@igalia.com>
[css-grid] Fix min/max widths of grid affected by ancestor
https://bugs.webkit.org/show_bug.cgi?id=222100
Reviewed by Reviewed by Javier Fernandez.
It's a reland of r273435, which got reverted because it broke
imported/w3c/web-platform-tests/css/css-flexbox/percentage-max-height-003.html. This change
narrows down the fix specificallly to the case when logical-width is recomputed.
We need to recalculate min/max widths of child that depend on the ancestor.
Before update logical-width, for element that needs preferredWidth recalcution,
it is necessary to make sure that min/max widths are set dirty.
This change is an import of chromium CL at
https://chromium-review.googlesource.com/c/chromium/src/+/527640/
Only the parts that apply to this issue are imported.
Tests were already imported in WPT.
* rendering/RenderBlock.cpp:
(WebCore::shouldRecalculateMinMaxWidthsAffectedByAncestor):
(WebCore::RenderBlock::recomputeLogicalWidth):
2021-04-09 Yusuke Suzuki <ysuzuki@apple.com>
ServiceWorker should save module scripts
https://bugs.webkit.org/show_bug.cgi?id=224356
<rdar://problem/75634897>
Reviewed by Youenn Fablet.
Test: http/wpt/service-workers/persistent-modules.html
In this patch, we call setScriptResource / scriptResource while loading service-worker module scripts in module loaders,
so that we can ensure that they are saved on the disk.
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):
* bindings/js/WorkerModuleScriptLoader.cpp:
(WebCore::WorkerModuleScriptLoader::load):
(WebCore::WorkerModuleScriptLoader::notifyFinished):
(WebCore::WorkerModuleScriptLoader::notifyClientFinished):
* bindings/js/WorkerModuleScriptLoader.h:
2021-04-08 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Wrong KeyboardEvent.key for numeric key pad with NumLock
https://bugs.webkit.org/show_bug.cgi?id=224352
Reviewed by Don Olmstead.
`8` key on a numeric key pad with NumLock dispatched a wrong
KeyboardEvent with `ArrowUp` as the `key` value. It should be `8`.
WindowsKeyNames::domKeyFromLParam computed a virtual key by
MapVirtualKey and a scan code. But, it should use a real virtual
key conveyed by WPARAM of WM_KEYDOWN and WM_KEYUP events.
* platform/win/KeyEventWin.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/win/WindowsKeyNames.cpp:
(WebCore::WindowsKeyNames::domKeyFromParams):
(WebCore::WindowsKeyNames::domKeyFromLParam): Deleted.
* platform/win/WindowsKeyNames.h:
2021-04-08 Wenson Hsieh <wenson_hsieh@apple.com>
Add a completion handler argument to `ChromeClient::requestImageExtraction`
https://bugs.webkit.org/show_bug.cgi?id=224348
Reviewed by Tim Horton.
See WebKit/ChangeLog for more details. No change in behavior.
* html/HTMLElement.h:
Export an existing helper method.
* page/ChromeClient.h:
(WebCore::ChromeClient::requestImageExtraction):
Add a (null-by-default) `CompletionHandler` argument to this client method, for future use by accessibility.
2021-04-08 Tim Horton <timothy_horton@apple.com>
Safari unit tests sometimes fail an ASSERTion in IOSurface.mm's optionsFor32BitSurface()
https://bugs.webkit.org/show_bug.cgi?id=224351
<rdar://problem/76405354>
Reviewed by Wenson Hsieh.
New API test: NavigationSwipeTests.DoNotAssertWhenSnapshottingZeroSizeView
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::IOSurface):
Add assertions that IOSurface size is non-empty at the beginning of the constructor.
We already have downstream ones (e.g. the bytesPerRow and totalBytes
assertions inside optionsFor32BitSurface()), but they are after doing
some math and calling IOSurfaceAlignProperty, so it's tempting to blame
that instead of the input. This way, we fail right at the input, making
it more obvious what's up.
2021-04-08 Alex Christensen <achristensen@webkit.org>
REGRESSION(r273541) WKWebView can't load NSURLRequest subclasses
https://bugs.webkit.org/show_bug.cgi?id=224338
<rdar://76192721>
Reviewed by Brent Fulgham.
We used to use SPI to extract the CFURLRequestRef, but now we just call encodeWithCoder and initWithCoder.
That's great for many reasons, but to stay binary compatible we have to continue to support NSURLRequest subclasses.
They fail in two possible ways:
1. In ObjC, you can do wild and crazy things such as overriding encodeWithCoder and not calling [super encodeWithCoder:coder];
2. The process decoding the request (one of our auxiliary processes) almost certainly has not linked with the definition of the subclass.
This makes us receive an NSException like this when calling decodeObjectOfClasses:forKey:
*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (TestURLRequest) for key (root) because no class named "TestURLRequest" was found;
the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target).
If the class was renamed, use setClassName:forClass: to add a class translation mapping to NSKeyedUnarchiver
To solve this problem, when attempting to encode a request that is not an NSURLRequest or NSMutableURLRequest, use existing code in ResourceRequest to extract
the parts we use into an NSMutableURLRequest that we can successfully decode.
* platform/network/cf/ResourceRequest.h:
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::replacePlatformRequest):
2021-04-08 Kyle Piddington <kpiddington@apple.com>
[Metal ANGLE] check to see that a Metal device is available before selecting the backend.
https://bugs.webkit.org/show_bug.cgi?id=224341
Some platforms, including virtual machines, do not support Metal.
If we cannot create a default device, fall back on selecting the OpenGL backend.
Reviewed by Dean Jackson.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::platformSupportsMetal):
(WebCore::InitializeEGLDisplay):
Added Metal header include, and runtime check to ensure a metal device can be created before selecting the Metal backend.
2021-04-08 Chris Dumez <cdumez@apple.com>
Suspended OfflineAudioContext objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=224333
Reviewed by Darin Adler.
When offline rendering is suspended, we now release the ActiveDOMObject::PendingActivity we hold
to keep the OfflineAudioContext and its wrapper alive during rendering. The JS has to keep a
reference to the context's wrapper anyway if they ever want to resume rendering.
Test: webaudio/OfflineAudioContext/offlineaudiocontext-leak-while-suspended.html
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::didSuspendRendering):
2021-04-08 Jiewen Tan <jiewen_tan@apple.com>
Unreviewed, a comment fix
* crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
(WebCore::encryptAES_GCM):
(WebCore::decyptAES_GCM):
Removes unnecessary comments.
2021-04-08 Rob Buis <rbuis@igalia.com>
Remove virtual from RenderBox::availableLogicalWidth
https://bugs.webkit.org/show_bug.cgi?id=224332
Reviewed by Darin Adler.
Remove virtual from RenderBox::availableLogicalWidth since
it is not overridden.
* rendering/RenderBox.h:
(WebCore::RenderBox::availableLogicalWidth const):
2021-04-08 Chris Dumez <cdumez@apple.com>
OfflineAudioContext objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=224279
Reviewed by Darin Adler.
OfflineAudioContext objects were always leaking due to 2 reference cycles:
1. BaseAudioContext -> m_listener (AudioListener) -> m_positionX (AudioParam) -> m_context (BaseAudioContext)
2. BaseAudioContext -> m_destinationNode (AudioDestinationNode) -> m_context (BaseAudioContext)
For reference cycle 1, I made AudioSummingJunction (base class of AudioParam) hold a weak pointer to the
AudioContext instead of a Ref<>. I don't think there is a good reason for an AudioSummingJunction (AudioParam
or AudioNodeInput) to keep its AudioContext alive. AudioNodes already keep their AudioContext alive.
AudioNodeInputs and AudioParams are associated to AudioNodes.
For reference cycle 2, I made AudioDestinationNode not hold a strong pointer to its context but instead a
weak pointer. Since keeping an AudioDestinationNode alive should keep its AudioContext alive, I made it so
that ref'ing the AudioDestinationNode refs its BaseAudioContext. Also, BaseAudioContext::m_destinationNode
is now a UniqueRef<> instead of a RefPtr<> to avoid a cycle.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::baseLatency):
(WebCore::AudioContext::getOutputTimestamp):
(WebCore::AudioContext::close):
(WebCore::AudioContext::destination):
(WebCore::AudioContext::destination const):
(WebCore::AudioContext::suspendRendering):
(WebCore::AudioContext::resumeRendering):
(WebCore::AudioContext::startRendering):
(WebCore::AudioContext::lazyInitialize):
(WebCore::AudioContext::mediaState const):
(WebCore::AudioContext::mayResumePlayback):
(WebCore::AudioContext::suspendPlayback):
(WebCore::AudioContext::pageMutedStateDidChange):
* Modules/webaudio/AudioContext.h:
- Drop some null checks now that m_destinationNode can no longer be null.
- Capture an ActiveDOMObject::PendingActivity when doing async work that ends up resolving a Promise, so that
we keep both the object and its wrapper alive for the duration of the async work.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::ref):
(WebCore::AudioDestinationNode::deref):
* Modules/webaudio/AudioDestinationNode.h:
Have AudioDestinationNode override AudioNode's ref() / deref() to forward the refcounting
to its BaseAudioContext, instead of using the AudioNode's internal refCount.
* Modules/webaudio/AudioListener.cpp:
(WebCore::AudioListener::updateValuesIfNeeded):
(WebCore::AudioListener::setPosition):
(WebCore::AudioListener::setOrientation):
Add some null-checks for AudioParam::context() now that AudioParam holds a WeakPtr to its
context.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::toWeakOrStrongContext):
(WebCore::AudioNode::AudioNode):
(WebCore::AudioNode::connect):
(WebCore::AudioNode::sampleRate const):
(WebCore::AudioNode::markNodeForDeletionIfNecessary):
(WebCore::AudioNode::contextForBindings):
(WebCore::AudioNode::context):
(WebCore::AudioNode::context const):
* Modules/webaudio/AudioNode.h:
- Hold the BaseAudioContext as a WeakPtr instead of a Ref<> if the AudioNode is an
AudioDestinationNode. This avoids a reference cycle since the BaseAudioContext owns the
AudioDestinationNode. Even though we are using a WeakPtr, it is safe to assume that
the context is not null because ref'ing an AudioDestinationNode refs its BaseAudioContext.
- Make sure markNodeForDeletionIfNecessary() has no effect for AudioDestinationNode since
BaseAudioContext now owns the AudioDestinationNode when we take care of destroying its
destination node when destroyed.
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect):
(WebCore::AudioNodeInput::disconnect):
(WebCore::AudioNodeInput::outputEnabledStateChanged):
(WebCore::AudioNodeInput::updateInternalBus):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::internalSummingBus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
Add assertions that the context is not null. There were already assertions that we are the graph
owner, which means we are holding the BaseAudioContext's lock, which means that the audio context
is alive.
* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::value):
(WebCore::AudioParam::setValueForBindings):
(WebCore::AudioParam::smooth):
(WebCore::AudioParam::hasSampleAccurateValues const):
(WebCore::AudioParam::calculateSampleAccurateValues):
(WebCore::AudioParam::calculateFinalValues):
(WebCore::AudioParam::calculateTimelineValues):
(WebCore::AudioParam::connect):
(WebCore::AudioParam::disconnect):
Add null-checks for the AudioContext now that the AudioParam is only holding a WeakPtr to its
BaseAudioContext (to avoid a reference cycle).
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::AudioSummingJunction):
(WebCore::AudioSummingJunction::~AudioSummingJunction):
(WebCore::AudioSummingJunction::markRenderingStateAsDirty):
(WebCore::AudioSummingJunction::addOutput):
(WebCore::AudioSummingJunction::removeOutput):
(WebCore::AudioSummingJunction::updateRenderingState):
(WebCore::AudioSummingJunction::outputEnabledStateChanged):
* Modules/webaudio/AudioSummingJunction.h:
(WebCore::AudioSummingJunction::context):
(WebCore::AudioSummingJunction::context const):
- Hold a WeakPtr to the BaseAudioContext to avoid a reference cycle.
- Deal with the fact that the audio context may be null now that we're holding a WeakPtr
to it (except when holding the graph lock)
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::BaseAudioContext):
(WebCore::BaseAudioContext::~BaseAudioContext):
(WebCore::BaseAudioContext::numberOfInstances):
(WebCore::BaseAudioContext::lazyInitialize):
(WebCore::BaseAudioContext::clear):
(WebCore::BaseAudioContext::uninitialize):
(WebCore::BaseAudioContext::stop):
(WebCore::BaseAudioContext::sampleRate const):
(WebCore::BaseAudioContext::decodeAudioData):
(WebCore::BaseAudioContext::markForDeletion):
(WebCore::BaseAudioContext::deleteMarkedNodes):
(WebCore::BaseAudioContext::setPendingActivity):
(WebCore::BaseAudioContext::workletIsReady):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::destination):
(WebCore::BaseAudioContext::destination const):
(WebCore::BaseAudioContext::currentSampleFrame const):
(WebCore::BaseAudioContext::currentTime const):
- Switch m_destinationNode from RefPtr<> to UniqueRef<> since the AudioContext is now
the owner of the destinationNode and since refing the destination node actually refs
its BaseAudioContext.
- Drop some null checks now that m_destinationNode can no longer be null.
- Rename makePendingActivity() to setPendingActivity() to avoid a naming conflict with
ActiveDOMObject::makePendingActivity().
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/OfflineAudioDestinationNode.h:
- Drop create() factory functions and make the constructor public now that the BaseAudioContext owns
its destination node via a UniqueRef<>.
- Make some member functions public as they are virtual and they now called on the subclass instead of the
base class (and these functions are public in the base class).
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::startOfflineRendering):
(WebCore::OfflineAudioContext::resumeOfflineRendering):
* Modules/webaudio/OfflineAudioContext.h:
- Drop some null checks now that m_destinationNode can no longer be null.
- Capture an ActiveDOMObject::PendingActivity when doing async work that ends up resolving a Promise, so that
we keep both the object and its wrapper alive for the duration of the async work.
* Modules/webaudio/WebKitAudioContext.cpp:
(WebCore::WebKitAudioContext::close):
Drop null checks for the destination node now that it can never be null.
* dom/ShadowRoot.cpp:
* rendering/FloatingObjects.cpp:
* rendering/RootInlineBox.cpp:
Update classes used of size restrictions since the size of a WeakPtr is not longer the same as the size of a
pointer when debug assertions are enabled. As long as they are the same size in release builds, there is no
memory use concern.
* testing/Internals.cpp:
(WebCore::Internals::numberOfBaseAudioContexts const):
* testing/Internals.h:
* testing/Internals.idl:
Add testing function to check how many BaseAudioContexts are alive, so that we can write layout tests and check
for leaks.
2021-04-08 Youenn Fablet <youenn@apple.com>
Streams: new test failure for canceling the branches of an errored tee'd stream
https://bugs.webkit.org/show_bug.cgi?id=223558
<rdar://problem/75924807>
Reviewed by Alex Christensen.
Align with latest version of the spec.
Covered by updated test.
* Modules/streams/ReadableStreamInternals.js:
(readableStreamTee):
(readableStreamTeePullFunction):
2021-04-08 Andres Gonzalez <andresg_22@apple.com>
VoiceOver does not echo text insertions and deletions when a contenteditable div has a non editable descendant element with a content editable child
https://bugs.webkit.org/show_bug.cgi?id=223818
Reviewed by Chris Fleizach.
Test: accessibility/nested-textareas-value-changed-notifications.html
AXObjectCache::textChanged now only notifies the closest non-native text
control of value changes. This avoid the problem of multiple value
changed notifications in a row when there are nested text areas.
Removed AccessibilityRenderObject::textChanged and moved that
functionality to AXObjectCache::textChanged, where it belongs.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::textChanged):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textChanged): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::textChanged): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
2021-04-08 Youenn Fablet <youenn@apple.com>
Broken transition when video player with MediaStream changes size
https://bugs.webkit.org/show_bug.cgi?id=224161
<rdar://problem/76366061>
Reviewed by Eric Carlson.
In case of animation that changes the root layer bounds, we need to synchronously update
the buffer layer as well.
Manually tested.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
2021-04-08 Simon Fraser <simon.fraser@apple.com>
Compact GraphicsContextState
https://bugs.webkit.org/show_bug.cgi?id=224317
Reviewed by Jon Lee.
Shrink GraphicsContextState from 192 to 184 bytes. This saves space in all the
GraphicsContext state stacks, and on pages with filters and canvas there can be
many of these.
* platform/graphics/GraphicsContext.h:
2021-04-08 Sihui Liu <sihui_liu@apple.com>
Remove logging for investigating http/tests/IndexedDB/storage-limit-1.html failure
https://bugs.webkit.org/show_bug.cgi?id=223086
<rdar://problem/75591816>
Reviewed by Chris Dumez.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::diskUsage):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* storage/StorageQuotaManager.cpp:
(WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread):
(WebCore::StorageQuotaManager::tryGrantRequest):
(WebCore::StorageQuotaManager::setLoggingEnabled): Deleted.
* storage/StorageQuotaManager.h:
2021-04-08 Antti Koivisto <antti@apple.com>
Revert r273621 because iPhone PLT regression
https://bugs.webkit.org/show_bug.cgi?id=224323
Unreviewed.
* dom/CharacterData.cpp:
(WebCore::CharacterData::parserAppendData):
(WebCore::CharacterData::setDataAndUpdate):
* dom/Document.cpp:
(WebCore::Document::removedLastRef):
(WebCore::Document::resolveStyle):
(WebCore::Document::updateTextRenderer):
(WebCore::Document::needsStyleRecalc const):
* dom/Document.h:
* dom/Text.cpp:
(WebCore::Text::splitText):
(WebCore::Text::updateRendererAfterContentChange):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::deleteInsignificantText):
* editing/markup.cpp:
(WebCore::replaceChildrenWithFragment):
* rendering/updating/RenderTreeUpdater.cpp:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::resolve):
* style/StyleTreeResolver.h:
(WebCore::Style::TreeResolver::TreeResolver): Deleted.
* style/StyleUpdate.cpp:
(WebCore::Style::Update::addText):
(WebCore::Style::Update::addPossibleRoot):
* style/StyleUpdate.h:
(WebCore::Style::Update:: const):
(WebCore::Style::Update::roots const): Deleted.
2021-04-08 Youenn Fablet <youenn@apple.com>
Update SFrame implementation to latest version
https://bugs.webkit.org/show_bug.cgi?id=224276
Reviewed by Eric Carlson.
Update implementation according to latest draft at https://github.com/eomara/sframe/blob/master/draft-omara-sframe.md.
In particular, we derive keys with new algorithm and the generation of the signature by including header and data length as well as nonce.
Test: webrtc/sframe-test-vectors.html
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::setCounterForTesting):
* Modules/mediastream/RTCRtpSFrameTransform.h:
* Modules/mediastream/RTCRtpSFrameTransformer.cpp:
(WebCore::computeIV):
(WebCore::RTCRtpSFrameTransformer::updateEncryptionKey):
(WebCore::RTCRtpSFrameTransformer::decryptFrame):
(WebCore::RTCRtpSFrameTransformer::encryptFrame):
(WebCore::RTCRtpSFrameTransformer::computeEncryptedDataSignature):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Modules/mediastream/RTCRtpSFrameTransformerCocoa.cpp:
(WebCore::RTCRtpSFrameTransformer::computeSaltKey):
(WebCore::createBaseSFrameKey):
(WebCore::RTCRtpSFrameTransformer::computeAuthenticationKey):
(WebCore::RTCRtpSFrameTransformer::computeEncryptionKey):
(WebCore::encodeBigEndian):
(WebCore::RTCRtpSFrameTransformer::computeEncryptedDataSignature):
* testing/Internals.cpp:
(WebCore::Internals::setSFrameCounter):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-08 Xabier Rodriguez Calvar <calvaris@igalia.com>
Unreviewed. Fixed build warning.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Avoid C-linkage warning.
2021-04-07 Julian Gonzalez <julian_a_gonzalez@apple.com>
Nullptr dereference in ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline
https://bugs.webkit.org/show_bug.cgi?id=224259
Reviewed by Ryosuke Niwa.
When pruning after removing the end <br> in ReplaceSelectionCommand::doApply(), make sure
that insertedNodes is updated properly (given that we may be removing an ancestor
of the start or end of insertedNodes).
Test: editing/inserting/insert-display-contents-crash.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::InsertedNodes::willRemovePossibleAncestorNode):
(WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNode):
(WebCore::ReplaceSelectionCommand::doApply):
* editing/ReplaceSelectionCommand.h:
2021-04-07 Jean-Yves Avenard <jya@apple.com>
Site could crash if MediaRemote framework isn't available.
https://bugs.webkit.org/show_bug.cgi?id=224308
<rdar://problem/76273591>
Reviewed by Eric Carlson.
Check that MediaRemote framework is available before calling any of its method.
We put the check in the two static methods calling MediaRemote in order to keep all code dealing with MediaRemote in the same place.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::clearNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
2021-04-02 Darin Adler <darin@apple.com>
Use Hasher more, remove IntegerHasher, fix hashing-related mistakes
https://bugs.webkit.org/show_bug.cgi?id=224138
Reviewed by Chris Dumez.
* contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::TriggerHash::hash): Use computeHash to
hash all the fields instead of a custom-written algorithm. The custom
algorithm had some magic numbers, repeatedly hashed hashes, and combined
hashes using exclusive or. The new one is almost certainly better.
* contentextensions/Term.h:
(WebCore::ContentExtensions::Term::CharacterSet::hash const):
Use computeHash to hash the boolean and the characters rather than
using intHash and pairIntHash.
* css/parser/CSSParserContext.cpp:
(WebCore::add): Moved the hashing here from the header. Fixed the
mistake where this was using & instead of | and so none of the booleans
were having any effect on the hash value.
* css/parser/CSSParserContext.h: Use WTF_MAKE_STRUCT_FAST_ALLOCATED so
we don't have to say public: explicitly. Also moved all the function
members to the bottom of the struct. This is typically preferred style
for structures as opposed to classes. Since the data members are the
primary interface, they are first, and all function members are secondary
and so they come after.
(WebCore::CSSParserContextHash::hash): Use convertHash instead of
a custom written hash function. The custom written function was combining
hahes using exclusive or, not a best practice, and also had a mistake
where it used & instead of | and so the "bits" local variable was always 0.
* html/FormController.cpp: Use HashTraits instead of WTF::GenericHashTraits.
* platform/encryptedmedia/CDMProxy.h: Removed unneedes includes.
* platform/graphics/Font.cpp: Changed CharacterFallbackMapKey into a
simple struct with no additional function members or static data members.
Changed CharacterFallbackMapKeyHash to use computeHash to calculate the
hash, instead of IntegerHasher. Probably better to hash the pointer of
the AtomString rather than hashing the hash, but either way, we should
have the best implementation for AtomString hashing in the Hasher class.
Added CharacterFallbackMapKeyHashTraits instead of using
SimpleClassHashTraits. Use the value U_SENTINEL for the UChar32 character,
which is the same as the -1 used before, but slightly clearer why it's OK.
(WebCore::Font::systemFallbackFontForCharacter const): Use HashMap::ensure
instead of HashMap::add to make the logic simpler.
* platform/graphics/Font.h: Use bool instead of uint8_t as the base type
for the No/Yes enumeration IsForPlatformFont.
* platform/graphics/FontCache.cpp: Removed unneeded "using namespace WTF",
which is not our best practice, especially given unified builds.
Changed FontPlatformDataCacheKey into a simple struct, removing all the
hash-related member functions. Also used struct-style naming for the
members without an "m_" prefix. Used the type FontFamilyName for the
family name, which means we will use FontCascadeDescription's system
for hashing and comparing family names for equality without having to
remember do to so explicitly. Changed FontPlatformDataCacheKeyHash to
use computeHash. The old version had unnecessarily complex logic to
handle Optional and was unnecessarily hashing hashes.
(WebCore::FontCache::cachedFontPlatformData): Renamed to remove "get"
from the function's name. Also use shorter argument and local variable
names that are single words, and updated since FontPlatformDataCacheKey
is now a struct without a constructor.
(WebCore::FontCache::fontForFamily): Use shorter names.
(WebCore::operator==): To compare two FontCascadeCacheKey objects,
use a simpler constructions, depending on the fact that Vector already
has an == operator and we are using FontFamilyName for the elements
of the vector, which has a correct == operator.
(WebCore::FontCascadeCacheKeyHash::hash): Use computeHash since
the FontFamilyName hashing is now correct, and we can rely on the
way Hasher knows how to iterate a collection.
(WebCore::FontCache::retrieveOrAddCachedFonts): Update since
FontCascadeCacheEntry is now a simple struct. Also use constexpr a bit.
(WebCore::FontCache::invalidate): Use copyToVectorOf<> to simplify the
code that calls fontCacheInvalidated on all the font selectors.
* platform/graphics/FontCache.h: Use "using" instead of "typedef".
Remove FontDescriptionKey::computeHash.
(WebCore::add): An overload of add for Hasher to include a
FontDescriptionKey in a hash, which just lists all the data members.
The old version did a hash of hashes, but that's not needed any more.
Updated FontDescriptionKeyHash to use the Hasher version of ComputeHash.
Added FontFamilyName. Change FontCascadeCacheKey to use a vector of
FontFamilyName instead of AtomString. In FontCascadeCacheEntry, use
WTF_MAKE_STRUCT_FAST_ALLOCATED instead of WTF_MAKE_FAST_ALLOCATED
and also got rid of the unneeeded constructor.
(WebCore::FontCascadeCacheKeyHashTraits::constructDeletedValue):
Use the deleted value of FontDescriptionKey.
(WebCore::FontCascadeCacheKeyHashTraits::isDeletedValue): Ditto.
Renamed getCachedFontPlatformData to just cachedFontPlatformData.
* platform/graphics/FontGenericFamilies.h: Use HashTraits instead of
WTF::GenericHashTraits.
* platform/graphics/FontSelectionAlgorithm.h:
(WebCore::FontSelectionRange::uniqueValue const): Deleted.
(WebCore::add): Add both the minimum and maximum values to the hash
separately instead of combining them. For now, this makes the way
they are hashed a bit inefficient, but that can be re-tightened up by
improving the algorithm of Hasher if we like. Should be fine for our
needs either way.
* platform/graphics/FontTaggedSettings.cpp:
(WebCore::FontFeatureSettings::hash const): Deleted.
(WebCore::FontVariationSettings::hash const): Deleted.
* platform/graphics/FontTaggedSettings.h: Added overloads of the
add(Hasher&) function for std::array<char, 4> and FontTaggedSetting<T>.
Got rid of many uses of pass by reference instead of value for FontTag,
since it fits into a 32-bit register and bth more source code and less
efficient to pass by value.
* platform/graphics/Gradient.cpp: Removed "using WTF::pairIntHash" since
that's now done in the WTF header.
* platform/graphics/cg/GraphicsContextCG.cpp: Ditto. Also removed
"using WTF::GenericHashTraits", which was unhelpful. The GenericHashTraits
template is only really needed when specializing HashTraits, which
already has to be done within the WTF namespace. In all other cases, we
should just use HashTraits instead.
* platform/graphics/cg/SubimageCacheWithTimer.h: Use HashTraits
instead of WTF::GenericHashTraits.
* platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
Move the data members to the top of the FontFamilySpecificationKey struct.
Removed unneeded computeHash function and WTF prefix from safeCFEqual.
(WebCore::FontFamilySpecificationKeyHash::hash): Call the Hasher version
of computeHash directly to hash the two items in this structure.
* platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
(WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
Use computeHash instead of IntegerHasher. Also renamed the hash function
struct from CascadeListParameters::CascadeListParametersHash to
CascadeListParameters::Hash.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
Removed now-unneeded WTF prefixes from calls to safeCFEqual.
* rendering/TextAutoSizing.h: Use HashTraits instead of WTF::GenericHashTraits.
* rendering/style/RenderStyle.cpp:
(WebCore::computeFontHash): Use computeHash instead of IntegerHasher.
Still not great that we hash a hash here, but we can improve that later.
* workers/service/ServiceWorkerClientIdentifier.h:
(WebCore::ServiceWorkerClientIdentifier::decode): Removed unneeded
WTFMove on ObjectIdentifier, which are just integers, so move vs. copy
is not an important distinction.
(WebCore::ServiceWorkerClientIdentifier::hash const): Use computeHash
instead of combining intHash with StringHasher::hashMemory. This fixes
two mistakes: one is that there is no need to hash a hash. The second is
that intHash takes a 32-bit integer as its parameter, so high bits
of object identifiers were discarded unnecessarily.
* workers/service/ServiceWorkerContextData.h: Removed unneeded include.
* workers/service/ServiceWorkerGlobalScope.h: Added now-needed include
of URLHash.h, since we removed it from a widely-included header.
* workers/service/context/SWContextManager.h: Ditto.
* workers/service/server/ServiceWorkerThreadProxy.h: Ditto.
* workers/service/server/RegistrationStore.h: Ditto.
* workers/service/server/SWServer.h: Ditto.
* workers/service/server/SWServerToContextConnection.h: Ditto.
* workers/service/server/SWServerWorker.h: Ditto.
2021-04-07 Mark Lam <mark.lam@apple.com>
Rename and make the TerminationException a singleton.
https://bugs.webkit.org/show_bug.cgi?id=224295
Reviewed by Keith Miller.
In the WorkerOrWorkletScriptController constructor, we ensure the TerminationException
because workers need to support termination requests.
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::reportException):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::handleResponseOnStreamingAction):
* bindings/js/JSDOMPromise.cpp:
(WebCore::DOMPromise::whenPromiseIsSettled):
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::reject):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/ReadableStream.cpp:
(WebCore::invokeReadableStreamFunction):
(WebCore::ReadableStream::lock):
(WebCore::checkReadableStream):
* bindings/js/ReadableStreamDefaultController.cpp:
(WebCore::invokeReadableStreamDefaultControllerFunction):
(WebCore::ReadableStreamDefaultController::error):
(WebCore::ReadableStreamDefaultController::enqueue):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::WorkerOrWorkletScriptController):
(WebCore::WorkerOrWorkletScriptController::evaluate):
(WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule):
(WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Remove RepaintLayoutRectsMap
https://bugs.webkit.org/show_bug.cgi?id=224217
Reviewed by Zalan Bujtas.
RepaintLayoutRectsMap was a side table used to map RenderLayerModelObjects to
repaint rects for their corresponding layers. However, this HashMap could
get large, and waste more space than if we just stored the repaint rects
on RenderLayer.
For example, on twitter.com we could have about 2000 RenderLayers; increasing
their size by 32 bytes (the size of the two LayoutRects) adds 62KB, but RepaintLayoutRectsMap
would contain about 1950 entries with a capacity of 8192, wasting around 200KB.
So moving repaint rects into RenderLayer is a memory saving. This patch does so
without using Optional<> since that introduces extra padding.
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::layoutRunsAndFloats):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants const):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::setRepaintRects):
(WebCore::RenderLayer::clearRepaintRects):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:
(WebCore::RenderLayer::repaintRects const):
(WebCore::RenderLayer::hasComputedRepaintRects const): Deleted.
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::willBeDestroyed):
(WebCore::RenderLayerModelObject::destroyLayer):
(WebCore::RenderLayerModelObject::styleDidChange):
(WebCore::RenderLayerModelObject::layerRepaintRects const):
(WebCore::RepaintLayoutRects::RepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::hasRepaintLayoutRects const): Deleted.
(WebCore::RenderLayerModelObject::setRepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::clearRepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::repaintLayoutRects const): Deleted.
(WebCore::RenderLayerModelObject::computeRepaintLayoutRects): Deleted.
* rendering/RenderLayerModelObject.h:
(WebCore::RepaintLayoutRects::RepaintLayoutRects): Deleted.
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollTo):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in various DisplayList related code paths
https://bugs.webkit.org/show_bug.cgi?id=224304
Reviewed by Wenson Hsieh.
Add DisplayList::shrinkToFit() and have it shrink the vector of drawing extents (this
could be extended to shrink item buffers at some point). Call the shrink from
FontCascade which caches glyph buffers as an optimization.
Reduce the inline capacity of the Recorder's context stack; this sticks around
for GPU process canvases.
Reduce the inline capacity of the DrawGyph buffers from 128 to 16, as these items
persist for FontCascade cached lists (until a memory warning).
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::shrinkToFit):
* platform/graphics/displaylists/DisplayList.h:
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawGlyphs::glyphs const):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity under CSSFontFace::setUnicodeRange()
https://bugs.webkit.org/show_bug.cgi?id=224266
Reviewed by Devin Rousso.
We know how big the Vector<UnicodeRange> is up-front.
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::setUnicodeRange):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity under RuleFeatureSet::collectFeatures()
https://bugs.webkit.org/show_bug.cgi?id=224248
Reviewed by Devin Rousso.
The RuleSets constructed ensureInvalidationRuleSets() were never shrunk,
causing up to 500KB of wasted vector capacity on youtube.com.
This change calls shrinkToFit() on the RuleSets, and on the InvalidationRuleSet
vector.
* style/StyleScopeRuleSets.cpp:
(WebCore::Style::ensureInvalidationRuleSets):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Reduce Vector<> wasted capacity in some RuleSet code
https://bugs.webkit.org/show_bug.cgi?id=224160
Reviewed by Antti Koivisto.
Dynamic media rule-related vectors were not getting shrunk because m_dynamicMediaQueryRules
was constructed after the shrinkToFit() calls, and itself was not shrunk.
Also re-order member variables to reduce padding.
Saves 60-120KB on a nytimes page.
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRulesFromSheet):
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):
(WebCore::Style::shrinkDynamicRules):
(WebCore::Style::RuleSet::shrinkToFit):
* style/RuleSet.h:
(WebCore::Style::RuleSet::DynamicMediaQueryRules::shrinkToFit):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in RenderLayer lists
https://bugs.webkit.org/show_bug.cgi?id=224170
Reviewed by Sam Weinig.
Shrink RenderLayer normal flow and z-order lists.
This saves about 800KB on twitter.com.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateNormalFlowList):
(WebCore::RenderLayer::rebuildZOrderLists):
2021-04-07 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] Remove InlineLines and InlineLineBoxes inline capacity of 10
https://bugs.webkit.org/show_bug.cgi?id=224296
Reviewed by Antti Koivisto.
A casual browsing session shows that the average line count is ~1.4. Having 10 as initial capacity seems a little excessive.
(and neither PerformanceTests/Layout/line-layout-inline-block.html nor PerformanceTests/Layout/line-layout-inline-level-boxes.html microbenchmarks show regression locally)
* layout/inlineformatting/InlineFormattingState.h:
2021-04-07 Chris Dumez <cdumez@apple.com>
Drop unnecessary NDEBUG checks in ServiceWorkerContainer
https://bugs.webkit.org/show_bug.cgi?id=224285
Reviewed by Youenn Fablet.
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::queueTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
(WebCore::ServiceWorkerContainer::destroyJob):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::queueTaskToDispatchControllerChangeEvent):
(WebCore::ServiceWorkerContainer::contextIdentifier):
* workers/service/ServiceWorkerContainer.h:
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in StyleRuleKeyframes
https://bugs.webkit.org/show_bug.cgi?id=224264
Reviewed by Antti Koivisto.
Shrink StyleRuleKeyframes::m_keyframes. Saves 23KB on youtube.com.
* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::shrinkToFit):
* css/CSSKeyframesRule.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeKeyframesRule):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in StyleSheetContents
https://bugs.webkit.org/show_bug.cgi?id=224250
Reviewed by Darin Adler.
Call shrinkToFit() on the StyleSheetContents created in CSSParserImpl::parseStyleSheet()
in order to shrink m_importRules and m_childRules, which can waste about 100KB on
youtube.com.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseStyleSheet):
2021-04-07 Zalan Bujtas <zalan@apple.com>
REGRESSION (r270849): Button content fails to render on apple.com "Blood Oxygen"/"ECG"
https://bugs.webkit.org/show_bug.cgi?id=224261
Reviewed by Simon Fraser.
1. The changeRequiresRecompositeLayer check in RenderStyle::diff should come after
changeRequiresRepaintIfTextOrBorderOrOutline since RepaintIfTextOrBorderOrOutline is at
a higher priority in StyleDifference.
2. Ensure that we trigger setNeedsCompositingConfigurationUpdate on diff >= StyleDifference::RecompositeLayer.
Test: fast/text/text-repaint-when-pointer-event-property-changes.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff const):
2021-04-07 Rob Buis <rbuis@igalia.com>
Ignore non-null lastQuote ASSERT when continuation is broken
https://bugs.webkit.org/show_bug.cgi?id=218576
Reviewed by Zalan Bujtas.
Ignore non-null lastQuote when continuation is broken.
* rendering/updating/RenderTreeBuilder.h:
(WebCore::RenderTreeBuilder::hasBrokenContinuation const):
(WebCore::RenderTreeBuilder::setHasBrokenContinuation):
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::splitInlines):
* rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
2021-04-07 Imanol Fernandez <ifernandez@igalia.com>
Use frameData instead of scheduleOnNextFrame calls in WebFakeXRDevice
https://bugs.webkit.org/show_bug.cgi?id=223580
Reviewed by Youenn Fablet.
This patch makes the WebFakeXRDevice code more robust by getting rid of the scheduleOnNextFrame calls.
Tested by WebXR WPT.
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::setViews):
(WebCore::SimulatedXRDevice::setNativeBoundsGeometry):
(WebCore::SimulatedXRDevice::setViewerOrigin):
(WebCore::SimulatedXRDevice::frameTimerFired):
(WebCore::WebFakeXRDevice::setViews):
(WebCore::WebFakeXRDevice::setViewerOrigin):
(WebCore::WebFakeXRDevice::setFloorOrigin):
* testing/WebFakeXRDevice.h:
* testing/WebXRTest.cpp:
(WebCore::WebXRTest::simulateDeviceConnection):
2021-04-07 Philippe Normand <pnormand@igalia.com>
[GStreamer] Videos start playing muted in epiphany with no unmute icon visible in tab, webkit_web_view_get_is_muted() returns incorrect results
https://bugs.webkit.org/show_bug.cgi?id=223195
Reviewed by Eric Carlson.
For GStreamer ports the semantics of IsPlayingAudio slightly differ from Apple ports. The
webkit_web_view_is_playing_audio() API is expected to return true if a page is producing
audio even though it might be muted.
The second change affects the private player mute state when the page mute state has been
updated.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaState const):
(WebCore::HTMLMediaElement::pageMutedStateDidChange):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Logging improvements.
(WebCore::MediaPlayerPrivateGStreamer::isMuted const):
(WebCore::MediaPlayerPrivateGStreamer::volume const):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange):
(WebCore::MediaPlayerPrivateGStreamer::setMuted):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfMute):
2021-04-07 Enrique Ocaña González <eocanha@igalia.com>
[EME][GStreamer] Abort decryptor operations immediately and without errors on flush
https://bugs.webkit.org/show_bug.cgi?id=223742
Reviewed by Xabier Rodriguez-Calvar.
A decryptor transformInPlace() operation can cause potentially long waits in
two situations:
- transformInPlace() is waiting to get the cdmProxy.
- The CDMProxy::decrypt() method is internally waiting for a specific key to
become available.
If a seek operation is performed during those long waits, the main thread will
be blocked until the seek finishes the conditions those long waits are waiting
for will never be fulfilled (because the operations that complete them happen
in the main thread, which is blocked), the internal wait timeouts will trigger
and the decoder will trigger an unrecoverable error.
The solution for this is to break the waits by issuing the right notifications,
and to detect the flushes performed by the seek, distinguising this special
"abort" case from a regular error, so that the situation is no longer
unrecoverable.
This solution involves changes in several layers. A public
CDMProxy::abortWaitingForKey() method is exposed to allow the decryptor to
awake the inner waitFor() that checks for the key. The cdmProxy wait is also
awaken in case there's no cdmProxy available yet.
In order to distinguish if the awakenings are caused by real errors (no
cdmProxy, no key available) or by a flush operation (caused by the seek), the
decryptor first needs to keep track of the "flushing" state and allow other
objects to know about it. CDMProxy is one of those objects, but due to layer
limitations it can't directly ask about it to the decryptor (it can't "see"
it).
A new CDMProxyDecryptionClient interface is created, and the decryptor will
hold an implementation of it (as CDMProxyDecryptorClientImplementation).
CDMProxy can then know the client isAborting(), and the client will know the
decryptor and will ask about it.
As the pipeline, and thus the decryptor, can be destroyed at any moment,
the client holds a WeakPtr to the decryptor and will only ask if isAborting()
if the pointer is still alive.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMProxy::abortWaitingForKey const): Notify waiting threads.
(WebCore::CDMProxy::tryWaitForKeyHandle const): Take a client and ask it if it's aborting.
(WebCore::CDMProxy::getOrWaitForKeyHandle const): Pass the client along.
(WebCore::CDMProxy::getOrWaitForKeyValue const): Ditto.
* platform/encryptedmedia/CDMProxy.h: Declaration and usage of the CDMProxyDecryptionClient interface.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::cencSetDecryptionKey): Pass the client along from the context.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h: Store client in the cencDecryptContext.
* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Pass the client along from the context.
(WebCore::CDMProxyThunder::decrypt): Abort operations aren't an error, so just trigger a warning if there's no session.
* platform/graphics/gstreamer/eme/CDMProxyThunder.h: Store client in DecryptionContext.
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
(decrypt): Ask for client to the superclass and store it in the context.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(CDMProxyDecryptionClientImplementation::CDMProxyDecryptionClientImplementation): Implementation of the CDMProxyDecryptionClient interface.
(CDMProxyDecryptionClientImplementation::isAborting): Ask if the decryptor is flushing.
(constructed): Initialize the client.
(transformInPlace): Check the flush status after waiting for the CDMProxy and for the decryption performed by the subclasses. Release the lock when not needed.
(isCDMProxyAvailable): Renamed mutex to be more generic.
(attachCDMProxy): Ditto. Also renamed condition for the same reason.
(sinkEventHandler): Manage isFlushing status and awake waits for cdmProxy or for session depending on the lifecycle stage.
(webKitMediaCommonEncryptionDecryptIsFlushing): Expose isFlushing status.
(webKitMediaCommonEncryptionDecryptGetCDMProxyDecryptionClient): Return Weak reference to the client.
(changeState): Renamed condition.
(setContext): Renamed mutex.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: New getters for isFlushing and the client.
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(decrypt): Ask for client to the superclass and store it in the context.
2021-04-07 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] Only seek to change the rate un updatePlaybackRate() when needed
https://bugs.webkit.org/show_bug.cgi?id=224235
Reviewed by Alicia Boya Garcia.
A seek is used by MediaPlayerPrivateGStreamer to update the playback
rate used in the pipeline. There's a special case when the rate is 0.0.
This actually means "paused" and, when set, the pipeline is changed to
PAUSED and no updatePlaybackRate() call is made because of an early
return (and therefore, no seek). When the rate is restored to a
non-zero value, the pipeline is set again to PLAYING, but a
call to updatePlaybackRate() is done, which implies an unconditional
seek.
It should be possible to do the seek in updatePlaybackRate() only if the
rate changed with respect to the original one, instead of always doing
it. This would avoid unneeded seeks, which are complex operations that
can trigger collateral issues such as the one addressed in
https://bugs.webkit.org/show_bug.cgi?id=223742.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate): Only seek when the playback rate hasn't changed.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Document m_lastPlaybackRate purpose.
2021-04-07 Rob Buis <rbuis@igalia.com>
Make synthesizedBaselineFromContentBox return LayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=224234
Reviewed by Javier Fernandez.
Make synthesizedBaselineFromContentBox return LayoutUnit. This
makes it consistent with synthesizedBaselineFromBorderBox.
* rendering/RenderButton.cpp:
(WebCore::synthesizedBaselineFromContentBox):
(WebCore::RenderButton::baselinePosition const):
2021-04-07 Alejandro G. Castro <alex@igalia.com>
[GTK][WPE] Wrong frame scrolled when view is horizontally scrolled with async scrolling enabled
https://bugs.webkit.org/show_bug.cgi?id=222900
Reviewed by Žan Doberšek.
We need to use the scrolling offset in the parent when collecting
the descendant layers at a point. We substract the boundsOrigin to
make sure we transform the point considering the scrolling offset.
Test: fast/scrolling/scrolling-inside-scrolled-overflowarea.html
* page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
(WebCore::collectDescendantLayersAtPoint):
2021-04-07 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION(r274812): Release assert in Document::updateLayout() after calling focus({preventScroll: true}) on a textarea
https://bugs.webkit.org/show_bug.cgi?id=224262
Reviewed by Antti Koivisto.
The regression was caused by Element::focus not updating the selection when preventScroll is set to true.
Fixed it by always updating the selection whenever Element::focus is called.
Test: fast/forms/textarea/textarea-focus-prevent-scroll-crash.html
* dom/Element.cpp:
(WebCore::Element::focus):
(WebCore::Element::findTargetAndUpdateFocusAppearance): Renamed from revealFocusedElement.
* dom/Element.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):
2021-04-07 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Provide a non-empty User Agent
https://bugs.webkit.org/show_bug.cgi?id=224216
Reviewed by Ross Kirsling.
Add non-empty implementation of User Agent code for port.
* platform/playstation/UserAgentPlayStation.cpp:
2021-04-06 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 5: Tweak the return type of DisplayList::Iterator::operator*()
https://bugs.webkit.org/show_bug.cgi?id=224148
Reviewed by Wenson Hsieh.
This patch migrates from
struct Value {
Optional<ItemHandle> item;
Optional<FloatRect> extent;
size_t itemSizeInBuffer { 0 };
};
Value operator*() const;
to
struct Value {
ItemHandle item;
Optional<FloatRect> extent;
size_t itemSizeInBuffer { 0 };
};
Optional<Value> operator*() const
There are two reasons for this:
1. Philosophically, if the item is nullopt, then all the stuff in the Value is also meaningless
2. Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
iterating - doing this will lead to an infinite loop. Promoting the optional makes it more
likely that this API contract is followed in the future.
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::asText const):
(WebCore::DisplayList::DisplayList::dump const):
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::iterator::operator* const):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):
2021-04-06 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] InlineFormattingState::shrinkToFit should shrink InlineItems too
https://bugs.webkit.org/show_bug.cgi?id=224258
Reviewed by Simon Fraser.
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::shrinkToFit):
* layout/integration/LayoutIntegrationCoverage.cpp:
2021-04-06 Jean-Yves Avenard <jya@apple.com>
Fix logic error in MediaMetadataInit
https://bugs.webkit.org/show_bug.cgi?id=224252
<rdar://problem/76291386>
Reviewed by Eric Carlson.
Fix inverted logic error in decode that would have caused it to return early.
* Modules/mediasession/MediaMetadataInit.h:
(WebCore::MediaMetadataInit::decode):
2021-04-06 Sihui Liu <sihui_liu@apple.com>
[ Catalina WK2 Release ] http/tests/IndexedDB/storage-limit-1.https.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=213292
<rdar://problem/64447734>
Reviewed by Geoffrey Garen.
Test http/tests/IndexedDB/collect-IDB-objects.https.html, which runs right before
http/tests/IndexedDB/storage-limit-1.https.html, will delete databases after test completetion. During deletion,
we create a new database if it does not exist, extract database version from it, and then delete database files.
This creation can happen during storage-limit-1.https.html run and interrupt testing for quota. To fix the
flakiness and make the deletion more efficient, let's not create a new database during deletion if database
does not exist.
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::databaseVersion):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseVersion):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
2021-04-06 Eric Carlson <eric.carlson@apple.com>
REGRESSION (r275538): [ macOS ] TestWebKitAPI.WebKitLegacy.MediaPlaybackSleepAssertion and TestWebKitAPI.SleepDisabler.Pause consistently failing
https://bugs.webkit.org/show_bug.cgi?id=224249
<rdar://problem/76286539>
Reviewed by Jer Noble.
No new tests, this fixes two API tests.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Use m_requestedRate
when choosing the pitch correction algorithm.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPreservesPitch): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPitchCorrectionAlgorithm): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatusDidChange): Ditto.
2021-04-06 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after 275571: add declaration for new method (and make the constness match).
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo const):
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo): Deleted.
* Modules/mediasession/MediaSessionCoordinator.h:
2021-04-06 Jer Noble <jer.noble@apple.com>
[MediaSession] Add optional mediaTime and hostTime arguments to the playSession() command.
https://bugs.webkit.org/show_bug.cgi?id=224173
Reviewed by Eric Carlson.
When receiving a playSession() method that has an optional mediaTime argument, perform a
seekAction before the matching playAction if the current media time is not already approximately
equal to the mediaTime argument.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
2021-04-06 Said Abou-Hallawa <said@apple.com>
Replace the Optional metadata of ImageSource by a single OptionSet and the underlying metadata
https://bugs.webkit.org/show_bug.cgi?id=224202
Reviewed by Simon Fraser.
Encapsulating the metadata in a Optionals adds extra memory cost. Replace
these Optionals by the underlying metadata and an OptionSet to tell which
ones are cached.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::ImageSource):
(WebCore::ImageSource::frameAtIndexCacheIfNeeded):
Instead of assertion index < m_frames.size(), we can return defaultFrame().
This will used in many callers which checks the size before calling it.
(WebCore::ImageSource::clearMetadata):
(WebCore::ImageSource::metadataCacheIfNeeded):
(WebCore::ImageSource::firstFrameMetadataCacheIfNeeded):
These two template functions will be used to return and cache, if needed,
the image metadata. The first function uses the ImageDecoder while the
second one uses the first ImageFrame of the image.
(WebCore::ImageSource::encodedDataStatus):
(WebCore::ImageSource::frameCount):
(WebCore::ImageSource::repetitionCount):
(WebCore::ImageSource::uti):
(WebCore::ImageSource::filenameExtension):
(WebCore::ImageSource::accessibilityDescription):
(WebCore::ImageSource::hotSpot):
(WebCore::ImageSource::orientation):
(WebCore::ImageSource::densityCorrectedSize):
(WebCore::ImageSource::sourceSize):
(WebCore::ImageSource::singlePixelSolidColor):
(WebCore::ImageSource::maximumSubsamplingLevel):
(WebCore::ImageSource::frameDecodingStatusAtIndex):
(WebCore::ImageSource::frameHasAlphaAtIndex):
(WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
(WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
(WebCore::ImageSource::frameSubsamplingLevelAtIndex):
(WebCore::ImageSource::frameSizeAtIndex):
(WebCore::ImageSource::frameBytesAtIndex):
(WebCore::ImageSource::frameDurationAtIndex):
(WebCore::ImageSource::frameOrientationAtIndex):
(WebCore::ImageSource::frameImageAtIndex):
(WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
(WebCore::ImageSource::metadata): Deleted.
(WebCore::ImageSource::frameMetadataAtIndex): Deleted.
(WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded): Deleted.
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::frameAtIndex):
2021-04-06 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 3: Reorder #include dependencies to allow for ItemBuffer{Writing,Reading}Client to know about DisplayList item types
https://bugs.webkit.org/show_bug.cgi?id=224145
Reviewed by Wenson Hsieh.
ItemBuffer{Writing,Reading}Client exists within DisplayListItemBuffer.h. The DisplayList item types exist within DisplayListItems.h.
Previously, the #include path was:
DisplayListItems.h -> DisplayList.h -> DisplayListItemBuffer.h
However, this means that DisplayListItemBuffer.h can't see what's inside DisplayListItems.h.
After this patch, the #include path is:
DisplayList.h -> DisplayListItemBuffer.h -> DisplayListItems.h
This is important because ItemBuffer{Writing,Reading}Client have encodeItem() and decodeItem() functions, which will need to know
about DisplayList item types if we want to migrate away from ItemHandle.
No new tests because there is no behavior change.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
* platform/graphics/displaylists/DisplayListItemBuffer.h:
* platform/graphics/displaylists/DisplayListItemBufferIdentifier.h: Added.
* platform/graphics/displaylists/DisplayListItems.h:
2021-04-06 Brent Fulgham <bfulgham@apple.com>
Add additional page load diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=224194
<rdar://problem/76227175>
Reviewed by Alex Christensen.
This patch adds new logging to help us diagnose and investigate page load failures.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init): Add logging for some unusual conditions:
(1) A loader cannot be created because the document loader is nullptr.
(2) A load is cancelled because it violates security policy.
(3) A load was cancelled during 'willSendRequest' processing.
(4) A load was cancelled because the request was null.
(WebCore::ResourceLoader::loadDataURL): Log when a data load was cancelled.
(WebCore::ResourceLoader::willSendRequestInternal): Log when a cross-origin redirect is triggered, and when a redirect is
to a dataURL and will be handled locally.
(WebCore::ResourceLoader::didFinishLoadingOnePart): Log when a load is cancelled after it finished.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal): Log when an ongoing load has unexpectedly reached terminal state. Remove a
spammy log message that indicates when a redirect response is null (which just means its a normal load).
(WebCore::SubresourceLoader::didFinishLoading): Log when a finished load unexpectedly did not reach terminal state.
(WebCore::SubresourceLoader::notifyDone): Log when a load could not finish because the document loader was nullptr.
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay label style cleanup
https://bugs.webkit.org/show_bug.cgi?id=224240
Reviewed by BJ Burg.
Clean up grid overlay label styling by:
- Make all labels use a translucent background. This patch chooses a middle ground between the existing
translucent labels that matched the color of the rulers, and the solid white background used by line
numbers/names for maximum legibility.
- Bumping the label padding by 1px to improve legibility.
- Bumping the label arrow size by 2px to make it easier to understand where a label is pointing, particularly
for labels where the edge position is not `Middle`.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay track size labels should show implicit `auto` value and no computed size
https://bugs.webkit.org/show_bug.cgi?id=224199
Reviewed by BJ Burg.
Previously, implicit `auto` track sizes were only shown if there were some number of explicit track sizes for
that track direction (rows/columns). To resolve this, `authoredGridTrackSizes` now only returns explicit
authored track sizes, and buildGridOverlay then infers `auto` for all remaining tracks. This will also help
resolve bug 224200 by providing a way to distinguish explicit and implicit tracks.
After discussion, this patch also removes the computed size of tracks from labels, as that information is
available in the box model diagram for children elements and having that information in these labels further
cramped often limited space for overlay labels.
* inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes):
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay line numbers should not include implicit tracks in negative line number calculations.
https://bugs.webkit.org/show_bug.cgi?id=224200
Reviewed by BJ Burg.
Use the `authoredTrackColumnSizes`/`authoredTrackRowSizes` to determine if the line is an explicit grid line or
implicit grid line (starting with the patch for bug 224199 those vectors will only contain the explicit lines).
Only explicit lines should have a negative number for addressing the line, and those numbers should start with
the last explicit line. Because each track is bounded by two lines, there will always be one more explicit line
than there is explicit track, including the case where there are no explicit tracks, which will still have a
single explicit line numbered `-1`.
Additionally, line numbers are now separated by an em-space to improve legibility, where previously the bullet
looked like a multiplication symbol between two numbers.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Mike Gorse <mgorse@suse.com>
Build fails when video is disabled
https://bugs.webkit.org/show_bug.cgi?id=224198
Reviewed by Adrian Perez de Castro.
Add #if ENABLE(VIDEO) where needed.
* editing/markup.cpp:
(WebCore::createPageForSanitizingWebContent):
* page/Page.cpp:
* page/Page.h:
* platform/graphics/GraphicsContext.cpp:
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* 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/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/DisplayListRecorder.cpp:
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/win/GraphicsContextImplDirect2D.cpp:
* platform/graphics/win/GraphicsContextImplDirect2D.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
2021-04-06 Philippe Normand <pnormand@igalia.com>
REGRESSION(r275275): Broke some build configs lacking openh264
https://bugs.webkit.org/show_bug.cgi?id=224244
Unreviewed, manual revert of r275275 and r275409.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.cpp:
(WebCore::gstreamerSupportedH264Codecs):
(WebCore::supportedH264Formats): Deleted.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.h:
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
2021-04-06 Simon Fraser <simon.fraser@apple.com>
Shrink some IndexedDB-related classes
https://bugs.webkit.org/show_bug.cgi?id=224221
Reviewed by Geoffrey Garen.
Shrink some enum classes, and re-order data members to optimize packing in
IDBRequest and IDBKeyRangeData.
A couple of data members of IDBRequest were made private with protected setters.
This shrinks IDBRequest from 496 bytes to 448 bytes, and IDBKeyRangeData from 96
to 72 bytes on x86_64.
* Modules/indexeddb/IDBKeyData.h:
* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::IDBKeyRangeData):
* Modules/indexeddb/IDBKeyRangeData.h:
(WebCore::IDBKeyRangeData::IDBKeyRangeData):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
(WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::setReadyState):
(WebCore::IDBRequest::setShouldExposeTransactionToDOM):
* Modules/indexeddb/IndexedDB.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/shared/IDBCursorInfo.h:
* Modules/indexeddb/shared/IDBGetAllRecordsData.h:
2021-04-06 Ryosuke Niwa <rniwa@webkit.org>
Assert failure in isCloneInShadowTreeOfSVGUseElement
https://bugs.webkit.org/show_bug.cgi?id=224174
Reviewed by Darin Adler and Antti Koivisto.
The bug was caused by two related but distinct issues:
1. An element can have an instance that had been removed from a use element's shadow tree
but not yet deleted. Because SVGElement clears its correspondingElement in its destructor,
when addEventListener is called on such an element, it can try to add an event listener
on this instance which is in the process of getting disposed.
2. DOM mutation events can be fired on the corresponding element of an instance inside
a use element’s shadow tree with EventQueueScope in the stack when the event is schedueld
via Node::dispatchScopedEvent, e.g. because use element's shadow tree was updated during
a style update at the beginning of document.execComand. Because SVGUseElement::cloneTarget
constructs the shadow tree by cloning the original tree while it's disconnected from the
document, Node::dispatchSubtreeModifiedEvent sees isInShadowTree() to be false and happily
tries to dispach DOMSubtreeModified event using Node::dispatchScopedEvent. This works fine
when the event is dispatched synchronously since these elements had never been exposed to
any scripts yet and they are still disconnected so no scripts have had an opportunity to
attach an event listener. But when EventQueueScope in the stack, Node::dispatchScopedEvent
will queue up the event and fire it later when those instance elements had been inserted
into use element's shadow tree.
This patch addresses (1) by severing correspondingElement relationship as soon as an instance
is removed from its use element's shadow tree, and (2) by not dispatching a scheduled mutation
event if the target is inside a shadow tree. Note that this patch also addresses (2) for
a regular shadow tree attached by author scripts.
Tests: fast/shadow-dom/mutation-event-in-shadow-tree.html
svg/dom/mutate-symbol-subtree-referenced-by-use-during-execCommand.html
svg/dom/update-svg-use-shadow-tree-with-execCommand.html
* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::dispatchEvent const):
* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::removedFromAncestor):
(WebCore::SVGElement::addEventListener):
(WebCore::SVGElement::removeEventListener):
2021-04-06 Eric Carlson <eric.carlson@apple.com>
[Cocoa] audio played at 2x speed video is not pitch corrected
https://bugs.webkit.org/show_bug.cgi?id=224238
rdar://75868284
Reviewed by Jer Noble.
We need to use the _intended_ playback rate when deciding which pitch correction
algorithm to use. MediaPlayerPrivateAVFoundationObjC::m_cachedRate is used for this,
but r274592 stopped setting m_cachedRate in MediaPlayerPrivateAVFoundationObjC::setPlayerRate
because it is also set when AVPlayer KVOs that the rate changed.
Tested manually.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate): Set m_cachedRate.
2021-04-06 David Kilzer <ddkilzer@apple.com>
UBSan: RenderView.cpp:831:9: runtime error: load of value nnn, which is not a valid value for type 'bool'
<https://webkit.org/b/224157>
Reviewed by Darin Adler.
Tests: editing/inserting/insert-list-user-select-none-crash.html
fast/dom/clientWidthAfterDocumentIsRemoved.html
fast/scrolling/iframe-scrollable-after-back.html
fast/text/crash-font-family-parsed.html
html5lib/generated/run-template-write.html
imported/blink/plugins/renderless-plugin-creation-doesnt-crash-without-frame.html
imported/w3c/web-platform-tests/css/cssom-view/scrolling-no-browsing-context.html
imported/w3c/web-platform-tests/dom/ranges/Range-mutations-appendChild.html
imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.html
imported/w3c/web-platform-tests/html/semantics/forms/the-label-element/clicking-interactive-content.html
imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template.html
imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html
imported/w3c/web-platform-tests/selection/addRange-12.html
imported/w3c/web-platform-tests/shadow-dom/untriaged/html-elements-in-shadow-trees/html-forms/test-001.html
media/track/track-remove-crash.html
svg/custom/animate-reference-crash.html
* rendering/RenderView.h:
(WebCore::RenderView::m_wasAccumulatingRepaintRegion):
- Add default initialization.
2021-04-06 Jiewen Tan <jiewen_tan@apple.com>
WebCrypto in Safari will not AES-GCM encrypt 0 bytes
https://bugs.webkit.org/show_bug.cgi?id=224083
<rdar://75093377>
Reviewed by Youenn Fablet.
CommonCrypto will bail out both the encryption and decryption process if the dataOut is a null pointer.
To workaround the issue, this patch forces the dataOut to be a non-null pointer.
Test: crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html
* crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
(WebCore::encryptAES_GCM):
(WebCore::decyptAES_GCM):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay areas appear offset from their actual areas when the grid container has a border set
https://bugs.webkit.org/show_bug.cgi?id=224201
Reviewed by BJ Burg.
As of r274096, it is no longer correct to subtract the first track's position for either axis from the edge
lines of areas. This change resolves that, bringing this math in line with how other grid lines are laid out.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Alicia Boya García <aboya@igalia.com>
[GStreamer] At EOS, change position to match duration, not the other way around.
https://bugs.webkit.org/show_bug.cgi?id=224237
Reviewed by Philippe Normand.
The criteria used to check if playback has finished is currentTime >=
duration. Currently MediaPlayerPrivateGStreamer::didEnd() ensures this
in an awkward way: by changing the duration so that it matches
currentTime, rather than the other way around.
This meant a duration change at the end of playback most of the time,
with a slightly different duration each time, since currentTime is
cached periodically.
This patch reworks that function to work more naturally and less racy:
First, only if the stream doesn't have a set duration (e.g. live
stream), we set a duration to currentTime, as defined in the spec.
Second, at EOS we update currentTime to match duration, rather than
the other way around.
This patch doesn't introduce changes in test results.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
2021-04-06 Tyler Wilcock <twilco.o@protonmail.com>
Non-unified build fixes, early April 2021
https://bugs.webkit.org/show_bug.cgi?id=224091
Reviewed by Simon Fraser.
The SelectionRestorationMode enum has been moved out of Document.h so
the entirety of Document.h doesn't need to be included just for that
enum.
* Headers.cmake:
Add SelectionRestorationMode.h.
* WebCore.xcodeproj/project.pbxproj:
Add SelectionRestorationMode.h.
* dom/Document.h:
Move SelectionRestorationMode enum to its own file.
* dom/Element.h:
Add forward declaration for enum class SelectionRestorationMode. Rearrange
existing enum class forward declarations alphabetically.
* dom/SelectionRestorationMode.h: Added.
* dom/FocusOptions.h:
* history/CachedPage.cpp:
* html/HTMLFormControlElement.cpp:
* html/HTMLInputElement.h:
* html/HTMLLabelElement.cpp:
* html/HTMLLegendElement.cpp:
* html/HTMLTextAreaElement.h:
* html/InputType.cpp:
* page/EventHandler.cpp:
* page/FocusController.cpp:
Add #include "SelectionRestorationMode.h".
* workers/service/context/ServiceWorkerThreadProxy.cpp:
Add #include "ServiceWorkerGlobalScope.h" to fix:
ServiceWorkerThreadProxy.cpp:287:53: error: invalid use of incomplete type
'WTF::match_constness_t<WebCore::ScriptExecutionContext, WebCore::ServiceWorkerGlobalScope>'
{aka 'class WebCore::ServiceWorkerGlobalScope'}
2021-04-06 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Use opaque system colors for control backgrounds
https://bugs.webkit.org/show_bug.cgi?id=224131
<rdar://problem/75975709>
Reviewed by Tim Horton.
r274600 introduced the use of system colors for control backgrounds.
However, the system fill colors are not opaque, leading to poor
visibility on certain page/element backgrounds.
To fix, use an opaque variant of the system fill colors, as if they
were drawn on top of a white background. Note that UIKit does not
expose these opaque variants, leaving us to make the adjustments
ourselves.
* css/CSSValueKeywords.in:
Replace the system fill color keywords with opaque variants. The old
colors are fine to remove, since they were only introduced in r274600,
and have no external clients.
* css/html.css:
Replace all system fill colors with their opaque variants.
* rendering/RenderThemeIOS.mm:
(WebCore::cssValueSystemColorInformationList):
Renamed CSSValueIDAndSelector to CSSValueSystemColorInformation to
account for the addition of new fields to support opaque fill colors.
Storing the blendOverWhite and opacity fields in the list allows us
to resolve the color once and store it in a cache, rather than
applying the adjustments each time.
(WebCore::systemColorFromCSSValueSystemColorInformation):
Use the blendOverWhite and opacity information from the
CSSValueSystemColorInformation to determine the final color.
(WebCore::systemColorFromCSSValueID):
Call into systemColorFromCSSValueSystemColorInformation to avoid
duplicating logic.
(WebCore::RenderThemeIOS::cssValueToSystemColorMap):
(WebCore::RenderThemeIOS::systemColor):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::paintProgressBarWithFormControlRefresh):
(WebCore::RenderThemeIOS::paintMeter):
(WebCore::RenderThemeIOS::paintSliderTrackWithFormControlRefresh):
2021-04-06 Tadeu Zagallo <tzagallo@apple.com>
Handle OOM in ScriptExecutionContext::reportUnhandledPromiseRejection
https://bugs.webkit.org/show_bug.cgi?id=223777
<rdar://66271491>
Reviewed by Yusuke Suzuki.
It's possible to fail to allocate the error message in ScriptExecutionContext::reportUnhandledPromiseRejection,
in which case we should report an OOM exception instead of crashing.
Test: js/Promise-reject-large-string.html
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay does not honor writing modes and RTL layout direction.
https://bugs.webkit.org/show_bug.cgi?id=224127
Reviewed by BJ Burg.
Grid overlays did not previous honor writing modes and RTL layout direction correctly. The underlying math was
correct, but the 'origin' of the element's grid, and the direction in which rows and columns increased, was not
handled correctly. This patch resolves this by taking writing mode and direction into account when calculating
row/column line positions as well as correctly orienting layout label arrows based on the current writing
mode/direction.
Area names have been moved to the center of their respective areas, which both helps to make sure the label is
within the area for all writing modes/direction/transformation, as well as improved legibility on smaller grids
where area names were previously behind other labels.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::backgroundPathForLayoutLabel):
(WebCore::InspectorOverlay::drawLayoutLabel):
(WebCore::InspectorOverlay::drawGridOverlay):
- `backgroundPathForLayoutLabel`, `drawLayoutLabel`, and `drawGridOverlay` now interpret the `None` arrow direction
as using the label's location as its center, not top-left.
(WebCore::authoredGridTrackSizes):
- Drive-by removal of extra whitespace.
(WebCore::InspectorOverlay::buildGridOverlay):
- Use the element's computed style to determine writing mode and direction (which takes into account the `dir` attribute).
- Adjust columnLineAt and rowLineAt calculations based on writing mode and direction.
- Adjust all arrow directions and positions based on writing mode and direction.
2021-04-06 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Fix build of DiagnosticLoggingDomain.h
https://bugs.webkit.org/show_bug.cgi?id=224205
Reviewed by Don Olmstead.
No new tests, build fix only.
* page/DiagnosticLoggingDomain.h: Include wtf/EnumTraits.h
2021-04-06 Philippe Normand <pnormand@igalia.com>
REGRESSION(r274358) [GStreamer] http/tests/images/mp4-partial-load.html is flaky crashing inside GStreamer
https://bugs.webkit.org/show_bug.cgi?id=223636
Reviewed by Carlos Alberto Lopez Perez.
Ensure the GStreamer messages are always processed synchronously, even when the handler is
called from another thread. Without blocking in the latter case, the select-streams event
might be sent to decodebin too late. It has to be sent as a synchronous reaction to the
stream-collection message.
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
* platform/graphics/gstreamer/ImageDecoderGStreamer.h:
2021-04-06 Zalan Bujtas <zalan@apple.com>
[LFC][Integration] Enable inline box support (RenderInline)
https://bugs.webkit.org/show_bug.cgi?id=220148
<rdar://problem/72768785>
Reviewed by Antti Koivisto.
Use the modern line layout for content like <span>content inside an inline box</span>.
* layout/integration/LayoutIntegrationCoverage.cpp:
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GStreamer][WebRTC] Audio is not played from an audio element when the srcObject object has unstarted video tracks
https://bugs.webkit.org/show_bug.cgi?id=209163
Reviewed by Xabier Rodriguez-Calvar.
Ensure no MediaStream (active) video tracks can be added in a pipeline representing an <audio> element.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::sourceSetup):
(WebCore::MediaPlayerPrivateGStreamer::hasFirstSampleReachedSink const):
(WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChanged):
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
(webkitMediaStreamSrcPostStreamCollection):
(webkitMediaStreamSrcSetStream):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GTK][GStreamer] Web Audio - Media element source - Audio is cracking.
https://bugs.webkit.org/show_bug.cgi?id=196293
Reviewed by Xabier Rodriguez-Calvar.
The provider client might request samples faster than the current clock speed, so this sink
should process buffers as fast as possible. The cracks were consequence of the audio sink of
the AudioDestination starving off.
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GStreamer] Heap allocation exceptions
https://bugs.webkit.org/show_bug.cgi?id=224188
Reviewed by Xabier Rodriguez-Calvar.
The current GStreamer audio-related backends can't yet avoid heap allocations in the audio
thread, so we need exceptions for those cases.
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::provideInput):
* platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
(gstMemoryFastMallocNew):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GStreamer][MediaStream] AudioSource triggering critical warnings
https://bugs.webkit.org/show_bug.cgi?id=224180
Reviewed by Xabier Rodriguez-Calvar.
Keep track of audio channel offsets and store them as metadata in audio buffers. This is
used by downstream elements such as the audio convert elements.
* Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:
(WebCore::copyBusData):
(WebCore::MediaStreamAudioSource::consumeAudio):
2021-04-06 Antti Koivisto <antti@apple.com>
[LFC][Integration] Disable LFC if paginated context has inline boxes
https://bugs.webkit.org/show_bug.cgi?id=224222
Reviewed by Zalan Bujtas.
There are no known problems with this combination but it is untested.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
Pass in the RenderBlockFlow and move the existing test requiring it here too.
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2021-04-06 Keith Miller <keith_miller@apple.com>
CloneDeserializer should use ArrayBuffer::tryCreate
https://bugs.webkit.org/show_bug.cgi?id=224218
Reviewed by Antti Koivisto.
Right now CloneDeserializer assumes that every ArrayBuffer allocation during
deserialization will succeed. This is silly since it's an array-like object.
It should call tryCreate and fail the deserialization instead.
Test: fast/dom/Window/post-message-large-array-buffer-should-not-crash.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readArrayBuffer):
2021-04-06 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Change mediaControlsLocalizedStrings to use unicode escapes
https://bugs.webkit.org/show_bug.cgi?id=224195
Reviewed by Yusuke Suzuki.
* en.lproj/mediaControlsLocalizedStrings.js:
Switch from literal smart quotes to unicode escapes.
2021-04-06 Rob Buis <rbuis@igalia.com>
Migrate layout ascents and descents to LayoutUnits instead of ints
https://bugs.webkit.org/show_bug.cgi?id=133040
Reviewed by Zalan Bujtas.
Migrate layout ascents and descents to LayoutUnits instead of ints.
The actual ascent/descent values are still integral.
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
* rendering/InlineFlowBox.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::alignBoxesInBlockDirection):
(WebCore::setAscentAndDescent):
(WebCore::RootInlineBox::ascentAndDescentForBox const):
* rendering/RootInlineBox.h:
2021-04-06 Chris Lord <clord@igalia.com>
BidiContext caching is not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=224179
Reviewed by Darin Adler.
Make BidiContext ThreadSafeRefCounted and make shared context creation
thread-safe. This is needed by OffscreenCanvas to use text in Workers.
No new tests, covered by existing tests.
* platform/text/BidiContext.cpp:
(WebCore::BidiContext::create):
* platform/text/BidiContext.h:
2021-04-06 Frédéric Wang <fwang@igalia.com>
Nullptr crash in EventPath::eventTargetRespectingTargetRules
https://bugs.webkit.org/show_bug.cgi?id=222718
Reviewed by Ryosuke Niwa.
During executions of "undo" and "redo" commands, beforeinput and input events are dispatched
on root editable elements. It is however possible that these elements had been disconnected,
causing nullptr crash. This patch exits the command execution early if that's the case.
Test: editing/undo/undo-with-disconnected-editable-element-crash.html
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::areRootEditabledElementsConnected): Add helper function
to check whether m_startingRootEditableElement and m_endingRootEditableElement are still
connected.
(WebCore::EditCommandComposition::unapply): Exit early if root editable elements are no
longer connected. Put this after the layout update.
(WebCore::EditCommandComposition::reapply): Ditto.
* editing/CompositeEditCommand.h: Declare new helper function.
2021-03-24 Sergio Villar Senin <svillar@igalia.com>
[css-grid] Initialize auto-repeat data in RenderStyle in applyInitialGridTemplate{Columns|Rows}
https://bugs.webkit.org/show_bug.cgi?id=222852
Reviewed by Antti Koivisto.
We should initialize the auto repeat data (like auto repeat tracks or the insertion point) whenever
applyInitialGridTemplateXXX is called. That method is normally called using different RenderStyle's
but under some circumstances it might be the same. For those cases we wouldn't like to end up with
obsolete data from a previous style resolution.
The same applies also to the applyInheritGridTemplateXXX calls. We're also removing a duplicate call
to setGridAutoRepeat{Row|Column}sInsertionPoint() that is not needed at all.
In order to have a single place with all the style properties affecting columns and rows, all the set
calls were moved to a macro that is used by all the apply{Initial|Inherit}GridTemplate{Columns|Rows}
methods. This would allow us to prevent eventual out-of-sync issues like this one.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialGridTemplateColumns):
(WebCore::Style::BuilderCustom::applyInheritGridTemplateColumns):
(WebCore::Style::BuilderCustom::applyInitialGridTemplateRows):
(WebCore::Style::BuilderCustom::applyInheritGridTemplateRows):
2021-04-06 Rob Buis <rbuis@igalia.com>
Move synthesizedBaselineFromBorderBox to RenderBox
https://bugs.webkit.org/show_bug.cgi?id=224186
Reviewed by Javier Fernandez.
Move synthesizedBaselineFromBorderBox to RenderBox since there are
various call sites using it.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox): Deleted.
* rendering/RenderGrid.cpp:
(WebCore::synthesizedBaselineFromBorderBox): Deleted.
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in CSSSegmentedFontFace
https://bugs.webkit.org/show_bug.cgi?id=224167
Reviewed by Myles C. Maxfield.
Shrink FontRanges.m_ranges. This saves about 12KB on youtube.com.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges):
* platform/graphics/FontRanges.h:
(WebCore::FontRanges::shrinkToFit):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure we no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Darin Adler.
Add linked-on-after check for the behavior change to minimize the risk of
breakage.
* platform/cocoa/VersionChecks.h:
2021-04-05 Alex Christensen <achristensen@webkit.org>
Resurrect Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=224084
Reviewed by Tim Horton.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/mac/WebGLBlocklist.mm:
* platform/text/cocoa/LocalizedDateCache.h: Renamed from Source/WebCore/platform/text/ios/LocalizedDateCache.h.
* platform/text/cocoa/LocalizedDateCache.mm: Renamed from Source/WebCore/platform/text/ios/LocalizedDateCache.mm.
(WebCore::localizedDateCache):
(WebCore::_localeChanged):
(WebCore::LocalizedDateCache::LocalizedDateCache):
(WebCore::LocalizedDateCache::~LocalizedDateCache):
(WebCore::LocalizedDateCache::localeChanged):
(WebCore::LocalizedDateCache::formatterForDateType):
(WebCore::LocalizedDateCache::maximumWidthForDateType):
(WebCore::LocalizedDateCache::createFormatterForType):
(WebCore::LocalizedDateCache::calculateMaximumWidth):
* testing/cocoa/WebViewVisualIdentificationOverlay.mm:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in SVGPathByteStream
https://bugs.webkit.org/show_bug.cgi?id=224165
Reviewed by Said Abou-Hallawa.
On youtube.com, about 50KB of vector capacity is wasted in SVGPathByteStream,
so shrink them after parsing.
* svg/SVGPathByteStream.h:
(WebCore::SVGPathByteStream::shrinkToFit):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::parseToByteStream):
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in CSSVariableData
https://bugs.webkit.org/show_bug.cgi?id=224164
Reviewed by Anders Carlsson.
Shrink m_tokens. This saves 2.7MB on youtube.com.
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::CSSVariableData):
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION: ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() on various tests
https://bugs.webkit.org/show_bug.cgi?id=209450
<rdar://problem/60799255>
Reviewed by Tim Horton.
When running layout tests without idempotent text autosizing after layout tests with idempotent text autosizing
enabled, it's possible to get into a state where the text size adjustment timer (which is used to schedule
idempotent text autosizing style adjustments) is scheduled, but idempotent text autosizing is disabled before
the timer fires. This causes the assertion in `resetIdempotentTextAutosizingIfNeeded` to fail, leading to a
debug assertion.
To prevent this, we simply add a client method to call out to WebPage to stop its idempotent text autosizing
timer when the idempotent text autosizing WebCore setting changes to disabled.
This fixes assertions on these four tests, which are normally run after fast/text-autosizing:
- fast/text/control-characters/visible-control-characters-1.html
- fast/text/firstline/001.html
- fast/text-indicator/text-indicator-empty-link.html
- fast/text/basic/001.html
* page/ChromeClient.h:
(WebCore::ChromeClient::textAutosizingUsesIdempotentModeChanged):
Add the new chrome client hook (see WebKit2 change for more details).
* page/SettingsBase.cpp:
(WebCore::SettingsBase::textAutosizingUsesIdempotentModeChanged):
Replace the existing settings change handler (`setNeedsRecalcStyleInAllFrames`) with a custom change handler
(`textAutosizingUsesIdempotentModeChanged`) that invokes the client hook above, in addition to flagging all
frames for a style recalc.
* page/SettingsBase.h:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Shrink the Vector<> of keyframe values
https://bugs.webkit.org/show_bug.cgi?id=224154
Reviewed by Sam Weinig.
The Vector<double> returned by CSSParserImpl::consumeKeyframeKeyList()
wasted 152KB of vector capacity on nytimes.com pages, so shrink it.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeKeyframeKeyList):
2021-04-05 Zalan Bujtas <zalan@apple.com>
No need to update the list marker number during internal move (e.g. result of anonymous collapsing)
https://bugs.webkit.org/show_bug.cgi?id=224142
<rdar://76101241>
Reviewed by Antti Koivisto.
Let's not update the marker numbers when the reason for re-parenting is "internal move"
which means the renderer's insertion point remains the same (e.g collapsing its anonymous parent).
* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertedIntoTree):
(WebCore::RenderElement::willBeRemovedFromTree):
* rendering/RenderElement.h:
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::insertedIntoTree):
(WebCore::RenderFragmentContainer::willBeRemovedFromTree):
* rendering/RenderFragmentContainer.h:
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::insertedIntoTree):
(WebCore::RenderListItem::willBeRemovedFromTree):
* rendering/RenderListItem.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::willBeRemovedFromTree):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::insertedIntoTree):
(WebCore::RenderObject::willBeRemovedFromTree):
* rendering/RenderObject.h:
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::insertedIntoTree):
(WebCore::RenderQuote::willBeRemovedFromTree):
* rendering/RenderQuote.h:
* rendering/RenderTableCaption.cpp:
(WebCore::RenderTableCaption::insertedIntoTree):
(WebCore::RenderTableCaption::willBeRemovedFromTree):
* rendering/RenderTableCaption.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::willBeRemovedFromTree):
* rendering/RenderTableCell.h:
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::insertedIntoTree):
(WebCore::RenderTableCol::willBeRemovedFromTree):
* rendering/RenderTableCol.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::willBeRemovedFromTree):
* rendering/RenderTableRow.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::willBeRemovedFromTree):
* rendering/RenderTableSection.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::insertedIntoTree):
(WebCore::RenderSVGRoot::willBeRemovedFromTree):
* rendering/svg/RenderSVGRoot.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):
(WebCore::RenderTreeBuilder::move):
(WebCore::RenderTreeBuilder::detachFromRenderElement):
* rendering/updating/RenderTreeBuilder.h:
2021-04-05 Alex Christensen <achristensen@webkit.org>
WebSocketChannel buffers use memory after going idle (64K wasted on facebook.com
https://bugs.webkit.org/show_bug.cgi?id=224193
Reviewed by Simon Fraser.
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processFrame):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure the Frame always gets destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=224213
<rdar://75131946>
Reviewed by Alex Christensen.
Make sure the Frame always gets destroyed on the main thread.
Since http://trac.webkit.org/changeset/181791, Frame is ThreadSafeRefCounted and captured
on other threads. We should make sure the Frame is always destroyed on the main thread
though, since it is a main thread object and we hold WeakPtrs to it in many places.
* page/AbstractFrame.h:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in FEColorMatrix and filters
https://bugs.webkit.org/show_bug.cgi?id=224169
Reviewed by Said Abou-Hallawa.
When building filter effects, avoid the inputEffects() having a larger
capacity than needed.
Shrink the Vector<float> which is input to FEColorMatrix.
This saves around 40KB on facebook.com feed pages.
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::FEColorMatrix):
(WebCore::FEColorMatrix::create):
* platform/graphics/filters/FEColorMatrix.h:
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::build):
(WebCore::endMatrixRow): Deleted.
(WebCore::lastMatrixRow): Deleted.
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
* svg/SVGFEColorMatrixElement.cpp:
(WebCore::SVGFEColorMatrixElement::build const):
* svg/SVGFEComponentTransferElement.cpp:
(WebCore::SVGFEComponentTransferElement::build const):
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::build const):
* svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::build const):
* svg/SVGFEDropShadowElement.cpp:
(WebCore::SVGFEDropShadowElement::build const):
* svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::build const):
* svg/SVGFEMergeElement.cpp:
(WebCore::SVGFEMergeElement::build const):
* svg/SVGFEMorphologyElement.cpp:
(WebCore::SVGFEMorphologyElement::build const):
* svg/SVGFEOffsetElement.cpp:
(WebCore::SVGFEOffsetElement::build const):
* svg/SVGFESpecularLightingElement.cpp:
(WebCore::SVGFESpecularLightingElement::build const):
* svg/SVGFETileElement.cpp:
(WebCore::SVGFETileElement::build const):
2021-04-05 Saam Barati <sbarati@apple.com>
Enable QuotaExceededError on non GSTREAMER platforms
https://bugs.webkit.org/show_bug.cgi?id=224136
<rdar://71219720>
Reviewed by Jer Noble.
This fixes a memory leak in Disney+ where we end up queuing up the entire
video because we never communicate to the page that they should stop queuing
more data.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferInternal):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure service workers use a ScriptSourceCode backed by file-mapped memory when possible
https://bugs.webkit.org/show_bug.cgi?id=224088
Reviewed by Yusuke Suzuki.
To run a worker, we were constructing a ScriptSourceCode from the source String and calling
JSC::evaluate. ScriptSourceCode would construct a JSC::StringSourceProvider, which would
keep the source String alive for the lifetime of the provider. This is problematic since
those worker scripts may be big and keeping heap-allocated version of them in memory is
expensive.
To address the issue, this patch introduces a new JSC::SourceProvider subclass named
ScriptBufferSourceProvider, which uses a ScriptBuffer internally. ScriptBuffer has the
benefit of being able to hold file-mapped data. We only convert the ScriptBuffer to
a String whenever necessary (When the script contains non-ascii characters and JSC
requests a StringView to the script). If we do end up converting the ScriptBuffer to
a String, this String will get cleared on memory pressure. This is similar to what
CachedScriptSourceProvider / CachedScript do on the main thread.
In the warm case, where the service worker script is coming from disk, we create
the ScriptBufferSourceProvider right away from a file-mapped ScriptBuffer, thus
greatly reducing dirty memory use. In the cold case, we initially construct the
ScriptBufferSourceProvider using a ScriptBuffer that is not file-mapped. However,
once the script is saved to disk (via SWScriptStorage), we replace the
ScriptBufferSourceProvider's ScriptBuffer with the new file-mapped version in
order to reduce dirty memory use in this case too.
* WebCore.xcodeproj/project.pbxproj:
Add ScriptBufferSourceProvider.h to the project.
* bindings/js/ScriptBufferSourceProvider.h: Added.
- Add new ScriptBufferSourceProvider, which is a JSC::SourceProvider subclass that
uses a ScriptBuffer as backing instead of a String. This allows us to use file-mapped
memory whenever possible, thus reducing dirty memory use. This provider provides
similar functionality to CachedScriptSourceProvider / CachedScript but works with
a ScriptBuffer and can be used off the main thread.
- We only transform the SharedBuffer into a String when strictly necessary, meaning
that the ScriptBuffer contains non-ascii characters and JSC is asking for a StringView
to the script.
- The class supports clearing the String copy of the script (done on memory pressure)
and replacing the ScriptBuffer (with a new file-mapped version).
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::m_code):
(WebCore::ScriptSourceCode::provider):
Add new constructors taking a ScriptBuffer instead of a String for the source code.
We then use the new ScriptBufferSourceProvider internally instead of the
StringSourceProvider.
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
* workers/DedicatedWorkerThread.h:
Use ScriptBuffer instead of String.
* workers/ScriptBuffer.cpp:
(WebCore::ScriptBuffer::empty):
(WebCore::ScriptBuffer::append):
(WebCore::operator!=):
* workers/ScriptBuffer.h:
(WebCore::ScriptBuffer::isEmpty const):
Add some functionality to SCriptBuffer to make it more convenient to use.
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
Convert ScriptBuffer to a String since this is what WebInspector expects.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::importScripts):
- When importing a new script, we now construct a ScriptSourceCode from a
ScriptBuffer instead of a String.
- We also store a weak pointer to the ScriptBufferSourceProvider used by the ScriptSourceCode
on the WorkerGlobalScope. This is so that we can ask those ScriptBufferSourceProvider objects
to clear their cached String representation of the script source on memory pressure. It is
also needed so we can replace the ScriptBufferSourceProvider's ScriptBuffer with a file-mapped
version when one becomes available.
(WebCore::WorkerGlobalScope::releaseMemory):
In addition to deleting JS code and doing garbage collection, we now also ask the
ScriptBufferSourceProvider objects to clear their cached String representation of the script
source.
(WebCore::WorkerGlobalScope::deleteJSCodeAndGC):
Moved the logic to delete JS code and doing GC from releaseMemory() to a new function, now
that releaseMemory() needs to do more things.
(WebCore::WorkerGlobalScope::setMainScriptSourceProvider):
(WebCore::WorkerGlobalScope::addImportedScriptSourceProvider):
Functions used to store the CachedScriptSourceProvider objects for the scripts used by the
worker on the WorkerGlobalScope. We keep weak pointers to those.
(WebCore::WorkerGlobalScope::clearDecodedScriptData):
Function used to ask the ScriptBufferSourceProvider objects to clear their cached String
representation of the script source on memory pressure.
(WebCore::WorkerGlobalScope::updateSourceProviderBuffers):
Function used to ask the ScriptBufferSourceProvider objects to replace their ScriptBuffers
with file-backed versions.
* workers/WorkerGlobalScope.h:
* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
Use ScriptBuffer instead of String.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::WorkerScriptLoader):
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::didReceiveData):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::script):
Use ScriptBuffer instead of String to hold the script source. We eventually need a ScriptBuffer
since this is what the Worker now needs to launch. Also, in the service worker case, we may
get a ScriptBuffer right away from the scriptResourceMap, without going to the network at all.
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
Use ScriptBuffer instead of String.
(WebCore::WorkerThread::evaluateScriptIfNecessary):
- When evaluating the main worker script, we now construct a ScriptSourceCode from a
ScriptBuffer instead of a String.
- We also store a weak pointer to the ScriptBufferSourceProvider used by the ScriptSourceCode
on the WorkerGlobalScope. This is so that we can ask those ScriptBufferSourceProvider objects
to clear their cached String representation of the script source on memory pressure. It is
also needed so we can replace the ScriptBufferSourceProvider's ScriptBuffer with a file-mapped
version when one becomes available.
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerFetchResult.h:
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerJobClient.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
Use ScriptBuffer instead of String.
2021-04-05 Fujii Hironori <Hironori.Fujii@sony.com>
[Win][WK2] Implement IPC::Semaphore to run WebGL in GPU process
https://bugs.webkit.org/show_bug.cgi?id=224014
Reviewed by Don Olmstead.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::sharedDisplay): GPU process calls this
function in IPC thread. Removed the assertion checking the main
thread.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::createForGPUProcess): Added.
2021-04-05 Cameron McCormack <heycam@apple.com>
Fix max-content on tables with percentage cell widths.
https://bugs.webkit.org/show_bug.cgi?id=221165
Reviewed by Zalan Bujtas.
When `width: max-content` is specified on an element, any percentages
on content inside the element that are relative to the containing block
width should be treated as auto. Percentages on table cells and columns
in tables using auto table layout are not quite relative to the
containing block width, but do have a similar influence. So when
computing the intrinsic width of a table for the purpose of determining
the max-content value to use, ignore any percentages specified on table
cells and columns.
This change makes us match Firefox and Chrome on the test case.
Test: fast/table/percent-width-max-content.html
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
* rendering/AutoTableLayout.h:
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::computeIntrinsicLogicalWidths):
* rendering/FixedTableLayout.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): Call
into the new computeIntrinsicKeywordLogicalWidths function so that
tables can return different values for layout and intrinsic keyword
calculation.
* rendering/RenderBox.h:
(WebCore::RenderBox::computeIntrinsicKeywordLogicalWidths const):
Added to support computing intrinsic keyword lengths that differ from
those returned by computeIntrinsicLogicalWidths.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeIntrinsicLogicalWidths const): Factored
this out to allow specifying an argument for whether the intrinsics
being computed are for layout or for instrinsic keyword calculation,
like max-content.
(WebCore::RenderTable::computeIntrinsicKeywordLogicalWidths const):
Added. This is the only override of the default implementation in
RenderBox.
* rendering/RenderTable.h:
* rendering/TableLayout.h:
2021-04-05 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 1: Require encoding/decoding delegates for non-inline display list items
https://bugs.webkit.org/show_bug.cgi?id=223849
Reviewed by Wenson Hsieh.
Requiring delegates for non-inline display list items has these advantages:
- DisplayList::Iterator::updateCurrentItem() only has 2 codepaths instead of 3.
- ItemBuffer::m_itemsToDestroyInAllocatedBuffers can be deleted entirely.
- The conditional inside ItemBuffer::append() can be simplified from
!T::isInlineItem && m_writingClient to just !T::isInlineItem, which I think makes the
function significantly more readable.
There are a few places where we were using non-inline display list items without a delegate:
This patch adds two new "null" delegates, and hooks them up to a subclass of DisplayList,
called InMemoryDisplayList. Clients who want to use in-memory display lists (like the
DrawGlyphs cache) can just use this class, and retain their calling pattern they were using
before. Also, this patch adds InMemoryDisplayList without adding any virtual functions to
DisplayList.
No new tests because there is no behavior change.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLCanvasElement.cpp:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::displayListForTextRun):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::platformCALayerPaintContents):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem):
* platform/graphics/displaylists/DisplayListDrawingContext.h:
(WebCore::DisplayList::DrawingContext::replayedDisplayList const):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::ImageBuffer):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::copyInto):
(WebCore::DisplayList::ItemBuffer::ItemBuffer):
(WebCore::DisplayList::ItemBuffer::operator=):
(WebCore::DisplayList::ItemBuffer::clear):
(WebCore::DisplayList::ItemBuffer::append):
(WebCore::DisplayList::m_allocatedBuffers): Deleted.
* platform/graphics/displaylists/DisplayListItemBuffer.h:
(WebCore::DisplayList::ItemHandle::get const):
(WebCore::DisplayList::ItemBufferWritingClient::~ItemBufferWritingClient):
(WebCore::DisplayList::ItemBufferWritingClient::createItemBuffer):
(WebCore::DisplayList::ItemBufferWritingClient::requiredSizeForItem const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemOutOfLine const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemInline const):
(WebCore::DisplayList::ItemBufferWritingClient::didAppendData):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):
* platform/graphics/displaylists/DisplayListReplayer.h:
* platform/graphics/displaylists/InMemoryDisplayList.cpp: Added.
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::requiredSizeForItem const):
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::encodeItemInline const):
(WebCore::DisplayList::InMemoryDisplayList::ReadingClient::decodeItem):
(WebCore::DisplayList::InMemoryDisplayList::InMemoryDisplayList):
(WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):
* platform/graphics/displaylists/InMemoryDisplayList.h: Copied from Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h.
* rendering/GlyphDisplayListCache.h:
2021-04-05 Jer Noble <jer.noble@apple.com>
[MediaSession] Small refactoring of MediaSession implementation classes
https://bugs.webkit.org/show_bug.cgi?id=224141
Reviewed by Eric Carlson.
A smorgasboard of small refactoring changes:
- Don't call action handlers by default in response to coordinator requests.
- Since we don't call the action handlers, we don't need the internal methods.
- Simplify the call site by defining the action details inline.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::seekSessionToTime):
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::pauseSession):
(WebCore::MediaSessionCoordinator::setSessionTrack):
(WebCore::MediaSessionCoordinator::internalSeekTo): Deleted.
(WebCore::MediaSessionCoordinator::internalPlay): Deleted.
(WebCore::MediaSessionCoordinator::internalPause): Deleted.
(WebCore::MediaSessionCoordinator::internalSetTrack): Deleted.
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
2021-04-05 Yusuke Suzuki <ysuzuki@apple.com>
Define AtomString(ASCIILiteral) and use ASCIILiteral more to avoid memory allocation
https://bugs.webkit.org/show_bug.cgi?id=224125
Reviewed by Saam Barati.
We apply "..."_s more. This avoids allocating of string storage when creating StringImpl.
* accessibility/AccessibilityObject.cpp:
(WebCore::initializeRoleMap):
* dom/ScriptElement.cpp:
(WebCore::isLegacySupportedJavaScriptLanguage):
* editing/EditorCommand.cpp:
(WebCore::createCommandMap):
* html/Autofill.cpp:
(WebCore::fieldNameMap):
* platform/LegacySchemeRegistry.cpp:
(WebCore::builtinLocalURLSchemes):
(WebCore::builtinSecureSchemes):
(WebCore::builtinSchemesWithUniqueOrigins):
(WebCore::builtinEmptyDocumentSchemes):
(WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
(WebCore::builtinCORSEnabledSchemes):
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::systemPreviewMIMETypes):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::hasValidAverageCharWidth const):
* platform/graphics/HEVCUtilities.cpp:
(WebCore::codecStringForDoViCodecType):
(WebCore::profileIDForAlphabeticDoViProfile):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList):
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
(WebCore::AVAssetMIMETypeCache::staticContainerTypeList):
* platform/graphics/cg/ImageSourceCGWin.cpp:
(WebCore::preferredExtensionForImageType):
* svg/SVGTests.cpp:
(WebCore::supportedSVGFeatures):
2021-04-02 Ryosuke Niwa <rniwa@webkit.org>
PendingImageBitmap gets created on a stopped script execution context.
https://bugs.webkit.org/show_bug.cgi?id=223971
Reviewed by Youenn Fablet.
Don't create a PendingImageBitmap in PendingImageBitmap::fetch
if the associated script execution context had already been stoppped.
The new behavior matches of Chrome although it's technically incorrect.
Correcting it to match the spec & Firefox will refactor a larger fix around
how script execution context is used by the threaded loader.
* html/ImageBitmap.cpp:
(WebCore::PendingImageBitmap::fetch):
2021-04-02 Alexey Shvayka <shvaikalesh@gmail.com>
Remove [Replaceable] extended attribute from `document.all`
https://bugs.webkit.org/show_bug.cgi?id=223883
Reviewed by Darin Adler.
[Replaceable] semantics was introduced around 2003 to work around a web-compat issue.
Since then, `document.all` was revised multiple times and standardized as [[IsHTMLDDA]]
object without a setter, which was proven to be compatible with the web.
This patch aligns WebKit with the spec [1], Blink, and Gecko.
iOS apps are unlikely to accidentally depend on subtleties in `document.all` behavior since
they were authored long after it became obsolete.
Old versions of libraries, originally designed for the web, are also unlikely to rely on
previous behavior, because `document.all` was never replaceable in some popular browsers.
[1] https://html.spec.whatwg.org/multipage/obsolete.html#Document-partial
Tests: fast/dom/undetectable-document-all.html
imported/w3c/web-platform-tests/html/dom/idlharness.https.html
* dom/Document+HTMLObsolete.idl:
2021-04-02 Chris Dumez <cdumez@apple.com>
Introduce ScriptBuffer class to wrap SharedBuffer containing a script
https://bugs.webkit.org/show_bug.cgi?id=224092
Reviewed by Yusuke Suzuki and Geoff Garen.
Introduce ScriptBuffer class to wrap SharedBuffer containing a script. We started using SharedBuffer to represent
worker scripts instead of String, so that they can hold file mapped data and be shared across processes.
This patch introduces a new ScriptBuffer to wrap those SharedBuffers. The type makes it clearer what type of
data we're dealing with. The helper functions used to convert between String and SharedBuffer can now simply
be member functions on ScriptBuffer. This also simplifies IPC code.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new ScriptBuffer class to project files.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
Use ScriptBuffer::toString() instead of scriptBufferToString().
* workers/ScriptBuffer.cpp: Added.
(WebCore::ScriptBuffer::ScriptBuffer):
(WebCore::ScriptBuffer::toString const):
(WebCore::ScriptBuffer::containsSingleFileMappedSegment const):
(WebCore::operator==):
* workers/ScriptBuffer.h: Added.
(WebCore::ScriptBuffer::ScriptBuffer):
(WebCore::ScriptBuffer::buffer const):
(WebCore::ScriptBuffer::isolatedCopy const):
(WebCore::ScriptBuffer::operator bool const):
New ScriptBuffer class that wraps a SharedBuffer representation of a script.
This class helps make it clear what data we're dealing with. It also facilitates
conversion to and from a String when needed. The class also has its own IPC
coder at WebKit layer to encode the script as a ShareableResource when file
mapped.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
Use ScriptBuffer::toString() instead of scriptBufferToString().
And use StringBuffer constructor that takes a String instead of stringToScriptBuffer().
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::encode const):
(WebCore::ServiceWorkerContextData::ImportedScript::decode):
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
- Use ScriptBuffer instead of RefPtr<SharedBuffer> for scripts.
- Drop scriptBufferToString() & stringToScriptBuffer() as they are no longer needed.
- Move IPC coders for ServiceWorkerContextData back from WebCoreArgumentCoders back
to the WebCore class, now that the coders no longer need to deal with ShareableResource
directly. We now encode / decode ScriptBuffer objects and its coder takes care of
using a ShareableResource whenever possible.
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::didSaveScriptsToDisk):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::didSaveScriptsToDisk):
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::didSaveWorkerScriptsToDisk):
* workers/service/server/RegistrationStore.h:
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):
(WebCore::SWScriptStorage::retrieve):
* workers/service/server/SWScriptStorage.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::didSaveWorkerScriptsToDisk):
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::didSaveScriptsToDisk):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::script const):
Use ScriptBuffer instead of SharedBuffer.
2021-04-02 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r275434.
Need to figure out a better strategy to chose the color
Reverted changeset:
"Make sure we are no longer show the previous page when
running a JS prompt"
https://bugs.webkit.org/show_bug.cgi?id=215782
https://commits.webkit.org/r275434
2021-04-02 Simon Fraser <simon.fraser@apple.com>
Allow wheel events to trigger high frequency DisplayLinks
https://bugs.webkit.org/show_bug.cgi?id=224095
Reviewed by Sam Weinig.
Adjust some logging so it's clear which process code is running in.
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayLinkFired):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::ensureMonitorForDisplayID):
2021-04-02 David Kilzer <ddkilzer@apple.com>
UBSan: AlternativeTextController::dismiss()/dismissSoon(): runtime error: load of value nnn, which is not a valid value for type 'bool'
<https://webkit.org/b/223903>
Reviewed by Wenson Hsieh.
Covered by 449 layout tests using WebKit compiled with UBSan.
* editing/AlternativeTextController.h:
- Initialize m_isActive and m_isDismissedByEditing.
2021-04-02 Chris Dumez <cdumez@apple.com>
Make sure we are no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Simon Fraser.
Add linked-on-after check for the behavior change to minimize the risk of
breakage.
* platform/cocoa/VersionChecks.h:
2021-04-02 Devin Rousso <drousso@apple.com>
[iPadOS] unable to reorder tabs on `*.mybinder.org`
https://bugs.webkit.org/show_bug.cgi?id=224034
<rdar://problem/51770057>
Reviewed by Brent Fulgham.
* page/Quirks.h:
* page/Quirks.cpp:
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
Modify `Quirks::shouldDispatchSimulatedMouseEvents` to accept an `EventTarget` so that we
can limit dispatching touch events as mouse events on `*.mybinder.org` to only the tab bar.
* dom/EventNames.h:
(WebCore::EventNames::isTouchRelatedEventType const):
* dom/Node.cpp:
(WebCore::Node::moveNodeToNewDocument):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
(WebCore::Node::defaultEventHandler):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
Pass in the `EventTarget` when calling `Quirks::shouldDispatchSimulatedMouseEvents`.
2021-04-02 Zalan Bujtas <zalan@apple.com>
[AspectRatio] Out-of-flow box with intrinsic width (e.g. <img>) may trigger infinite recursion
https://bugs.webkit.org/show_bug.cgi?id=224113
Reviewed by Rob Buis.
This covers the case when the out-of-flow box has intrinsic width (replaced box) and
the max-width is also set to "intrinsic" meaning content size dependent. In such cases
the aspect ratio computation ends up recursing around RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth.
This path checks if the out-of-flow box's horizontal size is also constrained by the intrinsic width.
Test: fast/replaced/infinite-recursion-with-intrinsic-width.html
* rendering/RenderBox.cpp:
(WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
2021-04-02 Chris Dumez <cdumez@apple.com>
Delete JS code and trigger garbage collection in worker threads on memory pressure
https://bugs.webkit.org/show_bug.cgi?id=224110
Reviewed by Geoffrey Garen.
Delete JS code and trigger garbage collection in worker threads on memory pressure,
to release as much memory as possible. We were previously only doing this in the
common (main thread) VM.
For the garbage collection logic, I tried to match what the GCController is doing
for the commonVM but apply it to worker VMs.
* page/MemoryRelease.cpp:
(WebCore::releaseCriticalMemory):
* workers/WorkerGlobalScope.cpp:
(WebCore::allWorkerGlobalScopeIdentifiers):
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::releaseMemory):
(WebCore::WorkerGlobalScope::releaseMemoryInWorkers):
* workers/WorkerGlobalScope.h:
2021-04-02 Aditya Keerthi <akeerthi@apple.com>
Do not paint native decorations for search fields without '-webkit-appearance: searchfield'
https://bugs.webkit.org/show_bug.cgi?id=223946
<rdar://problem/75621365>
Reviewed by Antti Koivisto.
On iOS, sites that use <input type="search"> have been observed to draw
their own icons next to the field. Since we draw our own icon for
search fields, this results in an unwanted icon on some sites, such as
on chanel.com. However, in this case, the site specifies
"-webkit-appearance: textfield" on the search input, indicating a desire
to remove the native search field appearance. To remove the unwanted
icon, we should not paint decorations for search fields without
"-webkit-appearance: searchfield".
To achieve this behavior, adjust the -webkit-appearance value on the
pseudo element containing the icon when the search field has a different
-webkit-appearance value, so that the native painting is elided. The
decision to not simply set "display: none" on the element was made so
that sites can still customize the decoration should they choose to do
so. Note that on macOS, Web Inspector paints their own search icon
using the pseudo element.
No new tests. A layout test is not possible since SearchFieldResultsButtonElement
is inaccessible through DOM APIs. A reference mismatch test is not
possible since changing the -webkit-appearance property on a search field
already results in visual changes. Existing tests were rebaselined to
account for the fact that the decoration is removed when changing
-webkit-appearance, so we do have test coverage.
* html/HTMLElement.h:
(WebCore::HTMLElement::isSearchFieldResultsButtonElement const):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
(WebCore::SearchFieldResultsButtonElement::resolveCustomStyle):
If the searchfield's appearance is not "searchfield", adjust the
appearance of the results button to NoControlPart. For compatibility
reasons, the adjustment is skipped if the author has specified the
results attribute on the searchfield. This is determined by checking
the maxResults of the input element.
If the adjustment needs to be performed, we elide standard style
adjustments from the theme by setting canAdjustStyleForAppearance to
false. Without this, the call to resolveStyle will apply native styles
to the element, since it does not know we are about to reset appearance.
* html/shadow/TextControlInnerElements.h:
(isType):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::adjustSearchFieldDecorationStyle const):
Skip style adjustment and reset the appearance when necessary.
* rendering/RenderTheme.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
Resolve all descendants if the appearance property of a search input is
changed. Without this change, the style of the results button is not
resolved when making a dynamic style change to the appearance of the
search input.
2021-04-02 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-04-02 Tyler Wilcock <twilco.o@protonmail.com>
Non-unified build fixes, early April 2021
https://bugs.webkit.org/show_bug.cgi?id=224091
Reviewed by Alex Christensen.
Non-unified build fixes, April 2021.
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
For IDLs that have a property with a type of `undefined`, also add #include "JSDOMConvertBase.h" to
the generated binding source file. This fixes a build error in
DerivedSources/JSWebGLLoseContext.cpp that looked like:
WebCore/DerivedSources/JSWebGLLoseContext.cpp:147:78: error: expected primary-expression before ‘>’ token
RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); })));
Thanks to Darin Adler for figuring this out.
To see the full error, go here: https://bugs.webkit.org/show_bug.cgi?id=223150#c14
* dom/EventContext.h:
* dom/FocusOptions.h:
* loader/ResourceLoadInfo.cpp:
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
* platform/network/soup/SoupNetworkSession.cpp:
* rendering/RenderLayerModelObject.cpp:
* style/Styleable.cpp:
* workers/service/server/SWScriptStorage.cpp:
* workers/service/server/SWScriptStorage.h:
* Modules/mediastream/RTCDataChannelRemoteSource.h:
Fix 'invalid use of incomplete type <TYPE>' or '<TYPE> does not name a type' errors.
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
* bindings/scripts/test/JS/JSTestCallbackInterface.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:
* bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
Update bindings via `run-bindings-tests --reset-results` to add new "JSDOMConvertBase.h" include.
2021-04-02 Chris Lord <clord@igalia.com>
Implement text rendering on OffscreenCanvas in a Worker
https://bugs.webkit.org/show_bug.cgi?id=202793
Reviewed by Darin Adler.
Add a CSSFontSelector and FontCache to WorkerGlobalScope and via
interface changes to ScriptExecutionContext and FontSelector, use them
as appropriate after enabling text functions on Worker threads with
OffscreenCanvas.
No new tests, rebaselined existing tests.
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::m_version):
(WebCore::CSSFontSelector::~CSSFontSelector):
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::fallbackFontAt):
* css/CSSFontSelector.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::genericFontFamily):
(WebCore::CSSPropertyParserHelpers::genericFontFamilyIndex):
* css/parser/CSSPropertyParserHelpers.h:
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::fontCache):
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::cssFontSelector):
* dom/make_names.pl:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::canDrawText):
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::setFont):
* platform/graphics/FontCache.cpp:
(WebCore::FontDataCacheKeyHash::hash):
(WebCore::FontDataCacheKeyHash::equal):
(WebCore::FontDataCacheKeyTraits::emptyValue):
(WebCore::FontDataCacheKeyTraits::constructDeletedValue):
(WebCore::FontDataCacheKeyTraits::isDeletedValue):
(WebCore::FontCache::create):
(WebCore::FontCache::singleton):
(WebCore::FontCache::FontCache):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::fontForPlatformData):
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::verticalData):
(WebCore::FontCache::fontCount):
(WebCore::FontCache::inactiveFontCount):
(WebCore::FontCache::invalidate):
* platform/graphics/FontCache.h:
(WebCore::FontCache::fontCacheFallbackToSingleton):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::isCurrent const):
(WebCore::FontCascade::update const):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::FontCascadeFonts):
(WebCore::realizeNextFallback):
(WebCore::FontCascadeFonts::realizeFallbackRangesAt):
* platform/graphics/FontSelector.h:
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::getFamilyNameStringFromFamily):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueFontFamily):
* style/StyleResolveForFontRaw.cpp:
(WebCore::Style::useFixedDefaultSize):
(WebCore::Style::resolveForFontRaw):
* style/StyleResolveForFontRaw.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::cssFontSelector):
(WebCore::WorkerGlobalScope::fontCache):
* workers/WorkerGlobalScope.h:
2021-04-02 Youenn Fablet <youenn@apple.com>
No audio output when unplugged wired headset during a call
https://bugs.webkit.org/show_bug.cgi?id=216389
<rdar://problem/68692800>
Reviewed by Eric Carlson.
Implement shouldOverridePauseDuringRouteChange for media elements.
If it is a media stream backed video element, do not pause on active audio route change.
Implement internal API to write a layout test.
Refactoring to share more code between WebCore and WebKit and implement the internal API.
Improve isolation of MediaSessionHelper by moving all its members from protected to private.
Test: fast/mediastream/MediaStream-video-element-change-audio-route.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverridePauseDuringRouteChange const):
* html/HTMLMediaElement.h:
* platform/audio/ios/MediaSessionHelperIOS.h:
(WebCore::MediaSessionHelper::MediaSessionHelper):
* platform/audio/ios/MediaSessionHelperIOS.mm:
(MediaSessionHelper::activeAudioRouteDidChange):
(MediaSessionHelper::applicationWillEnterForeground):
(MediaSessionHelper::applicationDidEnterBackground):
(MediaSessionHelper::applicationWillBecomeInactive):
(MediaSessionHelper::applicationDidBecomeActive):
(MediaSessionHelper::mediaServerConnectionDied):
(MediaSessionHelper::externalOutputDeviceAvailableDidChange):
(MediaSessionHelper::isPlayingToAutomotiveHeadUnitDidChange):
(MediaSessionHelper::activeVideoRouteDidChange):
(MediaSessionHelper::startMonitoringWirelessRoutes):
(MediaSessionHelper::stopMonitoringWirelessRoutes):
(MediaSessionHelperiOS::MediaSessionHelperiOS):
(MediaSessionHelperiOS::startMonitoringWirelessRoutesInternal):
(MediaSessionHelperiOS::stopMonitoringWirelessRoutesInternal):
(MediaSessionHelperiOS::mediaServerConnectionDied):
(MediaSessionHelperiOS::setIsPlayingToAutomotiveHeadUnit):
(MediaSessionHelperiOS::activeAudioRouteDidChange):
(MediaSessionHelperiOS::activeVideoRouteDidChange):
(MediaSessionHelperiOS::externalOutputDeviceAvailableDidChange):
(MediaSessionHelperiOS::startMonitoringWirelessRoutes): Deleted.
(MediaSessionHelperiOS::stopMonitoringWirelessRoutes): Deleted.
(MediaSessionHelperiOS::applicationDidBecomeActive): Deleted.
(MediaSessionHelperiOS::applicationDidEnterBackground): Deleted.
(MediaSessionHelperiOS::applicationWillBecomeInactive): Deleted.
(MediaSessionHelperiOS::applicationWillEnterForeground): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::activeAudioRouteDidChange):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-02 Youenn Fablet <youenn@apple.com>
Start observing outgoing audio/video sources asynchronously
https://bugs.webkit.org/show_bug.cgi?id=224040
Reviewed by Eric Carlson.
We delay sending media a little bit to guarantee that senders can be
assigned a transform synchronously at creation time.
This guarantees all sent media will go through the transform.
Difficult to test in practice as this would be very racy.
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::operator==):
(WebCore::LibWebRTCRtpSenderBackend::startSource):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2021-04-02 Rob Buis <rbuis@igalia.com>
Subpixel layout: Switch inlines' baseline positioning from int to LayoutUnit.
https://bugs.webkit.org/show_bug.cgi?id=133932
Reviewed by Zalan Bujtas.
This change converts the int returns type to LayoutUnit.
To match the old behavior, the implicit toInt() calls
have been replaced by explicit toInt() calls.
* rendering/GridBaselineAlignment.cpp:
(WebCore::GridBaselineAlignment::ascentForChild const):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::baselinePosition const):
* rendering/InlineBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::baselinePosition const):
* rendering/InlineTextBox.h:
* rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::baselinePosition const):
* rendering/RenderAttachment.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition const):
(WebCore::RenderBlock::firstLineBaseline const):
(WebCore::RenderBlock::inlineBlockBaseline const):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::baselinePosition const):
* rendering/RenderBox.h:
(WebCore::RenderBox::firstLineBaseline const):
(WebCore::RenderBox::inlineBlockBaseline const):
* rendering/RenderBoxModelObject.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::baselinePosition const):
* rendering/RenderButton.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderFlexibleBox::baselinePosition const):
(WebCore::RenderFlexibleBox::firstLineBaseline const):
(WebCore::RenderFlexibleBox::inlineBlockBaseline const):
* rendering/RenderFlexibleBox.h:
* rendering/RenderGrid.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderGrid::baselinePosition const):
(WebCore::RenderGrid::firstLineBaseline const):
(WebCore::RenderGrid::inlineBlockBaseline const):
* rendering/RenderGrid.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::baselinePosition const):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::baselinePosition const):
* rendering/RenderLineBreak.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::baselinePosition const):
* rendering/RenderListBox.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::baselinePosition const):
* rendering/RenderListMarker.h:
* rendering/RenderMenuList.h:
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::baselinePosition const):
* rendering/RenderSlider.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::baselinePosition const):
(WebCore::RenderTable::inlineBlockBaseline const):
(WebCore::RenderTable::firstLineBaseline const):
* rendering/RenderTable.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBaseline const):
* rendering/RenderTableSection.h:
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::baselinePosition const):
* rendering/RenderTextControlMultiLine.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::baselinePosition const):
* rendering/RootInlineBox.h:
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition const):
(WebCore::RenderMathMLTable::firstLineBaseline const):
* rendering/mathml/RenderMathMLBlock.h:
(WebCore::RenderMathMLBlock::ascentForChild):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline const):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::firstLineBaseline const):
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLPadded.cpp:
(WebCore::RenderMathMLPadded::firstLineBaseline const):
* rendering/mathml/RenderMathMLPadded.h:
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::firstLineBaseline const):
* rendering/mathml/RenderMathMLRow.h:
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::firstLineBaseline const):
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::firstLineBaseline const):
* rendering/mathml/RenderMathMLToken.h:
2021-04-02 Philippe Normand <pnormand@igalia.com>
REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails
https://bugs.webkit.org/show_bug.cgi?id=223850
Reviewed by Carlos Alberto Lopez Perez.
The GL pipeline used by the player is now able to handle image rotation tags itself. Manual
handling of the image rotation tags is now performed only when the pipeline is not able to
do it by itself.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::getVideoOrientation):
(WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2021-04-01 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Introduce RobinHoodHashTable
https://bugs.webkit.org/show_bug.cgi?id=223895
Reviewed by Fil Pizlo.
* Modules/mediacapabilities/MediaCapabilities.cpp:
(WebCore::bucketMIMETypes):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::popupValue const):
* dom/Element.cpp:
(WebCore::canAttachAuthorShadowRoot):
* dom/QualifiedName.h:
* dom/make_names.pl:
(printNamesHeaderFile):
(printFactoryCppFile):
(printWrapperFactoryCppFile):
* editing/FormatBlockCommand.cpp:
(WebCore::isElementForFormatBlock):
* editing/RemoveFormatCommand.cpp:
(WebCore::isElementForRemoveFormatCommand):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::isProhibitedParagraphChild):
* html/Autofill.cpp:
(WebCore::fieldNameMap):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::isCaseSensitiveAttribute):
* html/HTMLObjectElement.cpp:
(WebCore::preventsParentObjectFromExposure):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::createCaseMap):
(WebCore::adjustSVGTagNameCase):
(WebCore::adjustAttributes):
(WebCore::createForeignAttributesMap):
(WebCore::adjustForeignAttributes):
(WebCore::addNamesWithPrefix): Deleted.
* page/DebugPageOverlays.cpp:
(WebCore::touchEventRegionColors):
(WebCore::NonFastScrollableRegionOverlay::drawRect):
* page/PerformanceUserTiming.cpp:
(WebCore::restrictedMarkNamesToNavigationTimingFunctionMap):
* platform/cocoa/MIMETypeRegistryCocoa.mm:
(WebCore::extensionsForMIMETypeMap):
* platform/graphics/FontCascade.cpp:
(WebCore::useBackslashAsYenSignForFamily):
(WebCore::FontCascade::hasValidAverageCharWidth const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::validInitDataTypes):
* platform/graphics/cg/UTIRegistry.cpp:
(WebCore::defaultSupportedImageTypes):
* platform/graphics/cg/UTIRegistry.h:
* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::codecTypeForDoViCodecString):
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::supportedVideoCodecs):
(WebCore::SourceBufferParserWebM::supportedAudioCodecs):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
* rendering/svg/SVGResources.cpp:
(WebCore::clipperFilterMaskerTags):
(WebCore::markerTags):
(WebCore::fillAndStrokeTags):
(WebCore::chainableResourceTags):
* style/StyleAdjuster.cpp:
(WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::isSupportedAttribute):
* svg/SVGElement.cpp:
(WebCore::createAttributeNameToCSSPropertyIDMap):
(WebCore::SVGElement::animatableAttributeForName):
(WebCore::SVGElement::cssPropertyIdForSVGAttributeName):
* svg/SVGTests.cpp:
(WebCore::SVGTests::addSupportedAttributes):
* svg/SVGTests.h:
* svg/SVGUseElement.cpp:
(WebCore::createAllowedElementSet):
(WebCore::isDisallowedElement):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::isSupportedAttribute):
* xml/XPathFunctions.cpp:
(WebCore::XPath::createFunctionMap):
* xml/XPathParser.cpp:
(WebCore::XPath::createAxisNamesMap):
2021-04-02 Youenn Fablet <youenn@apple.com>
Bail out early if encoded frame is written twice
https://bugs.webkit.org/show_bug.cgi?id=224041
Reviewed by Eric Carlson.
Test: http/wpt/webrtc/write-twice-transform.html
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp:
(WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame):
In case the frame is written twice, the second write is considered as a no-op.
2021-04-01 Cameron McCormack <heycam@apple.com>
Remove redundant #if in RuntimeApplicationChecks.h.
https://bugs.webkit.org/show_bug.cgi?id=224037
Reviewed by Alexey Proskuryakov.
* platform/RuntimeApplicationChecks.h:
2021-04-01 Zalan Bujtas <zalan@apple.com>
Expand on shouldComputeLogicalWidthFromAspectRatioAndInsets return logic
https://bugs.webkit.org/show_bug.cgi?id=224057
Reviewed by Rob Buis.
In this patch we also start checking against logicalWidth/height instead of just width/height.
* rendering/RenderBox.cpp:
(WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
(WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const): Deleted.
* rendering/RenderBox.h:
2021-04-01 Alex Christensen <achristensen@webkit.org>
REGRESSION(r272469) QuickLook previews broken in some places on macOS
https://bugs.webkit.org/show_bug.cgi?id=224086
Reviewed by Tim Horton.
The linked-on-or-after check saves us from most compatibility problems, but QuickLook on macOS was broken.
It uses schemes x-apple-ql-id and x-apple-ql-magic, which we allow to continue to have non-null origins.
Covered by API tests.
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsUniqueOrigin):
2021-04-01 Alex Christensen <achristensen@webkit.org>
Add more deprecation macros.
I missed one in r275298
* platform/network/cocoa/CertificateInfoCocoa.mm:
(WebCore::CertificateInfo::dump const):
2021-04-01 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274381.
https://bugs.webkit.org/show_bug.cgi?id=224080
Caused stuttery select scrolling
Reverted changeset:
"Add basic (non-momentum) wheel event handling for scroll
snap"
https://bugs.webkit.org/show_bug.cgi?id=222594
https://trac.webkit.org/changeset/274381
2021-04-01 Rob Buis <rbuis@igalia.com>
aspect-ratio not recomputed on hover
https://bugs.webkit.org/show_bug.cgi?id=224028
Reviewed by Zalan Bujtas.
Detect change in aspect-ratio on hover.
Test: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-dynamic-aspect-ratio.html
* rendering/style/RenderStyle.cpp:
(WebCore::rareNonInheritedDataChangeRequiresLayout):
2021-04-01 Chris Dumez <cdumez@apple.com>
Have the ServiceWorker process hold on to a file mapped version of the service worker scripts to save dirty memory
https://bugs.webkit.org/show_bug.cgi?id=224015
<rdar://75637679>
Reviewed by Geoffrey Garen.
Since r275267, the Network process holds on the file mapped (mmap'd) versions of the service worker
scripts instead of heap allocated versions, in order to decrease its dirty memory use. However, the
ServiceWorker process (which is often a regular WebProcess) was still using heap allocated service
worker scripts. This patch is a follow-up to make sure the NetworkProcess sends its file mapped
scripts to the ServiceWorker processes as ShareableResource handles in order to decrease the dirty
memory usage of the ServiceWorker processes as well.
No new tests, no Web-facing behavior change, just a decrease in dirty memory use in the ServiceWorker
processes (which may be WebProcesses). I have done local testing with a very large service worker
that uses a ~100MB main script, which imports another ~100MB sub-script. With my change, dirty
memory usage goes from ~440MB to ~230MB in both the cold and warm cases ("Cold" meaning that the
service worker was just registed and downloaded from the network and "Warm" meaning that the
service worker had been previously registed and was loaded straight from the SWScriptStorage).
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::hasOneSegment const):
Add a utility function to SharedBuffer to check if it contains a single data segment.
(WebCore::SharedBuffer::DataSegment::containsMappedFileData const):
Add a utility function to check if a SharedBuffer DataSegment contains a MappedFileData object.
* platform/SharedBuffer.h:
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
Move IPC encoders / decoders for ServiceWorkerContextData and ServiceWorkerContextData::ImportedScript
to the WebKit layer, in WebCoreArgumentCoders. This allows us to encode / decode the scripts as
WebKit::ShareableHandle whenever possible. This way, when the NetworkProcess sends a
ServiceWorkerContextData to the ServiceWorker process to launch a service worker, both the
ServiceWorker process and the Network process share the same mmap'd versions of the scripts and we
save on dirty memory use. This helps reduce dirty memory use in the ServiceWorker process in the
warm case, where the scripts are loaded straight from the disk (via SWScriptStorage).
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::didSaveScriptsToDisk):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::didSaveScriptsToDisk):
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::didSaveScriptsToDisk):
In the cold case, once the NetworkProcess is done saving the scripts to disk, it now sends the
file mapped version of the scripts to the ServiceWorker process, so that it can also replace
its heap-allocated copies and save on dirty memory use.
2021-04-01 Fujii Hironori <Hironori.Fujii@sony.com>
[WebGL] Use GraphicsContextGLOpenGLManager for ports using TextureMapper
https://bugs.webkit.org/show_bug.cgi?id=224035
Reviewed by Don Olmstead.
Use GraphicsContextGLOpenGLManager for GTK, WPE and WinCairo ports
to reduce duplicated code.
GraphicsContextGLOpenGLBase.cpp isn't used by Cocoa ports.
No behavior change.
* PlatformMac.cmake:
* Sources.txt:
* SourcesCocoa.txt:
* platform/graphics/opengl/GraphicsContextGLOpenGLManager.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::activeContexts): Deleted.
2021-04-01 Chris Lord <clord@igalia.com>
Make FontCache constructable and safe to use off the main thread
https://bugs.webkit.org/show_bug.cgi?id=223997
Reviewed by Darin Adler.
So that we can have a separate FontCache for use with OffscreenCanvas
on Worker threads, make FontCache constructable/destructable and
ref-counted.
This also changes some functions so that they no longer rely on static
AtomString variables, as these paths would not be safe to use off the
main thread, and changes main-thread checks to creation-thread checks.
No new tests, no change in behavior.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::alternateFamilyName):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::fontForFamily):
(WebCore::FontCache::similarFont):
* platform/graphics/FontCache.h:
(WebCore::FontCache::fontForFamily):
(WebCore::FontCache::getCachedFontPlatformData):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::FontCascadeFonts):
(WebCore::FontCascadeFonts::glyphDataForCharacter):
* platform/graphics/FontCascadeFonts.h:
(WebCore::FontCascadeFonts::primaryFont):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::similarFont):
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::lastResortFallbackFont):
(WebCore::getFamilyNameStringFromFamily):
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::fontFromDescriptionAndLogFont):
(WebCore::FontCache::lastResortFallbackFont):
(WebCore::FontCache::platformAlternateFamilyName):
2021-04-01 Mark Lam <mark.lam@apple.com>
Fix some missing exception checks in HTMLMediaElement methods.
https://bugs.webkit.org/show_bug.cgi?id=224038
rdar://69573092
Reviewed by Eric Carlson.
Test: media/missing-exception-checks-in-HTMLMediaElement-methods.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setupAndCallJS):
(WebCore::HTMLMediaElement::updateCaptionContainer):
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::HTMLMediaElement::setControllerJSProperty):
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
2021-04-01 Jean-Yves Avenard <jya@apple.com>
Previous artwork isn't cleared when NowPlaying info doesn't contain an artwork
https://bugs.webkit.org/show_bug.cgi?id=224031
<rdar://76044544>
Reviewed by Youenn Fablet.
Manually tested, no framework available to test such change.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): use MRMediaRemoteSetNowPlayingInfoWithMergePolicy instead.
* platform/mac/MediaRemoteSoftLink.h: Soft link MRMediaRemoteSetNowPlayingInfoWithMergePolicy
* platform/mac/MediaRemoteSoftLink.mm:
2021-04-01 Jean-Yves Avenard <jya@apple.com>
Now Playing artwork doesn't update when changed.
https://bugs.webkit.org/show_bug.cgi?id=223731
<rdar://problem/75823923>
Now Playing and Media Remote requires a unique identifier for the currently playing item.
If the same identifier is provided for every call to MRMediaRemoteSetNowPlayingInfo,
then some updates may be skipped.
In earlier changes, the MediaSessionElement identifier was combined with the Media Element
identifier which broke Now Playing as the MediaSession identifier never changes for the
lifetime of the web content process.
So we create a new method HTMLMediaElement::mediaUniqueIdentifier with a new MediaUniqueIdentifier
that willthat will be updated whenever the source of a media element changes and stop
using the MediaSession identifier when dealing with Now Playing.
Reviewed by Eric Carlson.
Manually tested, no framework available to test such change.
* WebCore.xcodeproj/project.pbxproj: Add MediaUniqueIdentifier.h
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::selectMediaResource): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::loadResource): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::setCurrentSrc): Add convenience method, generate new MediaUniqueIdentifier each time m_currentSrc is modified.
(WebCore::HTMLMediaElement::mediaUniqueIdentifier const): Return unique media identifier.
(WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Deleted.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::nowPlayingInfo const):
* platform/audio/NowPlayingInfo.h: Use MediaUniqueIdentifier for uniqueIdentifier member.
(WebCore::NowPlayingInfo::decode):
* platform/audio/PlatformMediaSessionManager.h: Use MediaUniqueIdentifier instead.
(WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingInfoUniqueIdentifier const):
set kMRMediaRemoteNowPlayingInfoArtworkIdentifier in CFDictionary to the source of the artwork.
Workaround a bug in Media Controller component.
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):
* platform/mac/MediaRemoteSoftLink.h: Soft-link kMRMediaRemoteNowPlayingInfoArtworkIdentifier symbol.
* platform/mac/MediaRemoteSoftLink.mm:
* testing/Internals.h: Add missing header.
2021-04-01 Devin Rousso <drousso@apple.com>
Limit the number of buttons shown in media controls
https://bugs.webkit.org/show_bug.cgi?id=223909
Reviewed by Eric Carlson.
When in fullscreen, it's possible to have five different buttons to the right of "Play":
- AirPlay
- Enter Picture in Picture
- Audio/Languages
- Exit Full Screen
- More...
This turns the UI into something of an "icon soup" and should really be avoided, especially
now that `OverflowButton` allows for a single button to have multiple actions (via a native
contextmenu). This matches AVKit behavior.
Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html:
media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls.html:
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype.layout):
(InlineMediaControls.prototype._droppableButtons):
(InlineMediaControls.prototype._collapsableButtons): Added.
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls):
(MacOSFullscreenMediaControls.prototype.layout):
(MacOSFullscreenMediaControls.prototype._collapsableButtons): Added.
Limit the number of `visible` buttons in `rightContainer.children` by iteratively marking
`dropped = true` on buttons that are also in `_collapsableButtons` until either there are
no iterations left (`i < 0`) or the number of visible buttons is below the maximum (2 for
inline and 3 for fullscreen).
* Modules/modern-media-controls/controls/pip-button.js:
(PiPButton.prototype.get contextMenuOptions): Added.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
Add support for `includePictureInPicture` to the native contextmenu.
* en.lproj/Localizable.strings:
* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaControlsMaximumRightContainerButtonCountOverride): Added.
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMediaControlsMaximumRightContainerButtonCountOverride): Added.
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.set maximumRightContainerButtonCountOverride): Added.
Add a way to override the default maximum right container button count for testing. This is
useful for testing the functionality of a specific button when not in the collapsed state,
allowing for tests to not have to worry about other state that may affect collapsing (e.g.
the AirPlay button is shown when there are AirPlay targets).
2021-04-01 Zalan Bujtas <zalan@apple.com>
Cleanup shouldComputeLogicalWidthFromAspectRatio and shouldComputeLogicalWidthFromAspectRatioAndInsets
https://bugs.webkit.org/show_bug.cgi?id=224044
Reviewed by Antti Koivisto.
Let's use "return foo()" (or "return !foo()") instead of
if (!foo())
return true;
return false;
* rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const):
2021-04-01 Aditya Keerthi <akeerthi@apple.com>
[iOS] '-webkit-appearance: none' is not respected for searchfield decorations
https://bugs.webkit.org/show_bug.cgi?id=224018
Reviewed by Antti Koivisto.
Specifying '-webkit-appearance: none' on a searchfield decoration
pseudo-element fails to hide the native icon. This issue arises from
the fact that we add the icon in the UA stylesheet, rather than painting
it in the theme.
To fix, remove the styles from the UA stylesheet, and paint the icon in
RenderThemeIOS. If a different '-webkit-appearance' is specified the
theme will not adjust styles or paint the icon.
Test: fast/forms/ios/form-control-refresh/search/search-decoration-appearance.html
* css/html.css:
Remove the UA styles for searchfield decorations so that they are not
applied when specifying a different -webkit-appearance.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustSearchFieldDecorationPartStyle const):
Adjust the style to match the native appearance.
(WebCore::RenderThemeIOS::paintSearchFieldDecorationPart):
Paint the native icon.
(WebCore::RenderThemeIOS::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeIOS::paintSearchFieldResultsDecorationPart):
(WebCore::RenderThemeIOS::adjustSearchFieldResultsButtonStyle const):
(WebCore::RenderThemeIOS::paintSearchFieldResultsButton):
2021-04-01 Martin Robinson <mrobinson@igalia.com>
Expose an alias for ScrollSnapOffsetInfo<T> to make it easier to use
https://bugs.webkit.org/show_bug.cgi?id=223986
Reviewed by Sergio Villar Senin.
No new tests. This should not change behavior.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat): Use new aliases.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::FloatScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::closestSnapOffset const): Ditto.
(WebCore::FloatScrollSnapOffsetsInfo::closestSnapOffset const): Ditto.
(WebCore::ScrollSnapOffsetsInfo<float>::convertUnits const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<LayoutUnit>::convertUnits const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<LayoutUnit>::closestSnapOffset const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<float>::closestSnapOffset const): Deleted.
* page/scrolling/ScrollSnapOffsetsInfo.h: Ditto.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::setSnapOffsetsInfo): Ditto.
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::snapOffsetsInfo const): Ditto.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::snapOffsetsInfo const): Ditto.
* page/scrolling/ScrollingTreeScrollingNode.h: Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::updateScrollSnapPoints): Ditto.
* platform/ScrollController.h: Ditto.
* platform/ScrollSnapAnimatorState.h:
(WebCore::ScrollSnapAnimatorState::snapOffsetInfo const): Ditto.
(WebCore::ScrollSnapAnimatorState::setSnapOffsetInfo): Ditto.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::ensureSnapOffsetsInfo): Ditto.
(WebCore::ScrollableArea::snapOffsetInfo const): Ditto.
(WebCore::ScrollableArea::setScrollSnapOffsetInfo): Ditto.
* platform/ScrollableArea.h: Ditto.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::gestureShouldBeginSnap): Ditto.
2021-04-01 Rob Buis <rbuis@igalia.com>
Use Element for checking Settings in CSSComputedStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=223598
Reviewed by Darin Adler.
Use Element for checking Settings in CSSComputedStyleDeclaration.
Right now renderer is used but this will not work for non-rendered elements.
Tests: fast/css/rotate-invalidate-if-disabled.html
fast/css/scale-invalidate-if-disabled.html
fast/css/translate-invalidate-if-disabled.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
2021-04-01 Youenn Fablet <youenn@apple.com>
Add some logging to RTCRtpSender and RTCRtpReceiver
https://bugs.webkit.org/show_bug.cgi?id=223991
Reviewed by Eric Carlson.
Add some logging around transforms.
No change of behavior.
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::RTCRtpReceiver):
(WebCore::RTCRtpReceiver::setTransform):
(WebCore::RTCRtpReceiver::logChannel const):
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::RTCRtpSender):
(WebCore::RTCRtpSender::setTransform):
(WebCore::RTCRtpSender::logChannel const):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSender.idl:
2021-03-31 Antoine Quint <graouts@webkit.org>
Move AnimationTimeline methods related to Styleable to Styleable
https://bugs.webkit.org/show_bug.cgi?id=224012
Reviewed by Dean Jackson.
A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance
variables and instead call into Styleable:
void elementWasRemoved(const Styleable&);
void willChangeRendererForStyleable(const Styleable&);
void cancelDeclarativeAnimationsForStyleable(const Styleable&);
void animationWasAddedToStyleable(WebAnimation&, const Styleable&);
void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&);
void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&);
void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle);
void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle);
These really belong on Styleable so we move them all over to that class with a new .cpp class
for these non-trivial methods.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::removeAnimation):
(WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted.
(WebCore::removeCSSTransitionFromMap): Deleted.
(WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted.
(WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted.
(WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted.
(WebCore::AnimationTimeline::elementWasRemoved): Deleted.
(WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted.
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted.
(WebCore::shouldConsiderAnimation): Deleted.
(WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted.
(WebCore::keyframeEffectForElementAndProperty): Deleted.
(WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted.
(WebCore::transitionCombinedDuration): Deleted.
(WebCore::transitionMatchesProperty): Deleted.
(WebCore::compileTransitionPropertiesInStyle): Deleted.
(WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted.
(WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted.
* animation/AnimationTimeline.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::disassociateFromOwningElement):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::setEffectInternal):
(WebCore::WebAnimation::setTimeline):
(WebCore::WebAnimation::effectTargetDidChange):
(WebCore::WebAnimation::persist):
* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::clearHostElement):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
* style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp.
(WebCore::Styleable::animationWasAdded const):
(WebCore::removeCSSTransitionFromMap):
(WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const):
(WebCore::Styleable::animationWasRemoved const):
(WebCore::removeCSSAnimationCreatedByMarkup):
(WebCore::Styleable::elementWasRemoved const):
(WebCore::Styleable::willChangeRenderer const):
(WebCore::Styleable::cancelDeclarativeAnimations const):
(WebCore::shouldConsiderAnimation):
(WebCore::Styleable::updateCSSAnimations const):
(WebCore::keyframeEffectForElementAndProperty):
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::transitionCombinedDuration):
(WebCore::transitionMatchesProperty):
(WebCore::compileTransitionPropertiesInStyle):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
(WebCore::Styleable::updateCSSTransitions const):
* style/Styleable.h:
2021-03-31 Simon Fraser <simon.fraser@apple.com>
Feed preferred frames per second back to the UI process for each DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=224023
Reviewed by Sam Weinig.
DisplayRefreshMonitors should be responsive to the frame rate demands of their clients,
so move from a model where DisplayRefreshMonitor has setPreferredFramesPerSecond()
to one where it computes maxClientPreferredFramesPerSecond().
DisplayRefreshMonitor needs to recompute maxClientPreferredFramesPerSecond when clients
are added, removed, or when the preferred frame rate of a client changes.
For now, just one of the DisplayRefreshMonitor implementations responds to adjustPreferredFramesPerSecond:
DisplayRefreshMonitorMac sends IPC to the UI process, which DisplayLink can use on a per-connection
basis to throttle the frequency of display updates sent to that process (which is important
for power).
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::addClient):
(WebCore::DisplayRefreshMonitor::removeClient):
(WebCore::DisplayRefreshMonitor::maximumClientPreferredFramesPerSecond const):
(WebCore::DisplayRefreshMonitor::computeMaxPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitor::clientPreferredFramesPerSecondChanged):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::maxClientPreferredFramesPerSecond const):
(WebCore::DisplayRefreshMonitor::adjustPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond): Deleted.
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::setPreferredFramesPerSecond):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::clientPreferredFramesPerSecondChanged):
(WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond): Deleted.
* platform/graphics/DisplayRefreshMonitorManager.h:
2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com>
List of extents should be bounds-checked when iterating display list items
https://bugs.webkit.org/show_bug.cgi?id=224019
<rdar://problem/71851600>
Reviewed by Tim Horton.
Add a bounds check before attempting to access the vector of display list drawing item extents. In the case
where we would've otherwise attempted to access an out-of-bounds item, we instead flag ourselves as invalid and
stop early with `StopReplayReason::InvalidItemOrExtent`.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::setTracksDrawingItemExtents):
Drive-by fix: use `isEmpty()` in the release assertion instead of duplicating code.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentDrawingItemExtent):
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem):
* platform/graphics/displaylists/DisplayList.h:
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::applyItem):
(WebCore::DisplayList::Replayer::replay):
* platform/graphics/displaylists/DisplayListReplayer.h:
Rename the `StopReplayReason::InvalidItem` to `StopReplayReason::InvalidItemOrExtent`, to reflect that we may
also stop replay when encountering invalid item extents.
2021-03-31 Tadeu Zagallo <tzagallo@apple.com>
Missing scope release in JSDOMBuiltinConstructorBase
https://bugs.webkit.org/show_bug.cgi?id=216851
<rdar://problem/69144642>
Reviewed by Yusuke Suzuki.
In JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments, we should release the
ThrowScope before calling into JavaScript since we don't intend to handle the exception.
Test: js/transform-stream.html
* bindings/js/JSDOMBuiltinConstructorBase.cpp:
(WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
2021-03-31 Chris Dumez <cdumez@apple.com>
Use MACH_PORT_VALID() when wanting to check if a mach port is valid
https://bugs.webkit.org/show_bug.cgi?id=224004
Reviewed by Darin Adler.
Use MACH_PORT_VALID() when wanting to check if a mach port is valid, instead of checking for
MACH_PORT_NULL. MACH_PORT_VALID() is the correct way to check for validity since it also checks
for the MACH_PORT_DEAD value.
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformCollectCPUData):
* platform/graphics/mac/GraphicsChecksMac.cpp:
(WebCore::attachToAppleGraphicsControl):
(WebCore::hasMuxCapability):
2021-03-31 Cameron McCormack <heycam@apple.com>
Avoid creating any complex text runs when font-size is zero.
https://bugs.webkit.org/show_bug.cgi?id=223983
Reviewed by Myles C. Maxfield.
We have existing checks to handle `font-size: 0` on the simple
text path, but not for complex text. Handle this by creating
no complex text runs for text with zero size.
Test: fast/text/font-size-zero-complex.html
* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::collectComplexTextRuns):
2021-03-31 Mark Lam <mark.lam@apple.com>
Placate exception check validation below convertVariadicArguments().
https://bugs.webkit.org/show_bug.cgi?id=224027
rdar://68912995
Reviewed by Saam Barati.
Test: js/dom/missing-exception-check-in-convertVariadicArguments.html
* bindings/js/JSDOMConvertVariadic.h:
(WebCore::convertVariadicArguments):
2021-03-31 Venky Dass <yaranamavenkataramana@apple.com>
Null pointer access crash in WebCore::makeBoundaryPoint(..)
https://bugs.webkit.org/show_bug.cgi?id=223977
Reviewed by Darin Adler.
In makeBoundaryPoint, position.containerNode() can be nullptr even if position.isNull() was false
Test: LayoutTests/editing/inserting/crash-make-boundary-point.html
* dom/Position.cpp:
(WebCore::makeBoundaryPoint):
2021-03-31 Eric Carlson <eric.carlson@apple.com>
[macOS] MediaSessionCoordinator should have join and leave methods
https://bugs.webkit.org/show_bug.cgi?id=223955
<rdar://problem/76021588>
Reviewed by Jer Noble.
Add 'join' and 'leave' methods to MediaSessionCoordinator so a page has to opt-in
to participating in a coordinated session and can leave at any time. Don't have
the coordinator automatically call session methods when the private coordinator
finishes, just signal the promise and let the page handle it.
No new tests, updated media/media-session/mock-coordinator.html.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/mediasession/MediaMetadata.idl: Fix Conditional.
* Modules/mediasession/MediaMetadataPlaylistMixin.idl: Ditto.
* Modules/mediasession/MediaPositionState.h: Add logging template.
(WTF::LogArgument<WebCore::MediaPositionState>::toString):
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Switch from beging a ContextDestructionObserver
to an ActiveDOMObject to the wrapper won't be collected while an event dispatch
is pending.
(WebCore::MediaSession::virtualHasPendingActivity const): Prevent collection while
event dispatch is pending.
(WebCore::MediaSession::setPositionState): Improve logging.
(WebCore::MediaPositionState::toJSONString const):
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSession.idl:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::join): New.
(WebCore::MediaSessionCoordinator::leave): New.
(WebCore::MediaSessionCoordinator::seekTo): Reject unless state is 'joined'. Don't
call session method.
(WebCore::MediaSessionCoordinator::play): Ditto.
(WebCore::MediaSessionCoordinator::pause): Ditto.
(WebCore::MediaSessionCoordinator::setTrack): Ditto.
(WebCore::MediaSessionCoordinator::positionStateChanged):
(WebCore::MediaSessionCoordinator::playbackStateChanged):
(WebCore::MediaSessionCoordinator::readyStateChanged): Do nothing unless state is
'joined'. Improve logging.
(WebCore::MediaSessionCoordinator::seekSessionToTime): Ditto.
(WebCore::MediaSessionCoordinator::playSession): Ditto.
(WebCore::MediaSessionCoordinator::pauseSession): Ditto.
(WebCore::MediaSessionCoordinator::setSessionTrack): Ditto.
* Modules/mediasession/MediaSessionCoordinator.h:
(WebCore::MediaSessionCoordinator::identifier const):
(WebCore::MediaSessionCoordinator::state const):
* Modules/mediasession/MediaSessionCoordinator.idl:
* Modules/mediasession/MediaSessionCoordinatorMixin.idl: Fix Conditional.
* Modules/mediasession/MediaSessionCoordinatorPrivate.h: Declare new required methods.
* Modules/mediasession/MediaSessionCoordinatorState.h: Define states.
* Modules/mediasession/MediaSessionCoordinatorState.idl:
* Modules/mediasession/MediaSessionPlaylistMixin.idl: Fix Conditional.
* Sources.txt: Add JSMediaSessionCoordinatorState.cpp.
* WebCore.xcodeproj/project.pbxproj:
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::join):
(WebCore::MockMediaSessionCoordinator::leave):
(WebCore::MockMediaSessionCoordinator::coordinatorStateChanged):
* testing/MockMediaSessionCoordinator.h:
2021-03-31 Zalan Bujtas <zalan@apple.com>
Remove misleading FIXME comment in RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets
https://bugs.webkit.org/show_bug.cgi?id=224020
Reviewed by Simon Fraser.
RenderStyle should not contain such logic (or any layout related logic for that matter).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const):
2021-03-31 Chris Lord <clord@igalia.com>
Make FontCache self-contained (remove static global variables)
https://bugs.webkit.org/show_bug.cgi?id=223995
Reviewed by Darin Adler.
This refactors FontCache so that the iOS font lock, the
FontPlatformDataCache, the FontDataCache, the FontVerticalDataCache,
the FontSelector clients list and the generation counter all live on
FontCache instead of in static global variables.
No new tests, no change in behavior.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::FontCache):
(WebCore::FontPlatformDataCacheKey::isHashTableDeletedValue const):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::verticalData):
(WebCore::FontCache::fontForPlatformData):
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::fontCount):
(WebCore::FontCache::inactiveFontCount):
(WebCore::FontCache::addClient):
(WebCore::FontCache::removeClient):
(WebCore::FontCache::invalidate):
* platform/graphics/FontCache.h:
(WebCore::FontCache::generation const):
2021-03-31 Sam Weinig <weinig@apple.com>
Merge DOMWindow+IndexedDatabase.idl and WorkerGlobalScope+IndexedDatabase.idl into a single WindowOrWorkerGlobalScope+IndexedDatabase.idl to match the IndexedDB spec
https://bugs.webkit.org/show_bug.cgi?id=223856
Reviewed by Sihui Liu.
Replaces DOMWindow+IndexedDatabase.idl and WorkerGlobalScope+IndexedDatabase.idl with
WindowOrWorkerGlobalScope+IndexedDatabase.idl which contains a partial mixin interface
like specified. Also moves implementations of supplements into the cpp file, as the only
use of them is by the two indexedDB static functions.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/indexeddb/DOMWindow+IndexedDatabase.idl: Removed.
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp: Removed.
* Modules/indexeddb/DOMWindowIndexedDatabase.h: Removed.
* Modules/indexeddb/WindowOrWorkerGlobalScope+IndexedDatabase.idl: Added.
* Modules/indexeddb/WindowOrWorkerGlobalScopeIndexedDatabase.cpp: Added.
(WebCore::DOMWindowIndexedDatabase::supplementName):
(WebCore::WorkerGlobalScopeIndexedDatabase::supplementName):
(WebCore::WindowOrWorkerGlobalScopeIndexedDatabase::indexedDB):
(WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
(WebCore::DOMWindowIndexedDatabase::from):
(WebCore::DOMWindowIndexedDatabase::indexedDB):
(WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
(WebCore::WorkerGlobalScopeIndexedDatabase::from):
(WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
* Modules/indexeddb/WindowOrWorkerGlobalScopeIndexedDatabase.h: Added.
* Modules/indexeddb/WorkerGlobalScope+IndexedDatabase.idl: Removed.
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp: Removed.
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h: Removed.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowCustom.cpp:
* inspector/agents/InspectorIndexedDBAgent.cpp:
2021-03-30 Simon Fraser <simon.fraser@apple.com>
Assertions in DisplayUpdate when dragging WebView windows between screens with different refresh rates
https://bugs.webkit.org/show_bug.cgi?id=223984
Reviewed by Sam Weinig.
There are various reasons why rigorous assertions in DisplayUpdate::relevantForUpdateFrequency()
are ill advised.
When WebKitLegacy calls windowScreenDidChange() it does not pass in a nominal display
refresh rate, so we assume 60fps. If the screen actually has a non-60fps refresh rate, then
we can get mixed 60/50 state in various places; this change fixes one of them, but such bugs
have to not result in assertions or divide by zero crashes in
DisplayUpdate::relevantForUpdateFrequency().
The second reason is webkit.org/b/212120; we may start DisplayRefreshMonitors with DisplayID
0 before we know what screen we're on, again risking a situation where the actual screen has
a non-60fps refresh rate.
To fix the case where no nominal refresh rate is passed through
Chrome::windowScreenDidChange(), allow a DisplayRefreshMonitor to supply a rate; often, a
DisplayRefreshMonitor can compute one from its knowledge of the display. This requires
DisplayRefreshMonitorManager is able to create a DisplayRefreshMonitor with no client, so
support that with a little refactoring.
Have some DisplayRefreshMonitor implementations supply their nominal display refresh rate
when known.
* page/Chrome.cpp:
(WebCore::Chrome::windowScreenDidChange): No need to early return here; Page does the same check.
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange): Push the call to adjustRenderingUpdateFrequency() into
renderingUpdateScheduler().windowScreenDidChange() as suggested in a previous review.
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::windowScreenDidChange):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::displayNominalFramesPerSecond):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::ensureMonitorForDisplayID):
(WebCore::DisplayRefreshMonitorManager::nominalFramesPerSecondForDisplay):
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
* platform/graphics/DisplayRefreshMonitorManager.h:
* platform/graphics/DisplayUpdate.cpp:
(WebCore::DisplayUpdate::relevantForUpdateFrequency const):
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::displayNominalFramesPerSecond):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::ensureDisplayLink):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::displayNominalFramesPerSecond):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
2021-03-31 Sihui Liu <sihui_liu@apple.com>
Add logging in IndexedDB to help debug flaky quota tests
https://bugs.webkit.org/show_bug.cgi?id=223578
<rdar://problem/75956789>
Reviewed by Alexey Proskuryakov.
With r274323, we know that the tests fail because of IndexedDB. IndexedDB data should be cleared between tests,
so let's add more logging to see what databases are left.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::diskUsage):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2021-03-31 Alex Christensen <achristensen@webkit.org>
Add deprecation macros.
* platform/network/cf/CertificateInfoCFNet.cpp:
(WebCore::certificatesMatch):
(WebCore::CertificateInfo::certificateChainFromSecTrust):
(WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
2021-03-31 Antoine Quint <graouts@webkit.org>
Remove CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED
https://bugs.webkit.org/show_bug.cgi?id=224000
Reviewed by Simon Fraser.
Since trunk is no longer maintained on macOS versions earlier than 10.15,
we can remove this compile-time flag.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateAnimations):
2021-03-31 Patrick Angle <pangle@apple.com>
Web Inspector: CSS Grid overlay track sizes are incorrect when inline styles are applied to the element
https://bugs.webkit.org/show_bug.cgi?id=223908
Reviewed by BJ Burg.
Add checking the inline style attributes on an element when collecting authored track sizes for grid overlays.
* inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes):
2021-03-31 Chris Dumez <cdumez@apple.com>
ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope
https://bugs.webkit.org/show_bug.cgi?id=224001
Reviewed by Geoffrey Garen.
ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope.
ServiceWorkerContextData contains script sources and may use a large amount of memory.
To address the issue, we now clear ServiceWorkerThread's context data once the ServiceWorkerGlobalScope
has been constructed.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::create):
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
(WebCore::ServiceWorkerThread::createWorkerGlobalScope):
(WebCore::ServiceWorkerThread::heartBeatTimerFired):
(WebCore::ServiceWorkerThread::finishedFiringInstallEvent):
* workers/service/context/ServiceWorkerThread.h:
(WebCore::ServiceWorkerThread::identifier const):
(WebCore::ServiceWorkerThread::jobDataIdentifier const):
(WebCore::ServiceWorkerThread::contextData const): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-31 Antoine Quint <graouts@webkit.org>
font-stretch should support 0% and disallow animating to a value below 0%
https://bugs.webkit.org/show_bug.cgi?id=223994
Reviewed by Antti Koivisto.
Trying to fix css/css-fonts/animations/font-stretch-interpolation.html showed two issues:
1. we disallowed 0% as a valid value when parsing font-stretch,
2. we allowed negative values when blending.
This patch addresses both.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* css/parser/CSSPropertyParser.cpp:
(WebCore::fontStretchIsWithinRange):
2021-03-31 Antoine Quint <graouts@webkit.org>
Remove the Silently argument to WebAnimation::cancel()
https://bugs.webkit.org/show_bug.cgi?id=223992
Reviewed by Frédéric Wang.
The recent commit r275228 removed the use of the Silently argument in
AnimationTimeline::cancelDeclarativeAnimationsForStyleable(), which
was the only function that would eventually call into WebAnimation::cancel()
with a value other than the default, Silently::No.
So we remove that argument to WebAnimation::cancel(), its call sites and
WebAnimation::resetPendingTasks() which was called from it.
And since the Silently enum is no longer used outside of WebAnimation.cpp,
we move it to be private.
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::elementWasRemoved):
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable):
* animation/AnimationTimeline.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::cancel):
* animation/DeclarativeAnimation.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::cancel):
(WebCore::WebAnimation::resetPendingTasks):
* animation/WebAnimation.h:
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):
2021-03-31 Antti Koivisto <antti@apple.com>
Use :is() instead of :matches() on UA stylesheet
https://bugs.webkit.org/show_bug.cgi?id=223996
Reviewed by Antoine Quint.
Use the standard name.
* css/html.css:
(:is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(#endif):
(#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY):
(input:is([type="hidden"], [type="image"], [type="file"])):
(input:is([type="radio"], [type="checkbox"])):
(input:is([type="button"], [type="submit"], [type="reset"])):
(input:is([type="button"], [type="submit"], [type="reset"]), input[type="file"]::file-selector-button, button):
(input:is([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]::file-selector-button:active, button:active):
(input:is([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]:active::file-selector-button, button:active):
(input:is([type="button"], [type="submit"], [type="reset"]):active:disabled,):
(input:is([type="button"], [type="submit"], [type="reset"]):disabled,):
(input:is([type="checkbox"], [type="radio"]):checked):
(input:is([type="checkbox"], [type="radio"]):disabled):
(input:is([type="checkbox"], [type="radio"]):checked:disabled):
(:matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(input:matches([type="hidden"], [type="image"], [type="file"])): Deleted.
(input:matches([type="radio"], [type="checkbox"])): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"])): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]), input[type="file"]::file-selector-button, button): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]::file-selector-button:active, button:active): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]:active::file-selector-button, button:active): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active:disabled,): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):disabled,): Deleted.
(input:matches([type="checkbox"], [type="radio"]):checked): Deleted.
(input:matches([type="checkbox"], [type="radio"]):disabled): Deleted.
(input:matches([type="checkbox"], [type="radio"]):checked:disabled): Deleted.
2021-03-31 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not merge anonymous table cells with mismatching children types
https://bugs.webkit.org/show_bug.cgi?id=223979
<rdar://76003320>
Reviewed by Antti Koivisto.
A table cell (as it establishes a block formatting context) should only contain either
inline or block level inflow boxes.
* rendering/RenderElement.h:
(WebCore::RenderElement::firstInFlowChild const):
(WebCore::RenderElement::lastInFlowChild const):
* rendering/RenderObject.h:
(WebCore::RenderObject::isInFlow const):
(WebCore::RenderObject::previousInFlowSibling const):
(WebCore::RenderObject::nextInFlowSibling const):
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::canCollapseNextSibling):
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
2021-03-31 Antti Koivisto <antti@apple.com>
Animated pseudo element style resolved against wrong parent style
https://bugs.webkit.org/show_bug.cgi?id=223990
rdar://74997361
Reviewed by Antoine Quint.
In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.
This matters in style adjuster which may apply wrong adjustments as a result.
Test: fast/animation/pseudo-element-style-adjuster.html
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolvePseudoStyle):
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
Make static and provide the parent and parent box styles as parameters.
* style/StyleTreeResolver.h:
2021-03-31 Youenn Fablet <youenn@apple.com>
Apply permission policy to geolocation
https://bugs.webkit.org/show_bug.cgi?id=223248
Reviewed by Eric Carlson.
Only allow third-party iframes if allowed by permission policy,
following https://w3c.github.io/geolocation-api/#permissions-policy.
Covered by API tests.
* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::shouldBlockGeolocationRequests):
* html/FeaturePolicy.cpp:
(WebCore::policyTypeName):
(WebCore::FeaturePolicy::parse):
(WebCore::FeaturePolicy::allows const):
* html/FeaturePolicy.h:
2021-03-31 Thibault Saunier <tsaunier@igalia.com> and Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system
https://bugs.webkit.org/show_bug.cgi?id=202538
Reviewed by Xabier Rodriguez-Calvar and Adrian Perez de Castro.
Enable the openh264 encoder if it is available, it would be preferred over existing
GStreamer H.264 encoders in such case.
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
2021-03-30 Antoine Quint <graouts@webkit.org>
Computed style for a border-radius corner should never be 0px when the provided width isn't 0px
https://bugs.webkit.org/show_bug.cgi?id=223927
Reviewed by Dean Jackson.
If "border-top-left-radius: 40px 0px" is provided, the computed style would return "0px" since
BuilderConverter::convertRadius() would treat either of the dimensions for the radius being 0
as both being 0.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertRadius):
2021-03-30 Antoine Quint <graouts@webkit.org>
Fix interpolation of box-shadow and text-shadow CSS properties
https://bugs.webkit.org/show_bug.cgi?id=223924
Reviewed by Dean Jackson.
There were three issues with interpolation of ShadowData-backed properties such
as box-shadow and text-shadow:
1. the blur radius should not be allowed to be negative,
2. blending LayoutUnit had accuracy issues,
3. we would allow interpolation to happen when items in lists did not have
matching shadow styles ("inset" vs. unspecified).
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* platform/animation/AnimationUtilities.h:
(WebCore::blend):
2021-03-30 Antoine Quint <graouts@webkit.org>
Computed style for background-position should not use "left" and "top" keywords
https://bugs.webkit.org/show_bug.cgi?id=223878
Reviewed by Simon Fraser.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Ensure querying the computed
style for background-position longhands passes in the RenderStyle for the calc() case.
(WebCore::createPositionListForLayer):
2021-03-30 Chris Dumez <cdumez@apple.com>
Service Worker scripts use too much memory in the network process
https://bugs.webkit.org/show_bug.cgi?id=223808
<rdar://75637093>
Reviewed by Geoff Garen.
Previously, the network process would store service worker scripts in a SQLite database.
When starting to use service workers, we would load all those scripts from the database
into memory. This would use a decent amount of memory in the network process.
To address the issue, the approach is this patch is to store the scripts as separate
files on the filesystem instead. This when, when loading them, we can simply mmap() them
and greatly reduce dirty memory usage.
Note that the service worker process (which may be the WebContent process) also keeps a
copy of the imported service worker scripts for the service workers it is running. More
work will be needed in a follow-up but we should be able to extend the approach so that
the service worker process would only have a mmap'd version of those scripts. This would
reduce dirty memory usage on the WebContent/ServiceWorker process side as well. I am
doing this separately though to reduce patch size and facilitate review.
No new tests, there should be no Web-facing behavior change, just a decreased
dirty memory usage in the network process when service workers are used.
I did manual memory testing with a very large service worker that had one ~100MB main
script, importing another ~100MB script.
Here are the memory results without my change:
- Networking (Dirty): 238MB (cold) / 331MB (warm)
- WebContent (Dirty): 441MB (cold) / 857MB (warm)
Here are the memory results with my change:
- Networking (Dirty): 22MB (cold) / 14MB (warm)
- WebContent (Dirty): 440MB (cold) / 438MB (warm)
This shows that ALL memory from the scripts in the network process is no longer marked
as dirty. We also see a significant progression in the WebProcess in the warm case, since
the scripts are coming from the network process as shared memory in this case. There is
no progression in the WebProcess in the cold case yet, since the script were just
downloaded and are coming from the WebProcess to the NetworkProcess. In a follow-up, the
network process could send shared memory back to the WebProcess, after saving the scripts
to disk, so that the WebProcess can replace the copies of its scripts and save more memory.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new SWScriptStorage class to the project.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
Convert the script type from SharedBuffer to String.
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::operator== const):
Fix assertions that were hitting when comparing to empty SharedBuffers (offset would be 0
and size would be 0). This was caught by API tests since we have some service worker API
tests that use empty worker scripts.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
Add some conversion from String to SharedBuffer to the script, and vice-versa, in the
service worker case.
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
(WebCore::scriptBufferToString):
(WebCore::stringToScriptBuffer):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
(WebCore::ServiceWorkerContextData::ImportedScript::decode):
(WebCore::ServiceWorkerContextData::decode):
- Store scripts as SharedBuffer instead of String, so that they can hold
mmap'd data.
- Add scriptBufferToString() / stringToScriptBuffer() utility functions to
convert script sources between String and SharedBuffer.
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
Convert from script from SharedBuffer to String.
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::recordsTableSchema):
Update database schema and bump version now that we no longer store the
service worker script inside the SQLite database. Instead, those scripts
are stored separately on the filesystem via SWScriptStorage.
(WebCore::ImportedScriptAttributes::encode const):
(WebCore::ImportedScriptAttributes::decode):
Introduce new ImportedScriptAttributes struct which contains all the data
members of ServiceWorkerContextData::ImportedScript, except for the actual
script source. We now save a HashMap of ImportedScriptAttributes in the
databasae instead of HashMap of ImportedScript since we no longer want to
store imported script sources in the database, but rather store them
separately on the file system.
(WebCore::stripScriptSources):
Utility function to convert a HashMap of ServiceWorkerContextData::ImportedScript
into a HashMap of ImportedScriptAttributes (identical but without the script
source), ready to save in the SQLite database.
(WebCore::populateScriptSourcesFromDisk):
Utility function to construct a HashMap of ServiceWorkerContextData::ImportedScript
from a HasMap of ImportedScriptAttributes, coming from the SQLiteDatabase. The
missing script sources are fetched from the disk via SWScriptStorage.
(WebCore::RegistrationDatabase::~RegistrationDatabase):
Make sure we destroy the SWScriptStorage on the background queue for thread-safety.
(WebCore::RegistrationDatabase::scriptStorageDirectory const):
Returns the path on the filesystem where service worker scripts are stored.
(WebCore::RegistrationDatabase::scriptStorage):
Constructs (if necessary) a SWScriptStorage and return it.
(WebCore::RegistrationDatabase::clearAll):
Make sure we clear all the service worker scripts on disk in addition to the database,
now that they are stored separately.
(WebCore::RegistrationDatabase::doPushChanges):
- Stop storing the script sources in the SQLite database, and instead store them as separate
files on the file system via SWScriptStorage.
- Improve logging
- When done storing the scripts to disk, send these new mmap'd versions back to the
SWServerWorker on the main thread, so that it can replace it's heavy script sources with
these ones. This helps reduce memory usage.
(WebCore::RegistrationDatabase::importRecords):
- Load the script sources from the disk via SWScriptStorage, now that they are no longer
stored in the SQLite database.
- Improve logging.
* workers/service/server/RegistrationDatabase.h:
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::didSaveWorkerScriptsToDisk):
* workers/service/server/RegistrationStore.h:
Pass scripts that were saved to disk from the store to the SWServerWorker so that it
can replace its scripts sources with those new mmap'd version, in order to save memory.
* workers/service/server/SWScriptStorage.cpp: Added.
(WebCore::hashURL):
(WebCore::SWScriptStorage::SWScriptStorage):
(WebCore::SWScriptStorage::registrationDirectory const):
(WebCore::SWScriptStorage::scriptPath const):
(WebCore::SWScriptStorage::store):
(WebCore::SWScriptStorage::retrieve):
(WebCore::SWScriptStorage::clear):
* workers/service/server/SWScriptStorage.h: Added.
Add SWScriptStorage to deal with the storage / retrieval of Service
Worker scripts to / from disk, as files on the file system. When
going a retrieval, we return a script as a SharedBuffer which usually contains
mmap'd() data (we don't use mmap() for files that are smaller than the PAGE_SIZE).
The scripts reside in a Scripts/ folder, beside the database. The scripts are separated
by origin (using SHA256 of the origin as folder name with salt), and then by registration (by
using SHA256 of the registration scope as subfolder name with salt). The file name for the script
is a SHA256 of the script URL with salt.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::didSaveWorkerScriptsToDisk):
Pass scripts that were saved to disk from the store to the SWServerWorker so that it
can replace its scripts sources with those new mmap'd version, in order to save memory.
(WebCore::SWServer::updateWorker):
Convert script from String to SharedBuffer.
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
Convert script from SharedBuffer to String.
* workers/service/server/SWServerToContextConnection.cpp:
(WebCore::SWServerToContextConnection::setScriptResource):
* workers/service/server/SWServerToContextConnection.h:
Take in a ServiceWorkerContextData::ImportedScript for convenience, instead of taking
all its data members as separate parameters.
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::script const):
Use SharedBuffer type for script instead of String type, so that we can hold on the
mmap'd data and reduce memory usage.
2021-03-30 Devin Rousso <drousso@apple.com>
REGRESSION(r274607): media controls script is visible in Web Inspector even without the engineering "Show WebKit-internal scripts" enabled
https://bugs.webkit.org/show_bug.cgi?id=223961
Reviewed by Yusuke Suzuki.
It turns out that Web Inspector will only ignore scripts that have a source URL directive
that matches `__InjectedScript_*.js`, not those that have a (source) URL matching that.
In addition to Web Inspector ignoring these scripts in the UI, it will also cause the
`Debugger` to not pause in scripts with a matching source URL directive (unless the
local build engineering only "Pause in WebKit-internal scripts" is enabled).
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
Change the `ScriptSourceCode` here to not have a `URL` and have `make-js-file-arrays.py`
add a `//# sourceURL=__InjectedScript_*.js` to the contents before it's encoded.
2021-03-30 Venky Dass <yaranamavenkataramana@apple.com>
Nullptr crash in Crash in WebCore::positionInParentBeforeNode(..) where a NULL check is missing.
https://bugs.webkit.org/show_bug.cgi?id=223639
Reviewed by Ryosuke Niwa.
In positionInParentBeforeNode(..) there is a null check missing on a pointer - hence the crash.
Test: LayoutTests/editing/inserting/edit-style-and-insert-image.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
2021-03-30 Ryosuke Niwa <rniwa@webkit.org>
Occasional debug assert in GenericTaskQueue::~GenericTaskQueue
https://bugs.webkit.org/show_bug.cgi?id=223913
Reviewed by Eric Carlson.
Eagerly initialize WeakPtrImpl so that we don't hit debug assertions.
Also made Performance object use EventLoop.
No new tests since there is no test case that reliably reproduces this issue.
* dom/TaskSource.h:
(TaskSource): Added PerformanceTimeline.
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::contextDestroyed):
(WebCore::Performance::queueEntry): Use EventLoopTaskGroup instead of GenericTaskQueue to deliver entries.
* page/Performance.h:
* platform/GenericTaskQueue.h:
(WebCore::GenericTaskQueue::GenericTaskQueue): Eagerly initialize WeakPtrImpl.
Also assert that we're creating this object in the main thread.
2021-03-30 Peng Liu <peng.liu6@apple.com>
[GPUP] Add an IPC message to implement RemoteImageDecoderAVF::clearFrameBufferCache()
https://bugs.webkit.org/show_bug.cgi?id=223707
Reviewed by Youenn Fablet.
No change in observable functionality.
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
Export method `clearFrameBufferCache()` so that we can call it from WebKit.
2021-03-30 Antti Koivisto <antti@apple.com>
Nullptr crash in applyCommonButtonPaddingToStyle
https://bugs.webkit.org/show_bug.cgi?id=223917
rdar://57262957
Reviewed by Zalan Bujtas.
* rendering/RenderThemeIOS.mm:
(WebCore::applyCommonButtonPaddingToStyle):
Null check frame.
2021-03-30 Frédéric Wang <fwang@igalia.com>
Release assert in compareAnimationsByCompositeOrder
https://bugs.webkit.org/show_bug.cgi?id=223368
Reviewed by Antoine Quint.
AnimationTimeline::cancelDeclarativeAnimationsForStyleable currently only calls cancel() on
the declarative animation, which means the owning element is still associated to the
animation and that one continues to be accessible via Element's getAnimations(). When members
like pause() are called on that animation, one can obtain inconsistent state for
KeyframeEffectStack, leading to a debug ASSERT(!cssAnimationList->isEmpty()); and a
RELEASE_ASSERT_NOT_REACHED() in compareCSSAnimations(). This patch forces the owning element
to be clear during cancelDeclarativeAnimationsForStyleable in order to address these issues.
More code refactoring and cleanup should be done in follow-up patches, though.
Test: animations/animation-remove-element-crash.html
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Use cancelFromStyle()
so that the owning element is also cleared.
2021-03-30 Antoine Quint <graouts@webkit.org>
CSS properties backed by StyleImage should not interpolate when one of the values is "none"
https://bugs.webkit.org/show_bug.cgi?id=223929
Reviewed by Dean Jackson.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-03-30 Peng Liu <peng.liu6@apple.com>
Rename MediaElementSession::playbackPermitted() to MediaElementSession::playbackStateChangePermitted()
https://bugs.webkit.org/show_bug.cgi?id=220939
Reviewed by Youenn Fablet.
A follow-up patch of r271870 to rename function `playbackPermitted()` and
the enum class `MediaPlaybackOperation`.
No new tests as there is no change in functionality.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::userGestureRequired const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::updateShouldPlay):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const):
(WebCore::MediaElementSession::canShowControlsManager const):
(WebCore::MediaElementSession::updateMediaUsageIfChanged):
(WebCore::MediaElementSession::playbackPermitted const): Deleted.
* html/MediaElementSession.h:
2021-03-30 Antoine Quint <graouts@webkit.org>
Account for "hanging" and "each-line" when blending text-interpolation
https://bugs.webkit.org/show_bug.cgi?id=223914
Reviewed by Dean Jackson.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-30 Antoine Quint <graouts@webkit.org>
[CSS Backgrounds] WPT test css/css-backgrounds/animations/border-image-width-interpolation.html asserts
https://bugs.webkit.org/show_bug.cgi?id=206578
Reviewed by Dean Jackson.
Ensure we pass the RenderStyle through the methods eventually calling createValue() for calculated lengths.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForNinePieceImageQuad):
(WebCore::valueForNinePieceImage):
(WebCore::valueForReflection):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
2021-03-30 Andres Gonzalez <andresg_22@apple.com>
Fix for accessibility/textarea-insertion-point-line-number.html.
https://bugs.webkit.org/show_bug.cgi?id=223936
<rdar://problem/76007361>
Reviewed by Chris Fleizach.
Test: accessibility/textarea-insertion-point-line-number.html
Added AXCoreObject::insertionPointLineNumber to support this functionality.
This replaces the previous implementation in the wrapper's accessibilityAttributeValue.
There were several problems with the previous implementation that was
doing an unnecessary and buggy round trip from Ranges to indexes and
back to VisiblePositions.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::insertionPointLineNumber const):
* accessibility/AccessibilityRenderObject.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::insertionPointLineNumber const):
(WebCore::AXIsolatedObject::selectionStart const): Deleted.
(WebCore::AXIsolatedObject::selectionEnd const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2021-03-29 Simon Fraser <simon.fraser@apple.com>
Allow non-60fps display updates to be driven by DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=223912
Reviewed by Sam Weinig.
Previously, RenderingUpdateScheduler::scheduleAnimation() would return false for any
preferredFramesPerSecond which is not 60fps, causing RenderingUpdateScheduler to fall back
to its timer mechanism. This meant that throttled (e.g. by low power) pages and display
updates on non-60fps display would all use timers. This is undesirable because we want
alignment with display refresh, and to avoid timer drift between multiple throttled
documents.
The fix has two parts. First, we need to fix RenderingUpdateScheduler and
ScriptedAnimationController to compute their frame rates in terms of FramesPerSecond, rather
than Seconds, because using the latter requires conversion to Seconds and back via
m_page.preferredRenderingUpdateInterval() which was awkward. So have Page expose
preferredRenderingUpdateFramesPerSecond().
Also add preferredFramesPerSecond(), and have both it and preferredFrameInterval() take the
"near 60fps" flag as an argument, so doing the common math in AnimationFrameRate.
The second part of the fix is to move "preferredFramesPerSecond" from
RenderingUpdateScheduler to DisplayRefreshMonitorClient, since clients should be able to
request different frame rates. Then we pass the DisplayUpdate to
DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(), and finally use it to do the math
of whether to skip an update for this client.
Tested by API tests in AnimationFrameRate.cpp, and by
fast/animation/request-animation-frame-throttling-lowPowerMode.html
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::interval const): This function (used for testing)
is just a synonym for preferredScriptedAnimationInterval(), but left here because it's exported
and maybe the compiler can inline preferredScriptedAnimationInterval().
(WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const): Just call
preferredFrameInterval() with throttlingReasons(), which is the union of the reasons for
the page and for this ScriptedAnimationController.
(WebCore::ScriptedAnimationController::throttlingReasons const): No reason not to return m_throttlingReasons
if we don't have a page. Should never happen.
(WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): Logging.
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): Logging.
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange): The display nominal FPS may have changed so recompute the update frequency.
(WebCore::Page::preferredRenderingUpdateFramesPerSecond const): Return the preferred update in FramesPerSecond. Will return
null if throttling results in a < 1fps update.
(WebCore::Page::preferredRenderingUpdateInterval const): Push the "near 60fps" logic into the helper function.
(WebCore::Page::setIsVisuallyIdleInternal): Clearer to use OptionSet<>::set().
(WebCore::Page::handleLowModePowerChange): Ditto.
* page/Page.h:
(WebCore::Page::displayNominalFramesPerSecond const):
(WebCore::Page::throttlingReasons const):
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleAnimation): Remove code that fell back to a timer for any non-60fps rate.
(WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency): Compute if we have to use a timer.
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
(WebCore::RenderingUpdateScheduler::setPreferredFramesPerSecond): Deleted.
* page/RenderingUpdateScheduler.h:
* platform/graphics/AnimationFrameRate.cpp: Simplify some code with halfSpeedThrottlingReasons.
(WebCore::preferredFramesPerSecond): Similar logic to preferredFrameInterval, but for FramesPerSecond values.
(WebCore::preferredFrameInterval):
* platform/graphics/AnimationFrameRate.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::setPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded):
* platform/graphics/DisplayRefreshMonitorClient.h:
(WebCore::DisplayRefreshMonitorClient::preferredFramesPerSecond const):
* platform/graphics/DisplayUpdate.cpp:
(WebCore::DisplayUpdate::relevantForUpdateFrequency const): Compute whether this update is relevant
for a client who wants updates at 'preferredFramesPerSecond'.
* platform/graphics/DisplayUpdate.h:
2021-03-30 Antti Koivisto <antti@apple.com>
[LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
https://bugs.webkit.org/show_bug.cgi?id=223932
rdar://75888718
Reviewed by Zalan Bujtas.
If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.
Test: fast/inline-block/hit-test-negative-margin-child.html
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::hitTest):
Always descend into inline blocks even if their run didn't hit.
2021-03-30 Mark Lam <mark.lam@apple.com>
Ensure that GlobalPropertyInfo is allocated on the stack.
https://bugs.webkit.org/show_bug.cgi?id=223911
rdar://75865742
Reviewed by Yusuke Suzuki.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::finishCreation):
(WebCore::JSDOMWindowBase::initStaticGlobals):
* bindings/js/JSDOMWindowBase.h:
2021-03-30 Sam Weinig <weinig@apple.com>
Generalize ColorComponents to support an arbritrary number of components (though really we will only ever want 3, 4, or 5)
https://bugs.webkit.org/show_bug.cgi?id=223901
Reviewed by Darin Adler.
Add a length to ColorComponents to allow an arbitrary number of components. This
will be used to support cases where we only want to carry the three color components
(not alpha) and will be useful if we ever need to add back CMYKA support.
A new dedecution guide added allows for cases that currently deduce to remain.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HWBA<float>>):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HSLA<float>>):
(WebCore::CSSPropertyParserHelpers::fixupHueComponentsPriorToMix):
* platform/graphics/Color.cpp:
(WebCore::Color::colorSpaceAndComponents const):
* platform/graphics/Color.h:
(WebCore::Color::OutOfLineComponents::create):
(WebCore::Color::OutOfLineComponents::components const):
(WebCore::Color::OutOfLineComponents::OutOfLineComponents):
* platform/graphics/ColorComponents.h:
(WebCore::ColorComponents::ColorComponents):
(WebCore::mapColorComponents):
(WebCore::N>::map const):
(WebCore::=):
(WebCore::N>::operator const):
(WebCore::N>::abs const):
(WebCore::N>::get const):
(WebCore::N>::subset const):
(WebCore::perComponentMax):
(WebCore::perComponentMin):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::ColorComponents<T>::map const): Deleted.
(WebCore::ColorComponents<T>::operator const): Deleted.
(WebCore::ColorComponents<T>::abs const): Deleted.
(WebCore::ColorComponents<T>::get const): Deleted.
* platform/graphics/ColorMatrix.h:
(WebCore::RowCount>::transformedColorComponents const):
(WebCore::applyMatricesToColorComponents):
* platform/graphics/ColorSpace.h:
(WebCore::callWithColorType):
* platform/graphics/ColorTypes.h:
(WebCore::makeFromComponents):
(WebCore::clampedComponent):
(WebCore::clampedComponents):
(WebCore::clampedComponentsExceptAlpha):
(WebCore::makeFromComponentsClamping):
(WebCore::makeFromComponentsClampingExceptAlpha):
(WebCore::asColorComponents):
* platform/graphics/filters/FEColorMatrix.cpp:
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::makeColorComponentsfromPixelValue):
(WebCore::makePixelValueFromColorComponents):
(WebCore::minOrMax):
(WebCore::columnExtremum):
(WebCore::kernelExtremum):
(WebCore::FEMorphology::platformApplyGeneric):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::noise2D const):
(WebCore::toIntBasedColorComponents):
(WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
* platform/graphics/filters/FETurbulence.h:
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::hueRotate):
2021-03-30 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Anonymous table cell collapsing should also cleanup the inline tree
https://bugs.webkit.org/show_bug.cgi?id=223910
Reviewed by Antti Koivisto.
Let's delete the inline tree when the anonymous table cell is collapsed.
It's completely redundant at this point as the content is moved over to a previous sibling.
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings): Deleted.
* rendering/updating/RenderTreeBuilderTable.h:
2021-03-30 Jean-Yves Avenard <jya@apple.com>
Now Playing content isn't updated when media session's Metadata is modified
https://bugs.webkit.org/show_bug.cgi?id=223795
<rdar://problem/75883478>
Reviewed by Eric Carlson.
Manually tested. Ensuring that immediately after modifying the MediaSession metadata, NowPlaying reflects the change.
* Modules/mediasession/MediaSession.h:
(WebCore::MediaSession::Observer::metadataChanged): Change method prototype to avoid unnecessary refcount.
(WebCore::MediaSession::Observer::positionStateChanged): Change method prototype to pass argument by reference rather than value (and easier forward declaration).
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::positionStateChanged): Pass argument by reference rather than value.
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
* html/MediaElementSession.cpp: Add MediaSessionObserver class, we use separate proxy to avoid multiple inheritance of CanMakeWeakPtr.
(WebCore::MediaSessionObserver::MediaSessionObserver):
(WebCore::MediaSessionObserver::~MediaSessionObserver):
(WebCore::MediaSessionObserver::actionHandlersChanged):
(WebCore::MediaElementSession::registerWithDocument): Add MediaElementSession as Media Session observer when it's added to the DOM.
(WebCore::MediaElementSession::unregisterWithDocument): Remove MediaElementSession as Media Session observer when it's removed from the DOM.
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Simplify with new mediaSession() helper.
(WebCore::MediaElementSession::nowPlayingInfo const): Simplify with new mediaSession() helper.
(WebCore::MediaElementSession::mediaSession const): Helper to retrieve associated mediaSession object.
(WebCore::MediaElementSession::ensureIsObservingMediaSession):
(WebCore::MediaElementSession::metadataChanged): Call clientCharacteristicsChanged which will trigger the PlatformMediaSessionManager to refresh the NowPlayingInfo content.
(WebCore::MediaElementSession::positionStateChanged): Method currently doing nothing. Preparing for future change.
(WebCore::MediaElementSession::playbackStateChanged): Method currently doing nothing. Preparing for future change.
(WebCore::MediaElementSession::actionHandlersChanged): Method currently doing nothing. Preparing for future change.
* html/MediaElementSession.h: Add methods.
* platform/cocoa/RemoteCommandListenerCocoa.h: Remove trailing whitespace.
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::positionStateChanged): Update for new method prototyping.
* testing/MockMediaSessionCoordinator.h:
2021-03-30 Antoine Quint <graouts@webkit.org>
Account for "cover" and "contain" when interpolating background-size
https://bugs.webkit.org/show_bug.cgi?id=223879
Reviewed by Antti Koivisto.
* animation/CSSPropertyAnimation.cpp:
2021-03-30 Lauro Moura <lmoura@igalia.com>
[GTK][WPE] Timeouts on WPT css/css-images ref-tests after updating WPT import
https://bugs.webkit.org/show_bug.cgi?id=214472
Reviewed by Žan Doberšek.
In some cases, degenerated and corner cases of grandient stops might
trigger really slow operations in Cairo due to extremely high bezier
parameters. For example, the normalization-conic-2.html triggered this
by making the conic code calculate the tangent of 90 degrees for an
interpolation stop.
This commit adds some special handling for these cases to make sure the
interpolation will be inside reasonable values.
Covered by existing tests.
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::createConic): Handle degenerated stops
2021-03-29 Antoine Quint <graouts@webkit.org>
Enable "hanging" and "each-line" keywords for the text-indent CSS property
https://bugs.webkit.org/show_bug.cgi?id=223851
Reviewed by Antti Koivisto.
We've had support for "hanging" and "each-line" behind the ENABLE_CSS3_TEXT flag. Probably by mistake,
"hanging" itself was parsed and Web-exposed by default. Presumably that was the case because that CSS
keyword existed in the context of SVG.
But LineWidth.cpp already knew how to handle these keywords, so there seems to be no reason to keep
these behind a flag.
So we remove all the ENABLE_CSS3_TEXT guards related to they keywords and address some spec compliance
issue, namely:
1. add the text-indent length or percentage, the "hanging" and "each-line" keywords in that order
in consumeTextIndent(),
2. use that same order for the computed style.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTextIndent):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::initialConstraintsForLine const):
* rendering/line/LineWidth.cpp:
(WebCore::requiresIndent):
* rendering/style/RenderStyle.cpp:
(WebCore::rareInheritedDataChangeRequiresLayout):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInheritTextIndent):
(WebCore::Style::BuilderCustom::applyInitialTextIndent):
(WebCore::Style::BuilderCustom::applyValueTextIndent):
2021-03-29 David Kilzer <ddkilzer@apple.com>
Remove unused struct WebCore::AlternativeTextController::AlternativeTextInfo
<https://webkit.org/b/223902>
Reviewed by Wenson Hsieh.
* editing/AlternativeTextController.h:
- Remove unused struct definition.
2021-03-29 Chris Dumez <cdumez@apple.com>
REGRESSION(r274992): Nullptr crash in FontCache::retrieveOrAddCachedFonts
https://bugs.webkit.org/show_bug.cgi?id=223858
<rdar://75883697>
Reviewed by Darin Adler and Ryosuke Niwa.
Stop using a hash as key in the FontCascadeCache. Instead, use HashTraits and use
FontCascadeCacheKey as key.
Test: fonts/font-cache-crash.html
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::retrieveOrAddCachedFonts):
(WTF::FontCascadeCacheKeyHash::hash):
* platform/graphics/FontCache.h:
(WebCore::FontCascadeCacheKey::operator== const):
(WTF::FontCascadeCacheKeyHash::equal):
(WTF::HashTraits<WebCore::FontCascadeCacheKey>::emptyValue):
(WTF::HashTraits<WebCore::FontCascadeCacheKey>::constructDeletedValue):
(WTF::HashTraits<WebCore::FontCascadeCacheKey>::isDeletedValue):
2021-03-29 Devin Rousso <drousso@apple.com>
Propagate user gestures through `requestAnimationFrame` just like `setTimeout`
https://bugs.webkit.org/show_bug.cgi?id=223775
<rdar://problem/75860868>
Reviewed by Geoffrey Garen.
`setTimeout` and `requestAnimationFrame` are used somewhat interchangeably on the web.
There should be similar features/affordances for both so that if a developer decides to use
a display-linked animation "loop" instead of a strictly time-based delay (or even a "loop")
they're able to do similar things in the callback/handler.
Test: fast/animation/request-animation-frame-propagate-user-gesture.html
* dom/ScriptedAnimationController.h:
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::resume):
(WebCore::ScriptedAnimationController::registerCallback):
(WebCore::ScriptedAnimationController::cancelCallback):
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
Create a private struct for holding more data in the list of callbacks than just the
callback itself. For now, the only other data saved is a `RefPtr<UserGestureToken>`.
* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::withoutUserGesture): Added.
Add a way for tests to guaranteed run arbitrary code without a user gesture.
2021-03-29 Said Abou-Hallawa <said@apple.com>
[GPU Process] Don't record DisplayList items if the GPU Process has been terminated
https://bugs.webkit.org/show_bug.cgi?id=223864
<rdar://73586187>
Reviewed by Simon Fraser.
Consult the DisplayList::Recorder::Delegate before appending the item.
If the GPU Process was terminated, don't append the item.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canAppendItemOfType):
(WebCore::DisplayList::Recorder::willAppendItemOfType): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::canAppendItemOfType):
(WebCore::DisplayList::Recorder::append):
(WebCore::DisplayList::Recorder::Delegate::willAppendItemOfType): Deleted.
2021-03-29 ChangSeok Oh <changseok@webkit.org>
Implement repetition of animated AVIF
https://bugs.webkit.org/show_bug.cgi?id=223127
<rdar://problem/75629284>
Reviewed by Philippe Normand.
This change implements repeating AVIF animation, reflecting the AVIF sequence spec.
As the libavif does not provide a clear repetition count yet, we calculate it
by dividing the track duration by the sum of each frame duration. If the track duration
is not specified, the animation repeats indefinitely. Chromium just indefinitely
repeats all animated avif images.
The repetition count of avif sequence images is not necessarily an integer.
Since ScalableImageDecoder accepts an integer value for repetition,
we round the repetition count in floating point values to conform the current
image decoder design. Later, when we have more reliable testing environment
for the avifs repetition, we will revisit the repetition count in floating point numbers.
No new tests since no reliable test could be created. The latest avif encoder
does not support the repetition count yet.
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
(WebCore::AVIFImageDecoder::repetitionCount const):
(WebCore::AVIFImageDecoder::tryDecodeSize):
* platform/image-decoders/avif/AVIFImageDecoder.h:
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::repetitionCount const):
* platform/image-decoders/avif/AVIFImageReader.h:
2021-03-29 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 2: Rename setItemBufferClient to setItemBuffer{Writing,Reading}Client
https://bugs.webkit.org/show_bug.cgi?id=223863
Reviewed by Wenson Hsieh.
Currently, we have:
void setItemBufferClient(ItemBufferReadingClient*);
void setItemBufferClient(ItemBufferWritingClient*);
This is unfortunate, because if you want to set one of these clients to nullptr, you have to do:
setItemBufferClient(static_cast<ItemBufferReadingClient*>(nullptr));
Instead, we can just rename these functions to:
void setItemBufferReadingClient(ItemBufferReadingClient*);
void setItemBufferWritingClient(ItemBufferWritingClient*);
So you can just do
setItemBufferReadingClient(nullptr);
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::setItemBufferReadingClient):
(WebCore::DisplayList::DisplayList::setItemBufferWritingClient):
(WebCore::DisplayList::DisplayList::setItemBufferClient): Deleted.
* platform/graphics/displaylists/DisplayList.h:
2021-03-29 Eric Carlson <eric.carlson@apple.com>
[macOS] Playback is paused after scrubbing with the touch bar
https://bugs.webkit.org/show_bug.cgi?id=223887
rdar://75597684
Reviewed by Jer Noble.
Test: media/remote-control-command-scrubbing.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::pauseInternal): Don't pause if `m_pausedInternal` is true.
(WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Support BeginScrubbingCommand
and EndScrubbingCommand.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Update enum names.
* platform/audio/PlatformMediaSession.cpp:
(WebCore::convertEnumerationToString): Ditto.
* platform/audio/PlatformMediaSession.h: Add "Command" suffix to BeginScrubbing
and EndScrubbing so they math the enum's naming pattern.
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager beginTouchBarScrubbing]): Update enum names.
(-[WebPlaybackControlsManager endTouchBarScrubbing]): Update enum names.
* testing/Internals.cpp:
(WebCore::Internals::postRemoteControlCommand): Add "beginscrubbing" and "endscrubbing".
2021-03-29 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Custom fonts don't work in GPU process mode
https://bugs.webkit.org/show_bug.cgi?id=223861
Reviewed by Don Olmstead.
Custom fonts didn't work in GPU process mode of WinCairo port
because FontCustomPlatformData was destructed soon. In non-GPU
process mode, FontCustomPlatformData is retained by CachedFont. In
GPU process mode, there is no CachedFont. So, the font resource
handle should be ref-counted and retained by FontPlatformData.
Added a new class FontMemoryResource to ref-count the font
resource handle. Added a new member of Ref<FontMemoryResource> to
FontPlatformData::CreationData struct.
Converted by existing canvas custom font tests.
* PlatformWin.cmake:
* platform/graphics/FontPlatformData.h:
* platform/graphics/opentype/FontMemoryResource.h:
(WebCore::FontMemoryResource::create):
(WebCore::FontMemoryResource::~FontMemoryResource):
(WebCore::FontMemoryResource::FontMemoryResource):
* platform/graphics/opentype/OpenTypeUtilities.cpp:
(WebCore::renameAndActivateFont):
* platform/graphics/opentype/OpenTypeUtilities.h:
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
(WebCore::FontCustomPlatformData::fontPlatformData):
(WebCore::createFontCustomPlatformData):
(WebCore::FontCustomPlatformData::~FontCustomPlatformData): Deleted.
* platform/graphics/win/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData): Deleted.
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
(WebCore::createFontCustomPlatformData):
(WebCore::FontCustomPlatformData::~FontCustomPlatformData): Deleted.
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
2021-03-29 Eric Carlson <eric.carlson@apple.com>
[macOS] Add remote MediaSessionCoordinator
https://bugs.webkit.org/show_bug.cgi?id=223854
<rdar://problem/75934650>
Reviewed by Jer Noble.
Rename PlatformMediaSessionCoordinator to MediaSessionCoordinatorPrivate and make
it possible for the MediaSessionCoordinator implementation to be located in another
process.
* Modules/mediasession/MediaPositionState.h:
(WebCore::MediaPositionState::encode const):
(WebCore::MediaPositionState::decode):
* Modules/mediasession/MediaSession.cpp:
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionActionHandler.h:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::create):
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::seekTo):
(WebCore::MediaSessionCoordinator::play):
(WebCore::MediaSessionCoordinator::pause):
(WebCore::MediaSessionCoordinator::setTrack):
(WebCore::MediaSessionCoordinator::positionStateChanged):
(WebCore::MediaSessionCoordinator::playbackStateChanged):
(WebCore::MediaSessionCoordinator::readyStateChanged):
(WebCore::MediaSessionCoordinator::seekSessionToTime):
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::pauseSession):
(WebCore::MediaSessionCoordinator::setSessionTrack):
(WebCore::MediaSessionCoordinator::internalSeekTo):
(WebCore::MediaSessionCoordinator::internalPlay):
(WebCore::MediaSessionCoordinator::internalPause):
(WebCore::MediaSessionCoordinator::internalSetTrack):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.cpp: Copied from Source/WebCore/platform/graphics/PlatformMediaSessionCoordinator.cpp
(WebCore::MediaSessionCoordinatorPrivate::setLogger):
* Modules/mediasession/MediaSessionCoordinatorPrivate.h: Copied from Source/WebCore/platform/graphics/PlatformMediaSessionCoordinator.h
(WebCore::MediaSessionCoordinatorPrivate::setClient):
(WebCore::MediaSessionCoordinatorPrivate::loggerPtr const):
(WebCore::MediaSessionCoordinatorPrivate::logIdentifier const):
(WebCore::MediaSessionCoordinatorPrivate::client const):
* Modules/mediasession/MediaSessionPlaybackState.h:
* Modules/mediasession/MediaSessionReadyState.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/PlatformMediaSession.h:
* platform/graphics/PlatformMediaSessionCoordinator.cpp: Removed.
* platform/graphics/PlatformMediaSessionCoordinator.h: Removed.
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::seekTo):
(WebCore::MockMediaSessionCoordinator::play):
(WebCore::MockMediaSessionCoordinator::pause):
(WebCore::MockMediaSessionCoordinator::setTrack):
(WebCore::MockMediaSessionCoordinator::positionStateChanged):
(WebCore::MockMediaSessionCoordinator::readyStateChanged):
(WebCore::MockMediaSessionCoordinator::playbackStateChanged):
(WebCore::MockMediaSessionCoordinator::logChannel const):
* testing/MockMediaSessionCoordinator.h:
(WebCore::MockMediaSessionCoordinator::logClassName const):
2021-03-29 Devin Rousso <drousso@apple.com>
[Payment Request] move added `object data` to `ApplePayModifier`
https://bugs.webkit.org/show_bug.cgi?id=223621
<rdar://problem/75720879>
Reviewed by Wenson Hsieh.
The `object data` in `PaymentDetailsModifier` has a sibling property `required DOMString supportedMethods`
which acts as a "guard" to make sure that the structure of `data` is only limited to that `supportedMethods`
meaning that there's no concern over naming collisions between two different `supportedMethods`. As such,
the `object data` added to `PaymentItem` and `PaymentDetailsBase` and `PaymentShippingOption` should really
be part of `ApplePayModifier` (which is what the `object data` in `PaymentDetailsModifier` is parsed into).
* Modules/applepay/paymentrequest/ApplePayModifier.idl:
* Modules/applepay/paymentrequest/ApplePayModifier.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::convertAndValidate):
(WebCore::merge):
(WebCore::ApplePayPaymentHandler::show):
(WebCore::ApplePayPaymentHandler::computeShippingMethods const):
(WebCore::ApplePayPaymentHandler::computeTotalAndLineItems const):
(WebCore::validate):
(WebCore::ApplePayPaymentHandler::firstApplicableModifier const): Added.
(WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
(WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
(WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
Instead of validating and merging data from the various `ApplePay*Data` objects, get the
first applicable `ApplePayModifier` from the list of `PaymentDetailsModifier` and use that
for validation and data merging (since, as explained above, it now contains the data).
* Modules/paymentrequest/PaymentDetailsBase.idl:
* Modules/paymentrequest/PaymentDetailsBase.h:
* Modules/paymentrequest/PaymentItem.idl:
* Modules/paymentrequest/PaymentItem.h:
* Modules/paymentrequest/PaymentShippingOption.idl:
* Modules/paymentrequest/PaymentShippingOption.h:
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::checkAndCanonicalizePaymentItem):
(WebCore::checkAndCanonicalizeTotal):
(WebCore::checkAndCanonicalizeDetails):
(WebCore::PaymentRequest::create):
(WebCore::PaymentRequest::settleDetailsPromise):
Remove the IDL `object data;` and associated members/logic now that the parsed data is all
part of `ApplePayModifier`. These objects are now back to being spec compliant.
* Modules/applepay/ApplePayDetailsUpdateBase.idl:
Drive-by: Add missing inheritance to `ApplePayDetailsUpdateData`.
* Modules/applepay/ApplePayLineItemData.idl:
* Modules/applepay/ApplePayShippingMethodData.idl:
Drive-by: Remove unnecessary attributes.
2021-03-29 Ian Gilbert <iang@apple.com>
Make a Ref to HTMLPlugInElement when resolving callback
https://bugs.webkit.org/show_bug.cgi?id=223846
Reviewed by Ryosuke Niwa.
Take a Ref to the HTMLPlugInElement to keep it alive while invoking HTMLPlugInElement::swapRendererTimerFired()
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::swapRendererTimerFired):
2021-03-29 Alex Christensen <achristensen@webkit.org>
Build fix.
* platform/graphics/SourceBufferPrivateClient.h:
I have a build that can't find the MediaDescription destructor from the AudioTrackInformation declaration.
Including MediaDescription.h fixes it.
2021-03-29 Frédéric Wang <fwang@igalia.com>
Release assert in Vector::at in RenderLayoutState::establishLineGrid
https://bugs.webkit.org/show_bug.cgi?id=223368
Reviewed by Zalan Bujtas.
Fix out-of-bound access for layoutStateStack and ensure the whole vector is browsed.
Test: fast/line-grid/establish-line-grid-crash.html
* rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::establishLineGrid): Fix the exit condition.
2021-03-28 Simon Fraser <simon.fraser@apple.com>
Plumb DisplayUpdate through the display refresh monitors
https://bugs.webkit.org/show_bug.cgi?id=223847
Reviewed by Sam Weinig.
Future work will allow DisplayRefreshMonitorClients to request different frame rates, which
are whole fractions of the display's nominal refresh rate. These various frame rate requests
flow up through the DisplayRefreshMonitors, and in WebKit2, up through IPC to the
per-display DisplayLink which may even service multiple processes.
For power reasons, we don't want to trigger display refresh notifications down the chain at
the highest possible frequency; at various stages of propagation the rate might be halved if
that's necessary for downstream clients.
To make this frequency splitting logic simple, this patch introduces DisplayUpdate, which
represents an update of the display, and contains data about it in the form of a numerator
is the frame index, and the denominator is the nominal frame rate. Frame index wraps to zero
every second.
For example, a 60Hz display will generate display refreshes with DisplayUpdates which
sequentially will be { 0, 60 }, { 1, 60 }, { 2, 60 } ... { 59, 60 }, { 0, 60 }. The
zeroth frame is at some arbitrary time and not aligned with wallclock time.
Thus a client with a 30Hz update requirement can simply ignore every odd-numbered frame, and
a client downstream from it with a 15Hz requirement, which only receives those even-numbered
frames, still has enough information to compute which frames to ignore.
Classes which are sources of callbacks for DisplayRefreshMonitor need to generate these
DisplayUpdates; that includes the various platform DisplayRefreshMonitor subclasses in
WebCore, and those in WebKit that live in the UI process and trigger updates over IPC.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
* platform/graphics/AnimationFrameRate.cpp:
* platform/graphics/AnimationFrameRate.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayLinkFired):
(WebCore::DisplayRefreshMonitor::dispatchDisplayDidRefresh):
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
* platform/graphics/DisplayRefreshMonitorManager.h:
* platform/graphics/DisplayUpdate.cpp: Copied from Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.h.
(WebCore::operator<<):
* platform/graphics/DisplayUpdate.h: Copied from Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.h.
(WebCore::DisplayUpdate::didUpdate):
(WebCore::DisplayUpdate::encode const):
(WebCore::DisplayUpdate::decode):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Assume a 60fps refresh rate but this code
should probably use gdk_frame_clock_get_refresh_info() to get the correct rate.
(WebCore::onFrameClockUpdate):
(WebCore::DisplayRefreshMonitorGtk::displayLinkCallbackFired):
(WebCore::DisplayRefreshMonitorGtk::startNotificationMechanism):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(-[WebDisplayLinkHandler initWithMonitor:]):
(-[WebDisplayLinkHandler handleDisplayLink:]):
(WebCore::DisplayRefreshMonitorIOS::displayLinkCallbackFired):
(WebCore::DisplayRefreshMonitorIOS::startNotificationMechanism):
(-[WebDisplayLinkHandler setPreferredFramesPerSecond:]): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::displayLinkCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkCallbackFired):
(WebCore::LegacyDisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
(WebCore::LegacyDisplayRefreshMonitorMac::nominalFramesPerSecondFromDisplayLink):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
(WebCore::LegacyDisplayRefreshMonitorMac::currentUpdate const):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
(WebCore::DisplayRefreshMonitorWin::displayLinkCallbackFired):
* platform/graphics/win/DisplayRefreshMonitorWin.h:
2021-03-29 Aditya Keerthi <akeerthi@apple.com>
Use enum classes and OptionSets for ControlStates::States
https://bugs.webkit.org/show_bug.cgi?id=223647
Reviewed by Sam Weinig.
No behavior change.
* dom/Element.cpp:
(WebCore::Element::setActive):
(WebCore::Element::setHovered):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::focusedOrActiveStateChanged):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::disabledStateChanged):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::setIndeterminate):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::parseAttribute):
* platform/ControlStates.h:
(WebCore::ControlStates::ControlStates):
(WebCore::ControlStates::states const):
(WebCore::ControlStates::setStates):
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::paintCheckbox):
(WebCore::ThemeAdwaita::paintRadio):
(WebCore::ThemeAdwaita::paintButton):
(WebCore::ThemeAdwaita::paintSpinButton):
* platform/mac/ThemeMac.mm:
(WebCore::updateStates):
(WebCore::paintToggleButton):
(WebCore::button):
(WebCore::paintButton):
(WebCore::paintStepper):
(WebCore::ThemeMac::ensuredView):
(WebCore::paintColorWell):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::stateChanged const):
(WebCore::RenderTheme::extractControlStatesForRenderer const):
* rendering/RenderTheme.h:
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::paintMenuList):
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::checkboxRadioIndicatorColor):
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
2021-03-28 Antoine Quint <graouts@webkit.org>
Add support for animating the vertical-align CSS property
https://bugs.webkit.org/show_bug.cgi?id=223853
Reviewed by Antti Koivisto.
Adding support for animating vertical-align revealed a couple of long-standing issues with
regards to our support for this property.
First off, we didn't honor the "inherit" value since it required a custom builder method
to deal with both RenderStyle::verticalAlign() (the type) and RenderStyle::verticalAlignLength()
(the value).
Then, we would hit an assertion when obtaining the computed style for this property and a
calculated value since we didn't pass the RenderStyle to createValue().
We now correctly interpolate this property per the dedicated WPT test, the only issues remaining
being about how our calc serialization (https://bugs.webkit.org/show_bug.cgi?id=223875).
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInheritVerticalAlign):
2021-03-28 Sam Weinig <weinig@apple.com>
Remove JSCustomXPathNSResolver.h/JSCustomXPathNSResolver.cpp from the Xcode project as they don't exist
https://bugs.webkit.org/show_bug.cgi?id=223852
Reviewed by Simon Fraser.
* WebCore.xcodeproj/project.pbxproj:
Remove long deleted files.
2021-03-28 Jer Noble <jer.noble@apple.com>
[Cocoa] Exception thrown from -setShouldProvideMediaDataForTrackID:
https://bugs.webkit.org/show_bug.cgi?id=223859
<rdar://75936746>
Reviewed by Eric Carlson.
Protect against undocumented exceptions thrown from -setShouldProvideMediaDataForTrackID:.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
(WebCore::SourceBufferParserAVFObjC::setShouldProvideMediaDataForTrackID):
2021-03-28 Sam Weinig <weinig@apple.com>
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS, it seems like it is on for all ports
https://bugs.webkit.org/show_bug.cgi?id=223810
Reviewed by Simon Fraser.
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS conditionals.
* Modules/indexeddb/DOMWindow+IndexedDatabase.idl:
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
* Modules/indexeddb/IDBActiveDOMObject.h:
* Modules/indexeddb/IDBCursor.cpp:
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBCursorDirection.idl:
* Modules/indexeddb/IDBCursorWithValue.cpp:
* Modules/indexeddb/IDBCursorWithValue.h:
* Modules/indexeddb/IDBCursorWithValue.idl:
* Modules/indexeddb/IDBDatabase.cpp:
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBDatabaseIdentifier.cpp:
* Modules/indexeddb/IDBDatabaseIdentifier.h:
* Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp:
* Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h:
* Modules/indexeddb/IDBFactory.cpp:
* Modules/indexeddb/IDBFactory.h:
* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBGetAllResult.cpp:
* Modules/indexeddb/IDBGetAllResult.h:
* Modules/indexeddb/IDBGetResult.cpp:
* Modules/indexeddb/IDBGetResult.h:
* Modules/indexeddb/IDBIndex.cpp:
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKey.cpp:
* Modules/indexeddb/IDBKey.h:
* Modules/indexeddb/IDBKeyData.cpp:
* Modules/indexeddb/IDBKeyData.h:
* Modules/indexeddb/IDBKeyPath.cpp:
* Modules/indexeddb/IDBKeyPath.h:
* Modules/indexeddb/IDBKeyRange.cpp:
* Modules/indexeddb/IDBKeyRange.h:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBKeyRangeData.cpp:
* Modules/indexeddb/IDBKeyRangeData.h:
* Modules/indexeddb/IDBObjectStore.cpp:
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBOpenDBRequest.cpp:
* Modules/indexeddb/IDBOpenDBRequest.h:
* Modules/indexeddb/IDBOpenDBRequest.idl:
* Modules/indexeddb/IDBRecordIdentifier.h:
* Modules/indexeddb/IDBRequest.cpp:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBRequest.idl:
* Modules/indexeddb/IDBRequestCompletionEvent.cpp:
* Modules/indexeddb/IDBRequestCompletionEvent.h:
* Modules/indexeddb/IDBTransaction.cpp:
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/indexeddb/IDBTransactionMode.h:
* Modules/indexeddb/IDBTransactionMode.idl:
* Modules/indexeddb/IDBValue.cpp:
* Modules/indexeddb/IDBValue.h:
* Modules/indexeddb/IDBVersionChangeEvent.cpp:
* Modules/indexeddb/IDBVersionChangeEvent.h:
* Modules/indexeddb/IDBVersionChangeEvent.idl:
* Modules/indexeddb/IndexedDB.h:
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/client/TransactionOperation.cpp:
* Modules/indexeddb/client/TransactionOperation.h:
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/IDBConnectionToClient.cpp:
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
* Modules/indexeddb/server/IDBSerialization.cpp:
* Modules/indexeddb/server/IDBSerialization.h:
* Modules/indexeddb/server/IDBSerializationContext.cpp:
* Modules/indexeddb/server/IDBSerializationContext.h:
* Modules/indexeddb/server/IDBServer.cpp:
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/IndexValueEntry.cpp:
* Modules/indexeddb/server/IndexValueEntry.h:
* Modules/indexeddb/server/IndexValueStore.cpp:
* Modules/indexeddb/server/IndexValueStore.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryCursor.cpp:
* Modules/indexeddb/server/MemoryCursor.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryIndex.cpp:
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryIndexCursor.cpp:
* Modules/indexeddb/server/MemoryIndexCursor.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
* Modules/indexeddb/server/MemoryObjectStoreCursor.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
* Modules/indexeddb/server/SQLiteIDBCursor.h:
* Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
* Modules/indexeddb/server/SQLiteIDBTransaction.h:
* Modules/indexeddb/server/ServerOpenDBRequest.cpp:
* Modules/indexeddb/server/ServerOpenDBRequest.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
* Modules/indexeddb/server/UniqueIDBDatabase.h:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
* Modules/indexeddb/shared/IDBCursorInfo.cpp:
* Modules/indexeddb/shared/IDBCursorInfo.h:
* Modules/indexeddb/shared/IDBCursorRecord.h:
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h:
* Modules/indexeddb/shared/IDBError.cpp:
* Modules/indexeddb/shared/IDBError.h:
* Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
* Modules/indexeddb/shared/IDBGetAllRecordsData.h:
* Modules/indexeddb/shared/IDBGetRecordData.cpp:
* Modules/indexeddb/shared/IDBGetRecordData.h:
* Modules/indexeddb/shared/IDBIndexInfo.cpp:
* Modules/indexeddb/shared/IDBIndexInfo.h:
* Modules/indexeddb/shared/IDBIterateCursorData.cpp:
* Modules/indexeddb/shared/IDBIterateCursorData.h:
* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
* Modules/indexeddb/shared/IDBObjectStoreInfo.h:
* Modules/indexeddb/shared/IDBRequestData.cpp:
* Modules/indexeddb/shared/IDBRequestData.h:
* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
* Modules/indexeddb/shared/IDBResourceIdentifier.h:
* Modules/indexeddb/shared/IDBResultData.cpp:
* Modules/indexeddb/shared/IDBResultData.h:
* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
* Modules/indexeddb/shared/IDBTransactionInfo.h:
* Modules/indexeddb/shared/IndexKey.cpp:
* Modules/indexeddb/shared/IndexKey.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/IDBBindingUtilities.cpp:
* bindings/js/IDBBindingUtilities.h:
* bindings/js/JSDOMConvertIndexedDB.h:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::scriptExecutionContext const):
(WebCore::scriptModuleLoader):
* bindings/js/JSIDBCursorCustom.cpp:
* bindings/js/JSIDBCursorWithValueCustom.cpp:
* bindings/js/JSIDBIndexCustom.cpp:
* bindings/js/JSIDBObjectStoreCustom.cpp:
* bindings/js/JSIDBRequestCustom.cpp:
* bindings/js/JSIDBSerializationGlobalObject.cpp:
* bindings/js/JSIDBSerializationGlobalObject.h:
* bindings/js/JSIDBTransactionCustom.cpp:
* bindings/js/SerializedScriptValue.cpp:
* bindings/js/SerializedScriptValue.h:
* bindings/js/WebCoreJSClientData.cpp:
(WebCore::JSVMClientData::JSVMClientData):
* bindings/js/WebCoreJSClientData.h:
* dom/Document.cpp:
(WebCore::Document::idbConnectionProxy):
(WebCore::Document::setBackForwardCacheState):
* dom/Document.h:
* dom/EmptyScriptExecutionContext.h:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* dom/ScriptExecutionContext.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
* inspector/agents/InspectorIndexedDBAgent.cpp:
* inspector/agents/InspectorIndexedDBAgent.h:
* loader/EmptyClients.cpp:
* page/DatabaseProvider.h:
* page/Page.cpp:
(WebCore::Page::setSessionID):
(WebCore::Page::clearIDBConnection):
* page/Page.h:
* testing/Internals.cpp:
(WebCore::Internals::numberOfIDBTransactions const):
* testing/Internals.h:
* testing/Internals.idl:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::prepareForDestruction):
(WebCore::WorkerGlobalScope::idbConnectionProxy):
(WebCore::WorkerGlobalScope::stopIndexedDatabase):
(WebCore::WorkerGlobalScope::suspend):
(WebCore::WorkerGlobalScope::resume):
* workers/WorkerGlobalScope.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::idbConnectionProxy):
* workers/WorkerThread.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::idbConnectionProxy):
* worklets/WorkletGlobalScope.h:
2021-03-28 Philippe Normand <pnormand@igalia.com>
REGRESSION(r274527): [GStreamer] media/webaudio-background-playback.html now failing
https://bugs.webkit.org/show_bug.cgi?id=223840
Reviewed by Chris Dumez.
r274527 actually exposed a bug that was present since r271197. The AudioDestination pipeline
was not stopping properly because webkitGstSetElementStateSynchronously() was returning too
early.
This patch also includes a few improvements in the webaudiosrc element, most notably
regarding its preroll state. The element now stops emitting buffers downstream as soon as
the AudioDestination is scheduled to stop.
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcRenderAndPushFrames): Return early as soon as the destination is scheduled to stop.
(webKitWebAudioSrcChangeState): Synchronize preroll state with element state.
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::webkitGstSetElementStateSynchronously): targetState might be lower than current
state, e.g, when stopping a running pipeline, so we can't return early for those cases,
otherwise the pipeline won't stop.
2021-03-28 Chris Dumez <cdumez@apple.com>
Unreviewed, add an exception for a heap allocation on the WebAudio thread.
I recently added assertions to catch heap allocations on the WebAudio threads and failed to
mark this one as allowed (for now).
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::markForDeletion):
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Allow DisplayRefreshMonitor to be more long-lived objects
https://bugs.webkit.org/show_bug.cgi?id=223844
Reviewed by Chris Dumez.
The existing behavior for DisplayRefreshMonitors was that they were created and destroyed
frequently, as their clients are registered and unregistered. In addition, some of
their subclasses had duplicated logic related to how often they fired without clients
before they were removed.
The 1:1 correspondance between DisplayRefreshMonitors and physical displays makes them
a useful place to store per-display information (like refresh rate), which should
persist whether or not they have clients, so this change prepares for that.
The main changes in this patch are:
1. Provide virtual startNotificationMechanism()/stopNotificationMechanism() functions on
DisplayRefreshMonitor that subclasses can use to start their CVDisplayLink or related
functionality.
2. Provide some shared maxUnscheduledFireCount logic that subclasses can tune to
provide the hysteresis used to control the start/stop of the underlying
notification mechanism.
3. Provide a shared dispatchDisplayDidRefresh() function that most implementations
can use.
DisplayRefreshMonitorManager no longer destroys DisplayRefreshMonitors when they lose
all their clients. This means that DisplayRefreshMonitors are never removed, but there
should only ever be as many as there are physical displays, and they are only
active if being scheduled by clients.
* loader/EmptyClients.cpp:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::stop):
(WebCore::DisplayRefreshMonitor::removeClient):
(WebCore::DisplayRefreshMonitor::requestRefreshCallback):
(WebCore::DisplayRefreshMonitor::firedAndReachedMaxUnscheduledFireCount):
(WebCore::DisplayRefreshMonitor::displayLinkFired):
(WebCore::DisplayRefreshMonitor::dispatchDisplayDidRefresh):
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::setMaxUnscheduledFireCount):
(WebCore::DisplayRefreshMonitor::mutex):
(WebCore::DisplayRefreshMonitor::displayLinkFired): Deleted.
(WebCore::DisplayRefreshMonitor::stop): Deleted.
(WebCore::DisplayRefreshMonitor::shouldBeTerminated const): Deleted.
(WebCore::DisplayRefreshMonitor::isActive const): Deleted.
(WebCore::DisplayRefreshMonitor::setIsActive): Deleted.
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::unregisterClient):
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
(WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
(WebCore::onFrameClockUpdate):
(WebCore::DisplayRefreshMonitorGtk::stop):
(WebCore::DisplayRefreshMonitorGtk::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorGtk::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorGtk::displayLinkFired): Deleted.
* platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(-[WebDisplayLinkHandler setPaused:]):
(WebCore::DisplayRefreshMonitorIOS::DisplayRefreshMonitorIOS):
(WebCore::DisplayRefreshMonitorIOS::~DisplayRefreshMonitorIOS):
(WebCore::DisplayRefreshMonitorIOS::stop):
(WebCore::DisplayRefreshMonitorIOS::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorIOS::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::stop):
(WebCore::LegacyDisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::stopNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::requestRefreshCallback): Deleted.
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
(WebCore::DisplayRefreshMonitorWin::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorWin::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorWin::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorWin::displayLinkFired): Deleted.
* platform/graphics/win/DisplayRefreshMonitorWin.h:
2021-03-27 Ryosuke Niwa <rniwa@webkit.org>
Don't add Frame as an opaque root of DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=223838
Reviewed by Simon Fraser.
Don't add Frame as an opaque root of DOMWindow since we don't use Frame
as an opaque root of any JS wrappers since r248276.
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::visitAdditionalChildren):
2021-03-27 David Kilzer <ddkilzer@apple.com>
UBSan: runtime error: load of value <unknown>, which is not a valid value for type 'const WebCore::RealtimeMediaSourceCapabilities::EchoCancellation'
<https://webkit.org/b/223821>
Reviewed by Chris Dumez.
Tests: fast/mediastream/MediaDevices-addEventListener.html
fast/mediastream/constraint-intrinsic-size.html
http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html
http/tests/media/media-stream/get-display-media-iframe-allow-attribute.html
imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-bitrate.https.html
webrtc/addICECandidate-closed.html
webrtc/ice-candidate-sdpMLineIndex.html
webrtc/libwebrtc/descriptionGetters.html
webrtc/peerconnection-page-cache.html
* platform/mediastream/RealtimeMediaSourceCapabilities.h:
(WebCore::CapabilityValueOrRange::union ValueUnion):
- Make asDouble the first union member so C++ member
initializers set all memory.
(WebCore::CapabilityValueOrRange::m_minOrValue):
(WebCore::CapabilityValueOrRange::m_max):
(WebCore::CapabilityValueOrRange::m_type):
(WebCore::RealtimeMediaSourceCapabilities::m_echoCancellation):
- Provide member initializers. Setting a default value for
m_echoCancellation fixes the bug.
(WebCore::RealtimeMediaSourceCapabilities::encode const):
- Drive-by clean-up of encoder statement.
2021-03-27 Antoine Quint <graouts@webkit.org>
Fix build with ENABLE_CSS3_TEXT
https://bugs.webkit.org/show_bug.cgi?id=223841
Reviewed by Darin Adler.
We also remove the -webkit- prefix for the "hanging" and "each-line" keywords since
these are well specified by the CSS Text Module Level 3 spec.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTextIndent):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setTextIndentType):
(WebCore::RenderStyle::setTextAlignLast):
(WebCore::RenderStyle::setTextJustify):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueTextIndent):
2021-03-27 Kate Cheney <katherine_cheney@apple.com>
PCM: Send report to both click source and attribution destination website
https://bugs.webkit.org/show_bug.cgi?id=223615
<rdar://problem/75849443>
Reviewed by Brent Fulgham.
Introduce 2 new structs for storing the earliest time to send and
seconds until send for the source and destination sites.
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::isValid const):
(WebCore::PrivateClickMeasurement::hasPreviouslyBeenReported):
(WebCore::randomlyBetweenTwentyFourAndFortyEightHours):
(WebCore::PrivateClickMeasurement::attributeAndGetEarliestTimeToSend):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::hasValidSecondsUntilSendValues):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::minSecondsUntilSend):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::encode const):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::decode):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::earliestTimeToSend):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::latestTimeToSend):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::attributionReportEndpoint):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::encode const):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::decode):
(WebCore::PrivateClickMeasurement::timesToSend const):
(WebCore::PrivateClickMeasurement::setTimesToSend):
(WebCore::PrivateClickMeasurement::encode const):
(WebCore::PrivateClickMeasurement::decode):
(WebCore::PrivateClickMeasurement::earliestTimeToSend const): Deleted.
(WebCore::PrivateClickMeasurement::setEarliestTimeToSend): Deleted.
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=223837
Reviewed by Tim Horton.
handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
all subclasses of DisplayRefreshMonitor with that detail.
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
(WebCore::DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread): Deleted.
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::displayLinkFired):
2021-03-27 Zalan Bujtas <zalan@apple.com>
[Multicolumn] Do not try to re-validate a multicol spanner when the renderer is moved internally
https://bugs.webkit.org/show_bug.cgi?id=223836
<rdar://75742694>
Reviewed by Ryosuke Niwa.
When a renderer becomes a multicol spanner
1. it is moved out of its original tree position and placed as a sibling of the enclosing multicolumn flow and
2. a spanner placeholder is constructed and inserted at the original position
This patch fixes the case when an already placed multicol spanner is internally moved (e.g. collapsing an anonymous block parent)
and we attempt to re-insert this spanner to the multicolumn flow. No spanner state should change due to internal re-parenting.
Test: fast/multicol/spanner-get-re-added-on-move-crash.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):
2021-03-26 Ian Gilbert <iang@apple.com>
Dirty layout for floating children of inline on full layout
https://bugs.webkit.org/show_bug.cgi?id=223660
Reviewed by Zalan Bujtas.
Avoid consuming an object on an empty line when that object is floating or out-of-flow.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleEndOfLine):
2021-03-26 Chris Dumez <cdumez@apple.com>
Avoid heap allocation on the audio thread in BaseAudioContext::scheduleNodeDeletion()
https://bugs.webkit.org/show_bug.cgi?id=223825
Reviewed by Darin Adler.
Avoid heap allocation on the audio thread in BaseAudioContext::scheduleNodeDeletion()
for performance. Stop calling appendVector() on m_nodesToDelete since m_nodesToDelete
is always empty. We can use std::exchange() instead of appendVector() and clear() to
avoid the heap allocation.
The reason m_nodesToDelete is always empty is that BaseAudioContext::scheduleNodeDeletion()
relies on the m_isDeletionScheduled flag to avoid adding to m_nodesToDelete until
m_nodesToDelete is cleared on the main thread and the m_isDeletionScheduled gets reset.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::clear):
(WebCore::BaseAudioContext::scheduleNodeDeletion):
2021-03-26 Patrick Angle <pangle@apple.com>
Web Inspector: Grid layout labels can be drawn outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=221972
Reviewed by BJ Burg.
Added logic for a best-effort attempt to make sure that layout labels are drawn within the document's bounds, or
at least within the grid itself. Labels are measured and adjusted so that if they would be drawn outside the
document's bounds, they will be pulled inside the grid. This does not guarantee that all labels will be visible
all the time. It is still possible an entire side of a grid will be outside the document's bounds, and this does
not attempt to correct for this case, as the desired anchor points for labels will be outside of the visible
area of the document.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::fontForLayoutLabel):
- Added helper that creates the FontCascade for layout labels, which is done in a few different places.
(WebCore::InspectorOverlay::backgroundPathForLayoutLabel):
- Added helper to create the Path for the background of layout labels, which is now used in `WebKit::WKInspectorHighlightView`.
(WebCore::expectedSizeForLayoutLabel):
- Gets the expected size of the label based on the text and arrow direction, and does so without needing to
create the entire label background's path.
(WebCore::InspectorOverlay::drawLayoutLabel):
- Support new `LabelArrowEdgePosition` property
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::buildLabel):
(WebCore::InspectorOverlay::buildGridOverlay):
* inspector/InspectorOverlay.h:
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::decode):
2021-03-26 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] No need to update the counters when the renderer is moved internally
https://bugs.webkit.org/show_bug.cgi?id=223801
<rdar://75835208>
Reviewed by Ryosuke Niwa.
When the renderer re-parenting is initiated by an "internal move" (e.g. anonymous block parent is not needed anymore so all the descendants
are moved "one level" up), we don't need to re-compute the counters. Their state should not be any different after this re-parenting.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):
(WebCore::RenderTreeBuilder::move):
* rendering/updating/RenderTreeBuilder.h:
2021-03-26 Chris Fleizach <cfleizach@apple.com>
AX: crash at aom.apple.WebCore: WebCore::AccessibilityProgressIndicator::element const
https://bugs.webkit.org/show_bug.cgi?id=223800
rdar://75861367
Reviewed by Zalan Bujtas.
Prevent unintended renderer access.
No steps to reproduce were available, so a test was not able to be created.
* accessibility/AccessibilityProgressIndicator.cpp:
(WebCore::AccessibilityProgressIndicator::element const):
2021-03-26 Chris Dumez <cdumez@apple.com>
Source/WebCore/editing/cocoa/HTMLConverter.mm:1278:44: runtime error: member call on null pointer of type 'WebCore::ArchiveResource'
https://bugs.webkit.org/show_bug.cgi?id=223696
Reviewed by Alex Christensen.
Fix bug found by UBSan.
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_addAttachmentForElement):
- Drop duplicate call to dataSource->subresource(url) as it doesn't seem it can return something else
than null if it returned null the first time around.
- Make sure resource is null-checked before we dereference it to get the MIME type.
2021-03-26 Wenson Hsieh <wenson_hsieh@apple.com>
Allow some image overlay content to render in fully transparent image elements
https://bugs.webkit.org/show_bug.cgi?id=223781
<rdar://problem/75886351>
Reviewed by Tim Horton.
Introduce `ImageOverlayController`, and use it to render selections in image overlay content when the image
overlay's host element is fully transparent.
Test: fast/images/image-extraction/mac/select-word-in-transparent-image-overlay.html
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
Add plumbing to allow `ImageOverlayController` to uninstall its `PageOverlay` when the document is about to be
detached. See `ImageOverlayController::` below.
* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
Have `SelectionRectGatherer` notify the image overlay controller as well, when selection rects change.
* page/ChromeClient.h:
(WebCore::ChromeClient::needsImageOverlayControllerForSelectionPainting const):
Add a new client hook that returns whether or not we should use `ImageOverlayController` to paint selections.
If not (i.e. we're on iOS, where we use UIKit to draw selections in the UI process), then we'll never install
page overlays, since `selectionRectsDidChange` is effectively a no-op.
* page/ImageOverlayController.cpp: Added.
(WebCore::ImageOverlayController::ImageOverlayController):
(WebCore::ImageOverlayController::selectionRectsDidChange):
When selection rects change, if the selection is inside an image overlay whose host is completely transparent
(or very close to being completely transparent), then remember the selection rects along with the renderer's
background color, and use this to render selection highlights separately, in a `PageOverlay`.
(WebCore::ImageOverlayController::documentDetached):
If the `Document` containing the current rendered overlay selection is detached, immediately uninstall the
current `PageOverlay`. This ensures that the overlays don't persist through navigation.
(WebCore::ImageOverlayController::installPageOverlayIfNeeded):
(WebCore::ImageOverlayController::uninstallPageOverlayIfNeeded):
Helper methods to add or remove the `PageOverlay` from the current `Page`.
(WebCore::ImageOverlayController::willMoveToPage):
Uninstall the current page overlay if needed.
(WebCore::ImageOverlayController::drawRect):
Use the information stored in `ImageOverlayController::selectionRectsDidChange` to render custom selection
rects.
* page/ImageOverlayController.h: Added.
* page/Page.cpp:
* page/Page.h:
Add an `ImageOverlayController` to the `Page`.
(WebCore::Page::imageOverlayController):
2021-03-26 Don Olmstead <don.olmstead@sony.com>
[CMake] Deprecate using DERIVED_SOURCES_DIR/FOWARDING_HEADERS_DIR directly
https://bugs.webkit.org/show_bug.cgi?id=223763
Reviewed by Michael Catanzaro.
Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.
* PlatformFTW.cmake:
* PlatformWin.cmake:
2021-03-26 Tim Nguyen <ntim@apple.com>
Make the object-position CSS property animatable.
https://bugs.webkit.org/show_bug.cgi?id=223568
Reviewed by Antoine Quint.
Test: imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::canInterpolateLengthPoints):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-26 Said Abou-Hallawa <said@apple.com>
Allow logging minimal info about uploading media files in the system diagnose
https://bugs.webkit.org/show_bug.cgi?id=223706
Reviewed by Alex Christensen.
Give the WebKit client the ability to log info about the media files which
were submitted to a web server through an HTMLFormElement.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
* loader/EmptyClients.cpp:
* page/DiagnosticLoggingClient.h:
* page/DiagnosticLoggingDomain.h: Copied from Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h.
2021-03-26 Imanol Fernandez <ifernandez@igalia.com>
Implement cachedPropertyValue for WebXR [SameObject] attributes
https://bugs.webkit.org/show_bug.cgi?id=223635
Reviewed by Chris Dumez.
[SameObject] is not currently implemented in WebKit. We need to implement custom getters.
Tested by WebXR WPT.
* Modules/webxr/WebXRRigidTransform.h:
(WebCore::WebXRRigidTransform::cachedMatrix):
* Modules/webxr/WebXRRigidTransform.idl:
* Modules/webxr/WebXRView.h:
(WebCore::WebXRView::cachedProjectionMatrix):
* Modules/webxr/WebXRView.idl:
* Modules/webxr/WebXRViewerPose.h:
(WebCore::WebXRViewerPose::cachedViews):
* Modules/webxr/WebXRViewerPose.idl:
* Sources.txt:
* bindings/js/JSWebXRRigidTransformCustom.cpp: Added.
(WebCore::JSWebXRRigidTransform::matrix const):
* bindings/js/JSWebXRViewCustom.cpp: Added.
(WebCore::JSWebXRView::projectionMatrix const):
* bindings/js/JSWebXRViewerPoseCustom.cpp: Added.
(WebCore::JSWebXRViewerPose::views const):
2021-03-26 Devin Rousso <drousso@apple.com>
Adopt AVKit SPI for hiding touch bar seeking controls
https://bugs.webkit.org/show_bug.cgi?id=223773
<rdar://problem/68937617>
Reviewed by Jer Noble.
* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager setSeekableTimeRanges:]):
(-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
If the list of seekable time ranges is empty, we are unable to seek.
2021-03-26 Kimmo Kinnunen <kkinnunen@apple.com>
GraphicsContextGLOpenGL should avoid calling into ANGLE MakeCurrent
https://bugs.webkit.org/show_bug.cgi?id=223511
Reviewed by Kenneth Russell.
Avoid calling ANGLE MakeCurrent for contexts that are already current. Cache the current context pointer into a
global variable. Currently the code adds no locking. For the forseeable future, ANGLE does not support
simultaneous access from multiple threads.
The optimization can be done when run in WebContent process or in GPU process, but not when in WK1. This is because in WK1,
the 3rd party client may run arbitrary code in WebKit thread. This includes code that changes EAGL or AGL state.
This code might change the current context underneath WebKit. In WK1 mode, we already use "volatile context" feature of
ANGLE to reset the platform context on every EGL command. The command we use for this for normal GL commands is EGL_MakeCurrent.
Makes in-process WebGL faster in MotionMark triangles by 6300 -> 9800 pts
Makes GPU process WebGL faster in MotionMark triangles by 5300 -> 7000 pts
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isCurrentContextPredictable):
(WebCore::InitializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
(WebCore::GraphicsContextGLOpenGL::clearCurrentContext):
(WebCore::GraphicsContextGLOpenGL::releaseCurrentContext):
(WebCore::GraphicsContextGLOpenGL::checkGPUStatus):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-03-25 Antoine Quint <graouts@webkit.org>
Fix interpolation of the caret-color CSS property
https://bugs.webkit.org/show_bug.cgi?id=223181
<rdar://problem/75687413>
Reviewed by Antti Koivisto.
Add support for the "auto" value for the "caret-color" CSS property. That value
is its initial value. We support it with a new boolean flag on StyleRareInheritedData
which we reset to false when setCaretColor() or setVisitedLinkCaretColor() is called.
Then, we can blend this property with the new CaretColorPropertyWrapper wrapper which is
required to correctly get and set the "auto" bit.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSProperties.json: We can remove the initial value key since this property is entirely
custom.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setCaretColor):
(WebCore::RenderStyle::setHasAutoCaretColor):
(WebCore::RenderStyle::setVisitedLinkCaretColor):
(WebCore::RenderStyle::setHasVisitedLinkAutoCaretColor):
(WebCore::RenderStyle::hasAutoCaretColor const):
(WebCore::RenderStyle::hasVisitedLinkAutoCaretColor const):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialCaretColor):
(WebCore::Style::BuilderCustom::applyInheritCaretColor):
(WebCore::Style::BuilderCustom::applyValueCaretColor):
2021-03-26 Jean-Yves Avenard <jya@apple.com>
Fix NowPlayingInfoArtwork operator== logic.
https://bugs.webkit.org/show_bug.cgi?id=223730
<rdar://problem/75822687>
Reviewed by Youenn Fablet.
Gtest NowPlayingInfoArtworkTest added .
* platform/audio/NowPlayingInfo.h:
(WebCore::NowPlayingInfoArtwork::operator== const):
(WebCore::NowPlayingInfoArtwork::operator!= const):
2021-03-26 Rob Buis <rbuis@igalia.com>
Remove ASSERT in RenderListItem::computeMarkerStyle
https://bugs.webkit.org/show_bug.cgi?id=222670
Reviewed by Ryosuke Niwa.
Remove ASSERT in RenderListItem::computeMarkerStyle
since ::marker does not apply to all elements so
getCachedPseudoStyle can return null.
Test: fast/lists/list-item-compute-marker-style-crash.xhtml
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::computeMarkerStyle const):
2021-03-26 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r272301): [SOUP] default port attribute when persisting credential information with libsecret
https://bugs.webkit.org/show_bug.cgi?id=223782
Reviewed by Adrian Perez de Castro.
Use the default port instead of 0 when the URL omits the port.
* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::protectionSpaceFromSoupAuthAndURL):
2021-03-26 Yusuke Suzuki <ysuzuki@apple.com>
Use ICUDeleter to encode ucnv_close/uenum_close call into type of deleter of std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=223503
Reviewed by Alex Christensen.
Use ICUDeleter<ucnv_close> instead of holding ucnv_close pointer in ICUConverterPtr.
This deleter encodes ucnv_close calls into type so that we do not need to hold a pointer
to ucnv_close.
We also use ICUDeleter<uenum_close> in place where we use UEnumeration.
* Modules/applepay/PaymentRequestValidator.mm:
(WebCore::validateCurrencyCode):
* platform/text/EncodingTables.cpp:
(WebCore::jis0208):
(WebCore::jis0212):
(WebCore::big5):
(WebCore::eucKR):
(WebCore::gb18030):
* platform/text/TextCodecICU.cpp:
(WebCore::TextCodecICU::createICUConverter const):
* platform/text/TextCodecICU.h:
2021-03-26 Jessie Berlin <jberlin@webkit.org>
Update the BEFORE/SINCE, SYSTEM_VERSION_PREFIX, and MACOSX_DEPLOYMENT_TARGET flags
https://bugs.webkit.org/show_bug.cgi?id=223779
Reviewed by Tim Horton.
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
* Configurations/WebCore.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:
2021-03-25 Alex Christensen <achristensen@webkit.org>
Allow WKContentRuleList to block only in frames or only in main frame
https://bugs.webkit.org/show_bug.cgi?id=219001
<rdar://problem/71382045>
Reviewed by Ben Poulain.
This adds load-context to the trigger, which can have an array containing main-frame or iframe.
This makes the trigger only happen in such loading contexts.
* Modules/websockets/ThreadableWebSocketChannel.cpp:
(WebCore::ThreadableWebSocketChannel::validateURL):
* contentextensions/ContentExtension.cpp:
(WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::getTypeFlags):
(WebCore::ContentExtensions::loadTrigger):
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForPingLoad):
* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
* loader/PingLoader.cpp:
(WebCore::PingLoader::sendPing):
(WebCore::PingLoader::sendViolationReport):
* loader/ResourceLoadInfo.cpp:
(WebCore::ContentExtensions::toResourceType):
(WebCore::ContentExtensions::readResourceType):
(WebCore::ContentExtensions::readLoadType):
(WebCore::ContentExtensions::readLoadContext):
(WebCore::ContentExtensions::ResourceLoadInfo::getResourceFlags const):
* loader/ResourceLoadInfo.h:
2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com>
Don't add `-webkit-user-select: none;` on image elements with `draggable=true`
https://bugs.webkit.org/show_bug.cgi?id=223774
<rdar://problem/75860124>
Reviewed by Tim Horton.
Avoid adding this presentational CSS style property for image elements marked with `draggable=true`. Since
image elements are already draggable by default and mouse drags over image elements do not trigger text
selection, it's not necessary for the user agent to add this style property. See below for more details.
Test: fast/images/image-extraction/mac/select-word-in-draggable-image-overlay.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::collectStyleForPresentationAttribute):
If the element is already draggable (barring HTML attributes), don't additionally disable text selection inside
the element when we additionally have `draggable=true` set on the element.
(WebCore::HTMLElement::draggable const):
Refactor this to consult `isDraggableIgnoringAttributes()` when determining whether to check if the `draggable`
attribute value is not `"false"` vs. equal to `"true"`. In the case where the element is already draggable, we
only return `false` here if `draggable=false` is explicitly set.
* html/HTMLElement.h:
(WebCore::HTMLElement::isDraggableIgnoringAttributes const):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::draggable const): Deleted.
* html/HTMLImageElement.h:
Override `isDraggableIgnoringAttributes` and return `true`.
2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com>
It should be possible to drag images with overlay content
https://bugs.webkit.org/show_bug.cgi?id=223766
<rdar://problem/75856030>
Reviewed by Tim Horton.
Make a few minor adjustments to make drag and drop play well with images with overlay content. See below for
more details.
Test: DragAndDropTests.DragElementWithImageOverlay
* html/HTMLElement.cpp:
(WebCore::HTMLElement::isInsideImageOverlay):
Add a helper method to return whether an individual DOM node is inside an image overlay. Use this in the
existing version of this method that takes a `SimpleRange`.
* html/HTMLElement.h:
* page/DragController.cpp:
(WebCore::DragController::draggableElement const):
Skip all drag source actions except for `Selection` in the case where we're hit-testing to text inside of an
image overlay.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
Make `isMouseDownOnLinkOrImage` `false` in the case where we're over image overlay text.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::nodeForImageData const):
(WebCore::HitTestResult::image const):
(WebCore::HitTestResult::imageRect const):
(WebCore::HitTestResult::absoluteImageURL const):
Teach `HitTestResult` to skip out of image overlay content and find the actual image element when determining
the image URL, image, or image rect.
* rendering/HitTestResult.h:
2021-03-25 Jessie Berlin <jberlin@webkit.org>
Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs
https://bugs.webkit.org/show_bug.cgi?id=223765
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
2021-03-25 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not try to normalize the tree while destroying the multicolumn flow
https://bugs.webkit.org/show_bug.cgi?id=223722
<rdar://75731256>
Reviewed by Simon Fraser.
Test: fast/multicol/crash-while-destroying-the-column-context.html
This patch ensures that we don't start moving around parts of the fragmented flow subtree (e.g. collapsing anonymous blocks) while
trying place the spanner renderers back to their original positions as part of the "we don't need multicolumn context anymore".
(e.g spanner placeholder is removed -> triggers anon block collapsing -> moves subtrees around inside the multicolumn subtree -> insertion happens -> spanner placeholder gets re-validated)
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::destroy):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::detach):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
(WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
(WebCore::RenderTreeBuilder::MultiColumn::multiColumnRelativeWillBeRemoved):
* rendering/updating/RenderTreeBuilderMultiColumn.h:
2021-03-25 Andres Gonzalez <andresg_22@apple.com>
AX: Consider implementing @aria-details.
https://bugs.webkit.org/show_bug.cgi?id=165842
rdar://30725491
Reviewed by Chris Fleizach.
Tests: accessibility/ios-simulator/aria-details.html
accessibility/mac/aria-details.html
- Added [WebAccessibilityObjectWrapper accessibilityDetailsElements] on iOS.
- Added helper function accessibleElementsForObjects to retrieve platform-
specific accessible elements given a collection of AXCoreObjects.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(accessibleElementsForObjects):
(-[WebAccessibilityObjectWrapper accessibilityDetailsElements]):
(-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):
2021-03-25 Cameron McCormack <heycam@apple.com>
Collapse newly adjacent anonymous table cells when a table cell is detached from between them.
https://bugs.webkit.org/show_bug.cgi?id=220934
Reviewed by Zalan Bujtas.
We already had support for collapsing newly adjacent table row cells when a
table row cell is detached from between them. We need to do this for anonymous
table cells too.
Test: fast/table/table-anonymous-cell-collapse.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Call
into the RenderTreeBuilder::Table to collapse anonymous table cells when
needed.
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings):
Factor out the existing collapseAndDestroyAnonymousSiblingRows into
something re-usable.
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells):
Added.
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
Factored out to collapseAndDestroyAnonymousSiblings.
* rendering/updating/RenderTreeBuilderTable.h:
2021-03-25 Tim Nguyen <ntim@apple.com>
Fix edge cases in normalization of conic-gradient color stops
https://bugs.webkit.org/show_bug.cgi?id=221294
<rdar://problem/74157218>
Reviewed by Darin Adler.
`lastOneOrLessIndex` had an off-by-one error, so it did not go through the
branch handling clamping all the stop offsets when they're all above 1.
Also made `normalizeStopsAndEndpointsOutsideRange` logic easier to follow using
`Optional<size_t>` instead of placeholder values.
Test: web-platform-tests/css/css-images/normalization-conic-2.html
* css/CSSGradientValue.cpp:
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
2021-03-25 Chris Dumez <cdumez@apple.com>
Address some alignment issues found by UBSan in contentextensions code
https://bugs.webkit.org/show_bug.cgi?id=223748
Reviewed by Darin Adler.
Address some alignment issues found by UBSan in contentextensions code:
- contentextensions/SerializedNFA.h:55:20: runtime error: reference binding to misaligned address 0xnnnnnnnnn for type 'const unsigned long long', which requires 8 byte alignment
- contentextensions/NFAToDFA.cpp:254:29: runtime error: reference binding to misaligned address 0xnnnnnnnnn for type 'const unsigned long long', which requires 8 byte alignment
- contentextensions/DFABytecodeCompiler.cpp:43:5: runtime error: store to misaligned address 0xnnnnnnnnn for type 'unsigned short', which requires 2 byte alignment
Use memcpy() to store/load to/from misaligned address.
* contentextensions/DFABytecodeCompiler.cpp:
(WebCore::ContentExtensions::append):
* contentextensions/NFAToDFA.cpp:
(WebCore::ContentExtensions::epsilonClosureExcludingSelf):
(WebCore::ContentExtensions::NodeIdSetToUniqueNodeIdSetTranslator::translate):
* contentextensions/SerializedNFA.h:
(WebCore::ContentExtensions::SerializedNFA::Range::pointerAt const):
(WebCore::ContentExtensions::SerializedNFA::Range::valueAt const):
(WebCore::ContentExtensions::SerializedNFA::ConstTargetIterator::operator* const):
(WebCore::ContentExtensions::SerializedNFA::ConstTargetIterator::operator-> const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::first const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::last const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::data const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::range const):
(WebCore::ContentExtensions::SerializedNFA::transitionsForNode const):
(WebCore::ContentExtensions::SerializedNFA::Range::operator[] const): Deleted.
2021-03-25 Chris Dumez <cdumez@apple.com>
Source/WebCore/xml/parser/CharacterReferenceParserInlines.h:107:33: runtime error: signed integer overflow: 268435455 * 16 cannot be represented in type 'int'
https://bugs.webkit.org/show_bug.cgi?id=223718
Reviewed by Darin Adler.
Use Checked<> for the result in consumeCharacterReference() to deal with overflows
in a well-defined manner.
* xml/parser/CharacterReferenceParserInlines.h:
(WebCore::consumeCharacterReference):
2021-03-25 John Wilander <wilander@apple.com>
PCM: Rename attributeOn to attributionDestination and change the IDL data type of attributionSourceId to unsigned long
https://bugs.webkit.org/show_bug.cgi?id=223661
<rdar://problem/75762075>
Reviewed by Brent Fulgham.
The PR review of the update of the PCM spec lead WebKit, Mozilla, and Google to decide on two changes:
1. Rename attributeOn to attributionDestination
2. Change the IDL data type of attributionSourceId from DOMString to unsigned long
The spec change can be seen in this commit:
https://github.com/privacycg/private-click-measurement/pull/75/commits/8623b5df5e899e6652bc5b00313585f7eeafa797
This patch makes those changes, plus changes names of SPIs, functions, and variables accordingly.
Existing tests were updated.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const):
* html/HTMLAnchorElement.idl:
* html/HTMLAttributeNames.in:
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::isValid const):
(WebCore::PrivateClickMeasurement::attributionReportAttributeOnURL const):
(WebCore::PrivateClickMeasurement::attributionReportJSON const):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::AttributionDestinationSite):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::operator== const):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::deletedValue):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::constructDeletedValue):
(WebCore::PrivateClickMeasurement::AttributionDestinationSiteHash::hash):
(WebCore::PrivateClickMeasurement::AttributionDestinationSiteHash::equal):
(WebCore::PrivateClickMeasurement::PrivateClickMeasurement):
(WebCore::PrivateClickMeasurement::destinationSite const):
(WebCore::PrivateClickMeasurement::encode const):
(WebCore::PrivateClickMeasurement::decode):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::emptyValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::constructDeletedValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::isDeletedValue):
(WebCore::PrivateClickMeasurement::AttributeOnSite::AttributeOnSite): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::operator== const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::matches const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::isHashTableDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::deletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::constructDeletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::deleteValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::isDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSiteHash::hash): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSiteHash::equal): Deleted.
(WebCore::PrivateClickMeasurement::attributeOnSite const): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::emptyValue): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::constructDeletedValue): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::isDeletedValue): Deleted.
2021-03-25 Chris Dumez <cdumez@apple.com>
Drop unnecessary Settings pre-warming in ProcessWarming::prewarmGlobally()
https://bugs.webkit.org/show_bug.cgi?id=223749
Reviewed by Antti Koivisto.
Drop unnecessary Settings pre-warming in ProcessWarming::prewarmGlobally(). Based on the comment,
it looks like the intention was to prewarm some font families. However, looking at the code, nothing
that gets populated is global and survives the destruction of the Settings object on the next line.
We don't even make any calls to CTFont.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
2021-03-25 Youenn Fablet <youenn@apple.com>
Switch from PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION to filtering interfaces in Network process
https://bugs.webkit.org/show_bug.cgi?id=223679
Reviewed by Eric Carlson.
Covered by webrtc/datachannel/filter-ice-candidate.html.
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
Use set_allow_tcp_listen instead of PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION.
2021-03-25 Ben Nham <nham@apple.com>
Only preheat MTLCopyAllDevices on Mac
https://bugs.webkit.org/show_bug.cgi?id=223747
Reviewed by Chris Dumez.
We should use adoptNS to avoid leaking the array returned by MTLCopyAllDevices. We should
also only do this on Mac because this is only a public API on the Mac, and the issue of
graphics drivers falling out of the dyld shared cache doesn't exist on iOS.
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::prewarm):
2021-03-25 Alex Christensen <achristensen@webkit.org>
WKContentRuleList first-party should include other subdomains of the current registrable domain
https://bugs.webkit.org/show_bug.cgi?id=223728
<rdar://71912579>
Reviewed by John Wilander.
Covered by API tests.
* loader/ResourceLoadInfo.cpp:
(WebCore::ContentExtensions::ResourceLoadInfo::isThirdParty const):
2021-03-25 Youenn Fablet <youenn@apple.com>
Improve RealtimeIncomingVideoSourceCocoa::OnFrame logging to include rotation and size information
https://bugs.webkit.org/show_bug.cgi?id=223741
Reviewed by Eric Carlson.
No change of behavior.
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2021-03-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274826 and r274968.
https://bugs.webkit.org/show_bug.cgi?id=223746
Added broken layout test
Reverted changesets:
"AX: textRectsFromMarkers always fails"
https://bugs.webkit.org/show_bug.cgi?id=223556
https://trac.webkit.org/changeset/274826
"AX: Add functions rectsForTextMarkerRange for testing"
https://bugs.webkit.org/show_bug.cgi?id=223705
https://trac.webkit.org/changeset/274968
2021-03-25 Antoine Quint <graouts@webkit.org>
Improve interpolation of the shape-outside CSS property
https://bugs.webkit.org/show_bug.cgi?id=223738
Reviewed by Antti Koivisto.
While we had logic to deal with cases where ShapeValue objects could not be interpolated, we did not make
use of it in the animation wrapper. We now move this logic from the blendFunc() to the canInterpolate()
override method on the wrapper to correctly interpolate only when possible.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-03-25 Tim Horton <timothy_horton@apple.com>
All Books quirks are flakily not applied in modern WebKit
https://bugs.webkit.org/show_bug.cgi?id=157101
<rdar://problem/25965028>
Reviewed by Darin Adler.
No new tests; I haven't found a way to write a test that doesn't involve
adding a new parameter to the process bootstrap message, which seems
out of the realm of reason for a test.
* bindings/js/CommonVM.cpp:
(WebCore::commonVMSlow):
(WebCore::globalConstRedeclarationShouldThrow): Deleted.
Stop hardcoding globalConstRedeclarationShouldThrow based on the UI process identity.
* platform/RuntimeApplicationChecks.cpp:
(WebCore::isInAuxiliaryProcess):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::applicationBundleIdentifier):
(WebCore::setApplicationBundleIdentifierOverride):
Add an assertion to catch any future case where a bundle check is queried
in a auxiliary process before the hosting application bundle identifier is set.
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 ==