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

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

Issue 203523002: Reland "Add plumbing for font-stretch" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: w/fix for ASSERT Created 6 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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 return *rareNonInheritedData->m_transitions; 1114 return *rareNonInheritedData->m_transitions;
1115 } 1115 }
1116 1116
1117 const Font& RenderStyle::font() const { return inherited->font; } 1117 const Font& RenderStyle::font() const { return inherited->font; }
1118 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); } 1118 const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fon tMetrics(); }
1119 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); } 1119 const FontDescription& RenderStyle::fontDescription() const { return inherited-> font.fontDescription(); }
1120 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); } 1120 float RenderStyle::specifiedFontSize() const { return fontDescription().specifie dSize(); }
1121 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); } 1121 float RenderStyle::computedFontSize() const { return fontDescription().computedS ize(); }
1122 int RenderStyle::fontSize() const { return fontDescription().computedPixelSize() ; } 1122 int RenderStyle::fontSize() const { return fontDescription().computedPixelSize() ; }
1123 FontWeight RenderStyle::fontWeight() const { return fontDescription().weight(); } 1123 FontWeight RenderStyle::fontWeight() const { return fontDescription().weight(); }
1124 FontStretch RenderStyle::fontStretch() const { return fontDescription().stretch( ); }
1124 1125
1125 TextDecoration RenderStyle::textDecorationsInEffect() const 1126 TextDecoration RenderStyle::textDecorationsInEffect() const
1126 { 1127 {
1127 int decorations = 0; 1128 int decorations = 0;
1128 1129
1129 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); 1130 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations();
1130 1131
1131 for (size_t i = 0; i < applied.size(); ++i) 1132 for (size_t i = 0; i < applied.size(); ++i)
1132 decorations |= applied[i].line(); 1133 decorations |= applied[i].line();
1133 1134
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } 1289 }
1289 1290
1290 void RenderStyle::clearAppliedTextDecorations() 1291 void RenderStyle::clearAppliedTextDecorations()
1291 { 1292 {
1292 inherited_flags.m_textUnderline = false; 1293 inherited_flags.m_textUnderline = false;
1293 1294
1294 if (rareInheritedData->appliedTextDecorations) 1295 if (rareInheritedData->appliedTextDecorations)
1295 rareInheritedData.access()->appliedTextDecorations = nullptr; 1296 rareInheritedData.access()->appliedTextDecorations = nullptr;
1296 } 1297 }
1297 1298
1299 void RenderStyle::setFontStretch(FontStretch stretch)
1300 {
1301 FontSelector* currentFontSelector = font().fontSelector();
1302 FontDescription desc(fontDescription());
1303 desc.setStretch(stretch);
1304 setFontDescription(desc);
1305 font().update(currentFontSelector);
1306 }
1307
1298 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const 1308 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const
1299 { 1309 {
1300 top = 0; 1310 top = 0;
1301 right = 0; 1311 right = 0;
1302 bottom = 0; 1312 bottom = 0;
1303 left = 0; 1313 left = 0;
1304 1314
1305 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; 1315 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0;
1306 for (size_t i = 0; i < shadowCount; ++i) { 1316 for (size_t i = 0; i < shadowCount; ++i) {
1307 const ShadowData& shadow = shadowList->shadows()[i]; 1317 const ShadowData& shadow = shadowList->shadows()[i];
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 // right 1697 // right
1688 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1698 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1689 if (radiiSum > rect.height()) 1699 if (radiiSum > rect.height())
1690 factor = std::min(rect.height() / radiiSum, factor); 1700 factor = std::min(rect.height() / radiiSum, factor);
1691 1701
1692 ASSERT(factor <= 1); 1702 ASSERT(factor <= 1);
1693 return factor; 1703 return factor;
1694 } 1704 }
1695 1705
1696 } // namespace blink 1706 } // namespace blink
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