Title: [142093] trunk/Source/WebKit/chromium
Revision
142093
Author
[email protected]
Date
2013-02-07 04:18:12 -0800 (Thu, 07 Feb 2013)

Log Message

Add null check to editable in moveCaretSelectionTowardsWindowPoint
https://bugs.webkit.org/show_bug.cgi?id=108962

Patch by David Trainor <[email protected]> on 2013-02-07
Reviewed by Eric Seidel.

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::moveCaretSelectionTowardsWindowPoint):
* tests/WebFrameTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (142092 => 142093)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-02-07 11:57:41 UTC (rev 142092)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-02-07 12:18:12 UTC (rev 142093)
@@ -1,3 +1,14 @@
+2013-02-07  David Trainor  <[email protected]>
+
+        Add null check to editable in moveCaretSelectionTowardsWindowPoint
+        https://bugs.webkit.org/show_bug.cgi?id=108962
+
+        Reviewed by Eric Seidel.
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::moveCaretSelectionTowardsWindowPoint):
+        * tests/WebFrameTest.cpp:
+
 2013-02-07  Sheriff Bot  <[email protected]>
 
         Unreviewed.  Rolled Chromium DEPS to r180752.  Requested by

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (142092 => 142093)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2013-02-07 11:57:41 UTC (rev 142092)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2013-02-07 12:18:12 UTC (rev 142093)
@@ -1412,6 +1412,9 @@
         unscaledPoint.scale(1 / view()->pageScaleFactor(), 1 / view()->pageScaleFactor());
 
     Element* editable = frame()->selection()->rootEditableElement();
+    if (!editable)
+        return;
+
     IntPoint contentsPoint = frame()->view()->windowToContents(unscaledPoint);
     LayoutPoint localPoint(editable->convertFromPage(contentsPoint));
     VisiblePosition position = editable->renderer()->positionForPoint(localPoint);

Modified: trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp (142092 => 142093)


--- trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp	2013-02-07 11:57:41 UTC (rev 142092)
+++ trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp	2013-02-07 12:18:12 UTC (rev 142093)
@@ -2180,4 +2180,13 @@
     webView->close();
 }
 
+TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection)
+{
+    WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
+    WebFrame* frame = webView->mainFrame();
+
+    // This test passes if this doesn't crash.
+    frame->moveCaretSelectionTowardsWindowPoint(WebPoint(0, 0));
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to