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

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

Issue 196653020: Revert 169289 "A thread-safe Media Query Parser" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/css/parser/MediaQueryToken.h"
7
8 #include "wtf/HashMap.h"
9 #include "wtf/text/StringHash.h"
10
11 namespace WebCore {
12
13
14 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type)
15 : m_type(type)
16 , m_delimiter(0)
17 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
18 {
19 }
20
21 // Just a helper used for Delimiter tokens.
22 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, UChar c)
23 : m_type(type)
24 , m_delimiter(c)
25 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
26 {
27 ASSERT(m_type == DelimiterToken);
28 }
29
30 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, String value)
31 : m_type(type)
32 , m_value(value)
33 , m_delimiter(0)
34 , m_unit(CSSPrimitiveValue::CSS_UNKNOWN)
35 {
36 }
37
38 MediaQueryToken::MediaQueryToken(MediaQueryTokenType type, double numericValue, NumericValueType numericValueType)
39 : m_type(type)
40 , m_delimiter(0)
41 , m_numericValueType(numericValueType)
42 , m_numericValue(numericValue)
43 , m_unit(CSSPrimitiveValue::CSS_NUMBER)
44 {
45 ASSERT(type == NumberToken);
46 }
47
48 void MediaQueryToken::convertToDimensionWithUnit(String unit)
49 {
50 ASSERT(m_type == NumberToken);
51 m_type = DimensionToken;
52 m_unit = CSSPrimitiveValue::getUnitTable().get(unit.lower());
53 }
54
55 void MediaQueryToken::convertToPercentage()
56 {
57 ASSERT(m_type == NumberToken);
58 m_type = PercentageToken;
59 m_unit = CSSPrimitiveValue::CSS_PERCENTAGE;
60 }
61
62 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/core/css/parser/MediaQueryToken.h ('k') | trunk/Source/core/css/parser/MediaQueryTokenizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698