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

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: Fixes for layout tests breaks 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 { 774 {
775 if (isScrollBegin) 775 if (isScrollBegin)
776 host()->topControls().scrollBegin(); 776 host()->topControls().scrollBegin();
777 777
778 if (!view() || delta.isZero()) 778 if (!view() || delta.isZero())
779 return ScrollResult(false, false, delta.width(), delta.height()); 779 return ScrollResult(false, false, delta.width(), delta.height());
780 780
781 FloatSize remainingDelta = delta; 781 FloatSize remainingDelta = delta;
782 782
783 // If this is main frame, allow top controls to scroll first. 783 // If this is main frame, allow top controls to scroll first.
784 if (shouldScrollTopControls(delta)) 784 if (shouldScrollTopControls(granularity, delta))
785 remainingDelta = host()->topControls().scrollBy(remainingDelta); 785 remainingDelta = host()->topControls().scrollBy(remainingDelta);
786 786
787 if (remainingDelta.isZero()) 787 if (remainingDelta.isZero())
788 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); 788 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
789 789
790 ScrollResult result = view()->scrollableArea()->userScroll(granularity, rema iningDelta); 790 ScrollResult result = view()->scrollableArea()->userScroll(granularity, rema iningDelta);
791 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth()); 791 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth());
792 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight()); 792 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight());
793 793
794 return result; 794 return result;
795 } 795 }
796 796
797 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 797 bool LocalFrame::shouldScrollTopControls(ScrollGranularity granularity, const Fl oatSize& delta) const
798 { 798 {
799 if (!isMainFrame()) 799 if (!isMainFrame())
800 return false; 800 return false;
801 801
802 if (granularity != ScrollByPixel && granularity != ScrollByPrecisePixel)
803 return false;
804
802 // Always give the delta to the top controls if the scroll is in 805 // Always give the delta to the top controls if the scroll is in
803 // the direction to show the top controls. If it's in the 806 // the direction to show the top controls. If it's in the
804 // direction to hide the top controls, only give the delta to the 807 // direction to hide the top controls, only give the delta to the
805 // top controls when the frame can scroll. 808 // top controls when the frame can scroll.
806 DoublePoint maximumScrollPosition = 809 DoublePoint maximumScrollPosition =
807 host()->visualViewport().maximumScrollPositionDouble() + 810 host()->visualViewport().maximumScrollPositionDouble() +
808 toDoubleSize(view()->maximumScrollPositionDouble()); 811 toDoubleSize(view()->maximumScrollPositionDouble());
809 DoublePoint scrollPosition = host()->visualViewport() 812 DoublePoint scrollPosition = host()->visualViewport()
810 .visibleRectInDocument().location(); 813 .visibleRectInDocument().location();
811 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y(); 814 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 { 878 {
876 m_frame->disableNavigation(); 879 m_frame->disableNavigation();
877 } 880 }
878 881
879 FrameNavigationDisabler::~FrameNavigationDisabler() 882 FrameNavigationDisabler::~FrameNavigationDisabler()
880 { 883 {
881 m_frame->enableNavigation(); 884 m_frame->enableNavigation();
882 } 885 }
883 886
884 } // namespace blink 887 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698