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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 years, 3 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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1507
1508 int ComputedStyle::computedLineHeight() const 1508 int ComputedStyle::computedLineHeight() const
1509 { 1509 {
1510 const Length& lh = lineHeight(); 1510 const Length& lh = lineHeight();
1511 1511
1512 // Negative value means the line height is not set. Use the font's built-in 1512 // Negative value means the line height is not set. Use the font's built-in
1513 // spacing, if avalible. 1513 // spacing, if avalible.
1514 if (lh.isNegative() && font().primaryFont()) 1514 if (lh.isNegative() && font().primaryFont())
1515 return getFontMetrics().lineSpacing(); 1515 return getFontMetrics().lineSpacing();
1516 1516
1517 if (lh.hasPercent()) 1517 if (lh.isPercentOrCalc())
1518 return minimumValueForLength(lh, LayoutUnit(computedFontSize())).toInt() ; 1518 return minimumValueForLength(lh, LayoutUnit(computedFontSize())).toInt() ;
1519 1519
1520 return std::min(lh.value(), LayoutUnit::max().toFloat()); 1520 return std::min(lh.value(), LayoutUnit::max().toFloat());
1521 } 1521 }
1522 1522
1523 void ComputedStyle::setWordSpacing(float wordSpacing) 1523 void ComputedStyle::setWordSpacing(float wordSpacing)
1524 { 1524 {
1525 FontSelector* currentFontSelector = font().getFontSelector(); 1525 FontSelector* currentFontSelector = font().getFontSelector();
1526 FontDescription desc(getFontDescription()); 1526 FontDescription desc(getFontDescription());
1527 desc.setWordSpacing(wordSpacing); 1527 desc.setWordSpacing(wordSpacing);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 if (value < 0) 2045 if (value < 0)
2046 fvalue -= 0.5f; 2046 fvalue -= 0.5f;
2047 else 2047 else
2048 fvalue += 0.5f; 2048 fvalue += 0.5f;
2049 } 2049 }
2050 2050
2051 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2051 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2052 } 2052 }
2053 2053
2054 } // namespace blink 2054 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp ('k') | third_party/WebKit/Source/core/style/GridLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698