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

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

Issue 219123002: Read the default min-width value from the UA style sheets (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ViewportDescription.h ('k') | Source/core/frame/Settings.in » ('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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (length.type() == DeviceWidth) 63 if (length.type() == DeviceWidth)
64 return initialViewportSize.width(); 64 return initialViewportSize.width();
65 65
66 if (length.type() == DeviceHeight) 66 if (length.type() == DeviceHeight)
67 return initialViewportSize.height(); 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, Length legacyFallbackWidth) const
74 { 74 {
75 float resultWidth = ValueAuto; 75 float resultWidth = ValueAuto;
76 float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize, Horizontal); 76
77 float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize, Horizontal); 77 Length copyMaxWidth = maxWidth;
78 Length copyMinWidth = minWidth;
79 // In case the width (used for min- and max-width) is undefined.
80 if (isLegacyViewportType() && maxWidth.isAuto()) {
81 // The width viewport META property is translated into 'width' descripto rs, setting
82 // the 'min' value to 'extend-to-zoom' and the 'max' value to the intend ed length.
83 // In case the UA-defines a min-width, use that as length.
84 if (zoom == ViewportDescription::ValueAuto) {
85 copyMinWidth = Length(ExtendToZoom);
86 copyMaxWidth = legacyFallbackWidth;
87 } else if (maxHeight.isAuto()) {
88 copyMinWidth = Length(ExtendToZoom);
89 copyMaxWidth = Length(ExtendToZoom);
90 }
91 }
92
93 float resultMaxWidth = resolveViewportLength(copyMaxWidth, initialViewportSi ze, Horizontal);
94 float resultMinWidth = resolveViewportLength(copyMinWidth, initialViewportSi ze, Horizontal);
95
78 float resultHeight = ValueAuto; 96 float resultHeight = ValueAuto;
79 float resultMaxHeight = resolveViewportLength(maxHeight, initialViewportSize , Vertical); 97 float resultMaxHeight = resolveViewportLength(maxHeight, initialViewportSize , Vertical);
80 float resultMinHeight = resolveViewportLength(minHeight, initialViewportSize , Vertical); 98 float resultMinHeight = resolveViewportLength(minHeight, initialViewportSize , Vertical);
81 99
82 float resultZoom = zoom; 100 float resultZoom = zoom;
83 float resultMinZoom = minZoom; 101 float resultMinZoom = minZoom;
84 float resultMaxZoom = maxZoom; 102 float resultMaxZoom = maxZoom;
85 float resultUserZoom = userZoom; 103 float resultUserZoom = userZoom;
86 104
87 // 1. Resolve min-zoom and max-zoom values. 105 // 1. Resolve min-zoom and max-zoom values.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 PageScaleConstraints result; 188 PageScaleConstraints result;
171 result.minimumScale = resultMinZoom; 189 result.minimumScale = resultMinZoom;
172 result.maximumScale = resultMaxZoom; 190 result.maximumScale = resultMaxZoom;
173 result.initialScale = resultZoom; 191 result.initialScale = resultZoom;
174 result.layoutSize.setWidth(resultWidth); 192 result.layoutSize.setWidth(resultWidth);
175 result.layoutSize.setHeight(resultHeight); 193 result.layoutSize.setHeight(resultHeight);
176 return result; 194 return result;
177 } 195 }
178 196
179 } // namespace WebCore 197 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ViewportDescription.h ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698