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

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

Powered by Google App Engine
This is Rietveld 408576698