| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) | 3 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class ClassCollection final : public HTMLCollection { | 39 class ClassCollection final : public HTMLCollection { |
| 40 public: | 40 public: |
| 41 // classNames argument is an AtomicString because it is common for Elements to | 41 // classNames argument is an AtomicString because it is common for Elements to |
| 42 // share the same class names. It is also used to construct a | 42 // share the same class names. It is also used to construct a |
| 43 // SpaceSplitString (m_classNames) and its constructor requires an | 43 // SpaceSplitString (m_classNames) and its constructor requires an |
| 44 // AtomicString. | 44 // AtomicString. |
| 45 static ClassCollection* create(ContainerNode& rootNode, | 45 static ClassCollection* create(ContainerNode& rootNode, |
| 46 CollectionType type, | 46 CollectionType type, |
| 47 const AtomicString& classNames) { | 47 const AtomicString& classNames) { |
| 48 ASSERT_UNUSED(type, type == ClassCollectionType); | 48 DCHECK_EQ(type, ClassCollectionType); |
| 49 return new ClassCollection(rootNode, classNames); | 49 return new ClassCollection(rootNode, classNames); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ~ClassCollection() override; | 52 ~ClassCollection() override; |
| 53 | 53 |
| 54 bool elementMatches(const Element&) const; | 54 bool elementMatches(const Element&) const; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 ClassCollection(ContainerNode& rootNode, const AtomicString& classNames); | 57 ClassCollection(ContainerNode& rootNode, const AtomicString& classNames); |
| 58 | 58 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 if (!testElement.hasClass()) | 70 if (!testElement.hasClass()) |
| 71 return false; | 71 return false; |
| 72 if (!m_classNames.size()) | 72 if (!m_classNames.size()) |
| 73 return false; | 73 return false; |
| 74 return testElement.classNames().containsAll(m_classNames); | 74 return testElement.classNames().containsAll(m_classNames); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace blink | 77 } // namespace blink |
| 78 | 78 |
| 79 #endif // ClassCollection_h | 79 #endif // ClassCollection_h |
| OLD | NEW |