Commit 292c16f2 authored by Hyunjune's avatar Hyunjune Committed by Commit Bot

Fix that mask containing image with clip-path can not apply to client

When image contained mask is loading, it touches a mask flag called
|computed_invalidation_mask_|.
Because |MarkForLayoutAndParentResourceInvalidation| is called in
|ImageChanged| without layout while loading, so this flag would be
changed without clear. And this flag is used in the next layout.
Actually this mask can not apply to client element in next time.
This patch clears the mask flag in pre-paint time.

Bug: 1086070
Change-Id: I55a7a16faafe4eeefac88e8e15e6d3b18b097acf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432151Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Hyunjune Kim <hyunjune.kim@samsung.com>
Cr-Commit-Position: refs/heads/master@{#813061}
parent d1f13674
......@@ -27,6 +27,7 @@ base::Optional<IntRect> CSSMaskPainter::MaskBoundingBox(
SVGResources::ReferenceBoxForEffects(object);
const float reference_box_zoom =
object.IsSVGForeignObject() ? object.StyleRef().EffectiveZoom() : 1;
masker->ClearInvalidationMask();
return EnclosingIntRect(
masker->ResourceBoundingBox(reference_box, reference_box_zoom));
}
......
<svg class="reftest-wait" xmlns="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml">
<html:script src="/common/reftest-wait.js"/>
<html:script src="/common/rendering-utils.js"/>
<html:link rel="match" href="../embedded/reference/green-rect-100x100.svg"/>
<script>
<![CDATA[
function loadImage() {
waitForAtLeastOneFrame().then(() => {
var clip = document.getElementById('clip');
clip.setAttribute('width', '100');
clip.setAttribute('height', '100');
waitForAtLeastOneFrame().then(takeScreenshot);
});
}
]]>
</script>
<defs>
<mask id="mask">
<g clip-path="url(#clip_path)">
<image onload="loadImage()" width="100px" height="100px" href="support/white-rect-100x100.svg"/>
</g>
</mask>
<clipPath id="clip_path">
<rect id="clip"/>
</clipPath>
</defs>
<g mask="url(#mask)">
<rect width="100" height="100" fill="green"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" fill="white"/>
</svg>
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