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

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: Rebased onto ToT, cleaned up includes 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
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.h ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope rtyID) 2996 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope rtyID)
2997 { 2997 {
2998 return getPropertyValue(propertyID); 2998 return getPropertyValue(propertyID);
2999 } 2999 }
3000 3000
3001 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const Strin g&, bool, ExceptionCode& ec) 3001 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const Strin g&, bool, ExceptionCode& ec)
3002 { 3002 {
3003 ec = NoModificationAllowedError; 3003 ec = NoModificationAllowedError;
3004 } 3004 }
3005 3005
3006 const HashMap<AtomicString, String>* CSSComputedStyleDeclaration::variableMap() const
3007 {
3008 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3009 Node* styledNode = this->styledNode();
3010 if (!styledNode)
3011 return 0;
3012 RefPtr<RenderStyle> style = styledNode->computedStyle(styledNode->isPseudoEl ement() ? NOPSEUDO : m_pseudoElementSpecifier);
3013 if (!style)
3014 return 0;
3015 return style->variables();
3016 }
3017
3018 unsigned CSSComputedStyleDeclaration::variableCount() const
3019 {
3020 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3021 const HashMap<AtomicString, String>* variables = variableMap();
3022 if (!variables)
3023 return 0;
3024 return variables->size();
3025 }
3026
3027 String CSSComputedStyleDeclaration::variableValue(const AtomicString& name) cons t
3028 {
3029 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3030 const HashMap<AtomicString, String>* variables = variableMap();
3031 if (!variables)
3032 return emptyString();
3033 HashMap<AtomicString, String>::const_iterator it = variables->find(name);
3034 if (it == variables->end())
3035 return emptyString();
3036 return it->value;
3037 }
3038
3039 void CSSComputedStyleDeclaration::setVariableValue(const AtomicString&, const St ring&, ExceptionCode& ec)
3040 {
3041 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3042 ec = NoModificationAllowedError;
3043 }
3044
3045 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
3046 {
3047 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3048 return false;
3049 }
3050
3051 void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec)
3052 {
3053 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3054 ec = NoModificationAllowedError;
3055 }
3056
3006 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const 3057 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const
3007 { 3058 {
3008 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage, 3059 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage,
3009 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment, 3060 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment,
3010 CSSProperty BackgroundPosition }; 3061 CSSProperty BackgroundPosition };
3011 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3062 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3012 CSSPropertyB ackgroundClip }; 3063 CSSPropertyB ackgroundClip };
3013 3064
3014 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3065 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3015 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); 3066 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator))));
3016 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); 3067 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator))));
3017 return list.release(); 3068 return list.release();
3018 } 3069 }
3019 3070
3020 } // namespace WebCore 3071 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.h ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698