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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/composition-marker-split.html

Issue 2906953002: [DMC #26] Add CompositionMarker::Thickness enum (Closed)
Patch Set: Rebase Created 3 years, 6 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
OLDNEW
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 <!-- Text is injected after page load into the center of the initial text. 3 <!-- Text is injected after page load into the center of the initial text.
4 This results in an InlineTextBox with start() > 0, which allows testing 4 This results in an InlineTextBox with start() > 0, which allows testing
5 to make sure composition underlines are still painted in the right place. --> 5 to make sure composition underlines are still painted in the right place. -->
6 <div id="markSplit">abc def</div> 6 <div id="markSplit">abc def</div>
7 <div id="markSplitTruncated" style="white-space: nowrap; overflow: hidden; text- overflow: ellipsis; width: 8em;">abcdefghi jklmnopqr</div> 7 <div id="markSplitTruncated" style="white-space: nowrap; overflow: hidden; text- overflow: ellipsis; width: 8em;">abcdefghi jklmnopqr</div>
8 <script> 8 <script>
9 function injectText(node, offset) { 9 function injectText(node, offset) {
10 var textNode = node.firstChild; 10 var textNode = node.firstChild;
11 var replacementNode = textNode.splitText(offset); 11 var replacementNode = textNode.splitText(offset);
12 var newTextNode = document.createTextNode(' xxx '); 12 var newTextNode = document.createTextNode(' xxx ');
13 node.insertBefore(newTextNode, replacementNode); 13 node.insertBefore(newTextNode, replacementNode);
14 } 14 }
15 15
16 function highlightRange(node) { 16 function highlightRange(node) {
17 var range = document.createRange(); 17 var range = document.createRange();
18 var textNode = node.childNodes[2]; 18 var textNode = node.childNodes[2];
19 range.setStart(textNode, 0); 19 range.setStart(textNode, 0);
20 range.setEnd(textNode, 4); 20 range.setEnd(textNode, 4);
21 if (typeof internals !== 'undefined') 21 if (typeof internals !== 'undefined')
22 internals.addCompositionMarker(range, 'orange', false, 'lightBlue'); 22 internals.addCompositionMarker(range, 'orange', 'thin', 'lightBlue');
23 } 23 }
24 24
25 onload = runAfterLayoutAndPaint(function() { 25 onload = runAfterLayoutAndPaint(function() {
26 injectText(markSplit, 3); 26 injectText(markSplit, 3);
27 // TODO(wkorman): This ITB has start=1, end=3, truncation=USHRT_MAX, len=3. 27 // TODO(wkorman): This ITB has start=1, end=3, truncation=USHRT_MAX, len=3.
28 // Validate that the actual painting behavior is what's expected. 28 // Validate that the actual painting behavior is what's expected.
29 highlightRange(markSplit); 29 highlightRange(markSplit);
30 30
31 injectText(markSplitTruncated, 9); 31 injectText(markSplitTruncated, 9);
32 // TODO(wkorman): This ITB has start=1, end=9, truncation=3, len=9. Validate 32 // TODO(wkorman): This ITB has start=1, end=9, truncation=3, len=9. Validate
33 // that the actual painting behavior is what's expected. 33 // that the actual painting behavior is what's expected.
34 highlightRange(markSplitTruncated); 34 highlightRange(markSplitTruncated);
35 }, true); 35 }, true);
36 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698