Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 850443002: Scroll Customization Prototype (Not for review, WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase / cleanup / minor bug fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
773 }
774
775 // Returns true if a scroll occurred.
776 bool LocalFrame::scrollByDelta(const FloatSize& delta)
777 {
778 // FIXME: handle top controls.
779 if (!view())
780 return false;
781
782 if (scrollAreaOnBothAxes(delta, *view()))
783 return true;
784
785 // If this is the main frame and it didn't scroll, propagate up to the pinch viewport.
786 if (!settings()->pinchVirtualViewportEnabled() || !isMainFrame())
787 return false;
788
789 if (scrollAreaOnBothAxes(delta, page()->frameHost().pinchViewport()))
790 return true;
791
792 return false;
793 }
794
768 #if ENABLE(OILPAN) 795 #if ENABLE(OILPAN)
769 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin) 796 void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin)
770 { 797 {
771 m_pluginElements.add(plugin); 798 m_pluginElements.add(plugin);
772 } 799 }
773 800
774 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) 801 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin)
775 { 802 {
776 ASSERT(m_pluginElements.contains(plugin)); 803 ASSERT(m_pluginElements.contains(plugin));
777 m_pluginElements.remove(plugin); 804 m_pluginElements.remove(plugin);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // We detach the FrameView's custom scroll bars as early as 851 // We detach the FrameView's custom scroll bars as early as
825 // possible to prevent m_doc->detach() from messing with the view 852 // possible to prevent m_doc->detach() from messing with the view
826 // such that its scroll bars won't be torn down. 853 // such that its scroll bars won't be torn down.
827 // 854 //
828 // FIXME: We should revisit this. 855 // FIXME: We should revisit this.
829 if (m_view) 856 if (m_view)
830 m_view->prepareForDetach(); 857 m_view->prepareForDetach();
831 } 858 }
832 859
833 } // namespace blink 860 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698