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

Unified Diff: LayoutTests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html

Issue 361683002: Make LayoutText::absoluteQuadsForRange to consider leading/trailing whitespaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T15:06:27 Follow review comments Created 5 years, 4 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 | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html
diff --git a/LayoutTests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html b/LayoutTests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html
new file mode 100644
index 0000000000000000000000000000000000000000..e354b72788b6787edf538042512a7a99b2f1a670
--- /dev/null
+++ b/LayoutTests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="target"> abc </div>
+<div id="log"></div>
+<script>
+var target = document.getElementById('target').firstChild;
+function clientRectLeftOfNodeOffsetAt(offset) {
+ var range = document.createRange();
+ range.setStart(target, offset);
+ var rects = range.getClientRects();
+ return rects.length ? rects[0].left : 'no rects';
+}
+test(function() {
+ assert_equals(clientRectLeftOfNodeOffsetAt(0), clientRectLeftOfNodeOffsetAt(3), '0');
+ assert_equals(clientRectLeftOfNodeOffsetAt(1), clientRectLeftOfNodeOffsetAt(3), '1');
+ assert_equals(clientRectLeftOfNodeOffsetAt(2), clientRectLeftOfNodeOffsetAt(3), '2');
+}, 'leading whitespaces');
+
+test(function() {
+ assert_greater_than(clientRectLeftOfNodeOffsetAt(6), clientRectLeftOfNodeOffsetAt(5), '6');
+ assert_equals(clientRectLeftOfNodeOffsetAt(7), clientRectLeftOfNodeOffsetAt(6), '7');
+ assert_equals(clientRectLeftOfNodeOffsetAt(8), clientRectLeftOfNodeOffsetAt(6), '8');
+}, 'trailing whitespaces');
+</script>
« no previous file with comments | « no previous file | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698