Commit 2303c8fe authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Invalidate clipPath clients after mutating 'transform'

When the 'transform' presentation attribute (or CSS property) was
mutated on a <clipPath>, its clients were not notified. Make sure they
are.

Bug: 881700
Change-Id: Id42aedf814472d8156804a955e6bbf2aa2792ec2
Reviewed-on: https://chromium-review.googlesource.com/1213142Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#589511}
parent f7e8c68b
<!DOCTYPE html>
<div style="width: 100px; height: 100px; background-color: green"></div>
<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
#target {
width: 100px;
height: 100px;
background-color: green;
clip-path: url(#clip);
}
</style>
<div id="target"></div>
<svg>
<clipPath id="clip">
<rect width="1" height="1"/>
</clipPath>
</svg>
<script>
runAfterLayoutAndPaint(function() {
clip.style.transform = 'scale(100, 100)';
}, true);
</script>
<!DOCTYPE html>
<div style="width: 100px; height: 100px; background-color: green"></div>
<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
#target {
width: 100px;
height: 100px;
background-color: green;
clip-path: url(#clip);
}
</style>
<div id="target"></div>
<svg>
<clipPath id="clip">
<rect width="1" height="1"/>
</clipPath>
</svg>
<script>
runAfterLayoutAndPaint(function() {
clip.setAttribute('transform', 'scale(100 100)');
}, true);
</script>
...@@ -269,6 +269,15 @@ FloatRect LayoutSVGResourceClipper::ResourceBoundingBox( ...@@ -269,6 +269,15 @@ FloatRect LayoutSVGResourceClipper::ResourceBoundingBox(
return CalculateClipTransform(reference_box).MapRect(local_clip_bounds_); return CalculateClipTransform(reference_box).MapRect(local_clip_bounds_);
} }
void LayoutSVGResourceClipper::StyleDidChange(StyleDifference diff,
const ComputedStyle* old_style) {
LayoutSVGResourceContainer::StyleDidChange(diff, old_style);
if (diff.TransformChanged()) {
MarkAllClientsForInvalidation(SVGResourceClient::kBoundariesInvalidation |
SVGResourceClient::kPaintInvalidation);
}
}
void LayoutSVGResourceClipper::WillBeDestroyed() { void LayoutSVGResourceClipper::WillBeDestroyed() {
MarkAllClientsForInvalidation(SVGResourceClient::kBoundariesInvalidation | MarkAllClientsForInvalidation(SVGResourceClient::kBoundariesInvalidation |
SVGResourceClient::kPaintInvalidation); SVGResourceClient::kPaintInvalidation);
......
...@@ -64,6 +64,7 @@ class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer { ...@@ -64,6 +64,7 @@ class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer {
} }
protected: protected:
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
void WillBeDestroyed() override; void WillBeDestroyed() override;
private: private:
......
...@@ -75,7 +75,7 @@ class LayoutSVGResourceContainer : public LayoutSVGHiddenContainer { ...@@ -75,7 +75,7 @@ class LayoutSVGResourceContainer : public LayoutSVGHiddenContainer {
// Used from RemoveAllClientsFromCache methods. // Used from RemoveAllClientsFromCache methods.
void MarkAllClientsForInvalidation(InvalidationModeMask); void MarkAllClientsForInvalidation(InvalidationModeMask);
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) final; void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
void WillBeDestroyed() override; void WillBeDestroyed() override;
bool is_in_layout_; bool is_in_layout_;
......
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