Index: third_party/WebKit/LayoutTests/svg/text/combining-character-queries.html |
diff --git a/third_party/WebKit/LayoutTests/svg/text/combining-character-queries.html b/third_party/WebKit/LayoutTests/svg/text/combining-character-queries.html |
index 83a617ae5d083fc531b1574b7840dba6af9f127e..21cef57fcc3a41605b93fa4ad8d23bae24808b30 100644 |
--- a/third_party/WebKit/LayoutTests/svg/text/combining-character-queries.html |
+++ b/third_party/WebKit/LayoutTests/svg/text/combining-character-queries.html |
@@ -4,74 +4,39 @@ |
.testTextRun { |
font-size: 35px; |
} |
- .description { |
- font-size: 12px; |
- text-anchor: middle; |
- } |
- #highlightContainer text { |
- text-anchor: middle; |
- font-size: 8px; |
- -webkit-user-select: none; |
- user-select: none; |
+ #highlightContainer rect { |
+ fill-opacity: 0.3; |
} |
</style> |
<svg width="600px" height="500px" xmlns="http://www.w3.org/2000/svg"> |
<g id="highlightContainer"/> |
- <g> |
- <!-- multiple combining diacritics in LTR --> |
- <text x="50" y="50" class="testTextRun" font-family="cursive">ab̌č̌</text> |
- <text x="200" y="50" class="testTextRun" font-family="serif">ab̌č̌</text> |
- <text x="350" y="50" class="testTextRun" font-family="sans-serif">ab̌č̌</text> |
- <!-- multiple combining diacritics in RTL --> |
- <text x="100" y="125" class="testTextRun" font-family="cursive" direction="rtl">‏a‏b̌‏č̌</text> |
- <text x="250" y="125" class="testTextRun" font-family="serif" direction="rtl">‏a‏b̌‏č̌</text> |
- <text x="400" y="125" class="testTextRun" font-family="sans-serif" direction="rtl">‏a‏b̌‏č̌</text> |
+ <!-- multiple combining diacritics in LTR --> |
+ <text x="50" y="50" class="testTextRun" font-family="cursive">ab̌č̌</text> |
+ <text x="200" y="50" class="testTextRun" font-family="serif">ab̌č̌</text> |
+ <text x="350" y="50" class="testTextRun" font-family="sans-serif">ab̌č̌</text> |
+ |
+ <!-- multiple combining diacritics in RTL --> |
+ <text x="100" y="125" class="testTextRun" font-family="cursive" direction="rtl">‏a‏b̌‏č̌</text> |
+ <text x="250" y="125" class="testTextRun" font-family="serif" direction="rtl">‏a‏b̌‏č̌</text> |
+ <text x="400" y="125" class="testTextRun" font-family="sans-serif" direction="rtl">‏a‏b̌‏č̌</text> |
- <!-- multiple combining diacritics on ligatures in LTR --> |
- <text x="50" y="200" class="testTextRun" font-family="cursive">fǐ ffǐ̌</text> |
- <text x="200" y="200" class="testTextRun" font-family="serif">fǐ ffǐ̌</text> |
- <text x="350" y="200" class="testTextRun" font-family="sans-serif">fǐ ffǐ̌</text> |
+ <!-- multiple combining diacritics on ligatures in LTR --> |
+ <text x="50" y="200" class="testTextRun" font-family="cursive">fǐ ffǐ̌</text> |
+ <text x="200" y="200" class="testTextRun" font-family="serif">fǐ ffǐ̌</text> |
+ <text x="350" y="200" class="testTextRun" font-family="sans-serif">fǐ ffǐ̌</text> |
- <!-- combining diacritics on ligatures in mixed bidi runs --> |
- <text x="50" y="275" class="testTextRun" font-family="cursive">ff̌ــلاff̌</text> |
- <text x="200" y="275" class="testTextRun" font-family="serif">ff̌ــلاff̌</text> |
- <text x="350" y="275" class="testTextRun" font-family="sans-serif">ff̌ــلاff̌</text> |
+ <!-- combining diacritics on ligatures in mixed bidi runs --> |
+ <text x="50" y="275" class="testTextRun" font-family="cursive">ff̌ــلاff̌</text> |
+ <text x="200" y="275" class="testTextRun" font-family="serif">ff̌ــلاff̌</text> |
+ <text x="350" y="275" class="testTextRun" font-family="sans-serif">ff̌ــلاff̌</text> |
- <!-- combining diacritics which are wider than characters in mixed bidi runs --> |
- <text x="50" y="350" class="testTextRun" font-family="cursive"> ̌ﶰi̳</text> |
- <text x="200" y="350" class="testTextRun" font-family="serif"> ̌ﶰi̳</text> |
- <text x="350" y="350" class="testTextRun" font-family="sans-serif"> ̌ﶰi̳</text> |
- </g> |
+ <!-- combining diacritics which are wider than characters in mixed bidi runs --> |
+ <text x="50" y="350" class="testTextRun" font-family="cursive"> ̌ﶰi̳</text> |
+ <text x="200" y="350" class="testTextRun" font-family="serif"> ̌ﶰi̳</text> |
+ <text x="350" y="350" class="testTextRun" font-family="sans-serif"> ̌ﶰi̳</text> |
</svg> |
+<script src="resources/highlightGlyphs.js"></script> |
<script> |
- function highlightGlyph(text, index, color) { |
- var extent = text.getExtentOfChar(index); |
- // Highlight rect that we've selected using the extent information |
- var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
- rectElement.setAttribute("x", extent.x); |
- rectElement.setAttribute("y", extent.y); |
- rectElement.setAttribute("width", extent.width); |
- rectElement.setAttribute("height", extent.height); |
- rectElement.setAttribute("fill-opacity", "0.3"); |
- rectElement.setAttribute("fill", color); |
- document.getElementById("highlightContainer").appendChild(rectElement); |
- // Output the start offset |
- var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); |
- textElement.setAttribute("x", extent.x + extent.width / 2); |
- textElement.setAttribute("y", extent.y + extent.height + 7); |
- textElement.appendChild(document.createTextNode(index)); |
- document.getElementById("highlightContainer").appendChild(textElement); |
- } |
- |
- var colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]; |
- // Highlight each glyph with a semi-transparent rectangle and |
- // a number corresponding to the queried character index. |
- var textElements = document.querySelectorAll(".testTextRun"); |
- for (var elemNum = 0; elemNum < textElements.length; ++elemNum) { |
- var text = textElements[elemNum]; |
- var charCount = text.getNumberOfChars(); |
- for (var index = 0; index < charCount; ++index) |
- highlightGlyph(text, index, colors[index % colors.length]); |
- } |
+ highlightGlyphs(document.querySelectorAll('.testTextRun'), highlightContainer); |
</script> |