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

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

Issue 219223003: Add setting for fitting the content in the viewport width (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.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 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 2757
2758 void WebViewImpl::refreshPageScaleFactorAfterLayout() 2758 void WebViewImpl::refreshPageScaleFactorAfterLayout()
2759 { 2759 {
2760 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >view()) 2760 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >view())
2761 return; 2761 return;
2762 FrameView* view = page()->mainFrame()->view(); 2762 FrameView* view = page()->mainFrame()->view();
2763 2763
2764 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription()); 2764 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription());
2765 m_pageScaleConstraintsSet.computeFinalConstraints(); 2765 m_pageScaleConstraintsSet.computeFinalConstraints();
2766 2766
2767 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 2767 if (settings()->shrinksViewportContentToFit() && settings()->viewportEnabled () && !m_fixedLayoutSizeLock) {
2768 int verticalScrollbarWidth = 0; 2768 int verticalScrollbarWidth = 0;
2769 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar()) 2769 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
2770 verticalScrollbarWidth = view->verticalScrollbar()->width(); 2770 verticalScrollbarWidth = view->verticalScrollbar()->width();
2771 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(m_size, c ontentsSize(), verticalScrollbarWidth); 2771 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(m_size, c ontentsSize(), verticalScrollbarWidth);
2772 } 2772 }
2773 2773
2774 float newPageScaleFactor = pageScaleFactor(); 2774 float newPageScaleFactor = pageScaleFactor();
2775 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) { 2775 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) {
2776 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale; 2776 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale;
2777 m_pageScaleConstraintsSet.setNeedsReset(false); 2777 m_pageScaleConstraintsSet.setNeedsReset(false);
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 3975 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3976 3976
3977 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 3977 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
3978 return false; 3978 return false;
3979 3979
3980 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 3980 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
3981 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 3981 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
3982 } 3982 }
3983 3983
3984 } // namespace blink 3984 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698