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

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

Issue 1410173002: Only use fontMetrics if available in line-height computation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 1300
1301 return lh; 1301 return lh;
1302 } 1302 }
1303 1303
1304 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); } 1304 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i nherited, line_height, specifiedLineHeight); }
1305 1305
1306 int ComputedStyle::computedLineHeight() const 1306 int ComputedStyle::computedLineHeight() const
1307 { 1307 {
1308 const Length& lh = lineHeight(); 1308 const Length& lh = lineHeight();
1309 1309
1310 // Negative value means the line height is not set. Use the font's built-in spacing. 1310 // Negative value means the line height is not set. Use the font's built-in
1311 if (lh.isNegative()) 1311 // spacing, if avalible.
1312 if (lh.isNegative() && font().primaryFont())
1312 return fontMetrics().lineSpacing(); 1313 return fontMetrics().lineSpacing();
1313 1314
1314 if (lh.hasPercent()) 1315 if (lh.hasPercent())
1315 return minimumValueForLength(lh, fontSize()); 1316 return minimumValueForLength(lh, fontSize());
1316 1317
1317 return std::min(lh.value(), LayoutUnit::max().toFloat()); 1318 return std::min(lh.value(), LayoutUnit::max().toFloat());
1318 } 1319 }
1319 1320
1320 void ComputedStyle::setWordSpacing(float wordSpacing) 1321 void ComputedStyle::setWordSpacing(float wordSpacing)
1321 { 1322 {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 } 1799 }
1799 1800
1800 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) 1801 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other)
1801 { 1802 {
1802 setEmptyState(other.emptyState()); 1803 setEmptyState(other.emptyState());
1803 if (other.hasExplicitlyInheritedProperties()) 1804 if (other.hasExplicitlyInheritedProperties())
1804 setHasExplicitlyInheritedProperties(); 1805 setHasExplicitlyInheritedProperties();
1805 } 1806 }
1806 1807
1807 } // namespace blink 1808 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698