| 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 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr
olsContentOffset; | 1719 // The viewport bounds were adjusted on the compositor by this much due to t
op controls. Tell |
| 1720 if (!pinchVirtualViewportEnabled()) { | 1720 // the FrameView about it so it can make correct scroll offset clamping deci
sions during compositor |
| 1721 // The viewport bounds were adjusted on the compositor by this much due
to top controls. Tell | 1721 // commits. |
| 1722 // the FrameView about it so it can make correct scroll offset clamping
decisions during compositor | 1722 float topControlsViewportAdjustment = m_topControlsContentOffset - m_topCont
rolsLayoutHeight; |
| 1723 // commits. | 1723 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); |
| 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 } | |
| 1735 } | 1724 } |
| 1736 | 1725 |
| 1737 void WebViewImpl::resize(const WebSize& newSize) | 1726 void WebViewImpl::resize(const WebSize& newSize) |
| 1738 { | 1727 { |
| 1739 if (m_shouldAutoResize || m_size == newSize) | 1728 if (m_shouldAutoResize || m_size == newSize) |
| 1740 return; | 1729 return; |
| 1741 | 1730 |
| 1742 FrameView* view = localFrameRootTemporary()->frameView(); | 1731 FrameView* view = localFrameRootTemporary()->frameView(); |
| 1743 if (!view) | 1732 if (!view) |
| 1744 return; | 1733 return; |
| (...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4443 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4455 | 4444 |
| 4456 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4445 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4457 return false; | 4446 return false; |
| 4458 | 4447 |
| 4459 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4448 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4460 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4449 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4461 } | 4450 } |
| 4462 | 4451 |
| 4463 } // namespace blink | 4452 } // namespace blink |
| OLD | NEW |