| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if (!client) | 483 if (!client) |
| 484 return false; | 484 return false; |
| 485 | 485 |
| 486 return client->isValidationMessageVisible(*this); | 486 return client->isValidationMessageVisible(*this); |
| 487 } | 487 } |
| 488 | 488 |
| 489 ValidationMessageClient* HTMLFormControlElement::validationMessageClient() const | 489 ValidationMessageClient* HTMLFormControlElement::validationMessageClient() const |
| 490 { | 490 { |
| 491 Page* page = document().page(); | 491 Page* page = document().page(); |
| 492 if (!page) | 492 if (!page) |
| 493 return 0; | 493 return nullptr; |
| 494 | 494 |
| 495 return &page->validationMessageClient(); | 495 return &page->validationMessageClient(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<H
TMLFormControlElement> >* unhandledInvalidControls, CheckValidityEventBehavior e
ventBehavior) | 498 bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<H
TMLFormControlElement>>* unhandledInvalidControls, CheckValidityEventBehavior ev
entBehavior) |
| 499 { | 499 { |
| 500 if (!willValidate() || isValidElement()) | 500 if (!willValidate() || isValidElement()) |
| 501 return true; | 501 return true; |
| 502 if (eventBehavior != CheckValidityDispatchInvalidEvent) | 502 if (eventBehavior != CheckValidityDispatchInvalidEvent) |
| 503 return false; | 503 return false; |
| 504 // An event handler can deref this object. | 504 // An event handler can deref this object. |
| 505 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); | 505 RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); |
| 506 RefPtrWillBeRawPtr<Document> originalDocument(document()); | 506 RefPtrWillBeRawPtr<Document> originalDocument(document()); |
| 507 bool needsDefaultAction = dispatchEvent(Event::createCancelable(EventTypeNam
es::invalid)); | 507 bool needsDefaultAction = dispatchEvent(Event::createCancelable(EventTypeNam
es::invalid)); |
| 508 if (needsDefaultAction && unhandledInvalidControls && inDocument() && origin
alDocument == document()) | 508 if (needsDefaultAction && unhandledInvalidControls && inDocument() && origin
alDocument == document()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 592 } |
| 593 | 593 |
| 594 bool HTMLFormControlElement::isDefaultButtonForForm() const | 594 bool HTMLFormControlElement::isDefaultButtonForForm() const |
| 595 { | 595 { |
| 596 return isSuccessfulSubmitButton() && form() && form()->defaultButton() == th
is; | 596 return isSuccessfulSubmitButton() && form() && form()->defaultButton() == th
is; |
| 597 } | 597 } |
| 598 | 598 |
| 599 HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node
* node) | 599 HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node
* node) |
| 600 { | 600 { |
| 601 if (!node) | 601 if (!node) |
| 602 return 0; | 602 return nullptr; |
| 603 return Traversal<HTMLFormControlElement>::firstAncestorOrSelf(*node); | 603 return Traversal<HTMLFormControlElement>::firstAncestorOrSelf(*node); |
| 604 } | 604 } |
| 605 | 605 |
| 606 String HTMLFormControlElement::nameForAutofill() const | 606 String HTMLFormControlElement::nameForAutofill() const |
| 607 { | 607 { |
| 608 String fullName = name(); | 608 String fullName = name(); |
| 609 String trimmedName = fullName.stripWhiteSpace(); | 609 String trimmedName = fullName.stripWhiteSpace(); |
| 610 if (!trimmedName.isEmpty()) | 610 if (!trimmedName.isEmpty()) |
| 611 return trimmedName; | 611 return trimmedName; |
| 612 fullName = getIdAttribute(); | 612 fullName = getIdAttribute(); |
| 613 trimmedName = fullName.stripWhiteSpace(); | 613 trimmedName = fullName.stripWhiteSpace(); |
| 614 return trimmedName; | 614 return trimmedName; |
| 615 } | 615 } |
| 616 | 616 |
| 617 void HTMLFormControlElement::setFocus(bool flag) | 617 void HTMLFormControlElement::setFocus(bool flag) |
| 618 { | 618 { |
| 619 LabelableElement::setFocus(flag); | 619 LabelableElement::setFocus(flag); |
| 620 | 620 |
| 621 if (!flag && wasChangedSinceLastFormControlChangeEvent()) | 621 if (!flag && wasChangedSinceLastFormControlChangeEvent()) |
| 622 dispatchFormControlChangeEvent(); | 622 dispatchFormControlChangeEvent(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 } // namespace blink | 625 } // namespace blink |
| OLD | NEW |