Diff
Modified: trunk/Source/WebCore/ChangeLog (151639 => 151640)
--- trunk/Source/WebCore/ChangeLog 2013-06-17 13:43:48 UTC (rev 151639)
+++ trunk/Source/WebCore/ChangeLog 2013-06-17 13:57:45 UTC (rev 151640)
@@ -1,3 +1,25 @@
+2013-06-17 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSSION(r151632) : Build error on ASSERT(WTF_USE_GRAMMAR_CHECKING)
+ https://bugs.webkit.org/show_bug.cgi?id=117692
+
+ Reviewed by Jocelyn Turcotte.
+
+ Ifdef the feature-depending code and fix the assertions to check runtime conditions.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::advanceToNextMisspelling):
+ (WebCore::Editor::markMisspellingsOrBadGrammar):
+ (WebCore::Editor::markBadGrammar):
+ * editing/TextCheckingHelper.cpp:
+ (WebCore::findBadGrammars):
+ (WebCore::TextCheckingHelper::findFirstGrammarDetail):
+ (WebCore::TextCheckingHelper::findFirstBadGrammar):
+ (WebCore::TextCheckingHelper::isUngrammatical):
+ (WebCore::TextCheckingHelper::markAllBadGrammar):
+ (WebCore::checkTextOfParagraph):
+ * editing/TextCheckingHelper.h:
+
2013-06-17 Grzegorz Czajkowski <[email protected]>
Unreviewed, rolling out r151632.
Modified: trunk/Source/WebCore/editing/Editor.cpp (151639 => 151640)
--- trunk/Source/WebCore/editing/Editor.cpp 2013-06-17 13:43:48 UTC (rev 151639)
+++ trunk/Source/WebCore/editing/Editor.cpp 2013-06-17 13:57:45 UTC (rev 151640)
@@ -1767,8 +1767,11 @@
}
}
+#if !USE(GRAMMAR_CHECKING)
+ ASSERT(badGrammarPhrase.isEmpty());
+ UNUSED_PARAM(grammarPhraseOffset);
+#else
if (!badGrammarPhrase.isEmpty()) {
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
// We found bad grammar. Since we only searched for bad grammar up to the first misspelled word, the bad grammar
// takes precedence and we ignore any potential misspelled word. Select the grammar detail, update the spelling
// panel, and store a marker so we draw the green squiggle later.
@@ -1783,7 +1786,9 @@
client()->updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail);
frame()->document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
- } else if (!misspelledWord.isEmpty()) {
+ } else
+#endif
+ if (!misspelledWord.isEmpty()) {
// We found a misspelling, but not any earlier bad grammar. Select the misspelling, update the spelling panel, and store
// a marker so we draw the red squiggle later.
@@ -2064,9 +2069,12 @@
if (checkSpelling)
checker.markAllMisspellings(firstMisspellingRange);
else {
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
+#if USE(GRAMMAR_CHECKING)
if (isGrammarCheckingEnabled())
checker.markAllBadGrammar();
+#else
+ ASSERT_NOT_REACHED();
+#endif
}
}
@@ -2092,9 +2100,12 @@
void Editor::markBadGrammar(const VisibleSelection& selection)
{
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
+#if USE(GRAMMAR_CHECKING)
RefPtr<Range> firstMisspellingRange;
markMisspellingsOrBadGrammar(selection, false, firstMisspellingRange);
+#else
+ ASSERT_NOT_REACHED();
+#endif
}
void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* spellingRange, Range* grammarRange)
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (151639 => 151640)
--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2013-06-17 13:43:48 UTC (rev 151639)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2013-06-17 13:57:45 UTC (rev 151640)
@@ -41,10 +41,10 @@
namespace WebCore {
#if !USE(UNIFIED_TEXT_CHECKING)
+
+#if USE(GRAMMAR_CHECKING)
static void findBadGrammars(TextCheckerClient* client, const UChar* text, int start, int length, Vector<TextCheckingResult>& results)
{
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
-
int checkLocation = start;
int checkLength = length;
@@ -68,6 +68,7 @@
checkLength -= (badGrammarLocation + badGrammarLength);
}
}
+#endif
static void findMisspellings(TextCheckerClient* client, const UChar* text, int start, int length, Vector<TextCheckingResult>& results)
{
@@ -413,9 +414,9 @@
return firstFoundItem;
}
+#if USE(GRAMMAR_CHECKING)
int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int /*badGrammarPhraseLength*/, int startOffset, int endOffset, bool markAll)
{
-#if USE(GRAMMAR_CHECKING)
// Found some bad grammar. Find the earliest detail range that starts in our search range (if any).
// Optionally add a DocumentMarker for each detail in the range.
int earliestDetailLocationSoFar = -1;
@@ -447,20 +448,10 @@
}
return earliestDetailIndex;
-#else
- ASSERT_NOT_REACHED();
- UNUSED_PARAM(grammarDetails);
- UNUSED_PARAM(badGrammarPhraseLocation);
- UNUSED_PARAM(startOffset);
- UNUSED_PARAM(endOffset);
- UNUSED_PARAM(markAll);
- return 0;
-#endif
}
String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll)
{
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
// Initialize out parameters; these will be updated if we find something to return.
outGrammarDetail.location = -1;
outGrammarDetail.length = 0;
@@ -521,7 +512,6 @@
bool TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) const
{
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
if (!m_client)
return false;
@@ -563,6 +553,7 @@
return true;
}
+#endif
Vector<String> TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool& misspelled, bool& ungrammatical) const
{
@@ -630,15 +621,16 @@
findFirstMisspelling(ignoredOffset, true, firstMisspellingRange);
}
+#if USE(GRAMMAR_CHECKING)
void TextCheckingHelper::markAllBadGrammar()
{
- ASSERT(WTF_USE_GRAMMAR_CHECKING);
// Use the "markAll" feature of ofindFirstBadGrammar. Ignore the return value and "out parameters"; all we need to
// do is mark every instance.
GrammarDetail ignoredGrammarDetail;
int ignoredOffset;
findFirstBadGrammar(ignoredGrammarDetail, ignoredOffset, true);
}
+#endif
bool TextCheckingHelper::unifiedTextCheckerEnabled() const
{
@@ -662,6 +654,7 @@
if (checkingTypes & TextCheckingTypeSpelling)
findMisspellings(client, text, 0, length, spellingResult);
+#if USE(GRAMMAR_CHECKING)
Vector<TextCheckingResult> grammarResult;
if (checkingTypes & TextCheckingTypeGrammar) {
// Only checks grammartical error before the first misspellings
@@ -676,6 +669,7 @@
if (grammarResult.size())
results.swap(grammarResult);
+#endif
if (spellingResult.size()) {
if (results.isEmpty())
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.h (151639 => 151640)
--- trunk/Source/WebCore/editing/TextCheckingHelper.h 2013-06-17 13:43:48 UTC (rev 151639)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.h 2013-06-17 13:57:45 UTC (rev 151640)
@@ -85,12 +85,13 @@
String findFirstMisspelling(int& firstMisspellingOffset, bool markAll, RefPtr<Range>& firstMisspellingRange);
String findFirstMisspellingOrBadGrammar(bool checkGrammar, bool& outIsSpelling, int& outFirstFoundOffset, GrammarDetail& outGrammarDetail);
+ void markAllMisspellings(RefPtr<Range>& firstMisspellingRange);
+#if USE(GRAMMAR_CHECKING)
String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll);
int findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int badGrammarPhraseLength, int startOffset, int endOffset, bool markAll);
- void markAllMisspellings(RefPtr<Range>& firstMisspellingRange);
void markAllBadGrammar();
-
bool isUngrammatical(Vector<String>& guessesVector) const;
+#endif
Vector<String> guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool& misspelled, bool& ungrammatical) const;
private:
EditorClient* m_client;