| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/html/HTMLFormElement.h" | 26 #include "core/html/HTMLFormElement.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ScriptController.h" | 28 #include "bindings/core/v8/ScriptController.h" |
| 29 #include "bindings/core/v8/ScriptEventListener.h" | 29 #include "bindings/core/v8/ScriptEventListener.h" |
| 30 #include "bindings/core/v8/UnionTypesCore.h" |
| 30 #include "bindings/core/v8/V8DOMActivityLogger.h" | 31 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 31 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
| 32 #include "core/dom/Attribute.h" | 33 #include "core/dom/Attribute.h" |
| 33 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 34 #include "core/dom/ElementTraversal.h" | 35 #include "core/dom/ElementTraversal.h" |
| 35 #include "core/dom/IdTargetObserverRegistry.h" | 36 #include "core/dom/IdTargetObserverRegistry.h" |
| 36 #include "core/dom/NodeListsNodeData.h" | 37 #include "core/dom/NodeListsNodeData.h" |
| 37 #include "core/events/AutocompleteErrorEvent.h" | 38 #include "core/events/AutocompleteErrorEvent.h" |
| 38 #include "core/events/Event.h" | 39 #include "core/events/Event.h" |
| 39 #include "core/events/GenericEventQueue.h" | 40 #include "core/events/GenericEventQueue.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 document().formController().restoreControlStateIn(*this); | 824 document().formController().restoreControlStateIn(*this); |
| 824 m_didFinishParsingChildren = true; | 825 m_didFinishParsingChildren = true; |
| 825 } | 826 } |
| 826 | 827 |
| 827 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc
e) | 828 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc
e) |
| 828 { | 829 { |
| 829 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; | 830 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; |
| 830 HTMLElement::copyNonAttributePropertiesFromElement(source); | 831 HTMLElement::copyNonAttributePropertiesFromElement(source); |
| 831 } | 832 } |
| 832 | 833 |
| 833 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, RefPtrWillB
eRawPtr<RadioNodeList>& returnValue0, RefPtrWillBeRawPtr<Element>& returnValue1) | 834 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, RadioNodeLi
stOrElement& returnValue) |
| 834 { | 835 { |
| 835 // Call getNamedElements twice, first time check if it has a value | 836 // Call getNamedElements twice, first time check if it has a value |
| 836 // and let HTMLFormElement update its cache. | 837 // and let HTMLFormElement update its cache. |
| 837 // See issue: 867404 | 838 // See issue: 867404 |
| 838 { | 839 { |
| 839 WillBeHeapVector<RefPtrWillBeMember<Element> > elements; | 840 WillBeHeapVector<RefPtrWillBeMember<Element> > elements; |
| 840 getNamedElements(name, elements); | 841 getNamedElements(name, elements); |
| 841 if (elements.isEmpty()) | 842 if (elements.isEmpty()) |
| 842 return; | 843 return; |
| 843 } | 844 } |
| 844 | 845 |
| 845 // Second call may return different results from the first call, | 846 // Second call may return different results from the first call, |
| 846 // but if the first the size cannot be zero. | 847 // but if the first the size cannot be zero. |
| 847 WillBeHeapVector<RefPtrWillBeMember<Element> > elements; | 848 WillBeHeapVector<RefPtrWillBeMember<Element> > elements; |
| 848 getNamedElements(name, elements); | 849 getNamedElements(name, elements); |
| 849 ASSERT(!elements.isEmpty()); | 850 ASSERT(!elements.isEmpty()); |
| 850 | 851 |
| 851 if (elements.size() == 1) { | 852 if (elements.size() == 1) { |
| 852 returnValue1 = elements.at(0); | 853 returnValue.setElement(elements.at(0)); |
| 853 return; | 854 return; |
| 854 } | 855 } |
| 855 | 856 |
| 856 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs
t()); | 857 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs
t()); |
| 857 returnValue0 = radioNodeList(name, onlyMatchImg); | 858 returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg)); |
| 858 } | 859 } |
| 859 | 860 |
| 860 void HTMLFormElement::setDemoted(bool demoted) | 861 void HTMLFormElement::setDemoted(bool demoted) |
| 861 { | 862 { |
| 862 if (demoted) | 863 if (demoted) |
| 863 UseCounter::count(document(), UseCounter::DemotedFormElement); | 864 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 864 m_wasDemoted = demoted; | 865 m_wasDemoted = demoted; |
| 865 } | 866 } |
| 866 | 867 |
| 867 } // namespace | 868 } // namespace |
| OLD | NEW |