Title: [279304] trunk/Source/WebKit
Revision
279304
Author
[email protected]
Date
2021-06-25 17:49:17 -0700 (Fri, 25 Jun 2021)

Log Message

[iOS] Web process sometimes crashes under findDataDetectionResultElementInImageOverlay
https://bugs.webkit.org/show_bug.cgi?id=227412
rdar://79588091

Reviewed by Devin Rousso.

Speculatively fix the crash by ensuring that the hit-tested text node inside an image overlay is inside the
shadow root of the element responding to click events, and that the element responding to click events contains
an image overlay.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::elementPositionInformation):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (279303 => 279304)


--- trunk/Source/WebKit/ChangeLog	2021-06-26 00:39:22 UTC (rev 279303)
+++ trunk/Source/WebKit/ChangeLog	2021-06-26 00:49:17 UTC (rev 279304)
@@ -1,3 +1,18 @@
+2021-06-25  Wenson Hsieh  <[email protected]>
+
+        [iOS] Web process sometimes crashes under findDataDetectionResultElementInImageOverlay
+        https://bugs.webkit.org/show_bug.cgi?id=227412
+        rdar://79588091
+
+        Reviewed by Devin Rousso.
+
+        Speculatively fix the crash by ensuring that the hit-tested text node inside an image overlay is inside the
+        shadow root of the element responding to click events, and that the element responding to click events contains
+        an image overlay.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::elementPositionInformation):
+
 2021-06-25  Per Arne  <[email protected]>
 
         [macOS] Add missing methods to IOKit filter

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (279303 => 279304)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-06-26 00:39:22 UTC (rev 279303)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-06-26 00:49:17 UTC (rev 279304)
@@ -2895,8 +2895,10 @@
     }
 
 #if ENABLE(DATA_DETECTION)
-    if (info.isImageOverlayText && is<HTMLElement>(element))
-        dataDetectorImageOverlayPositionInformation(downcast<HTMLElement>(element), request, info);
+    if (info.isImageOverlayText && innerNonSharedNode->shadowHost() == &element && is<HTMLElement>(element)) {
+        if (auto htmlElement = makeRef(downcast<HTMLElement>(element)); htmlElement->hasImageOverlay())
+            dataDetectorImageOverlayPositionInformation(htmlElement.get(), request, info);
+    }
 #endif
 
     info.elementContext = page.contextForElement(element);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to