| 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "core/css/PropertySetCSSStyleDeclaration.h" | 23 #include "core/css/PropertySetCSSStyleDeclaration.h" |
| 24 | 24 |
| 25 #include "HTMLNames.h" | 25 #include "HTMLNames.h" |
| 26 #include "RuntimeEnabledFeatures.h" |
| 26 #include "core/css/CSSParser.h" | 27 #include "core/css/CSSParser.h" |
| 27 #include "core/css/CSSStyleSheet.h" | 28 #include "core/css/CSSStyleSheet.h" |
| 28 #include "core/css/StylePropertySet.h" | 29 #include "core/css/StylePropertySet.h" |
| 29 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
| 30 #include "core/dom/MutationObserverInterestGroup.h" | 31 #include "core/dom/MutationObserverInterestGroup.h" |
| 31 #include "core/dom/MutationRecord.h" | 32 #include "core/dom/MutationRecord.h" |
| 32 #include "core/inspector/InspectorInstrumentation.h" | 33 #include "core/inspector/InspectorInstrumentation.h" |
| 33 | 34 |
| 34 using namespace std; | 35 using namespace std; |
| 35 | 36 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 ec = 0; | 266 ec = 0; |
| 266 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); | 267 bool changed = m_propertySet->setProperty(propertyID, value, important, cont
extStyleSheet()); |
| 267 | 268 |
| 268 didMutate(changed ? PropertyChanged : NoChanges); | 269 didMutate(changed ? PropertyChanged : NoChanges); |
| 269 | 270 |
| 270 if (changed) | 271 if (changed) |
| 271 mutationScope.enqueueMutationRecord(); | 272 mutationScope.enqueueMutationRecord(); |
| 272 } | 273 } |
| 273 | 274 |
| 275 unsigned PropertySetCSSStyleDeclaration::variableCount() const |
| 276 { |
| 277 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 278 return m_propertySet->variableCount(); |
| 279 } |
| 280 |
| 281 String PropertySetCSSStyleDeclaration::variableValue(const AtomicString& name) c
onst |
| 282 { |
| 283 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 284 return m_propertySet->variableValue(name); |
| 285 } |
| 286 |
| 287 void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name,
const String& value, ExceptionCode&) |
| 288 { |
| 289 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 290 StyleAttributeMutationScope mutationScope(this); |
| 291 willMutate(); |
| 292 bool changed = m_propertySet->setVariableValue(name, value); |
| 293 didMutate(changed ? PropertyChanged : NoChanges); |
| 294 if (changed) |
| 295 mutationScope.enqueueMutationRecord(); |
| 296 } |
| 297 |
| 298 bool PropertySetCSSStyleDeclaration::removeVariable(const AtomicString& name) |
| 299 { |
| 300 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 301 StyleAttributeMutationScope mutationScope(this); |
| 302 willMutate(); |
| 303 bool changed = m_propertySet->removeVariable(name); |
| 304 didMutate(changed ? PropertyChanged : NoChanges); |
| 305 if (changed) |
| 306 mutationScope.enqueueMutationRecord(); |
| 307 return changed; |
| 308 } |
| 309 |
| 310 void PropertySetCSSStyleDeclaration::clearVariables(ExceptionCode&) |
| 311 { |
| 312 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| 313 StyleAttributeMutationScope mutationScope(this); |
| 314 willMutate(); |
| 315 bool changed = m_propertySet->clearVariables(); |
| 316 didMutate(changed ? PropertyChanged : NoChanges); |
| 317 if (changed) |
| 318 mutationScope.enqueueMutationRecord(); |
| 319 } |
| 320 |
| 274 CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* intern
alValue) | 321 CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* intern
alValue) |
| 275 { | 322 { |
| 276 if (!internalValue) | 323 if (!internalValue) |
| 277 return 0; | 324 return 0; |
| 278 | 325 |
| 279 // The map is here to maintain the object identity of the CSSValues over mul
tiple invocations. | 326 // The map is here to maintain the object identity of the CSSValues over mul
tiple invocations. |
| 280 // FIXME: It is likely that the identity is not important for web compatibil
ity and this code should be removed. | 327 // FIXME: It is likely that the identity is not important for web compatibil
ity and this code should be removed. |
| 281 if (!m_cssomCSSValueClones) | 328 if (!m_cssomCSSValueClones) |
| 282 m_cssomCSSValueClones = adoptPtr(new HashMap<CSSValue*, RefPtr<CSSValue>
>); | 329 m_cssomCSSValueClones = adoptPtr(new HashMap<CSSValue*, RefPtr<CSSValue>
>); |
| 283 | 330 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 m_parentElement->invalidateStyleAttribute(); | 418 m_parentElement->invalidateStyleAttribute(); |
| 372 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); | 419 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); |
| 373 } | 420 } |
| 374 | 421 |
| 375 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const | 422 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const |
| 376 { | 423 { |
| 377 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; | 424 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; |
| 378 } | 425 } |
| 379 | 426 |
| 380 } // namespace WebCore | 427 } // namespace WebCore |
| OLD | NEW |