| OLD | NEW |
| 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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 | 1216 |
| 1217 void RenderStyle::setLetterSpacing(float letterSpacing) | 1217 void RenderStyle::setLetterSpacing(float letterSpacing) |
| 1218 { | 1218 { |
| 1219 FontSelector* currentFontSelector = font().fontSelector(); | 1219 FontSelector* currentFontSelector = font().fontSelector(); |
| 1220 FontDescription desc(fontDescription()); | 1220 FontDescription desc(fontDescription()); |
| 1221 desc.setLetterSpacing(letterSpacing); | 1221 desc.setLetterSpacing(letterSpacing); |
| 1222 setFontDescription(desc); | 1222 setFontDescription(desc); |
| 1223 font().update(currentFontSelector); | 1223 font().update(currentFontSelector); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void RenderStyle::setFontSize(float size) | 1226 void RenderStyle::setTextAutosizingMultiplier(float multiplier) |
| 1227 { | 1227 { |
| 1228 // size must be specifiedSize if Text Autosizing is enabled, but computedSiz
e if text | 1228 SET_VAR(inherited, textAutosizingMultiplier, multiplier); |
| 1229 // zoom is enabled (if neither is enabled it's irrelevant as they're probabl
y the same). | 1229 |
| 1230 float size = specifiedFontSize(); |
| 1230 | 1231 |
| 1231 ASSERT(std::isfinite(size)); | 1232 ASSERT(std::isfinite(size)); |
| 1232 if (!std::isfinite(size) || size < 0) | 1233 if (!std::isfinite(size) || size < 0) |
| 1233 size = 0; | 1234 size = 0; |
| 1234 else | 1235 else |
| 1235 size = std::min(maximumAllowedFontSize, size); | 1236 size = std::min(maximumAllowedFontSize, size); |
| 1236 | 1237 |
| 1237 FontSelector* currentFontSelector = font().fontSelector(); | 1238 FontSelector* currentFontSelector = font().fontSelector(); |
| 1238 FontDescription desc(fontDescription()); | 1239 FontDescription desc(fontDescription()); |
| 1239 desc.setSpecifiedSize(size); | 1240 desc.setSpecifiedSize(size); |
| 1240 desc.setComputedSize(size); | 1241 desc.setComputedSize(size); |
| 1241 | 1242 |
| 1242 float multiplier = textAutosizingMultiplier(); | |
| 1243 if (multiplier > 1) { | 1243 if (multiplier > 1) { |
| 1244 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size,
multiplier); | 1244 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size,
multiplier); |
| 1245 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize)
); | 1245 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize)
); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 setFontDescription(desc); | 1248 setFontDescription(desc); |
| 1249 font().update(currentFontSelector); | 1249 font().update(currentFontSelector); |
| 1250 } | 1250 } |
| 1251 | 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 | |
| 1261 void RenderStyle::addAppliedTextDecoration(const AppliedTextDecoration& decorati
on) | 1252 void RenderStyle::addAppliedTextDecoration(const AppliedTextDecoration& decorati
on) |
| 1262 { | 1253 { |
| 1263 RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->applie
dTextDecorations; | 1254 RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->applie
dTextDecorations; |
| 1264 | 1255 |
| 1265 if (!list) | 1256 if (!list) |
| 1266 list = AppliedTextDecorationList::create(); | 1257 list = AppliedTextDecorationList::create(); |
| 1267 else if (!list->hasOneRef()) | 1258 else if (!list->hasOneRef()) |
| 1268 list = list->copy(); | 1259 list = list->copy(); |
| 1269 | 1260 |
| 1270 if (inherited_flags.m_textUnderline) { | 1261 if (inherited_flags.m_textUnderline) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 if (rareInheritedData->appliedTextDecorations) | 1299 if (rareInheritedData->appliedTextDecorations) |
| 1309 rareInheritedData.access()->appliedTextDecorations = nullptr; | 1300 rareInheritedData.access()->appliedTextDecorations = nullptr; |
| 1310 } | 1301 } |
| 1311 | 1302 |
| 1312 void RenderStyle::clearMultiCol() | 1303 void RenderStyle::clearMultiCol() |
| 1313 { | 1304 { |
| 1314 rareNonInheritedData.access()->m_multiCol = nullptr; | 1305 rareNonInheritedData.access()->m_multiCol = nullptr; |
| 1315 rareNonInheritedData.access()->m_multiCol.init(); | 1306 rareNonInheritedData.access()->m_multiCol.init(); |
| 1316 } | 1307 } |
| 1317 | 1308 |
| 1318 void RenderStyle::setFontStretch(FontStretch stretch) | |
| 1319 { | |
| 1320 FontSelector* currentFontSelector = font().fontSelector(); | |
| 1321 FontDescription desc(fontDescription()); | |
| 1322 desc.setStretch(stretch); | |
| 1323 setFontDescription(desc); | |
| 1324 font().update(currentFontSelector); | |
| 1325 } | |
| 1326 | |
| 1327 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top,
LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const | 1309 void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top,
LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const |
| 1328 { | 1310 { |
| 1329 top = 0; | 1311 top = 0; |
| 1330 right = 0; | 1312 right = 0; |
| 1331 bottom = 0; | 1313 bottom = 0; |
| 1332 left = 0; | 1314 left = 0; |
| 1333 | 1315 |
| 1334 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; | 1316 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; |
| 1335 for (size_t i = 0; i < shadowCount; ++i) { | 1317 for (size_t i = 0; i < shadowCount; ++i) { |
| 1336 const ShadowData& shadow = shadowList->shadows()[i]; | 1318 const ShadowData& shadow = shadowList->shadows()[i]; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 horizontal || includeLogicalRightEdge); | 1748 horizontal || includeLogicalRightEdge); |
| 1767 | 1749 |
| 1768 edges[BSLeft] = BorderEdge(borderLeftWidth(), | 1750 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
| 1769 visitedDependentColor(CSSPropertyBorderLeftColor), | 1751 visitedDependentColor(CSSPropertyBorderLeftColor), |
| 1770 borderLeftStyle(), | 1752 borderLeftStyle(), |
| 1771 borderLeftIsTransparent(), | 1753 borderLeftIsTransparent(), |
| 1772 !horizontal || includeLogicalLeftEdge); | 1754 !horizontal || includeLogicalLeftEdge); |
| 1773 } | 1755 } |
| 1774 | 1756 |
| 1775 } // namespace blink | 1757 } // namespace blink |
| OLD | NEW |