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

Side by Side Diff: LayoutTests/fast/borders/border-radius-hittest.html

Issue 249133002: hitTest should take care if the location is inside rounded border if border-radius is specified (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 var x, y;
5
6 function offset(elem) {
7 var result = {top: 0, left: 0};
8 for (; elem; elem = elem.offsetParent) {
9 result.left += elem.offsetLeft;
10 result.top += elem.offsetTop;
11 }
12 return result;
13 }
14
15 function test() {
16 var innerBox = document.getElementById('roundedBox');
17 x = offset(innerBox).left;
18 y = offset(innerBox).top;
ojan 2014/04/30 18:37:47 Nit: You can use getBoundingClientRect instead of
pals 2014/05/06 06:33:41 Done.
19 // At top-left corner.
20 shouldBe("document.elementFromPoint(x + 5, y + 5).id", "'container'");
21 // At top-right corner.
22 shouldBe("document.elementFromPoint(x + 195, y + 5).id", "'container'");
23 // At bottom-left corner.
24 shouldBe("document.elementFromPoint(x + 5, y + 195).id", "'container'");
25 // At bottom-right corner.
26 shouldBe("document.elementFromPoint(x + 195, y + 195).id", "'container'");
27 // At the center.
28 shouldBe("document.elementFromPoint(x + 100, y + 100).id", "'roundedBox'");
29 isSuccessfullyParsed();
ojan 2014/04/30 18:37:47 I don't think you need isSuccessfullyParsed anymor
pals 2014/05/06 06:33:41 Done.
30 }
31 </script>
32 <style>
33 #container {
34 width: 200px; height: 200px;
ojan 2014/04/30 18:37:47 Nit: we usually put each property on its own line.
pals 2014/05/06 06:33:41 Done.
35 background-color: lightgray;
36 }
37 #roundedBox {
38 width: 200px; height: 200px;
39 border-radius: 50px;
40 background-color: lightgreen;
41 }
42 </style>
43 <body onload="test()">
44 <p>This test checks that div block should not get events on clicking outside the rounded border but within the bounding box of the block.</p>
45 <div id="container">
46 <div id="roundedBox"></div>
47 </div>
48 <div id="console"></div>
ojan 2014/04/30 18:37:47 You don't need this. js-test.js will add it for yo
pals 2014/05/06 06:33:41 I added this to print the console log below the "c
49 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/borders/border-radius-hittest-expected.txt » ('j') | Source/core/rendering/RenderBlock.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698