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

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

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use m_unit Created 5 years, 1 month 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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 return empty; 1262 return empty;
1263 } 1263 }
1264 if (inherited_flags.m_textUnderline) { 1264 if (inherited_flags.m_textUnderline) {
1265 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie dTextDecoration(TextDecorationUnderline))); 1265 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie dTextDecoration(TextDecorationUnderline)));
1266 return underline; 1266 return underline;
1267 } 1267 }
1268 1268
1269 return rareInheritedData->appliedTextDecorations->vector(); 1269 return rareInheritedData->appliedTextDecorations->vector();
1270 } 1270 }
1271 1271
1272 StyleVariableData* ComputedStyle::variables() const
1273 {
1274 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
1275 return rareInheritedData->variables.get();
1276 }
1277
1278 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable Data> value)
1279 {
1280 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ;
1281 if (!variables)
1282 variables = StyleVariableData::create();
1283 else if (!variables->hasOneRef())
1284 variables = variables->copy();
1285 variables->setVariable(name, value);
1286 }
1287
1288 void ComputedStyle::removeVariable(const AtomicString& name)
1289 {
1290 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ;
1291 if (!variables)
1292 return;
1293 if (!variables->hasOneRef())
1294 variables = variables->copy();
1295 variables->removeVariable(name);
1296 }
1297
1272 float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing( ); } 1298 float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing( ); }
1273 float ComputedStyle::letterSpacing() const { return fontDescription().letterSpac ing(); } 1299 float ComputedStyle::letterSpacing() const { return fontDescription().letterSpac ing(); }
1274 1300
1275 bool ComputedStyle::setFontDescription(const FontDescription& v) 1301 bool ComputedStyle::setFontDescription(const FontDescription& v)
1276 { 1302 {
1277 if (inherited->font.fontDescription() != v) { 1303 if (inherited->font.fontDescription() != v) {
1278 inherited.access()->font = Font(v); 1304 inherited.access()->font = Font(v);
1279 return true; 1305 return true;
1280 } 1306 }
1281 return false; 1307 return false;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 } 1817 }
1792 1818
1793 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) 1819 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other)
1794 { 1820 {
1795 setEmptyState(other.emptyState()); 1821 setEmptyState(other.emptyState());
1796 if (other.hasExplicitlyInheritedProperties()) 1822 if (other.hasExplicitlyInheritedProperties())
1797 setHasExplicitlyInheritedProperties(); 1823 setHasExplicitlyInheritedProperties();
1798 } 1824 }
1799 1825
1800 } // namespace blink 1826 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleRareInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698