Title: [253849] trunk/Source/WebKit
- Revision
- 253849
- Author
- timothy_hor...@apple.com
- Date
- 2019-12-20 15:21:30 -0800 (Fri, 20 Dec 2019)
Log Message
Expose approximate caret extents for the hit line via InteractionInformationAtPosition
https://bugs.webkit.org/show_bug.cgi?id=205526
<rdar://problem/57983076>
Reviewed by Dean Jackson.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::positionInformation):
Compute and expose the union of first and last caret rects on the line.
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
* Shared/ios/InteractionInformationRequest.cpp:
(WebKit::InteractionInformationRequest::encode const):
(WebKit::InteractionInformationRequest::decode):
(WebKit::InteractionInformationRequest::isValidForRequest):
* Shared/ios/InteractionInformationRequest.h:
Also, add a bit so that we can only fetch this data when needed.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (253848 => 253849)
--- trunk/Source/WebKit/ChangeLog 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/ChangeLog 2019-12-20 23:21:30 UTC (rev 253849)
@@ -1,3 +1,26 @@
+2019-12-20 Tim Horton <timothy_hor...@apple.com>
+
+ Expose approximate caret extents for the hit line via InteractionInformationAtPosition
+ https://bugs.webkit.org/show_bug.cgi?id=205526
+ <rdar://problem/57983076>
+
+ Reviewed by Dean Jackson.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::positionInformation):
+ Compute and expose the union of first and last caret rects on the line.
+
+ * Shared/ios/InteractionInformationAtPosition.h:
+ * Shared/ios/InteractionInformationAtPosition.mm:
+ (WebKit::InteractionInformationAtPosition::encode const):
+ (WebKit::InteractionInformationAtPosition::decode):
+ * Shared/ios/InteractionInformationRequest.cpp:
+ (WebKit::InteractionInformationRequest::encode const):
+ (WebKit::InteractionInformationRequest::decode):
+ (WebKit::InteractionInformationRequest::isValidForRequest):
+ * Shared/ios/InteractionInformationRequest.h:
+ Also, add a bit so that we can only fetch this data when needed.
+
2019-12-20 Brent Fulgham <bfulg...@apple.com>
Remove access to 'com.apple.cfprefsd.agent' from the macOS sandbox
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h (253848 => 253849)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h 2019-12-20 23:21:30 UTC (rev 253849)
@@ -85,6 +85,7 @@
String textAfter;
float caretHeight { 0 };
+ WebCore::FloatRect lineCaretExtent;
Optional<WebCore::Cursor> cursor;
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (253848 => 253849)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2019-12-20 23:21:30 UTC (rev 253849)
@@ -69,6 +69,7 @@
encoder << textBefore;
encoder << textAfter;
encoder << caretHeight;
+ encoder << lineCaretExtent;
encoder << cursor;
encoder << linkIndicator;
@@ -164,6 +165,9 @@
if (!decoder.decode(result.caretHeight))
return false;
+ if (!decoder.decode(result.lineCaretExtent))
+ return false;
+
if (!decoder.decode(result.cursor))
return false;
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp (253848 => 253849)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp 2019-12-20 23:21:30 UTC (rev 253849)
@@ -38,6 +38,7 @@
encoder << point;
encoder << includeSnapshot;
encoder << includeLinkIndicator;
+ encoder << includeCaretContext;
encoder << linkIndicatorShouldHaveLegacyMargins;
}
@@ -52,6 +53,9 @@
if (!decoder.decode(result.includeLinkIndicator))
return false;
+ if (!decoder.decode(result.includeCaretContext))
+ return false;
+
if (!decoder.decode(result.linkIndicatorShouldHaveLegacyMargins))
return false;
@@ -66,6 +70,9 @@
if (other.includeLinkIndicator && !includeLinkIndicator)
return false;
+ if (other.includeCaretContext && !includeCaretContext)
+ return false;
+
if (other.linkIndicatorShouldHaveLegacyMargins != linkIndicatorShouldHaveLegacyMargins)
return false;
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.h (253848 => 253849)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.h 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.h 2019-12-20 23:21:30 UTC (rev 253849)
@@ -41,6 +41,7 @@
bool includeSnapshot { false };
bool includeLinkIndicator { false };
+ bool includeCaretContext { false };
bool linkIndicatorShouldHaveLegacyMargins { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (253848 => 253849)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-12-20 23:15:00 UTC (rev 253848)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-12-20 23:21:30 UTC (rev 253849)
@@ -2762,10 +2762,16 @@
auto& eventHandler = m_page->mainFrame().eventHandler();
HitTestResult hitTestResult = eventHandler.hitTestResultAtPoint(request.point, HitTestRequest::ReadOnly | HitTestRequest::AllowFrameScrollbars);
info.cursor = eventHandler.selectCursor(hitTestResult, false);
- if (auto* frame = hitTestResult.innerNodeFrame()) {
- if (auto* frameView = frame->view()) {
- VisiblePosition position = frame->visiblePositionForPoint(request.point);
- info.caretHeight = frameView->contentsToRootView(position.absoluteCaretBounds()).height();
+ if (request.includeCaretContext) {
+ if (auto* frame = hitTestResult.innerNodeFrame()) {
+ if (auto* frameView = frame->view()) {
+ VisiblePosition position = frame->visiblePositionForPoint(request.point);
+ info.caretHeight = frameView->contentsToRootView(position.absoluteCaretBounds()).height();
+
+ VisiblePosition startPosition = startOfLine(position);
+ VisiblePosition endPosition = endOfLine(position);
+ info.lineCaretExtent = unionRect(frameView->contentsToRootView(startPosition.absoluteCaretBounds()), frameView->contentsToRootView(endPosition.absoluteCaretBounds()));
+ }
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes