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

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

Issue 1840113005: Move viewport actions into an ApplyScroll callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase over my own changes Created 4 years, 8 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
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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return false; 748 return false;
749 749
750 return document()->isSecureTransitionTo(url); 750 return document()->isSecureTransitionTo(url);
751 } 751 }
752 752
753 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) 753 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
754 { 754 {
755 spellChecker().removeSpellingMarkersUnderWords(words); 755 spellChecker().removeSpellingMarkersUnderWords(words);
756 } 756 }
757 757
758 ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const F loatSize& delta, bool isScrollBegin)
759 {
760 if (isScrollBegin)
761 host()->topControls().scrollBegin();
762
763 if (!view() || delta.isZero())
764 return ScrollResult(false, false, delta.width(), delta.height());
765
766 FloatSize remainingDelta = delta;
767
768 // If this is main frame, allow top controls to scroll first.
769 if (shouldScrollTopControls(granularity, delta))
770 remainingDelta = host()->topControls().scrollBy(remainingDelta);
771
772 if (remainingDelta.isZero())
773 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
774
775 ScrollResult result = view()->getScrollableArea()->userScroll(granularity, r emainingDelta);
776 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth());
777 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight());
778
779 return result;
780 }
781
782 bool LocalFrame::shouldScrollTopControls(ScrollGranularity granularity, const Fl oatSize& delta) const
783 {
784 if (!isMainFrame())
785 return false;
786
787 if (granularity != ScrollByPixel && granularity != ScrollByPrecisePixel)
788 return false;
789
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 DoublePoint maximumScrollPosition =
795 host()->visualViewport().maximumScrollPositionDouble() +
796 toDoubleSize(view()->maximumScrollPositionDouble());
797 DoublePoint scrollPosition = host()->visualViewport()
798 .visibleRectInDocument().location();
799 return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y();
800 }
801
802 String LocalFrame::localLayerTreeAsText(unsigned flags) const 758 String LocalFrame::localLayerTreeAsText(unsigned flags) const
803 { 759 {
804 if (!contentLayoutObject()) 760 if (!contentLayoutObject())
805 return String(); 761 return String();
806 762
807 return contentLayoutObject()->compositor()->layerTreeAsText(static_cast<Laye rTreeFlags>(flags)); 763 return contentLayoutObject()->compositor()->layerTreeAsText(static_cast<Laye rTreeFlags>(flags));
808 } 764 }
809 765
810 bool LocalFrame::shouldThrottleRendering() const 766 bool LocalFrame::shouldThrottleRendering() const
811 { 767 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 { 814 {
859 m_frame->disableNavigation(); 815 m_frame->disableNavigation();
860 } 816 }
861 817
862 FrameNavigationDisabler::~FrameNavigationDisabler() 818 FrameNavigationDisabler::~FrameNavigationDisabler()
863 { 819 {
864 m_frame->enableNavigation(); 820 m_frame->enableNavigation();
865 } 821 }
866 822
867 } // namespace blink 823 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/input/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698