Title: [221843] trunk/LayoutTests
Revision
221843
Author
tpop...@redhat.com
Date
2017-09-10 21:18:06 -0700 (Sun, 10 Sep 2017)

Log Message

[GTK] DOM operations could behave unexpectedly with certain fonts or font sizes
https://bugs.webkit.org/show_bug.cgi?id=149703

Reviewed by Michael Catanzaro.

Before r221670 (FreeType rebase) this test case would fail due to
bug in FreeType where it was providing wrong font extents for specific
fonts and sizes. Before the rebase the selection was incorrectly
restored on the end of the first line. Adding this new test to catch
any possible regression in the FreeType.

* fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point-expected.txt: Added.
* fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (221842 => 221843)


--- trunk/LayoutTests/ChangeLog	2017-09-11 01:05:05 UTC (rev 221842)
+++ trunk/LayoutTests/ChangeLog	2017-09-11 04:18:06 UTC (rev 221843)
@@ -1,3 +1,19 @@
+2017-09-11  Tomas Popela  <tpop...@redhat.com>
+
+        [GTK] DOM operations could behave unexpectedly with certain fonts or font sizes
+        https://bugs.webkit.org/show_bug.cgi?id=149703
+
+        Reviewed by Michael Catanzaro.
+
+        Before r221670 (FreeType rebase) this test case would fail due to
+        bug in FreeType where it was providing wrong font extents for specific
+        fonts and sizes. Before the rebase the selection was incorrectly
+        restored on the end of the first line. Adding this new test to catch
+        any possible regression in the FreeType.
+
+        * fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point-expected.txt: Added.
+        * fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point.html: Added.
+
 2017-09-08  Dean Jackson  <d...@apple.com>
 
         gl.detachShader breaks shader program

Added: trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point-expected.txt (0 => 221843)


--- trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point-expected.txt	2017-09-11 04:18:06 UTC (rev 221843)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point.html (0 => 221843)


--- trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/restore-selection-from-point.html	2017-09-11 04:18:06 UTC (rev 221843)
@@ -0,0 +1,58 @@
+<html>
+<head>
+    <style>
+        body {
+            font-family: 'Monospace';
+            font-size: 11pt;
+            font-weight: 400;
+            font-style: normal;
+            -webkit-line-break: after-white-space;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        var x = 0;
+        var y = 0;
+
+        function saveOffset(element)
+        {
+            var offsetParent = element;
+            while (offsetParent !== document.body) {
+                x += offsetParent.offsetLeft;
+                y += offsetParent.offsetTop;
+                offsetParent = offsetParent.offsetParent;
+            }
+        }
+
+        window._onload_ = function()
+        {
+            var start = document.getElementById("selection-start")
+            var end = document.getElementById("selection-end")
+
+            var range = document.createRange()
+            range.setStartAfter(start)
+            saveOffset(start)
+            start.remove()
+            range.setEndBefore(end)
+            end.remove()
+            window.getSelection().removeAllRanges()
+            window.getSelection().addRange(range)
+
+            document.execCommand("SelectAll", false, "")
+
+            range = document.caretRangeFromPoint(x,y)
+            window.getSelection().removeAllRanges()
+            window.getSelection().addRange(range)
+
+            document.body.innerHTML = (window.getSelection().anchorNode.textContent == document.getElementById("second-line").textContent) ?
+                "PASS" : "FAIL - selection was restored on wrong line - see <a href="" 149703</a>"
+        }
+    </script>
+</head>
+<body contenteditable>
+    <div style="width: 72ch; word-wrap: normal;" >12</div>
+    <div id="second-line" style="width: 72ch; word-wrap: normal;" >34<span id="selection-start"></span><span id="selection-end"></span></div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to