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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryExp.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 /* 1 /*
2 * CSS Media Query 2 * CSS Media Query
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 22 matching lines...) Expand all
33 #include "core/CoreExport.h" 33 #include "core/CoreExport.h"
34 #include "core/MediaFeatureNames.h" 34 #include "core/MediaFeatureNames.h"
35 #include "core/css/CSSPrimitiveValue.h" 35 #include "core/css/CSSPrimitiveValue.h"
36 #include "core/css/CSSValue.h" 36 #include "core/css/CSSValue.h"
37 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
38 #include "wtf/PassOwnPtr.h" 38 #include "wtf/PassOwnPtr.h"
39 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class CSSDeserializeStream;
43 class CSSParserToken; 44 class CSSParserToken;
45 class CSSSerializeStream;
44 46
45 struct MediaQueryExpValue { 47 struct MediaQueryExpValue {
46 DISALLOW_NEW(); 48 DISALLOW_NEW();
47 CSSValueID id; 49 CSSValueID id;
48 double value; 50 double value;
49 CSSPrimitiveValue::UnitType unit; 51 CSSPrimitiveValue::UnitType unit;
50 unsigned numerator; 52 unsigned numerator;
51 unsigned denominator; 53 unsigned denominator;
52 54
53 bool isID; 55 bool isID;
(...skipping 17 matching lines...) Expand all
71 bool equals(const MediaQueryExpValue& expValue) const 73 bool equals(const MediaQueryExpValue& expValue) const
72 { 74 {
73 if (isID) 75 if (isID)
74 return (id == expValue.id); 76 return (id == expValue.id);
75 if (isValue) 77 if (isValue)
76 return (value == expValue.value); 78 return (value == expValue.value);
77 if (isRatio) 79 if (isRatio)
78 return (numerator == expValue.numerator && denominator == expValue.d enominator); 80 return (numerator == expValue.numerator && denominator == expValue.d enominator);
79 return !expValue.isValid(); 81 return !expValue.isValid();
80 } 82 }
83
84 void serialize(CSSSerializeStream*) const;
85 static MediaQueryExpValue deserialize(CSSDeserializeStream*);
81 }; 86 };
82 87
83 class CORE_EXPORT MediaQueryExp : public NoBaseWillBeGarbageCollectedFinalized< MediaQueryExp> { 88 class CORE_EXPORT MediaQueryExp final : public NoBaseWillBeGarbageCollectedFinal ized<MediaQueryExp> {
84 USING_FAST_MALLOC_WILL_BE_REMOVED(MediaQueryExp); 89 USING_FAST_MALLOC_WILL_BE_REMOVED(MediaQueryExp);
85 public: 90 public:
86 static PassOwnPtrWillBeRawPtr<MediaQueryExp> createIfValid(const String& med iaFeature, const Vector<CSSParserToken, 4>&); 91 static PassOwnPtrWillBeRawPtr<MediaQueryExp> createIfValid(const String& med iaFeature, const Vector<CSSParserToken, 4>&);
92 static PassOwnPtrWillBeRawPtr<MediaQueryExp> deserialize(CSSDeserializeStrea m*);
87 ~MediaQueryExp(); 93 ~MediaQueryExp();
88 94
89 const String& mediaFeature() const { return m_mediaFeature; } 95 const String& mediaFeature() const { return m_mediaFeature; }
90 96
91 MediaQueryExpValue expValue() const { return m_expValue; } 97 MediaQueryExpValue expValue() const { return m_expValue; }
92 98
93 bool operator==(const MediaQueryExp& other) const; 99 bool operator==(const MediaQueryExp& other) const;
94 100
95 bool isViewportDependent() const; 101 bool isViewportDependent() const;
96 102
97 String serialize() const; 103 String serialize() const;
98 104
99 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo op(new MediaQueryExp(*this)); } 105 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo op(new MediaQueryExp(*this)); }
100 106
101 MediaQueryExp(const MediaQueryExp& other); 107 MediaQueryExp(const MediaQueryExp& other);
102 108
109 void serialize(CSSSerializeStream*) const;
110
103 DEFINE_INLINE_TRACE() { } 111 DEFINE_INLINE_TRACE() { }
104 112
105 private: 113 private:
106 MediaQueryExp(const String&, const MediaQueryExpValue&); 114 MediaQueryExp(const String&, const MediaQueryExpValue&);
107 115
108 String m_mediaFeature; 116 String m_mediaFeature;
109 MediaQueryExpValue m_expValue; 117 MediaQueryExpValue m_expValue;
110 }; 118 };
111 119
112 } // namespace 120 } // namespace
113 121
114 #endif 122 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQuery.cpp ('k') | third_party/WebKit/Source/core/css/MediaQueryExp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698