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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html

Issue 2763013002: Fix incorrect bounding box position for '\n' (Closed)
Patch Set: Refactor to populate one vector. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html b/third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html
new file mode 100644
index 0000000000000000000000000000000000000000..b0bb4b2cdb243106d77ed933209fec2efeeb6611
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <style>
+ body {
+ margin: 0;
+ font-family: monospace;
+ font-size: 15px;
+ line-height: 1;
+ }
+
+ div#testArea {
+ white-space: pre;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="testArea">
+ </div>
+
+ <script>
+ test(function() {
+ var div = document.getElementById("testArea");
+ div.textContent = 'a\nb\n\n\nc';
+
+ var rects=[]
+ for (var i = 0; i < div.textContent.length; ++i) {
+ var range = document.createRange();
+ range.setStart(div.firstChild, i);
+ range.setEnd(div.firstChild, i+1);
+ rects.push(range.getBoundingClientRect());
+ }
+
+ assert_greater_than(rects[2].top, rects[1].top,
+ 'Top of the rect of offset(2,3) should be greater than offset(1,2)')
+ assert_greater_than(rects[4].top, rects[3].top,
+ 'Top of the rect of offset(4,5) should be greater than offset(3,4)')
+ assert_greater_than(rects[5].top, rects[4].top,
+ 'Top of the rect of offset(5,6) should be greater than offset(4,5)')
+ assert_greater_than(rects[6].top, rects[5].top,
+ 'Top of the rect of offset(6,7) should be greater than offset(5,6)')
+ }, 'BoundingClinentRect of linebreak character should be calculated correctly');
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698