Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 1511523002: Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix removal issue when a text node is between <source> and <img> Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return InsertionDone; 158 return InsertionDone;
159 } 159 }
160 160
161 template<class T> 161 template<class T>
162 void notifyFormRemovedFromTree(const T& elements, Node& root) 162 void notifyFormRemovedFromTree(const T& elements, Node& root)
163 { 163 {
164 for (const auto& element : elements) 164 for (const auto& element : elements)
165 element->formRemovedFromTree(root); 165 element->formRemovedFromTree(root);
166 } 166 }
167 167
168 void HTMLFormElement::removedFrom(ContainerNode* insertionPoint) 168 void HTMLFormElement::removedFrom(ContainerNode* insertionPoint, Node* next)
169 { 169 {
170 // We don't need to take care of form association by 'form' content 170 // We don't need to take care of form association by 'form' content
171 // attribute becuse IdTargetObserver handles it. 171 // attribute becuse IdTargetObserver handles it.
172 if (m_hasElementsAssociatedByParser) { 172 if (m_hasElementsAssociatedByParser) {
173 Node& root = NodeTraversal::highestAncestorOrSelf(*this); 173 Node& root = NodeTraversal::highestAncestorOrSelf(*this);
174 if (!m_associatedElementsAreDirty) { 174 if (!m_associatedElementsAreDirty) {
175 FormAssociatedElement::List elements(associatedElements()); 175 FormAssociatedElement::List elements(associatedElements());
176 notifyFormRemovedFromTree(elements, root); 176 notifyFormRemovedFromTree(elements, root);
177 } else { 177 } else {
178 FormAssociatedElement::List elements; 178 FormAssociatedElement::List elements;
(...skipping 10 matching lines...) Expand all
189 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement>> images; 189 WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement>> images;
190 collectImageElements(NodeTraversal::highestAncestorOrSelf(*insertion Point), images); 190 collectImageElements(NodeTraversal::highestAncestorOrSelf(*insertion Point), images);
191 notifyFormRemovedFromTree(images, root); 191 notifyFormRemovedFromTree(images, root);
192 collectImageElements(root, images); 192 collectImageElements(root, images);
193 notifyFormRemovedFromTree(images, root); 193 notifyFormRemovedFromTree(images, root);
194 } 194 }
195 } 195 }
196 #if ENABLE(OILPAN) 196 #if ENABLE(OILPAN)
197 document().formController().willDeleteForm(this); 197 document().formController().willDeleteForm(this);
198 #endif 198 #endif
199 HTMLElement::removedFrom(insertionPoint); 199 HTMLElement::removedFrom(insertionPoint, next);
200 } 200 }
201 201
202 void HTMLFormElement::handleLocalEvents(Event& event) 202 void HTMLFormElement::handleLocalEvents(Event& event)
203 { 203 {
204 Node* targetNode = event.target()->toNode(); 204 Node* targetNode = event.target()->toNode();
205 if (event.eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event.type() == EventTypeNames::submit || event.type() == EventType Names::reset)) { 205 if (event.eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event.type() == EventTypeNames::submit || event.type() == EventType Names::reset)) {
206 event.stopPropagation(); 206 event.stopPropagation();
207 return; 207 return;
208 } 208 }
209 HTMLElement::handleLocalEvents(event); 209 HTMLElement::handleLocalEvents(event);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 823 }
824 824
825 void HTMLFormElement::setDemoted(bool demoted) 825 void HTMLFormElement::setDemoted(bool demoted)
826 { 826 {
827 if (demoted) 827 if (demoted)
828 UseCounter::count(document(), UseCounter::DemotedFormElement); 828 UseCounter::count(document(), UseCounter::DemotedFormElement);
829 m_wasDemoted = demoted; 829 m_wasDemoted = demoted;
830 } 830 }
831 831
832 } // namespace 832 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698