Skip to content

Commit

Permalink
[LBSE] Fix pattern related dynamic-updates tests
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268610

Reviewed by Nikolas Zimmermann.

Make sure changing animated properties like x, y, width, height, etc.
invalidate the pattern.

This PR also fixes a last minute change from r273757.

* LayoutTests/platform/mac-sonoma-wk2-lbse-text/TestExpectations:
* LayoutTests/platform/mac-sonoma-wk2-lbse-text/svg/custom/pattern-size-bigger-than-target-size-expected.png: Removed.
* Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
* Source/WebCore/svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::svgAttributeChanged):

Canonical link: https://commits.webkit.org/273985@main
  • Loading branch information
rwlbuis committed Feb 2, 2024
1 parent 29eeaff commit c63c8c1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ svg/as-image/img-preserveAspectRatio-support-1.html [ Imag

# Pattern problems
imported/w3c/web-platform-tests/svg/import/pservers-grad-06-b-manual.svg [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/svg/import/pservers-pattern-02-f-manual.svg [ ImageOnlyFailure ]
svg/W3C-SVG-1.1/pservers-grad-06-b.svg [ Failure ]
svg/custom/js-late-pattern-and-object-creation.svg [ Failure ]
svg/custom/js-late-pattern-creation.svg [ Failure ]
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ RefPtr<Pattern> RenderSVGResourcePattern::buildPattern(GraphicsContext& context,

auto patternTransform = m_attributes->patternTransform();
if (!patternTransform.isIdentity())
patternSpaceTransform.multiply(patternSpaceTransform);
patternSpaceTransform = patternTransform * patternSpaceTransform;

// Build pattern.
return Pattern::create({ copiedImage.releaseNonNull() }, { true, true, patternSpaceTransform });
Expand Down
9 changes: 3 additions & 6 deletions Source/WebCore/svg/SVGPatternElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,10 @@ void SVGPatternElement::attributeChanged(const QualifiedName& name, const AtomSt

void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) {
InstanceInvalidationGuard guard(*this);
setPresentationalHintStyleIsDirty();
return;
}

if (PropertyRegistry::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
InstanceInvalidationGuard guard(*this);
if (PropertyRegistry::isAnimatedLengthAttribute(attrName))
setPresentationalHintStyleIsDirty();
#if ENABLE(LAYER_BASED_SVG_ENGINE)
if (document().settings().layerBasedSVGEngineEnabled()) {
if (auto* patternRenderer = dynamicDowncast<RenderSVGResourcePattern>(renderer()))
Expand Down

0 comments on commit c63c8c1

Please sign in to comment.