WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-25539-20101022192809.patch (text/plain), 7.62 KB, created by
Hajime Morrita
on 2010-10-22 03:28:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Hajime Morrita
Created:
2010-10-22 03:28:11 PDT
Size:
7.62 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index cd43dbdc40084c6a1425c25ef04f7df35be03a7c..7111fb0d27a56a924222656506cfd1cc38b031a4 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2010-10-22 MORITA Hajime <morrita@google.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-22 MORITA Hajime <morrita@google.com> > > Reviewed by Kent Tamura. >diff --git a/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt b/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt >index e90ec600286f58e43bc315a27b68071ba3c50ef0..4fa331d184054ea02d51e327d71146c88fe7c1cc 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 70348c601c9ac2c9919b50dc7d0763e8a0f086a4..0e5a07e80528f0a351ded242cf26415c76b604e6 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 155977cb857dc0cf71dd4e33c164af56efbf9215..96ed95b162a844191ace57c8ac92b78a52baba40 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2010-10-22 MORITA Hajime <morrita@google.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ (WebCore::Element::spellCheckingEnabled): >+ * dom/Element.h: >+ * editing/Editor.cpp: >+ (WebCore::Editor::spellCheckingEnabledInFocusedNode): >+ >+ Test: editing/spelling/spellcheck-attribute.html >+ > 2010-10-21 Kwang Yul Seo <skyul@company100.net> > > Reviewed by Kent Tamura. >diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp >index 83e129e8e28cfa510ee0d8156d24385d1e93dcf9..86af556dca9b3d174e1cb5bd2cbe0b1aa83cf57e 100644 >--- a/WebCore/dom/Element.cpp >+++ b/WebCore/dom/Element.cpp >@@ -1678,4 +1678,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::spellCheckingEnabled() 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 b890ecde4f2aed6c1fbe94c5d235da2707742c1a..52615c3b034bdccbcdc51e1c78b1b4081c5e1a2b 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*); >@@ -318,6 +324,9 @@ public: > void webkitRequestFullScreen(unsigned short flags); > #endif > >+ SpellcheckAttributeState spellcheckAttributeState() const; >+ bool spellCheckingEnabled() const; >+ > protected: > Element(const QualifiedName& tagName, Document* document, ConstructionType type) > : ContainerNode(document, type) >diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp >index 7b3d0552a2bfb672c07b78d54d70f02f0fe0d77e..08a3b81768da187f9208739dfd6bd7c8694d814c 100644 >--- a/WebCore/editing/Editor.cpp >+++ b/WebCore/editing/Editor.cpp >@@ -2548,17 +2548,10 @@ 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 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->spellCheckingEnabled(); > } > > void Editor::markMisspellings(const VisibleSelection& selection, RefPtr<Range>& firstMisspellingRange)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 25539
:
71527
|
71543
|
71705
|
71858