Title: [228079] branches/safari-605-branch/Source/WebKit
- Revision
- 228079
- Author
- jmarc...@apple.com
- Date
- 2018-02-04 21:30:58 -0800 (Sun, 04 Feb 2018)
Log Message
Cherry-pick r228050. rdar://problem/37220143
Modified Paths
Diff
Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (228078 => 228079)
--- branches/safari-605-branch/Source/WebKit/ChangeLog 2018-02-05 05:30:56 UTC (rev 228078)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog 2018-02-05 05:30:58 UTC (rev 228079)
@@ -1,5 +1,26 @@
2018-02-04 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r228050. rdar://problem/37220143
+
+ 2018-02-03 Tim Horton <timothy_hor...@apple.com>
+
+ UI process sometimes crashes under -[WKContentView _lookupForWebView:]
+ https://bugs.webkit.org/show_bug.cgi?id=182460
+ <rdar://problem/33260602>
+
+ Reviewed by Wenson Hsieh.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _lookupForWebView:]):
+ If you have a range selection, but no rects for the selection, retrieving
+ the 0th element of selectionRects will crash the UI process. To fix, in
+ this case, use the rect for the starting caret instead.
+
+ It doesn't seem like the presentationRect is actually currently used for
+ the Lookup service, so the only impact is that we shouldn't crash anymore.
+
+2018-02-04 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r228041. rdar://problem/37220123
2018-02-02 Youenn Fablet <you...@apple.com>
Modified: branches/safari-605-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (228078 => 228079)
--- branches/safari-605-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-02-05 05:30:56 UTC (rev 228078)
+++ branches/safari-605-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-02-05 05:30:58 UTC (rev 228079)
@@ -1934,15 +1934,22 @@
return;
if (!selectedText)
return;
+
+ auto& editorState = view->_page->editorState();
+ auto& postLayoutData = editorState.postLayoutData();
+ CGRect presentationRect;
+ if (editorState.selectionIsRange && !postLayoutData.selectionRects.isEmpty())
+ presentationRect = postLayoutData.selectionRects[0].rect();
+ else
+ presentationRect = postLayoutData.caretRectAtStart;
- CGRect presentationRect = view->_page->editorState().selectionIsRange ? view->_page->editorState().postLayoutData().selectionRects[0].rect() : view->_page->editorState().postLayoutData().caretRectAtStart;
-
String selectionContext = textBefore + selectedText + textAfter;
- if (view->_textSelectionAssistant) {
- [view->_textSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect];
- } else {
- [view->_webSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect];
- }
+ NSRange selectedRangeInContext = NSMakeRange(textBefore.length(), selectedText.length());
+
+ if (auto textSelectionAssistant = view->_textSelectionAssistant)
+ [textSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect];
+ else
+ [view->_webSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect];
});
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes