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

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

Issue 240453010: Avoid use of CSSValue in MediaQueryExp and MediaQueryEvaluator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix previous patch 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/MediaQuerySetTest.cpp ('k') | no next file » | 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>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 { 64 {
65 ASSERT(m_type == NumberToken); 65 ASSERT(m_type == NumberToken);
66 m_type = PercentageToken; 66 m_type = PercentageToken;
67 m_unit = CSSPrimitiveValue::CSS_PERCENTAGE; 67 m_unit = CSSPrimitiveValue::CSS_PERCENTAGE;
68 } 68 }
69 69
70 // This function is used only for testing 70 // This function is used only for testing
71 // FIXME - This doesn't cover all possible Token types, but it's enough for curr ent testing. 71 // FIXME - This doesn't cover all possible Token types, but it's enough for curr ent testing.
72 String MediaQueryToken::textForUnitTests() const 72 String MediaQueryToken::textForUnitTests() const
73 { 73 {
74 char buffer[std::numeric_limits<float>::digits10]; 74 char buffer[std::numeric_limits<float>::digits];
75 if (!m_value.isNull()) 75 if (!m_value.isNull())
76 return m_value; 76 return m_value;
77 if (m_type == LeftParenthesisToken) 77 if (m_type == LeftParenthesisToken)
78 return String("("); 78 return String("(");
79 if (m_type == RightParenthesisToken) 79 if (m_type == RightParenthesisToken)
80 return String(")"); 80 return String(")");
81 if (m_type == ColonToken) 81 if (m_type == ColonToken)
82 return String(":"); 82 return String(":");
83 if (m_type == WhitespaceToken) 83 if (m_type == WhitespaceToken)
84 return String(" "); 84 return String(" ");
(...skipping 15 matching lines...) Expand all
100 sprintf(buffer, "%d%s", static_cast<int>(m_numericValue), unitBuffer ); 100 sprintf(buffer, "%d%s", static_cast<int>(m_numericValue), unitBuffer );
101 else 101 else
102 sprintf(buffer, "%f%s", m_numericValue, unitBuffer); 102 sprintf(buffer, "%f%s", m_numericValue, unitBuffer);
103 103
104 return String(buffer, strlen(buffer)); 104 return String(buffer, strlen(buffer));
105 } 105 }
106 return String(); 106 return String();
107 } 107 }
108 108
109 } // namespace WebCore 109 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/MediaQuerySetTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698