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

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

Issue 26251010: Reset to initial page scale in additional scenarios. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test coverage and extra setNeedsLayout() call 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
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 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); 3007 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size);
3007 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode()); 3008 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode());
3009 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3010 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
3011 m_pageScaleConstraintsSet.setNeedsReset(true);
3012 if (mainFrameImpl() && mainFrameImpl()->frameView())
mnaganov (inactive) 2013/11/04 11:44:09 I guess, we will have to cherry pick this 'if' int
3013 mainFrameImpl()->frameView()->setNeedsLayout();
3014 }
3008 3015
3009 updateMainFrameLayoutSize(); 3016 updateMainFrameLayoutSize();
3010 } 3017 }
3011 3018
3012 void WebViewImpl::updateMainFrameLayoutSize() 3019 void WebViewImpl::updateMainFrameLayoutSize()
3013 { 3020 {
3014 if (m_fixedLayoutSizeLock || !mainFrameImpl()) 3021 if (m_fixedLayoutSizeLock || !mainFrameImpl())
3015 return; 3022 return;
3016 3023
3017 FrameView* view = mainFrameImpl()->frameView(); 3024 FrameView* view = mainFrameImpl()->frameView();
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4177 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4171 4178
4172 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4179 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4173 return false; 4180 return false;
4174 4181
4175 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4182 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4176 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4183 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4177 } 4184 }
4178 4185
4179 } // namespace WebKit 4186 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698