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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (isDisabledFormControl() && treeScope().adjustedFocusedElement() == this)
{ | 178 if (isDisabledFormControl() && treeScope().adjustedFocusedElement() == this)
{ |
179 // We might want to call blur(), but it's dangerous to dispatch events | 179 // We might want to call blur(), but it's dangerous to dispatch events |
180 // here. | 180 // here. |
181 document().setNeedsFocusedElementCheck(); | 181 document().setNeedsFocusedElementCheck(); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 void HTMLFormControlElement::requiredAttributeChanged() | 185 void HTMLFormControlElement::requiredAttributeChanged() |
186 { | 186 { |
187 setNeedsValidityCheck(); | 187 setNeedsValidityCheck(); |
188 // Style recalculation is needed because style selectors may include | 188 pseudoStateChanged(CSSSelector::PseudoRequired); |
189 // :required and :optional pseudo-classes. | 189 pseudoStateChanged(CSSSelector::PseudoOptional); |
190 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAtt
ribute(requiredAttr)); | |
191 } | 190 } |
192 | 191 |
193 bool HTMLFormControlElement::supportsAutofocus() const | 192 bool HTMLFormControlElement::supportsAutofocus() const |
194 { | 193 { |
195 return false; | 194 return false; |
196 } | 195 } |
197 | 196 |
198 bool HTMLFormControlElement::isAutofocusable() const | 197 bool HTMLFormControlElement::isAutofocusable() const |
199 { | 198 { |
200 return fastHasAttribute(autofocusAttr) && supportsAutofocus(); | 199 return fastHasAttribute(autofocusAttr) && supportsAutofocus(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 ASSERT(m_isValid == valid()); | 510 ASSERT(m_isValid == valid()); |
512 return m_isValid; | 511 return m_isValid; |
513 } | 512 } |
514 | 513 |
515 void HTMLFormControlElement::setNeedsValidityCheck() | 514 void HTMLFormControlElement::setNeedsValidityCheck() |
516 { | 515 { |
517 bool newIsValid = valid(); | 516 bool newIsValid = valid(); |
518 if (willValidate() && newIsValid != m_isValid) { | 517 if (willValidate() && newIsValid != m_isValid) { |
519 formOwnerSetNeedsValidityCheck(); | 518 formOwnerSetNeedsValidityCheck(); |
520 // Update style for pseudo classes such as :valid :invalid. | 519 // Update style for pseudo classes such as :valid :invalid. |
521 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid))
; | 520 pseudoStateChanged(CSSSelector::PseudoValid); |
| 521 pseudoStateChanged(CSSSelector::PseudoInvalid); |
522 } | 522 } |
523 m_isValid = newIsValid; | 523 m_isValid = newIsValid; |
524 | 524 |
525 // Updates only if this control already has a validation message. | 525 // Updates only if this control already has a validation message. |
526 if (isValidationMessageVisible()) { | 526 if (isValidationMessageVisible()) { |
527 // Calls updateVisibleValidationMessage() even if m_isValid is not | 527 // Calls updateVisibleValidationMessage() even if m_isValid is not |
528 // changed because a validation message can be changed. | 528 // changed because a validation message can be changed. |
529 updateVisibleValidationMessage(); | 529 updateVisibleValidationMessage(); |
530 } | 530 } |
531 } | 531 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 void HTMLFormControlElement::setFocus(bool flag) | 573 void HTMLFormControlElement::setFocus(bool flag) |
574 { | 574 { |
575 LabelableElement::setFocus(flag); | 575 LabelableElement::setFocus(flag); |
576 | 576 |
577 if (!flag && wasChangedSinceLastFormControlChangeEvent()) | 577 if (!flag && wasChangedSinceLastFormControlChangeEvent()) |
578 dispatchFormControlChangeEvent(); | 578 dispatchFormControlChangeEvent(); |
579 } | 579 } |
580 | 580 |
581 } // namespace blink | 581 } // namespace blink |
OLD | NEW |