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

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

Issue 643473002: Made top controls work with virtual viewport pinch-to-zoom. (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed mac breakage (UseMockScrollbars) Created 6 years, 2 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') | Source/web/tests/FrameTestHelpers.h » ('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 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 m_topControlsLayoutHeight = height; 1709 m_topControlsLayoutHeight = height;
1710 didUpdateTopControls(); 1710 didUpdateTopControls();
1711 } 1711 }
1712 1712
1713 void WebViewImpl::didUpdateTopControls() 1713 void WebViewImpl::didUpdateTopControls()
1714 { 1714 {
1715 FrameView* view = localFrameRootTemporary()->frameView(); 1715 FrameView* view = localFrameRootTemporary()->frameView();
1716 if (!view) 1716 if (!view)
1717 return; 1717 return;
1718 1718
1719 // The viewport bounds were adjusted on the compositor by this much due to t op controls. Tell 1719 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr olsContentOffset;
1720 // the FrameView about it so it can make correct scroll offset clamping deci sions during compositor 1720 if (!pinchVirtualViewportEnabled()) {
1721 // commits. 1721 // The viewport bounds were adjusted on the compositor by this much due to top controls. Tell
1722 float topControlsViewportAdjustment = m_topControlsContentOffset - m_topCont rolsLayoutHeight; 1722 // the FrameView about it so it can make correct scroll offset clamping decisions during compositor
1723 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); 1723 // commits.
1724 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
1725 } else {
1726 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
1727 pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment);
1728
1729 // Shrink the FrameView by the amount that will maintain the aspect-rati o with the PinchViewport.
1730 float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport. visibleRect().height();
1731 float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).wi dth() / aspectRatio;
1732 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS crollbars).height();
1733 view->setTopControlsViewportAdjustment(adjustment);
1734 }
1724 } 1735 }
1725 1736
1726 void WebViewImpl::resize(const WebSize& newSize) 1737 void WebViewImpl::resize(const WebSize& newSize)
1727 { 1738 {
1728 if (m_shouldAutoResize || m_size == newSize) 1739 if (m_shouldAutoResize || m_size == newSize)
1729 return; 1740 return;
1730 1741
1731 FrameView* view = localFrameRootTemporary()->frameView(); 1742 FrameView* view = localFrameRootTemporary()->frameView();
1732 if (!view) 1743 if (!view)
1733 return; 1744 return;
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4455 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4445 4456
4446 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4457 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4447 return false; 4458 return false;
4448 4459
4449 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4460 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4450 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4461 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4451 } 4462 }
4452 4463
4453 } // namespace blink 4464 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698