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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS
crollbars).height(); | 1801 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS
crollbars).height(); |
1802 view->setTopControlsViewportAdjustment(adjustment); | 1802 view->setTopControlsViewportAdjustment(adjustment); |
1803 } | 1803 } |
1804 } | 1804 } |
1805 | 1805 |
1806 TopControls& WebViewImpl::topControls() | 1806 TopControls& WebViewImpl::topControls() |
1807 { | 1807 { |
1808 return page()->frameHost().topControls(); | 1808 return page()->frameHost().topControls(); |
1809 } | 1809 } |
1810 | 1810 |
| 1811 void WebViewImpl::resizeViewWhileAnchored(FrameView* view) |
| 1812 { |
| 1813 // FIXME: TextAutosizer does not yet support out-of-process frames. |
| 1814 if (mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame()) { |
| 1815 // Avoids unnecessary invalidations while various bits of state in TextA
utosizer are updated. |
| 1816 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); |
| 1817 performResize(); |
| 1818 } else { |
| 1819 performResize(); |
| 1820 } |
| 1821 |
| 1822 m_fullscreenController->updateSize(); |
| 1823 |
| 1824 // Relayout immediately to recalculate the minimum scale limit for rotation
anchoring. |
| 1825 if (view->needsLayout()) |
| 1826 view->layout(); |
| 1827 } |
| 1828 |
1811 void WebViewImpl::resize(const WebSize& newSize) | 1829 void WebViewImpl::resize(const WebSize& newSize) |
1812 { | 1830 { |
1813 if (m_shouldAutoResize || m_size == newSize) | 1831 if (m_shouldAutoResize || m_size == newSize) |
1814 return; | 1832 return; |
1815 | 1833 |
1816 WebLocalFrameImpl* mainFrame = mainFrameImpl(); | 1834 WebLocalFrameImpl* mainFrame = mainFrameImpl(); |
1817 if (!mainFrame) | 1835 if (!mainFrame) |
1818 return; | 1836 return; |
1819 | 1837 |
1820 FrameView* view = mainFrame->frameView(); | 1838 FrameView* view = mainFrame->frameView(); |
1821 if (!view) | 1839 if (!view) |
1822 return; | 1840 return; |
1823 | 1841 |
1824 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); | 1842 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); |
1825 | 1843 |
1826 bool isRotation = settings()->mainFrameResizesAreOrientationChanges() | 1844 bool isRotation = settings()->mainFrameResizesAreOrientationChanges() |
1827 && m_size.width && contentsSize().width() && newSize.width != m_size.wid
th && !m_fullscreenController->isFullscreen(); | 1845 && m_size.width && contentsSize().width() && newSize.width != m_size.wid
th && !m_fullscreenController->isFullscreen(); |
1828 m_size = newSize; | 1846 m_size = newSize; |
1829 | 1847 |
1830 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); | 1848 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); |
1831 OwnPtr<ViewportAnchor> viewportAnchor = isRotation | 1849 if (isRotation) { |
1832 ? adoptPtr<ViewportAnchor>(new RotationViewportAnchor(*view, pinchViewpo
rt, viewportAnchorCoords, m_pageScaleConstraintsSet)) | 1850 RotationViewportAnchor anchor(*view, pinchViewport, viewportAnchorCoords
, m_pageScaleConstraintsSet); |
1833 : adoptPtr<ViewportAnchor>(new ResizeViewportAnchor(*view, pinchViewport
)); | 1851 resizeViewWhileAnchored(view); |
1834 | |
1835 viewportAnchor->setAnchor(); | |
1836 | |
1837 // FIXME: TextAutosizer does not yet support out-of-process frames. | |
1838 if (mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame()) | |
1839 { | |
1840 // Avoids unnecessary invalidations while various bits of state in TextA
utosizer are updated. | |
1841 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); | |
1842 performResize(); | |
1843 } else { | 1852 } else { |
1844 performResize(); | 1853 ResizeViewportAnchor anchor(*view, pinchViewport); |
| 1854 resizeViewWhileAnchored(view); |
1845 } | 1855 } |
1846 | |
1847 m_fullscreenController->updateSize(); | |
1848 | |
1849 // Relayout immediately to recalculate the minimum scale limit for rotation
anchoring. | |
1850 if (view->needsLayout()) | |
1851 view->layout(); | |
1852 | |
1853 viewportAnchor->restoreToAnchor(); | |
1854 | |
1855 sendResizeEventAndRepaint(); | 1856 sendResizeEventAndRepaint(); |
1856 } | 1857 } |
1857 | 1858 |
1858 void WebViewImpl::willEndLiveResize() | 1859 void WebViewImpl::willEndLiveResize() |
1859 { | 1860 { |
1860 if (mainFrameImpl() && mainFrameImpl()->frameView()) | 1861 if (mainFrameImpl() && mainFrameImpl()->frameView()) |
1861 mainFrameImpl()->frameView()->willEndLiveResize(); | 1862 mainFrameImpl()->frameView()->willEndLiveResize(); |
1862 | 1863 |
1863 LocalFrame* frame = mainFrameImpl()->frame(); | 1864 LocalFrame* frame = mainFrameImpl()->frame(); |
1864 WebPluginContainerImpl* pluginContainer = WebLocalFrameImpl::pluginContainer
FromFrame(frame); | 1865 WebPluginContainerImpl* pluginContainer = WebLocalFrameImpl::pluginContainer
FromFrame(frame); |
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4500 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4501 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4501 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4502 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4502 } | 4503 } |
4503 | 4504 |
4504 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4505 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4505 { | 4506 { |
4506 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4507 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4507 } | 4508 } |
4508 | 4509 |
4509 } // namespace blink | 4510 } // namespace blink |
OLD | NEW |