Changeset 158540 in webkit
- Timestamp:
- Nov 3, 2013 1:32:00 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r158537 r158540 1 2013-11-03 Antti Koivisto <antti@apple.com> 2 3 LiveNodeLists should have non-null ContainerNode as root 4 https://bugs.webkit.org/show_bug.cgi?id=123709 5 6 Reviewed by Andreas Kling. 7 8 After moving ChildNodeList off from LiveNodeList the root is now always at least a ContainerNode. 9 10 * dom/ContainerNode.cpp: 11 (WebCore::ContainerNode::getElementsByTagName): 12 (WebCore::ContainerNode::getElementsByTagNameNS): 13 (WebCore::ContainerNode::getElementsByName): 14 (WebCore::ContainerNode::getElementsByClassName): 15 (WebCore::ContainerNode::radioNodeList): 16 17 Also these move from Node to ContainerNode to make tighter typing work. 18 1 19 2013-11-03 Antti Koivisto <antti@apple.com> 2 20 -
trunk/Source/WebCore/dom/ClassNodeList.cpp
r157365 r158540 37 37 namespace WebCore { 38 38 39 ClassNodeList::ClassNodeList( Node& rootNode, const String& classNames)39 ClassNodeList::ClassNodeList(ContainerNode& rootNode, const String& classNames) 40 40 : LiveNodeList(rootNode, ClassNodeListType, InvalidateOnClassAttrChange) 41 41 , m_classNames(classNames, document().inQuirksMode()) -
trunk/Source/WebCore/dom/ClassNodeList.h
r157065 r158540 40 40 class ClassNodeList : public LiveNodeList { 41 41 public: 42 static PassRefPtr<ClassNodeList> create( Node& rootNode, const String& classNames)42 static PassRefPtr<ClassNodeList> create(ContainerNode& rootNode, const String& classNames) 43 43 { 44 44 return adoptRef(new ClassNodeList(rootNode, classNames)); … … 50 50 51 51 private: 52 ClassNodeList( Node& rootNode, const String& classNames);52 ClassNodeList(ContainerNode& rootNode, const String& classNames); 53 53 54 54 virtual bool nodeMatches(Element*) const; -
trunk/Source/WebCore/dom/ContainerNode.cpp
r157971 r158540 28 28 #include "Chrome.h" 29 29 #include "ChromeClient.h" 30 #include "ClassNodeList.h" 30 31 #include "ContainerNodeAlgorithms.h" 31 32 #include "Editor.h" … … 42 43 #include "JSLazyEventListener.h" 43 44 #include "JSNode.h" 45 #include "LabelsNodeList.h" 46 #include "LiveNodeList.h" 44 47 #include "LoaderStrategy.h" 45 48 #include "MemoryCache.h" 46 49 #include "MutationEvent.h" 50 #include "NameNodeList.h" 51 #include "NodeRareData.h" 47 52 #include "NodeRenderStyle.h" 48 53 #include "NodeTraversal.h" 49 54 #include "Page.h" 50 55 #include "PlatformStrategies.h" 56 #include "RadioNodeList.h" 51 57 #include "RenderBox.h" 52 58 #include "RenderTheme.h" … … 55 61 #include "RootInlineBox.h" 56 62 #include "SelectorQuery.h" 63 #include "TagNodeList.h" 57 64 #include "TemplateContentDocumentFragment.h" 58 65 #include "Text.h" … … 1128 1135 } 1129 1136 1137 PassRefPtr<NodeList> ContainerNode::getElementsByTagName(const AtomicString& localName) 1138 { 1139 if (localName.isNull()) 1140 return 0; 1141 1142 if (document().isHTMLDocument()) 1143 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(*this, HTMLTagNodeListType, localName); 1144 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList>(*this, TagNodeListType, localName); 1145 } 1146 1147 PassRefPtr<NodeList> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName) 1148 { 1149 if (localName.isNull()) 1150 return 0; 1151 1152 if (namespaceURI == starAtom) 1153 return getElementsByTagName(localName); 1154 1155 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); 1156 } 1157 1158 PassRefPtr<NodeList> ContainerNode::getElementsByName(const String& elementName) 1159 { 1160 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, NameNodeListType, elementName); 1161 } 1162 1163 PassRefPtr<NodeList> ContainerNode::getElementsByClassName(const String& classNames) 1164 { 1165 return ensureRareData().ensureNodeLists().addCacheWithName<ClassNodeList>(*this, ClassNodeListType, classNames); 1166 } 1167 1168 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name) 1169 { 1170 ASSERT(hasTagName(HTMLNames::formTag) || hasTagName(HTMLNames::fieldsetTag)); 1171 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeList>(*this, RadioNodeListType, name); 1172 } 1173 1130 1174 } // namespace WebCore -
trunk/Source/WebCore/dom/ContainerNode.h
r157653 r158540 133 133 RefPtr<NodeList> querySelectorAll(const AtomicString& selectors, ExceptionCode&); 134 134 135 PassRefPtr<NodeList> getElementsByTagName(const AtomicString&); 136 PassRefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName); 137 PassRefPtr<NodeList> getElementsByName(const String& elementName); 138 PassRefPtr<NodeList> getElementsByClassName(const String& classNames); 139 PassRefPtr<RadioNodeList> radioNodeList(const AtomicString&); 140 135 141 protected: 136 142 explicit ContainerNode(Document*, ConstructionType = CreateContainer); -
trunk/Source/WebCore/dom/LiveNodeList.cpp
r158536 r158540 30 30 namespace WebCore { 31 31 32 Node& LiveNodeListBase::rootNode() const32 ContainerNode& LiveNodeListBase::rootNode() const 33 33 { 34 34 if (isRootedAtDocument() && ownerNode().inDocument()) … … 36 36 37 37 return ownerNode(); 38 }39 40 ContainerNode* LiveNodeListBase::rootContainerNode() const41 {42 Node& rootNode = this->rootNode();43 if (!rootNode.isContainerNode())44 return 0;45 return &toContainerNode(rootNode);46 38 } 47 39 -
trunk/Source/WebCore/dom/LiveNodeList.h
r158536 r158540 49 49 }; 50 50 51 LiveNodeListBase( Node& ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType,51 LiveNodeListBase(ContainerNode& ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, 52 52 bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) 53 53 : m_ownerNode(ownerNode) … … 84 84 ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); } 85 85 ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); } 86 Node& ownerNode() const { return const_cast<Node&>(m_ownerNode.get()); }86 ContainerNode& ownerNode() const { return const_cast<ContainerNode&>(m_ownerNode.get()); } 87 87 ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const 88 88 { … … 99 99 protected: 100 100 Document& document() const { return m_ownerNode->document(); } 101 Node& rootNode() const; 102 ContainerNode* rootContainerNode() const; 101 ContainerNode& rootNode() const; 103 102 bool overridesItemAfter() const { return m_overridesItemAfter; } 104 103 … … 142 141 Node* itemBefore(Node* previousItem) const; 143 142 144 Ref< Node> m_ownerNode;143 Ref<ContainerNode> m_ownerNode; 145 144 mutable Node* m_cachedItem; 146 145 mutable unsigned m_cachedLength; … … 185 184 class LiveNodeList : public LiveNodeListBase { 186 185 public: 187 LiveNodeList( Node& ownerNode, CollectionType collectionType, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode)186 LiveNodeList(ContainerNode& ownerNode, CollectionType collectionType, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) 188 187 : LiveNodeListBase(ownerNode, rootType, invalidationType, /*shouldOnlyIncludeDirectChildren*/ false, collectionType, DoesNotOverrideItemAfter) 189 188 { } -
trunk/Source/WebCore/dom/NameNodeList.cpp
r157065 r158540 33 33 using namespace HTMLNames; 34 34 35 NameNodeList::NameNodeList( Node& rootNode, const AtomicString& name)35 NameNodeList::NameNodeList(ContainerNode& rootNode, const AtomicString& name) 36 36 : LiveNodeList(rootNode, NameNodeListType, InvalidateOnNameAttrChange) 37 37 , m_name(name) -
trunk/Source/WebCore/dom/NameNodeList.h
r157065 r158540 34 34 class NameNodeList : public LiveNodeList { 35 35 public: 36 static PassRefPtr<NameNodeList> create( Node& rootNode, CollectionType type, const AtomicString& name)36 static PassRefPtr<NameNodeList> create(ContainerNode& rootNode, CollectionType type, const AtomicString& name) 37 37 { 38 38 ASSERT_UNUSED(type, type == NameNodeListType); … … 43 43 44 44 private: 45 NameNodeList( Node& rootNode, const AtomicString& name);45 NameNodeList(ContainerNode& rootNode, const AtomicString& name); 46 46 47 47 virtual bool nodeMatches(Element*) const; -
trunk/Source/WebCore/dom/Node.cpp
r158536 r158540 40 40 #include "CSSStyleSheet.h" 41 41 #include "ChildNodeList.h" 42 #include "ClassNodeList.h"43 42 #include "ContainerNodeAlgorithms.h" 44 43 #include "ContextMenuController.h" … … 70 69 #include "InspectorCounters.h" 71 70 #include "KeyboardEvent.h" 72 #include "LabelsNodeList.h"73 #include "LiveNodeList.h"74 71 #include "Logging.h" 75 72 #include "MouseEvent.h" 76 73 #include "MutationEvent.h" 77 #include "NameNodeList.h"78 74 #include "NamedNodeMap.h" 79 75 #include "NodeRareData.h" … … 84 80 #include "ProcessingInstruction.h" 85 81 #include "ProgressEvent.h" 86 #include "RadioNodeList.h"87 82 #include "RegisteredEventListener.h" 88 83 #include "RenderBlock.h" … … 95 90 #include "StorageEvent.h" 96 91 #include "StyleResolver.h" 97 #include "TagNodeList.h"98 92 #include "TemplateContentDocumentFragment.h" 99 93 #include "Text.h" … … 1056 1050 // FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node. 1057 1051 1058 PassRefPtr<NodeList> Node::getElementsByTagName(const AtomicString& localName)1059 {1060 if (localName.isNull())1061 return 0;1062 1063 if (document().isHTMLDocument())1064 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(*this, HTMLTagNodeListType, localName);1065 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList>(*this, TagNodeListType, localName);1066 }1067 1068 PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)1069 {1070 if (localName.isNull())1071 return 0;1072 1073 if (namespaceURI == starAtom)1074 return getElementsByTagName(localName);1075 1076 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);1077 }1078 1079 PassRefPtr<NodeList> Node::getElementsByName(const String& elementName)1080 {1081 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, NameNodeListType, elementName);1082 }1083 1084 PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames)1085 {1086 return ensureRareData().ensureNodeLists().addCacheWithName<ClassNodeList>(*this, ClassNodeListType, classNames);1087 }1088 1089 PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name)1090 {1091 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag));1092 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeList>(*this, RadioNodeListType, name);1093 }1094 1095 1052 Document* Node::ownerDocument() const 1096 1053 { -
trunk/Source/WebCore/dom/Node.h
r158461 r158540 500 500 void clearNodeLists(); 501 501 502 PassRefPtr<NodeList> getElementsByTagName(const AtomicString&);503 PassRefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);504 PassRefPtr<NodeList> getElementsByName(const String& elementName);505 PassRefPtr<NodeList> getElementsByClassName(const String& classNames);506 PassRefPtr<RadioNodeList> radioNodeList(const AtomicString&);507 508 502 virtual bool willRespondToMouseMoveEvents(); 509 503 virtual bool willRespondToMouseClickEvents(); -
trunk/Source/WebCore/dom/NodeRareData.h
r158536 r158540 107 107 108 108 template<typename T> 109 PassRefPtr<T> addCacheWithAtomicName( Node& node, CollectionType collectionType, const AtomicString& name)109 PassRefPtr<T> addCacheWithAtomicName(ContainerNode& node, CollectionType collectionType, const AtomicString& name) 110 110 { 111 111 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(namedNodeListKey(collectionType, name), nullptr); … … 120 120 // FIXME: This function should be renamed since it doesn't have an atomic name. 121 121 template<typename T> 122 PassRefPtr<T> addCacheWithAtomicName( Node& node, CollectionType collectionType)122 PassRefPtr<T> addCacheWithAtomicName(ContainerNode& node, CollectionType collectionType) 123 123 { 124 124 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(namedNodeListKey(collectionType, starAtom), nullptr); … … 138 138 139 139 template<typename T> 140 PassRefPtr<T> addCacheWithName( Node& node, CollectionType collectionType, const String& name)140 PassRefPtr<T> addCacheWithName(ContainerNode& node, CollectionType collectionType, const String& name) 141 141 { 142 142 NodeListNameCacheMap::AddResult result = m_nameCaches.add(namedNodeListKey(collectionType, name), nullptr); … … 149 149 } 150 150 151 PassRefPtr<TagNodeList> addCacheWithQualifiedName( Node& node, const AtomicString& namespaceURI, const AtomicString& localName)151 PassRefPtr<TagNodeList> addCacheWithQualifiedName(ContainerNode& node, const AtomicString& namespaceURI, const AtomicString& localName) 152 152 { 153 153 QualifiedName name(nullAtom, localName, namespaceURI); -
trunk/Source/WebCore/dom/TagNodeList.cpp
r157065 r158540 31 31 namespace WebCore { 32 32 33 TagNodeList::TagNodeList( Node& rootNode, CollectionType type, const AtomicString& namespaceURI, const AtomicString& localName)33 TagNodeList::TagNodeList(ContainerNode& rootNode, CollectionType type, const AtomicString& namespaceURI, const AtomicString& localName) 34 34 : LiveNodeList(rootNode, type, DoNotInvalidateOnAttributeChanges) 35 35 , m_namespaceURI(namespaceURI) … … 56 56 } 57 57 58 HTMLTagNodeList::HTMLTagNodeList( Node& rootNode, const AtomicString& localName)58 HTMLTagNodeList::HTMLTagNodeList(ContainerNode& rootNode, const AtomicString& localName) 59 59 : TagNodeList(rootNode, HTMLTagNodeListType, starAtom, localName) 60 60 , m_loweredLocalName(localName.lower()) -
trunk/Source/WebCore/dom/TagNodeList.h
r157065 r158540 34 34 class TagNodeList : public LiveNodeList { 35 35 public: 36 static PassRefPtr<TagNodeList> create( Node& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)36 static PassRefPtr<TagNodeList> create(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName) 37 37 { 38 38 ASSERT(namespaceURI != starAtom); … … 40 40 } 41 41 42 static PassRefPtr<TagNodeList> create( Node& rootNode, CollectionType type, const AtomicString& localName)42 static PassRefPtr<TagNodeList> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName) 43 43 { 44 44 ASSERT_UNUSED(type, type == TagNodeListType); … … 49 49 50 50 protected: 51 TagNodeList( Node& rootNode, CollectionType, const AtomicString& namespaceURI, const AtomicString& localName);51 TagNodeList(ContainerNode& rootNode, CollectionType, const AtomicString& namespaceURI, const AtomicString& localName); 52 52 53 53 virtual bool nodeMatches(Element*) const OVERRIDE; … … 59 59 class HTMLTagNodeList : public TagNodeList { 60 60 public: 61 static PassRefPtr<HTMLTagNodeList> create( Node& rootNode, CollectionType type, const AtomicString& localName)61 static PassRefPtr<HTMLTagNodeList> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName) 62 62 { 63 63 ASSERT_UNUSED(type, type == HTMLTagNodeListType); … … 68 68 69 69 private: 70 HTMLTagNodeList( Node& rootNode, const AtomicString& localName);70 HTMLTagNodeList(ContainerNode& rootNode, const AtomicString& localName); 71 71 72 72 virtual bool nodeMatches(Element*) const OVERRIDE; -
trunk/Source/WebCore/html/HTMLAllCollection.cpp
r157065 r158540 31 31 namespace WebCore { 32 32 33 PassRefPtr<HTMLAllCollection> HTMLAllCollection::create( Node& node, CollectionType type)33 PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(ContainerNode& node, CollectionType type) 34 34 { 35 35 return adoptRef(new HTMLAllCollection(node, type)); 36 36 } 37 37 38 HTMLAllCollection::HTMLAllCollection( Node& node, CollectionType type)38 HTMLAllCollection::HTMLAllCollection(ContainerNode& node, CollectionType type) 39 39 : HTMLCollection(node, type, DoesNotOverrideItemAfter) 40 40 { -
trunk/Source/WebCore/html/HTMLAllCollection.h
r157065 r158540 33 33 class HTMLAllCollection : public HTMLCollection { 34 34 public: 35 static PassRefPtr<HTMLAllCollection> create( Node&, CollectionType);35 static PassRefPtr<HTMLAllCollection> create(ContainerNode&, CollectionType); 36 36 virtual ~HTMLAllCollection(); 37 37 … … 39 39 40 40 private: 41 HTMLAllCollection( Node&, CollectionType);41 HTMLAllCollection(ContainerNode&, CollectionType); 42 42 }; 43 43 -
trunk/Source/WebCore/html/HTMLCollection.cpp
r158536 r158540 156 156 } 157 157 158 HTMLCollection::HTMLCollection( Node& ownerNode, CollectionType type, ItemAfterOverrideType itemAfterOverrideType)158 HTMLCollection::HTMLCollection(ContainerNode& ownerNode, CollectionType type, ItemAfterOverrideType itemAfterOverrideType) 159 159 : LiveNodeListBase(ownerNode, rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), 160 160 WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideType) … … 162 162 } 163 163 164 PassRefPtr<HTMLCollection> HTMLCollection::create( Node& base, CollectionType type)164 PassRefPtr<HTMLCollection> HTMLCollection::create(ContainerNode& base, CollectionType type) 165 165 { 166 166 return adoptRef(new HTMLCollection(base, type, DoesNotOverrideItemAfter)); … … 391 391 return 0; 392 392 393 ContainerNode* root = rootContainerNode(); 394 if (!root) { 395 // FIMXE: In someTextNode.childNodes case the root is Text. We shouldn't even make a LiveNodeList for that. 396 setLengthCache(0); 397 return 0; 398 } 393 ContainerNode& root = rootNode(); 399 394 400 395 if (isLengthCacheValid() && !overridesItemAfter() && isLastItemCloserThanLastOrCachedItem(offset)) { … … 406 401 Node* firstItem; 407 402 if (isNodeList(type())) 408 firstItem = traverseLiveNodeListFirstElement( root);403 firstItem = traverseLiveNodeListFirstElement(&root); 409 404 else 410 firstItem = static_cast<const HTMLCollection*>(this)->traverseFirstElement(offsetInArray, root);405 firstItem = static_cast<const HTMLCollection*>(this)->traverseFirstElement(offsetInArray, &root); 411 406 412 407 if (!firstItem) { … … 421 416 return cachedItem(); 422 417 423 return itemBeforeOrAfterCachedItem(offset, root);418 return itemBeforeOrAfterCachedItem(offset, &root); 424 419 } 425 420 … … 544 539 // that are allowed a name attribute. 545 540 546 ContainerNode* root = rootContainerNode(); 547 if (name.isEmpty() || !root) 541 if (name.isEmpty()) 548 542 return 0; 549 543 550 if (!overridesItemAfter() && root->isInTreeScope()) { 551 TreeScope& treeScope = root->treeScope(); 544 ContainerNode& root = rootNode(); 545 if (!overridesItemAfter() && root.isInTreeScope()) { 546 TreeScope& treeScope = root.treeScope(); 552 547 Element* candidate = 0; 553 548 if (treeScope.hasElementWithId(*name.impl())) { … … 565 560 if (candidate 566 561 && isMatchingElement(this, candidate) 567 && (shouldOnlyIncludeDirectChildren() ? candidate->parentNode() == root : candidate->isDescendantOf(root)))562 && (shouldOnlyIncludeDirectChildren() ? candidate->parentNode() == &root : candidate->isDescendantOf(&root))) 568 563 return candidate; 569 564 } … … 590 585 return; 591 586 592 ContainerNode* root = rootContainerNode(); 593 if (!root) 594 return; 587 ContainerNode& root = rootNode(); 595 588 596 589 unsigned arrayOffset = 0; 597 for (Element* element = traverseFirstElement(arrayOffset, root); element; element = traverseNextElement(arrayOffset, element,root)) {590 for (Element* element = traverseFirstElement(arrayOffset, &root); element; element = traverseNextElement(arrayOffset, element, &root)) { 598 591 const AtomicString& idAttrVal = element->getIdAttribute(); 599 592 if (!idAttrVal.isEmpty()) -
trunk/Source/WebCore/html/HTMLCollection.h
r157653 r158540 35 35 class HTMLCollection : public LiveNodeListBase { 36 36 public: 37 static PassRefPtr<HTMLCollection> create( Node& base, CollectionType);37 static PassRefPtr<HTMLCollection> create(ContainerNode& base, CollectionType); 38 38 virtual ~HTMLCollection(); 39 39 … … 68 68 69 69 protected: 70 HTMLCollection( Node& base, CollectionType, ItemAfterOverrideType);70 HTMLCollection(ContainerNode& base, CollectionType, ItemAfterOverrideType); 71 71 72 72 virtual void updateNameCache() const; -
trunk/Source/WebCore/html/HTMLFormControlsCollection.cpp
r157357 r158540 37 37 // calculation every time if anything has changed. 38 38 39 HTMLFormControlsCollection::HTMLFormControlsCollection( Node& ownerNode)39 HTMLFormControlsCollection::HTMLFormControlsCollection(ContainerNode& ownerNode) 40 40 : HTMLCollection(ownerNode, FormControls, OverridesItemAfter) 41 41 { … … 43 43 } 44 44 45 PassRefPtr<HTMLFormControlsCollection> HTMLFormControlsCollection::create( Node& ownerNode, CollectionType)45 PassRefPtr<HTMLFormControlsCollection> HTMLFormControlsCollection::create(ContainerNode& ownerNode, CollectionType) 46 46 { 47 47 return adoptRef(new HTMLFormControlsCollection(ownerNode)); -
trunk/Source/WebCore/html/HTMLFormControlsCollection.h
r157065 r158540 38 38 class HTMLFormControlsCollection : public HTMLCollection { 39 39 public: 40 static PassRefPtr<HTMLFormControlsCollection> create( Node&, CollectionType);40 static PassRefPtr<HTMLFormControlsCollection> create(ContainerNode&, CollectionType); 41 41 42 42 virtual ~HTMLFormControlsCollection(); … … 45 45 46 46 private: 47 explicit HTMLFormControlsCollection( Node&);47 explicit HTMLFormControlsCollection(ContainerNode&); 48 48 49 49 virtual void updateNameCache() const; -
trunk/Source/WebCore/html/HTMLNameCollection.cpp
r157065 r158540 37 37 using namespace HTMLNames; 38 38 39 HTMLNameCollection::HTMLNameCollection( Node& document, CollectionType type, const AtomicString& name)39 HTMLNameCollection::HTMLNameCollection(ContainerNode& document, CollectionType type, const AtomicString& name) 40 40 : HTMLCollection(document, type, DoesNotOverrideItemAfter) 41 41 , m_name(name) -
trunk/Source/WebCore/html/HTMLNameCollection.h
r157065 r158540 37 37 38 38 protected: 39 HTMLNameCollection( Node&, CollectionType, const AtomicString& name);39 HTMLNameCollection(ContainerNode&, CollectionType, const AtomicString& name); 40 40 41 41 AtomicString m_name; … … 44 44 class WindowNameCollection : public HTMLNameCollection { 45 45 public: 46 static PassRefPtr<WindowNameCollection> create( Node& document, CollectionType type, const AtomicString& name)46 static PassRefPtr<WindowNameCollection> create(ContainerNode& document, CollectionType type, const AtomicString& name) 47 47 { 48 48 return adoptRef(new WindowNameCollection(document, type, name)); … … 56 56 57 57 private: 58 WindowNameCollection( Node& document, CollectionType type, const AtomicString& name)58 WindowNameCollection(ContainerNode& document, CollectionType type, const AtomicString& name) 59 59 : HTMLNameCollection(document, type, name) 60 60 { … … 65 65 class DocumentNameCollection : public HTMLNameCollection { 66 66 public: 67 static PassRefPtr<DocumentNameCollection> create( Node& document, CollectionType type, const AtomicString& name)67 static PassRefPtr<DocumentNameCollection> create(ContainerNode& document, CollectionType type, const AtomicString& name) 68 68 { 69 69 return adoptRef(new DocumentNameCollection(document, type, name)); … … 77 77 78 78 private: 79 DocumentNameCollection( Node& document, CollectionType type, const AtomicString& name)79 DocumentNameCollection(ContainerNode& document, CollectionType type, const AtomicString& name) 80 80 : HTMLNameCollection(document, type, name) 81 81 { -
trunk/Source/WebCore/html/HTMLOptionsCollection.cpp
r157065 r158540 28 28 namespace WebCore { 29 29 30 HTMLOptionsCollection::HTMLOptionsCollection( Node& select)30 HTMLOptionsCollection::HTMLOptionsCollection(ContainerNode& select) 31 31 : HTMLCollection(select, SelectOptions, DoesNotOverrideItemAfter) 32 32 { … … 34 34 } 35 35 36 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create( Node& select, CollectionType)36 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(ContainerNode& select, CollectionType) 37 37 { 38 38 return adoptRef(new HTMLOptionsCollection(select)); -
trunk/Source/WebCore/html/HTMLOptionsCollection.h
r157065 r158540 36 36 class HTMLOptionsCollection : public HTMLCollection { 37 37 public: 38 static PassRefPtr<HTMLOptionsCollection> create( Node&, CollectionType);38 static PassRefPtr<HTMLOptionsCollection> create(ContainerNode&, CollectionType); 39 39 40 40 void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&); … … 49 49 50 50 private: 51 explicit HTMLOptionsCollection( Node&);51 explicit HTMLOptionsCollection(ContainerNode&); 52 52 }; 53 53 -
trunk/Source/WebCore/html/LabelsNodeList.cpp
r157065 r158540 34 34 using namespace HTMLNames; 35 35 36 LabelsNodeList::LabelsNodeList( Node& forNode)36 LabelsNodeList::LabelsNodeList(ContainerNode& forNode) 37 37 : LiveNodeList(forNode, LabelsNodeListType, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) 38 38 { -
trunk/Source/WebCore/html/LabelsNodeList.h
r157065 r158540 33 33 class LabelsNodeList : public LiveNodeList { 34 34 public: 35 static PassRefPtr<LabelsNodeList> create( Node& forNode, CollectionType type, const AtomicString&)35 static PassRefPtr<LabelsNodeList> create(ContainerNode& forNode, CollectionType type, const AtomicString&) 36 36 { 37 37 ASSERT_UNUSED(type, type == LabelsNodeListType); … … 41 41 42 42 protected: 43 explicit LabelsNodeList( Node& forNode);43 explicit LabelsNodeList(ContainerNode& forNode); 44 44 45 45 virtual bool nodeMatches(Element*) const; -
trunk/Source/WebCore/html/MediaDocument.cpp
r156980 r158540 137 137 } 138 138 139 static inline HTMLVideoElement* descendentVideoElement(Node* node) 140 { 141 ASSERT(node); 142 143 if (node->hasTagName(videoTag)) 144 return toHTMLVideoElement(node); 145 146 RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName()); 139 static inline HTMLVideoElement* descendentVideoElement(ContainerNode& node) 140 { 141 if (isHTMLVideoElement(node)) 142 return toHTMLVideoElement(&node); 143 144 RefPtr<NodeList> nodeList = node.getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName()); 147 145 148 146 if (nodeList.get()->length() > 0) … … 182 180 } 183 181 182 if (!targetNode->isContainerNode()) 183 return; 184 ContainerNode& targetContainer = toContainerNode(*targetNode); 184 185 if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) { 185 HTMLVideoElement* video = descendentVideoElement(target Node);186 HTMLVideoElement* video = descendentVideoElement(targetContainer); 186 187 if (!video) 187 188 return; … … 219 220 htmlBody->setAttribute(marginheightAttr, "0"); 220 221 221 if (HTMLVideoElement* videoElement = descendentVideoElement( htmlBody)) {222 if (HTMLVideoElement* videoElement = descendentVideoElement(*htmlBody)) { 222 223 RefPtr<Element> element = Document::createElement(embedTag, false); 223 224 HTMLEmbedElement* embedElement = static_cast<HTMLEmbedElement*>(element.get()); -
trunk/Source/WebCore/html/RadioNodeList.cpp
r157065 r158540 38 38 using namespace HTMLNames; 39 39 40 RadioNodeList::RadioNodeList( Node& rootNode, const AtomicString& name)40 RadioNodeList::RadioNodeList(ContainerNode& rootNode, const AtomicString& name) 41 41 : LiveNodeList(rootNode, RadioNodeListType, InvalidateForFormControls, isHTMLFormElement(rootNode) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) 42 42 , m_name(name) -
trunk/Source/WebCore/html/RadioNodeList.h
r157065 r158540 35 35 class RadioNodeList : public LiveNodeList { 36 36 public: 37 static PassRefPtr<RadioNodeList> create( Node& rootNode, CollectionType type, const AtomicString& name)37 static PassRefPtr<RadioNodeList> create(ContainerNode& rootNode, CollectionType type, const AtomicString& name) 38 38 { 39 39 ASSERT_UNUSED(type, type == RadioNodeListType); … … 50 50 51 51 private: 52 RadioNodeList( Node&, const AtomicString& name);52 RadioNodeList(ContainerNode&, const AtomicString& name); 53 53 bool checkElementMatchesRadioNodeListFilter(Element*) const; 54 54
Note: See TracChangeset
for help on using the changeset viewer.