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

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 7 years 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 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 { 2980 {
2981 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight) 2981 if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.he ight)
2982 return; 2982 return;
2983 2983
2984 ViewportDescription adjustedDescription = description; 2984 ViewportDescription adjustedDescription = description;
2985 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) { 2985 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) {
2986 if (adjustedDescription.maxWidth.type() == ExtendToZoom) 2986 if (adjustedDescription.maxWidth.type() == ExtendToZoom)
2987 adjustedDescription.maxWidth = Length(); // auto 2987 adjustedDescription.maxWidth = Length(); // auto
2988 const int legacyWidthSnappingMagicNumber = 320; 2988 const int legacyWidthSnappingMagicNumber = 320;
2989 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber) 2989 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber)
2990 adjustedDescription.maxWidth = Length(100, ViewportPercentageWidth); 2990 adjustedDescription.maxWidth = Length(-1, Percent);
2991 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxWi dth.value() <= m_size.height) 2991 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxWi dth.value() <= m_size.height)
2992 adjustedDescription.maxHeight = Length(100, ViewportPercentageHeight ); 2992 adjustedDescription.maxHeight = Length(-2, Percent);
esprehn 2013/12/04 06:02:28 This makes me nervous... why the magic lengths?
2993 adjustedDescription.minWidth = adjustedDescription.maxWidth; 2993 adjustedDescription.minWidth = adjustedDescription.maxWidth;
2994 adjustedDescription.minHeight = adjustedDescription.maxHeight; 2994 adjustedDescription.minHeight = adjustedDescription.maxHeight;
2995 } 2995 }
2996 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2996 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2997 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); 2997 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size);
2998 2998
2999 if (settingsImpl()->clobberUserAgentInitialScaleQuirk() 2999 if (settingsImpl()->clobberUserAgentInitialScaleQuirk()
3000 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1 3000 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1
3001 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) { 3001 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) {
3002 if (description.maxWidth == Length(100, ViewportPercentageWidth) 3002 if (description.maxWidth == Length(-1, Percent)
3003 || (description.maxWidth.type() == ExtendToZoom && m_pageScaleConstr aintsSet.pageDefinedConstraints().initialScale == 1.0f)) 3003 || (description.maxWidth.type() == ExtendToZoom && m_pageScaleConstr aintsSet.pageDefinedConstraints().initialScale == 1.0f))
3004 setInitialPageScaleOverride(-1); 3004 setInitialPageScaleOverride(-1);
3005 } 3005 }
3006 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()); 3006 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());
3007 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 3007 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3008 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 3008 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
3009 m_pageScaleConstraintsSet.setNeedsReset(true); 3009 m_pageScaleConstraintsSet.setNeedsReset(true);
3010 if (mainFrameImpl() && mainFrameImpl()->frameView()) 3010 if (mainFrameImpl() && mainFrameImpl()->frameView())
3011 mainFrameImpl()->frameView()->setNeedsLayout(); 3011 mainFrameImpl()->frameView()->setNeedsLayout();
3012 } 3012 }
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4175 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4176 4176
4177 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4177 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4178 return false; 4178 return false;
4179 4179
4180 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4180 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4181 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4181 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4182 } 4182 }
4183 4183
4184 } // namespace blink 4184 } // namespace blink
OLDNEW
« Source/core/rendering/style/RenderStyle.h ('K') | « Source/web/PageScaleConstraintsSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698