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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 years, 9 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
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1130
1131 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor(const LayoutRect& borde rRect, 1131 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor(const LayoutRect& borde rRect,
1132 const LayoutRectOutsets insets, bool includeLogicalLeftEdge, bool includeLog icalRightEdge) const 1132 const LayoutRectOutsets insets, bool includeLogicalLeftEdge, bool includeLog icalRightEdge) const
1133 { 1133 {
1134 LayoutRect innerRect(borderRect); 1134 LayoutRect innerRect(borderRect);
1135 innerRect.expand(insets); 1135 innerRect.expand(insets);
1136 1136
1137 FloatRoundedRect roundedRect(pixelSnappedIntRect(innerRect)); 1137 FloatRoundedRect roundedRect(pixelSnappedIntRect(innerRect));
1138 1138
1139 if (hasBorderRadius()) { 1139 if (hasBorderRadius()) {
1140 FloatRoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii(); 1140 FloatRoundedRect::Radii radii = getRoundedBorderFor(borderRect).getRadii ();
1141 // Insets use negative values. 1141 // Insets use negative values.
1142 radii.shrink( 1142 radii.shrink(
1143 -insets.top().toFloat(), 1143 -insets.top().toFloat(),
1144 -insets.bottom().toFloat(), 1144 -insets.bottom().toFloat(),
1145 -insets.left().toFloat(), 1145 -insets.left().toFloat(),
1146 -insets.right().toFloat()); 1146 -insets.right().toFloat());
1147 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge); 1147 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge);
1148 } 1148 }
1149 return roundedRect; 1149 return roundedRect;
1150 } 1150 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 } 1275 }
1276 1276
1277 CSSTransitionData& ComputedStyle::accessTransitions() 1277 CSSTransitionData& ComputedStyle::accessTransitions()
1278 { 1278 {
1279 if (!rareNonInheritedData.access()->m_transitions) 1279 if (!rareNonInheritedData.access()->m_transitions)
1280 rareNonInheritedData.access()->m_transitions = CSSTransitionData::create (); 1280 rareNonInheritedData.access()->m_transitions = CSSTransitionData::create ();
1281 return *rareNonInheritedData->m_transitions; 1281 return *rareNonInheritedData->m_transitions;
1282 } 1282 }
1283 1283
1284 const Font& ComputedStyle::font() const { return inherited->font; } 1284 const Font& ComputedStyle::font() const { return inherited->font; }
1285 const FontMetrics& ComputedStyle::fontMetrics() const { return inherited->font.f ontMetrics(); } 1285 const FontMetrics& ComputedStyle::getFontMetrics() const { return inherited->fon t.getFontMetrics(); }
1286 const FontDescription& ComputedStyle::fontDescription() const { return inherited ->font.fontDescription(); } 1286 const FontDescription& ComputedStyle::getFontDescription() const { return inheri ted->font.getFontDescription(); }
1287 float ComputedStyle::specifiedFontSize() const { return fontDescription().specif iedSize(); } 1287 float ComputedStyle::specifiedFontSize() const { return getFontDescription().spe cifiedSize(); }
1288 float ComputedStyle::computedFontSize() const { return fontDescription().compute dSize(); } 1288 float ComputedStyle::computedFontSize() const { return getFontDescription().comp utedSize(); }
1289 int ComputedStyle::fontSize() const { return fontDescription().computedPixelSize (); } 1289 int ComputedStyle::fontSize() const { return getFontDescription().computedPixelS ize(); }
1290 float ComputedStyle::fontSizeAdjust() const { return fontDescription().sizeAdjus t(); } 1290 float ComputedStyle::fontSizeAdjust() const { return getFontDescription().sizeAd just(); }
1291 bool ComputedStyle::hasFontSizeAdjust() const { return fontDescription().hasSize Adjust(); } 1291 bool ComputedStyle::hasFontSizeAdjust() const { return getFontDescription().hasS izeAdjust(); }
1292 FontWeight ComputedStyle::fontWeight() const { return fontDescription().weight() ; } 1292 FontWeight ComputedStyle::fontWeight() const { return getFontDescription().weigh t(); }
1293 FontStretch ComputedStyle::fontStretch() const { return fontDescription().stretc h(); } 1293 FontStretch ComputedStyle::fontStretch() const { return getFontDescription().str etch(); }
1294 1294
1295 TextDecoration ComputedStyle::textDecorationsInEffect() const 1295 TextDecoration ComputedStyle::textDecorationsInEffect() const
1296 { 1296 {
1297 int decorations = 0; 1297 int decorations = 0;
1298 1298
1299 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); 1299 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations();
1300 1300
1301 for (size_t i = 0; i < applied.size(); ++i) 1301 for (size_t i = 0; i < applied.size(); ++i)
1302 decorations |= applied[i].line(); 1302 decorations |= applied[i].line();
1303 1303
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 void ComputedStyle::removeVariable(const AtomicString& name) 1337 void ComputedStyle::removeVariable(const AtomicString& name)
1338 { 1338 {
1339 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ; 1339 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables ;
1340 if (!variables) 1340 if (!variables)
1341 return; 1341 return;
1342 if (!variables->hasOneRef()) 1342 if (!variables->hasOneRef())
1343 variables = variables->copy(); 1343 variables = variables->copy();
1344 variables->removeVariable(name); 1344 variables->removeVariable(name);
1345 } 1345 }
1346 1346
1347 float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing( ); } 1347 float ComputedStyle::wordSpacing() const { return getFontDescription().wordSpaci ng(); }
1348 float ComputedStyle::letterSpacing() const { return fontDescription().letterSpac ing(); } 1348 float ComputedStyle::letterSpacing() const { return getFontDescription().letterS pacing(); }
1349 1349
1350 bool ComputedStyle::setFontDescription(const FontDescription& v) 1350 bool ComputedStyle::setFontDescription(const FontDescription& v)
1351 { 1351 {
1352 if (inherited->font.fontDescription() != v) { 1352 if (inherited->font.getFontDescription() != v) {
1353 inherited.access()->font = Font(v); 1353 inherited.access()->font = Font(v);
1354 return true; 1354 return true;
1355 } 1355 }
1356 return false; 1356 return false;
1357 } 1357 }
1358 1358
1359 void ComputedStyle::setFont(const Font& font) 1359 void ComputedStyle::setFont(const Font& font)
1360 { 1360 {
1361 inherited.access()->font = font; 1361 inherited.access()->font = font;
1362 } 1362 }
1363 1363
1364 const Length& ComputedStyle::specifiedLineHeight() const { return inherited->lin e_height; } 1364 const Length& ComputedStyle::specifiedLineHeight() const { return inherited->lin e_height; }
1365 Length ComputedStyle::lineHeight() const 1365 Length ComputedStyle::lineHeight() const
1366 { 1366 {
1367 const Length& lh = inherited->line_height; 1367 const Length& lh = inherited->line_height;
1368 // Unlike fontDescription().computedSize() and hence fontSize(), this is 1368 // Unlike getFontDescription().computedSize() and hence fontSize(), this is
1369 // recalculated on demand as we only store the specified line height. 1369 // recalculated on demand as we only store the specified line height.
1370 // FIXME: Should consider scaling the fixed part of any calc expressions 1370 // FIXME: Should consider scaling the fixed part of any calc expressions
1371 // too, though this involves messily poking into CalcExpressionLength. 1371 // too, though this involves messily poking into CalcExpressionLength.
1372 float multiplier = textAutosizingMultiplier(); 1372 float multiplier = textAutosizingMultiplier();
1373 if (multiplier > 1 && lh.isFixed()) 1373 if (multiplier > 1 && lh.isFixed())
1374 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip lier), Fixed); 1374 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip lier), Fixed);
1375 1375
1376 return lh; 1376 return lh;
1377 } 1377 }
1378 1378
1379 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); } 1379 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); }
1380 1380
1381 int ComputedStyle::computedLineHeight() const 1381 int ComputedStyle::computedLineHeight() const
1382 { 1382 {
1383 const Length& lh = lineHeight(); 1383 const Length& lh = lineHeight();
1384 1384
1385 // Negative value means the line height is not set. Use the font's built-in 1385 // Negative value means the line height is not set. Use the font's built-in
1386 // spacing, if avalible. 1386 // spacing, if avalible.
1387 if (lh.isNegative() && font().primaryFont()) 1387 if (lh.isNegative() && font().primaryFont())
1388 return fontMetrics().lineSpacing(); 1388 return getFontMetrics().lineSpacing();
1389 1389
1390 if (lh.hasPercent()) 1390 if (lh.hasPercent())
1391 return minimumValueForLength(lh, LayoutUnit(computedFontSize())); 1391 return minimumValueForLength(lh, LayoutUnit(computedFontSize()));
1392 1392
1393 return std::min(lh.value(), LayoutUnit::max().toFloat()); 1393 return std::min(lh.value(), LayoutUnit::max().toFloat());
1394 } 1394 }
1395 1395
1396 void ComputedStyle::setWordSpacing(float wordSpacing) 1396 void ComputedStyle::setWordSpacing(float wordSpacing)
1397 { 1397 {
1398 FontSelector* currentFontSelector = font().fontSelector(); 1398 FontSelector* currentFontSelector = font().getFontSelector();
1399 FontDescription desc(fontDescription()); 1399 FontDescription desc(getFontDescription());
1400 desc.setWordSpacing(wordSpacing); 1400 desc.setWordSpacing(wordSpacing);
1401 setFontDescription(desc); 1401 setFontDescription(desc);
1402 font().update(currentFontSelector); 1402 font().update(currentFontSelector);
1403 } 1403 }
1404 1404
1405 void ComputedStyle::setLetterSpacing(float letterSpacing) 1405 void ComputedStyle::setLetterSpacing(float letterSpacing)
1406 { 1406 {
1407 FontSelector* currentFontSelector = font().fontSelector(); 1407 FontSelector* currentFontSelector = font().getFontSelector();
1408 FontDescription desc(fontDescription()); 1408 FontDescription desc(getFontDescription());
1409 desc.setLetterSpacing(letterSpacing); 1409 desc.setLetterSpacing(letterSpacing);
1410 setFontDescription(desc); 1410 setFontDescription(desc);
1411 font().update(currentFontSelector); 1411 font().update(currentFontSelector);
1412 } 1412 }
1413 1413
1414 void ComputedStyle::setTextAutosizingMultiplier(float multiplier) 1414 void ComputedStyle::setTextAutosizingMultiplier(float multiplier)
1415 { 1415 {
1416 SET_VAR(inherited, textAutosizingMultiplier, multiplier); 1416 SET_VAR(inherited, textAutosizingMultiplier, multiplier);
1417 1417
1418 float size = specifiedFontSize(); 1418 float size = specifiedFontSize();
1419 1419
1420 ASSERT(std::isfinite(size)); 1420 ASSERT(std::isfinite(size));
1421 if (!std::isfinite(size) || size < 0) 1421 if (!std::isfinite(size) || size < 0)
1422 size = 0; 1422 size = 0;
1423 else 1423 else
1424 size = std::min(maximumAllowedFontSize, size); 1424 size = std::min(maximumAllowedFontSize, size);
1425 1425
1426 FontSelector* currentFontSelector = font().fontSelector(); 1426 FontSelector* currentFontSelector = font().getFontSelector();
1427 FontDescription desc(fontDescription()); 1427 FontDescription desc(getFontDescription());
1428 desc.setSpecifiedSize(size); 1428 desc.setSpecifiedSize(size);
1429 desc.setComputedSize(size); 1429 desc.setComputedSize(size);
1430 1430
1431 if (multiplier > 1) { 1431 if (multiplier > 1) {
1432 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, multiplier); 1432 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, multiplier);
1433 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize) ); 1433 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize) );
1434 } 1434 }
1435 1435
1436 setFontDescription(desc); 1436 setFontDescription(desc);
1437 font().update(currentFontSelector); 1437 font().update(currentFontSelector);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 if (!shadowList) 1881 if (!shadowList)
1882 return false; 1882 return false;
1883 for (size_t i = shadowList->shadows().size(); i--; ) { 1883 for (size_t i = shadowList->shadows().size(); i--; ) {
1884 if (shadowList->shadows()[i].color().isCurrentColor()) 1884 if (shadowList->shadows()[i].color().isCurrentColor())
1885 return true; 1885 return true;
1886 } 1886 }
1887 return false; 1887 return false;
1888 } 1888 }
1889 1889
1890 } // namespace blink 1890 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleFetchedImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698