OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="../resources/run-after-layout-and-paint.js"></script> | 2 <script src="../resources/run-after-layout-and-paint.js"></script> |
3 <!-- Tests various permutations of composition underlines in LTR and RTL text. | 3 <!-- Tests various permutations of composition underlines in LTR and RTL text. |
4 These are normally used by foreign language IME (Input Method Extension). --> | 4 These are normally used by foreign language IME (Input Method Extension). --> |
5 <div dir="rtl" style="float: right;"> | 5 <div dir="rtl" style="float: right;"> |
6 <p>RTL</p> | 6 <p>RTL</p> |
7 <div id="markRtlAll" dir="rtl">abcdef</div> | 7 <div id="markRtlAll" dir="rtl">abcdef</div> |
8 <div id="markRtlAllThick">abcdef</div> | 8 <div id="markRtlAllThick">abcdef</div> |
9 <div id="markRtlBeginning">abcdef</div> | 9 <div id="markRtlBeginning">abcdef</div> |
10 <div id="markRtlAllExceptFirstAndLast">abcdef</div> | 10 <div id="markRtlAllExceptFirstAndLast">abcdef</div> |
(...skipping 18 matching lines...) Expand all Loading... |
29 function highlightRange(elem, start, end, underlineColor, thick, backgroundColor
) { | 29 function highlightRange(elem, start, end, underlineColor, thick, backgroundColor
) { |
30 var range = document.createRange(); | 30 var range = document.createRange(); |
31 var textNode = elem.firstChild; | 31 var textNode = elem.firstChild; |
32 range.setStart(textNode, start); | 32 range.setStart(textNode, start); |
33 range.setEnd(textNode, end); | 33 range.setEnd(textNode, end); |
34 if (typeof internals !== 'undefined') | 34 if (typeof internals !== 'undefined') |
35 internals.addCompositionMarker(range, underlineColor, thick, backgroundC
olor); | 35 internals.addCompositionMarker(range, underlineColor, thick, backgroundC
olor); |
36 }; | 36 }; |
37 | 37 |
38 function highlightRangeSimple(elem, start, end) { | 38 function highlightRangeSimple(elem, start, end) { |
39 highlightRange(elem, start, end, 'orange', false, 'lightBlue'); | 39 highlightRange(elem, start, end, 'orange', 'thin', 'lightBlue'); |
40 }; | 40 }; |
41 | 41 |
42 function highlightAcrossNodes(startNode, start, endNode, end) { | 42 function highlightAcrossNodes(startNode, start, endNode, end) { |
43 var range = document.createRange(); | 43 var range = document.createRange(); |
44 range.setStart(startNode, start); | 44 range.setStart(startNode, start); |
45 range.setEnd(endNode, end); | 45 range.setEnd(endNode, end); |
46 if (typeof internals !== 'undefined') | 46 if (typeof internals !== 'undefined') |
47 internals.addCompositionMarker(range, 'orange', false, 'lightBlue'); | 47 internals.addCompositionMarker(range, 'orange', 'thin', 'lightBlue'); |
48 }; | 48 }; |
49 | 49 |
50 onload = runAfterLayoutAndPaint(function() { | 50 onload = runAfterLayoutAndPaint(function() { |
51 highlightRangeSimple(markAll, 0, 6); | 51 highlightRangeSimple(markAll, 0, 6); |
52 highlightRange(markAllThick, 0, 6, 'orange', true, 'lightBlue'); | 52 highlightRange(markAllThick, 0, 6, 'orange', 'thick', 'lightBlue'); |
53 highlightRange(markAllDifferentColors, 0, 6, 'purple', true, 'lightYellow'); | 53 highlightRange(markAllDifferentColors, 0, 6, 'purple', 'thick', 'lightYellow
'); |
54 highlightRangeSimple(markBeginning, 0, 3); | 54 highlightRangeSimple(markBeginning, 0, 3); |
55 highlightRangeSimple(markAllExceptFirstAndLast, 1, 5); | 55 highlightRangeSimple(markAllExceptFirstAndLast, 1, 5); |
56 highlightRangeSimple(markEnd, 3, 6); | 56 highlightRangeSimple(markEnd, 3, 6); |
57 highlightRangeSimple(markNothingZero, 0, 0); | 57 highlightRangeSimple(markNothingZero, 0, 0); |
58 highlightRangeSimple(markNothingEnd, 6, 6); | 58 highlightRangeSimple(markNothingEnd, 6, 6); |
59 | 59 |
60 highlightRangeSimple(markRtlAll, 0, 6); | 60 highlightRangeSimple(markRtlAll, 0, 6); |
61 highlightRange(markRtlAllThick, 0, 6, 'orange', true, 'lightBlue'); | 61 highlightRange(markRtlAllThick, 0, 6, 'orange', 'thick', 'lightBlue'); |
62 highlightRangeSimple(markRtlBeginning, 0, 3); | 62 highlightRangeSimple(markRtlBeginning, 0, 3); |
63 highlightRangeSimple(markRtlAllExceptFirstAndLast, 1, 5); | 63 highlightRangeSimple(markRtlAllExceptFirstAndLast, 1, 5); |
64 highlightRangeSimple(markRtlEnd, 3, 6); | 64 highlightRangeSimple(markRtlEnd, 3, 6); |
65 | 65 |
66 highlightAcrossNodes(markAcrossNodes.childNodes[0].firstChild, 3, | 66 highlightAcrossNodes(markAcrossNodes.childNodes[0].firstChild, 3, |
67 markAcrossNodes.childNodes[1].firstChild, 3); | 67 markAcrossNodes.childNodes[1].firstChild, 3); |
68 highlightAcrossNodes(markRtlAcrossNodes.childNodes[0].firstChild, 3, | 68 highlightAcrossNodes(markRtlAcrossNodes.childNodes[0].firstChild, 3, |
69 markRtlAcrossNodes.childNodes[1].firstChild, 3); | 69 markRtlAcrossNodes.childNodes[1].firstChild, 3); |
70 }, true); | 70 }, true); |
71 </script> | 71 </script> |
OLD | NEW |