| 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, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 unsigned AbstractPropertySetCSSStyleDeclaration::length() const | 152 unsigned AbstractPropertySetCSSStyleDeclaration::length() const |
| 153 { | 153 { |
| 154 return propertySet().propertyCount(); | 154 return propertySet().propertyCount(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 String AbstractPropertySetCSSStyleDeclaration::item(unsigned i) const | 157 String AbstractPropertySetCSSStyleDeclaration::item(unsigned i) const |
| 158 { | 158 { |
| 159 if (i >= propertySet().propertyCount()) | 159 if (i >= propertySet().propertyCount()) |
| 160 return ""; | 160 return ""; |
| 161 StylePropertySet::PropertyReference property = propertySet().propertyAt(i); | 161 StylePropertySet::PropertyReference property = propertySet().propertyAt(i); |
| 162 if (RuntimeEnabledFeatures::cssVariablesEnabled() && property.id() == CSSPro
pertyVariable) | 162 if (property.id() == CSSPropertyVariable) |
| 163 return toCSSCustomPropertyDeclaration(property.value()).name(); | 163 return toCSSCustomPropertyDeclaration(property.value()).name(); |
| 164 if (property.id() == CSSPropertyApplyAtRule) | 164 if (property.id() == CSSPropertyApplyAtRule) |
| 165 return "@apply"; | 165 return "@apply"; |
| 166 return getPropertyName(property.id()); | 166 return getPropertyName(property.id()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 String AbstractPropertySetCSSStyleDeclaration::cssText() const | 169 String AbstractPropertySetCSSStyleDeclaration::cssText() const |
| 170 { | 170 { |
| 171 return propertySet().asText(); | 171 return propertySet().asText(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void AbstractPropertySetCSSStyleDeclaration::setCSSText(const String& text, Exce
ptionState&) | 174 void AbstractPropertySetCSSStyleDeclaration::setCSSText(const String& text, Exce
ptionState&) |
| 175 { | 175 { |
| 176 StyleAttributeMutationScope mutationScope(this); | 176 StyleAttributeMutationScope mutationScope(this); |
| 177 willMutate(); | 177 willMutate(); |
| 178 | 178 |
| 179 propertySet().parseDeclarationList(text, contextStyleSheet()); | 179 propertySet().parseDeclarationList(text, contextStyleSheet()); |
| 180 | 180 |
| 181 didMutate(PropertyChanged); | 181 didMutate(PropertyChanged); |
| 182 | 182 |
| 183 mutationScope.enqueueMutationRecord(); | 183 mutationScope.enqueueMutationRecord(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 String AbstractPropertySetCSSStyleDeclaration::getPropertyValue(const String& pr
opertyName) | 186 String AbstractPropertySetCSSStyleDeclaration::getPropertyValue(const String& pr
opertyName) |
| 187 { | 187 { |
| 188 CSSPropertyID propertyID = cssPropertyID(propertyName); | 188 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 189 if (!propertyID) { | 189 if (!propertyID) { |
| 190 if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser
::isValidVariableName(propertyName)) | 190 if (!CSSVariableParser::isValidVariableName(propertyName)) |
| 191 return String(); | 191 return String(); |
| 192 return propertySet().getPropertyValue(AtomicString(propertyName)); | 192 return propertySet().getPropertyValue(AtomicString(propertyName)); |
| 193 } | 193 } |
| 194 return propertySet().getPropertyValue(propertyID); | 194 return propertySet().getPropertyValue(propertyID); |
| 195 } | 195 } |
| 196 | 196 |
| 197 String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority(const String&
propertyName) | 197 String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority(const String&
propertyName) |
| 198 { | 198 { |
| 199 bool important = false; | 199 bool important = false; |
| 200 CSSPropertyID propertyID = cssPropertyID(propertyName); | 200 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 201 if (!propertyID) { | 201 if (!propertyID) { |
| 202 if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser
::isValidVariableName(propertyName)) | 202 if (!CSSVariableParser::isValidVariableName(propertyName)) |
| 203 return String(); | 203 return String(); |
| 204 important = propertySet().propertyIsImportant(AtomicString(propertyName)
); | 204 important = propertySet().propertyIsImportant(AtomicString(propertyName)
); |
| 205 } else { | 205 } else { |
| 206 important = propertySet().propertyIsImportant(propertyID); | 206 important = propertySet().propertyIsImportant(propertyID); |
| 207 } | 207 } |
| 208 return important ? "important" : ""; | 208 return important ? "important" : ""; |
| 209 } | 209 } |
| 210 | 210 |
| 211 String AbstractPropertySetCSSStyleDeclaration::getPropertyShorthand(const String
& propertyName) | 211 String AbstractPropertySetCSSStyleDeclaration::getPropertyShorthand(const String
& propertyName) |
| 212 { | 212 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 230 // Custom properties don't have shorthands, so we can ignore them here. | 230 // Custom properties don't have shorthands, so we can ignore them here. |
| 231 if (!propertyID) | 231 if (!propertyID) |
| 232 return false; | 232 return false; |
| 233 return propertySet().isPropertyImplicit(propertyID); | 233 return propertySet().isPropertyImplicit(propertyID); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN
ame, const String& value, const String& priority, ExceptionState& exceptionState
) | 236 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN
ame, const String& value, const String& priority, ExceptionState& exceptionState
) |
| 237 { | 237 { |
| 238 CSSPropertyID propertyID = unresolvedCSSPropertyID(propertyName); | 238 CSSPropertyID propertyID = unresolvedCSSPropertyID(propertyName); |
| 239 if (!propertyID) { | 239 if (!propertyID) { |
| 240 if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser
::isValidVariableName(propertyName)) | 240 if (!CSSVariableParser::isValidVariableName(propertyName)) |
| 241 return; | 241 return; |
| 242 propertyID = CSSPropertyVariable; | 242 propertyID = CSSPropertyVariable; |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool important = equalIgnoringCase(priority, "important"); | 245 bool important = equalIgnoringCase(priority, "important"); |
| 246 if (!important && !priority.isEmpty()) | 246 if (!important && !priority.isEmpty()) |
| 247 return; | 247 return; |
| 248 | 248 |
| 249 setPropertyInternal(propertyID, propertyName, value, important, exceptionSta
te); | 249 setPropertyInternal(propertyID, propertyName, value, important, exceptionSta
te); |
| 250 } | 250 } |
| 251 | 251 |
| 252 String AbstractPropertySetCSSStyleDeclaration::removeProperty(const String& prop
ertyName, ExceptionState& exceptionState) | 252 String AbstractPropertySetCSSStyleDeclaration::removeProperty(const String& prop
ertyName, ExceptionState& exceptionState) |
| 253 { | 253 { |
| 254 CSSPropertyID propertyID = cssPropertyID(propertyName); | 254 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 255 if (!propertyID) { | 255 if (!propertyID) { |
| 256 if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser
::isValidVariableName(propertyName)) | 256 if (!CSSVariableParser::isValidVariableName(propertyName)) |
| 257 return String(); | 257 return String(); |
| 258 propertyID = CSSPropertyVariable; | 258 propertyID = CSSPropertyVariable; |
| 259 } | 259 } |
| 260 | 260 |
| 261 StyleAttributeMutationScope mutationScope(this); | 261 StyleAttributeMutationScope mutationScope(this); |
| 262 willMutate(); | 262 willMutate(); |
| 263 | 263 |
| 264 String result; | 264 String result; |
| 265 bool changed = false; | 265 bool changed = false; |
| 266 if (propertyID == CSSPropertyVariable) | 266 if (propertyID == CSSPropertyVariable) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 return m_parentElement ? &m_parentElement->document().elementSheet() : nullp
tr; | 391 return m_parentElement ? &m_parentElement->document().elementSheet() : nullp
tr; |
| 392 } | 392 } |
| 393 | 393 |
| 394 DEFINE_TRACE(InlineCSSStyleDeclaration) | 394 DEFINE_TRACE(InlineCSSStyleDeclaration) |
| 395 { | 395 { |
| 396 visitor->trace(m_parentElement); | 396 visitor->trace(m_parentElement); |
| 397 AbstractPropertySetCSSStyleDeclaration::trace(visitor); | 397 AbstractPropertySetCSSStyleDeclaration::trace(visitor); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace blink | 400 } // namespace blink |
| OLD | NEW |