Changeset 71101 in webkit


Ignore:
Timestamp:
Nov 1, 2010 10:30:42 PM (13 years ago)
Author:
morrita@google.com
Message:

2010-11-01 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

@spellcheck attribute at the child of contentEditable node is ignored.
https://bugs.webkit.org/show_bug.cgi?id=48418

  • editing/spelling/script-tests/spelling-attribute-at-child.js: Added.
  • editing/spelling/spelling-attribute-at-child-expected.txt: Added.
  • editing/spelling/spelling-attribute-at-child.html: Added.

2010-11-01 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

@spellcheck attribute at the child of contentEditable node is ignored.
https://bugs.webkit.org/show_bug.cgi?id=48418

Changed to check spellcheck availability against a node under the
selection (caret) instead of the focus. For shadow elements, the
check now refers its host node. Note that the original code didn't
care shadows because focus is never set on them.

Test: editing/spelling/spelling-attribute-at-child.html

  • dom/Element.h:
  • editing/Editor.cpp: (WebCore::Editor::markMisspellingsOrBadGrammar): (WebCore::Editor::isSpellCheckingEnabledFor): (WebCore::Editor::isSpellCheckingEnabledInFocusedNode): Now just calling isSpellCheckingEnabledFor() (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
  • editing/Editor.h:
  • platform/ContextMenu.cpp: (WebCore::ContextMenu::populate):
  • rendering/TextControlInnerElements.cpp: (WebCore::TextControlInnerElement::isSpellCheckingEnabled): Added.
  • rendering/TextControlInnerElements.h:
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r71100 r71101  
     12010-11-01  MORITA Hajime  <morrita@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        @spellcheck attribute at the child of contentEditable node is ignored.
     6        https://bugs.webkit.org/show_bug.cgi?id=48418
     7
     8        * editing/spelling/script-tests/spelling-attribute-at-child.js: Added.
     9        * editing/spelling/spelling-attribute-at-child-expected.txt: Added.
     10        * editing/spelling/spelling-attribute-at-child.html: Added.
     11
    1122010-11-01  Adam Barth  <abarth@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r71099 r71101  
     12010-11-01  MORITA Hajime  <morrita@google.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        @spellcheck attribute at the child of contentEditable node is ignored.
     6        https://bugs.webkit.org/show_bug.cgi?id=48418
     7
     8        Changed to check spellcheck availability against a node under the
     9        selection (caret) instead of the focus. For shadow elements, the
     10        check now refers its host node.  Note that the original code didn't
     11        care shadows because focus is never set on them.
     12       
     13        Test: editing/spelling/spelling-attribute-at-child.html
     14
     15        * dom/Element.h:
     16        * editing/Editor.cpp:
     17        (WebCore::Editor::markMisspellingsOrBadGrammar):
     18        (WebCore::Editor::isSpellCheckingEnabledFor):
     19        (WebCore::Editor::isSpellCheckingEnabledInFocusedNode): Now just calling isSpellCheckingEnabledFor()
     20        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
     21        * editing/Editor.h:
     22        * platform/ContextMenu.cpp:
     23        (WebCore::ContextMenu::populate):
     24        * rendering/TextControlInnerElements.cpp:
     25        (WebCore::TextControlInnerElement::isSpellCheckingEnabled): Added.
     26        * rendering/TextControlInnerElements.h:
     27
    1282010-11-01  Martin Robinson  <mrobinson@igalia.com>
    229
  • trunk/WebCore/dom/Element.h

    r70598 r71101  
    327327#endif
    328328
    329     bool isSpellCheckingEnabled() const;
     329    virtual bool isSpellCheckingEnabled() const;
    330330
    331331protected:
  • trunk/WebCore/editing/Editor.cpp

    r71009 r71101  
    20962096        return;
    20972097
    2098     if (!isSpellCheckingEnabledInFocusedNode())
     2098    if (!isSpellCheckingEnabledFor(editableNode))
    20992099        return;
    21002100
     
    21162116}
    21172117
    2118 bool Editor::isSpellCheckingEnabledInFocusedNode() const
    2119 {
    2120     // Ascend the DOM tree to find a "spellcheck" attribute.
    2121     // When we find a "spellcheck" attribute, retrieve its value and return false if its value is "false".
    2122     const Node* node = frame()->document()->focusedNode();
     2118bool Editor::isSpellCheckingEnabledFor(Node* node) const
     2119{
    21232120    if (!node)
    21242121        return false;
     
    21272124        return false;
    21282125    return focusedElement->isSpellCheckingEnabled();
     2126}
     2127
     2128bool Editor::isSpellCheckingEnabledInFocusedNode() const
     2129{
     2130    return isSpellCheckingEnabledFor(m_frame->selection()->start().node());
    21292131}
    21302132
     
    21712173        return;
    21722174
    2173     if (!isSpellCheckingEnabledInFocusedNode())
     2175    if (!isSpellCheckingEnabledFor(editableNode))
    21742176        return;
    21752177
  • trunk/WebCore/editing/Editor.h

    r71009 r71101  
    220220    Vector<String> guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical);
    221221    bool isSpellCheckingEnabledInFocusedNode() const;
     222    bool isSpellCheckingEnabledFor(Node*) const;
    222223    void markMisspellingsAfterTypingToPosition(const VisiblePosition&);
    223224    void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
  • trunk/WebCore/platform/ContextMenu.cpp

    r70963 r71101  
    430430        SelectionController* selection = frame->selection();
    431431        bool inPasswordField = selection->isInPasswordField();
    432         bool spellCheckingEnabled = frame->editor()->isSpellCheckingEnabledInFocusedNode();
     432        bool spellCheckingEnabled = frame->editor()->isSpellCheckingEnabledFor(node);
    433433       
    434434        if (!inPasswordField && spellCheckingEnabled) {
  • trunk/WebCore/rendering/TextControlInnerElements.cpp

    r70863 r71101  
    125125}
    126126
     127bool TextControlInnerElement::isSpellCheckingEnabled() const
     128{
     129    return m_shadowParent && m_shadowParent->isSpellCheckingEnabled();
     130}
     131
    127132// ----------------------------
    128133
  • trunk/WebCore/rendering/TextControlInnerElements.h

    r70490 r71101  
    5050    virtual bool isShadowNode() const { return m_shadowParent; }
    5151    virtual ContainerNode* shadowParentNode() { return m_shadowParent; }
     52    virtual bool isSpellCheckingEnabled() const;
    5253    void setShadowParentNode(HTMLElement* shadowParent) { m_shadowParent = shadowParent; }
    5354
Note: See TracChangeset for help on using the changeset viewer.