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

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

Issue 663993003: Don't calculate a top controls adjustment if pinch viewport size is uninitialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | no next file » | 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 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 return; 1722 return;
1723 1723
1724 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr olsContentOffset; 1724 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr olsContentOffset;
1725 if (!pinchVirtualViewportEnabled()) { 1725 if (!pinchVirtualViewportEnabled()) {
1726 // The viewport bounds were adjusted on the compositor by this much due to top controls. Tell 1726 // The viewport bounds were adjusted on the compositor by this much due to top controls. Tell
1727 // the FrameView about it so it can make correct scroll offset clamping decisions during compositor 1727 // the FrameView about it so it can make correct scroll offset clamping decisions during compositor
1728 // commits. 1728 // commits.
1729 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); 1729 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
1730 } else { 1730 } else {
1731 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 1731 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
1732
1733 if (!pinchViewport.visibleRect().width() || !pinchViewport.visibleRect() .height())
Peter Kasting 2014/10/22 19:32:21 Can this just be "if (pinchViewport.visibleRect().
bokan 2014/10/22 20:08:53 Done.
1734 return;
1735
1732 pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment); 1736 pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment);
1733 1737
1734 // Shrink the FrameView by the amount that will maintain the aspect-rati o with the PinchViewport. 1738 // Shrink the FrameView by the amount that will maintain the aspect-rati o with the PinchViewport.
1735 float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport. visibleRect().height(); 1739 float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport. visibleRect().height();
1736 float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).wi dth() / aspectRatio; 1740 float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).wi dth() / aspectRatio;
1737 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS crollbars).height(); 1741 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS crollbars).height();
1738 view->setTopControlsViewportAdjustment(adjustment); 1742 view->setTopControlsViewportAdjustment(adjustment);
1739 } 1743 }
1740 } 1744 }
1741 1745
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
4468 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4472 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4469 4473
4470 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4474 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4471 return false; 4475 return false;
4472 4476
4473 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4477 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4474 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4478 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4475 } 4479 }
4476 4480
4477 } // namespace blink 4481 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698