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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 case CSS_CALC_PERCENTAGE_WITH_LENGTH: | 939 case CSS_CALC_PERCENTAGE_WITH_LENGTH: |
940 case CSS_QEM: | 940 case CSS_QEM: |
941 break; | 941 break; |
942 }; | 942 }; |
943 ASSERT_NOT_REACHED(); | 943 ASSERT_NOT_REACHED(); |
944 return ""; | 944 return ""; |
945 } | 945 } |
946 | 946 |
947 String CSSPrimitiveValue::customCSSText() const | 947 String CSSPrimitiveValue::customCSSText() const |
948 { | 948 { |
949 if (hasCachedCSSText()) { | 949 if (!isObject() && cssTextCache().contains(m_rawValue.asPtr)) |
950 ASSERT(cssTextCache().contains(m_rawValue)); | 950 return cssTextCache().get(m_rawValue.asPtr); |
951 return cssTextCache().get(m_rawValue); | 951 |
| 952 if (isObject() && m_rawValue.asPtr->m_hasCachedCSSText) { |
| 953 ASSERT(cssTextCache().contains(m_rawValue.asPtr)); |
| 954 return cssTextCache().get(m_rawValue.asPtr); |
952 } | 955 } |
953 | 956 |
954 String text; | 957 String text; |
955 switch (type()) { | 958 switch (type()) { |
956 case CSS_UNKNOWN: | 959 case CSS_UNKNOWN: |
957 // FIXME | 960 // FIXME |
958 break; | 961 break; |
959 case CSS_INTEGER: | 962 case CSS_INTEGER: |
960 text = String::format("%d", getIntValue()); | 963 text = String::format("%d", getIntValue()); |
961 break; | 964 break; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 case CSS_CALC: | 1058 case CSS_CALC: |
1056 text = value().calc->cssText(); | 1059 text = value().calc->cssText(); |
1057 break; | 1060 break; |
1058 case CSS_SHAPE: | 1061 case CSS_SHAPE: |
1059 text = value().shape->cssText(); | 1062 text = value().shape->cssText(); |
1060 break; | 1063 break; |
1061 default: | 1064 default: |
1062 break; | 1065 break; |
1063 } | 1066 } |
1064 | 1067 |
1065 ASSERT(!cssTextCache().contains(m_rawValue)); | 1068 ASSERT(!cssTextCache().contains(m_rawValue.asPtr)); |
1066 cssTextCache().set(m_rawValue, text); | 1069 cssTextCache().set(m_rawValue.asPtr, text); |
1067 setHasCachedCSSText(true); | 1070 if (isObject()) |
| 1071 m_rawValue.asPtr->m_hasCachedCSSText = true; |
1068 return text; | 1072 return text; |
1069 } | 1073 } |
1070 | 1074 |
1071 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue other) const | 1075 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue other) const |
1072 { | 1076 { |
1073 if (type() != other.type()) | 1077 if (type() != other.type()) |
1074 return false; | 1078 return false; |
1075 | 1079 |
1076 switch (type()) { | 1080 switch (type()) { |
1077 case CSS_UNKNOWN: | 1081 case CSS_UNKNOWN: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 visitor->trace(m_value.shape); | 1160 visitor->trace(m_value.shape); |
1157 break; | 1161 break; |
1158 default: | 1162 default: |
1159 break; | 1163 break; |
1160 } | 1164 } |
1161 #endif | 1165 #endif |
1162 CSSValueObject::traceAfterDispatch(visitor); | 1166 CSSValueObject::traceAfterDispatch(visitor); |
1163 } | 1167 } |
1164 | 1168 |
1165 } // namespace blink | 1169 } // namespace blink |
OLD | NEW |