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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp Created 4 years, 10 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 605 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
606 606
607 if (primitiveValue.isLength()) 607 if (primitiveValue.isLength())
608 return primitiveValue.computeLength<Length>(lineHeightToLengthConversion Data(state)); 608 return primitiveValue.computeLength<Length>(lineHeightToLengthConversion Data(state));
609 if (primitiveValue.isPercentage()) 609 if (primitiveValue.isPercentage())
610 return Length((state.style()->computedFontSize() * primitiveValue.getInt Value()) / 100.0, Fixed); 610 return Length((state.style()->computedFontSize() * primitiveValue.getInt Value()) / 100.0, Fixed);
611 if (primitiveValue.isNumber()) 611 if (primitiveValue.isNumber())
612 return Length(primitiveValue.getDoubleValue() * 100.0, Percent); 612 return Length(primitiveValue.getDoubleValue() * 100.0, Percent);
613 if (primitiveValue.isCalculated()) { 613 if (primitiveValue.isCalculated()) {
614 Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue( lineHeightToLengthConversionData(state))); 614 Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue( lineHeightToLengthConversionData(state)));
615 return Length(valueForLength(zoomedLength, state.style()->computedFontSi ze()), Fixed); 615 return Length(valueForLength(zoomedLength, LayoutUnit(state.style()->com putedFontSize())), Fixed);
616 } 616 }
617 617
618 ASSERT(primitiveValue.getValueID() == CSSValueNormal); 618 ASSERT(primitiveValue.getValueID() == CSSValueNormal);
619 return ComputedStyle::initialLineHeight(); 619 return ComputedStyle::initialLineHeight();
620 } 620 }
621 621
622 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state , const CSSValue& value) 622 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state , const CSSValue& value)
623 { 623 {
624 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 624 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
625 ASSERT(primitiveValue.isNumber() || primitiveValue.isPercentage()); 625 ASSERT(primitiveValue.isNumber() || primitiveValue.isPercentage());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 977
978 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 978 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
979 { 979 {
980 if (value.isPathValue()) 980 if (value.isPathValue())
981 return convertPath(state, value); 981 return convertPath(state, value);
982 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 982 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
983 return nullptr; 983 return nullptr;
984 } 984 }
985 985
986 } // namespace blink 986 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698