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

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

Issue 18332019: Allow fractional letter- word-spacing values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: *actually* add the file Created 7 years, 5 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
« 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 return 0; 1146 return 0;
1147 } 1147 }
1148 1148
1149 const Font& RenderStyle::font() const { return inherited->font; } 1149 const Font& RenderStyle::font() const { return inherited->font; }
1150 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); } 1150 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); }
1151 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); } 1151 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); }
1152 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); } 1152 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); }
1153 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); } 1153 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); }
1154 int RenderStyle::fontSize() const { return inherited->font.pixelSize(); } 1154 int RenderStyle::fontSize() const { return inherited->font.pixelSize(); }
1155 1155
1156 int RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); } 1156 float RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); }
1157 int RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); } 1157 float RenderStyle::letterSpacing() const { return inherited->font.letterSpacing( ); }
1158 1158
1159 bool RenderStyle::setFontDescription(const FontDescription& v) 1159 bool RenderStyle::setFontDescription(const FontDescription& v)
1160 { 1160 {
1161 if (inherited->font.fontDescription() != v) { 1161 if (inherited->font.fontDescription() != v) {
1162 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inhe rited->font.wordSpacing()); 1162 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inhe rited->font.wordSpacing());
1163 return true; 1163 return true;
1164 } 1164 }
1165 return false; 1165 return false;
1166 } 1166 }
1167 1167
(...skipping 23 matching lines...) Expand all
1191 1191
1192 if (lh.isPercent()) 1192 if (lh.isPercent())
1193 return minimumValueForLength(lh, fontSize()); 1193 return minimumValueForLength(lh, fontSize());
1194 1194
1195 if (lh.isViewportPercentage()) 1195 if (lh.isViewportPercentage())
1196 return valueForLength(lh, 0, renderView); 1196 return valueForLength(lh, 0, renderView);
1197 1197
1198 return lh.value(); 1198 return lh.value();
1199 } 1199 }
1200 1200
1201 void RenderStyle::setWordSpacing(int v) { inherited.access()->font.setWordSpacin g(v); } 1201 void RenderStyle::setWordSpacing(float v) { inherited.access()->font.setWordSpac ing(v); }
1202 void RenderStyle::setLetterSpacing(int v) { inherited.access()->font.setLetterSp acing(v); } 1202 void RenderStyle::setLetterSpacing(float v) { inherited.access()->font.setLetter Spacing(v); }
1203 1203
1204 void RenderStyle::setFontSize(float size) 1204 void RenderStyle::setFontSize(float size)
1205 { 1205 {
1206 // size must be specifiedSize if Text Autosizing is enabled, but computedSiz e if text 1206 // size must be specifiedSize if Text Autosizing is enabled, but computedSiz e if text
1207 // zoom is enabled (if neither is enabled it's irrelevant as they're probabl y the same). 1207 // zoom is enabled (if neither is enabled it's irrelevant as they're probabl y the same).
1208 1208
1209 ASSERT(std::isfinite(size)); 1209 ASSERT(std::isfinite(size));
1210 if (!std::isfinite(size) || size < 0) 1210 if (!std::isfinite(size) || size < 0)
1211 size = 0; 1211 size = 0;
1212 else 1212 else
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 info.addMember(rareInheritedData, "rareInheritedData"); 1572 info.addMember(rareInheritedData, "rareInheritedData");
1573 // FIXME: inherited contains StyleImage and Font fields that might need to b e instrumented. 1573 // FIXME: inherited contains StyleImage and Font fields that might need to b e instrumented.
1574 info.addMember(inherited, "inherited"); 1574 info.addMember(inherited, "inherited");
1575 info.addMember(m_cachedPseudoStyles, "cachedPseudoStyles"); 1575 info.addMember(m_cachedPseudoStyles, "cachedPseudoStyles");
1576 info.addMember(m_svgStyle, "svgStyle"); 1576 info.addMember(m_svgStyle, "svgStyle");
1577 info.addMember(inherited_flags, "inherited_flags"); 1577 info.addMember(inherited_flags, "inherited_flags");
1578 info.addMember(noninherited_flags, "noninherited_flags"); 1578 info.addMember(noninherited_flags, "noninherited_flags");
1579 } 1579 }
1580 1580
1581 } // namespace WebCore 1581 } // 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