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

Unified Diff: LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html

Issue 25668008: Make Document::caretRangeFromPoint() to work with :first-letter style (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-10-07T15:30:03 Created 7 years, 2 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 | LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html
diff --git a/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html
new file mode 100644
index 0000000000000000000000000000000000000000..72be097ba4e3fa133e98483e7754cd4e6c07e8fb
--- /dev/null
+++ b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html
@@ -0,0 +1,28 @@
+<style>
+p.first-letter:first-letter { color: red; }
+</style>
+<div id="container">
+<p id="description"></p>
+<p id="sample" class="first-letter"><span>0123456</span></p>
+</div>
+<div id="console"></div>
+<script src="../../../../fast/js/resources/js-test-pre.js"></script>
+<script>
+description('caretRangeFromPoint() should work with :first-letter style');
+function $(id) { return document.getElementById(id); }
+
+var middle = $('sample').offsetTop + $('sample').offsetHeight / 2;
+var left = $('sample').offsetLeft;
+var numberOfChars = $('sample').firstChild.firstChild.length;
+var charWidth = $('sample').firstChild.offsetWidth / numberOfChars;
+var x = left;
+for (var i = 0; i < numberOfChars; ++i) {
+ var range = document.caretRangeFromPoint(x + 3, middle);
+ shouldBe('range.startOffset', i.toString());
+ x += charWidth;
+}
+
+if (window.testRunner)
+ $('container').outerHTML = '';
+</script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698