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

Side by Side Diff: LayoutTests/svg/text/bidi-getcharnumatpos.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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/text/bidi-getcharnumatpos-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="UTF-8">
3 <title>BiDi getCharNumAtPosition()</title>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <svg width="50px" height="60px" font-family="Arial" font-size="30px">
7 <text y="40" direction="ltr">Foo הפוך</text>
8 <text text-anchor="end" y="70" direction="rtl">Foo הפוך</text>
9 </svg>
10 <script>
11 function getExtents(textElement) {
12 var glyphBBoxes = [];
13 for (var i = 0; i < 8; ++i)
14 glyphBBoxes.push(textElement.getExtentOfChar(i));
15 return glyphBBoxes;
16 }
17
18 function getCharNums(textElement, glyphBBoxes) {
19 var charNums = [];
20 var point = textElement.ownerSVGElement.createSVGPoint();
21 for (var i = 0; i < glyphBBoxes.length; ++i) {
22 var bbox = glyphBBoxes[i];
23 point.x = bbox.x + bbox.width / 2;
24 point.y = bbox.y + bbox.height / 2;
25 charNums.push(textElement.getCharNumAtPosition(point));
26 }
27 return charNums;
28 }
29
30 var textElements = document.querySelectorAll("text");
31 for (var j = 0; j < textElements.length; ++j) {
32 var textElement = textElements[j];
33 test(function() {
34 assert_equals(textElement.textContent.length, 10);
35 var glyphChars = getCharNums(textElement, getExtents(textElement));
36 for (var i = 0; i < glyphChars.length; ++i)
37 assert_equals(glyphChars[i], i);
38 }, document.title+', direction='+textElement.getAttribute("direction")+'.');
39 }
40 </script>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/text/bidi-getcharnumatpos-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698