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