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

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 IdentToken:
93 case FunctionToken:
94 case StringToken:
95 case HashToken:
96 if (m_hashTokenType != other.m_hashTokenType)
Timothy Loh 2015/12/17 04:22:56 This is only really for HashTokens
shans 2015/12/17 05:14:14 my bad - I ordered the cases incorrectly.
97 return false;
98 // fallthrough
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:
Timothy Loh 2015/12/17 04:22:56 These also have a dimension (i.e. string) attached
shans 2015/12/17 05:14:14 that isn't just the numericValueType? Fixed, at an
106 case PercentageToken:
107 return m_numericValue == other.m_numericValue && m_numericValueType == other.m_numericValueType;
108 case UnicodeRangeToken:
109 return m_unicodeRange.start == other.m_unicodeRange.start && m_unico deRange.end == other.m_unicodeRange.end;
110 default:
111 return true;
112 }
113 }
114
85 // Converts NumberToken to DimensionToken. 115 // Converts NumberToken to DimensionToken.
86 void convertToDimensionWithUnit(CSSParserString); 116 void convertToDimensionWithUnit(CSSParserString);
87 117
88 // Converts NumberToken to PercentageToken. 118 // Converts NumberToken to PercentageToken.
89 void convertToPercentage(); 119 void convertToPercentage();
90 120
91 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); } 121 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); }
92 CSSParserString value() const 122 CSSParserString value() const
93 { 123 {
94 CSSParserString ret; 124 CSSParserString ret;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 183
154 namespace WTF { 184 namespace WTF {
155 template <> 185 template <>
156 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { 186 struct IsTriviallyMoveAssignable<blink::CSSParserToken> {
157 STATIC_ONLY(IsTriviallyMoveAssignable); 187 STATIC_ONLY(IsTriviallyMoveAssignable);
158 static const bool value = true; 188 static const bool value = true;
159 }; 189 };
160 } 190 }
161 191
162 #endif // CSSSParserToken_h 192 #endif // CSSSParserToken_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698