| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe
rNode* insertionPoint) | 271 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe
rNode* insertionPoint) |
| 272 { | 272 { |
| 273 m_ancestorDisabledState = AncestorDisabledStateUnknown; | 273 m_ancestorDisabledState = AncestorDisabledStateUnknown; |
| 274 m_dataListAncestorState = Unknown; | 274 m_dataListAncestorState = Unknown; |
| 275 setNeedsWillValidateCheck(); | 275 setNeedsWillValidateCheck(); |
| 276 HTMLElement::insertedInto(insertionPoint); | 276 HTMLElement::insertedInto(insertionPoint); |
| 277 FormAssociatedElement::insertedInto(insertionPoint); | 277 FormAssociatedElement::insertedInto(insertionPoint); |
| 278 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); | 278 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); |
| 279 | 279 |
| 280 // Trigger for elements outside of forms. | 280 // Trigger for elements outside of forms. |
| 281 if (!formOwner() && insertionPoint->inDocument()) | 281 if (!formOwner() && insertionPoint->inShadowIncludingDocument()) |
| 282 document().didAssociateFormControl(this); | 282 document().didAssociateFormControl(this); |
| 283 | 283 |
| 284 return InsertionDone; | 284 return InsertionDone; |
| 285 } | 285 } |
| 286 | 286 |
| 287 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) | 287 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) |
| 288 { | 288 { |
| 289 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); | 289 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); |
| 290 hideVisibleValidationMessage(); | 290 hideVisibleValidationMessage(); |
| 291 m_hasValidationMessage = false; | 291 m_hasValidationMessage = false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 302 FormAssociatedElement::willChangeForm(); | 302 FormAssociatedElement::willChangeForm(); |
| 303 formOwnerSetNeedsValidityCheck(); | 303 formOwnerSetNeedsValidityCheck(); |
| 304 if (formOwner() && canBeSuccessfulSubmitButton()) | 304 if (formOwner() && canBeSuccessfulSubmitButton()) |
| 305 formOwner()->invalidateDefaultButtonStyle(); | 305 formOwner()->invalidateDefaultButtonStyle(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void HTMLFormControlElement::didChangeForm() | 308 void HTMLFormControlElement::didChangeForm() |
| 309 { | 309 { |
| 310 FormAssociatedElement::didChangeForm(); | 310 FormAssociatedElement::didChangeForm(); |
| 311 formOwnerSetNeedsValidityCheck(); | 311 formOwnerSetNeedsValidityCheck(); |
| 312 if (formOwner() && inDocument() && canBeSuccessfulSubmitButton()) | 312 if (formOwner() && inShadowIncludingDocument() && canBeSuccessfulSubmitButto
n()) |
| 313 formOwner()->invalidateDefaultButtonStyle(); | 313 formOwner()->invalidateDefaultButtonStyle(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() | 316 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() |
| 317 { | 317 { |
| 318 if (HTMLFormElement* form = formOwner()) { | 318 if (HTMLFormElement* form = formOwner()) { |
| 319 form->pseudoStateChanged(CSSSelector::PseudoValid); | 319 form->pseudoStateChanged(CSSSelector::PseudoValid); |
| 320 form->pseudoStateChanged(CSSSelector::PseudoInvalid); | 320 form->pseudoStateChanged(CSSSelector::PseudoInvalid); |
| 321 } | 321 } |
| 322 } | 322 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem
ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior) | 537 bool HTMLFormControlElement::checkValidity(HeapVector<Member<HTMLFormControlElem
ent>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior) |
| 538 { | 538 { |
| 539 if (isValidElement()) | 539 if (isValidElement()) |
| 540 return true; | 540 return true; |
| 541 if (eventBehavior != CheckValidityDispatchInvalidEvent) | 541 if (eventBehavior != CheckValidityDispatchInvalidEvent) |
| 542 return false; | 542 return false; |
| 543 // An event handler can deref this object. | 543 // An event handler can deref this object. |
| 544 RawPtr<HTMLFormControlElement> protector(this); | 544 RawPtr<HTMLFormControlElement> protector(this); |
| 545 RawPtr<Document> originalDocument(document()); | 545 RawPtr<Document> originalDocument(document()); |
| 546 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E
ventTypeNames::invalid)); | 546 DispatchEventResult dispatchResult = dispatchEvent(Event::createCancelable(E
ventTypeNames::invalid)); |
| 547 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo
ntrols && inDocument() && originalDocument == document()) | 547 if (dispatchResult == DispatchEventResult::NotCanceled && unhandledInvalidCo
ntrols && inShadowIncludingDocument() && originalDocument == document()) |
| 548 unhandledInvalidControls->append(this); | 548 unhandledInvalidControls->append(this); |
| 549 return false; | 549 return false; |
| 550 } | 550 } |
| 551 | 551 |
| 552 void HTMLFormControlElement::showValidationMessage() | 552 void HTMLFormControlElement::showValidationMessage() |
| 553 { | 553 { |
| 554 scrollIntoViewIfNeeded(false); | 554 scrollIntoViewIfNeeded(false); |
| 555 RawPtr<HTMLFormControlElement> protector(this); | 555 RawPtr<HTMLFormControlElement> protector(this); |
| 556 focus(); | 556 focus(); |
| 557 updateVisibleValidationMessage(); | 557 updateVisibleValidationMessage(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 dispatchFormControlChangeEvent(); | 661 dispatchFormControlChangeEvent(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element
& source) | 664 void HTMLFormControlElement::copyNonAttributePropertiesFromElement(const Element
& source) |
| 665 { | 665 { |
| 666 HTMLElement::copyNonAttributePropertiesFromElement(source); | 666 HTMLElement::copyNonAttributePropertiesFromElement(source); |
| 667 setNeedsValidityCheck(); | 667 setNeedsValidityCheck(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 } // namespace blink | 670 } // namespace blink |
| OLD | NEW |