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

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

Issue 2657773005: Revert of Use full viewport height for layout if URL bar is locked shown or hidden. (Closed)
Patch Set: Created 3 years, 10 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
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 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 page()->frameHost().visualViewport().setSize(newSize); 1771 page()->frameHost().visualViewport().setSize(newSize);
1772 page()->frameHost().visualViewport().clampToBoundaries(); 1772 page()->frameHost().visualViewport().clampToBoundaries();
1773 } 1773 }
1774 1774
1775 void WebViewImpl::performResize() { 1775 void WebViewImpl::performResize() {
1776 // We'll keep the initial containing block size from changing when the top 1776 // We'll keep the initial containing block size from changing when the top
1777 // controls hide so that the ICB will always be the same size as the 1777 // controls hide so that the ICB will always be the same size as the
1778 // viewport with the browser controls shown. 1778 // viewport with the browser controls shown.
1779 IntSize ICBSize = m_size; 1779 IntSize ICBSize = m_size;
1780 if (RuntimeEnabledFeatures::inertTopControlsEnabled() && 1780 if (RuntimeEnabledFeatures::inertTopControlsEnabled() &&
1781 browserControls().permittedState() == WebBrowserControlsBoth &&
1782 !browserControls().shrinkViewport()) 1781 !browserControls().shrinkViewport())
1783 ICBSize.expand(0, -browserControls().height()); 1782 ICBSize.expand(0, -browserControls().height());
1784 1783
1785 pageScaleConstraintsSet().didChangeInitialContainingBlockSize(ICBSize); 1784 pageScaleConstraintsSet().didChangeInitialContainingBlockSize(ICBSize);
1786 1785
1787 updatePageDefinedViewportConstraints( 1786 updatePageDefinedViewportConstraints(
1788 mainFrameImpl()->frame()->document()->viewportDescription()); 1787 mainFrameImpl()->frame()->document()->viewportDescription());
1789 updateMainFrameLayoutSize(); 1788 updateMainFrameLayoutSize();
1790 1789
1791 page()->frameHost().visualViewport().setSize(m_size); 1790 page()->frameHost().visualViewport().setSize(m_size);
1792 1791
1793 if (mainFrameImpl()->frameView()) { 1792 if (mainFrameImpl()->frameView()) {
1794 mainFrameImpl()->frameView()->setInitialViewportSize(ICBSize); 1793 mainFrameImpl()->frameView()->setInitialViewportSize(ICBSize);
1795 if (!mainFrameImpl()->frameView()->needsLayout()) 1794 if (!mainFrameImpl()->frameView()->needsLayout())
1796 postLayoutResize(mainFrameImpl()); 1795 postLayoutResize(mainFrameImpl());
1797 } 1796 }
1798 } 1797 }
1799 1798
1800 void WebViewImpl::updateBrowserControlsState(WebBrowserControlsState constraint, 1799 void WebViewImpl::updateBrowserControlsState(WebBrowserControlsState constraint,
1801 WebBrowserControlsState current, 1800 WebBrowserControlsState current,
1802 bool animate) { 1801 bool animate) {
1803 WebBrowserControlsState oldPermittedState =
1804 browserControls().permittedState();
1805
1806 browserControls().updateConstraintsAndState(constraint, current, animate); 1802 browserControls().updateConstraintsAndState(constraint, current, animate);
1807 1803
1808 // If the controls are going from a locked to an unlocked state, or
1809 // vice-versa, then we need to force a recompute of the ICB size since that
1810 // depends on the permitted browser controls state.
1811 if (oldPermittedState != constraint &&
1812 (oldPermittedState == WebBrowserControlsBoth ||
1813 constraint == WebBrowserControlsBoth)) {
1814 performResize();
1815 }
1816
1817 if (m_layerTreeView) 1804 if (m_layerTreeView)
1818 m_layerTreeView->updateBrowserControlsState(constraint, current, animate); 1805 m_layerTreeView->updateBrowserControlsState(constraint, current, animate);
1819 } 1806 }
1820 1807
1821 void WebViewImpl::didUpdateBrowserControls() { 1808 void WebViewImpl::didUpdateBrowserControls() {
1822 if (m_layerTreeView) { 1809 if (m_layerTreeView) {
1823 m_layerTreeView->setBrowserControlsShownRatio( 1810 m_layerTreeView->setBrowserControlsShownRatio(
1824 browserControls().shownRatio()); 1811 browserControls().shownRatio());
1825 m_layerTreeView->setBrowserControlsHeight( 1812 m_layerTreeView->setBrowserControlsHeight(
1826 browserControls().height(), browserControls().shrinkViewport()); 1813 browserControls().height(), browserControls().shrinkViewport());
(...skipping 26 matching lines...) Expand all
1853 // scale, its adjustment must also be scaled by the minimum scale. 1840 // scale, its adjustment must also be scaled by the minimum scale.
1854 view->setBrowserControlsViewportAdjustment( 1841 view->setBrowserControlsViewportAdjustment(
1855 browserControlsViewportAdjustment / minimumPageScaleFactor()); 1842 browserControlsViewportAdjustment / minimumPageScaleFactor());
1856 } 1843 }
1857 } 1844 }
1858 1845
1859 BrowserControls& WebViewImpl::browserControls() { 1846 BrowserControls& WebViewImpl::browserControls() {
1860 return page()->frameHost().browserControls(); 1847 return page()->frameHost().browserControls();
1861 } 1848 }
1862 1849
1863 void WebViewImpl::resizeViewWhileAnchored(float browserControlsHeight, 1850 void WebViewImpl::resizeViewWhileAnchored(FrameView* view,
1851 float browserControlsHeight,
1864 bool browserControlsShrinkLayout) { 1852 bool browserControlsShrinkLayout) {
1865 DCHECK(mainFrameImpl()); 1853 DCHECK(mainFrameImpl());
1866 1854
1867 browserControls().setHeight(browserControlsHeight, 1855 browserControls().setHeight(browserControlsHeight,
1868 browserControlsShrinkLayout); 1856 browserControlsShrinkLayout);
1869 1857
1870 { 1858 {
1871 // Avoids unnecessary invalidations while various bits of state in 1859 // Avoids unnecessary invalidations while various bits of state in
1872 // TextAutosizer are updated. 1860 // TextAutosizer are updated.
1873 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); 1861 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 bool isRotation = 1905 bool isRotation =
1918 page()->settings().mainFrameResizesAreOrientationChanges() && 1906 page()->settings().mainFrameResizesAreOrientationChanges() &&
1919 m_size.width && contentsSize().width() && newSize.width != m_size.width && 1907 m_size.width && contentsSize().width() && newSize.width != m_size.width &&
1920 !m_fullscreenController->isFullscreen(); 1908 !m_fullscreenController->isFullscreen();
1921 m_size = newSize; 1909 m_size = newSize;
1922 1910
1923 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); 1911 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY);
1924 if (isRotation) { 1912 if (isRotation) {
1925 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords, 1913 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords,
1926 pageScaleConstraintsSet()); 1914 pageScaleConstraintsSet());
1927 resizeViewWhileAnchored(browserControlsHeight, browserControlsShrinkLayout); 1915 resizeViewWhileAnchored(view, browserControlsHeight,
1916 browserControlsShrinkLayout);
1928 } else { 1917 } else {
1929 ResizeViewportAnchor::ResizeScope resizeScope(*m_resizeViewportAnchor); 1918 ResizeViewportAnchor::ResizeScope resizeScope(*m_resizeViewportAnchor);
1930 resizeViewWhileAnchored(browserControlsHeight, browserControlsShrinkLayout); 1919 resizeViewWhileAnchored(view, browserControlsHeight,
1920 browserControlsShrinkLayout);
1931 } 1921 }
1932 sendResizeEventAndRepaint(); 1922 sendResizeEventAndRepaint();
1933 } 1923 }
1934 1924
1935 void WebViewImpl::resize(const WebSize& newSize) { 1925 void WebViewImpl::resize(const WebSize& newSize) {
1936 if (m_shouldAutoResize || m_size == newSize) 1926 if (m_shouldAutoResize || m_size == newSize)
1937 return; 1927 return;
1938 1928
1939 resizeWithBrowserControls(newSize, browserControls().height(), 1929 resizeWithBrowserControls(newSize, browserControls().height(),
1940 browserControls().shrinkViewport()); 1930 browserControls().shrinkViewport());
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
4212 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4202 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4213 return nullptr; 4203 return nullptr;
4214 return focusedFrame; 4204 return focusedFrame;
4215 } 4205 }
4216 4206
4217 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4207 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4218 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4208 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4219 } 4209 }
4220 4210
4221 } // namespace blink 4211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698