| 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 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 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 28 matching lines...) Expand all Loading... |
| 39 #include "platform/wtf/HashSet.h" | 39 #include "platform/wtf/HashSet.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 using namespace HTMLNames; | 43 using namespace HTMLNames; |
| 44 | 44 |
| 45 static bool ShouldTypeOnlyIncludeDirectChildren(CollectionType type) { | 45 static bool ShouldTypeOnlyIncludeDirectChildren(CollectionType type) { |
| 46 switch (type) { | 46 switch (type) { |
| 47 case kClassCollectionType: | 47 case kClassCollectionType: |
| 48 case kTagCollectionType: | 48 case kTagCollectionType: |
| 49 case kTagCollectionNSType: |
| 49 case kHTMLTagCollectionType: | 50 case kHTMLTagCollectionType: |
| 50 case kDocAll: | 51 case kDocAll: |
| 51 case kDocAnchors: | 52 case kDocAnchors: |
| 52 case kDocApplets: | 53 case kDocApplets: |
| 53 case kDocEmbeds: | 54 case kDocEmbeds: |
| 54 case kDocForms: | 55 case kDocForms: |
| 55 case kDocImages: | 56 case kDocImages: |
| 56 case kDocLinks: | 57 case kDocLinks: |
| 57 case kDocScripts: | 58 case kDocScripts: |
| 58 case kDocumentNamedItems: | 59 case kDocumentNamedItems: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 88 case kDocForms: | 89 case kDocForms: |
| 89 case kDocLinks: | 90 case kDocLinks: |
| 90 case kDocAnchors: | 91 case kDocAnchors: |
| 91 case kDocScripts: | 92 case kDocScripts: |
| 92 case kDocAll: | 93 case kDocAll: |
| 93 case kWindowNamedItems: | 94 case kWindowNamedItems: |
| 94 case kDocumentNamedItems: | 95 case kDocumentNamedItems: |
| 95 return NodeListRootType::kTreeScope; | 96 return NodeListRootType::kTreeScope; |
| 96 case kClassCollectionType: | 97 case kClassCollectionType: |
| 97 case kTagCollectionType: | 98 case kTagCollectionType: |
| 99 case kTagCollectionNSType: |
| 98 case kHTMLTagCollectionType: | 100 case kHTMLTagCollectionType: |
| 99 case kNodeChildren: | 101 case kNodeChildren: |
| 100 case kTableTBodies: | 102 case kTableTBodies: |
| 101 case kTSectionRows: | 103 case kTSectionRows: |
| 102 case kTableRows: | 104 case kTableRows: |
| 103 case kTRCells: | 105 case kTRCells: |
| 104 case kSelectOptions: | 106 case kSelectOptions: |
| 105 case kSelectedOptions: | 107 case kSelectedOptions: |
| 106 case kDataListOptions: | 108 case kDataListOptions: |
| 107 case kMapAreas: | 109 case kMapAreas: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 118 break; | 120 break; |
| 119 } | 121 } |
| 120 NOTREACHED(); | 122 NOTREACHED(); |
| 121 return NodeListRootType::kNode; | 123 return NodeListRootType::kNode; |
| 122 } | 124 } |
| 123 | 125 |
| 124 static NodeListInvalidationType InvalidationTypeExcludingIdAndNameAttributes( | 126 static NodeListInvalidationType InvalidationTypeExcludingIdAndNameAttributes( |
| 125 CollectionType type) { | 127 CollectionType type) { |
| 126 switch (type) { | 128 switch (type) { |
| 127 case kTagCollectionType: | 129 case kTagCollectionType: |
| 130 case kTagCollectionNSType: |
| 128 case kHTMLTagCollectionType: | 131 case kHTMLTagCollectionType: |
| 129 case kDocImages: | 132 case kDocImages: |
| 130 case kDocEmbeds: | 133 case kDocEmbeds: |
| 131 case kDocForms: | 134 case kDocForms: |
| 132 case kDocScripts: | 135 case kDocScripts: |
| 133 case kDocAll: | 136 case kDocAll: |
| 134 case kNodeChildren: | 137 case kNodeChildren: |
| 135 case kTableTBodies: | 138 case kTableTBodies: |
| 136 case kTSectionRows: | 139 case kTSectionRows: |
| 137 case kTableRows: | 140 case kTableRows: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 case kDocLinks: | 240 case kDocLinks: |
| 238 return (element.HasTagName(aTag) || element.HasTagName(areaTag)) && | 241 return (element.HasTagName(aTag) || element.HasTagName(areaTag)) && |
| 239 element.FastHasAttribute(hrefAttr); | 242 element.FastHasAttribute(hrefAttr); |
| 240 case kDocAnchors: | 243 case kDocAnchors: |
| 241 return element.HasTagName(aTag) && element.FastHasAttribute(nameAttr); | 244 return element.HasTagName(aTag) && element.FastHasAttribute(nameAttr); |
| 242 case kFormControls: | 245 case kFormControls: |
| 243 DCHECK(isHTMLFieldSetElement(html_collection.ownerNode())); | 246 DCHECK(isHTMLFieldSetElement(html_collection.ownerNode())); |
| 244 return isHTMLObjectElement(element) || IsHTMLFormControlElement(element); | 247 return isHTMLObjectElement(element) || IsHTMLFormControlElement(element); |
| 245 case kClassCollectionType: | 248 case kClassCollectionType: |
| 246 case kTagCollectionType: | 249 case kTagCollectionType: |
| 250 case kTagCollectionNSType: |
| 247 case kHTMLTagCollectionType: | 251 case kHTMLTagCollectionType: |
| 248 case kDocAll: | 252 case kDocAll: |
| 249 case kNodeChildren: | 253 case kNodeChildren: |
| 250 case kTableRows: | 254 case kTableRows: |
| 251 case kWindowNamedItems: | 255 case kWindowNamedItems: |
| 252 case kNameNodeListType: | 256 case kNameNodeListType: |
| 253 case kRadioNodeListType: | 257 case kRadioNodeListType: |
| 254 case kRadioImgNodeListType: | 258 case kRadioImgNodeListType: |
| 255 case kLabelsNodeListType: | 259 case kLabelsNodeListType: |
| 256 NOTREACHED(); | 260 NOTREACHED(); |
| 257 } | 261 } |
| 258 return false; | 262 return false; |
| 259 } | 263 } |
| 260 | 264 |
| 261 inline bool HTMLCollection::ElementMatches(const Element& element) const { | 265 inline bool HTMLCollection::ElementMatches(const Element& element) const { |
| 262 // These collections apply to any kind of Elements, not just HTMLElements. | 266 // These collections apply to any kind of Elements, not just HTMLElements. |
| 263 switch (GetType()) { | 267 switch (GetType()) { |
| 264 case kDocAll: | 268 case kDocAll: |
| 265 case kNodeChildren: | 269 case kNodeChildren: |
| 266 return true; | 270 return true; |
| 267 case kClassCollectionType: | 271 case kClassCollectionType: |
| 268 return ToClassCollection(*this).ElementMatches(element); | 272 return ToClassCollection(*this).ElementMatches(element); |
| 269 case kTagCollectionType: | 273 case kTagCollectionType: |
| 270 return ToTagCollection(*this).ElementMatches(element); | 274 return ToTagCollection(*this).ElementMatches(element); |
| 271 case kHTMLTagCollectionType: | 275 case kHTMLTagCollectionType: |
| 272 return ToHTMLTagCollection(*this).ElementMatches(element); | 276 return ToHTMLTagCollection(*this).ElementMatches(element); |
| 277 case kTagCollectionNSType: |
| 278 return ToTagCollectionNS(*this).ElementMatches(element); |
| 273 case kWindowNamedItems: | 279 case kWindowNamedItems: |
| 274 return ToWindowNameCollection(*this).ElementMatches(element); | 280 return ToWindowNameCollection(*this).ElementMatches(element); |
| 275 default: | 281 default: |
| 276 break; | 282 break; |
| 277 } | 283 } |
| 278 | 284 |
| 279 // The following only applies to HTMLElements. | 285 // The following only applies to HTMLElements. |
| 280 return element.IsHTMLElement() && | 286 return element.IsHTMLElement() && |
| 281 IsMatchingHTMLElement(*this, ToHTMLElement(element)); | 287 IsMatchingHTMLElement(*this, ToHTMLElement(element)); |
| 282 } | 288 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 525 |
| 520 HTMLCollection::NamedItemCache::NamedItemCache() {} | 526 HTMLCollection::NamedItemCache::NamedItemCache() {} |
| 521 | 527 |
| 522 DEFINE_TRACE(HTMLCollection) { | 528 DEFINE_TRACE(HTMLCollection) { |
| 523 visitor->Trace(named_item_cache_); | 529 visitor->Trace(named_item_cache_); |
| 524 visitor->Trace(collection_items_cache_); | 530 visitor->Trace(collection_items_cache_); |
| 525 LiveNodeListBase::Trace(visitor); | 531 LiveNodeListBase::Trace(visitor); |
| 526 } | 532 } |
| 527 | 533 |
| 528 } // namespace blink | 534 } // namespace blink |
| OLD | NEW |