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 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "platform/LengthFunctions.h" | 25 #include "platform/LengthFunctions.h" |
26 | 26 |
27 #include "platform/LayoutUnit.h" | 27 #include "platform/LayoutUnit.h" |
28 #include "platform/Length.h" | 28 #include "platform/Length.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 // This method is over-ridden in core/css/CSSLengthFunctions.cpp. | |
33 // Any changes here most likely also need to be applied there. | |
34 float floatValueForLength(const Length& length, float maximumValue) | 32 float floatValueForLength(const Length& length, float maximumValue) |
35 { | 33 { |
36 switch (length.type()) { | 34 switch (length.type()) { |
37 case Fixed: | 35 case Fixed: |
38 return length.getFloatValue(); | 36 return length.getFloatValue(); |
39 case Percent: | 37 case Percent: |
40 return static_cast<float>(maximumValue * length.percent() / 100.0f); | 38 return static_cast<float>(maximumValue * length.percent() / 100.0f); |
41 case FillAvailable: | 39 case FillAvailable: |
42 case Auto: | 40 case Auto: |
43 return static_cast<float>(maximumValue); | 41 return static_cast<float>(maximumValue); |
44 case Calculated: | 42 case Calculated: |
45 return length.nonNanCalculatedValue(maximumValue); | 43 return length.nonNanCalculatedValue(maximumValue); |
46 case ViewportPercentageWidth: | |
47 case ViewportPercentageHeight: | |
48 case ViewportPercentageMin: | |
49 case ViewportPercentageMax: | |
50 return 0; | |
51 case Intrinsic: | 44 case Intrinsic: |
52 case MinIntrinsic: | 45 case MinIntrinsic: |
53 case MinContent: | 46 case MinContent: |
54 case MaxContent: | 47 case MaxContent: |
55 case FitContent: | 48 case FitContent: |
56 case ExtendToZoom: | 49 case ExtendToZoom: |
| 50 case DeviceWidth: |
| 51 case DeviceHeight: |
57 case Undefined: | 52 case Undefined: |
58 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
59 return 0; | 54 return 0; |
60 } | 55 } |
61 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
62 return 0; | 57 return 0; |
63 } | 58 } |
64 | 59 |
65 } // namespace WebCore | 60 } // namespace WebCore |
OLD | NEW |