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

Side by Side Diff: LayoutTests/fast/css-generated-content/crash-selection-editing-removes-pseudo.html

Issue 693283002: Avoid anchoring to pseudo elements when using logical ordering in a selection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 1 month 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <style> 3 <style>
4 #before:before { 4 #before:before {
5 /* must be an inline-block */ 5 /* must be an inline-block */
6 display: inline-block; 6 display: inline-block;
7 content: 'before'; 7 content: 'before';
8 } 8 }
9 #start:after {
10 /* must be an inline-block */
11 display: inline-block;
12 content: 'after';
13 }
9 </style> 14 </style>
10 15
11 16
12 <p>Passes if it doesn't crash and the pseudo exists.</p> 17 <p>Passes if it doesn't crash.</p>
13 18
14 <div id="test"> 19 <div id="test">
15 <span id="before"><!-- no content can be here --></span> 20 <span id="before"><!-- no content can be here --></span>
16 <span>text</span> 21 <span>text</span>
17 <span id="start"><!-- no content can be here --></span> 22 <span id="start"><!-- no content can be here --></span>
18 </div> 23 </div>
19 24
20 <script> 25 <script>
21 if (window.testRunner) 26 if (window.testRunner)
22 testRunner.dumpAsText(); 27 testRunner.dumpAsText();
23 28
24 var before = document.getElementById('before'); 29 var before = document.getElementById('before');
30 var start = document.getElementById('start');
25 var test = document.getElementById('test'); 31 var test = document.getElementById('test');
26 32
27 // Select from the #start backwards to the start of the line. 33 // Select from the #start backwards to the start of the line.
28 window.getSelection().setBaseAndExtent(document.getElementById('start')); 34 window.getSelection().setBaseAndExtent(document.getElementById('start'));
29 window.getSelection().modify('extend', 'backward', 'lineBoundary') 35 window.getSelection().modify('extend', 'backward', 'lineBoundary')
30 36
31 // Replace the selection with a break. This apparently puts two <br>'s before 37 // Replace the selection with a break. This replaces #before, text,
32 // the #before and removes the span with "text" and the #start. 38 // #start with two <br>'s.
33 document.designMode = 'on'; 39 document.designMode = 'on';
34 document.execCommand('InsertLineBreak'); 40 document.execCommand('InsertLineBreak');
35 41
36 // Crash during tear down. 42 // Crash during tear down.
37 test.innerHTML = "Pseudo still exists: " + (before.offsetHeight > 0); 43 test.innerHTML = "Both pseudos have been removed: " + (before.offsetHeight == 0 && start.offsetHeight == 0);
38 </script> 44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698