| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 { | 344 { |
| 345 cleanup(); | 345 cleanup(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void CSSPrimitiveValue::cleanup() | 348 void CSSPrimitiveValue::cleanup() |
| 349 { | 349 { |
| 350 switch (type()) { | 350 switch (type()) { |
| 351 case UnitType::CustomIdentifier: | 351 case UnitType::CustomIdentifier: |
| 352 case UnitType::String: | 352 case UnitType::String: |
| 353 case UnitType::URI: | 353 case UnitType::URI: |
| 354 case UnitType::Attribute: | |
| 355 if (m_value.string) | 354 if (m_value.string) |
| 356 m_value.string->deref(); | 355 m_value.string->deref(); |
| 357 break; | 356 break; |
| 358 case UnitType::Calc: | 357 case UnitType::Calc: |
| 359 // We must not call deref() when oilpan is enabled because m_value.calc
is traced. | 358 // We must not call deref() when oilpan is enabled because m_value.calc
is traced. |
| 360 #if !ENABLE(OILPAN) | 359 #if !ENABLE(OILPAN) |
| 361 m_value.calc->deref(); | 360 m_value.calc->deref(); |
| 362 #endif | 361 #endif |
| 363 break; | 362 break; |
| 364 case UnitType::CalcPercentageWithNumber: | 363 case UnitType::CalcPercentageWithNumber: |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 737 } |
| 739 ASSERT_NOT_REACHED(); | 738 ASSERT_NOT_REACHED(); |
| 740 return CSSPrimitiveValue::UnitType::Unknown; | 739 return CSSPrimitiveValue::UnitType::Unknown; |
| 741 } | 740 } |
| 742 | 741 |
| 743 String CSSPrimitiveValue::getStringValue() const | 742 String CSSPrimitiveValue::getStringValue() const |
| 744 { | 743 { |
| 745 switch (type()) { | 744 switch (type()) { |
| 746 case UnitType::CustomIdentifier: | 745 case UnitType::CustomIdentifier: |
| 747 case UnitType::String: | 746 case UnitType::String: |
| 748 case UnitType::Attribute: | |
| 749 case UnitType::URI: | 747 case UnitType::URI: |
| 750 return m_value.string; | 748 return m_value.string; |
| 751 default: | 749 default: |
| 752 break; | 750 break; |
| 753 } | 751 } |
| 754 | 752 |
| 755 ASSERT_NOT_REACHED(); | 753 ASSERT_NOT_REACHED(); |
| 756 return String(); | 754 return String(); |
| 757 } | 755 } |
| 758 | 756 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 case UnitType::ViewportMin: | 837 case UnitType::ViewportMin: |
| 840 return "vmin"; | 838 return "vmin"; |
| 841 case UnitType::ViewportMax: | 839 case UnitType::ViewportMax: |
| 842 return "vmax"; | 840 return "vmax"; |
| 843 case UnitType::Unknown: | 841 case UnitType::Unknown: |
| 844 case UnitType::CustomIdentifier: | 842 case UnitType::CustomIdentifier: |
| 845 case UnitType::String: | 843 case UnitType::String: |
| 846 case UnitType::URI: | 844 case UnitType::URI: |
| 847 case UnitType::ValueID: | 845 case UnitType::ValueID: |
| 848 case UnitType::PropertyID: | 846 case UnitType::PropertyID: |
| 849 case UnitType::Attribute: | |
| 850 case UnitType::RGBColor: | 847 case UnitType::RGBColor: |
| 851 case UnitType::Calc: | 848 case UnitType::Calc: |
| 852 case UnitType::Shape: | 849 case UnitType::Shape: |
| 853 case UnitType::CalcPercentageWithNumber: | 850 case UnitType::CalcPercentageWithNumber: |
| 854 case UnitType::CalcPercentageWithLength: | 851 case UnitType::CalcPercentageWithLength: |
| 855 case UnitType::QuirkyEms: | 852 case UnitType::QuirkyEms: |
| 856 break; | 853 break; |
| 857 }; | 854 }; |
| 858 ASSERT_NOT_REACHED(); | 855 ASSERT_NOT_REACHED(); |
| 859 return ""; | 856 return ""; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 } | 910 } |
| 914 case UnitType::URI: | 911 case UnitType::URI: |
| 915 text = "url(" + quoteCSSURLIfNeeded(m_value.string) + ")"; | 912 text = "url(" + quoteCSSURLIfNeeded(m_value.string) + ")"; |
| 916 break; | 913 break; |
| 917 case UnitType::ValueID: | 914 case UnitType::ValueID: |
| 918 text = valueName(m_value.valueID); | 915 text = valueName(m_value.valueID); |
| 919 break; | 916 break; |
| 920 case UnitType::PropertyID: | 917 case UnitType::PropertyID: |
| 921 text = propertyName(m_value.propertyID); | 918 text = propertyName(m_value.propertyID); |
| 922 break; | 919 break; |
| 923 case UnitType::Attribute: { | |
| 924 StringBuilder result; | |
| 925 result.reserveCapacity(6 + m_value.string->length()); | |
| 926 result.appendLiteral("attr("); | |
| 927 result.append(m_value.string); | |
| 928 result.append(')'); | |
| 929 | |
| 930 text = result.toString(); | |
| 931 break; | |
| 932 } | |
| 933 case UnitType::RGBColor: { | 920 case UnitType::RGBColor: { |
| 934 text = Color(m_value.rgbcolor).serializedAsCSSComponentValue(); | 921 text = Color(m_value.rgbcolor).serializedAsCSSComponentValue(); |
| 935 break; | 922 break; |
| 936 } | 923 } |
| 937 case UnitType::Calc: | 924 case UnitType::Calc: |
| 938 text = m_value.calc->customCSSText(); | 925 text = m_value.calc->customCSSText(); |
| 939 break; | 926 break; |
| 940 case UnitType::Shape: | 927 case UnitType::Shape: |
| 941 text = m_value.shape->cssText(); | 928 text = m_value.shape->cssText(); |
| 942 break; | 929 break; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 case UnitType::ViewportMax: | 976 case UnitType::ViewportMax: |
| 990 case UnitType::Fraction: | 977 case UnitType::Fraction: |
| 991 return m_value.num == other.m_value.num; | 978 return m_value.num == other.m_value.num; |
| 992 case UnitType::PropertyID: | 979 case UnitType::PropertyID: |
| 993 return m_value.propertyID == other.m_value.propertyID; | 980 return m_value.propertyID == other.m_value.propertyID; |
| 994 case UnitType::ValueID: | 981 case UnitType::ValueID: |
| 995 return m_value.valueID == other.m_value.valueID; | 982 return m_value.valueID == other.m_value.valueID; |
| 996 case UnitType::CustomIdentifier: | 983 case UnitType::CustomIdentifier: |
| 997 case UnitType::String: | 984 case UnitType::String: |
| 998 case UnitType::URI: | 985 case UnitType::URI: |
| 999 case UnitType::Attribute: | |
| 1000 return equal(m_value.string, other.m_value.string); | 986 return equal(m_value.string, other.m_value.string); |
| 1001 case UnitType::RGBColor: | 987 case UnitType::RGBColor: |
| 1002 return m_value.rgbcolor == other.m_value.rgbcolor; | 988 return m_value.rgbcolor == other.m_value.rgbcolor; |
| 1003 case UnitType::Calc: | 989 case UnitType::Calc: |
| 1004 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other
.m_value.calc); | 990 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other
.m_value.calc); |
| 1005 case UnitType::Shape: | 991 case UnitType::Shape: |
| 1006 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot
her.m_value.shape); | 992 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot
her.m_value.shape); |
| 1007 case UnitType::Integer: | 993 case UnitType::Integer: |
| 1008 case UnitType::Chs: | 994 case UnitType::Chs: |
| 1009 case UnitType::CalcPercentageWithNumber: | 995 case UnitType::CalcPercentageWithNumber: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1025 visitor->trace(m_value.shape); | 1011 visitor->trace(m_value.shape); |
| 1026 break; | 1012 break; |
| 1027 default: | 1013 default: |
| 1028 break; | 1014 break; |
| 1029 } | 1015 } |
| 1030 #endif | 1016 #endif |
| 1031 CSSValue::traceAfterDispatch(visitor); | 1017 CSSValue::traceAfterDispatch(visitor); |
| 1032 } | 1018 } |
| 1033 | 1019 |
| 1034 } // namespace blink | 1020 } // namespace blink |
| OLD | NEW |