| 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 // Returns true if a scroll occurred. | |
| 768 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F
loatSize& delta, bool isScrollBegin) | 767 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F
loatSize& delta, bool isScrollBegin) |
| 769 { | 768 { |
| 770 if (isScrollBegin) | 769 if (isScrollBegin) |
| 771 host()->topControls().scrollBegin(); | 770 host()->topControls().scrollBegin(); |
| 772 | 771 |
| 773 if (!view() || delta.isZero()) | 772 if (!view() || delta.isZero()) |
| 774 return ScrollResult(false, false, delta.width(), delta.height()); | 773 return ScrollResult(false, false, delta.width(), delta.height()); |
| 775 | 774 |
| 776 FloatSize remainingDelta = delta; | 775 FloatSize remainingDelta = delta; |
| 777 | 776 |
| 778 // If this is main frame, allow top controls to scroll first. | 777 // If this is main frame, allow top controls to scroll first. |
| 779 if (shouldScrollTopControls(delta)) | 778 if (shouldScrollTopControls(delta)) |
| 780 remainingDelta = host()->topControls().scrollBy(remainingDelta); | 779 remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| 781 | 780 |
| 782 if (remainingDelta.isZero()) | 781 if (remainingDelta.isZero()) |
| 783 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); | 782 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); |
| 784 | 783 |
| 785 // TODO(bokan): The delta coming in here is the GestureEvent delta, which is | 784 ScrollResult result = view()->scrollableArea()->userScroll(granularity, rema
iningDelta); |
| 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()); | 785 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi
dth()); |
| 794 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h
eight()); | 786 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h
eight()); |
| 795 | 787 |
| 796 return result; | 788 return result; |
| 797 } | 789 } |
| 798 | 790 |
| 799 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const | 791 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |
| 800 { | 792 { |
| 801 if (!isMainFrame()) | 793 if (!isMainFrame()) |
| 802 return false; | 794 return false; |
| 803 | 795 |
| 804 // Always give the delta to the top controls if the scroll is in | 796 // Always give the delta to the top controls if the scroll is in |
| 805 // the direction to show the top controls. If it's in the | 797 // the direction to show the top controls. If it's in the |
| 806 // direction to hide the top controls, only give the delta to the | 798 // direction to hide the top controls, only give the delta to the |
| 807 // top controls when the frame can scroll. | 799 // top controls when the frame can scroll. |
| 808 DoublePoint maximumScrollPosition = | 800 DoublePoint maximumScrollPosition = |
| 809 host()->visualViewport().maximumScrollPositionDouble() + | 801 host()->visualViewport().maximumScrollPositionDouble() + |
| 810 toDoubleSize(view()->maximumScrollPositionDouble()); | 802 toDoubleSize(view()->maximumScrollPositionDouble()); |
| 811 DoublePoint scrollPosition = host()->visualViewport() | 803 DoublePoint scrollPosition = host()->visualViewport() |
| 812 .visibleRectInDocument().location(); | 804 .visibleRectInDocument().location(); |
| 813 return delta.height() > 0 || scrollPosition.y() < maximumScrollPosition.y(); | 805 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y(); |
| 814 } | 806 } |
| 815 | 807 |
| 816 String LocalFrame::localLayerTreeAsText(unsigned flags) const | 808 String LocalFrame::localLayerTreeAsText(unsigned flags) const |
| 817 { | 809 { |
| 818 if (!contentLayoutObject()) | 810 if (!contentLayoutObject()) |
| 819 return String(); | 811 return String(); |
| 820 | 812 |
| 821 return contentLayoutObject()->compositor()->layerTreeAsText(static_cast<Laye
rTreeFlags>(flags)); | 813 return contentLayoutObject()->compositor()->layerTreeAsText(static_cast<Laye
rTreeFlags>(flags)); |
| 822 } | 814 } |
| 823 | 815 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 { | 869 { |
| 878 m_frame->disableNavigation(); | 870 m_frame->disableNavigation(); |
| 879 } | 871 } |
| 880 | 872 |
| 881 FrameNavigationDisabler::~FrameNavigationDisabler() | 873 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 882 { | 874 { |
| 883 m_frame->enableNavigation(); | 875 m_frame->enableNavigation(); |
| 884 } | 876 } |
| 885 | 877 |
| 886 } // namespace blink | 878 } // namespace blink |
| OLD | NEW |