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

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.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 * 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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details. 16 * Lesser General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Lesser General Public 18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software 19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA 21 * 02110-1301 USA
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/css/CSSComputedStyleDeclaration.h" 25 #include "core/css/CSSComputedStyleDeclaration.h"
26 26
27 #include "CSSPropertyNames.h" 27 #include "CSSPropertyNames.h"
28 #include "FontFamilyNames.h" 28 #include "FontFamilyNames.h"
29 #include "RuntimeEnabledFeatures.h"
29 #include "core/css/BasicShapeFunctions.h" 30 #include "core/css/BasicShapeFunctions.h"
30 #include "core/css/CSSArrayFunctionValue.h" 31 #include "core/css/CSSArrayFunctionValue.h"
31 #include "core/css/CSSAspectRatioValue.h" 32 #include "core/css/CSSAspectRatioValue.h"
32 #include "core/css/CSSBorderImage.h" 33 #include "core/css/CSSBorderImage.h"
33 #include "core/css/CSSFilterValue.h" 34 #include "core/css/CSSFilterValue.h"
34 #include "core/css/CSSFunctionValue.h" 35 #include "core/css/CSSFunctionValue.h"
35 #include "core/css/CSSLineBoxContainValue.h" 36 #include "core/css/CSSLineBoxContainValue.h"
36 #include "core/css/CSSMixFunctionValue.h" 37 #include "core/css/CSSMixFunctionValue.h"
37 #include "core/css/CSSParser.h" 38 #include "core/css/CSSParser.h"
38 #include "core/css/CSSPrimitiveValue.h" 39 #include "core/css/CSSPrimitiveValue.h"
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope rtyID) 3001 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope rtyID)
3001 { 3002 {
3002 return getPropertyValue(propertyID); 3003 return getPropertyValue(propertyID);
3003 } 3004 }
3004 3005
3005 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const Strin g&, bool, ExceptionCode& ec) 3006 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const Strin g&, bool, ExceptionCode& ec)
3006 { 3007 {
3007 ec = NO_MODIFICATION_ALLOWED_ERR; 3008 ec = NO_MODIFICATION_ALLOWED_ERR;
3008 } 3009 }
3009 3010
3011 const HashMap<AtomicString, String>* CSSComputedStyleDeclaration::variableMap() const
3012 {
3013 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3014 Node* styledNode = this->styledNode();
3015 if (!styledNode)
3016 return 0;
3017 RefPtr<RenderStyle> style = styledNode->computedStyle(styledNode->isPseudoEl ement() ? NOPSEUDO : m_pseudoElementSpecifier);
3018 if (!style)
3019 return 0;
3020 return style->variables();
3021 }
3022
3023 unsigned CSSComputedStyleDeclaration::variableCount() const
3024 {
3025 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3026 const HashMap<AtomicString, String>* variables = variableMap();
3027 if (!variables)
3028 return 0;
3029 return variables->size();
3030 }
3031
3032 String CSSComputedStyleDeclaration::variableValue(const AtomicString& name) cons t
3033 {
3034 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3035 const HashMap<AtomicString, String>* variables = variableMap();
3036 if (!variables)
3037 return emptyString();
3038 HashMap<AtomicString, String>::const_iterator it = variables->find(name);
3039 if (it == variables->end())
3040 return emptyString();
3041 return it->value;
3042 }
3043
3044 void CSSComputedStyleDeclaration::setVariableValue(const AtomicString&, const St ring&, ExceptionCode& ec)
3045 {
3046 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3047 ec = NO_MODIFICATION_ALLOWED_ERR;
3048 }
3049
3050 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
3051 {
3052 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3053 return false;
3054 }
3055
3056 void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec)
3057 {
3058 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3059 ec = NO_MODIFICATION_ALLOWED_ERR;
3060 }
3061
3010 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const 3062 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const
3011 { 3063 {
3012 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage, 3064 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage,
3013 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment, 3065 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment,
3014 CSSProperty BackgroundPosition }; 3066 CSSProperty BackgroundPosition };
3015 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3067 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3016 CSSPropertyB ackgroundClip }; 3068 CSSPropertyB ackgroundClip };
3017 3069
3018 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3070 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3019 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); 3071 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator))));
3020 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); 3072 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator))));
3021 return list.release(); 3073 return list.release();
3022 } 3074 }
3023 3075
3024 } // namespace WebCore 3076 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698