OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 Boston, MA 02110-1301, USA. | 21 Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #include "platform/LengthFunctions.h" | 24 #include "platform/LengthFunctions.h" |
25 | 25 |
26 #include "platform/LayoutUnit.h" | 26 #include "platform/LayoutUnit.h" |
27 #include "platform/LengthSize.h" | 27 #include "platform/LengthSize.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 int intValueForLength(const Length& length, LayoutUnit maximumValue) | 31 int intValueForLength(const Length& length, int maximumValue) |
32 { | 32 { |
33 return static_cast<int>(valueForLength(length, maximumValue)); | 33 return static_cast<int>(valueForLength(length, LayoutUnit(maximumValue))); |
34 } | 34 } |
35 | 35 |
36 float floatValueForLength(const Length& length, float maximumValue) | 36 float floatValueForLength(const Length& length, float maximumValue) |
37 { | 37 { |
38 switch (length.type()) { | 38 switch (length.type()) { |
39 case Fixed: | 39 case Fixed: |
40 return length.getFloatValue(); | 40 return length.getFloatValue(); |
41 case Percent: | 41 case Percent: |
42 return static_cast<float>(maximumValue * length.percent() / 100.0f); | 42 return static_cast<float>(maximumValue * length.percent() / 100.0f); |
43 case FillAvailable: | 43 case FillAvailable: |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 ASSERT_NOT_REACHED(); | 116 ASSERT_NOT_REACHED(); |
117 return LayoutUnit(); | 117 return LayoutUnit(); |
118 } | 118 } |
119 | 119 |
120 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize&
boxSize) | 120 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize&
boxSize) |
121 { | 121 { |
122 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f
loatValueForLength(lengthSize.height(), boxSize.height())); | 122 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f
loatValueForLength(lengthSize.height(), boxSize.height())); |
123 } | 123 } |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
OLD | NEW |