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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/hittest/text-with-multiple-tspans.svg

Issue 1454623002: Hit test SVG line boxes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup extra debugging code and minor bugs Created 5 years, 1 month 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 <svg onload="runTest()" xmlns="http://www.w3.org/2000/svg" width="300" height="1 50" viewBox="0 0 300 150">
2 <rect id="background" width="100%" height="100%" fill="blue" />
3 <text id="text">
4 <tspan id="tspan1" x="10" dy="1em">Foo</tspan>
5 <tspan id="tspan2" x="10" dy="1.2em">Foo bar baz</tspan>
6 </text>
7 <defs>
8 <style type="text/css">
9 <![CDATA[
10 @font-face {
11 font-family: Ahem;
12 src: url(../../resources/Ahem.ttf);
13 }
14 text {
15 font-family: Ahem;
16 font-size: 40px;
17 }
18 ]]>
19 </style>
20 <script type="text/javascript">
21 <![CDATA[
22 function runTest() {
23 if (window.testRunner)
24 testRunner.dumpAsText();
25
26 // The point at 170,30 is contained within the text's bounding b ox
27 // but not in a painted part so the element should be the backgr ound.
28 // The point 50,30 is contained within the first tspan's boundin g box.
29 // 50,60 and 250,60 are both contained within the second tspan's bounding box.
30 var text = document.getElementById("text");
31 var tspan1 = document.getElementById("tspan1");
32 var tspan2 = document.getElementById("tspan2");
33 var background = document.getElementById("background");
34 if (document.elementFromPoint(50, 30) === tspan1
35 && document.elementFromPoint(170, 30) === background
36 && document.elementFromPoint(50, 60) === tspan2
37 && document.elementFromPoint(250, 60) === tspan2)
38 text.textContent = "PASS";
39 else
40 text.textContent = "FAIL";
41 }
42 ]]>
43 </script>
44 </defs>
45 </svg>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698