Changeset 228050 in webkit
- Timestamp:
- Feb 3, 2018 7:35:18 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228046 r228050 1 2018-02-03 Tim Horton <timothy_horton@apple.com> 2 3 UI process sometimes crashes under -[WKContentView _lookupForWebView:] 4 https://bugs.webkit.org/show_bug.cgi?id=182460 5 <rdar://problem/33260602> 6 7 Reviewed by Wenson Hsieh. 8 9 * UIProcess/ios/WKContentViewInteraction.mm: 10 (-[WKContentView _lookupForWebView:]): 11 If you have a range selection, but no rects for the selection, retrieving 12 the 0th element of selectionRects will crash the UI process. To fix, in 13 this case, use the rect for the starting caret instead. 14 15 It doesn't seem like the presentationRect is actually currently used for 16 the Lookup service, so the only impact is that we shouldn't crash anymore. 17 1 18 2018-02-02 Michael Catanzaro <mcatanzaro@igalia.com> 2 19 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r227984 r228050 2005 2005 if (!selectedText) 2006 2006 return; 2007 2008 CGRect presentationRect = view->_page->editorState().selectionIsRange ? view->_page->editorState().postLayoutData().selectionRects[0].rect() : view->_page->editorState().postLayoutData().caretRectAtStart; 2007 2008 auto& editorState = view->_page->editorState(); 2009 auto& postLayoutData = editorState.postLayoutData(); 2010 CGRect presentationRect; 2011 if (editorState.selectionIsRange && !postLayoutData.selectionRects.isEmpty()) 2012 presentationRect = postLayoutData.selectionRects[0].rect(); 2013 else 2014 presentationRect = postLayoutData.caretRectAtStart; 2009 2015 2010 2016 String selectionContext = textBefore + selectedText + textAfter; 2011 if (view->_textSelectionAssistant) { 2012 [view->_textSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 2013 } else { 2014 [view->_webSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 2015 } 2017 NSRange selectedRangeInContext = NSMakeRange(textBefore.length(), selectedText.length()); 2018 2019 if (auto textSelectionAssistant = view->_textSelectionAssistant) 2020 [textSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect]; 2021 else 2022 [view->_webSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect]; 2016 2023 }); 2017 2024 }
Note: See TracChangeset
for help on using the changeset viewer.