Commit ab8ae315 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Chromium LUCI CQ

Invalidate any dependent patterns when a <pattern> is attached/detached

SVGPatternElement::CollectPatternAttributes() rejects linked <pattern>
elements that are not attached, so we need to make sure that they re-
evaluate their attributes if a referenced element gets/loses a
LayoutObject.

Bug: 1164735
Change-Id: I0f1e28c890f7f91cacbfa0f8be133d919df5c7db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620564Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#842066}
parent 76c20976
...@@ -60,6 +60,23 @@ void LayoutSVGResourcePattern::RemoveAllClientsFromCache() { ...@@ -60,6 +60,23 @@ void LayoutSVGResourcePattern::RemoveAllClientsFromCache() {
MarkAllClientsForInvalidation(SVGResourceClient::kPaintInvalidation); MarkAllClientsForInvalidation(SVGResourceClient::kPaintInvalidation);
} }
void LayoutSVGResourcePattern::WillBeDestroyed() {
NOT_DESTROYED();
To<SVGPatternElement>(*GetElement()).InvalidateDependentPatterns();
LayoutSVGResourcePaintServer::WillBeDestroyed();
}
void LayoutSVGResourcePattern::StyleDidChange(StyleDifference diff,
const ComputedStyle* old_style) {
NOT_DESTROYED();
LayoutSVGResourcePaintServer::StyleDidChange(diff, old_style);
if (old_style)
return;
// The resource has been attached, any linked <pattern> may need to
// re-evaluate its attributes.
To<SVGPatternElement>(*GetElement()).InvalidateDependentPatterns();
}
bool LayoutSVGResourcePattern::RemoveClientFromCache( bool LayoutSVGResourcePattern::RemoveClientFromCache(
SVGResourceClient& client) { SVGResourceClient& client) {
NOT_DESTROYED(); NOT_DESTROYED();
......
...@@ -59,6 +59,9 @@ class LayoutSVGResourcePattern final : public LayoutSVGResourcePaintServer { ...@@ -59,6 +59,9 @@ class LayoutSVGResourcePattern final : public LayoutSVGResourcePaintServer {
} }
private: private:
void WillBeDestroyed() override;
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
bool FindCycleFromSelf(SVGResourcesCycleSolver&) const override; bool FindCycleFromSelf(SVGResourcesCycleSolver&) const override;
std::unique_ptr<PatternData> BuildPatternData( std::unique_ptr<PatternData> BuildPatternData(
const FloatRect& object_bounding_box); const FloatRect& object_bounding_box);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment