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

Side by Side Diff: Source/core/css/parser/MediaQueryToken.cpp

Issue 225293006: Moved MQ parsing block tracking to tokenizer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unused member var Created 6 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
« no previous file with comments | « Source/core/css/parser/MediaQueryToken.h ('k') | Source/core/css/parser/MediaQueryTokenizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/MediaQueryToken.h" 6 #include "core/css/parser/MediaQueryToken.h"
7 7
8 #include "wtf/HashMap.h" 8 #include "wtf/HashMap.h"
9 #include "wtf/text/StringHash.h" 9 #include "wtf/text/StringHash.h"
10 #include <limits.h> 10 #include <limits.h>
11 11
12 namespace WebCore { 12 namespace WebCore {
13 13
14 14
15 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type) 15 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, BlockType blockType)
16 : m_type(type) 16 : m_type(type)
17 , m_delimiter(0) 17 , m_delimiter(0)
18 , m_numericValue(0) 18 , m_numericValue(0)
19 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN) 19 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
20 , m_blockType(blockType)
20 { 21 {
21 } 22 }
22 23
23 // Just a helper used for Delimiter tokens. 24 // Just a helper used for Delimiter tokens.
24 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, UChar c) 25 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, UChar c)
25 : m_type(type) 26 : m_type(type)
26 , m_delimiter(c) 27 , m_delimiter(c)
27 , m_numericValue(0) 28 , m_numericValue(0)
28 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN) 29 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
30 , m_blockType(NotBlock)
29 { 31 {
30 ASSERT(m_type == DelimiterToken); 32 ASSERT(m_type == DelimiterToken);
31 } 33 }
32 34
33 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, String value) 35 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, String value, BlockTy pe blockType)
34 : m_type(type) 36 : m_type(type)
35 , m_value(value) 37 , m_value(value)
36 , m_delimiter(0) 38 , m_delimiter(0)
37 , m_numericValue(0) 39 , m_numericValue(0)
38 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN) 40 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
41 , m_blockType(blockType)
39 { 42 {
40 } 43 }
41 44
42 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, double numericValue, NumericValueType numericValueType) 45 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, double numericValue, NumericValueType numericValueType)
43 : m_type(type) 46 : m_type(type)
44 , m_delimiter(0) 47 , m_delimiter(0)
45 , m_numericValueType(numericValueType) 48 , m_numericValueType(numericValueType)
46 , m_numericValue(numericValue) 49 , m_numericValue(numericValue)
47 , m_unit(CSSPrimitiveValue::CSS_NUMBER) 50 , m_unit(CSSPrimitiveValue::CSS_NUMBER)
51 , m_blockType(NotBlock)
48 { 52 {
49 ASSERT(type == NumberToken); 53 ASSERT(type == NumberToken);
50 } 54 }
51 55
52 void MediaQueryToken::convertToDimensionWithUnit(String unit) 56 void MediaQueryToken::convertToDimensionWithUnit(String unit)
53 { 57 {
54 ASSERT(m_type == NumberToken); 58 ASSERT(m_type == NumberToken);
55 m_type = DimensionToken; 59 m_type = DimensionToken;
56 m_unit = CSSPrimitiveValue::fromName(unit); 60 m_unit = CSSPrimitiveValue::fromName(unit);
57 } 61 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 sprintf(buffer, "%d%s", static_cast<int>(m_numericValue), unitBuffer ); 100 sprintf(buffer, "%d%s", static_cast<int>(m_numericValue), unitBuffer );
97 else 101 else
98 sprintf(buffer, "%f%s", m_numericValue, unitBuffer); 102 sprintf(buffer, "%f%s", m_numericValue, unitBuffer);
99 103
100 return String(buffer, strlen(buffer)); 104 return String(buffer, strlen(buffer));
101 } 105 }
102 return String(); 106 return String();
103 } 107 }
104 108
105 } // namespace WebCore 109 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/MediaQueryToken.h ('k') | Source/core/css/parser/MediaQueryTokenizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698