| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const | 711 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const |
| 712 { | 712 { |
| 713 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume
nt()->isSecureTransitionTo(url); | 713 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume
nt()->isSecureTransitionTo(url); |
| 714 } | 714 } |
| 715 | 715 |
| 716 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) | 716 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) |
| 717 { | 717 { |
| 718 spellChecker().removeSpellingMarkersUnderWords(words); | 718 spellChecker().removeSpellingMarkersUnderWords(words); |
| 719 } | 719 } |
| 720 | 720 |
| 721 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) | 721 static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea&
view) |
| 722 { | 722 { |
| 723 bool scrolledHorizontal = view.userScroll(ScrollLeft, ScrollByPrecisePixel,
delta.width()); | 723 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft,
ScrollByPrecisePixel, delta.width()); |
| 724 bool scrolledVertical = view.userScroll(ScrollUp, ScrollByPrecisePixel, delt
a.height()); | 724 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, Scro
llByPrecisePixel, delta.height()); |
| 725 return scrolledHorizontal || scrolledVertical; | 725 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll
, scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta); |
| 726 } | 726 } |
| 727 | 727 |
| 728 // Returns true if a scroll occurred. | 728 // Returns true if a scroll occurred. |
| 729 bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) | 729 ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollB
egin) |
| 730 { | 730 { |
| 731 if (isScrollBegin) | 731 if (isScrollBegin) |
| 732 host()->topControls().scrollBegin(); | 732 host()->topControls().scrollBegin(); |
| 733 | 733 |
| 734 if (!view() || delta.isZero()) | 734 if (!view() || delta.isZero()) |
| 735 return false; | 735 return ScrollResult(false, false, delta.width(), delta.height()); |
| 736 | 736 |
| 737 FloatSize remainingDelta = delta; | 737 FloatSize remainingDelta = delta; |
| 738 | 738 |
| 739 // If this is main frame, allow top controls to scroll first. | 739 // If this is main frame, allow top controls to scroll first. |
| 740 if (shouldScrollTopControls(delta)) | 740 if (shouldScrollTopControls(delta)) |
| 741 remainingDelta = host()->topControls().scrollBy(remainingDelta); | 741 remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| 742 | 742 |
| 743 if (remainingDelta.isZero()) | 743 if (remainingDelta.isZero()) |
| 744 return true; | 744 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); |
| 745 | 745 |
| 746 bool consumed = remainingDelta != delta; | 746 ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollab
leArea()); |
| 747 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi
dth()); |
| 748 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h
eight()); |
| 747 | 749 |
| 748 if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) | 750 return result; |
| 749 return true; | |
| 750 | |
| 751 return consumed; | |
| 752 } | 751 } |
| 753 | 752 |
| 754 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const | 753 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |
| 755 { | 754 { |
| 756 if (!isMainFrame()) | 755 if (!isMainFrame()) |
| 757 return false; | 756 return false; |
| 758 | 757 |
| 759 // Always give the delta to the top controls if the scroll is in | 758 // Always give the delta to the top controls if the scroll is in |
| 760 // the direction to show the top controls. If it's in the | 759 // the direction to show the top controls. If it's in the |
| 761 // direction to hide the top controls, only give the delta to the | 760 // direction to hide the top controls, only give the delta to the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 , m_textZoomFactor(parentTextZoomFactor(this)) | 816 , m_textZoomFactor(parentTextZoomFactor(this)) |
| 818 , m_inViewSourceMode(false) | 817 , m_inViewSourceMode(false) |
| 819 { | 818 { |
| 820 if (isLocalRoot()) | 819 if (isLocalRoot()) |
| 821 m_instrumentingAgents = InstrumentingAgents::create(); | 820 m_instrumentingAgents = InstrumentingAgents::create(); |
| 822 else | 821 else |
| 823 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; | 822 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; |
| 824 } | 823 } |
| 825 | 824 |
| 826 } // namespace blink | 825 } // namespace blink |
| OLD | NEW |