Title: [265174] trunk/Source/WebKit
Revision
265174
Author
[email protected]
Date
2020-08-01 01:02:05 -0700 (Sat, 01 Aug 2020)

Log Message

Unable to select multiple lines of vertical text correctly
https://bugs.webkit.org/show_bug.cgi?id=213671
<rdar://problem/53753636>

Reviewed by Darin Adler.

In order to make for a better text selection experience, we pulled the selection position
down to be on the last line selectable, rather than snap the selection to a single position.
This made for a better selection experience on small text, but we failed to take
vertical text into account, and a user is locked into only selecting vertical text that ends below the
other anchor point of the selection. We should have the same behavior for vertical text, but correctly
calculated for X instead of Y.
This does not fix all cases, but it fixes the most glaring cases.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeForPointInRootViewCoordinates):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (265173 => 265174)


--- trunk/Source/WebKit/ChangeLog	2020-08-01 06:09:15 UTC (rev 265173)
+++ trunk/Source/WebKit/ChangeLog	2020-08-01 08:02:05 UTC (rev 265174)
@@ -1,3 +1,22 @@
+2020-08-01  Megan Gardner  <[email protected]>
+
+        Unable to select multiple lines of vertical text correctly
+        https://bugs.webkit.org/show_bug.cgi?id=213671
+        <rdar://problem/53753636>
+
+        Reviewed by Darin Adler.
+
+        In order to make for a better text selection experience, we pulled the selection position 
+        down to be on the last line selectable, rather than snap the selection to a single position.
+        This made for a better selection experience on small text, but we failed to take
+        vertical text into account, and a user is locked into only selecting vertical text that ends below the
+        other anchor point of the selection. We should have the same behavior for vertical text, but correctly 
+        calculated for X instead of Y.
+        This does not fix all cases, but it fixes the most glaring cases.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::rangeForPointInRootViewCoordinates):
+
 2020-07-31  Jer Noble  <[email protected]>
 
         [Mac] Add Experimental Feature preference for SW VP9

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (265173 => 265174)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-08-01 06:09:15 UTC (rev 265173)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-08-01 08:02:05 UTC (rev 265174)
@@ -107,6 +107,7 @@
 #import <WebCore/MediaSessionManagerIOS.h>
 #import <WebCore/Node.h>
 #import <WebCore/NodeList.h>
+#import <WebCore/NodeRenderStyle.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/Page.h>
 #import <WebCore/Pasteboard.h>
@@ -1493,14 +1494,27 @@
 
     auto pointInDocument = frame.view()->rootViewToContents(pointInRootViewCoordinates);
 
-    if (baseIsStart) {
-        int startY = selectionStart.absoluteCaretBounds().center().y();
-        if (pointInDocument.y() < startY)
-            pointInDocument.setY(startY);
+    auto node = selectionStart.deepEquivalent().containerNode();
+    if (node && node->renderStyle() && node->renderStyle()->isVerticalWritingMode()) {
+        if (baseIsStart) {
+            int startX = selectionStart.absoluteCaretBounds().center().x();
+            if (pointInDocument.x() > startX)
+                pointInDocument.setX(startX);
+        } else {
+            int endX = selectionEnd.absoluteCaretBounds().center().x();
+            if (pointInDocument.x() < endX)
+                pointInDocument.setX(endX);
+        }
     } else {
-        int endY = selectionEnd.absoluteCaretBounds().center().y();
-        if (pointInDocument.y() > endY)
-            pointInDocument.setY(endY);
+        if (baseIsStart) {
+            int startY = selectionStart.absoluteCaretBounds().center().y();
+            if (pointInDocument.y() < startY)
+                pointInDocument.setY(startY);
+        } else {
+            int endY = selectionEnd.absoluteCaretBounds().center().y();
+            if (pointInDocument.y() > endY)
+                pointInDocument.setY(endY);
+        }
     }
     
     VisiblePosition result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to