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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ViewportDescription.h ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ViewportDescription.cpp
diff --git a/Source/core/dom/ViewportDescription.cpp b/Source/core/dom/ViewportDescription.cpp
index 7f63c6a663e4036492510384d15e084c4e089f88..5e928bd77ab187512933cd4b2862d5b9d3ef62d5 100644
--- a/Source/core/dom/ViewportDescription.cpp
+++ b/Source/core/dom/ViewportDescription.cpp
@@ -70,11 +70,29 @@ float ViewportDescription::resolveViewportLength(const Length& length, const Flo
return ViewportDescription::ValueAuto;
}
-PageScaleConstraints ViewportDescription::resolve(const FloatSize& initialViewportSize) const
+PageScaleConstraints ViewportDescription::resolve(const FloatSize& initialViewportSize, Length legacyFallbackWidth) const
{
float resultWidth = ValueAuto;
- float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize, Horizontal);
- float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize, Horizontal);
+
+ Length copyMaxWidth = maxWidth;
+ Length copyMinWidth = minWidth;
+ // In case the width (used for min- and max-width) is undefined.
+ if (isLegacyViewportType() && maxWidth.isAuto()) {
+ // The width viewport META property is translated into 'width' descriptors, setting
+ // the 'min' value to 'extend-to-zoom' and the 'max' value to the intended length.
+ // In case the UA-defines a min-width, use that as length.
+ if (zoom == ViewportDescription::ValueAuto) {
+ copyMinWidth = Length(ExtendToZoom);
+ copyMaxWidth = legacyFallbackWidth;
+ } else if (maxHeight.isAuto()) {
+ copyMinWidth = Length(ExtendToZoom);
+ copyMaxWidth = Length(ExtendToZoom);
+ }
+ }
+
+ float resultMaxWidth = resolveViewportLength(copyMaxWidth, initialViewportSize, Horizontal);
+ float resultMinWidth = resolveViewportLength(copyMinWidth, initialViewportSize, Horizontal);
+
float resultHeight = ValueAuto;
float resultMaxHeight = resolveViewportLength(maxHeight, initialViewportSize, Vertical);
float resultMinHeight = resolveViewportLength(minHeight, initialViewportSize, Vertical);
« 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