Title: [273721] trunk/Source/WebCore
Revision
273721
Author
commit-qu...@webkit.org
Date
2021-03-01 20:17:16 -0800 (Mon, 01 Mar 2021)

Log Message

Make DictionaryLookup::rangeAtHitTestResult more robust
https://bugs.webkit.org/show_bug.cgi?id=222301
<rdar://problem/74529831>

Patch by Alex Christensen <achristen...@webkit.org> on 2021-03-01
Reviewed by Brent Fulgham.

This may be related to r265084 but something is crashing and I'm not sure what.
Adding some Optional checks might fix something, but this is still puzzling to me.

* editing/cocoa/DictionaryLookup.mm:
(WebCore::DictionaryLookup::rangeAtHitTestResult):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273720 => 273721)


--- trunk/Source/WebCore/ChangeLog	2021-03-02 04:08:52 UTC (rev 273720)
+++ trunk/Source/WebCore/ChangeLog	2021-03-02 04:17:16 UTC (rev 273721)
@@ -1,3 +1,17 @@
+2021-03-01  Alex Christensen  <achristen...@webkit.org>
+
+        Make DictionaryLookup::rangeAtHitTestResult more robust
+        https://bugs.webkit.org/show_bug.cgi?id=222301
+        <rdar://problem/74529831>
+
+        Reviewed by Brent Fulgham.
+
+        This may be related to r265084 but something is crashing and I'm not sure what.
+        Adding some Optional checks might fix something, but this is still puzzling to me.
+
+        * editing/cocoa/DictionaryLookup.mm:
+        (WebCore::DictionaryLookup::rangeAtHitTestResult):
+
 2021-03-01  Zalan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Do not try to run simplified alignment when line-height is set

Modified: trunk/Source/WebCore/editing/cocoa/DictionaryLookup.mm (273720 => 273721)


--- trunk/Source/WebCore/editing/cocoa/DictionaryLookup.mm	2021-03-02 04:08:52 UTC (rev 273720)
+++ trunk/Source/WebCore/editing/cocoa/DictionaryLookup.mm	2021-03-02 04:17:16 UTC (rev 273721)
@@ -342,6 +342,8 @@
 
         // As context, we are going to use 250 characters of text before and after the point.
         fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
+        if (!fullCharacterRange)
+            return WTF::nullopt;
 
         selectionRange = NSMakeRange(NSNotFound, 0);
         hitIndex = characterCount(*makeSimpleRange(fullCharacterRange->start, position));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to