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 reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 605 } |
606 | 606 |
607 PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> HTMLFormElement::elements() | 607 PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> HTMLFormElement::elements() |
608 { | 608 { |
609 return ensureCachedCollection<HTMLFormControlsCollection>(FormControls); | 609 return ensureCachedCollection<HTMLFormControlsCollection>(FormControls); |
610 } | 610 } |
611 | 611 |
612 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen
t::List& elements) const | 612 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen
t::List& elements) const |
613 { | 613 { |
614 elements.clear(); | 614 elements.clear(); |
615 for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(root); eleme
nt; element = Traversal<HTMLElement>::next(*element)) { | 615 for (HTMLElement& element : Traversal<HTMLElement>::from(root)) { |
616 FormAssociatedElement* associatedElement = 0; | 616 FormAssociatedElement* associatedElement = 0; |
617 if (element->isFormControlElement()) | 617 if (element.isFormControlElement()) |
618 associatedElement = toHTMLFormControlElement(element); | 618 associatedElement = toHTMLFormControlElement(&element); |
619 else if (isHTMLObjectElement(*element)) | 619 else if (isHTMLObjectElement(element)) |
620 associatedElement = toHTMLObjectElement(element); | 620 associatedElement = toHTMLObjectElement(&element); |
621 else | 621 else |
622 continue; | 622 continue; |
623 if (associatedElement->form()== this) | 623 if (associatedElement->form()== this) |
624 elements.append(associatedElement); | 624 elements.append(associatedElement); |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 // This function should be const conceptually. However we update some fields | 628 // This function should be const conceptually. However we update some fields |
629 // because of lazy evaluation. | 629 // because of lazy evaluation. |
630 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const | 630 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const |
631 { | 631 { |
632 if (!m_associatedElementsAreDirty) | 632 if (!m_associatedElementsAreDirty) |
633 return m_associatedElements; | 633 return m_associatedElements; |
634 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); | 634 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); |
635 Node* scope = mutableThis; | 635 Node* scope = mutableThis; |
636 if (m_hasElementsAssociatedByParser) | 636 if (m_hasElementsAssociatedByParser) |
637 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); | 637 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); |
638 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) | 638 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) |
639 scope = &treeScope().rootNode(); | 639 scope = &treeScope().rootNode(); |
640 ASSERT(scope); | 640 ASSERT(scope); |
641 collectAssociatedElements(*scope, mutableThis->m_associatedElements); | 641 collectAssociatedElements(*scope, mutableThis->m_associatedElements); |
642 mutableThis->m_associatedElementsAreDirty = false; | 642 mutableThis->m_associatedElementsAreDirty = false; |
643 return m_associatedElements; | 643 return m_associatedElements; |
644 } | 644 } |
645 | 645 |
646 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) | 646 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) |
647 { | 647 { |
648 elements.clear(); | 648 elements.clear(); |
649 for (HTMLImageElement* image = Traversal<HTMLImageElement>::firstWithin(root
); image; image = Traversal<HTMLImageElement>::next(*image)) { | 649 for (HTMLImageElement& image : Traversal<HTMLImageElement>::from(root)) { |
650 if (image->formOwner() == this) | 650 if (image.formOwner() == this) |
651 elements.append(image); | 651 elements.append(&image); |
652 } | 652 } |
653 } | 653 } |
654 | 654 |
655 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() | 655 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() |
656 { | 656 { |
657 if (!m_imageElementsAreDirty) | 657 if (!m_imageElementsAreDirty) |
658 return m_imageElements; | 658 return m_imageElements; |
659 collectImageElements(m_hasElementsAssociatedByParser ? NodeTraversal::highes
tAncestorOrSelf(*this) : *this, m_imageElements); | 659 collectImageElements(m_hasElementsAssociatedByParser ? NodeTraversal::highes
tAncestorOrSelf(*this) : *this, m_imageElements); |
660 m_imageElementsAreDirty = false; | 660 m_imageElementsAreDirty = false; |
661 return m_imageElements; | 661 return m_imageElements; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 } | 841 } |
842 | 842 |
843 void HTMLFormElement::setDemoted(bool demoted) | 843 void HTMLFormElement::setDemoted(bool demoted) |
844 { | 844 { |
845 if (demoted) | 845 if (demoted) |
846 UseCounter::count(document(), UseCounter::DemotedFormElement); | 846 UseCounter::count(document(), UseCounter::DemotedFormElement); |
847 m_wasDemoted = demoted; | 847 m_wasDemoted = demoted; |
848 } | 848 } |
849 | 849 |
850 } // namespace | 850 } // namespace |
OLD | NEW |