| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 for (size_t i = 0; i < size; ++i) | 160 for (size_t i = 0; i < size; ++i) |
| 161 elements[i]->formRemovedFromTree(root); | 161 elements[i]->formRemovedFromTree(root); |
| 162 ASSERT(elements.size() == size); | 162 ASSERT(elements.size() == size); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void HTMLFormElement::removedFrom(ContainerNode* insertionPoint) | 165 void HTMLFormElement::removedFrom(ContainerNode* insertionPoint) |
| 166 { | 166 { |
| 167 // We don't need to take care of form association by 'form' content | 167 // We don't need to take care of form association by 'form' content |
| 168 // attribute becuse IdTargetObserver handles it. | 168 // attribute becuse IdTargetObserver handles it. |
| 169 if (m_hasElementsAssociatedByParser) { | 169 if (m_hasElementsAssociatedByParser) { |
| 170 Node& root = highestAncestorOrSelf(); | 170 Node& root = NodeTraversal::highestAncestorOrSelf(*this); |
| 171 if (!m_associatedElementsAreDirty) { | 171 if (!m_associatedElementsAreDirty) { |
| 172 FormAssociatedElement::List elements(associatedElements()); | 172 FormAssociatedElement::List elements(associatedElements()); |
| 173 notifyFormRemovedFromTree(elements, root); | 173 notifyFormRemovedFromTree(elements, root); |
| 174 } else { | 174 } else { |
| 175 FormAssociatedElement::List elements; | 175 FormAssociatedElement::List elements; |
| 176 collectAssociatedElements(insertionPoint->highestAncestorOrSelf(), e
lements); | 176 collectAssociatedElements(NodeTraversal::highestAncestorOrSelf(*inse
rtionPoint), elements); |
| 177 notifyFormRemovedFromTree(elements, root); | 177 notifyFormRemovedFromTree(elements, root); |
| 178 collectAssociatedElements(root, elements); | 178 collectAssociatedElements(root, elements); |
| 179 notifyFormRemovedFromTree(elements, root); | 179 notifyFormRemovedFromTree(elements, root); |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (!m_imageElementsAreDirty) { | 182 if (!m_imageElementsAreDirty) { |
| 183 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> > images(image
Elements()); | 183 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> > images(image
Elements()); |
| 184 notifyFormRemovedFromTree(images, root); | 184 notifyFormRemovedFromTree(images, root); |
| 185 } else { | 185 } else { |
| 186 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> > images; | 186 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> > images; |
| 187 collectImageElements(insertionPoint->highestAncestorOrSelf(), images
); | 187 collectImageElements(NodeTraversal::highestAncestorOrSelf(*insertion
Point), images); |
| 188 notifyFormRemovedFromTree(images, root); | 188 notifyFormRemovedFromTree(images, root); |
| 189 collectImageElements(root, images); | 189 collectImageElements(root, images); |
| 190 notifyFormRemovedFromTree(images, root); | 190 notifyFormRemovedFromTree(images, root); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 #if ENABLE(OILPAN) | 193 #if ENABLE(OILPAN) |
| 194 document().formController().willDeleteForm(this); | 194 document().formController().willDeleteForm(this); |
| 195 #endif | 195 #endif |
| 196 HTMLElement::removedFrom(insertionPoint); | 196 HTMLElement::removedFrom(insertionPoint); |
| 197 } | 197 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 610 |
| 611 // This function should be const conceptually. However we update some fields | 611 // This function should be const conceptually. However we update some fields |
| 612 // because of lazy evaluation. | 612 // because of lazy evaluation. |
| 613 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const | 613 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const |
| 614 { | 614 { |
| 615 if (!m_associatedElementsAreDirty) | 615 if (!m_associatedElementsAreDirty) |
| 616 return m_associatedElements; | 616 return m_associatedElements; |
| 617 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); | 617 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); |
| 618 Node* scope = mutableThis; | 618 Node* scope = mutableThis; |
| 619 if (m_hasElementsAssociatedByParser) | 619 if (m_hasElementsAssociatedByParser) |
| 620 scope = &highestAncestorOrSelf(); | 620 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); |
| 621 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) | 621 if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fast
GetAttribute(idAttr))) |
| 622 scope = &treeScope().rootNode(); | 622 scope = &treeScope().rootNode(); |
| 623 ASSERT(scope); | 623 ASSERT(scope); |
| 624 collectAssociatedElements(*scope, mutableThis->m_associatedElements); | 624 collectAssociatedElements(*scope, mutableThis->m_associatedElements); |
| 625 mutableThis->m_associatedElementsAreDirty = false; | 625 mutableThis->m_associatedElementsAreDirty = false; |
| 626 return m_associatedElements; | 626 return m_associatedElements; |
| 627 } | 627 } |
| 628 | 628 |
| 629 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) | 629 void HTMLFormElement::collectImageElements(Node& root, WillBeHeapVector<RawPtrWi
llBeMember<HTMLImageElement> >& elements) |
| 630 { | 630 { |
| 631 elements.clear(); | 631 elements.clear(); |
| 632 for (HTMLImageElement* image = Traversal<HTMLImageElement>::firstWithin(root
); image; image = Traversal<HTMLImageElement>::next(*image)) { | 632 for (HTMLImageElement* image = Traversal<HTMLImageElement>::firstWithin(root
); image; image = Traversal<HTMLImageElement>::next(*image)) { |
| 633 if (image->formOwner() == this) | 633 if (image->formOwner() == this) |
| 634 elements.append(image); | 634 elements.append(image); |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() | 638 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >& HTMLFormElement::
imageElements() |
| 639 { | 639 { |
| 640 if (!m_imageElementsAreDirty) | 640 if (!m_imageElementsAreDirty) |
| 641 return m_imageElements; | 641 return m_imageElements; |
| 642 collectImageElements(m_hasElementsAssociatedByParser ? highestAncestorOrSelf
() : *this, m_imageElements); | 642 collectImageElements(m_hasElementsAssociatedByParser ? NodeTraversal::highes
tAncestorOrSelf(*this) : *this, m_imageElements); |
| 643 m_imageElementsAreDirty = false; | 643 m_imageElementsAreDirty = false; |
| 644 return m_imageElements; | 644 return m_imageElements; |
| 645 } | 645 } |
| 646 | 646 |
| 647 String HTMLFormElement::name() const | 647 String HTMLFormElement::name() const |
| 648 { | 648 { |
| 649 return getNameAttribute(); | 649 return getNameAttribute(); |
| 650 } | 650 } |
| 651 | 651 |
| 652 bool HTMLFormElement::noValidate() const | 652 bool HTMLFormElement::noValidate() const |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } | 826 } |
| 827 | 827 |
| 828 void HTMLFormElement::setDemoted(bool demoted) | 828 void HTMLFormElement::setDemoted(bool demoted) |
| 829 { | 829 { |
| 830 if (demoted) | 830 if (demoted) |
| 831 UseCounter::count(document(), UseCounter::DemotedFormElement); | 831 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 832 m_wasDemoted = demoted; | 832 m_wasDemoted = demoted; |
| 833 } | 833 } |
| 834 | 834 |
| 835 } // namespace | 835 } // namespace |
| OLD | NEW |