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

Side by Side Diff: Source/core/css/MediaQueryExp.cpp

Issue 285643006: Kill WTF::DecimalNumber class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Inline single-line function Created 6 years, 7 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
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.cpp ('k') | Source/core/css/MediaQuerySetTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * CSS Media Query 2 * CSS Media Query
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * Copyright (C) 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2013 Apple Inc. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 16 matching lines...) Expand all
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/css/MediaQueryExp.h" 31 #include "core/css/MediaQueryExp.h"
32 32
33 #include "core/css/CSSAspectRatioValue.h" 33 #include "core/css/CSSAspectRatioValue.h"
34 #include "core/css/CSSParserValues.h" 34 #include "core/css/CSSParserValues.h"
35 #include "core/css/CSSPrimitiveValue.h" 35 #include "core/css/CSSPrimitiveValue.h"
36 #include "core/html/parser/HTMLParserIdioms.h" 36 #include "core/html/parser/HTMLParserIdioms.h"
37 #include "wtf/DecimalNumber.h" 37 #include "platform/Decimal.h"
38 #include "wtf/text/StringBuffer.h" 38 #include "wtf/text/StringBuffer.h"
39 #include "wtf/text/StringBuilder.h" 39 #include "wtf/text/StringBuilder.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 using namespace MediaFeatureNames; 43 using namespace MediaFeatureNames;
44 44
45 static inline bool featureWithCSSValueID(const String& mediaFeature, const CSSPa rserValue* value) 45 static inline bool featureWithCSSValueID(const String& mediaFeature, const CSSPa rserValue* value)
46 { 46 {
47 if (!value->id) 47 if (!value->id)
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 result.append(m_mediaFeature.lower()); 291 result.append(m_mediaFeature.lower());
292 if (m_expValue.isValid()) { 292 if (m_expValue.isValid()) {
293 result.append(": "); 293 result.append(": ");
294 result.append(m_expValue.cssText()); 294 result.append(m_expValue.cssText());
295 } 295 }
296 result.append(")"); 296 result.append(")");
297 297
298 return result.toString(); 298 return result.toString();
299 } 299 }
300 300
301 static String printNumber(double number) 301 static inline String printNumber(double number)
302 { 302 {
303 DecimalNumber decimal(number); 303 return Decimal::fromDouble(number).toString();
304 StringBuffer<LChar> buffer(decimal.bufferLengthForStringDecimal());
305 decimal.toStringDecimal(buffer.characters(), buffer.length());
306 return String::adopt(buffer);
307 } 304 }
308 305
309 String MediaQueryExpValue::cssText() const 306 String MediaQueryExpValue::cssText() const
310 { 307 {
311 StringBuilder output; 308 StringBuilder output;
312 if (isValue) { 309 if (isValue) {
313 output.append(printNumber(value)); 310 output.append(printNumber(value));
314 output.append(CSSPrimitiveValue::unitTypeToString(unit)); 311 output.append(CSSPrimitiveValue::unitTypeToString(unit));
315 } else if (isRatio) { 312 } else if (isRatio) {
316 output.append(printNumber(numerator)); 313 output.append(printNumber(numerator));
317 output.append("/"); 314 output.append("/");
318 output.append(printNumber(denominator)); 315 output.append(printNumber(denominator));
319 } else if (isID) { 316 } else if (isID) {
320 output.append(getValueName(id)); 317 output.append(getValueName(id));
321 } 318 }
322 319
323 return output.toString(); 320 return output.toString();
324 } 321 }
325 322
326 } // namespace 323 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.cpp ('k') | Source/core/css/MediaQuerySetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698