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

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

Issue 560623002: Adjust maximum scroll bounds on FrameView to account for top controls. (Blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 , m_showFPSCounter(false) 407 , m_showFPSCounter(false)
408 , m_showPaintRects(false) 408 , m_showPaintRects(false)
409 , m_showDebugBorders(false) 409 , m_showDebugBorders(false)
410 , m_continuousPaintingEnabled(false) 410 , m_continuousPaintingEnabled(false)
411 , m_showScrollBottleneckRects(false) 411 , m_showScrollBottleneckRects(false)
412 , m_baseBackgroundColor(Color::white) 412 , m_baseBackgroundColor(Color::white)
413 , m_backgroundColorOverride(Color::transparent) 413 , m_backgroundColorOverride(Color::transparent)
414 , m_zoomFactorOverride(0) 414 , m_zoomFactorOverride(0)
415 , m_userGestureObserved(false) 415 , m_userGestureObserved(false)
416 , m_topControlsContentOffset(0) 416 , m_topControlsContentOffset(0)
417 , m_topControlsLayoutHeight(0)
417 { 418 {
418 Page::PageClients pageClients; 419 Page::PageClients pageClients;
419 pageClients.chromeClient = &m_chromeClientImpl; 420 pageClients.chromeClient = &m_chromeClientImpl;
420 pageClients.contextMenuClient = &m_contextMenuClientImpl; 421 pageClients.contextMenuClient = &m_contextMenuClientImpl;
421 pageClients.editorClient = &m_editorClientImpl; 422 pageClients.editorClient = &m_editorClientImpl;
422 pageClients.dragClient = &m_dragClientImpl; 423 pageClients.dragClient = &m_dragClientImpl;
423 pageClients.inspectorClient = &m_inspectorClientImpl; 424 pageClients.inspectorClient = &m_inspectorClientImpl;
424 pageClients.backForwardClient = &m_backForwardClientImpl; 425 pageClients.backForwardClient = &m_backForwardClientImpl;
425 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 426 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
426 pageClients.storageClient = &m_storageClientImpl; 427 pageClients.storageClient = &m_storageClientImpl;
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 if (page()->inspectorController().deviceEmulationEnabled()) { 1660 if (page()->inspectorController().deviceEmulationEnabled()) {
1660 if (Document* document = localFrameRootTemporary()->frame()->document()) 1661 if (Document* document = localFrameRootTemporary()->frame()->document())
1661 document->mediaQueryAffectingValueChanged(); 1662 document->mediaQueryAffectingValueChanged();
1662 } 1663 }
1663 } 1664 }
1664 1665
1665 void WebViewImpl::setTopControlsContentOffset(float offset) 1666 void WebViewImpl::setTopControlsContentOffset(float offset)
1666 { 1667 {
1667 m_topControlsContentOffset = offset; 1668 m_topControlsContentOffset = offset;
1668 m_layerTreeView->setTopControlsContentOffset(offset); 1669 m_layerTreeView->setTopControlsContentOffset(offset);
1670 didUpdateTopControls();
1671 }
1672
1673 void WebViewImpl::setTopControlsLayoutHeight(float height)
1674 {
1675 m_topControlsLayoutHeight = height;
1676 didUpdateTopControls();
1677 }
1678
1679 void WebViewImpl::didUpdateTopControls()
1680 {
1681 FrameView* view = localFrameRootTemporary()->frameView();
1682 if (!view)
1683 return;
1684
1685 // The viewport bounds were adjusted on the compositor by this much due to t op controls. Tell
1686 // the FrameView about it so it can make correct scroll offset clamping deci sions during compositor
1687 // commits.
1688 float topControlsViewportAdjustment = m_topControlsContentOffset - m_topCont rolsLayoutHeight;
1689 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
bokan 2014/09/09 23:14:19 There's also a Chromium-side patch that just calls
aelias_OOO_until_Jul13 2014/09/10 01:57:29 If you prefer, you could also avoid the third patc
bokan 2014/09/10 13:51:52 One liners like that are easy enough to land + I'd
aelias_OOO_until_Jul13 2014/09/10 15:51:45 Yes, feel free to TBR that and mention I preapprov
1669 } 1690 }
1670 1691
1671 void WebViewImpl::resize(const WebSize& newSize) 1692 void WebViewImpl::resize(const WebSize& newSize)
1672 { 1693 {
1673 if (m_shouldAutoResize || m_size == newSize) 1694 if (m_shouldAutoResize || m_size == newSize)
1674 return; 1695 return;
1675 1696
1676 FrameView* view = localFrameRootTemporary()->frameView(); 1697 FrameView* view = localFrameRootTemporary()->frameView();
1677 if (!view) 1698 if (!view)
1678 return; 1699 return;
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4311 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4291 4312
4292 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4313 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4293 return false; 4314 return false;
4294 4315
4295 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4316 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4296 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4317 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4297 } 4318 }
4298 4319
4299 } // namespace blink 4320 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698