Title: [256005] trunk/Source
Revision
256005
Author
timothy_hor...@apple.com
Date
2020-02-06 19:30:42 -0800 (Thu, 06 Feb 2020)

Log Message

macCatalyst: Unnecessary I-beam over images in editable areas
https://bugs.webkit.org/show_bug.cgi?id=207370
<rdar://problem/59235429>

Reviewed by Wenson Hsieh.

Source/WebCore:

* dom/Position.h:

Source/WebKit:

* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::populateCaretContext):
Add a bit indicating whether the forced I-beam for editable contexts
should be used or not, based on whether it is adjacent to (or immediately
over) a replaced element.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (256004 => 256005)


--- trunk/Source/WebCore/ChangeLog	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebCore/ChangeLog	2020-02-07 03:30:42 UTC (rev 256005)
@@ -1,3 +1,13 @@
+2020-02-06  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Unnecessary I-beam over images in editable areas
+        https://bugs.webkit.org/show_bug.cgi?id=207370
+        <rdar://problem/59235429>
+
+        Reviewed by Wenson Hsieh.
+
+        * dom/Position.h:
+
 2020-02-06  Doug Kelly  <do...@apple.com>
 
         Incorrect TextTrack sorting with invalid BCP47 language

Modified: trunk/Source/WebCore/dom/Position.h (256004 => 256005)


--- trunk/Source/WebCore/dom/Position.h	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebCore/dom/Position.h	2020-02-07 03:30:42 UTC (rev 256005)
@@ -106,8 +106,8 @@
     RefPtr<Node> firstNode() const;
 
     // These are convenience methods which are smart about whether the position is neighbor anchored or parent anchored
-    Node* computeNodeBeforePosition() const;
-    Node* computeNodeAfterPosition() const;
+    WEBCORE_EXPORT Node* computeNodeBeforePosition() const;
+    WEBCORE_EXPORT Node* computeNodeAfterPosition() const;
 
     Node* anchorNode() const { return m_anchorNode.get(); }
 

Modified: trunk/Source/WebKit/ChangeLog (256004 => 256005)


--- trunk/Source/WebKit/ChangeLog	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebKit/ChangeLog	2020-02-07 03:30:42 UTC (rev 256005)
@@ -1,3 +1,21 @@
+2020-02-06  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Unnecessary I-beam over images in editable areas
+        https://bugs.webkit.org/show_bug.cgi?id=207370
+        <rdar://problem/59235429>
+
+        Reviewed by Wenson Hsieh.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode const):
+        (WebKit::InteractionInformationAtPosition::decode):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::populateCaretContext):
+        Add a bit indicating whether the forced I-beam for editable contexts
+        should be used or not, based on whether it is adjacent to (or immediately
+        over) a replaced element.
+
 2020-02-06  Brent Fulgham  <bfulg...@apple.com>
 
         Build entitlements into GPU Process

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h (256004 => 256005)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2020-02-07 03:30:42 UTC (rev 256005)
@@ -69,6 +69,7 @@
 #if ENABLE(DATALIST_ELEMENT)
     bool preventTextInteraction { false };
 #endif
+    bool shouldNotUseIBeamInEditableContent { false };
     WebCore::FloatPoint adjustedPointForNodeRespondingToClickEvents;
     URL url;
     URL imageURL;

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (256004 => 256005)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2020-02-07 03:30:42 UTC (rev 256005)
@@ -84,6 +84,7 @@
 #if ENABLE(DATALIST_ELEMENT)
     encoder << preventTextInteraction;
 #endif
+    encoder << shouldNotUseIBeamInEditableContent;
     encoder << elementContext;
 }
 
@@ -200,6 +201,9 @@
         return false;
 #endif
 
+    if (!decoder.decode(result.shouldNotUseIBeamInEditableContent))
+        return false;
+
     if (!decoder.decode(result.elementContext))
         return false;
 

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


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-07 03:27:21 UTC (rev 256004)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-07 03:30:42 UTC (rev 256005)
@@ -2838,6 +2838,18 @@
             info.lineCaretExtent.setY(request.point.y() - info.lineCaretExtent.height() / 2);
         info.caretHeight = info.lineCaretExtent.height();
     }
+
+    auto nodeShouldNotUseIBeam = ^(Node* node) {
+        if (!node)
+            return false;
+        RenderObject *renderer = node->renderer();
+        if (!renderer)
+            return false;
+        return is<RenderReplaced>(*renderer);
+    };
+
+    const auto& deepPosition = position.deepEquivalent();
+    info.shouldNotUseIBeamInEditableContent = nodeShouldNotUseIBeam(node) || nodeShouldNotUseIBeam(deepPosition.computeNodeBeforePosition()) || nodeShouldNotUseIBeam(deepPosition.computeNodeAfterPosition());
 }
 
 InteractionInformationAtPosition WebPage::positionInformation(const InteractionInformationRequest& request)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to