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

Side by Side Diff: Source/core/style/ComputedStyle.cpp

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToTed Created 5 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. 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 *
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 return empty; 1245 return empty;
1246 } 1246 }
1247 if (inherited_flags.m_textUnderline) { 1247 if (inherited_flags.m_textUnderline) {
1248 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie dTextDecoration(TextDecorationUnderline))); 1248 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie dTextDecoration(TextDecorationUnderline)));
1249 return underline; 1249 return underline;
1250 } 1250 }
1251 1251
1252 return rareInheritedData->appliedTextDecorations->vector(); 1252 return rareInheritedData->appliedTextDecorations->vector();
1253 } 1253 }
1254 1254
1255 StyleVariableData* ComputedStyle::variables() const
1256 {
1257 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
1258 return rareInheritedData->variables.get();
1259 }
1260
1261 void ComputedStyle::setVariables(PassRefPtr<StyleVariableData> variableData)
1262 {
1263 rareInheritedData.access()->variables = variableData;
1264 }
1265
1266 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable Data> value)
1267 {
1268 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ;
1269 if (!variables)
1270 variables = StyleVariableData::create();
1271 else if (!variables->hasOneRef())
1272 variables = variables->copy();
1273 variables->setVariable(name, value);
1274 }
1275
1276 void ComputedStyle::removeVariable(const AtomicString& name)
1277 {
1278 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ;
1279 if (!variables)
1280 return;
1281 if (!variables->hasOneRef())
1282 variables = variables->copy();
1283 variables->removeVariable(name);
1284 }
1285
1255 float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing( ); } 1286 float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing( ); }
1256 float ComputedStyle::letterSpacing() const { return fontDescription().letterSpac ing(); } 1287 float ComputedStyle::letterSpacing() const { return fontDescription().letterSpac ing(); }
1257 1288
1258 bool ComputedStyle::setFontDescription(const FontDescription& v) 1289 bool ComputedStyle::setFontDescription(const FontDescription& v)
1259 { 1290 {
1260 if (inherited->font.fontDescription() != v) { 1291 if (inherited->font.fontDescription() != v) {
1261 inherited.access()->font = Font(v); 1292 inherited.access()->font = Font(v);
1262 return true; 1293 return true;
1263 } 1294 }
1264 return false; 1295 return false;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 } 1806 }
1776 1807
1777 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) 1808 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other)
1778 { 1809 {
1779 setEmptyState(other.emptyState()); 1810 setEmptyState(other.emptyState());
1780 if (other.hasExplicitlyInheritedProperties()) 1811 if (other.hasExplicitlyInheritedProperties())
1781 setHasExplicitlyInheritedProperties(); 1812 setHasExplicitlyInheritedProperties();
1782 } 1813 }
1783 1814
1784 } // namespace blink 1815 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698