Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 466a4e163671edd79710f625f32e3ee740b3a522
      
https://github.com/WebKit/WebKit/commit/466a4e163671edd79710f625f32e3ee740b3a522
  Author: Rob Buis <rb...@igalia.com>
  Date:   2024-04-10 (Wed, 10 Apr 2024)

  Changed paths:
    A LayoutTests/svg/custom/mask-nested-reference-expected.txt
    A LayoutTests/svg/custom/mask-nested-reference.html
    M Source/WebCore/rendering/ReferencedSVGResources.cpp
    M Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
    M Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp
    M Source/WebCore/rendering/svg/RenderSVGResourceMasker.h
    M Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp
    M Source/WebCore/svg/SVGCircleElement.cpp
    M Source/WebCore/svg/SVGElement.cpp
    M Source/WebCore/svg/SVGEllipseElement.cpp
    M Source/WebCore/svg/SVGGraphicsElement.cpp
    M Source/WebCore/svg/SVGGraphicsElement.h
    M Source/WebCore/svg/SVGImageElement.cpp
    M Source/WebCore/svg/SVGLineElement.cpp
    M Source/WebCore/svg/SVGMaskElement.cpp
    M Source/WebCore/svg/SVGPathElement.cpp
    M Source/WebCore/svg/SVGPolyElement.cpp
    M Source/WebCore/svg/SVGRectElement.cpp
    M Source/WebCore/svg/SVGResourceElementClient.h
    M Source/WebCore/svg/SVGTextContentElement.cpp
    M Source/WebCore/svg/SVGTextElement.cpp
    M Source/WebCore/svg/SVGTextElement.h
    M Source/WebCore/svg/SVGTextPositioningElement.cpp
    M Source/WebCore/svg/SVGUseElement.cpp

  Log Message:
  -----------
  [LBSE] Fix performance of nested masks
https://bugs.webkit.org/show_bug.cgi?id=271146

Reviewed by Nikolas Zimmermann.

Masks with a high amount of nesting can take a lot of resources, both in 
computation and memory.
One example of this is mask-nested-reference.html (based on 
pattern-nested-reference.html).

To fix this, implement two optimizations:
- cache masks as image bitmaps (like legacy did)
- restrict the nesting level when calculating the mask bounding box
- take care of correctly invalidating in case mask contents change or a 
referencing client is added or removed

* LayoutTests/svg/custom/mask-nested-reference-expected.txt: Added.
* LayoutTests/svg/custom/mask-nested-reference.html: Added.
* Source/WebCore/rendering/ReferencedSVGResources.cpp:
* Source/WebCore/rendering/svg/RenderSVGResourceContainer.h:
(WebCore::RenderSVGResourceContainer::addReferencingCSSClient):
(WebCore::RenderSVGResourceContainer::removeReferencingCSSClient):
* Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyMask):
(WebCore::RenderSVGResourceMasker::removeReferencingCSSClient):
* Source/WebCore/rendering/svg/RenderSVGResourceMasker.h:
* Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp:
(WebCore::SVGBoundingBoxComputation::adjustBoxForClippingAndEffects const):
* Source/WebCore/svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::svgAttributeChanged):
* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::addReferencingCSSClient):
(WebCore::SVGElement::removeReferencingCSSClient):
* Source/WebCore/svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::svgAttributeChanged):
* Source/WebCore/svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::invalidateResourceImageBuffersIfNeeded):
* Source/WebCore/svg/SVGGraphicsElement.h:
* Source/WebCore/svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::svgAttributeChanged):
* Source/WebCore/svg/SVGLineElement.cpp:
(WebCore::SVGLineElement::svgAttributeChanged):
* Source/WebCore/svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::svgAttributeChanged):
(WebCore::SVGMaskElement::childrenChanged):
* Source/WebCore/svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::svgAttributeChanged):
* Source/WebCore/svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::svgAttributeChanged):
* Source/WebCore/svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::svgAttributeChanged):
* Source/WebCore/svg/SVGResourceElementClient.h:
* Source/WebCore/svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::svgAttributeChanged):
* Source/WebCore/svg/SVGTextElement.cpp:
(WebCore::SVGTextElement::childrenChanged):
* Source/WebCore/svg/SVGTextElement.h:
* Source/WebCore/svg/SVGTextPositioningElement.cpp:
(WebCore::SVGTextPositioningElement::svgAttributeChanged):
* Source/WebCore/svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::svgAttributeChanged):

Canonical link: https://commits.webkit.org/277292@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to