[iOS] getAssistedNodeInformation crashes getting the bounding box if it doesn't have...
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Apr 2014 03:54:33 +0000 (03:54 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Apr 2014 03:54:33 +0000 (03:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132217
<rdar://problem/16671662>

Patch by Simon Fraser <simon.fraser@apple.com> on 2014-04-25
Reviewed by Dean Jackson.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation): Check that m_assistedNode has
a renderer before asking for its bounding box.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167839 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 50ed3742b6b1ffcb95f9c54d1c58ccf3027e7145..b444574606b072f8d38d946ef47a442c39bcb2f2 100644 (file)
@@ -1,3 +1,15 @@
+2014-04-25  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] getAssistedNodeInformation crashes getting the bounding box if it doesn't have a renderer
+        https://bugs.webkit.org/show_bug.cgi?id=132217
+        <rdar://problem/16671662>
+
+        Reviewed by Dean Jackson.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation): Check that m_assistedNode has
+        a renderer before asking for its bounding box.
+
 2014-04-25  Benjamin Poulain  <bpoulain@apple.com>
 
         [iOS][WK2] Add an intermediary view to do the target transform and adjustment transform
index 2e6edff8ce56d104258d8f2b7dbed41e0bd1869d..5fbae4c09ac4b2d457314d9217145e5556d739bf 100644 (file)
@@ -1682,7 +1682,10 @@ void WebPage::focusNextAssistedNode(bool isForward)
 
 void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
 {
-    information.elementRect = m_page->focusController().focusedOrMainFrame().view()->contentsToRootView(m_assistedNode->renderer()->absoluteBoundingBoxRect());
+    if (RenderObject* renderer = m_assistedNode->renderer())
+        information.elementRect = m_page->focusController().focusedOrMainFrame().view()->contentsToRootView(renderer->absoluteBoundingBoxRect());
+    else
+        information.elementRect = IntRect();
     information.minimumScaleFactor = m_viewportConfiguration.minimumScale();
     information.maximumScaleFactor = m_viewportConfiguration.maximumScale();
     information.hasNextNode = hasFocusableElement(m_assistedNode.get(), m_page.get(), true);