| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv
ed. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 return CSSPrimitiveValue::UnitType::ViewportMin; | 551 return CSSPrimitiveValue::UnitType::ViewportMin; |
| 552 case UnitTypeViewportMax: | 552 case UnitTypeViewportMax: |
| 553 return CSSPrimitiveValue::UnitType::ViewportMax; | 553 return CSSPrimitiveValue::UnitType::ViewportMax; |
| 554 case LengthUnitTypeCount: | 554 case LengthUnitTypeCount: |
| 555 break; | 555 break; |
| 556 } | 556 } |
| 557 ASSERT_NOT_REACHED(); | 557 ASSERT_NOT_REACHED(); |
| 558 return CSSPrimitiveValue::UnitType::Unknown; | 558 return CSSPrimitiveValue::UnitType::Unknown; |
| 559 } | 559 } |
| 560 | 560 |
| 561 static String formatNumber(double number, const char* suffix, unsigned suffixLen
gth) | 561 static String formatNumber(double number, const StringView& suffix) |
| 562 { | 562 { |
| 563 #if OS(WIN) && _MSC_VER < 1900 | 563 #if OS(WIN) && _MSC_VER < 1900 |
| 564 unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT); | 564 unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT); |
| 565 #endif | 565 #endif |
| 566 String result = String::format("%.6g", number); | 566 String result = String::format("%.6g", number); |
| 567 #if OS(WIN) && _MSC_VER < 1900 | 567 #if OS(WIN) && _MSC_VER < 1900 |
| 568 _set_output_format(oldFormat); | 568 _set_output_format(oldFormat); |
| 569 #endif | 569 #endif |
| 570 result.append(suffix, suffixLength); | 570 result.append(suffix); |
| 571 return result; | 571 return result; |
| 572 } | 572 } |
| 573 | 573 |
| 574 template <unsigned characterCount> | |
| 575 ALWAYS_INLINE static String formatNumber(double number, const char (&characters)
[characterCount]) | |
| 576 { | |
| 577 return formatNumber(number, characters, characterCount - 1); | |
| 578 } | |
| 579 | |
| 580 static String formatNumber(double number, const char* characters) | |
| 581 { | |
| 582 return formatNumber(number, characters, strlen(characters)); | |
| 583 } | |
| 584 | |
| 585 const char* CSSPrimitiveValue::unitTypeToString(UnitType type) | 574 const char* CSSPrimitiveValue::unitTypeToString(UnitType type) |
| 586 { | 575 { |
| 587 switch (type) { | 576 switch (type) { |
| 588 case UnitType::Number: | 577 case UnitType::Number: |
| 589 case UnitType::Integer: | 578 case UnitType::Integer: |
| 590 case UnitType::UserUnits: | 579 case UnitType::UserUnits: |
| 591 return ""; | 580 return ""; |
| 592 case UnitType::Percentage: | 581 case UnitType::Percentage: |
| 593 return "%"; | 582 return "%"; |
| 594 case UnitType::Ems: | 583 case UnitType::Ems: |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 case UnitType::Calc: | 772 case UnitType::Calc: |
| 784 visitor->trace(m_value.calc); | 773 visitor->trace(m_value.calc); |
| 785 break; | 774 break; |
| 786 default: | 775 default: |
| 787 break; | 776 break; |
| 788 } | 777 } |
| 789 CSSValue::traceAfterDispatch(visitor); | 778 CSSValue::traceAfterDispatch(visitor); |
| 790 } | 779 } |
| 791 | 780 |
| 792 } // namespace blink | 781 } // namespace blink |
| OLD | NEW |