| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/page/ValidationMessageClient.h" | 42 #include "core/page/ValidationMessageClient.h" |
| 43 #include "platform/text/BidiTextRun.h" | 43 #include "platform/text/BidiTextRun.h" |
| 44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 using namespace HTMLNames; | 48 using namespace HTMLNames; |
| 49 | 49 |
| 50 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) | 50 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) |
| 51 : LabelableElement(tagName, document) | 51 : LabelableElement(tagName, document) |
| 52 , m_disabled(false) | |
| 53 , m_isAutofilled(false) | 52 , m_isAutofilled(false) |
| 54 , m_isReadOnly(false) | |
| 55 , m_isRequired(false) | |
| 56 , m_hasValidationMessage(false) | 53 , m_hasValidationMessage(false) |
| 57 , m_ancestorDisabledState(AncestorDisabledStateUnknown) | 54 , m_ancestorDisabledState(AncestorDisabledStateUnknown) |
| 58 , m_dataListAncestorState(Unknown) | 55 , m_dataListAncestorState(Unknown) |
| 59 , m_willValidateInitialized(false) | 56 , m_willValidateInitialized(false) |
| 60 , m_willValidate(true) | 57 , m_willValidate(true) |
| 61 , m_isValid(true) | 58 , m_isValid(true) |
| 62 , m_validityIsDirty(false) | 59 , m_validityIsDirty(false) |
| 63 , m_wasChangedSinceLastFormControlChangeEvent(false) | 60 , m_wasChangedSinceLastFormControlChangeEvent(false) |
| 64 , m_wasFocusedByMouse(false) | 61 , m_wasFocusedByMouse(false) |
| 65 { | 62 { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 setAutofilled(false); | 153 setAutofilled(false); |
| 157 resetImpl(); | 154 resetImpl(); |
| 158 } | 155 } |
| 159 | 156 |
| 160 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
micString& oldValue, const AtomicString& value) | 157 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
micString& oldValue, const AtomicString& value) |
| 161 { | 158 { |
| 162 if (name == formAttr) { | 159 if (name == formAttr) { |
| 163 formAttributeChanged(); | 160 formAttributeChanged(); |
| 164 UseCounter::count(document(), UseCounter::FormAttribute); | 161 UseCounter::count(document(), UseCounter::FormAttribute); |
| 165 } else if (name == disabledAttr) { | 162 } else if (name == disabledAttr) { |
| 166 bool oldDisabled = m_disabled; | 163 if (oldValue.isNull() != value.isNull()) |
| 167 m_disabled = !value.isNull(); | |
| 168 if (oldDisabled != m_disabled) | |
| 169 disabledAttributeChanged(); | 164 disabledAttributeChanged(); |
| 170 } else if (name == readonlyAttr) { | 165 } else if (name == readonlyAttr) { |
| 171 bool wasReadOnly = m_isReadOnly; | 166 if (oldValue.isNull() != value.isNull()) { |
| 172 m_isReadOnly = !value.isNull(); | |
| 173 if (wasReadOnly != m_isReadOnly) { | |
| 174 setNeedsWillValidateCheck(); | 167 setNeedsWillValidateCheck(); |
| 175 pseudoStateChanged(CSSSelector::PseudoReadOnly); | 168 pseudoStateChanged(CSSSelector::PseudoReadOnly); |
| 176 pseudoStateChanged(CSSSelector::PseudoReadWrite); | 169 pseudoStateChanged(CSSSelector::PseudoReadWrite); |
| 177 if (layoutObject()) | 170 if (layoutObject()) |
| 178 LayoutTheme::theme().controlStateChanged(*layoutObject(), ReadOn
lyControlState); | 171 LayoutTheme::theme().controlStateChanged(*layoutObject(), ReadOn
lyControlState); |
| 179 } | 172 } |
| 180 } else if (name == requiredAttr) { | 173 } else if (name == requiredAttr) { |
| 181 bool wasRequired = m_isRequired; | 174 if (oldValue.isNull() != value.isNull()) |
| 182 m_isRequired = !value.isNull(); | |
| 183 if (wasRequired != m_isRequired) | |
| 184 requiredAttributeChanged(); | 175 requiredAttributeChanged(); |
| 185 UseCounter::count(document(), UseCounter::RequiredAttribute); | 176 UseCounter::count(document(), UseCounter::RequiredAttribute); |
| 186 } else if (name == autofocusAttr) { | 177 } else if (name == autofocusAttr) { |
| 187 HTMLElement::parseAttribute(name, oldValue, value); | 178 HTMLElement::parseAttribute(name, oldValue, value); |
| 188 UseCounter::count(document(), UseCounter::AutoFocusAttribute); | 179 UseCounter::count(document(), UseCounter::AutoFocusAttribute); |
| 189 } else { | 180 } else { |
| 190 HTMLElement::parseAttribute(name, oldValue, value); | 181 HTMLElement::parseAttribute(name, oldValue, value); |
| 191 } | 182 } |
| 192 } | 183 } |
| 193 | 184 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 HTMLElement::dispatchInputEvent(); | 340 HTMLElement::dispatchInputEvent(); |
| 350 } | 341 } |
| 351 | 342 |
| 352 HTMLFormElement* HTMLFormControlElement::formOwner() const | 343 HTMLFormElement* HTMLFormControlElement::formOwner() const |
| 353 { | 344 { |
| 354 return FormAssociatedElement::form(); | 345 return FormAssociatedElement::form(); |
| 355 } | 346 } |
| 356 | 347 |
| 357 bool HTMLFormControlElement::isDisabledFormControl() const | 348 bool HTMLFormControlElement::isDisabledFormControl() const |
| 358 { | 349 { |
| 359 if (m_disabled) | 350 if (fastHasAttribute(disabledAttr)) |
| 360 return true; | 351 return true; |
| 361 | 352 |
| 362 if (m_ancestorDisabledState == AncestorDisabledStateUnknown) | 353 if (m_ancestorDisabledState == AncestorDisabledStateUnknown) |
| 363 updateAncestorDisabledState(); | 354 updateAncestorDisabledState(); |
| 364 return m_ancestorDisabledState == AncestorDisabledStateDisabled; | 355 return m_ancestorDisabledState == AncestorDisabledStateDisabled; |
| 365 } | 356 } |
| 366 | 357 |
| 367 bool HTMLFormControlElement::isRequired() const | 358 bool HTMLFormControlElement::isRequired() const |
| 368 { | 359 { |
| 369 return m_isRequired; | 360 return fastHasAttribute(requiredAttr); |
| 370 } | 361 } |
| 371 | 362 |
| 372 String HTMLFormControlElement::resultForDialogSubmit() | 363 String HTMLFormControlElement::resultForDialogSubmit() |
| 373 { | 364 { |
| 374 return fastGetAttribute(valueAttr); | 365 return fastGetAttribute(valueAttr); |
| 375 } | 366 } |
| 376 | 367 |
| 377 void HTMLFormControlElement::didRecalcStyle(StyleRecalcChange) | 368 void HTMLFormControlElement::didRecalcStyle(StyleRecalcChange) |
| 378 { | 369 { |
| 379 if (LayoutObject* layoutObject = this->layoutObject()) | 370 if (LayoutObject* layoutObject = this->layoutObject()) |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 dispatchFormControlChangeEvent(); | 654 dispatchFormControlChangeEvent(); |
| 664 } | 655 } |
| 665 | 656 |
| 666 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element
& source) | 657 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element
& source) |
| 667 { | 658 { |
| 668 HTMLElement::copyNonAttributePropertiesFromElement(source); | 659 HTMLElement::copyNonAttributePropertiesFromElement(source); |
| 669 setNeedsValidityCheck(); | 660 setNeedsValidityCheck(); |
| 670 } | 661 } |
| 671 | 662 |
| 672 } // namespace blink | 663 } // namespace blink |
| OLD | NEW |