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

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

Issue 1056983004: OverscrollGlow for mainThread-{BLINK CHANGES} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const 707 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const
708 { 708 {
709 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); 709 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url);
710 } 710 }
711 711
712 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) 712 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
713 { 713 {
714 spellChecker().removeSpellingMarkersUnderWords(words); 714 spellChecker().removeSpellingMarkersUnderWords(words);
715 } 715 }
716 716
717 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) 717 static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view)
718 { 718 {
719 bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delt a.width()); 719 ScrollResultOneDimensional horizontal = view.scroll(ScrollLeft, ScrollByPrec isePixel, delta.width());
720 bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.he ight()); 720 ScrollResultOneDimensional vertical = view.scroll(ScrollUp, ScrollByPreciseP ixel, delta.height());
721 return scrolledHorizontal || scrolledVertical; 721 return ScrollResult((horizontal.didScroll || vertical.didScroll), horizontal .unusedScrollDelta, vertical.unusedScrollDelta);
722 } 722 }
723 723
724 // Returns true if a scroll occurred. 724 ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollB egin)
725 bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin)
726 { 725 {
727 if (isScrollBegin) 726 if (isScrollBegin)
728 host()->topControls().scrollBegin(); 727 host()->topControls().scrollBegin();
729 728
730 if (!view() || delta.isZero()) 729 if (!view() || delta.isZero())
731 return false; 730 return ScrollResult(false, delta.width(), delta.height());
732 731
733 FloatSize remainingDelta = delta; 732 FloatSize remainingDelta = delta;
734 733
735 // If this is main frame, allow top controls to scroll first. 734 // If this is main frame, allow top controls to scroll first.
736 if (shouldScrollTopControls(delta)) 735 if (shouldScrollTopControls(delta))
737 remainingDelta = host()->topControls().scrollBy(remainingDelta); 736 remainingDelta = host()->topControls().scrollBy(remainingDelta);
738 737
739 if (remainingDelta.isZero()) 738 if (remainingDelta.isZero())
740 return true; 739 return ScrollResult(true);
741 740
742 bool consumed = remainingDelta != delta; 741 ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollab leArea());
743 742
744 if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) 743 if (result.didScroll)
745 return true; 744 return result;
746 745
747 return consumed; 746 result.didScroll = remainingDelta != delta;
747 return result;
748 } 748 }
749 749
750 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 750 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
751 { 751 {
752 if (!isMainFrame()) 752 if (!isMainFrame())
753 return false; 753 return false;
754 754
755 // Always give the delta to the top controls if the scroll is in 755 // Always give the delta to the top controls if the scroll is in
756 // the direction to show the top controls. If it's in the 756 // the direction to show the top controls. If it's in the
757 // direction to hide the top controls, only give the delta to the 757 // direction to hide the top controls, only give the delta to the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 , m_textZoomFactor(parentTextZoomFactor(this)) 813 , m_textZoomFactor(parentTextZoomFactor(this))
814 , m_inViewSourceMode(false) 814 , m_inViewSourceMode(false)
815 { 815 {
816 if (isLocalRoot()) 816 if (isLocalRoot())
817 m_instrumentingAgents = InstrumentingAgents::create(); 817 m_instrumentingAgents = InstrumentingAgents::create();
818 else 818 else
819 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 819 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
820 } 820 }
821 821
822 } // namespace blink 822 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698