-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use layout coordinates for LayoutClipRect of ClipPathClip and MaskClip
This is to ensure correct inclusive intersection for empty objects with empty clip-path/mask. Previously, we failed to detect viewport intersection and start loading a lazy loading <img> which was empty with an empty clip-path before the image was loaded. A change (crrev.com/936552) from blink::EnclosingIntRect(FloatRect) to gfx::ToEnclosingRect(gfx::RectF) exposed the issue. The difference between the two functions was that for an empty input rect with non-integral origin, the former returned an non-empty IntRect, while the latter returns an empty gfx::Rect. An alternative to this CL is to add a version of gfx::ToEnclosingRect() behaving the same as blink::EnclosingIntRect(), but I think this CL is better by making LayoutClipRect for ClipPathClip and MaskClip correct. Bug: 1308299, 1248598 Change-Id: I242c1d38277cdd91aa596fda15156d991f2626d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3568746 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#989750}
- Loading branch information
1 parent
5357c2e
commit cc453fd
Showing
11 changed files
with
118 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-clip-path-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<img src="resources/image.png"> |
20 changes: 20 additions & 0 deletions
20
...nal/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-clip-path.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="author" title="Xianzhu Wang" href="mailto:wangxianzhu@chromium.org"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/urls-and-fetching.html#lazy-loading-attributes"> | ||
<link rel="help" href="https://crbug.com/1308299"> | ||
<link rel="match" href="image-loading-lazy-clip-path-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<style> | ||
img { | ||
clip-path: polygon(10% 0, 90% 0, 90% 90%, 0 90%, 0 10%); | ||
vertical-align: middle; | ||
} | ||
</style> | ||
<img id=target loading="lazy" | ||
src="resources/image.png" | ||
style="vertical-align: middle; clip-path: polygon(0 0, 110% 0, 110% 110%, 0 110%, 0 0)"> | ||
<script> | ||
target.onload = takeScreenshot; | ||
</script> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
...external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-mask.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="author" title="Xianzhu Wang" href="mailto:wangxianzhu@chromium.org"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/urls-and-fetching.html#lazy-loading-attributes"> | ||
<link rel="help" href="https://crbug.com/1308299"> | ||
<link rel="match" href="image-loading-lazy-clip-path-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<style> | ||
img { | ||
mask: url(#mask); | ||
vertical-align: middle; | ||
} | ||
</style> | ||
<svg style="display: none"> | ||
<mask id="mask"> | ||
<rect width="1000" height="1000" fill="white"/> | ||
</mask> | ||
</svg> | ||
<img id=target loading="lazy" | ||
src="resources/image.png" | ||
style="vertical-align: middle; clip-path: polygon(0 0, 110% 0, 110% 110%, 0 110%, 0 0)"> | ||
<script> | ||
target.onload = takeScreenshot; | ||
</script> | ||
</html> |
Binary file modified
BIN
+0 Bytes
(100%)
...ty/blink/web_tests/flag-specific/highdpi/paint/masks/fieldset-mask-expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.