OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 { | 47 { |
48 if (length.isAuto()) | 48 if (length.isAuto()) |
49 return ViewportDescription::ValueAuto; | 49 return ViewportDescription::ValueAuto; |
50 | 50 |
51 if (length.isFixed()) | 51 if (length.isFixed()) |
52 return length.getFloatValue(); | 52 return length.getFloatValue(); |
53 | 53 |
54 if (length.type() == ExtendToZoom) | 54 if (length.type() == ExtendToZoom) |
55 return ViewportDescription::ValueExtendToZoom; | 55 return ViewportDescription::ValueExtendToZoom; |
56 | 56 |
57 if ((length.type() == Percent && direction == Horizontal) || length.type() =
= ViewportPercentageWidth) | 57 if (length.type() == Percent && direction == Horizontal) |
58 return initialViewportSize.width() * length.getFloatValue() / 100.0f; | 58 return initialViewportSize.width() * length.getFloatValue() / 100.0f; |
59 | 59 |
60 if ((length.type() == Percent && direction == Vertical) || length.type() ==
ViewportPercentageHeight) | 60 if (length.type() == Percent && direction == Vertical) |
61 return initialViewportSize.height() * length.getFloatValue() / 100.0f; | 61 return initialViewportSize.height() * length.getFloatValue() / 100.0f; |
62 | 62 |
63 if (length.type() == ViewportPercentageMin) | 63 if (length.type() == DeviceWidth) |
64 return min(initialViewportSize.width(), initialViewportSize.height()) *
length.viewportPercentageLength() / 100.0f; | 64 return initialViewportSize.width(); |
65 | 65 |
66 if (length.type() == ViewportPercentageMax) | 66 if (length.type() == DeviceHeight) |
67 return max(initialViewportSize.width(), initialViewportSize.height()) *
length.viewportPercentageLength() / 100.0f; | 67 return initialViewportSize.height(); |
68 | 68 |
69 ASSERT_NOT_REACHED(); | 69 ASSERT_NOT_REACHED(); |
70 return ViewportDescription::ValueAuto; | 70 return ViewportDescription::ValueAuto; |
71 } | 71 } |
72 | 72 |
73 PageScaleConstraints ViewportDescription::resolve(const FloatSize& initialViewpo
rtSize) const | 73 PageScaleConstraints ViewportDescription::resolve(const FloatSize& initialViewpo
rtSize) const |
74 { | 74 { |
75 float resultWidth = ValueAuto; | 75 float resultWidth = ValueAuto; |
76 float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize,
Horizontal); | 76 float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize,
Horizontal); |
77 float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize,
Horizontal); | 77 float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize,
Horizontal); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 PageScaleConstraints result; | 170 PageScaleConstraints result; |
171 result.minimumScale = resultMinZoom; | 171 result.minimumScale = resultMinZoom; |
172 result.maximumScale = resultMaxZoom; | 172 result.maximumScale = resultMaxZoom; |
173 result.initialScale = resultZoom; | 173 result.initialScale = resultZoom; |
174 result.layoutSize.setWidth(resultWidth); | 174 result.layoutSize.setWidth(resultWidth); |
175 result.layoutSize.setHeight(resultHeight); | 175 result.layoutSize.setHeight(resultHeight); |
176 return result; | 176 return result; |
177 } | 177 } |
178 | 178 |
179 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |