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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 173953002: Make font-weight animatable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use clampTo<int>. Created 6 years, 10 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
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | 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) 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 } 1169 }
1170 return 0; 1170 return 0;
1171 } 1171 }
1172 1172
1173 const Font& RenderStyle::font() const { return inherited->font; } 1173 const Font& RenderStyle::font() const { return inherited->font; }
1174 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); } 1174 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); }
1175 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); } 1175 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); }
1176 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); } 1176 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); }
1177 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); } 1177 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); }
1178 int RenderStyle::fontSize() const { return fontDescription().computedPixelSize() ; } 1178 int RenderStyle::fontSize() const { return fontDescription().computedPixelSize() ; }
1179 FontWeight RenderStyle::fontWeight() const { return fontDescription().weight(); }
1179 1180
1180 float RenderStyle::wordSpacing() const { return fontDescription().wordSpacing(); } 1181 float RenderStyle::wordSpacing() const { return fontDescription().wordSpacing(); }
1181 float RenderStyle::letterSpacing() const { return fontDescription().letterSpacin g(); } 1182 float RenderStyle::letterSpacing() const { return fontDescription().letterSpacin g(); }
1182 1183
1183 bool RenderStyle::setFontDescription(const FontDescription& v) 1184 bool RenderStyle::setFontDescription(const FontDescription& v)
1184 { 1185 {
1185 if (inherited->font.fontDescription() != v) { 1186 if (inherited->font.fontDescription() != v) {
1186 inherited.access()->font = Font(v); 1187 inherited.access()->font = Font(v);
1187 return true; 1188 return true;
1188 } 1189 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 float multiplier = textAutosizingMultiplier(); 1242 float multiplier = textAutosizingMultiplier();
1242 if (multiplier > 1) { 1243 if (multiplier > 1) {
1243 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, multiplier); 1244 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, multiplier);
1244 desc.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize)); 1245 desc.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize));
1245 } 1246 }
1246 1247
1247 setFontDescription(desc); 1248 setFontDescription(desc);
1248 font().update(currentFontSelector); 1249 font().update(currentFontSelector);
1249 } 1250 }
1250 1251
1252 void RenderStyle::setFontWeight(FontWeight weight)
1253 {
1254 FontSelector* currentFontSelector = font().fontSelector();
1255 FontDescription desc(fontDescription());
1256 desc.setWeight(weight);
1257 setFontDescription(desc);
1258 font().update(currentFontSelector);
1259 }
1260
1251 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const 1261 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const
1252 { 1262 {
1253 top = 0; 1263 top = 0;
1254 right = 0; 1264 right = 0;
1255 bottom = 0; 1265 bottom = 0;
1256 left = 0; 1266 left = 0;
1257 1267
1258 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; 1268 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0;
1259 for (size_t i = 0; i < shadowCount; ++i) { 1269 for (size_t i = 0; i < shadowCount; ++i) {
1260 const ShadowData& shadow = shadowList->shadows()[i]; 1270 const ShadowData& shadow = shadowList->shadows()[i];
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 } 1599 }
1590 1600
1591 void RenderStyle::setBorderImageOutset(const BorderImageLengthBox& outset) 1601 void RenderStyle::setBorderImageOutset(const BorderImageLengthBox& outset)
1592 { 1602 {
1593 if (surround->border.m_image.outset() == outset) 1603 if (surround->border.m_image.outset() == outset)
1594 return; 1604 return;
1595 surround.access()->border.m_image.setOutset(outset); 1605 surround.access()->border.m_image.setOutset(outset);
1596 } 1606 }
1597 1607
1598 } // namespace WebCore 1608 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698