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

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

Issue 1557993002: Add scroll units in GestureEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const 769 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const
770 { 770 {
771 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); 771 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url);
772 } 772 }
773 773
774 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) 774 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
775 { 775 {
776 spellChecker().removeSpellingMarkersUnderWords(words); 776 spellChecker().removeSpellingMarkersUnderWords(words);
777 } 777 }
778 778
779 static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) 779 static ScrollResult scrollAreaOnBothAxes(ScrollGranularity granularity, const Fl oatSize& delta, ScrollableArea& view)
780 { 780 {
781 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft, ScrollByPrecisePixel, delta.width()); 781 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft, granularity, delta.width());
782 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, Scro llByPrecisePixel, delta.height()); 782 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, gran ularity, delta.height());
783 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll , scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta); 783 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll , scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta);
784 } 784 }
785 785
786 // Returns true if a scroll occurred. 786 // Returns true if a scroll occurred.
787 ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollB egin) 787 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F loatSize& delta, bool isScrollBegin)
788 { 788 {
789 if (isScrollBegin) 789 if (isScrollBegin)
790 host()->topControls().scrollBegin(); 790 host()->topControls().scrollBegin();
791 791
792 if (!view() || delta.isZero()) 792 if (!view() || delta.isZero())
793 return ScrollResult(false, false, delta.width(), delta.height()); 793 return ScrollResult(false, false, delta.width(), delta.height());
794 794
795 FloatSize remainingDelta = delta; 795 FloatSize remainingDelta = delta;
796 796
797 // If this is main frame, allow top controls to scroll first. 797 // If this is main frame, allow top controls to scroll first.
798 if (shouldScrollTopControls(delta)) 798 if (shouldScrollTopControls(delta))
799 remainingDelta = host()->topControls().scrollBy(remainingDelta); 799 remainingDelta = host()->topControls().scrollBy(remainingDelta);
800 800
801 if (remainingDelta.isZero()) 801 if (remainingDelta.isZero())
802 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); 802 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
803 803
804 ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollab leArea()); 804 ScrollResult result = scrollAreaOnBothAxes(granularity, remainingDelta, *vie w()->scrollableArea());
805 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth()); 805 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth());
806 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight()); 806 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight());
807 807
808 return result; 808 return result;
809 } 809 }
810 810
811 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 811 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
812 { 812 {
813 if (!isMainFrame()) 813 if (!isMainFrame())
814 return false; 814 return false;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 { 889 {
890 m_frame->disableNavigation(); 890 m_frame->disableNavigation();
891 } 891 }
892 892
893 FrameNavigationDisabler::~FrameNavigationDisabler() 893 FrameNavigationDisabler::~FrameNavigationDisabler()
894 { 894 {
895 m_frame->enableNavigation(); 895 m_frame->enableNavigation();
896 } 896 }
897 897
898 } // namespace blink 898 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698