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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleVariableData.h

Issue 1537523003: Add correct equality testing for ComputedStyle's StyleVariableData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
1 #ifndef StyleVariableData_h 5 #ifndef StyleVariableData_h
2 #define StyleVariableData_h 6 #define StyleVariableData_h
3 7
4 #include "core/css/CSSVariableData.h" 8 #include "core/css/CSSVariableData.h"
5 #include "wtf/Forward.h" 9 #include "wtf/Forward.h"
6 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
7 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
8 #include "wtf/text/AtomicStringHash.h" 12 #include "wtf/text/AtomicStringHash.h"
9 13
10 namespace blink { 14 namespace blink {
11 15
12 class StyleVariableData : public RefCounted<StyleVariableData> { 16 class StyleVariableData : public RefCounted<StyleVariableData> {
13 public: 17 public:
14 static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVar iableData()); } 18 static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVar iableData()); }
15 PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariab leData(*this)); } 19 PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariab leData(*this)); }
16 20
17 bool operator==(const StyleVariableData& other) const { return other.m_data == m_data; } 21 bool operator==(const StyleVariableData& other) const;
18 bool operator!=(const StyleVariableData& other) const { return !(*this == ot her); } 22 bool operator!=(const StyleVariableData& other) const { return !(*this == ot her); }
19 23
20 void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value ) { m_data.set(name, value); } 24 void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value ) { m_data.set(name, value); }
21 CSSVariableData* getVariable(const AtomicString& name) const { return m_data .get(name); } 25 CSSVariableData* getVariable(const AtomicString& name) const { return m_data .get(name); }
22 void removeVariable(const AtomicString& name) { return m_data.remove(name); } 26 void removeVariable(const AtomicString& name) { return m_data.remove(name); }
23 private: 27 private:
24 StyleVariableData() = default; 28 StyleVariableData() = default;
25 StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariable Data>(), m_data(other.m_data) { } 29 StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariable Data>(), m_data(other.m_data) { }
26 30
27 friend class CSSVariableResolver; 31 friend class CSSVariableResolver;
28 32
29 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data; 33 HashMap<AtomicString, RefPtr<CSSVariableData>> m_data;
30 }; 34 };
31 35
32 } // namespace blink 36 } // namespace blink
33 37
34 #endif // StyleVariableData_h 38 #endif // StyleVariableData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698