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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 61593006: Zoom instead of autosizing for desktop sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 // isn't set at the end of a layout. 2989 // isn't set at the end of a layout.
2990 if (view->needsLayout()) 2990 if (view->needsLayout())
2991 view->layout(); 2991 view->layout();
2992 } 2992 }
2993 2993
2994 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description) 2994 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description)
2995 { 2995 {
2996 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight) 2996 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight)
2997 return; 2997 return;
2998 2998
2999 ViewportDescription adjustedDescription = description; 2999 ViewportDescription adjustedDescription = description;
aelias_OOO_until_Jul13 2013/11/07 02:05:25 Could you mutate this value instead of changing th
aelias_OOO_until_Jul13 2013/11/07 22:02:50 Looks like you missed this comment, please follow
skobes 2013/11/08 03:26:47 I did miss this, sorry. Unfortunately I don't thi
aelias_OOO_until_Jul13 2013/11/08 04:06:17 Right, never mind, sorry.
3000 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) { 3000 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) {
3001 if (adjustedDescription.maxWidth.type() == ExtendToZoom) 3001 if (adjustedDescription.maxWidth.type() == ExtendToZoom)
3002 adjustedDescription.maxWidth = Length(); // auto 3002 adjustedDescription.maxWidth = Length(); // auto
3003 adjustedDescription.minWidth = adjustedDescription.maxWidth; 3003 adjustedDescription.minWidth = adjustedDescription.maxWidth;
3004 adjustedDescription.minHeight = adjustedDescription.maxHeight; 3004 adjustedDescription.minHeight = adjustedDescription.maxHeight;
3005 } 3005 }
3006 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 3006 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3007 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); 3007 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size);
3008 3008
3009 if (settingsImpl()->clobberUserAgentInitialScaleQuirk() 3009 if (settingsImpl()->clobberUserAgentInitialScaleQuirk()
3010 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1 3010 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1
3011 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) { 3011 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) {
3012 if (!description.maxWidth.isFixed() 3012 if (!description.maxWidth.isFixed()
3013 || (description.maxWidth == Length(100, ViewportPercentageWidth) && m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale == 1.0f)) 3013 || (description.maxWidth == Length(100, ViewportPercentageWidth) && m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale == 1.0f))
3014 setInitialPageScaleOverride(-1); 3014 setInitialPageScaleOverride(-1);
3015 } 3015 }
3016 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode()); 3016 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode());
3017 m_pageScaleConstraintsSet.applyDeviceScaleAdjustment(adjustedDescription, pa ge()->settings().deviceScaleAdjustment(), page()->settings().layoutFallbackWidth ());
aelias_OOO_until_Jul13 2013/11/07 02:05:25 layoutFallbackWidth setting is due for removal soo
skobes 2013/11/07 17:55:27 It's needed to avoid reducing the width below 980p
3017 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 3018 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3018 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 3019 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
3019 m_pageScaleConstraintsSet.setNeedsReset(true); 3020 m_pageScaleConstraintsSet.setNeedsReset(true);
3020 if (mainFrameImpl() && mainFrameImpl()->frameView()) 3021 if (mainFrameImpl() && mainFrameImpl()->frameView())
3021 mainFrameImpl()->frameView()->setNeedsLayout(); 3022 mainFrameImpl()->frameView()->setNeedsLayout();
3022 } 3023 }
3023 3024
3024 updateMainFrameLayoutSize(); 3025 updateMainFrameLayoutSize();
3025 } 3026 }
3026 3027
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4185 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4186 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4186 4187
4187 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4188 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4188 return false; 4189 return false;
4189 4190
4190 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4191 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4191 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4192 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4192 } 4193 }
4193 4194
4194 } // namespace WebKit 4195 } // namespace WebKit
OLDNEW
« Source/web/PageScaleConstraintsSet.cpp ('K') | « Source/web/PageScaleConstraintsSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698