Title: [153513] trunk/Source/WebCore
- Revision
- 153513
- Author
- [email protected]
- Date
- 2013-07-31 01:06:54 -0700 (Wed, 31 Jul 2013)
Log Message
Unnecessary const_cast<TextCheckingHelper*>(this)->findFirstBadGrammar
https://bugs.webkit.org/show_bug.cgi?id=119244
Reviewed by Ryosuke Niwa.
Added missing const modifier to findFirstBadGrammar (and findFirstGrammarDetail
respectively) to call it in 'isUngrammatical() const' without const casting.
No new tests, no behavior change.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::findFirstGrammarDetail):
(WebCore::TextCheckingHelper::findFirstBadGrammar):
Added const.
(WebCore::TextCheckingHelper::isUngrammatical):
Now const_cast can be removed.
* editing/TextCheckingHelper.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (153512 => 153513)
--- trunk/Source/WebCore/ChangeLog 2013-07-31 07:23:41 UTC (rev 153512)
+++ trunk/Source/WebCore/ChangeLog 2013-07-31 08:06:54 UTC (rev 153513)
@@ -1,3 +1,25 @@
+2013-07-31 Grzegorz Czajkowski <[email protected]>
+
+ Unnecessary const_cast<TextCheckingHelper*>(this)->findFirstBadGrammar
+ https://bugs.webkit.org/show_bug.cgi?id=119244
+
+ Reviewed by Ryosuke Niwa.
+
+ Added missing const modifier to findFirstBadGrammar (and findFirstGrammarDetail
+ respectively) to call it in 'isUngrammatical() const' without const casting.
+
+ No new tests, no behavior change.
+
+ * editing/TextCheckingHelper.cpp:
+ (WebCore::TextCheckingHelper::findFirstGrammarDetail):
+ (WebCore::TextCheckingHelper::findFirstBadGrammar):
+ Added const.
+
+ (WebCore::TextCheckingHelper::isUngrammatical):
+ Now const_cast can be removed.
+
+ * editing/TextCheckingHelper.h:
+
2013-07-30 Grzegorz Czajkowski <[email protected]>
findFirstGrammarDetail doesn't need to be exposed.
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (153512 => 153513)
--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2013-07-31 07:23:41 UTC (rev 153512)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2013-07-31 08:06:54 UTC (rev 153513)
@@ -415,7 +415,7 @@
}
#if USE(GRAMMAR_CHECKING)
-int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int startOffset, int endOffset, bool markAll)
+int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int badGrammarPhraseLocation, int startOffset, int endOffset, bool markAll) const
{
// 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.
@@ -450,7 +450,7 @@
return earliestDetailIndex;
}
-String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll)
+String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll) const
{
// Initialize out parameters; these will be updated if we find something to return.
outGrammarDetail.location = -1;
@@ -525,7 +525,7 @@
int grammarPhraseOffset;
GrammarDetail grammarDetail;
- String badGrammarPhrase = const_cast<TextCheckingHelper*>(this)->findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
+ String badGrammarPhrase = findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
// No bad grammar in these parts at all.
if (badGrammarPhrase.isEmpty())
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.h (153512 => 153513)
--- trunk/Source/WebCore/editing/TextCheckingHelper.h 2013-07-31 07:23:41 UTC (rev 153512)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.h 2013-07-31 08:06:54 UTC (rev 153513)
@@ -87,7 +87,7 @@
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);
+ String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll) const;
void markAllBadGrammar();
bool isUngrammatical(Vector<String>& guessesVector) const;
#endif
@@ -99,7 +99,7 @@
bool unifiedTextCheckerEnabled() const;
#if USE(GRAMMAR_CHECKING)
- int findFirstGrammarDetail(const Vector<GrammarDetail>&, int badGrammarPhraseLocation, int startOffset, int endOffset, bool markAll);
+ int findFirstGrammarDetail(const Vector<GrammarDetail>&, int badGrammarPhraseLocation, int startOffset, int endOffset, bool markAll) const;
#endif
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes