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

Side by Side Diff: Source/web/WebViewImpl.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/web/PageScaleConstraintsSet.cpp ('k') | no next file » | 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) 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 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 { 2888 {
2889 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight) 2889 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight)
2890 return; 2890 return;
2891 2891
2892 ViewportDescription adjustedDescription = description; 2892 ViewportDescription adjustedDescription = description;
2893 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) { 2893 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) {
2894 if (adjustedDescription.maxWidth.type() == ExtendToZoom) 2894 if (adjustedDescription.maxWidth.type() == ExtendToZoom)
2895 adjustedDescription.maxWidth = Length(); // auto 2895 adjustedDescription.maxWidth = Length(); // auto
2896 const int legacyWidthSnappingMagicNumber = 320; 2896 const int legacyWidthSnappingMagicNumber = 320;
2897 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber) 2897 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber)
2898 adjustedDescription.maxWidth = Length(100, ViewportPercentageWidth); 2898 adjustedDescription.maxWidth = Length(DeviceWidth);
2899 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxWi dth.value() <= m_size.height) 2899 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxWi dth.value() <= m_size.height)
2900 adjustedDescription.maxHeight = Length(100, ViewportPercentageHeight ); 2900 adjustedDescription.maxHeight = Length(DeviceHeight);
2901 adjustedDescription.minWidth = adjustedDescription.maxWidth; 2901 adjustedDescription.minWidth = adjustedDescription.maxWidth;
2902 adjustedDescription.minHeight = adjustedDescription.maxHeight; 2902 adjustedDescription.minHeight = adjustedDescription.maxHeight;
2903 } 2903 }
2904 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2904 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2905 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); 2905 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size);
2906 2906
2907 if (settingsImpl()->clobberUserAgentInitialScaleQuirk() 2907 if (settingsImpl()->clobberUserAgentInitialScaleQuirk()
2908 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1 2908 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1
2909 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) { 2909 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) {
2910 if (description.maxWidth == Length(100, ViewportPercentageWidth) 2910 if (description.maxWidth == Length(DeviceWidth)
2911 || (description.maxWidth.type() == ExtendToZoom && m_pageScaleConstr aintsSet.pageDefinedConstraints().initialScale == 1.0f)) 2911 || (description.maxWidth.type() == ExtendToZoom && m_pageScaleConstr aintsSet.pageDefinedConstraints().initialScale == 1.0f))
2912 setInitialPageScaleOverride(-1); 2912 setInitialPageScaleOverride(-1);
2913 } 2913 }
2914 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk()); 2914 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk());
2915 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2915 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2916 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 2916 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
2917 m_pageScaleConstraintsSet.setNeedsReset(true); 2917 m_pageScaleConstraintsSet.setNeedsReset(true);
2918 if (mainFrameImpl() && mainFrameImpl()->frameView()) 2918 if (mainFrameImpl() && mainFrameImpl()->frameView())
2919 mainFrameImpl()->frameView()->setNeedsLayout(); 2919 mainFrameImpl()->frameView()->setNeedsLayout();
2920 } 2920 }
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4013 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4014 4014
4015 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4015 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4016 return false; 4016 return false;
4017 4017
4018 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4018 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4019 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4019 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4020 } 4020 }
4021 4021
4022 } // namespace blink 4022 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/PageScaleConstraintsSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698