Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: third_party/WebKit/LayoutTests/hittesting/image-with-border-radius.html

Issue 1506053003: Include clip-path and border radius when hit testing boxes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hit test in PaintLayer, add transformed clip path tests Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/hittesting/image-with-border-radius-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/hittesting/image-with-border-radius.html
diff --git a/third_party/WebKit/LayoutTests/hittesting/image-with-border-radius.html b/third_party/WebKit/LayoutTests/hittesting/image-with-border-radius.html
new file mode 100644
index 0000000000000000000000000000000000000000..92fd4c5e3262e1722ecf0e51087dba9dc442ef53
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/hittesting/image-with-border-radius.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<script src="../resources/js-test.js"></script>
+<script>
+var x, y;
+function test() {
+ var rect = roundedImage.getBoundingClientRect();
+ x = rect.left;
+ y = rect.top;
+
+ // At top-left corner, outside the outer border radius.
+ shouldBe("document.elementFromPoint(x + 20, y + 20).id", "'container'");
+
+ // At top-left corner, inside outer border radius.
+ shouldBe("document.elementFromPoint(x + 35, y + 35).id", "'roundedImage'");
+ shouldBe("document.elementFromPoint(x + 60, y + 60).id", "'roundedImage'");
+
+ // Fully inside border.
+ shouldBe("document.elementFromPoint(x + 68, y + 68).id", "'roundedImage'");
+ shouldBe("document.elementFromPoint(x + 80, y + 80).id", "'roundedImage'");
+ shouldBe("document.elementFromPoint(x + 230, y + 230).id", "'roundedImage'");
+
+ // At bottom-right corner, insider inner border radius.
+ shouldBe("document.elementFromPoint(x + 240, y + 240).id", "'roundedImage'");
+ shouldBe("document.elementFromPoint(x + 265, y + 265).id", "'roundedImage'");
+
+ // At bottom-right corner, outside the outer border radius.
+ shouldBe("document.elementFromPoint(x + 275, y + 275).id", "'container'");
+}
+</script>
+<style>
+ #container {
+ display: inline-block;
+ background-color: black;
+ }
+ #roundedImage {
+ width: 200px;
+ height: 200px;
+ border-radius: 100px;
+ background-color: blue;
+ border: 50px solid orange;
+ display: block;
+ }
+ #roundedImage:hover {
+ border-color: green;
+ background-color: green;
+ }
+</style>
+<body onload="test()">
+ <p>The border radius clip should be respected when hit testing images.</p>
+ <div id="container">
+ <img id="roundedImage" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==">
+ </div>
+ <div id="console"></div>
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/hittesting/image-with-border-radius-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698