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

Unified Diff: third_party/WebKit/LayoutTests/fast/text/international/rtl-selection-rect-with-fallback.html

Issue 1420043007: Fix ShapeResult::selectionRect handles RTL runs in wrong order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaseline 1px diff on Mac Created 5 years, 1 month 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
Index: third_party/WebKit/LayoutTests/fast/text/international/rtl-selection-rect-with-fallback.html
diff --git a/third_party/WebKit/LayoutTests/fast/text/international/rtl-selection-rect-with-fallback.html b/third_party/WebKit/LayoutTests/fast/text/international/rtl-selection-rect-with-fallback.html
new file mode 100644
index 0000000000000000000000000000000000000000..1773203dfd8ea56baa96d97c10312ea4cdb8af52
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/text/international/rtl-selection-rect-with-fallback.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+div {
+ /* Must be a font that causes fallback for Arabic.
+ 'MS PGothic' for Windows, TakaoPGothic for Linux, Times for Mac. */
+ font-family: 'MS PGothic', TakaoPGothic, Times;
+}
+
+.PASS {
+ background-color: lime;
+}
+
+.FAIL {
+ background-color: red;
+}
+</style>
+<div id="container">
+ <div id="ltr">'ص</div>
+ <div id="rtl" dir="rtl">'ص</div>
+</div>
+<script>
+Array.prototype.forEach.call(container.children, function (element) {
+ test(function () {
+ var textNode = element.firstChild;
+ var width0 = getWidth(textNode, 0);
+ var width1 = getWidth(textNode, 1);
+ element.className = width0 < width1 ? "PASS" : "FAIL";
+ assert_less_than(width0, width1);
+ }, element.id);
+});
+
+function getWidth(node, offset) {
+ var range = document.createRange();
+ range.setStart(node, offset);
+ range.setEnd(node, offset + 1);
+ var rect = range.getBoundingClientRect();
+ return rect.width;
+}
+
+if (window.testRunner)
+ container.style.display = "none";
+</script>

Powered by Google App Engine
This is Rietveld 408576698