summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/editing/Editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/editing/Editor.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/editing/Editor.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/3rdparty/webkit/WebCore/editing/Editor.cpp b/src/3rdparty/webkit/WebCore/editing/Editor.cpp
index b62ded749..0b150d3b1 100644
--- a/src/3rdparty/webkit/WebCore/editing/Editor.cpp
+++ b/src/3rdparty/webkit/WebCore/editing/Editor.cpp
@@ -2258,20 +2258,9 @@ static void markMisspellingsOrBadGrammar(Editor* editor, const VisibleSelection&
Node* editableNode = searchRange->startContainer();
if (!editableNode || !editableNode->isContentEditable())
return;
-
- // Ascend the DOM tree to find a "spellcheck" attribute.
- // When we find a "spellcheck" attribute, retrieve its value and exit if its value is "false".
- const Node* node = editor->frame()->document()->focusedNode();
- while (node) {
- if (node->isElementNode()) {
- const WebCore::AtomicString& value = static_cast<const Element*>(node)->getAttribute(spellcheckAttr);
- if (equalIgnoringCase(value, "true"))
- break;
- if (equalIgnoringCase(value, "false"))
- return;
- }
- node = node->parent();
- }
+
+ if (!editor->spellCheckingEnabledInFocusedNode())
+ return;
// Get the spell checker if it is available
if (!editor->client())
@@ -2289,6 +2278,24 @@ static void markMisspellingsOrBadGrammar(Editor* editor, const VisibleSelection&
}
}
+bool Editor::spellCheckingEnabledInFocusedNode() const
+{
+ // Ascend the DOM tree to find a "spellcheck" attribute.
+ // When we find a "spellcheck" attribute, retrieve its value and return false if its value is "false".
+ const Node* node = frame()->document()->focusedNode();
+ while (node) {
+ if (node->isElementNode()) {
+ const WebCore::AtomicString& value = static_cast<const Element*>(node)->getAttribute(spellcheckAttr);
+ if (equalIgnoringCase(value, "true"))
+ return true;
+ if (equalIgnoringCase(value, "false"))
+ return false;
+ }
+ node = node->parent();
+ }
+ return true;
+}
+
void Editor::markMisspellings(const VisibleSelection& selection, RefPtr<Range>& firstMisspellingRange)
{
markMisspellingsOrBadGrammar(this, selection, true, firstMisspellingRange);
@@ -2325,7 +2332,10 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(bool markSpelling, Range*
Node* editableNode = spellingRange->startContainer();
if (!editableNode || !editableNode->isContentEditable())
return;
-
+
+ if (!spellCheckingEnabledInFocusedNode())
+ return;
+
// Expand the range to encompass entire paragraphs, since text checking needs that much context.
int spellingRangeStartOffset = 0;
int spellingRangeEndOffset = 0;