Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: Source/core/css/PropertySetCSSStyleDeclaration.cpp

Issue 18311002: Partial implementation of CSSVariablesMap for CSS Variables CSSOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed unused IDL callback definition Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/dom/WebCoreMemoryInstrumentation.h" 33 #include "core/dom/WebCoreMemoryInstrumentation.h"
33 #include "core/inspector/InspectorInstrumentation.h" 34 #include "core/inspector/InspectorInstrumentation.h"
34 #include <wtf/MemoryInstrumentationHashMap.h> 35 #include <wtf/MemoryInstrumentationHashMap.h>
35 36
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 274
274 ec = 0; 275 ec = 0;
275 bool changed = m_propertySet->setProperty(propertyID, value, important, cont extStyleSheet()); 276 bool changed = m_propertySet->setProperty(propertyID, value, important, cont extStyleSheet());
276 277
277 didMutate(changed ? PropertyChanged : NoChanges); 278 didMutate(changed ? PropertyChanged : NoChanges);
278 279
279 if (changed) 280 if (changed)
280 mutationScope.enqueueMutationRecord(); 281 mutationScope.enqueueMutationRecord();
281 } 282 }
282 283
284 unsigned PropertySetCSSStyleDeclaration::variableCount() const
285 {
286 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
287 return m_propertySet->variableCount();
288 }
289
290 String PropertySetCSSStyleDeclaration::variableValue(const AtomicString& name) c onst
291 {
292 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
293 return m_propertySet->variableValue(name);
294 }
295
296 void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionCode& ec)
297 {
298 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
299 StyleAttributeMutationScope mutationScope(this);
300 willMutate();
301 bool changed = m_propertySet->setVariableValue(name, value, ec);
302 didMutate(changed ? PropertyChanged : NoChanges);
303 if (changed)
304 mutationScope.enqueueMutationRecord();
305 }
306
307 bool PropertySetCSSStyleDeclaration::removeVariable(const AtomicString& name)
308 {
309 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
310 StyleAttributeMutationScope mutationScope(this);
311 willMutate();
312 bool changed = m_propertySet->removeVariable(name);
313 didMutate(changed ? PropertyChanged : NoChanges);
314 if (changed)
315 mutationScope.enqueueMutationRecord();
316 return changed;
317 }
318
319 void PropertySetCSSStyleDeclaration::clearVariables(ExceptionCode&)
320 {
321 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
322 StyleAttributeMutationScope mutationScope(this);
323 willMutate();
324 bool changed = m_propertySet->clearVariables();
325 didMutate(changed ? PropertyChanged : NoChanges);
326 if (changed)
327 mutationScope.enqueueMutationRecord();
328 }
329
283 CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* intern alValue) 330 CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* intern alValue)
284 { 331 {
285 if (!internalValue) 332 if (!internalValue)
286 return 0; 333 return 0;
287 334
288 // The map is here to maintain the object identity of the CSSValues over mul tiple invocations. 335 // The map is here to maintain the object identity of the CSSValues over mul tiple invocations.
289 // FIXME: It is likely that the identity is not important for web compatibil ity and this code should be removed. 336 // FIXME: It is likely that the identity is not important for web compatibil ity and this code should be removed.
290 if (!m_cssomCSSValueClones) 337 if (!m_cssomCSSValueClones)
291 m_cssomCSSValueClones = adoptPtr(new HashMap<CSSValue*, RefPtr<CSSValue> >); 338 m_cssomCSSValueClones = adoptPtr(new HashMap<CSSValue*, RefPtr<CSSValue> >);
292 339
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 m_parentElement->invalidateStyleAttribute(); 441 m_parentElement->invalidateStyleAttribute();
395 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); 442 StyleAttributeMutationScope(this).didInvalidateStyleAttr();
396 } 443 }
397 444
398 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const 445 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const
399 { 446 {
400 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; 447 return m_parentElement ? m_parentElement->document()->elementSheet() : 0;
401 } 448 }
402 449
403 } // namespace WebCore 450 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698