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

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: Created 7 years, 4 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 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 3062 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3063 return false; 3063 return false;
3064 } 3064 }
3065 3065
3066 void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec) 3066 void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec)
3067 { 3067 {
3068 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); 3068 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3069 ec = NoModificationAllowedError; 3069 ec = NoModificationAllowedError;
3070 } 3070 }
3071 3071
3072 CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::ComputedCSSVariablesI terator(const HashMap<AtomicString, String>* variables)
3073 : m_active(variables)
3074 {
3075 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
3076 if (m_active) {
3077 m_it = variables->begin();
3078 m_end = variables->end();
3079 }
3080 }
3081
3082 void CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::advance()
3083 {
3084 ASSERT(m_active);
3085 ++m_it;
3086 m_active = !atEnd();
3087 }
3088
3089 AtomicString CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::name() c onst
3090 {
3091 ASSERT(m_active);
3092 return m_it->key;
3093 }
3094
3095 String CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::value() const
3096 {
3097 ASSERT(m_active);
3098 return m_it->value;
3099 }
3100
3101
3072 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const 3102 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValu e() const
3073 { 3103 {
3074 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage, 3104 static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSProperty BackgroundColor, CSSPropertyBackgroundImage,
3075 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment, 3105 CSSProperty BackgroundRepeat, CSSPropertyBackgroundAttachment,
3076 CSSProperty BackgroundPosition }; 3106 CSSProperty BackgroundPosition };
3077 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3107 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3078 CSSPropertyB ackgroundClip }; 3108 CSSPropertyB ackgroundClip };
3079 3109
3080 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3110 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3081 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); 3111 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator))));
3082 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); 3112 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator))));
3083 return list.release(); 3113 return list.release();
3084 } 3114 }
3085 3115
3086 } // namespace WebCore 3116 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698