Title: [211538] trunk/Source/WebKit2
Revision
211538
Author
enr...@apple.com
Date
2017-02-01 15:25:15 -0800 (Wed, 01 Feb 2017)

Log Message

WebProcess crashes in  int WTF::__throw_bad_variant_access<int> when expanding/shrinking a block selection.
https://bugs.webkit.org/show_bug.cgi?id=167673
rdar://problem/30229620

Reviewed by Anders Carlsson

This is a speculative fix for a bug that might have been introduced
with http://trac.webkit.org/changeset/208479.
The code in containsRange inline fuction in WebPageIOS.mm has not been
updated when the return value of Range::compareBoundaryPoints was changed
to ExceptionOr<short>.
Since there is already a method containsRange in the Range class that
does the right thing, expandedRangeFromHandle now uses that.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::expandedRangeFromHandle):
(WebKit::containsRange): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (211537 => 211538)


--- trunk/Source/WebKit2/ChangeLog	2017-02-01 23:16:20 UTC (rev 211537)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-01 23:25:15 UTC (rev 211538)
@@ -1,3 +1,23 @@
+2017-02-01  Enrica Casucci  <enr...@apple.com>
+
+        WebProcess crashes in  int WTF::__throw_bad_variant_access<int> when expanding/shrinking a block selection.
+        https://bugs.webkit.org/show_bug.cgi?id=167673
+        rdar://problem/30229620
+
+        Reviewed by Anders Carlsson
+
+        This is a speculative fix for a bug that might have been introduced
+        with http://trac.webkit.org/changeset/208479.
+        The code in containsRange inline fuction in WebPageIOS.mm has not been
+        updated when the return value of Range::compareBoundaryPoints was changed
+        to ExceptionOr<short>.
+        Since there is already a method containsRange in the Range class that
+        does the right thing, expandedRangeFromHandle now uses that.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::expandedRangeFromHandle):
+        (WebKit::containsRange): Deleted.
+
 2017-02-01  Anders Carlsson  <ander...@apple.com>
 
         IPC::Connection receive ports should be guarded

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (211537 => 211538)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-02-01 23:16:20 UTC (rev 211537)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-02-01 23:25:15 UTC (rev 211538)
@@ -1272,15 +1272,6 @@
         && (heightRatio > minMagnitudeRatio && yOriginShiftRatio < maxDisplacementRatio));
 }
 
-static inline bool containsRange(Range* first, Range* second)
-{
-    if (!first || !second)
-        return false;
-    return first->commonAncestorContainer()->ownerDocument() == second->commonAncestorContainer()->ownerDocument()
-        && first->compareBoundaryPoints(Range::START_TO_START, *second).releaseReturnValue() <= 0
-        && first->compareBoundaryPoints(Range::END_TO_END, *second).releaseReturnValue() >= 0;
-}
-
 static inline RefPtr<Range> unionDOMRanges(Range* rangeA, Range* rangeB)
 {
     if (!rangeB)
@@ -1350,9 +1341,9 @@
         if (!rangeAtPosition || &currentRange->ownerDocument() != &rangeAtPosition->ownerDocument())
             continue;
 
-        if (containsRange(rangeAtPosition.get(), currentRange))
+        if (rangeAtPosition->contains(*currentRange))
             newRange = rangeAtPosition;
-        else if (containsRange(currentRange, rangeAtPosition.get()))
+        else if (currentRange->contains(*rangeAtPosition.get()))
             newRange = currentRange;
         else
             newRange = unionDOMRanges(currentRange, rangeAtPosition.get());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to