Title: [256548] branches/safari-609.1.17.0-branch/Source/WebKit
Revision
256548
Author
[email protected]
Date
2020-02-13 14:52:31 -0800 (Thu, 13 Feb 2020)

Log Message

Cherry-pick r255710. rdar://problem/59299340

    macCatalyst: Shouldn't get text cursor on checkboxes
    https://bugs.webkit.org/show_bug.cgi?id=207234
    <rdar://problem/59155917>

    Reviewed by Wenson Hsieh.

    * WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::canForceCaretForPosition):
    (WebKit::populateCaretContext):
    (WebKit::lineCaretExtent): Deleted.
    The I-beam forcing code was a bit too aggressive; it should consider
    the style of the node that it ends up finding after searching, not just
    assume it wants an I-beam because it's "texty".

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255710 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog (256547 => 256548)


--- branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog	2020-02-13 22:52:29 UTC (rev 256547)
+++ branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog	2020-02-13 22:52:31 UTC (rev 256548)
@@ -1,5 +1,42 @@
 2020-02-13  Russell Epstein  <[email protected]>
 
+        Cherry-pick r255710. rdar://problem/59299340
+
+    macCatalyst: Shouldn't get text cursor on checkboxes
+    https://bugs.webkit.org/show_bug.cgi?id=207234
+    <rdar://problem/59155917>
+    
+    Reviewed by Wenson Hsieh.
+    
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::canForceCaretForPosition):
+    (WebKit::populateCaretContext):
+    (WebKit::lineCaretExtent): Deleted.
+    The I-beam forcing code was a bit too aggressive; it should consider
+    the style of the node that it ends up finding after searching, not just
+    assume it wants an I-beam because it's "texty".
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-04  Tim Horton  <[email protected]>
+
+            macCatalyst: Shouldn't get text cursor on checkboxes
+            https://bugs.webkit.org/show_bug.cgi?id=207234
+            <rdar://problem/59155917>
+
+            Reviewed by Wenson Hsieh.
+
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::canForceCaretForPosition):
+            (WebKit::populateCaretContext):
+            (WebKit::lineCaretExtent): Deleted.
+            The I-beam forcing code was a bit too aggressive; it should consider
+            the style of the node that it ends up finding after searching, not just
+            assume it wants an I-beam because it's "texty".
+
+2020-02-13  Russell Epstein  <[email protected]>
+
         Cherry-pick r255691. rdar://problem/59299315
 
     [macCatalyst] Missing custom cursors in subframes that are offset from the origin of the root view

Modified: branches/safari-609.1.17.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (256547 => 256548)


--- branches/safari-609.1.17.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-13 22:52:29 UTC (rev 256547)
+++ branches/safari-609.1.17.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-13 22:52:31 UTC (rev 256548)
@@ -2760,25 +2760,50 @@
     return nullptr;
 }
 
-static FloatRect lineCaretExtent(const InteractionInformationRequest& request, const HitTestResult& hitTestResult)
+static bool canForceCaretForPosition(const VisiblePosition& position)
 {
+    auto* node = position.deepEquivalent().anchorNode();
+    if (!node)
+        return false;
+
+    auto* renderer = node->renderer();
+    auto* style = renderer ? &renderer->style() : nullptr;
+    auto cursorType = style ? style->cursor() : CursorType::Auto;
+
+    if (cursorType == CursorType::Text)
+        return true;
+
+    if (cursorType != CursorType::Auto)
+        return false;
+
+    if (node->hasEditableStyle())
+        return true;
+
+    if (!renderer)
+        return false;
+
+    return renderer->isText() && node->canStartSelection();
+}
+
+static void populateCaretContext(const HitTestResult& hitTestResult, const InteractionInformationRequest& request, InteractionInformationAtPosition& info)
+{
     auto frame = makeRefPtr(hitTestResult.innerNodeFrame());
     if (!frame)
-        return { };
+        return;
 
     auto view = makeRefPtr(frame->view());
     if (!view)
-        return { };
+        return;
 
     auto* renderer = hitTestResult.innerNode()->renderer();
     if (!renderer)
-        return { };
+        return;
 
     while (renderer && !is<RenderBlockFlow>(*renderer))
         renderer = renderer->parent();
 
     if (!renderer)
-        return { };
+        return;
 
     // FIXME: We should be able to retrieve this geometry information without
     // forcing the text to fall out of Simple Line Layout.
@@ -2786,24 +2811,12 @@
     auto position = frame->visiblePositionForPoint(view->rootViewToContents(request.point));
     auto lineRect = position.absoluteSelectionBoundsForLine();
     lineRect.setWidth(blockFlow.contentWidth());
-    return lineRect;
-}
 
-static void populateCaretContext(const HitTestResult& hitTestResult, const InteractionInformationRequest& request, InteractionInformationAtPosition& info)
-{
-    auto* frame = hitTestResult.innerNodeFrame();
-    if (!frame)
-        return;
-
-    auto* frameView = frame->view();
-    if (!frameView)
-        return;
-
-    info.lineCaretExtent = frameView->contentsToRootView(lineCaretExtent(request, hitTestResult));
+    info.lineCaretExtent = view->contentsToRootView(lineRect);
     info.caretHeight = info.lineCaretExtent.height();
 
     // Force an I-beam cursor if the page didn't request a hand, and we're inside the bounds of the line.
-    if (info.lineCaretExtent.contains(request.point) && info.cursor->type() != Cursor::Hand)
+    if (info.lineCaretExtent.contains(request.point) && info.cursor->type() != Cursor::Hand && canForceCaretForPosition(position))
         info.cursor = Cursor::fromType(Cursor::IBeam);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to