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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserToken.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CSSParserToken_h 5 #ifndef CSSParserToken_h
6 #define CSSParserToken_h 6 #define CSSParserToken_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/parser/CSSParserString.h" 10 #include "core/css/parser/CSSParserString.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 CSSParserToken(CSSParserTokenType, BlockType = NotBlock); 76 CSSParserToken(CSSParserTokenType, BlockType = NotBlock);
77 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock); 77 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock);
78 78
79 CSSParserToken(CSSParserTokenType, UChar); // for DelimiterToken 79 CSSParserToken(CSSParserTokenType, UChar); // for DelimiterToken
80 CSSParserToken(CSSParserTokenType, double, NumericValueType, NumericSign); / / for NumberToken 80 CSSParserToken(CSSParserTokenType, double, NumericValueType, NumericSign); / / for NumberToken
81 CSSParserToken(CSSParserTokenType, UChar32, UChar32); // for UnicodeRangeTok en 81 CSSParserToken(CSSParserTokenType, UChar32, UChar32); // for UnicodeRangeTok en
82 82
83 CSSParserToken(HashTokenType, CSSParserString); 83 CSSParserToken(HashTokenType, CSSParserString);
84 84
85 bool operator==(const CSSParserToken& other) const
86 {
87 if (m_type != other.m_type)
88 return false;
89 switch (m_type) {
90 case DelimiterToken:
91 return delimiter() == other.delimiter();
92 case HashToken:
93 if (m_hashTokenType != other.m_hashTokenType)
94 return false;
95 // fallthrough
96 case IdentToken:
97 case FunctionToken:
98 case StringToken:
99 case UrlToken:
100 return m_valueDataCharRaw == other.m_valueDataCharRaw && m_valueLeng th == other.m_valueLength && m_valueIs8Bit == other.m_valueIs8Bit;
101 case NumberToken:
102 if (m_numericSign != other.m_numericSign)
103 return false;
104 // fallthrough
105 case DimensionToken:
106 if (m_valueDataCharRaw != other.m_valueDataCharRaw || m_valueLength != other.m_valueLength || m_valueIs8Bit != other.m_valueIs8Bit)
107 return false;
108 // fallthrough
109 case PercentageToken:
110 return m_numericValue == other.m_numericValue && m_numericValueType == other.m_numericValueType;
111 case UnicodeRangeToken:
112 return m_unicodeRange.start == other.m_unicodeRange.start && m_unico deRange.end == other.m_unicodeRange.end;
113 default:
114 return true;
115 }
116 }
117
85 // Converts NumberToken to DimensionToken. 118 // Converts NumberToken to DimensionToken.
86 void convertToDimensionWithUnit(CSSParserString); 119 void convertToDimensionWithUnit(CSSParserString);
87 120
88 // Converts NumberToken to PercentageToken. 121 // Converts NumberToken to PercentageToken.
89 void convertToPercentage(); 122 void convertToPercentage();
90 123
91 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); } 124 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); }
92 CSSParserString value() const 125 CSSParserString value() const
93 { 126 {
94 CSSParserString ret; 127 CSSParserString ret;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 186
154 namespace WTF { 187 namespace WTF {
155 template <> 188 template <>
156 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { 189 struct IsTriviallyMoveAssignable<blink::CSSParserToken> {
157 STATIC_ONLY(IsTriviallyMoveAssignable); 190 STATIC_ONLY(IsTriviallyMoveAssignable);
158 static const bool value = true; 191 static const bool value = true;
159 }; 192 };
160 } 193 }
161 194
162 #endif // CSSSParserToken_h 195 #endif // CSSSParserToken_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698