Changeset 265174 in webkit


Ignore:
Timestamp:
Aug 1, 2020 1:02:05 AM (4 years ago)
Author:
Megan Gardner
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r265171 r265174  
     12020-08-01  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Unable to select multiple lines of vertical text correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=213671
     5        <rdar://problem/53753636>
     6
     7        Reviewed by Darin Adler.
     8
     9        In order to make for a better text selection experience, we pulled the selection position
     10        down to be on the last line selectable, rather than snap the selection to a single position.
     11        This made for a better selection experience on small text, but we failed to take
     12        vertical text into account, and a user is locked into only selecting vertical text that ends below the
     13        other anchor point of the selection. We should have the same behavior for vertical text, but correctly
     14        calculated for X instead of Y.
     15        This does not fix all cases, but it fixes the most glaring cases.
     16
     17        * WebProcess/WebPage/ios/WebPageIOS.mm:
     18        (WebKit::rangeForPointInRootViewCoordinates):
     19
    1202020-07-31  Jer Noble  <jer.noble@apple.com>
    221
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r265084 r265174  
    108108#import <WebCore/Node.h>
    109109#import <WebCore/NodeList.h>
     110#import <WebCore/NodeRenderStyle.h>
    110111#import <WebCore/NotImplemented.h>
    111112#import <WebCore/Page.h>
     
    14941495    auto pointInDocument = frame.view()->rootViewToContents(pointInRootViewCoordinates);
    14951496
    1496     if (baseIsStart) {
    1497         int startY = selectionStart.absoluteCaretBounds().center().y();
    1498         if (pointInDocument.y() < startY)
    1499             pointInDocument.setY(startY);
     1497    auto node = selectionStart.deepEquivalent().containerNode();
     1498    if (node && node->renderStyle() && node->renderStyle()->isVerticalWritingMode()) {
     1499        if (baseIsStart) {
     1500            int startX = selectionStart.absoluteCaretBounds().center().x();
     1501            if (pointInDocument.x() > startX)
     1502                pointInDocument.setX(startX);
     1503        } else {
     1504            int endX = selectionEnd.absoluteCaretBounds().center().x();
     1505            if (pointInDocument.x() < endX)
     1506                pointInDocument.setX(endX);
     1507        }
    15001508    } else {
    1501         int endY = selectionEnd.absoluteCaretBounds().center().y();
    1502         if (pointInDocument.y() > endY)
    1503             pointInDocument.setY(endY);
     1509        if (baseIsStart) {
     1510            int startY = selectionStart.absoluteCaretBounds().center().y();
     1511            if (pointInDocument.y() < startY)
     1512                pointInDocument.setY(startY);
     1513        } else {
     1514            int endY = selectionEnd.absoluteCaretBounds().center().y();
     1515            if (pointInDocument.y() > endY)
     1516                pointInDocument.setY(endY);
     1517        }
    15041518    }
    15051519   
Note: See TracChangeset for help on using the changeset viewer.