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

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 138343007: Use more consistent naming for caching methods in NodeListsNodeData class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 10 months 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/dom/ClassCollection.cpp ('k') | Source/core/dom/Document.cpp » ('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 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 setNeedsStyleRecalc(SubtreeStyleChange); 875 setNeedsStyleRecalc(SubtreeStyleChange);
876 else if (renderStyle()->affectedByHover()) 876 else if (renderStyle()->affectedByHover())
877 setNeedsStyleRecalc(LocalStyleChange); 877 setNeedsStyleRecalc(LocalStyleChange);
878 878
879 if (renderer()->style()->hasAppearance()) 879 if (renderer()->style()->hasAppearance())
880 RenderTheme::theme().stateChanged(renderer(), HoverState); 880 RenderTheme::theme().stateChanged(renderer(), HoverState);
881 } 881 }
882 882
883 PassRefPtr<HTMLCollection> ContainerNode::children() 883 PassRefPtr<HTMLCollection> ContainerNode::children()
884 { 884 {
885 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLCollect ion>(this, NodeChildren); 885 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(this, Nod eChildren);
886 } 886 }
887 887
888 Element* ContainerNode::firstElementChild() const 888 Element* ContainerNode::firstElementChild() const
889 { 889 {
890 return ElementTraversal::firstWithin(*this); 890 return ElementTraversal::firstWithin(*this);
891 } 891 }
892 892
893 Element* ContainerNode::lastElementChild() const 893 Element* ContainerNode::lastElementChild() const
894 { 894 {
895 Node* n = lastChild(); 895 Node* n = lastChild();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 1014
1015 dispatchChildInsertionEvents(child); 1015 dispatchChildInsertionEvents(child);
1016 } 1016 }
1017 1017
1018 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin g& localName) 1018 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin g& localName)
1019 { 1019 {
1020 if (localName.isNull()) 1020 if (localName.isNull())
1021 return 0; 1021 return 0;
1022 1022
1023 if (document().isHTMLDocument()) 1023 if (document().isHTMLDocument())
1024 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTag Collection>(this, HTMLTagCollectionType, localName); 1024 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(th is, HTMLTagCollectionType, localName);
1025 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagCollecti on>(this, TagCollectionType, localName); 1025 return ensureRareData().ensureNodeLists().addCache<TagCollection>(this, TagC ollectionType, localName);
1026 } 1026 }
1027 1027
1028 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr ing& namespaceURI, const AtomicString& localName) 1028 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr ing& namespaceURI, const AtomicString& localName)
1029 { 1029 {
1030 if (localName.isNull()) 1030 if (localName.isNull())
1031 return 0; 1031 return 0;
1032 1032
1033 if (namespaceURI == starAtom) 1033 if (namespaceURI == starAtom)
1034 return getElementsByTagName(localName); 1034 return getElementsByTagName(localName);
1035 1035
1036 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(this, na mespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); 1036 return ensureRareData().ensureNodeLists().addCache(this, namespaceURI.isEmpt y() ? nullAtom : namespaceURI, localName);
1037 } 1037 }
1038 1038
1039 // Takes an AtomicString in argument because it is common for elements to share the same name attribute. 1039 // Takes an AtomicString in argument because it is common for elements to share the same name attribute.
1040 // Therefore, the NameNodeList factory function expects an AtomicString type. 1040 // Therefore, the NameNodeList factory function expects an AtomicString type.
1041 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen tName) 1041 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen tName)
1042 { 1042 {
1043 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeLis t>(this, NameNodeListType, elementName); 1043 return ensureRareData().ensureNodeLists().addCache<NameNodeList>(this, NameN odeListType, elementName);
1044 } 1044 }
1045 1045
1046 // Takes an AtomicString in argument because it is common for elements to share the same set of class names. 1046 // Takes an AtomicString in argument because it is common for elements to share the same set of class names.
1047 // Therefore, the ClassNodeList factory function expects an AtomicString type. 1047 // Therefore, the ClassNodeList factory function expects an AtomicString type.
1048 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr ing& classNames) 1048 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr ing& classNames)
1049 { 1049 {
1050 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassCollec tion>(this, ClassCollectionType, classNames); 1050 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(this, Cl assCollectionType, classNames);
1051 } 1051 }
1052 1052
1053 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name, bool onlyMatchImgElements) 1053 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name, bool onlyMatchImgElements)
1054 { 1054 {
1055 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); 1055 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag));
1056 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod eListType; 1056 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod eListType;
1057 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeLi st>(this, type, name); 1057 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(this, type , name);
1058 } 1058 }
1059 1059
1060 #ifndef NDEBUG 1060 #ifndef NDEBUG
1061 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) 1061 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node)
1062 { 1062 {
1063 if (node->isShadowRoot()) 1063 if (node->isShadowRoot())
1064 return true; 1064 return true;
1065 1065
1066 if (node->isInsertionPoint()) 1066 if (node->isInsertionPoint())
1067 return true; 1067 return true;
1068 1068
1069 if (node->isElementNode() && toElement(node)->shadow()) 1069 if (node->isElementNode() && toElement(node)->shadow())
1070 return true; 1070 return true;
1071 1071
1072 return false; 1072 return false;
1073 } 1073 }
1074 #endif 1074 #endif
1075 1075
1076 } // namespace WebCore 1076 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ClassCollection.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698