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

Side by Side Diff: Source/core/dom/ViewportDescription.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 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/core/dom/TreeScope.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | 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 * (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
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
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
OLDNEW
« no previous file with comments | « Source/core/dom/TreeScope.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698