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

Side by Side Diff: LayoutTests/fast/dom/Range/getBoundingClientRect-caret.html

Issue 998263002: range.getBoundingClientRect() returns incorrect value for collapsed ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="d1" contenteditable="true"> hello </div>
8 <div id="console"></div>
9 </body>
10 <script>
11 description('Test getBoundingClientRect of caret for collapsed range.');
12
13 /* Set caret position */
14 var el = document.getElementById('d1');
15 var sel = window.getSelection();
16 var range = document.createRange();
17 range.setStart(el.childNodes[0], 3);
18 range.collapse(true);
19 sel.removeAllRanges();
20 sel.addRange(range);
21 el.focus();
22
23 /* Actual test */
24 sel = window.getSelection();
25 range = sel.getRangeAt(0);
26 range.collapse(true);
27 var rect = range.getBoundingClientRect();
28
29 shouldBe('rect.left', '22');
30 shouldBe('rect.top', '8');
31 shouldBe('rect.width', '0');
32 shouldBe('rect.height', '19');
33 </script>
34 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/dom/Range/getBoundingClientRect-caret-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698