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

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

Issue 1905163003: Fix CSSParserToken::operator== for NumberTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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 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 86
118 // Converts NumberToken to DimensionToken. 87 // Converts NumberToken to DimensionToken.
119 void convertToDimensionWithUnit(CSSParserString); 88 void convertToDimensionWithUnit(CSSParserString);
120 89
121 // Converts NumberToken to PercentageToken. 90 // Converts NumberToken to PercentageToken.
122 void convertToPercentage(); 91 void convertToPercentage();
123 92
124 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); } 93 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t ype); }
125 CSSParserString value() const 94 CSSParserString value() const
126 { 95 {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 156
188 namespace WTF { 157 namespace WTF {
189 template <> 158 template <>
190 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { 159 struct IsTriviallyMoveAssignable<blink::CSSParserToken> {
191 STATIC_ONLY(IsTriviallyMoveAssignable); 160 STATIC_ONLY(IsTriviallyMoveAssignable);
192 static const bool value = true; 161 static const bool value = true;
193 }; 162 };
194 } 163 }
195 164
196 #endif // CSSSParserToken_h 165 #endif // CSSSParserToken_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698