| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3162 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 3162 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 3163 const HashMap<AtomicString, String>* variables = variableMap(); | 3163 const HashMap<AtomicString, String>* variables = variableMap(); |
| 3164 if (!variables) | 3164 if (!variables) |
| 3165 return emptyString(); | 3165 return emptyString(); |
| 3166 HashMap<AtomicString, String>::const_iterator it = variables->find(name); | 3166 HashMap<AtomicString, String>::const_iterator it = variables->find(name); |
| 3167 if (it == variables->end()) | 3167 if (it == variables->end()) |
| 3168 return emptyString(); | 3168 return emptyString(); |
| 3169 return it->value; | 3169 return it->value; |
| 3170 } | 3170 } |
| 3171 | 3171 |
| 3172 void CSSComputedStyleDeclaration::setVariableValue(const AtomicString& name, con
st String&, ExceptionState& es) | 3172 bool CSSComputedStyleDeclaration::setVariableValue(const AtomicString& name, con
st String&, ExceptionState& es) |
| 3173 { | 3173 { |
| 3174 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 3174 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 3175 es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + nam
e + "' property on a computed 'CSSStyleDeclaration': computed styles are read-on
ly."); | 3175 es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + nam
e + "' property on a computed 'CSSStyleDeclaration': computed styles are read-on
ly."); |
| 3176 return false; |
| 3176 } | 3177 } |
| 3177 | 3178 |
| 3178 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&) | 3179 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&) |
| 3179 { | 3180 { |
| 3180 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 3181 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 3181 return false; | 3182 return false; |
| 3182 } | 3183 } |
| 3183 | 3184 |
| 3184 void CSSComputedStyleDeclaration::clearVariables(ExceptionState& es) | 3185 bool CSSComputedStyleDeclaration::clearVariables(ExceptionState& es) |
| 3185 { | 3186 { |
| 3186 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 3187 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 3187 es.throwDOMException(NoModificationAllowedError, "Failed to clear variables
from a computed 'CSSStyleDeclaration': computed styles are read-only."); | 3188 es.throwDOMException(NoModificationAllowedError, "Failed to clear variables
from a computed 'CSSStyleDeclaration': computed styles are read-only."); |
| 3189 return false; |
| 3190 } |
| 3191 |
| 3192 CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::ComputedCSSVariablesI
terator(const HashMap<AtomicString, String>* variables) |
| 3193 : m_active(variables) |
| 3194 { |
| 3195 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 3196 if (m_active) { |
| 3197 m_it = variables->begin(); |
| 3198 m_end = variables->end(); |
| 3199 } |
| 3200 } |
| 3201 |
| 3202 void CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::advance() |
| 3203 { |
| 3204 ASSERT(m_active); |
| 3205 ++m_it; |
| 3206 m_active = !atEnd(); |
| 3207 } |
| 3208 |
| 3209 AtomicString CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::name() c
onst |
| 3210 { |
| 3211 ASSERT(m_active); |
| 3212 return m_it->key; |
| 3213 } |
| 3214 |
| 3215 String CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::value() const |
| 3216 { |
| 3217 ASSERT(m_active); |
| 3218 return m_it->value; |
| 3188 } | 3219 } |
| 3189 | 3220 |
| 3190 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShortha
nd() const | 3221 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShortha
nd() const |
| 3191 { | 3222 { |
| 3192 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty
BackgroundColor, CSSPropertyBackgroundImage, | 3223 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty
BackgroundColor, CSSPropertyBackgroundImage, |
| 3193 CSSProperty
BackgroundRepeat, CSSPropertyBackgroundAttachment, | 3224 CSSProperty
BackgroundRepeat, CSSPropertyBackgroundAttachment, |
| 3194 CSSProperty
BackgroundPosition }; | 3225 CSSProperty
BackgroundPosition }; |
| 3195 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3226 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
| 3196 CSSPropertyB
ackgroundClip }; | 3227 CSSPropertyB
ackgroundClip }; |
| 3197 | 3228 |
| 3198 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3229 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
| 3199 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); | 3230 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); |
| 3200 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); | 3231 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); |
| 3201 return list.release(); | 3232 return list.release(); |
| 3202 } | 3233 } |
| 3203 | 3234 |
| 3204 } // namespace WebCore | 3235 } // namespace WebCore |
| OLD | NEW |