| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 632 } |
| 633 | 633 |
| 634 return factor; | 634 return factor; |
| 635 } | 635 } |
| 636 | 636 |
| 637 double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionCode&
ec) const | 637 double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionCode&
ec) const |
| 638 { | 638 { |
| 639 double result = 0; | 639 double result = 0; |
| 640 bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &res
ult); | 640 bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &res
ult); |
| 641 if (!success) { | 641 if (!success) { |
| 642 ec = INVALID_ACCESS_ERR; | 642 ec = InvalidAccessError; |
| 643 return 0.0; | 643 return 0.0; |
| 644 } | 644 } |
| 645 | 645 |
| 646 ec = 0; | 646 ec = 0; |
| 647 return result; | 647 return result; |
| 648 } | 648 } |
| 649 | 649 |
| 650 double CSSPrimitiveValue::getDoubleValue(unsigned short unitType) const | 650 double CSSPrimitiveValue::getDoubleValue(unsigned short unitType) const |
| 651 { | 651 { |
| 652 double result = 0; | 652 double result = 0; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 case CSS_STRING: | 750 case CSS_STRING: |
| 751 case CSS_ATTR: | 751 case CSS_ATTR: |
| 752 case CSS_URI: | 752 case CSS_URI: |
| 753 case CSS_VARIABLE_NAME: | 753 case CSS_VARIABLE_NAME: |
| 754 return m_value.string; | 754 return m_value.string; |
| 755 case CSS_VALUE_ID: | 755 case CSS_VALUE_ID: |
| 756 return valueName(m_value.valueID); | 756 return valueName(m_value.valueID); |
| 757 case CSS_PROPERTY_ID: | 757 case CSS_PROPERTY_ID: |
| 758 return propertyName(m_value.propertyID); | 758 return propertyName(m_value.propertyID); |
| 759 default: | 759 default: |
| 760 ec = INVALID_ACCESS_ERR; | 760 ec = InvalidAccessError; |
| 761 break; | 761 break; |
| 762 } | 762 } |
| 763 | 763 |
| 764 return String(); | 764 return String(); |
| 765 } | 765 } |
| 766 | 766 |
| 767 String CSSPrimitiveValue::getStringValue() const | 767 String CSSPrimitiveValue::getStringValue() const |
| 768 { | 768 { |
| 769 switch (m_primitiveUnitType) { | 769 switch (m_primitiveUnitType) { |
| 770 case CSS_STRING: | 770 case CSS_STRING: |
| 771 case CSS_ATTR: | 771 case CSS_ATTR: |
| 772 case CSS_URI: | 772 case CSS_URI: |
| 773 case CSS_VARIABLE_NAME: | 773 case CSS_VARIABLE_NAME: |
| 774 return m_value.string; | 774 return m_value.string; |
| 775 case CSS_VALUE_ID: | 775 case CSS_VALUE_ID: |
| 776 return valueName(m_value.valueID); | 776 return valueName(m_value.valueID); |
| 777 case CSS_PROPERTY_ID: | 777 case CSS_PROPERTY_ID: |
| 778 return propertyName(m_value.propertyID); | 778 return propertyName(m_value.propertyID); |
| 779 default: | 779 default: |
| 780 break; | 780 break; |
| 781 } | 781 } |
| 782 | 782 |
| 783 return String(); | 783 return String(); |
| 784 } | 784 } |
| 785 | 785 |
| 786 Counter* CSSPrimitiveValue::getCounterValue(ExceptionCode& ec) const | 786 Counter* CSSPrimitiveValue::getCounterValue(ExceptionCode& ec) const |
| 787 { | 787 { |
| 788 ec = 0; | 788 ec = 0; |
| 789 if (m_primitiveUnitType != CSS_COUNTER) { | 789 if (m_primitiveUnitType != CSS_COUNTER) { |
| 790 ec = INVALID_ACCESS_ERR; | 790 ec = InvalidAccessError; |
| 791 return 0; | 791 return 0; |
| 792 } | 792 } |
| 793 | 793 |
| 794 return m_value.counter; | 794 return m_value.counter; |
| 795 } | 795 } |
| 796 | 796 |
| 797 Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const | 797 Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const |
| 798 { | 798 { |
| 799 ec = 0; | 799 ec = 0; |
| 800 if (m_primitiveUnitType != CSS_RECT) { | 800 if (m_primitiveUnitType != CSS_RECT) { |
| 801 ec = INVALID_ACCESS_ERR; | 801 ec = InvalidAccessError; |
| 802 return 0; | 802 return 0; |
| 803 } | 803 } |
| 804 | 804 |
| 805 return m_value.rect; | 805 return m_value.rect; |
| 806 } | 806 } |
| 807 | 807 |
| 808 Quad* CSSPrimitiveValue::getQuadValue(ExceptionCode& ec) const | 808 Quad* CSSPrimitiveValue::getQuadValue(ExceptionCode& ec) const |
| 809 { | 809 { |
| 810 ec = 0; | 810 ec = 0; |
| 811 if (m_primitiveUnitType != CSS_QUAD) { | 811 if (m_primitiveUnitType != CSS_QUAD) { |
| 812 ec = INVALID_ACCESS_ERR; | 812 ec = InvalidAccessError; |
| 813 return 0; | 813 return 0; |
| 814 } | 814 } |
| 815 | 815 |
| 816 return m_value.quad; | 816 return m_value.quad; |
| 817 } | 817 } |
| 818 | 818 |
| 819 PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) cons
t | 819 PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) cons
t |
| 820 { | 820 { |
| 821 ec = 0; | 821 ec = 0; |
| 822 if (m_primitiveUnitType != CSS_RGBCOLOR) { | 822 if (m_primitiveUnitType != CSS_RGBCOLOR) { |
| 823 ec = INVALID_ACCESS_ERR; | 823 ec = InvalidAccessError; |
| 824 return 0; | 824 return 0; |
| 825 } | 825 } |
| 826 | 826 |
| 827 // FIMXE: This should not return a new object for each invocation. | 827 // FIMXE: This should not return a new object for each invocation. |
| 828 return RGBColor::create(m_value.rgbcolor); | 828 return RGBColor::create(m_value.rgbcolor); |
| 829 } | 829 } |
| 830 | 830 |
| 831 Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const | 831 Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const |
| 832 { | 832 { |
| 833 ec = 0; | 833 ec = 0; |
| 834 if (m_primitiveUnitType != CSS_PAIR) { | 834 if (m_primitiveUnitType != CSS_PAIR) { |
| 835 ec = INVALID_ACCESS_ERR; | 835 ec = InvalidAccessError; |
| 836 return 0; | 836 return 0; |
| 837 } | 837 } |
| 838 | 838 |
| 839 return m_value.pair; | 839 return m_value.pair; |
| 840 } | 840 } |
| 841 | 841 |
| 842 static String formatNumber(double number, const char* suffix, unsigned suffixLen
gth) | 842 static String formatNumber(double number, const char* suffix, unsigned suffixLen
gth) |
| 843 { | 843 { |
| 844 DecimalNumber decimal(number); | 844 DecimalNumber decimal(number); |
| 845 | 845 |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 break; | 1321 break; |
| 1322 case CSS_CALC: | 1322 case CSS_CALC: |
| 1323 info.addMember(m_value.calc, "value.calc"); | 1323 info.addMember(m_value.calc, "value.calc"); |
| 1324 break; | 1324 break; |
| 1325 default: | 1325 default: |
| 1326 break; | 1326 break; |
| 1327 } | 1327 } |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 } // namespace WebCore | 1330 } // namespace WebCore |
| OLD | NEW |