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

Side by Side Diff: third_party/WebKit/Source/core/dom/ClassCollection.h

Issue 2899243003: DOM: Fix an incorrect result of getElementsByClassName() in quirks mode. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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& root_node, const AtomicString& class_names); 57 ClassCollection(ContainerNode& root_node, const AtomicString& class_names);
58 58
59 SpaceSplitString class_names_; 59 SpaceSplitString class_names_;
60 AtomicString original_class_names_;
61 }; 60 };
62 61
63 DEFINE_TYPE_CASTS(ClassCollection, 62 DEFINE_TYPE_CASTS(ClassCollection,
64 LiveNodeListBase, 63 LiveNodeListBase,
65 collection, 64 collection,
66 collection->GetType() == kClassCollectionType, 65 collection->GetType() == kClassCollectionType,
67 collection.GetType() == kClassCollectionType); 66 collection.GetType() == kClassCollectionType);
68 67
69 inline bool ClassCollection::ElementMatches(const Element& test_element) const { 68 inline bool ClassCollection::ElementMatches(const Element& test_element) const {
70 if (!test_element.HasClass()) 69 if (!test_element.HasClass())
71 return false; 70 return false;
72 if (!class_names_.size()) 71 if (!class_names_.size())
73 return false; 72 return false;
74 return test_element.ClassNames().ContainsAll(class_names_); 73 return test_element.ClassNames().ContainsAll(class_names_);
75 } 74 }
76 75
77 } // namespace blink 76 } // namespace blink
78 77
79 #endif // ClassCollection_h 78 #endif // ClassCollection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698