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 21 matching lines...) Expand all Loading... |
32 #include "RenderArena.h" | 32 #include "RenderArena.h" |
33 #include "RenderObject.h" | 33 #include "RenderObject.h" |
34 #include "ScaleTransformOperation.h" | 34 #include "ScaleTransformOperation.h" |
35 #include "ShadowData.h" | 35 #include "ShadowData.h" |
36 #include "StyleImage.h" | 36 #include "StyleImage.h" |
37 #include "StyleInheritedData.h" | 37 #include "StyleInheritedData.h" |
38 #include "StyleResolver.h" | 38 #include "StyleResolver.h" |
39 #if ENABLE(TOUCH_EVENTS) | 39 #if ENABLE(TOUCH_EVENTS) |
40 #include "RenderTheme.h" | 40 #include "RenderTheme.h" |
41 #endif | 41 #endif |
| 42 #include "TextAutosizer.h" |
42 #include "WebCoreMemoryInstrumentation.h" | 43 #include "WebCoreMemoryInstrumentation.h" |
43 #include <wtf/MathExtras.h> | 44 #include <wtf/MathExtras.h> |
44 #include <wtf/MemoryInstrumentationVector.h> | 45 #include <wtf/MemoryInstrumentationVector.h> |
45 #include <wtf/MemoryObjectInfo.h> | 46 #include <wtf/MemoryObjectInfo.h> |
46 #include <wtf/StdLibExtras.h> | 47 #include <wtf/StdLibExtras.h> |
47 #include <algorithm> | 48 #include <algorithm> |
48 | 49 |
49 #if ENABLE(TEXT_AUTOSIZING) | |
50 #include "TextAutosizer.h" | |
51 #endif | |
52 | |
53 using namespace std; | 50 using namespace std; |
54 | 51 |
55 namespace WebCore { | 52 namespace WebCore { |
56 | 53 |
57 struct SameSizeAsBorderValue { | 54 struct SameSizeAsBorderValue { |
58 RGBA32 m_color; | 55 RGBA32 m_color; |
59 unsigned m_width; | 56 unsigned m_width; |
60 }; | 57 }; |
61 | 58 |
62 COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue
_should_not_grow); | 59 COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue
_should_not_grow); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 || rareInheritedData->listStyleImage != other->rareInheritedData->li
stStyleImage) | 508 || rareInheritedData->listStyleImage != other->rareInheritedData->li
stStyleImage) |
512 return StyleDifferenceLayout; | 509 return StyleDifferenceLayout; |
513 | 510 |
514 if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.g
et())) | 511 if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.g
et())) |
515 return StyleDifferenceLayout; | 512 return StyleDifferenceLayout; |
516 | 513 |
517 if (textStrokeWidth() != other->textStrokeWidth()) | 514 if (textStrokeWidth() != other->textStrokeWidth()) |
518 return StyleDifferenceLayout; | 515 return StyleDifferenceLayout; |
519 } | 516 } |
520 | 517 |
521 #if ENABLE(TEXT_AUTOSIZING) | |
522 if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMul
tiplier) | 518 if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMul
tiplier) |
523 return StyleDifferenceLayout; | 519 return StyleDifferenceLayout; |
524 #endif | |
525 | 520 |
526 if (inherited->line_height != other->inherited->line_height | 521 if (inherited->line_height != other->inherited->line_height |
527 || inherited->font != other->inherited->font | 522 || inherited->font != other->inherited->font |
528 || inherited->horizontal_border_spacing != other->inherited->horizontal_
border_spacing | 523 || inherited->horizontal_border_spacing != other->inherited->horizontal_
border_spacing |
529 || inherited->vertical_border_spacing != other->inherited->vertical_bord
er_spacing | 524 || inherited->vertical_border_spacing != other->inherited->vertical_bord
er_spacing |
530 || inherited_flags._box_direction != other->inherited_flags._box_directi
on | 525 || inherited_flags._box_direction != other->inherited_flags._box_directi
on |
531 || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering | 526 || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering |
532 || noninherited_flags._position != other->noninherited_flags._position | 527 || noninherited_flags._position != other->noninherited_flags._position |
533 || noninherited_flags._floating != other->noninherited_flags._floating | 528 || noninherited_flags._floating != other->noninherited_flags._floating |
534 || noninherited_flags._originalDisplay != other->noninherited_flags._ori
ginalDisplay) | 529 || noninherited_flags._originalDisplay != other->noninherited_flags._ori
ginalDisplay) |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inhe
rited->font.wordSpacing()); | 1229 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inhe
rited->font.wordSpacing()); |
1235 return true; | 1230 return true; |
1236 } | 1231 } |
1237 return false; | 1232 return false; |
1238 } | 1233 } |
1239 | 1234 |
1240 Length RenderStyle::specifiedLineHeight() const { return inherited->line_height;
} | 1235 Length RenderStyle::specifiedLineHeight() const { return inherited->line_height;
} |
1241 Length RenderStyle::lineHeight() const | 1236 Length RenderStyle::lineHeight() const |
1242 { | 1237 { |
1243 const Length& lh = inherited->line_height; | 1238 const Length& lh = inherited->line_height; |
1244 #if ENABLE(TEXT_AUTOSIZING) | |
1245 // Unlike fontDescription().computedSize() and hence fontSize(), this is | 1239 // Unlike fontDescription().computedSize() and hence fontSize(), this is |
1246 // recalculated on demand as we only store the specified line height. | 1240 // recalculated on demand as we only store the specified line height. |
1247 // FIXME: Should consider scaling the fixed part of any calc expressions | 1241 // FIXME: Should consider scaling the fixed part of any calc expressions |
1248 // too, though this involves messily poking into CalcExpressionLength. | 1242 // too, though this involves messily poking into CalcExpressionLength. |
1249 float multiplier = textAutosizingMultiplier(); | 1243 float multiplier = textAutosizingMultiplier(); |
1250 if (multiplier > 1 && lh.isFixed()) | 1244 if (multiplier > 1 && lh.isFixed()) |
1251 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip
lier), Fixed); | 1245 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip
lier), Fixed); |
1252 #endif | 1246 |
1253 return lh; | 1247 return lh; |
1254 } | 1248 } |
1255 void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited,
line_height, specifiedLineHeight); } | 1249 void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited,
line_height, specifiedLineHeight); } |
1256 | 1250 |
1257 int RenderStyle::computedLineHeight(RenderView* renderView) const | 1251 int RenderStyle::computedLineHeight(RenderView* renderView) const |
1258 { | 1252 { |
1259 const Length& lh = lineHeight(); | 1253 const Length& lh = lineHeight(); |
1260 | 1254 |
1261 // Negative value means the line height is not set. Use the font's built-in
spacing. | 1255 // Negative value means the line height is not set. Use the font's built-in
spacing. |
1262 if (lh.isNegative()) | 1256 if (lh.isNegative()) |
(...skipping 20 matching lines...) Expand all Loading... |
1283 if (!std::isfinite(size) || size < 0) | 1277 if (!std::isfinite(size) || size < 0) |
1284 size = 0; | 1278 size = 0; |
1285 else | 1279 else |
1286 size = min(maximumAllowedFontSize, size); | 1280 size = min(maximumAllowedFontSize, size); |
1287 | 1281 |
1288 FontSelector* currentFontSelector = font().fontSelector(); | 1282 FontSelector* currentFontSelector = font().fontSelector(); |
1289 FontDescription desc(fontDescription()); | 1283 FontDescription desc(fontDescription()); |
1290 desc.setSpecifiedSize(size); | 1284 desc.setSpecifiedSize(size); |
1291 desc.setComputedSize(size); | 1285 desc.setComputedSize(size); |
1292 | 1286 |
1293 #if ENABLE(TEXT_AUTOSIZING) | |
1294 float multiplier = textAutosizingMultiplier(); | 1287 float multiplier = textAutosizingMultiplier(); |
1295 if (multiplier > 1) { | 1288 if (multiplier > 1) { |
1296 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size,
multiplier); | 1289 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size,
multiplier); |
1297 desc.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize)); | 1290 desc.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize)); |
1298 } | 1291 } |
1299 #endif | |
1300 | 1292 |
1301 setFontDescription(desc); | 1293 setFontDescription(desc); |
1302 font().update(currentFontSelector); | 1294 font().update(currentFontSelector); |
1303 } | 1295 } |
1304 | 1296 |
1305 void RenderStyle::getShadowExtent(const ShadowData* shadow, LayoutUnit &top, Lay
outUnit &right, LayoutUnit &bottom, LayoutUnit &left) const | 1297 void RenderStyle::getShadowExtent(const ShadowData* shadow, LayoutUnit &top, Lay
outUnit &right, LayoutUnit &bottom, LayoutUnit &left) const |
1306 { | 1298 { |
1307 top = 0; | 1299 top = 0; |
1308 right = 0; | 1300 right = 0; |
1309 bottom = 0; | 1301 bottom = 0; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 info.addMember(inherited, "inherited"); | 1647 info.addMember(inherited, "inherited"); |
1656 info.addMember(m_cachedPseudoStyles, "cachedPseudoStyles"); | 1648 info.addMember(m_cachedPseudoStyles, "cachedPseudoStyles"); |
1657 #if ENABLE(SVG) | 1649 #if ENABLE(SVG) |
1658 info.addMember(m_svgStyle, "svgStyle"); | 1650 info.addMember(m_svgStyle, "svgStyle"); |
1659 #endif | 1651 #endif |
1660 info.addMember(inherited_flags, "inherited_flags"); | 1652 info.addMember(inherited_flags, "inherited_flags"); |
1661 info.addMember(noninherited_flags, "noninherited_flags"); | 1653 info.addMember(noninherited_flags, "noninherited_flags"); |
1662 } | 1654 } |
1663 | 1655 |
1664 } // namespace WebCore | 1656 } // namespace WebCore |
OLD | NEW |