OLD | NEW |
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 Loading... |
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 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4443 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4454 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4444 | 4455 |
4445 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4456 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4446 return false; | 4457 return false; |
4447 | 4458 |
4448 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4459 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4449 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4460 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4450 } | 4461 } |
4451 | 4462 |
4452 } // namespace blink | 4463 } // namespace blink |
OLD | NEW |