Title: [88211] trunk
Revision
88211
Author
[email protected]
Date
2011-06-06 18:44:26 -0700 (Mon, 06 Jun 2011)

Log Message

2011-06-06  MORITA Hajime  <[email protected]>

        Reviewed by Kent Tamura.

        Assertion fails in TextCheckingHelper by right-clicking on <input type=search>
        https://bugs.webkit.org/show_bug.cgi?id=61991

        * editing/spelling/spellcheck-input-search-crash-expected.txt: Added.
        * editing/spelling/spellcheck-input-search-crash.html: Added.
2011-06-06  MORITA Hajime  <[email protected]>

        Reviewed by Kent Tamura.

        Assertion fails in TextCheckingHelper by right-clicking on <input type=search>
        https://bugs.webkit.org/show_bug.cgi?id=61991

        Added a guard bofore TextCheckingHelper construction sites.

        Test: editing/spelling/spellcheck-input-search-crash.html

        * editing/Editor.cpp:
        (WebCore::Editor::isSelectionUngrammatical):
        (WebCore::Editor::guessesForUngrammaticalSelection):
        (WebCore::Editor::guessesForMisspelledOrUngrammaticalSelection):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88210 => 88211)


--- trunk/LayoutTests/ChangeLog	2011-06-07 01:35:52 UTC (rev 88210)
+++ trunk/LayoutTests/ChangeLog	2011-06-07 01:44:26 UTC (rev 88211)
@@ -1,3 +1,13 @@
+2011-06-06  MORITA Hajime  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        Assertion fails in TextCheckingHelper by right-clicking on <input type=search>
+        https://bugs.webkit.org/show_bug.cgi?id=61991
+
+        * editing/spelling/spellcheck-input-search-crash-expected.txt: Added.
+        * editing/spelling/spellcheck-input-search-crash.html: Added.
+
 2011-06-06  James Kozianski  <[email protected]>
 
         [Chromium] Unreviewed, update test_expectations.txt.

Added: trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash-expected.txt (0 => 88211)


--- trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash-expected.txt	2011-06-07 01:44:26 UTC (rev 88211)
@@ -0,0 +1,10 @@
+This test passes if it doesn't crash and the context menu is shown for the search input
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS clicked is true
+
Property changes on: trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash.html (0 => 88211)


--- trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash.html	                        (rev 0)
+++ trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash.html	2011-06-07 01:44:26 UTC (rev 88211)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script>
+var clicked = false;
+
+function handleClicked()
+{
+    clicked = true;
+}
+
+function test()
+{
+    description("This test passes if it doesn't crash and the context menu is shown for the search input");
+    if (!window.eventSender)
+        return;
+    var target = document.getElementById("target");
+    var clickX = target.offsetLeft + target.offsetWidth - 2;
+    var clickY = target.offsetTop + target.offsetHeight / 2;
+    eventSender.mouseMoveTo(clickX, clickY);
+    eventSender.contextClick();
+    shouldBe("clicked", "true");
+}
+var successfullyParsed = true;
+</script>
+</head>
+<body _onload_="test();">
+<p id="description"></p>
+<div id="console"></div>
+<input id="target" type="search" _oncontextmenu_="handleClicked()">
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/editing/spelling/spellcheck-input-search-crash.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (88210 => 88211)


--- trunk/Source/WebCore/ChangeLog	2011-06-07 01:35:52 UTC (rev 88210)
+++ trunk/Source/WebCore/ChangeLog	2011-06-07 01:44:26 UTC (rev 88211)
@@ -1,3 +1,19 @@
+2011-06-06  MORITA Hajime  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        Assertion fails in TextCheckingHelper by right-clicking on <input type=search>
+        https://bugs.webkit.org/show_bug.cgi?id=61991
+
+        Added a guard bofore TextCheckingHelper construction sites.
+
+        Test: editing/spelling/spellcheck-input-search-crash.html
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::isSelectionUngrammatical):
+        (WebCore::Editor::guessesForUngrammaticalSelection):
+        (WebCore::Editor::guessesForMisspelledOrUngrammaticalSelection):
+
 2011-06-06  Emil A Eklund  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/editing/Editor.cpp (88210 => 88211)


--- trunk/Source/WebCore/editing/Editor.cpp	2011-06-07 01:35:52 UTC (rev 88210)
+++ trunk/Source/WebCore/editing/Editor.cpp	2011-06-07 01:44:26 UTC (rev 88211)
@@ -1855,7 +1855,10 @@
 {
 #if USE(GRAMMAR_CHECKING)
     Vector<String> ignoredGuesses;
-    return TextCheckingHelper(client(), frame()->selection()->toNormalizedRange()).isUngrammatical(ignoredGuesses);
+    RefPtr<Range> range = frame()->selection()->toNormalizedRange();
+    if (!range)
+        return false;
+    return TextCheckingHelper(client(), range).isUngrammatical(ignoredGuesses);
 #else
     return false;
 #endif
@@ -1865,8 +1868,11 @@
 {
 #if USE(GRAMMAR_CHECKING)
     Vector<String> guesses;
+    RefPtr<Range> range = frame()->selection()->toNormalizedRange();
+    if (!range)
+        return guesses;
     // Ignore the result of isUngrammatical; we just want the guesses, whether or not there are any
-    TextCheckingHelper(client(), frame()->selection()->toNormalizedRange()).isUngrammatical(guesses);
+    TextCheckingHelper(client(), range).isUngrammatical(guesses);
     return guesses;
 #else
     return Vector<String>();
@@ -1887,7 +1893,10 @@
 Vector<String> Editor::guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical)
 {
 #if USE(UNIFIED_TEXT_CHECKING)
-    return TextCheckingHelper(client(), frame()->selection()->toNormalizedRange()).guessesForMisspelledOrUngrammaticalRange(isGrammarCheckingEnabled(), misspelled, ungrammatical);
+    RefPtr<Range> range = frame()->selection()->toNormalizedRange();
+    if (!range)
+        return Vector<String>();
+    return TextCheckingHelper(client(), range).guessesForMisspelledOrUngrammaticalRange(isGrammarCheckingEnabled(), misspelled, ungrammatical);
 #else
     misspelled = isSelectionMisspelled();
     if (misspelled) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to