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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2622103002: Generalize browser controls adjustment for arbitrary scrollers. (Closed)
Patch Set: Fixed some comments Created 3 years, 11 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 &FrameView::updateWidgetsTimerFired), 166 &FrameView::updateWidgetsTimerFired),
167 m_isTransparent(false), 167 m_isTransparent(false),
168 m_baseBackgroundColor(Color::white), 168 m_baseBackgroundColor(Color::white),
169 m_mediaType(MediaTypeNames::screen), 169 m_mediaType(MediaTypeNames::screen),
170 m_safeToPropagateScrollToParent(true), 170 m_safeToPropagateScrollToParent(true),
171 m_scrollCorner(nullptr), 171 m_scrollCorner(nullptr),
172 m_stickyPositionObjectCount(0), 172 m_stickyPositionObjectCount(0),
173 m_inputEventsScaleFactorForEmulation(1), 173 m_inputEventsScaleFactorForEmulation(1),
174 m_layoutSizeFixedToFrameSize(true), 174 m_layoutSizeFixedToFrameSize(true),
175 m_didScrollTimer(this, &FrameView::didScrollTimerFired), 175 m_didScrollTimer(this, &FrameView::didScrollTimerFired),
176 m_browserControlsViewportAdjustment(0),
177 m_needsUpdateWidgetGeometries(false), 176 m_needsUpdateWidgetGeometries(false),
178 #if ENABLE(ASSERT) 177 #if ENABLE(ASSERT)
179 m_hasBeenDisposed(false), 178 m_hasBeenDisposed(false),
180 #endif 179 #endif
181 m_horizontalScrollbarMode(ScrollbarAuto), 180 m_horizontalScrollbarMode(ScrollbarAuto),
182 m_verticalScrollbarMode(ScrollbarAuto), 181 m_verticalScrollbarMode(ScrollbarAuto),
183 m_horizontalScrollbarLock(false), 182 m_horizontalScrollbarLock(false),
184 m_verticalScrollbarLock(false), 183 m_verticalScrollbarLock(false),
185 m_scrollbarsSuppressed(false), 184 m_scrollbarsSuppressed(false),
186 m_inUpdateScrollbars(false), 185 m_inUpdateScrollbars(false),
(...skipping 3460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 3646
3648 m_layoutSize = size; 3647 m_layoutSize = size;
3649 contentsResized(); 3648 contentsResized();
3650 } 3649 }
3651 3650
3652 void FrameView::didAddScrollbar(Scrollbar& scrollbar, 3651 void FrameView::didAddScrollbar(Scrollbar& scrollbar,
3653 ScrollbarOrientation orientation) { 3652 ScrollbarOrientation orientation) {
3654 ScrollableArea::didAddScrollbar(scrollbar, orientation); 3653 ScrollableArea::didAddScrollbar(scrollbar, orientation);
3655 } 3654 }
3656 3655
3657 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) {
3658 m_browserControlsViewportAdjustment = adjustment;
3659 }
3660
3661 PaintLayer* FrameView::layer() const { 3656 PaintLayer* FrameView::layer() const {
3662 LayoutViewItem layoutView = layoutViewItem(); 3657 LayoutViewItem layoutView = layoutViewItem();
3663 if (layoutView.isNull() || !layoutView.compositor()) 3658 if (layoutView.isNull() || !layoutView.compositor())
3664 return nullptr; 3659 return nullptr;
3665 3660
3666 return layoutView.compositor()->rootLayer(); 3661 return layoutView.compositor()->rootLayer();
3667 } 3662 }
3668 3663
3669 IntSize FrameView::maximumScrollOffsetInt() const { 3664 IntSize FrameView::maximumScrollOffsetInt() const {
3670 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() 3665 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
3671 // FIXME: We probably shouldn't be storing the bounds in a float. 3666 // FIXME: We probably shouldn't be storing the bounds in a float.
3672 // crbug.com/422331. 3667 // crbug.com/422331.
3673 IntSize visibleSize = 3668 IntSize visibleSize = visibleContentSize(ExcludeScrollbars);
3674 visibleContentSize(ExcludeScrollbars) + browserControlsSize();
3675 IntSize contentBounds = contentsSize(); 3669 IntSize contentBounds = contentsSize();
3670
3671 FrameHost* host = m_frame->host();
3672 DCHECK(host);
3673
3674 // We need to perform this const_cast since maximumScrollOffsetInt is a const
3675 // method but we can't make layoutViewportScrollableArea const since it can
3676 // return |this|. Once root-layer-scrolls ships layoutViewportScrollableArea
3677 // can be made const.
3678 const ScrollableArea* layoutViewport =
3679 const_cast<FrameView*>(this)->layoutViewportScrollableArea();
3680 TopDocumentRootScrollerController& controller =
3681 host->globalRootScrollerController();
3682 if (layoutViewport == controller.rootScrollerArea())
3683 visibleSize = controller.rootScrollerVisibleArea();
3684
3676 IntSize maximumOffset = 3685 IntSize maximumOffset =
3677 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); 3686 toIntSize(-scrollOrigin() + (contentBounds - visibleSize));
3678 return maximumOffset.expandedTo(minimumScrollOffsetInt()); 3687 return maximumOffset.expandedTo(minimumScrollOffsetInt());
3679 } 3688 }
3680 3689
3681 void FrameView::addChild(Widget* child) { 3690 void FrameView::addChild(Widget* child) {
3682 ASSERT(child != this && !child->parent()); 3691 ASSERT(child != this && !child->parent());
3683 child->setParent(this); 3692 child->setParent(this);
3684 m_children.add(child); 3693 m_children.add(child);
3685 } 3694 }
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4902 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; 4911 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4903 ++reason) { 4912 ++reason) {
4904 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { 4913 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4905 reasons |= 1 << reason; 4914 reasons |= 1 << reason;
4906 } 4915 }
4907 } 4916 }
4908 return reasons; 4917 return reasons;
4909 } 4918 }
4910 4919
4911 } // namespace blink 4920 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/VisualViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698