WebKit Bugzilla
Attachment 343665 Details for
Bug 186900
: Fix IBeam issues with iPad apps on Mac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186900-20180626174439.patch (text/plain), 7.43 KB, created by
Megan Gardner
on 2018-06-26 17:44:39 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2018-06-26 17:44:39 PDT
Size:
7.43 KB
patch
obsolete
>Subversion Revision: 233064 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 05aa2ff1519d440bb2bbc3af5f1e0d6ce90a5161..87e57da46b6c6b25ef6a0f601aa9a02ed2da8b8b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,39 @@ >+2018-06-26 Megan Gardner <megan_gardner@apple.com> >+ >+ Fix IBeam issues with iPad apps on Mac >+ https://bugs.webkit.org/show_bug.cgi?id=186900 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/ios/InteractionInformationAtPosition.h: >+ * Shared/ios/InteractionInformationAtPosition.mm: >+ (WebKit::InteractionInformationAtPosition::encode const): >+ (WebKit::InteractionInformationAtPosition::decode): >+ >+ Add functionality to determine what a caret rect should be, but as it is >+ expensive, it should only be done for this platform. >+ >+ * Shared/ios/InteractionInformationRequest.cpp: >+ (WebKit::InteractionInformationRequest::isApproximateForRequest): >+ * Shared/ios/InteractionInformationRequest.h: >+ >+ As there is no way to premptively request information on hover, we need to use >+ the last cached information, but only if it is close to the point we are about >+ to request information for. So having a way to determine if a point is very close >+ to a previous point is a good idea. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _currentPositionInformationIsApproximateForRequest:]): >+ (-[WKContentView closestPositionToPoint:]): >+ >+ UIKit is using this function to determine if we should show an Ibeam or not. >+ So we need to implement it, at least for this platform. >+ >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::getPositionInformation): >+ >+ Pass up the calculated caret rect, but only for iPad apps on Mac. >+ > 2018-06-21 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r232884. >diff --git a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h >index 9f6783e922857ee402c7ef2d33d14413935a9c48..a0e90bce7fd7b9fc7aa1940ca08d2d8287d54c2d 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h >+++ b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h >@@ -62,6 +62,7 @@ struct InteractionInformationAtPosition { > String title; > String idAttribute; > WebCore::IntRect bounds; >+ WebCore::IntRect caretRect; // currently only valid on iPad apps on Mac > RefPtr<ShareableBitmap> image; > String textBefore; > String textAfter; >diff --git a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >index 641257ebbfb0f7df3392f6f35e424f99dabc31d4..d6cdb6b5ef2afc269c0d201432b2f6e27ad334d3 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >+++ b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >@@ -61,6 +61,7 @@ void InteractionInformationAtPosition::encode(IPC::Encoder& encoder) const > encoder << title; > encoder << idAttribute; > encoder << bounds; >+ encoder << caretRect; > encoder << textBefore; > encoder << textAfter; > encoder << linkIndicator; >@@ -135,6 +136,9 @@ bool InteractionInformationAtPosition::decode(IPC::Decoder& decoder, Interaction > > if (!decoder.decode(result.bounds)) > return false; >+ >+ if (!decoder.decode(result.caretRect)) >+ return false; > > if (!decoder.decode(result.textBefore)) > return false; >diff --git a/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp b/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >index f50018b31e0613a29c4d694078a1c2410e642b5d..88d56d1236a3367fac61e73ff78f3be2350903e2 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >+++ b/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp >@@ -67,6 +67,17 @@ bool InteractionInformationRequest::isValidForRequest(const InteractionInformati > > return true; > } >+ >+bool InteractionInformationRequest::isApproximateForRequest(const InteractionInformationRequest& other) >+{ >+ if (other.includeSnapshot && !includeSnapshot) >+ return false; >+ >+ if (other.includeLinkIndicator && !includeLinkIndicator) >+ return false; >+ >+ return (other.point - point).diagonalLengthSquared() <= 4; >+} > > #endif // PLATFORM(IOS) > >diff --git a/Source/WebKit/Shared/ios/InteractionInformationRequest.h b/Source/WebKit/Shared/ios/InteractionInformationRequest.h >index f139ec8e6bf94d4d1a2e1545a6c0b138f3fce734..774a617e375fc3cbd01fd6bf67134b7840309a79 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationRequest.h >+++ b/Source/WebKit/Shared/ios/InteractionInformationRequest.h >@@ -49,6 +49,7 @@ struct InteractionInformationRequest { > } > > bool isValidForRequest(const InteractionInformationRequest&); >+ bool isApproximateForRequest(const InteractionInformationRequest& other); > > void encode(IPC::Encoder&) const; > static bool decode(IPC::Decoder&, InteractionInformationRequest&); >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 266926d0b0009658f2c6c21a5739aef530dae6a8..6970868c133a0a6d1125fb66d4b37090b6e53070 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1499,6 +1499,11 @@ static inline bool isSamePair(UIGestureRecognizer *a, UIGestureRecognizer *b, UI > return _outstandingPositionInformationRequest && _outstandingPositionInformationRequest->isValidForRequest(request); > } > >+- (BOOL)_currentPositionInformationIsApproximateForRequest:(const InteractionInformationRequest&)request >+{ >+ return _hasValidPositionInformation && _positionInformation.request.isApproximateForRequest(request); >+} >+ > - (void)_invokeAndRemovePendingHandlersValidForCurrentPositionInformation > { > ASSERT(_hasValidPositionInformation); >@@ -3319,6 +3324,12 @@ static void selectionChangedWithTouch(WKContentView *view, const WebCore::IntPoi > /* Hit testing. */ > - (UITextPosition *)closestPositionToPoint:(CGPoint)point > { >+#if ENABLE(MINIMAL_SIMULATOR) >+ InteractionInformationRequest request(roundedIntPoint(point)); >+ [self requestAsynchronousPositionInformationUpdate:request]; >+ if ([self _currentPositionInformationIsApproximateForRequest:request] && _positionInformation.isSelectable) >+ return [WKTextPosition textPositionWithRect:_positionInformation.caretRect]; >+#endif > return nil; > } > >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 69d80aa852f59398d7c4c87fbe552aa4fe896a68..b9de04d0c18d48f22210303a702fa1733650de91 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2175,6 +2175,11 @@ void WebPage::getPositionInformation(const InteractionInformationRequest& reques > if (info.isSelectable && !hitNode->isTextNode()) > info.isSelectable = !isAssistableElement(*downcast<Element>(hitNode)) && !rectIsTooBigForSelection(info.bounds, *result.innerNodeFrame()); > } >+#if ENABLE(MINIMAL_SIMULATOR) >+ bool isInsideFixedPosition; >+ VisiblePosition caretPosition(renderer->positionForPoint(request.point, nullptr)); >+ info.caretRect = caretPosition.absoluteCaretBounds(&isInsideFixedPosition); >+#endif > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186900
:
343283
|
343286
|
343294
|
343434
|
343564
|
343570
|
343607
|
343643
|
343665
|
343770