Title: [210874] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210873 => 210874)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-18 20:43:17 UTC (rev 210873)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-18 20:43:20 UTC (rev 210874)
@@ -1,5 +1,20 @@
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210831. rdar://problem/29057611
+
+    2017-01-17  Zalan Bujtas  <za...@apple.com>
+
+            Editing nested RTL-LTR content makes the process unresponsive.
+            https://bugs.webkit.org/show_bug.cgi?id=167140
+            rdar://problem/29057611
+
+            Reviewed by Ryosuke Niwa.
+
+            * editing/rtl-to-ltr-editing-word-move-spin-expected.txt: Added.
+            * editing/rtl-to-ltr-editing-word-move-spin.html: Added.
+
+2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210827. rdar://problem/28620865
 
     2017-01-17  Brady Eidson  <beid...@apple.com>

Added: branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin-expected.txt (0 => 210874)


--- branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin-expected.txt	2017-01-18 20:43:20 UTC (rev 210874)
@@ -0,0 +1,4 @@
+Pass if no hang.
+‫ foobar foobar‫
+
+

Added: branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin.html (0 => 210874)


--- branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/editing/rtl-to-ltr-editing-word-move-spin.html	2017-01-18 20:43:20 UTC (rev 210874)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test that we can jump word by word over rtl-ltr content.</title>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+</head>
+<body contenteditable="true";>
+Pass if no hang.
+<div style="direction: rtl;">&#x202B foobar foobar&#x202B</div></br>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    getSelection().setPosition(document.querySelector('div').firstChild, 2);
+    getSelection().modify('move', 'right', 'word');
+    getSelection().modify('move', 'right', 'word');
+</script>
+</body>
+</html>

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (210873 => 210874)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-18 20:43:17 UTC (rev 210873)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-18 20:43:20 UTC (rev 210874)
@@ -1,5 +1,25 @@
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210831. rdar://problem/29057611
+
+    2017-01-17  Zalan Bujtas  <za...@apple.com>
+
+            Editing nested RTL-LTR content makes the process unresponsive.
+            https://bugs.webkit.org/show_bug.cgi?id=167140
+            rdar://problem/29057611
+
+            Reviewed by Ryosuke Niwa.
+
+            Break out of the loop if we keep coming back to the same position.
+            This is a workaround for the underlying editing/position bug -> webkit.org/b/167138.
+
+            Test: editing/rtl-to-ltr-editing-word-move-spin.html
+
+            * editing/VisibleUnits.cpp:
+            (WebCore::visualWordPosition):
+
+2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210795. rdar://problem/24457632
 
     2017-01-16  Antti Koivisto  <an...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/editing/VisibleUnits.cpp (210873 => 210874)


--- branches/safari-603-branch/Source/WebCore/editing/VisibleUnits.cpp	2017-01-18 20:43:17 UTC (rev 210873)
+++ branches/safari-603-branch/Source/WebCore/editing/VisibleUnits.cpp	2017-01-18 20:43:20 UTC (rev 210874)
@@ -352,6 +352,7 @@
     TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent());
     InlineBox* previouslyVisitedBox = nullptr;
     VisiblePosition current = visiblePosition;
+    std::optional<VisiblePosition> previousPosition;
     UBreakIterator* iter = nullptr;
 
     CachedLogicallyOrderedLeafBoxes leafBoxes;
@@ -361,6 +362,9 @@
         VisiblePosition adjacentCharacterPosition = direction == MoveRight ? current.right(true) : current.left(true); 
         if (adjacentCharacterPosition == current || adjacentCharacterPosition.isNull())
             return VisiblePosition();
+        // FIXME: This is a workaround for webkit.org/b/167138.
+        if (previousPosition && adjacentCharacterPosition == previousPosition.value())
+            return VisiblePosition();
     
         InlineBox* box;
         int offsetInBox;
@@ -409,6 +413,7 @@
         if (isWordBreak)
             return adjacentCharacterPosition;
     
+        previousPosition = current;
         current = adjacentCharacterPosition;
     }
     return VisiblePosition();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to