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

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-04T19:04:13 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..307023f2db639b600094d3ef4215cfab4f998ab6
--- /dev/null
+++ b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-first-letter-style.html
@@ -0,0 +1,34 @@
+<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 range;
+window.onload = function() {
+ 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) {
+ range = document.caretRangeFromPoint(x + 3, middle);
+ shouldBe('range.startOffset', i.toString());
+ x += charWidth;
+ }
+
+ if (window.testRunner) {
+ $('container').outerHTML = '';
+ finishJSTest();
+ }
+}
+window.jsTestIsAsync = true;
ojan 2013/10/04 17:36:25 This test doesn't need to be async if you're runni
+</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