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

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

Issue 1820773002: getComputedStyle() should return used value for 'line-height' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 // too, though this involves messily poking into CalcExpressionLength. 1344 // too, though this involves messily poking into CalcExpressionLength.
1345 float multiplier = textAutosizingMultiplier(); 1345 float multiplier = textAutosizingMultiplier();
1346 if (multiplier > 1 && lh.isFixed()) 1346 if (multiplier > 1 && lh.isFixed())
1347 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip lier), Fixed); 1347 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip lier), Fixed);
1348 1348
1349 return lh; 1349 return lh;
1350 } 1350 }
1351 1351
1352 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); } 1352 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); }
1353 1353
1354 float ComputedStyle::floatComputedLineHeight() const
1355 {
1356 const Length& lh = lineHeight();
1357
1358 // Negative value means the line height is not set. Use the font's built-in
1359 // spacing, if avalible.
1360 if (lh.isNegative() && font().primaryFont())
1361 return getFontMetrics().lineSpacing();
1362
1363 if (lh.hasPercent())
1364 return minimumValueForLength(lh, LayoutUnit(computedFontSize()));
1365
1366 return std::min(lh.value(), LayoutUnit::max().toFloat());
1367 }
1368
1354 int ComputedStyle::computedLineHeight() const 1369 int ComputedStyle::computedLineHeight() const
1355 { 1370 {
1356 const Length& lh = lineHeight(); 1371 const Length& lh = lineHeight();
1357 1372
1358 // Negative value means the line height is not set. Use the font's built-in 1373 // Negative value means the line height is not set. Use the font's built-in
1359 // spacing, if avalible. 1374 // spacing, if avalible.
1360 if (lh.isNegative() && font().primaryFont()) 1375 if (lh.isNegative() && font().primaryFont())
1361 return getFontMetrics().lineSpacing(); 1376 return getFontMetrics().lineSpacing();
1362 1377
1363 if (lh.hasPercent()) 1378 if (lh.hasPercent())
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 if (!shadowList) 1867 if (!shadowList)
1853 return false; 1868 return false;
1854 for (size_t i = shadowList->shadows().size(); i--; ) { 1869 for (size_t i = shadowList->shadows().size(); i--; ) {
1855 if (shadowList->shadows()[i].color().isCurrentColor()) 1870 if (shadowList->shadows()[i].color().isCurrentColor())
1856 return true; 1871 return true;
1857 } 1872 }
1858 return false; 1873 return false;
1859 } 1874 }
1860 1875
1861 } // namespace blink 1876 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698