| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |