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