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

Side by Side Diff: Source/core/dom/ClassNodeList.h

Issue 112843002: Make calls to AtomicString(const String&) explicit in dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 21 matching lines...) Expand all
32 32
33 #include "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/dom/LiveNodeList.h" 34 #include "core/dom/LiveNodeList.h"
35 #include "core/dom/Node.h" 35 #include "core/dom/Node.h"
36 #include "core/dom/SpaceSplitString.h" 36 #include "core/dom/SpaceSplitString.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 class ClassNodeList FINAL : public LiveNodeList { 40 class ClassNodeList FINAL : public LiveNodeList {
41 public: 41 public:
42 static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const Str ing& classNames) 42 static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, Collectio nType type, const AtomicString& classNames)
eseidel 2013/12/15 16:51:26 Odd that this would be AtomicString? I guess it's
Inactive 2013/12/16 14:26:27 Yes, I found it a bit weird as well. However, it d
eseidel 2013/12/30 17:19:27 I guess it's common for many elements to share the
43 { 43 {
44 ASSERT_UNUSED(type, type == ClassNodeListType);
44 return adoptRef(new ClassNodeList(rootNode, classNames)); 45 return adoptRef(new ClassNodeList(rootNode, classNames));
45 } 46 }
46 47
47 virtual ~ClassNodeList(); 48 virtual ~ClassNodeList();
48 49
49 bool nodeMatchesInlined(Element*) const; 50 bool nodeMatchesInlined(Element*) const;
50 51
51 private: 52 private:
52 ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames); 53 ClassNodeList(PassRefPtr<Node> rootNode, const AtomicString& classNames);
53 54
54 virtual bool nodeMatches(Element*) const OVERRIDE; 55 virtual bool nodeMatches(Element*) const OVERRIDE;
55 56
56 SpaceSplitString m_classNames; 57 SpaceSplitString m_classNames;
Inactive 2013/12/16 14:26:27 See this member.
57 String m_originalClassNames; 58 AtomicString m_originalClassNames;
58 }; 59 };
59 60
60 inline bool ClassNodeList::nodeMatchesInlined(Element* testNode) const 61 inline bool ClassNodeList::nodeMatchesInlined(Element* testNode) const
61 { 62 {
62 if (!testNode->hasClass()) 63 if (!testNode->hasClass())
63 return false; 64 return false;
64 if (!m_classNames.size()) 65 if (!m_classNames.size())
65 return false; 66 return false;
66 // FIXME: DOM4 allows getElementsByClassName to return non StyledElement. 67 // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
67 // https://bugs.webkit.org/show_bug.cgi?id=94718 68 // https://bugs.webkit.org/show_bug.cgi?id=94718
68 if (!testNode->isStyledElement()) 69 if (!testNode->isStyledElement())
69 return false; 70 return false;
70 return testNode->classNames().containsAll(m_classNames); 71 return testNode->classNames().containsAll(m_classNames);
71 } 72 }
72 73
73 } // namespace WebCore 74 } // namespace WebCore
74 75
75 #endif // ClassNodeList_h 76 #endif // ClassNodeList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698