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

Side by Side Diff: Source/platform/LengthFunctions.cpp

Issue 845313010: Allow Length::nonNanCalculatedValue to take a LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add reftest Created 5 years, 11 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 | « Source/platform/Length.cpp ('k') | 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 Lars Knoll (knoll@kde.org) 2 Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com) 4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com)
5 Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved. 6 Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue) 65 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue)
66 { 66 {
67 switch (length.type()) { 67 switch (length.type()) {
68 case Fixed: 68 case Fixed:
69 return length.value(); 69 return length.value();
70 case Percent: 70 case Percent:
71 // Don't remove the extra cast to float. It is needed for rounding on 32 -bit Intel machines that use the FPU stack. 71 // Don't remove the extra cast to float. It is needed for rounding on 32 -bit Intel machines that use the FPU stack.
72 return static_cast<float>(maximumValue * length.percent() / 100.0f); 72 return static_cast<float>(maximumValue * length.percent() / 100.0f);
73 case Calculated: 73 case Calculated:
74 return length.nonNanCalculatedValue(maximumValue); 74 return length.nonNanCalculatedValue(maximumValue.toFloat());
Julien - ping for review 2015/01/23 10:22:26 How about we just pass a LayoutUnit to the functio
75 case FillAvailable: 75 case FillAvailable:
76 case Auto: 76 case Auto:
77 return 0; 77 return 0;
78 case Intrinsic: 78 case Intrinsic:
79 case MinIntrinsic: 79 case MinIntrinsic:
80 case MinContent: 80 case MinContent:
81 case MaxContent: 81 case MaxContent:
82 case FitContent: 82 case FitContent:
83 case ExtendToZoom: 83 case ExtendToZoom:
84 case DeviceWidth: 84 case DeviceWidth:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT_NOT_REACHED(); 123 ASSERT_NOT_REACHED();
124 return 0; 124 return 0;
125 } 125 }
126 126
127 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize) 127 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
128 { 128 {
129 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f loatValueForLength(lengthSize.height(), boxSize.height())); 129 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f loatValueForLength(lengthSize.height(), boxSize.height()));
130 } 130 }
131 131
132 } // namespace blink 132 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/Length.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698