Chromium Code Reviews| 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const | 758 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const |
| 759 { | 759 { |
| 760 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); | 760 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); |
| 761 } | 761 } |
| 762 | 762 |
| 763 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) | 763 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) |
| 764 { | 764 { |
| 765 spellChecker().removeSpellingMarkersUnderWords(words); | 765 spellChecker().removeSpellingMarkersUnderWords(words); |
| 766 } | 766 } |
| 767 | 767 |
| 768 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) | |
| 769 { | |
| 770 bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delt a.width()); | |
| 771 bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.he ight()); | |
| 772 return scrolledHorizontal || scrolledVertical; | |
|
Rick Byers
2015/03/11 02:22:18
again, don't you need to handle these two cases se
tdresser
2015/03/20 18:00:36
This doesn't change any behavior, see
https://cod
Rick Byers
2015/03/26 21:22:49
Ok, SGTM - thanks.
| |
| 773 } | |
| 774 | |
| 775 // Returns true if a scroll occurred. | |
| 776 bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) | |
| 777 { | |
| 778 if (isScrollBegin) | |
| 779 host()->topControls().scrollBegin(); | |
| 780 | |
| 781 if (!view() || delta.isZero()) | |
| 782 return false; | |
| 783 | |
| 784 FloatSize remainingDelta = delta; | |
| 785 | |
| 786 // If this is main frame, allow top controls to scroll first and update | |
| 787 // |remainingDelta| accordingly | |
| 788 bool giveToTopControls = false; | |
| 789 if (isMainFrame()) { | |
| 790 // Always give the delta to the top controls if the scroll is in | |
| 791 // the direction to show the top controls. If it's in the | |
| 792 // direction to hide the top controls, only give the delta to the | |
| 793 // top controls when the frame can scroll. | |
| 794 giveToTopControls = remainingDelta.height() > 0 | |
| 795 || view()->scrollPosition().y() < view()->maximumScrollPosition().y( ); | |
| 796 } | |
| 797 | |
| 798 if (giveToTopControls) | |
| 799 remainingDelta = host()->topControls().scrollBy(remainingDelta); | |
| 800 | |
| 801 if (remainingDelta.isZero()) | |
| 802 return true; | |
| 803 | |
| 804 if (scrollAreaOnBothAxes(remainingDelta, *view())) | |
| 805 return true; | |
| 806 | |
| 807 // If this is the main frame and it didn't scroll, propagate up to the pinch viewport. | |
| 808 if (!settings()->pinchVirtualViewportEnabled() || !isMainFrame()) | |
| 809 return false; | |
| 810 | |
| 811 if (scrollAreaOnBothAxes(remainingDelta, page()->frameHost().pinchViewport() )) | |
| 812 return true; | |
| 813 | |
| 814 return false; | |
| 815 } | |
| 816 | |
| 768 #if ENABLE(OILPAN) | 817 #if ENABLE(OILPAN) |
| 769 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin) | 818 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin) |
| 770 { | 819 { |
| 771 m_pluginElements.add(plugin); | 820 m_pluginElements.add(plugin); |
| 772 } | 821 } |
| 773 | 822 |
| 774 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) | 823 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) |
| 775 { | 824 { |
| 776 ASSERT(m_pluginElements.contains(plugin)); | 825 ASSERT(m_pluginElements.contains(plugin)); |
| 777 m_pluginElements.remove(plugin); | 826 m_pluginElements.remove(plugin); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 // We detach the FrameView's custom scroll bars as early as | 873 // We detach the FrameView's custom scroll bars as early as |
| 825 // possible to prevent m_doc->detach() from messing with the view | 874 // possible to prevent m_doc->detach() from messing with the view |
| 826 // such that its scroll bars won't be torn down. | 875 // such that its scroll bars won't be torn down. |
| 827 // | 876 // |
| 828 // FIXME: We should revisit this. | 877 // FIXME: We should revisit this. |
| 829 if (m_view) | 878 if (m_view) |
| 830 m_view->prepareForDetach(); | 879 m_view->prepareForDetach(); |
| 831 } | 880 } |
| 832 | 881 |
| 833 } // namespace blink | 882 } // namespace blink |
| OLD | NEW |