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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSCustomIdentValue.h

Issue 1481383002: [Experimental] CSSSerializer Proof-of-concept Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: snapshot: top_25 sites ser/dser now works Created 4 years, 11 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 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CSSCustomIdentValue_h 5 #ifndef CSSCustomIdentValue_h
6 #define CSSCustomIdentValue_h 6 #define CSSCustomIdentValue_h
7 7
8 #include "core/CSSPropertyNames.h" 8 #include "core/CSSPropertyNames.h"
9 #include "core/css/CSSValue.h" 9 #include "core/css/CSSValue.h"
10 #include "wtf/PassRefPtr.h" 10 #include "wtf/PassRefPtr.h"
11 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class CSSCustomIdentValue : public CSSValue { 15 class CSSCustomIdentValue : public CSSValue {
16 public: 16 public:
17 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(const String& str) 17 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(const String& str)
18 { 18 {
19 return adoptRefWillBeNoop(new CSSCustomIdentValue(str)); 19 return adoptRefWillBeNoop(new CSSCustomIdentValue(str));
20 } 20 }
21 21
22 // TODO(sashab, timloh): Remove this and lazily parse the CSSPropertyID in i sKnownPropertyID(). 22 // TODO(sashab, timloh): Remove this and lazily parse the CSSPropertyID in i sKnownPropertyID().
23 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(CSSPropertyID id) 23 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(CSSPropertyID id)
24 { 24 {
25 return adoptRefWillBeNoop(new CSSCustomIdentValue(id)); 25 return adoptRefWillBeNoop(new CSSCustomIdentValue(id));
26 } 26 }
27 27
28 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> deserializeAfterDispatch( CSSDeserializeStream*);
29
28 String value() const { ASSERT(!isKnownPropertyID()); return m_string; } 30 String value() const { ASSERT(!isKnownPropertyID()); return m_string; }
29 bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; } 31 bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; }
30 CSSPropertyID valueAsPropertyID() const { ASSERT(isKnownPropertyID()); retur n m_propertyId; } 32 CSSPropertyID valueAsPropertyID() const { ASSERT(isKnownPropertyID()); retur n m_propertyId; }
31 33
32 String customCSSText() const; 34 String customCSSText() const;
33 35
34 bool equals(const CSSCustomIdentValue& other) const 36 bool equals(const CSSCustomIdentValue& other) const
35 { 37 {
36 return isKnownPropertyID() ? m_propertyId == other.m_propertyId : m_stri ng == other.m_string; 38 return isKnownPropertyID() ? m_propertyId == other.m_propertyId : m_stri ng == other.m_string;
37 } 39 }
38 40
41 void serializeAfterDispatch(CSSSerializeStream*) const;
39 DECLARE_TRACE_AFTER_DISPATCH(); 42 DECLARE_TRACE_AFTER_DISPATCH();
40 43
41 private: 44 private:
42 CSSCustomIdentValue(const String&); 45 CSSCustomIdentValue(const String&);
43 CSSCustomIdentValue(CSSPropertyID); 46 CSSCustomIdentValue(CSSPropertyID);
44 47
45 // TODO(sashab): Change this to an AtomicString. 48 // TODO(sashab): Change this to an AtomicString.
46 String m_string; 49 String m_string;
47 CSSPropertyID m_propertyId; 50 CSSPropertyID m_propertyId;
48 }; 51 };
49 52
50 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); 53 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue());
51 54
52 } // namespace blink 55 } // namespace blink
53 56
54 #endif // CSSCustomIdentValue_h 57 #endif // CSSCustomIdentValue_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCounterValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSCustomIdentValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698