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

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

Issue 119063002: Have HTMLFormElement's named getter return a RadioNodeList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test style adjustments + const'ify new RadioNodeList field. Created 7 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
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLFormElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 #include "config.h" 25 #include "config.h"
26 #include "core/html/HTMLFormElement.h" 26 #include "core/html/HTMLFormElement.h"
27 27
28 #include <limits> 28 #include <limits>
29 #include "HTMLNames.h" 29 #include "HTMLNames.h"
30 #include "bindings/v8/ScriptController.h" 30 #include "bindings/v8/ScriptController.h"
31 #include "bindings/v8/ScriptEventListener.h" 31 #include "bindings/v8/ScriptEventListener.h"
32 #include "core/dom/Attribute.h" 32 #include "core/dom/Attribute.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/NamedNodesCollection.h"
36 #include "core/events/AutocompleteErrorEvent.h" 35 #include "core/events/AutocompleteErrorEvent.h"
37 #include "core/events/Event.h" 36 #include "core/events/Event.h"
38 #include "core/events/ScopedEventQueue.h" 37 #include "core/events/ScopedEventQueue.h"
39 #include "core/events/ThreadLocalEventNames.h" 38 #include "core/events/ThreadLocalEventNames.h"
40 #include "core/html/HTMLCollection.h" 39 #include "core/html/HTMLCollection.h"
41 #include "core/html/HTMLDialogElement.h" 40 #include "core/html/HTMLDialogElement.h"
42 #include "core/html/HTMLImageElement.h" 41 #include "core/html/HTMLImageElement.h"
43 #include "core/html/HTMLInputElement.h" 42 #include "core/html/HTMLInputElement.h"
44 #include "core/html/HTMLObjectElement.h" 43 #include "core/html/HTMLObjectElement.h"
45 #include "core/html/HTMLTableElement.h" 44 #include "core/html/HTMLTableElement.h"
45 #include "core/html/RadioNodeList.h"
46 #include "core/html/forms/FormController.h" 46 #include "core/html/forms/FormController.h"
47 #include "core/loader/FrameLoader.h" 47 #include "core/loader/FrameLoader.h"
48 #include "core/loader/FrameLoaderClient.h" 48 #include "core/loader/FrameLoaderClient.h"
49 #include "core/frame/ContentSecurityPolicy.h" 49 #include "core/frame/ContentSecurityPolicy.h"
50 #include "core/frame/DOMWindow.h" 50 #include "core/frame/DOMWindow.h"
51 #include "core/frame/Frame.h" 51 #include "core/frame/Frame.h"
52 #include "core/frame/UseCounter.h" 52 #include "core/frame/UseCounter.h"
53 #include "core/rendering/RenderTextControl.h" 53 #include "core/rendering/RenderTextControl.h"
54 #include "platform/UserGestureIndicator.h" 54 #include "platform/UserGestureIndicator.h"
55 55
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 HTMLElement::finishParsingChildren(); 784 HTMLElement::finishParsingChildren();
785 document().formController()->restoreControlStateIn(*this); 785 document().formController()->restoreControlStateIn(*this);
786 } 786 }
787 787
788 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e) 788 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e)
789 { 789 {
790 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; 790 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted;
791 HTMLElement::copyNonAttributePropertiesFromElement(source); 791 HTMLElement::copyNonAttributePropertiesFromElement(source);
792 } 792 }
793 793
794 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtr<NodeList>& returnValue0, bool& returnValue1Enabled, RefPt r<Node>& returnValue1) 794 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtr<RadioNodeList>& returnValue0, bool& returnValue1Enabled, RefPtr<Node>& returnValue1)
795 { 795 {
796 // Call getNamedElements twice, first time check if it has a value 796 // Call getNamedElements twice, first time check if it has a value
797 // and let HTMLFormElement update its cache. 797 // and let HTMLFormElement update its cache.
798 // See issue: 867404 798 // See issue: 867404
799 { 799 {
800 Vector<RefPtr<Node> > elements; 800 Vector<RefPtr<Node> > elements;
801 getNamedElements(name, elements); 801 getNamedElements(name, elements);
802 if (elements.isEmpty()) 802 if (elements.isEmpty())
803 return; 803 return;
804 } 804 }
805 805
806 // Second call may return different results from the first call, 806 // Second call may return different results from the first call,
807 // but if the first the size cannot be zero. 807 // but if the first the size cannot be zero.
808 Vector<RefPtr<Node> > elements; 808 Vector<RefPtr<Node> > elements;
809 getNamedElements(name, elements); 809 getNamedElements(name, elements);
810 ASSERT(!elements.isEmpty()); 810 ASSERT(!elements.isEmpty());
811 811
812 if (elements.size() == 1) { 812 if (elements.size() == 1) {
813 returnValue1Enabled = true; 813 returnValue1Enabled = true;
814 returnValue1 = elements.at(0); 814 returnValue1 = elements.at(0);
815 return; 815 return;
816 } 816 }
817 817
818 bool onlyMatchImg = elements.size() && elements.at(0)->hasTagName(imgTag);
818 returnValue0Enabled = true; 819 returnValue0Enabled = true;
819 returnValue0 = NamedNodesCollection::create(elements); 820 returnValue0 = radioNodeList(name, onlyMatchImg);
820 } 821 }
821 822
822 void HTMLFormElement::setDemoted(bool demoted) 823 void HTMLFormElement::setDemoted(bool demoted)
823 { 824 {
824 if (demoted) 825 if (demoted)
825 UseCounter::count(document(), UseCounter::DemotedFormElement); 826 UseCounter::count(document(), UseCounter::DemotedFormElement);
826 m_wasDemoted = demoted; 827 m_wasDemoted = demoted;
827 } 828 }
828 829
829 } // namespace 830 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLFormElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698