LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2006 22:21:22 +0000 (22:21 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2006 22:21:22 +0000 (22:21 +0000)
        Tests for change to make readonly text fields have dimmed borders.

        * fast/forms/input-appearance-readonly-expected.checksum:
        * fast/forms/input-appearance-readonly-expected.png:
        * fast/forms/input-readonly-dimmed-expected.checksum: Added.
        * fast/forms/input-readonly-dimmed-expected.png: Added.
        * fast/forms/input-readonly-dimmed-expected.txt: Added.
        * fast/forms/input-readonly-dimmed.html: Added.

WebCore:

 2006-04-19  Adele Peterson  <adele@apple.com>

         Reviewed by Beth.

         Fix to make readonly text fields have dimmed borders to match AppKit behavior.

         Test: fast/forms/input-readonly-dimmed.html

         * dom/Node.h: (WebCore::Node::isReadOnlyControl): Changed from const version of isReadOnly.
         * dom/Node.cpp:
         (WebCore::Node::isReadOnlyNode): Changed from isReadOnly.
         (WebCore::Node::setNodeValue): Uses isReadOnlyNode instead of isReadOnly.
         (WebCore::Node::checkSetPrefix): ditto.
         (WebCore::Node::checkAddChild): ditto.
         * dom/Attr.cpp: (WebCore::Attr::setValue): ditto.
         * dom/CharacterData.cpp:
         (WebCore::CharacterData::setData): ditto.
         (WebCore::CharacterData::appendData): ditto.
         (WebCore::CharacterData::checkCharDataOperation): ditto.
         * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeChild): ditto.
         * dom/Element.cpp: (WebCore::Element::setAttribute): ditto.
         * dom/NamedAttrMap.cpp:
         (WebCore::NamedAttrMap::setNamedItem): ditto.
         (WebCore::NamedAttrMap::removeNamedItem): ditto.
         * dom/NamedAttrMap.h: (WebCore::NamedAttrMap::isReadOnlyNode): ditto.
         * dom/NamedNodeMap.h: (WebCore::NamedNodeMap::isReadOnlyNode): ditto.
         * dom/Range.cpp:
         (WebCore::Range::checkDeleteExtract): ditto.
         (WebCore::Range::containedByReadOnly): ditto.
         * dom/Text.cpp: (WebCore::Text::splitText): ditto.
         * dom/dom_xmlimpl.cpp: (WebCore::ProcessingInstruction::setData): ditto.

         * bindings/js/kjs_html.cpp:
         (KJS::JSHTMLElement::inputGetter): Uses isReadOnlyControl instead of isReadOnly.
         (KJS::JSHTMLElement::textAreaGetter): ditto.
         * bindings/objc/DOMHTML.mm: (-[DOMHTMLInputElement readOnly]): ditto.
         * rendering/render_form.cpp:
         (WebCore::RenderLineEdit::updateFromElement): ditto.
         (WebCore::RenderTextArea::updateFromElement): ditto.
         * rendering/RenderTextField.cpp:
         (WebCore::RenderTextField::createDivStyle): ditto.
         (WebCore::RenderTextField::updateFromElement): ditto.

         * html/HTMLGenericFormElement.cpp: (WebCore::HTMLGenericFormElement::parseMappedAttribute):
           When readonly attribute changes, update the theme so the control will repaint.
         * html/HTMLGenericFormElement.h: (WebCore::HTMLGenericFormElement::isReadOnlyControl): Renamed from readOnly.
         * html/HTMLInputElement.h: Removed isReadOnly, since isReadOnlyControl now exists on HTMLGenericFormElement.
         * rendering/RenderTheme.cpp: (WebCore::RenderTheme::isReadOnlyControl): Renamed from isReadOnly.
         * rendering/RenderTheme.h: (WebCore::): Added ReadOnlyState to ControlState enum.
         * rendering/RenderThemeMac.h: Removed NSTextFieldCell since it was only being used to store the enabled state.
           Removed setTextFieldState since it was updating the enabled state of the cell, which is only used in one place.
         * rendering/RenderThemeMac.mm:
         (WebCore::RenderThemeMac::RenderThemeMac): No longer initialized the NSTextFieldCell.
         (WebCore::RenderThemeMac::adjustRepaintRect): No longer calls setTextFieldState.
         (WebCore::RenderThemeMac::paintTextField): Uses the enabled state and the readonly state to determine whether to draw
          a dimmed version of the aqua border.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13973 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/input-appearance-readonly-expected.checksum
LayoutTests/fast/forms/input-appearance-readonly-expected.png
LayoutTests/fast/forms/input-readonly-dimmed-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-dimmed-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-dimmed-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-dimmed.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/objc/DOMHTML.mm
WebCore/dom/Attr.cpp
WebCore/dom/CharacterData.cpp
WebCore/dom/ContainerNode.cpp
WebCore/dom/Element.cpp
WebCore/dom/NamedAttrMap.cpp
WebCore/dom/NamedAttrMap.h
WebCore/dom/NamedNodeMap.h
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/dom/Range.cpp
WebCore/dom/Text.cpp
WebCore/dom/dom_xmlimpl.cpp
WebCore/html/HTMLGenericFormElement.cpp
WebCore/html/HTMLGenericFormElement.h
WebCore/html/HTMLInputElement.h
WebCore/rendering/RenderTextField.cpp
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderTheme.h
WebCore/rendering/RenderThemeMac.h
WebCore/rendering/RenderThemeMac.mm
WebCore/rendering/render_form.cpp

index 9d9773c25adb8824794811f250f5ebaba3fcff4f..2037d1a3add4a5f8f6e20b986d0c3ea0a9e29414 100644 (file)
@@ -1,3 +1,14 @@
+2006-04-19  Adele Peterson  <adele@apple.com>
+
+        Tests for change to make readonly text fields have dimmed borders.
+
+        * fast/forms/input-appearance-readonly-expected.checksum:
+        * fast/forms/input-appearance-readonly-expected.png:
+        * fast/forms/input-readonly-dimmed-expected.checksum: Added.
+        * fast/forms/input-readonly-dimmed-expected.png: Added.
+        * fast/forms/input-readonly-dimmed-expected.txt: Added.
+        * fast/forms/input-readonly-dimmed.html: Added.
+
 2006-04-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Eric, landed by ap.
index 61ca1c8710f909365c95a6083d788366c90fec6c..1ffe3067c057670a65a06bc714169f248da80292 100644 (file)
@@ -1 +1 @@
-714bda3e7dcea28242a2759f56071bad
\ No newline at end of file
+63391945b82cbeff58b29477d7033994
\ No newline at end of file
index 33441ff8ec799d4b5cc8f2759becbb8c7273f138..40ebbca58933fc5e7eda577c8821841c976ded2a 100644 (file)
Binary files a/LayoutTests/fast/forms/input-appearance-readonly-expected.png and b/LayoutTests/fast/forms/input-appearance-readonly-expected.png differ
diff --git a/LayoutTests/fast/forms/input-readonly-dimmed-expected.checksum b/LayoutTests/fast/forms/input-readonly-dimmed-expected.checksum
new file mode 100644 (file)
index 0000000..ed2cbd1
--- /dev/null
@@ -0,0 +1 @@
+b9af0752503eb2800cd69c78463c6144
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/input-readonly-dimmed-expected.png b/LayoutTests/fast/forms/input-readonly-dimmed-expected.png
new file mode 100644 (file)
index 0000000..ebaa1c8
Binary files /dev/null and b/LayoutTests/fast/forms/input-readonly-dimmed-expected.png differ
diff --git a/LayoutTests/fast/forms/input-readonly-dimmed-expected.txt b/LayoutTests/fast/forms/input-readonly-dimmed-expected.txt
new file mode 100644 (file)
index 0000000..32aa523
--- /dev/null
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 455x18
+        text run at (0,0) width 455: "This tests that the border of a readonly text field should appear dimmed. "
+      RenderBR {BR} at (455,14) size 0x0
+      RenderTextField {INPUT} at (2,20) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (13,31) size 142x13 scrollWidth 167
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 166x13
+      text run at (1,0) width 166: "This border should be dimmed"
diff --git a/LayoutTests/fast/forms/input-readonly-dimmed.html b/LayoutTests/fast/forms/input-readonly-dimmed.html
new file mode 100644 (file)
index 0000000..5c14745
--- /dev/null
@@ -0,0 +1,7 @@
+<html>
+<body onload="document.getElementById('tf').readOnly = true">
+This tests that the border of a readonly text field should appear dimmed.
+<br>
+<input id="tf" readonly value="This border should be dimmed"></input>
+</body>
+</html>
\ No newline at end of file
index 2aaa99668dd5cec63fd320ebaa3c599d6c81d74c..dcd6b5a6a19abd7e36e407fe883bcecd8004537c 100644 (file)
@@ -1,3 +1,60 @@
+ 2006-04-19  Adele Peterson  <adele@apple.com>
+         Reviewed by Beth.
+         Fix to make readonly text fields have dimmed borders to match AppKit behavior.
+         Test: fast/forms/input-readonly-dimmed.html
+         * dom/Node.h: (WebCore::Node::isReadOnlyControl): Changed from const version of isReadOnly.
+         * dom/Node.cpp:
+         (WebCore::Node::isReadOnlyNode): Changed from isReadOnly.
+         (WebCore::Node::setNodeValue): Uses isReadOnlyNode instead of isReadOnly.
+         (WebCore::Node::checkSetPrefix): ditto.
+         (WebCore::Node::checkAddChild): ditto.
+         * dom/Attr.cpp: (WebCore::Attr::setValue): ditto.
+         * dom/CharacterData.cpp:
+         (WebCore::CharacterData::setData): ditto.
+         (WebCore::CharacterData::appendData): ditto.
+         (WebCore::CharacterData::checkCharDataOperation): ditto.
+         * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeChild): ditto.
+         * dom/Element.cpp: (WebCore::Element::setAttribute): ditto.
+         * dom/NamedAttrMap.cpp:
+         (WebCore::NamedAttrMap::setNamedItem): ditto.
+         (WebCore::NamedAttrMap::removeNamedItem): ditto.
+         * dom/NamedAttrMap.h: (WebCore::NamedAttrMap::isReadOnlyNode): ditto.
+         * dom/NamedNodeMap.h: (WebCore::NamedNodeMap::isReadOnlyNode): ditto.
+         * dom/Range.cpp:
+         (WebCore::Range::checkDeleteExtract): ditto.
+         (WebCore::Range::containedByReadOnly): ditto.
+         * dom/Text.cpp: (WebCore::Text::splitText): ditto.
+         * dom/dom_xmlimpl.cpp: (WebCore::ProcessingInstruction::setData): ditto.
+         * bindings/js/kjs_html.cpp:
+         (KJS::JSHTMLElement::inputGetter): Uses isReadOnlyControl instead of isReadOnly.
+         (KJS::JSHTMLElement::textAreaGetter): ditto.
+         * bindings/objc/DOMHTML.mm: (-[DOMHTMLInputElement readOnly]): ditto.
+         * rendering/render_form.cpp:
+         (WebCore::RenderLineEdit::updateFromElement): ditto.
+         (WebCore::RenderTextArea::updateFromElement): ditto.
+         * rendering/RenderTextField.cpp:
+         (WebCore::RenderTextField::createDivStyle): ditto.
+         (WebCore::RenderTextField::updateFromElement): ditto.
+         * html/HTMLGenericFormElement.cpp: (WebCore::HTMLGenericFormElement::parseMappedAttribute): 
+           When readonly attribute changes, update the theme so the control will repaint.
+         * html/HTMLGenericFormElement.h: (WebCore::HTMLGenericFormElement::isReadOnlyControl): Renamed from readOnly.
+         * html/HTMLInputElement.h: Removed isReadOnly, since isReadOnlyControl now exists on HTMLGenericFormElement.
+         * rendering/RenderTheme.cpp: (WebCore::RenderTheme::isReadOnlyControl): Renamed from isReadOnly.
+         * rendering/RenderTheme.h: (WebCore::): Added ReadOnlyState to ControlState enum.
+         * rendering/RenderThemeMac.h: Removed NSTextFieldCell since it was only being used to store the enabled state.
+           Removed setTextFieldState since it was updating the enabled state of the cell, which is only used in one place.
+         * rendering/RenderThemeMac.mm:
+         (WebCore::RenderThemeMac::RenderThemeMac): No longer initialized the NSTextFieldCell.
+         (WebCore::RenderThemeMac::adjustRepaintRect): No longer calls setTextFieldState.
+         (WebCore::RenderThemeMac::paintTextField): Uses the enabled state and the readonly state to determine whether to draw
+          a dimmed version of the aqua border.
 2006-04-19  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Hyatt.
index c394c02af646933e7a05860c0a7733026af9b878..560dbd9da2e2c09a3f0b74ce59254165517621a7 100644 (file)
@@ -1550,7 +1550,7 @@ JSValue *JSHTMLElement::inputGetter(ExecState* exec, int token) const
         case InputIndeterminate:   return jsBoolean(input.indeterminate());
         case InputMaxLength:       return jsNumber(input.maxLength());
         case InputName:            return jsString(input.name());
-        case InputReadOnly:        return jsBoolean(input.readOnly());
+        case InputReadOnly:        return jsBoolean(input.isReadOnlyControl());
         case InputSelectionStart:  return getInputSelectionStart(input);
         case InputSelectionEnd:    return getInputSelectionEnd(input);
         case InputSize:            return jsNumber(input.size());
@@ -1573,7 +1573,7 @@ JSValue *JSHTMLElement::textAreaGetter(ExecState* exec, int token) const
         case TextAreaCols:            return jsNumber(textarea.cols());
         case TextAreaDisabled:        return jsBoolean(textarea.disabled());
         case TextAreaName:            return jsString(textarea.name());
-        case TextAreaReadOnly:        return jsBoolean(textarea.readOnly());
+        case TextAreaReadOnly:        return jsBoolean(textarea.isReadOnlyControl());
         case TextAreaRows:            return jsNumber(textarea.rows());
         case TextAreaSelectionStart:  return jsNumber(textarea.selectionStart());
         case TextAreaSelectionEnd:    return jsNumber(textarea.selectionEnd());
index e3caaef64ff60ab9107ce1a0237941f18219b709..2b24e9b2b37990e1e359b22bef03e0c6e9ee97b3 100644 (file)
@@ -1337,7 +1337,7 @@ using namespace WebCore::HTMLNames;
 
 - (BOOL)readOnly
 {
-    return [self _inputElement]->readOnly();
+    return [self _inputElement]->isReadOnlyControl();
 }
 
 - (void)setReadOnly:(BOOL)readOnly
index a5fd49a7c5f570fdb3775d29812f8a8aa0930e24..e44ad01909c919cfc0e39f1efb15c8a5e0e5d2b9 100644 (file)
@@ -106,7 +106,7 @@ void Attr::setValue( const String& v, ExceptionCode& ec)
     // do not interprete entities in the string, its literal!
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
index 5b194b12f4ddc4eca89bb54961fccbd8b9c8879f..5359a523209e306804401641754b692c261f65cc 100644 (file)
@@ -61,7 +61,7 @@ String CharacterData::data() const
 void CharacterData::setData( const String &_data, ExceptionCode& ec)
 {
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
@@ -106,7 +106,7 @@ void CharacterData::appendData( const String &arg, ExceptionCode& ec)
     ec = 0;
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
@@ -267,7 +267,7 @@ void CharacterData::checkCharDataOperation( const unsigned offset, ExceptionCode
     }
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
index be1cf82aa3fedf8611f405ecec69236c08045556..b0297b4003867b67bd11c86849ab25d3e113df31 100644 (file)
@@ -347,7 +347,7 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
     ec = 0;
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return false;
     }
index dc01d58bef83c023aa8ca2af582305ab3a88bc71..dd858c17d2a90a098b427e8af6f27e2a299276b8 100644 (file)
@@ -316,7 +316,7 @@ void Element::setAttribute(const QualifiedName& name, StringImpl* value, Excepti
     Attribute* old = attributes(false)->getAttributeItem(name);
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
-    if (namedAttrMap->isReadOnly()) {
+    if (namedAttrMap->isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
index dd6680ceb5c1411dc3f0c67b5bea1203c69d84b8..38de52edb5032986a835496a2df743f971904414 100644 (file)
@@ -93,7 +93,7 @@ PassRefPtr<Node> NamedAttrMap::setNamedItem(Node* arg, ExceptionCode& ec)
     }
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return 0;
     }
@@ -144,7 +144,7 @@ PassRefPtr<Node> NamedAttrMap::removeNamedItem(const QualifiedName& name, Except
 {
     // ### should this really be raised when the attribute to remove isn't there at all?
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return 0;
     }
index fbd938cfa8c1179e259d3d6a144e907e782d6655..5739fdbd2796ee7306e3075051b2fbbca590834f 100644 (file)
@@ -63,7 +63,7 @@ public:
     // Other methods (not part of DOM)
     Attribute* attributeItem(unsigned index) const { return attrs ? attrs[index] : 0; }
     Attribute* getAttributeItem(const QualifiedName& name) const;
-    virtual bool isReadOnly() { return element ? element->isReadOnly() : false; }
+    virtual bool isReadOnlyNode() { return element ? element->isReadOnlyNode() : false; }
 
     // used during parsing: only inserts if not already there
     // no error checking!
index 08a859d7bef259dd98e09d5559ee441176bb2a59..a45bd05494caa40632f399032c069a0a55a445af 100644 (file)
@@ -60,7 +60,7 @@ public:
     virtual unsigned length() const = 0;
 
     // Other methods (not part of DOM)
-    virtual bool isReadOnly() { return false; }
+    virtual bool isReadOnlyNode() { return false; }
 };
 
 } //namespace
index 6902e50a1cd48a7c4bb934236c979824218c078e..bc2ba3eb010a45dbd0a5a38af4c5291a00075816 100644 (file)
@@ -160,7 +160,7 @@ String Node::nodeValue() const
 void Node::setNodeValue( const String &/*_nodeValue*/, ExceptionCode& ec)
 {
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
@@ -513,7 +513,7 @@ void Node::checkSetPrefix(const AtomicString &_prefix, ExceptionCode& ec)
     // FIXME: Implement support for INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
     
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
@@ -547,7 +547,7 @@ void Node::checkAddChild(Node *newChild, ExceptionCode& ec)
     }
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
@@ -742,7 +742,7 @@ void Node::childrenChanged()
 {
 }
 
-bool Node::isReadOnly()
+bool Node::isReadOnlyNode()
 {
     // Entity & Entity Reference nodes and their descendants are read-only
     Node *n = this;
index 029bc2430fedd6f433cd9c705abaf9d4b33e53d6..0ec6ad54ad76d4bc849a5d29d1f2d73bafcc1462 100644 (file)
@@ -238,7 +238,7 @@ public:
     virtual bool isEnabled() const { return true; }
     virtual bool isChecked() const { return false; }
     virtual bool isIndeterminate() const { return false; }
-    virtual bool isReadOnly() const { return false; }
+    virtual bool isReadOnlyControl() const { return false; }
 
     virtual bool isContentEditable() const;
     virtual bool isContentRichlyEditable() const;
@@ -271,7 +271,7 @@ public:
       return m_inDocument; 
     }
     
-    virtual bool isReadOnly();
+    virtual bool isReadOnlyNode();
     virtual bool childTypeAllowed(NodeType) { return false; }
     virtual unsigned childNodeCount() const;
     virtual Node* childNode(unsigned index) const;
index c1a0638998a572c7082deb3c62b873c61a676bc8..b030701d13ffebd44035a9fde075334f6dfbb681 100644 (file)
@@ -1202,7 +1202,7 @@ void Range::checkDeleteExtract(ExceptionCode& ec)
 {
     Node *pastEnd = pastEndNode();
     for (Node *n = startNode(); n != pastEnd; n = n->traverseNextNode()) {
-        if (n->isReadOnly()) {
+        if (n->isReadOnlyNode()) {
             ec = NO_MODIFICATION_ALLOWED_ERR;
             return;
         }
@@ -1222,11 +1222,11 @@ bool Range::containedByReadOnly() const
 {
     Node *n;
     for (n = m_startContainer.get(); n; n = n->parentNode()) {
-        if (n->isReadOnly())
+        if (n->isReadOnlyNode())
             return true;
     }
     for (n = m_endContainer.get(); n; n = n->parentNode()) {
-        if (n->isReadOnly())
+        if (n->isReadOnlyNode())
             return true;
     }
     return false;
index bd79b769680957f682b37c4c292020634798186c..ac2027d1a4f1515628516ef245ecc03b54cad6cd 100644 (file)
@@ -60,7 +60,7 @@ Text *Text::splitText(unsigned offset, ExceptionCode& ec)
     }
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return 0;
     }
index 6750b3c783221717210b7bab327ef732e7181c4a..2b23878b1a9d3e35a6c4e1b2acf1b4a9144cbb70 100644 (file)
@@ -233,7 +233,7 @@ ProcessingInstruction::~ProcessingInstruction()
 void ProcessingInstruction::setData(const String& data, ExceptionCode& ec)
 {
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
-    if (isReadOnly()) {
+    if (isReadOnlyNode()) {
         ec = NO_MODIFICATION_ALLOWED_ERR;
         return;
     }
index 7da101e4c4ec3c84d713b83d0d78e302c5306e21..3710e6aa7db3b739cba7b31af771dec070d73944 100644 (file)
@@ -70,7 +70,11 @@ void HTMLGenericFormElement::parseMappedAttribute(MappedAttribute *attr)
     } else if (attr->name() == readonlyAttr) {
         bool oldReadOnly = m_readOnly;
         m_readOnly = !attr->isNull();
-        if (oldReadOnly != m_readOnly) setChanged();
+        if (oldReadOnly != m_readOnly) {
+            setChanged();
+            if (renderer() && renderer()->style()->hasAppearance())
+                theme()->stateChanged(renderer(), ReadOnlyState);
+        }
     } else
         HTMLElement::parseMappedAttribute(attr);
 }
index 31e3456308e270b1c1588b109a3a9e76223076ad..ad0ca2aa62fd9f24b98c8e754c47b99ac1cb707a 100644 (file)
@@ -73,7 +73,7 @@ public:
     virtual bool isMouseFocusable() const;
     virtual bool isEnumeratable() const { return false; }
 
-    bool readOnly() const { return m_readOnly; }
+    virtual bool isReadOnlyControl() const { return m_readOnly; }
     void setReadOnly(bool _readOnly);
 
     virtual void recalcStyle( StyleChange );
index 34a7c84548b5c65d86228bc5c9c01dc2ffd7d6d8..f038857a0ec42ca80cd8306c4f63f3e14e449097 100644 (file)
@@ -71,7 +71,6 @@ public:
 
     virtual bool isChecked() const { return checked(); }
     virtual bool isIndeterminate() const { return indeterminate(); }
-    virtual bool isReadOnly() const { return readOnly(); }
 
     bool isTextButton() const { return m_type == SUBMIT || m_type == RESET || m_type == BUTTON; }
     virtual bool isRadioButton() const { return m_type == RADIO; }
index f861480ac512a169990e18537e4926c9aeed48e2..f9057eac27f29ca45e9726cb62357115677ea713 100644 (file)
@@ -74,7 +74,7 @@ RenderStyle* RenderTextField::createDivStyle(RenderStyle* startStyle)
     divStyle->setOverflow(OHIDDEN);
     divStyle->setWhiteSpace(PRE);
 
-    divStyle->setUserModify(input->readOnly() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
+    divStyle->setUserModify(input->isReadOnlyControl() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
 
     // We're adding this extra pixel of padding to match WinIE.
     divStyle->setPaddingLeft(Length(1, Fixed));
@@ -112,7 +112,7 @@ void RenderTextField::updateFromElement()
         }
 
         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
-        m_div->renderer()->style()->setUserModify(input->readOnly() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
+        m_div->renderer()->style()->setUserModify(input->isReadOnlyControl() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
         
         if (!input->valueMatchesRenderer()) {
             String oldText = text();
index 9b1088b5eca30608b73a2e1d3dd3d071881dfd8b..000fc083368ae70ba9fb1ddb285947fdee07ad93 100644 (file)
@@ -202,11 +202,11 @@ bool RenderTheme::isPressed(const RenderObject* o) const
     return o->element()->active();
 }
 
-bool RenderTheme::isReadOnly(const RenderObject* o) const
+bool RenderTheme::isReadOnlyControl(const RenderObject* o) const
 {
     if (!o->element())
         return false;
-    return o->element()->isReadOnly();
+    return o->element()->isReadOnlyControl();
 }
 
 bool RenderTheme::isHovered(const RenderObject* o) const
index df91ba26dd6b308f4bdbcf550ee1748fb65727af..8c9780ce0b6a223a96f73eabfd1591c70d4cedab 100644 (file)
@@ -28,7 +28,7 @@
 namespace WebCore {
 
 class Element;
-enum ControlState { HoverState, PressedState, FocusState, EnabledState, CheckedState };
+enum ControlState { HoverState, PressedState, FocusState, EnabledState, CheckedState, ReadOnlyState };
 
 class RenderTheme {
 public:
@@ -96,7 +96,7 @@ protected:
     bool isFocused(const RenderObject* o) const;
     bool isPressed(const RenderObject* o) const;
     bool isHovered(const RenderObject* o) const;
-    bool isReadOnly(const RenderObject* o) const;
+    bool isReadOnlyControl(const RenderObject* o) const;
 
     // Methods for each appearance value.
     virtual void adjustCheckboxStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const;
index fe1aa1673f5a48fac8675b8aedf9d82b501af217..4f87f03079ea1583ffbfd65e8def4b005169558a 100644 (file)
@@ -96,13 +96,10 @@ private:
     const int* buttonMargins() const;
     void setButtonCellState(const RenderObject* o, const IntRect& r);
 
-    void setTextFieldCellState(const RenderObject* o, const IntRect& r);
-
 private:
     NSButtonCell* checkbox;
     NSButtonCell* radio;
     NSButtonCell* button;
-    NSTextFieldCell* textField;
 };
 
 }
index 6ea9f4722e4af8b7341acbec162fb3f03a5dc4d0..0efeb25bdadf894af8fcdb0095fce238226b6040 100644 (file)
@@ -50,7 +50,6 @@ RenderThemeMac::RenderThemeMac()
     : checkbox(nil)
     , radio(nil)
     , button(nil)
-    , textField(nil)
 {
 }
 
@@ -94,10 +93,6 @@ void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r)
                 r = inflateRect(r, buttonSizes()[[button controlSize]], buttonMargins());
             break;
         }
-        case TextFieldAppearance:
-            // Since we query the prototype cell, we need to update its state to match.
-            setTextFieldCellState(o, r);
-            break;
         default:
             break;
     }
@@ -526,23 +521,12 @@ bool RenderThemeMac::paintButton(RenderObject* o, const RenderObject::PaintInfo&
 
 bool RenderThemeMac::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
 {
-    // Initialize text field and update state.
-    setTextFieldCellState(o, r);
-    
-    [[WebCoreGraphicsBridge sharedBridge] drawBezeledTextFieldCell:NSRect(r) enabled:[textField isEnabled]];
-
-    [textField setControlView: nil];
+    bool enabled = isEnabled(o) && !isReadOnlyControl(o);
+    [[WebCoreGraphicsBridge sharedBridge] drawBezeledTextFieldCell:NSRect(r) enabled:enabled];
     
     return false;
 }
 
-void RenderThemeMac::setTextFieldCellState(const RenderObject* o, const IntRect& r)
-{
-    if (!textField)
-        textField = KWQRetainNSRelease([[NSTextFieldCell alloc] initTextCell:@""]);
-    updateEnabledState(textField, o);
-}
-
 void RenderThemeMac::adjustTextFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
 {
     // Add in intrinsic margins if the font size isn't too small
index 2b6d26ebda8a0334761e32cae0542870bda4f03b..bd418ccb3fa552bbb62827f81488cb30ca4333ef 100644 (file)
@@ -271,7 +271,7 @@ void RenderLineEdit::updateFromElement()
         e->setValueMatchesRenderer();
     }
 
-    w->setReadOnly(e->readOnly());
+    w->setReadOnly(e->isReadOnlyControl());
     
     // Handle updating the search attributes.
     w->setPlaceholderString(e->getAttribute(placeholderAttr).deprecatedString());
@@ -986,7 +986,7 @@ void RenderTextArea::updateFromElement()
     HTMLTextAreaElement *e = element();
     QTextEdit* w = static_cast<QTextEdit*>(m_widget);
 
-    w->setReadOnly(e->readOnly());
+    w->setReadOnly(e->isReadOnlyControl());
     w->setDisabled(e->disabled());
 
     String widgetText = text();