| 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 * | 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 else if (isElementNode() && toElement(this)->childrenAffectedByHover()) | 908 else if (isElementNode() && toElement(this)->childrenAffectedByHover()) |
| 909 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 909 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
| 910 else if (renderStyle()->affectedByHover()) | 910 else if (renderStyle()->affectedByHover()) |
| 911 setNeedsStyleRecalc(LocalStyleChange); | 911 setNeedsStyleRecalc(LocalStyleChange); |
| 912 } | 912 } |
| 913 | 913 |
| 914 if (renderer()->style()->hasAppearance()) | 914 if (renderer()->style()->hasAppearance()) |
| 915 RenderTheme::theme().stateChanged(renderer(), HoverControlState); | 915 RenderTheme::theme().stateChanged(renderer(), HoverControlState); |
| 916 } | 916 } |
| 917 | 917 |
| 918 PassRefPtr<HTMLCollection> ContainerNode::children() | 918 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::children() |
| 919 { | 919 { |
| 920 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); | 920 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); |
| 921 } | 921 } |
| 922 | 922 |
| 923 unsigned ContainerNode::countChildren() const | 923 unsigned ContainerNode::countChildren() const |
| 924 { | 924 { |
| 925 unsigned count = 0; | 925 unsigned count = 0; |
| 926 Node *n; | 926 Node *n; |
| 927 for (n = firstChild(); n; n = n->nextSibling()) | 927 for (n = firstChild(); n; n = n->nextSibling()) |
| 928 count++; | 928 count++; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 944 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 944 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
| 945 return nullptr; | 945 return nullptr; |
| 946 } | 946 } |
| 947 | 947 |
| 948 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 948 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
| 949 if (!selectorQuery) | 949 if (!selectorQuery) |
| 950 return nullptr; | 950 return nullptr; |
| 951 return selectorQuery->queryFirst(*this); | 951 return selectorQuery->queryFirst(*this); |
| 952 } | 952 } |
| 953 | 953 |
| 954 PassRefPtr<NodeList> ContainerNode::querySelectorAll(const AtomicString& selecto
rs, ExceptionState& exceptionState) | 954 PassRefPtrWillBeRawPtr<NodeList> ContainerNode::querySelectorAll(const AtomicStr
ing& selectors, ExceptionState& exceptionState) |
| 955 { | 955 { |
| 956 if (selectors.isEmpty()) { | 956 if (selectors.isEmpty()) { |
| 957 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 957 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
| 958 return nullptr; | 958 return nullptr; |
| 959 } | 959 } |
| 960 | 960 |
| 961 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 961 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
| 962 if (!selectorQuery) | 962 if (!selectorQuery) |
| 963 return nullptr; | 963 return nullptr; |
| 964 return selectorQuery->queryAll(*this); | 964 return selectorQuery->queryAll(*this); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 // The + selector. We need to invalidate the first element following the ins
ertion point. It is the only possible element | 1141 // The + selector. We need to invalidate the first element following the ins
ertion point. It is the only possible element |
| 1142 // that could be affected by this DOM change. | 1142 // that could be affected by this DOM change. |
| 1143 if (childrenAffectedByDirectAdjacentRules() && afterChange) { | 1143 if (childrenAffectedByDirectAdjacentRules() && afterChange) { |
| 1144 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : ElementTraversal::nextSibling(*afterChange)) | 1144 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : ElementTraversal::nextSibling(*afterChange)) |
| 1145 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); | 1145 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); |
| 1146 } | 1146 } |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin
g& localName) | 1149 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByTagName(const
AtomicString& localName) |
| 1150 { | 1150 { |
| 1151 if (localName.isNull()) | 1151 if (localName.isNull()) |
| 1152 return nullptr; | 1152 return nullptr; |
| 1153 | 1153 |
| 1154 if (document().isHTMLDocument()) | 1154 if (document().isHTMLDocument()) |
| 1155 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t
his, HTMLTagCollectionType, localName); | 1155 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t
his, HTMLTagCollectionType, localName); |
| 1156 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag
CollectionType, localName); | 1156 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag
CollectionType, localName); |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr
ing& namespaceURI, const AtomicString& localName) | 1159 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(con
st AtomicString& namespaceURI, const AtomicString& localName) |
| 1160 { | 1160 { |
| 1161 if (localName.isNull()) | 1161 if (localName.isNull()) |
| 1162 return nullptr; | 1162 return nullptr; |
| 1163 | 1163 |
| 1164 if (namespaceURI == starAtom) | 1164 if (namespaceURI == starAtom) |
| 1165 return getElementsByTagName(localName); | 1165 return getElementsByTagName(localName); |
| 1166 | 1166 |
| 1167 return ensureRareData().ensureNodeLists().addCache(*this, namespaceURI.isEmp
ty() ? nullAtom : namespaceURI, localName); | 1167 return ensureRareData().ensureNodeLists().addCache(*this, namespaceURI.isEmp
ty() ? nullAtom : namespaceURI, localName); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. | 1170 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. |
| 1171 // Therefore, the NameNodeList factory function expects an AtomicString type. | 1171 // Therefore, the NameNodeList factory function expects an AtomicString type. |
| 1172 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
tName) | 1172 PassRefPtrWillBeRawPtr<NodeList> ContainerNode::getElementsByName(const AtomicSt
ring& elementName) |
| 1173 { | 1173 { |
| 1174 return ensureRareData().ensureNodeLists().addCache<NameNodeList>(*this, Name
NodeListType, elementName); | 1174 return ensureRareData().ensureNodeLists().addCache<NameNodeList>(*this, Name
NodeListType, elementName); |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. | 1177 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. |
| 1178 // Therefore, the ClassNodeList factory function expects an AtomicString type. | 1178 // Therefore, the ClassNodeList factory function expects an AtomicString type. |
| 1179 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr
ing& classNames) | 1179 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByClassName(con
st AtomicString& classNames) |
| 1180 { | 1180 { |
| 1181 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C
lassCollectionType, classNames); | 1181 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C
lassCollectionType, classNames); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name,
bool onlyMatchImgElements) | 1184 PassRefPtrWillBeRawPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicS
tring& name, bool onlyMatchImgElements) |
| 1185 { | 1185 { |
| 1186 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); | 1186 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); |
| 1187 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | 1187 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; |
| 1188 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ
e, name); | 1188 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ
e, name); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 Element* ContainerNode::getElementById(const AtomicString& id) const | 1191 Element* ContainerNode::getElementById(const AtomicString& id) const |
| 1192 { | 1192 { |
| 1193 if (isInTreeScope()) { | 1193 if (isInTreeScope()) { |
| 1194 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope | 1194 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1218 return true; | 1218 return true; |
| 1219 | 1219 |
| 1220 if (node->isElementNode() && toElement(node)->shadow()) | 1220 if (node->isElementNode() && toElement(node)->shadow()) |
| 1221 return true; | 1221 return true; |
| 1222 | 1222 |
| 1223 return false; | 1223 return false; |
| 1224 } | 1224 } |
| 1225 #endif | 1225 #endif |
| 1226 | 1226 |
| 1227 } // namespace WebCore | 1227 } // namespace WebCore |
| OLD | NEW |