| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 615 } |
| 616 | 616 |
| 617 PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> HTMLFormElement::elements() | 617 PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> HTMLFormElement::elements() |
| 618 { | 618 { |
| 619 return ensureCachedCollection<HTMLFormControlsCollection>(FormControls); | 619 return ensureCachedCollection<HTMLFormControlsCollection>(FormControls); |
| 620 } | 620 } |
| 621 | 621 |
| 622 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen
t::List& elements) const | 622 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen
t::List& elements) const |
| 623 { | 623 { |
| 624 elements.clear(); | 624 elements.clear(); |
| 625 for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(root); eleme
nt; element = Traversal<HTMLElement>::next(*element)) { | 625 for (HTMLElement& element : Traversal<HTMLElement>::fromNext(root)) { |
| 626 FormAssociatedElement* associatedElement = 0; | 626 FormAssociatedElement* associatedElement = 0; |
| 627 if (element->isFormControlElement()) | 627 if (element.isFormControlElement()) |
| 628 associatedElement = toHTMLFormControlElement(element); | 628 associatedElement = toHTMLFormControlElement(&element); |
| 629 else if (isHTMLObjectElement(*element)) | 629 else if (isHTMLObjectElement(element)) |
| 630 associatedElement = toHTMLObjectElement(element); | 630 associatedElement = toHTMLObjectElement(&element); |
| 631 else | 631 else |
| 632 continue; | 632 continue; |
| 633 if (associatedElement->form()== this) | 633 if (associatedElement->form()== this) |
| 634 elements.append(associatedElement); | 634 elements.append(associatedElement); |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 // This function should be const conceptually. However we update some fields | 638 // This function should be const conceptually. However we update some fields |
| 639 // because of lazy evaluation. | 639 // because of lazy evaluation. |
| 640 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const | 640 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const |
| 641 { | 641 { |
| 642 if (!m_associatedElementsAreDirty) | 642 if (!m_associatedElementsAreDirty) |
| 643 return m_associatedElements; | 643 return m_associatedElements; |
| 644 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); | 644 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); |
| 645 Node* scope = mutableThis; | 645 Node* scope = mutableThis; |
| 646 if (m_hasElementsAssociatedByParser) | 646 if (m_hasElementsAssociatedByParser) |
| 647 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); | 647 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); |
| 648 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) | 648 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) |
| 649 scope = &treeScope().rootNode(); | 649 scope = &treeScope().rootNode(); |
| 650 ASSERT(scope); | 650 ASSERT(scope); |
| 651 collectAssociatedElements(*scope, mutableThis->m_associatedElements); | 651 collectAssociatedElements(*scope, mutableThis->m_associatedElements); |
| 652 mutableThis->m_associatedElementsAreDirty = false; | 652 mutableThis->m_associatedElementsAreDirty = false; |
| 653 return m_associatedElements; | 653 return m_associatedElements; |
| 654 } | 654 } |
| 655 | 655 |
| 656 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) | 656 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) |
| 657 { | 657 { |
| 658 elements.clear(); | 658 elements.clear(); |
| 659 for (HTMLImageElement* image = Traversal<HTMLImageElement>::firstWithin(root
); image; image = Traversal<HTMLImageElement>::next(*image)) { | 659 for (HTMLImageElement& image : Traversal<HTMLImageElement>::fromNext(root))
{ |
| 660 if (image->formOwner() == this) | 660 if (image.formOwner() == this) |
| 661 elements.append(image); | 661 elements.append(&image); |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() | 665 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() |
| 666 { | 666 { |
| 667 if (!m_imageElementsAreDirty) | 667 if (!m_imageElementsAreDirty) |
| 668 return m_imageElements; | 668 return m_imageElements; |
| 669 collectImageElements(m_hasElementsAssociatedByParser ? NodeTraversal::highes
tAncestorOrSelf(*this) : *this, m_imageElements); | 669 collectImageElements(m_hasElementsAssociatedByParser ? NodeTraversal::highes
tAncestorOrSelf(*this) : *this, m_imageElements); |
| 670 m_imageElementsAreDirty = false; | 670 m_imageElementsAreDirty = false; |
| 671 return m_imageElements; | 671 return m_imageElements; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 } | 859 } |
| 860 | 860 |
| 861 void HTMLFormElement::setDemoted(bool demoted) | 861 void HTMLFormElement::setDemoted(bool demoted) |
| 862 { | 862 { |
| 863 if (demoted) | 863 if (demoted) |
| 864 UseCounter::count(document(), UseCounter::DemotedFormElement); | 864 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 865 m_wasDemoted = demoted; | 865 m_wasDemoted = demoted; |
| 866 } | 866 } |
| 867 | 867 |
| 868 } // namespace | 868 } // namespace |
| OLD | NEW |