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

Side by Side Diff: LayoutTests/svg/text/textquery-collapsed-whitespace.html

Issue 1083073002: Add a "logical query mode" to SVGTextQuery (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Older URL. Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Text queries on elements with collapsed whitespace</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <svg>
6 <text transform="translate(0 20)">A B C</text>
7 <text transform="translate(0 40)">A <tspan>B</tspan> C</text>
8 <text transform="translate(0 60)"> A B C </text>
9 <text transform="translate(0 80)"> A <tspan> B C </tspan> </text>
10 <text transform="translate(0 100)"> <tspan> A B </tspan> C </text>
11 <text transform="translate(0 120)"> A <tspan> B </tspan> C </text>
12 </svg>
13 <script>
14 setup(function() {
15 window.textElements = document.getElementsByTagName('text');
16 var referenceElement = textElements[0];
17 window.reference = [];
18 for (var i = 0; i < 5; ++i)
19 reference.push(referenceElement.getExtentOfChar(i));
20 });
21
22 test(function() {
23 for (var j = 1; j < textElements.length; ++j) {
24 var element = textElements[j];
25 assert_equals(element.getNumberOfChars(), 5, 'collapsed length');
26
27 for (var i = 0; i < 5; ++i) {
28 var extents = element.getExtentOfChar(i);
29 for (var attr of ['x', 'y', 'width', 'height'])
30 assert_equals(extents[attr], reference[i][attr], 'same extents a s reference (' + attr + ')');
31 }
32
33 var queryPoint = element.ownerSVGElement.createSVGPoint();
34 for (var i = 0; i < 5; ++i) {
35 queryPoint.x = reference[i].x + reference[i].width / 2;
36 queryPoint.y = reference[i].y + reference[i].height / 2;
37 assert_equals(element.getCharNumAtPosition(queryPoint), i, 'at same position as reference');
38 }
39 }
40 });
41 </script>
OLDNEW
« no previous file with comments | « LayoutTests/svg/text/bidi-text-query.svg ('k') | LayoutTests/svg/text/textquery-collapsed-whitespace-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698