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

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

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased onto callback change Created 7 years, 3 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
(...skipping 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 3179 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3180 return false; 3180 return false;
3181 } 3181 }
3182 3182
3183 void CSSComputedStyleDeclaration::clearVariables(ExceptionState& es) 3183 void CSSComputedStyleDeclaration::clearVariables(ExceptionState& es)
3184 { 3184 {
3185 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 3185 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3186 es.throwDOMException(NoModificationAllowedError, "Failed to clear variables from a computed 'CSSStyleDeclaration': computed styles are read-only."); 3186 es.throwDOMException(NoModificationAllowedError, "Failed to clear variables from a computed 'CSSStyleDeclaration': computed styles are read-only.");
3187 } 3187 }
3188 3188
3189 CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::ComputedCSSVariablesI terator(const HashMap<AtomicString, String>* variables)
3190 : m_active(variables)
3191 {
3192 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3193 if (m_active) {
3194 m_it = variables->begin();
3195 m_end = variables->end();
3196 }
3197 }
3198
3199 void CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::advance()
3200 {
3201 ASSERT(m_active);
3202 ++m_it;
3203 m_active = !atEnd();
3204 }
3205
3206 AtomicString CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::name() c onst
3207 {
3208 ASSERT(m_active);
3209 return m_it->key;
3210 }
3211
3212 String CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::value() const
3213 {
3214 ASSERT(m_active);
3215 return m_it->value;
3216 }
3217
3189 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShortha nd() const 3218 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShortha nd() const
3190 { 3219 {
3191 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage, 3220 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage,
3192 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment, 3221 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment,
3193 CSSProperty BackgroundPosition }; 3222 CSSProperty BackgroundPosition };
3194 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3223 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3195 CSSPropertyB ackgroundClip }; 3224 CSSPropertyB ackgroundClip };
3196 3225
3197 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3226 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3198 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3227 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3199 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3228 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3200 return list.release(); 3229 return list.release();
3201 } 3230 }
3202 3231
3203 } // namespace WebCore 3232 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698