[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

morrita at google.com morrita at google.com
Wed Dec 22 14:57:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 44c831970e7f2000f9d150cf9d22c8a60d135b4e
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 04:45:34 2010 +0000

    2010-10-22  MORITA Hajime <morrita at google.com>
    
            Reviewed by Tony Chang.
    
            spellcheck='' should be the same as spellcheck="true"
            https://bugs.webkit.org/show_bug.cgi?id=25539
    
            * editing/spelling/spellcheck-attribute-expected.txt:
            * editing/spelling/spellcheck-attribute.html:
    2010-10-24  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Tony Chang.
    
            spellcheck='' should be the same as spellcheck="true"
            https://bugs.webkit.org/show_bug.cgi?id=25539
    
            - Added a check for empty string and missing attribute.
            - Extracted the check to Element::spellCheckingEnabled()
            - Introduced SpellcheckAttributeState enum to represent the
              states for spellcheck attributes.
    
            * dom/Element.cpp:
            (WebCore::Element::spellcheckAttributeState): Added.
            (WebCore::Element::isSpellCheckingEnabled): Added.
            * dom/Element.h:
            * editing/Editor.cpp:
            (WebCore::markMisspellingsOrBadGrammar):
            (WebCore::Editor::isSpellCheckingEnabledInFocusedNode): Renamed, partly extracted to Element::isSpellCheckingEnabled()
            (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
            * editing/Editor.h:
            * platform/ContextMenu.cpp:
            (WebCore::ContextMenu::populate):
    2010-10-25  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Tony Chang.
    
            spellcheck='' should be the same as spellcheck="true"
            https://bugs.webkit.org/show_bug.cgi?id=25539
    
            Followed API rename in WebCore.
    
            * src/ContextMenuClientImpl.cpp:
            (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
            * src/EditorClientImpl.cpp:
            (WebKit::EditorClientImpl::shouldSpellcheckByDefault):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fa9bfff..d31210c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-22  MORITA Hajime <morrita at google.com>
+
+        Reviewed by Tony Chang.
+
+        spellcheck='' should be the same as spellcheck="true"
+        https://bugs.webkit.org/show_bug.cgi?id=25539
+
+        * editing/spelling/spellcheck-attribute-expected.txt:
+        * editing/spelling/spellcheck-attribute.html:
+
 2010-10-25  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt b/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt
index e90ec60..4fa331d 100644
--- a/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt
+++ b/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt
@@ -3,7 +3,13 @@ This tests if the "spellcheck" attribute is implemented as written in its specif
 PASS:test1_1
 PASS:test1_2
 PASS:test1_3
+PASS:test1_4
+PASS:test1_5
+PASS:test1_6
 PASS:test2_1
 PASS:test2_2
 PASS:test2_3
+PASS:test2_4
+PASS:test2_5
+PASS:test2_6
 
diff --git a/LayoutTests/editing/spelling/spellcheck-attribute.html b/LayoutTests/editing/spelling/spellcheck-attribute.html
index 70348c6..0e5a07e 100644
--- a/LayoutTests/editing/spelling/spellcheck-attribute.html
+++ b/LayoutTests/editing/spelling/spellcheck-attribute.html
@@ -10,11 +10,17 @@
 <label>1.1.</label><input id="test1_1" type="text"></input><br/>
 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br/>
 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><br/>
+<label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></input><br/>
+<label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/>
+<label>1.6.</label><input id="test1_6" type="text"></input><br/>
 </div>
 <div spellcheck="false">
 <label>2.1.</label><input id="test2_1" type="text"></input><br/>
 <label>2.2.</label><input id="test2_2" type="text" spellcheck="true"></input><br/>
 <label>2.3.</label><input id="test2_3" type="text" spellcheck="false"></input><br/>
+<label>2.4.</label><input id="test2_4" type="text" spellcheck="InvalidValue"></input><br/>
+<label>2.5.</label><input id="test2_5" type="text" spellcheck></input><br/>
+<label>2.6.</label><input id="test2_6" type="text"></input><br/>
 </div>
 </div>
 <pre id="console"></pre>
@@ -37,9 +43,15 @@ function testTypingInvalidWord(id, shouldBeMarked) {
 testTypingInvalidWord('test1_1', true);
 testTypingInvalidWord('test1_2', true);
 testTypingInvalidWord('test1_3', false);
+testTypingInvalidWord('test1_4', true);
+testTypingInvalidWord('test1_5', true);
+testTypingInvalidWord('test1_6', true);
 testTypingInvalidWord('test2_1', false);
 testTypingInvalidWord('test2_2', true);
 testTypingInvalidWord('test2_3', false);
+testTypingInvalidWord('test2_4', false);
+testTypingInvalidWord('test2_5', true);
+testTypingInvalidWord('test2_6', false);
 
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f2594be..8e4bfe8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-10-24  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Tony Chang.
+
+        spellcheck='' should be the same as spellcheck="true"
+        https://bugs.webkit.org/show_bug.cgi?id=25539
+
+        - Added a check for empty string and missing attribute.
+        - Extracted the check to Element::spellCheckingEnabled()
+        - Introduced SpellcheckAttributeState enum to represent the
+          states for spellcheck attributes.
+
+        * dom/Element.cpp:
+        (WebCore::Element::spellcheckAttributeState): Added.
+        (WebCore::Element::isSpellCheckingEnabled): Added.
+        * dom/Element.h:
+        * editing/Editor.cpp:
+        (WebCore::markMisspellingsOrBadGrammar):
+        (WebCore::Editor::isSpellCheckingEnabledInFocusedNode): Renamed, partly extracted to Element::isSpellCheckingEnabled()
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
+        * editing/Editor.h:
+        * platform/ContextMenu.cpp:
+        (WebCore::ContextMenu::populate):
+
 2010-10-25  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index f3d388e..4c352c0 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1708,4 +1708,37 @@ void Element::webkitRequestFullScreen(unsigned short flags)
 }
 #endif    
 
+SpellcheckAttributeState Element::spellcheckAttributeState() const
+{
+    if (!hasAttribute(HTMLNames::spellcheckAttr))
+        return SpellcheckAttributeDefault;
+
+    const AtomicString& value = getAttribute(HTMLNames::spellcheckAttr);
+    if (equalIgnoringCase(value, "true") || equalIgnoringCase(value, ""))
+        return SpellcheckAttributeTrue;
+    if (equalIgnoringCase(value, "false"))
+        return SpellcheckAttributeFalse;
+
+    return SpellcheckAttributeDefault;
+}
+
+bool Element::isSpellCheckingEnabled() const
+{
+    const Element* element = this;
+    while (element) {
+        switch (element->spellcheckAttributeState()) {
+        case SpellcheckAttributeTrue:
+            return true;
+        case SpellcheckAttributeFalse:
+            return false;
+        case SpellcheckAttributeDefault:
+            break;
+        }
+
+        element = element->parentElement();
+    }
+
+    return true;
+}
+
 } // namespace WebCore
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index f5f170a..67887cc 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -40,6 +40,12 @@ class DOMTokenList;
 class ElementRareData;
 class IntSize;
 
+enum SpellcheckAttributeState {
+    SpellcheckAttributeTrue,
+    SpellcheckAttributeFalse,
+    SpellcheckAttributeDefault
+};
+
 class Element : public ContainerNode {
 public:
     static PassRefPtr<Element> create(const QualifiedName&, Document*);
@@ -320,6 +326,8 @@ public:
     void webkitRequestFullScreen(unsigned short flags);
 #endif
 
+    bool isSpellCheckingEnabled() const;
+
 protected:
     Element(const QualifiedName& tagName, Document* document, ConstructionType type)
         : ContainerNode(document, type)
@@ -375,7 +383,9 @@ private:
 
     ElementRareData* rareData() const;
     ElementRareData* ensureRareData();
-    
+
+    SpellcheckAttributeState spellcheckAttributeState() const;
+
 private:
     mutable RefPtr<NamedNodeMap> m_attributeMap;
 };
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 4d6d258..3bd4357 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -2524,7 +2524,7 @@ static void markMisspellingsOrBadGrammar(Editor* editor, const VisibleSelection&
     if (!editableNode || !editableNode->isContentEditable())
         return;
 
-    if (!editor->spellCheckingEnabledInFocusedNode())
+    if (!editor->isSpellCheckingEnabledInFocusedNode())
         return;
 
     // Get the spell checker if it is available
@@ -2543,22 +2543,15 @@ static void markMisspellingsOrBadGrammar(Editor* editor, const VisibleSelection&
     }    
 }
 
-bool Editor::spellCheckingEnabledInFocusedNode() const
+bool Editor::isSpellCheckingEnabledInFocusedNode() 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 WTF::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;
+    const Element* focusedElement = node->isElementNode() ? toElement(node) : node->parentElement();
+    if (!focusedElement)
+        return false;
+    return focusedElement->isSpellCheckingEnabled();
 }
 
 void Editor::markMisspellings(const VisibleSelection& selection, RefPtr<Range>& firstMisspellingRange)
@@ -2603,7 +2596,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
     if (!editableNode || !editableNode->isContentEditable())
         return;
 
-    if (!spellCheckingEnabledInFocusedNode())
+    if (!isSpellCheckingEnabledInFocusedNode())
         return;
 
     // Expand the range to encompass entire paragraphs, since text checking needs that much context.
diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h
index df2e947..0ad4737 100644
--- a/WebCore/editing/Editor.h
+++ b/WebCore/editing/Editor.h
@@ -207,7 +207,7 @@ public:
     Vector<String> guessesForMisspelledSelection();
     Vector<String> guessesForUngrammaticalSelection();
     Vector<String> guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical);
-    bool spellCheckingEnabledInFocusedNode() const;
+    bool isSpellCheckingEnabledInFocusedNode() const;
     void markMisspellingsAfterTypingToPosition(const VisiblePosition&);
     void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
     void markBadGrammar(const VisibleSelection&);
diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp
index ca1f719..369f9ce 100644
--- a/WebCore/platform/ContextMenu.cpp
+++ b/WebCore/platform/ContextMenu.cpp
@@ -428,7 +428,7 @@ void ContextMenu::populate()
     } else { // Make an editing context menu
         SelectionController* selection = frame->selection();
         bool inPasswordField = selection->isInPasswordField();
-        bool spellCheckingEnabled = frame->editor()->spellCheckingEnabledInFocusedNode();
+        bool spellCheckingEnabled = frame->editor()->isSpellCheckingEnabledInFocusedNode();
         
         if (!inPasswordField && spellCheckingEnabled) {
             // Consider adding spelling-related or grammar-related context menu items (never both, since a single selected range
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 994787e..60b61a3 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-25  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Tony Chang.
+
+        spellcheck='' should be the same as spellcheck="true"
+        https://bugs.webkit.org/show_bug.cgi?id=25539
+
+        Followed API rename in WebCore.
+
+        * src/ContextMenuClientImpl.cpp:
+        (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+        * src/EditorClientImpl.cpp:
+        (WebKit::EditorClientImpl::shouldSpellcheckByDefault):
+
 2010-10-25  Satish Sampath  <satish at chromium.org>
 
         Unreviewed, fix for a build break caused by my earlier patch.
diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp
index d9ccb17..d33a06b 100644
--- a/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -241,7 +241,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
         if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
             data.isSpellCheckingEnabled = true;
             // Spellchecking might be enabled for the field, but could be disabled on the node.
-            if (m_webView->focusedWebCoreFrame()->editor()->spellCheckingEnabledInFocusedNode())
+            if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode())
                 data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
         }
     }
diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp
index 11977b6..bc1d206 100644
--- a/WebKit/chromium/src/EditorClientImpl.cpp
+++ b/WebKit/chromium/src/EditorClientImpl.cpp
@@ -124,7 +124,7 @@ bool EditorClientImpl::shouldSpellcheckByDefault()
     const Editor* editor = frame->editor();
     if (!editor)
         return false;
-    if (editor->spellCheckingEnabledInFocusedNode())
+    if (editor->isSpellCheckingEnabledInFocusedNode())
         return true;
     const Document* document = frame->document();
     if (!document)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list