Index: LayoutTests/editing/selection/offset-from-point-complex-scripts.html |
diff --git a/LayoutTests/editing/selection/offset-from-point-complex-scripts.html b/LayoutTests/editing/selection/offset-from-point-complex-scripts.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..398453f6a464e23d837219d420e45abd4aaf73b4 |
--- /dev/null |
+++ b/LayoutTests/editing/selection/offset-from-point-complex-scripts.html |
@@ -0,0 +1,33 @@ |
+<!DOCTYPE html> |
+<meta charset="utf-8"> |
+<div id="container"> |
+ <p>مَ متن</p> |
+</div> |
+<div id=log></div> |
+<script> |
+testOffsetFromPoint(container.firstElementChild); |
+ |
+function testOffsetFromPoint(element) { |
+ var y = element.offsetTop + element.offsetHeight / 2; |
+ var xmin = element.offsetLeft; |
+ var xmax = xmin + element.offsetWidth; |
+ var lastCharacterOffset = null; |
+ var results = []; |
+ for (var x = xmin - 1; x <= xmax + 1; ++x) { |
+ var result = document.caretRangeFromPoint(x, y); |
+ var characterOffset = result ? result.startOffset : null; |
+ if (characterOffset === lastCharacterOffset) |
+ continue; |
+ results.push(characterOffset); |
+ lastCharacterOffset = characterOffset; |
+ } |
+ var div = document.createElement("div"); |
+ div.innerText = results.join(" "); |
+ log.appendChild(div); |
+} |
+ |
+if (window.testRunner) { |
+ container.style.display = "none"; |
+ testRunner.dumpAsText(); |
+} |
+</script> |