| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (i >= m_propertySet->propertyCount()) | 145 if (i >= m_propertySet->propertyCount()) |
| 146 return ""; | 146 return ""; |
| 147 return m_propertySet->propertyAt(i).cssName(); | 147 return m_propertySet->propertyAt(i).cssName(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 String PropertySetCSSStyleDeclaration::cssText() const | 150 String PropertySetCSSStyleDeclaration::cssText() const |
| 151 { | 151 { |
| 152 return m_propertySet->asText(); | 152 return m_propertySet->asText(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void PropertySetCSSStyleDeclaration::setCSSText(const String& text, ExceptionSta
te& es) | 155 void PropertySetCSSStyleDeclaration::setCSSText(const String& text, ExceptionSta
te& exceptionState) |
| 156 { | 156 { |
| 157 StyleAttributeMutationScope mutationScope(this); | 157 StyleAttributeMutationScope mutationScope(this); |
| 158 willMutate(); | 158 willMutate(); |
| 159 | 159 |
| 160 // FIXME: Detect syntax errors and set es. | 160 // FIXME: Detect syntax errors and set exceptionState. |
| 161 m_propertySet->parseDeclaration(text, contextStyleSheet()); | 161 m_propertySet->parseDeclaration(text, contextStyleSheet()); |
| 162 | 162 |
| 163 didMutate(PropertyChanged); | 163 didMutate(PropertyChanged); |
| 164 | 164 |
| 165 mutationScope.enqueueMutationRecord(); | 165 mutationScope.enqueueMutationRecord(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const S
tring& propertyName) | 168 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const S
tring& propertyName) |
| 169 { | 169 { |
| 170 CSSPropertyID propertyID = cssPropertyID(propertyName); | 170 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyNa
me) | 203 bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyNa
me) |
| 204 { | 204 { |
| 205 CSSPropertyID propertyID = cssPropertyID(propertyName); | 205 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 206 if (!propertyID) | 206 if (!propertyID) |
| 207 return false; | 207 return false; |
| 208 return m_propertySet->isPropertyImplicit(propertyID); | 208 return m_propertySet->isPropertyImplicit(propertyID); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con
st String& value, const String& priority, ExceptionState& es) | 211 void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con
st String& value, const String& priority, ExceptionState& exceptionState) |
| 212 { | 212 { |
| 213 StyleAttributeMutationScope mutationScope(this); | 213 StyleAttributeMutationScope mutationScope(this); |
| 214 CSSPropertyID propertyID = cssPropertyID(propertyName); | 214 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 215 if (!propertyID) | 215 if (!propertyID) |
| 216 return; | 216 return; |
| 217 | 217 |
| 218 bool important = priority.find("important", 0, false) != kNotFound; | 218 bool important = priority.find("important", 0, false) != kNotFound; |
| 219 | 219 |
| 220 willMutate(); | 220 willMutate(); |
| 221 | 221 |
| 222 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); | 222 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); |
| 223 | 223 |
| 224 didMutate(changed ? PropertyChanged : NoChanges); | 224 didMutate(changed ? PropertyChanged : NoChanges); |
| 225 | 225 |
| 226 if (changed) { | 226 if (changed) { |
| 227 // CSS DOM requires raising SyntaxError of parsing failed, but this is t
oo dangerous for compatibility, | 227 // CSS DOM requires raising SyntaxError of parsing failed, but this is t
oo dangerous for compatibility, |
| 228 // see <http://bugs.webkit.org/show_bug.cgi?id=7296>. | 228 // see <http://bugs.webkit.org/show_bug.cgi?id=7296>. |
| 229 mutationScope.enqueueMutationRecord(); | 229 mutationScope.enqueueMutationRecord(); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName
, ExceptionState& es) | 233 String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName
, ExceptionState& exceptionState) |
| 234 { | 234 { |
| 235 StyleAttributeMutationScope mutationScope(this); | 235 StyleAttributeMutationScope mutationScope(this); |
| 236 CSSPropertyID propertyID = cssPropertyID(propertyName); | 236 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 237 if (!propertyID) | 237 if (!propertyID) |
| 238 return String(); | 238 return String(); |
| 239 | 239 |
| 240 willMutate(); | 240 willMutate(); |
| 241 | 241 |
| 242 String result; | 242 String result; |
| 243 bool changed = m_propertySet->removeProperty(propertyID, &result); | 243 bool changed = m_propertySet->removeProperty(propertyID, &result); |
| 244 | 244 |
| 245 didMutate(changed ? PropertyChanged : NoChanges); | 245 didMutate(changed ? PropertyChanged : NoChanges); |
| 246 | 246 |
| 247 if (changed) | 247 if (changed) |
| 248 mutationScope.enqueueMutationRecord(); | 248 mutationScope.enqueueMutationRecord(); |
| 249 return result; | 249 return result; |
| 250 } | 250 } |
| 251 | 251 |
| 252 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal
(CSSPropertyID propertyID) | 252 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal
(CSSPropertyID propertyID) |
| 253 { | 253 { |
| 254 return m_propertySet->getPropertyCSSValue(propertyID); | 254 return m_propertySet->getPropertyCSSValue(propertyID); |
| 255 } | 255 } |
| 256 | 256 |
| 257 String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID pr
opertyID) | 257 String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID pr
opertyID) |
| 258 { | 258 { |
| 259 return m_propertySet->getPropertyValue(propertyID); | 259 return m_propertySet->getPropertyValue(propertyID); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI
D, const String& value, bool important, ExceptionState& es) | 262 void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI
D, const String& value, bool important, ExceptionState& exceptionState) |
| 263 { | 263 { |
| 264 StyleAttributeMutationScope mutationScope(this); | 264 StyleAttributeMutationScope mutationScope(this); |
| 265 willMutate(); | 265 willMutate(); |
| 266 | 266 |
| 267 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); | 267 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); |
| 268 | 268 |
| 269 didMutate(changed ? PropertyChanged : NoChanges); | 269 didMutate(changed ? PropertyChanged : NoChanges); |
| 270 | 270 |
| 271 if (changed) | 271 if (changed) |
| 272 mutationScope.enqueueMutationRecord(); | 272 mutationScope.enqueueMutationRecord(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 m_parentElement->invalidateStyleAttribute(); | 425 m_parentElement->invalidateStyleAttribute(); |
| 426 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); | 426 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const | 429 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const |
| 430 { | 430 { |
| 431 return m_parentElement ? m_parentElement->document().elementSheet() : 0; | 431 return m_parentElement ? m_parentElement->document().elementSheet() : 0; |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace WebCore | 434 } // namespace WebCore |
| OLD | NEW |