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

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

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 #include "core/css/CSSCustomIdentValue.h" 5 #include "core/css/CSSCustomIdentValue.h"
6 6
7 #include "core/css/CSSMarkup.h" 7 #include "core/css/CSSMarkup.h"
8 #include "core/css/serializer/CSSDeserializeStream.h"
9 #include "core/css/serializer/CSSSerializeStream.h"
8 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
9 11
10 namespace blink { 12 namespace blink {
11 13
14 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> CSSCustomIdentValue::deserializeAfte rDispatch(CSSDeserializeStream* stream)
15 {
16 String str = stream->readString();
17 CSSPropertyID propertyId = static_cast<CSSPropertyID>(stream->readUnsigned() );
18 if (propertyId != CSSPropertyInvalid) {
19 return create(propertyId);
20 }
21 return create(str);
22 }
23
12 CSSCustomIdentValue::CSSCustomIdentValue(const String& str) 24 CSSCustomIdentValue::CSSCustomIdentValue(const String& str)
13 : CSSValue(CustomIdentClass) 25 : CSSValue(CustomIdentClass)
14 , m_string(str) 26 , m_string(str)
15 , m_propertyId(CSSPropertyInvalid) { } 27 , m_propertyId(CSSPropertyInvalid) { }
16 28
17 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id) 29 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id)
18 : CSSValue(CustomIdentClass) 30 : CSSValue(CustomIdentClass)
19 , m_string() 31 , m_string()
20 , m_propertyId(id) 32 , m_propertyId(id)
21 { 33 {
22 ASSERT(isKnownPropertyID()); 34 ASSERT(isKnownPropertyID());
23 } 35 }
24 36
25
26 String CSSCustomIdentValue::customCSSText() const 37 String CSSCustomIdentValue::customCSSText() const
27 { 38 {
28 if (isKnownPropertyID()) 39 if (isKnownPropertyID())
29 return getPropertyNameAtomicString(m_propertyId); 40 return getPropertyNameAtomicString(m_propertyId);
30 return quoteCSSStringIfNeeded(m_string); 41 return quoteCSSStringIfNeeded(m_string);
31 } 42 }
32 43
44 void CSSCustomIdentValue::serializeAfterDispatch(CSSSerializeStream* stream) con st
45 {
46 stream->writeString(m_string);
47 stream->writeUnsigned(m_propertyId);
48 }
49
33 DEFINE_TRACE_AFTER_DISPATCH(CSSCustomIdentValue) 50 DEFINE_TRACE_AFTER_DISPATCH(CSSCustomIdentValue)
34 { 51 {
35 CSSValue::traceAfterDispatch(visitor); 52 CSSValue::traceAfterDispatch(visitor);
36 } 53 }
37 54
38 } // namespace blink 55 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCustomIdentValue.h ('k') | third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698