Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 768 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const | 768 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const |
| 769 { | 769 { |
| 770 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); | 770 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); |
| 771 } | 771 } |
| 772 | 772 |
| 773 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) | 773 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) |
| 774 { | 774 { |
| 775 spellChecker().removeSpellingMarkersUnderWords(words); | 775 spellChecker().removeSpellingMarkersUnderWords(words); |
| 776 } | 776 } |
| 777 | 777 |
| 778 static ScrollResult scrollAreaOnBothAxes(ScrollGranularity granularity, const Fl oatSize& delta, ScrollableArea& view) | |
| 779 { | |
| 780 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft, granularity, delta.width()); | |
| 781 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, gran ularity, delta.height()); | |
| 782 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll , scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta); | |
| 783 } | |
| 784 | |
| 785 // Returns true if a scroll occurred. | 778 // Returns true if a scroll occurred. |
| 786 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F loatSize& delta, bool isScrollBegin) | 779 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F loatSize& delta, bool isScrollBegin) |
| 787 { | 780 { |
| 788 if (isScrollBegin) | 781 if (isScrollBegin) |
| 789 host()->topControls().scrollBegin(); | 782 host()->topControls().scrollBegin(); |
| 790 | 783 |
| 791 if (!view() || delta.isZero()) | 784 if (!view() || delta.isZero()) |
| 792 return ScrollResult(false, false, delta.width(), delta.height()); | 785 return ScrollResult(false, false, delta.width(), delta.height()); |
| 793 | 786 |
| 794 FloatSize remainingDelta = delta; | 787 FloatSize remainingDelta = delta; |
| 795 | 788 |
| 796 // If this is main frame, allow top controls to scroll first. | 789 // If this is main frame, allow top controls to scroll first. |
| 797 if (shouldScrollTopControls(delta)) | 790 if (shouldScrollTopControls(delta)) |
| 798 remainingDelta = host()->topControls().scrollBy(remainingDelta); | 791 remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| 799 | 792 |
| 800 if (remainingDelta.isZero()) | 793 if (remainingDelta.isZero()) |
| 801 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); | 794 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); |
| 802 | 795 |
| 803 ScrollResult result = scrollAreaOnBothAxes(granularity, remainingDelta, *vie w()->scrollableArea()); | 796 // TODO(bokan): The delta coming in here is the GSU event delta, which is |
|
skobes
2016/02/29 18:52:47
what is GSU?
bokan
2016/03/01 05:56:24
Sorry, forgot not everyone works on input :) (Gest
| |
| 797 // positive if the user scrolls up. For scrolling, a positive delta implies | |
|
tdresser
2016/02/29 14:53:43
positive if the user scrolls up or left
bokan
2016/03/01 05:56:24
Done.
| |
| 798 // downward scrolling. This negation should happen up in the call chain. | |
| 799 FloatSize normalizedDelta = remainingDelta.scaledBy(-1); | |
| 800 | |
| 801 ScrollResult result = view()->scrollableArea()->userScroll(granularity, norm alizedDelta); | |
| 802 | |
| 804 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth()); | 803 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth()); |
| 805 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight()); | 804 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight()); |
| 806 | 805 |
| 807 return result; | 806 return result; |
| 808 } | 807 } |
| 809 | 808 |
| 810 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const | 809 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |
| 811 { | 810 { |
| 812 if (!isMainFrame()) | 811 if (!isMainFrame()) |
| 813 return false; | 812 return false; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 { | 887 { |
| 889 m_frame->disableNavigation(); | 888 m_frame->disableNavigation(); |
| 890 } | 889 } |
| 891 | 890 |
| 892 FrameNavigationDisabler::~FrameNavigationDisabler() | 891 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 893 { | 892 { |
| 894 m_frame->enableNavigation(); | 893 m_frame->enableNavigation(); |
| 895 } | 894 } |
| 896 | 895 |
| 897 } // namespace blink | 896 } // namespace blink |
| OLD | NEW |