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

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

Issue 1752043002: Merged FrameView and LayoutBox scrolling in EventHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@invertScrollCustomizationPath
Patch Set: Created 4 years, 9 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 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 { 768 {
769 if (isScrollBegin) 769 if (isScrollBegin)
770 host()->topControls().scrollBegin(); 770 host()->topControls().scrollBegin();
771 771
772 if (!view() || delta.isZero()) 772 if (!view() || delta.isZero())
773 return ScrollResult(false, false, delta.width(), delta.height()); 773 return ScrollResult(false, false, delta.width(), delta.height());
774 774
775 FloatSize remainingDelta = delta; 775 FloatSize remainingDelta = delta;
776 776
777 // If this is main frame, allow top controls to scroll first. 777 // If this is main frame, allow top controls to scroll first.
778 if (shouldScrollTopControls(delta)) 778 if (shouldScrollTopControls(granularity, delta))
779 remainingDelta = host()->topControls().scrollBy(remainingDelta); 779 remainingDelta = host()->topControls().scrollBy(remainingDelta);
780 780
781 if (remainingDelta.isZero()) 781 if (remainingDelta.isZero())
782 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); 782 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
783 783
784 ScrollResult result = view()->scrollableArea()->userScroll(granularity, rema iningDelta); 784 ScrollResult result = view()->scrollableArea()->userScroll(granularity, rema iningDelta);
785 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth()); 785 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth());
786 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight()); 786 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight());
787 787
788 return result; 788 return result;
789 } 789 }
790 790
791 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 791 bool LocalFrame::shouldScrollTopControls(ScrollGranularity granularity, const Fl oatSize& delta) const
792 { 792 {
793 if (!isMainFrame()) 793 if (!isMainFrame())
794 return false; 794 return false;
795 795
796 if (granularity != ScrollByPixel && granularity != ScrollByPrecisePixel)
797 return false;
798
796 // Always give the delta to the top controls if the scroll is in 799 // Always give the delta to the top controls if the scroll is in
797 // the direction to show the top controls. If it's in the 800 // the direction to show the top controls. If it's in the
798 // direction to hide the top controls, only give the delta to the 801 // direction to hide the top controls, only give the delta to the
799 // top controls when the frame can scroll. 802 // top controls when the frame can scroll.
800 DoublePoint maximumScrollPosition = 803 DoublePoint maximumScrollPosition =
801 host()->visualViewport().maximumScrollPositionDouble() + 804 host()->visualViewport().maximumScrollPositionDouble() +
802 toDoubleSize(view()->maximumScrollPositionDouble()); 805 toDoubleSize(view()->maximumScrollPositionDouble());
803 DoublePoint scrollPosition = host()->visualViewport() 806 DoublePoint scrollPosition = host()->visualViewport()
804 .visibleRectInDocument().location(); 807 .visibleRectInDocument().location();
805 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y(); 808 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 { 872 {
870 m_frame->disableNavigation(); 873 m_frame->disableNavigation();
871 } 874 }
872 875
873 FrameNavigationDisabler::~FrameNavigationDisabler() 876 FrameNavigationDisabler::~FrameNavigationDisabler()
874 { 877 {
875 m_frame->enableNavigation(); 878 m_frame->enableNavigation();
876 } 879 }
877 880
878 } // namespace blink 881 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698