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, 2008, 2009 Apple Inc. All rights | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 void HTMLFormElement::getNamedElements( | 736 void HTMLFormElement::getNamedElements( |
737 const AtomicString& name, | 737 const AtomicString& name, |
738 HeapVector<Member<Element>>& namedItems) { | 738 HeapVector<Member<Element>>& namedItems) { |
739 // http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-
form-nameditem | 739 // http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-
form-nameditem |
740 elements()->namedItems(name, namedItems); | 740 elements()->namedItems(name, namedItems); |
741 | 741 |
742 Element* elementFromPast = elementFromPastNamesMap(name); | 742 Element* elementFromPast = elementFromPastNamesMap(name); |
743 if (namedItems.size() && namedItems.first() != elementFromPast) { | 743 if (namedItems.size() && namedItems.front() != elementFromPast) { |
744 addToPastNamesMap(namedItems.first().get(), name); | 744 addToPastNamesMap(namedItems.front().get(), name); |
745 } else if (elementFromPast && namedItems.isEmpty()) { | 745 } else if (elementFromPast && namedItems.isEmpty()) { |
746 namedItems.append(elementFromPast); | 746 namedItems.append(elementFromPast); |
747 UseCounter::count(document(), UseCounter::FormNameAccessForPastNamesMap); | 747 UseCounter::count(document(), UseCounter::FormNameAccessForPastNamesMap); |
748 } | 748 } |
749 } | 749 } |
750 | 750 |
751 bool HTMLFormElement::shouldAutocomplete() const { | 751 bool HTMLFormElement::shouldAutocomplete() const { |
752 return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); | 752 return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); |
753 } | 753 } |
754 | 754 |
(...skipping 22 matching lines...) Expand all Loading... |
777 return; | 777 return; |
778 } | 778 } |
779 | 779 |
780 // Second call may return different results from the first call, | 780 // Second call may return different results from the first call, |
781 // but if the first the size cannot be zero. | 781 // but if the first the size cannot be zero. |
782 HeapVector<Member<Element>> elements; | 782 HeapVector<Member<Element>> elements; |
783 getNamedElements(name, elements); | 783 getNamedElements(name, elements); |
784 DCHECK(!elements.isEmpty()); | 784 DCHECK(!elements.isEmpty()); |
785 | 785 |
786 bool onlyMatchImg = | 786 bool onlyMatchImg = |
787 !elements.isEmpty() && isHTMLImageElement(*elements.first()); | 787 !elements.isEmpty() && isHTMLImageElement(*elements.front()); |
788 if (onlyMatchImg) { | 788 if (onlyMatchImg) { |
789 UseCounter::count(document(), UseCounter::FormNameAccessForImageElement); | 789 UseCounter::count(document(), UseCounter::FormNameAccessForImageElement); |
790 // The following code has performance impact, but it should be small | 790 // The following code has performance impact, but it should be small |
791 // because <img> access via <form> name getter is rarely used. | 791 // because <img> access via <form> name getter is rarely used. |
792 for (auto& element : elements) { | 792 for (auto& element : elements) { |
793 if (isHTMLImageElement(*element) && !element->isDescendantOf(this)) { | 793 if (isHTMLImageElement(*element) && !element->isDescendantOf(this)) { |
794 UseCounter::count( | 794 UseCounter::count( |
795 document(), UseCounter::FormNameAccessForNonDescendantImageElement); | 795 document(), UseCounter::FormNameAccessForNonDescendantImageElement); |
796 break; | 796 break; |
797 } | 797 } |
(...skipping 17 matching lines...) Expand all Loading... |
815 for (const auto& control : associatedElements()) { | 815 for (const auto& control : associatedElements()) { |
816 if (!control->isFormControlElement()) | 816 if (!control->isFormControlElement()) |
817 continue; | 817 continue; |
818 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) | 818 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
819 toHTMLFormControlElement(control)->pseudoStateChanged( | 819 toHTMLFormControlElement(control)->pseudoStateChanged( |
820 CSSSelector::PseudoDefault); | 820 CSSSelector::PseudoDefault); |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 } // namespace blink | 824 } // namespace blink |
OLD | NEW |