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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 31ac24aa956778860b7b74b2639ba2d1d366c9d9..fa169158b81c529d37f765e06af04bba1d8c60e4 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1351,6 +1351,21 @@ Length ComputedStyle::lineHeight() const
void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
+float ComputedStyle::floatComputedLineHeight() const
+{
+ const Length& lh = lineHeight();
+
+ // Negative value means the line height is not set. Use the font's built-in
+ // spacing, if avalible.
+ if (lh.isNegative() && font().primaryFont())
+ return getFontMetrics().lineSpacing();
+
+ if (lh.hasPercent())
+ return minimumValueForLength(lh, LayoutUnit(computedFontSize()));
+
+ return std::min(lh.value(), LayoutUnit::max().toFloat());
+}
+
int ComputedStyle::computedLineHeight() const
{
const Length& lh = lineHeight();
« 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