| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 return false; | 763 return false; |
| 764 | 764 |
| 765 return document()->isSecureTransitionTo(url); | 765 return document()->isSecureTransitionTo(url); |
| 766 } | 766 } |
| 767 | 767 |
| 768 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) | 768 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) |
| 769 { | 769 { |
| 770 spellChecker().removeSpellingMarkersUnderWords(words); | 770 spellChecker().removeSpellingMarkersUnderWords(words); |
| 771 } | 771 } |
| 772 | 772 |
| 773 static ScrollResult scrollAreaOnBothAxes(ScrollGranularity granularity, const Fl
oatSize& delta, ScrollableArea& view) | |
| 774 { | |
| 775 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft,
granularity, delta.width()); | |
| 776 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, gran
ularity, delta.height()); | |
| 777 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll
, scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta); | |
| 778 } | |
| 779 | |
| 780 // Returns true if a scroll occurred. | 773 // Returns true if a scroll occurred. |
| 781 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F
loatSize& delta, bool isScrollBegin) | 774 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F
loatSize& delta, bool isScrollBegin) |
| 782 { | 775 { |
| 783 if (isScrollBegin) | 776 if (isScrollBegin) |
| 784 host()->topControls().scrollBegin(); | 777 host()->topControls().scrollBegin(); |
| 785 | 778 |
| 786 if (!view() || delta.isZero()) | 779 if (!view() || delta.isZero()) |
| 787 return ScrollResult(false, false, delta.width(), delta.height()); | 780 return ScrollResult(false, false, delta.width(), delta.height()); |
| 788 | 781 |
| 789 FloatSize remainingDelta = delta; | 782 FloatSize remainingDelta = delta; |
| 790 | 783 |
| 791 // If this is main frame, allow top controls to scroll first. | 784 // If this is main frame, allow top controls to scroll first. |
| 792 if (shouldScrollTopControls(delta)) | 785 if (shouldScrollTopControls(delta)) |
| 793 remainingDelta = host()->topControls().scrollBy(remainingDelta); | 786 remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| 794 | 787 |
| 795 if (remainingDelta.isZero()) | 788 if (remainingDelta.isZero()) |
| 796 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); | 789 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); |
| 797 | 790 |
| 798 ScrollResult result = scrollAreaOnBothAxes(granularity, remainingDelta, *vie
w()->scrollableArea()); | 791 // TODO(bokan): The delta coming in here is the GestureEvent delta, which is |
| 792 // positive if the user scrolls up or left. For scrolling, a positive delta |
| 793 // implies downward or rightward scrolling. This negation should happen up |
| 794 // in the call chain. |
| 795 FloatSize normalizedDelta = remainingDelta.scaledBy(-1); |
| 796 |
| 797 ScrollResult result = view()->scrollableArea()->userScroll(granularity, norm
alizedDelta); |
| 798 |
| 799 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi
dth()); | 799 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi
dth()); |
| 800 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h
eight()); | 800 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h
eight()); |
| 801 | 801 |
| 802 return result; | 802 return result; |
| 803 } | 803 } |
| 804 | 804 |
| 805 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const | 805 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |
| 806 { | 806 { |
| 807 if (!isMainFrame()) | 807 if (!isMainFrame()) |
| 808 return false; | 808 return false; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 { | 883 { |
| 884 m_frame->disableNavigation(); | 884 m_frame->disableNavigation(); |
| 885 } | 885 } |
| 886 | 886 |
| 887 FrameNavigationDisabler::~FrameNavigationDisabler() | 887 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 888 { | 888 { |
| 889 m_frame->enableNavigation(); | 889 m_frame->enableNavigation(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 } // namespace blink | 892 } // namespace blink |
| OLD | NEW |