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

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: added function for comparison Created 5 years, 7 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const 711 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const
712 { 712 {
713 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); 713 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url);
714 } 714 }
715 715
716 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) 716 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
717 { 717 {
718 spellChecker().removeSpellingMarkersUnderWords(words); 718 spellChecker().removeSpellingMarkersUnderWords(words);
719 } 719 }
720 720
721 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) 721 static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view)
722 { 722 {
723 bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delt a.width()); 723 ScrollResultOneDimensional horizontal = view.scroll(ScrollLeft, ScrollByPrec isePixel, delta.width());
724 bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.he ight()); 724 ScrollResultOneDimensional vertical = view.scroll(ScrollUp, ScrollByPreciseP ixel, delta.height());
725 return scrolledHorizontal || scrolledVertical; 725 return ScrollResult((horizontal.didScroll || vertical.didScroll), horizontal .unusedScrollDelta, vertical.unusedScrollDelta);
726 } 726 }
727 727
728 // Returns true if a scroll occurred. 728 // Returns ScrollResult.
majidvp 2015/05/27 14:37:23 nit: this comment no longer conveys any useful inf
MuVen 2015/05/29 09:37:15 Done.
729 bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) 729 ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollB egin)
730 { 730 {
731 if (isScrollBegin) 731 if (isScrollBegin)
732 host()->topControls().scrollBegin(); 732 host()->topControls().scrollBegin();
733 733
734 if (!view() || delta.isZero()) 734 if (!view() || delta.isZero())
735 return false; 735 return ScrollResult(false, delta.width(), delta.height());
736 736
737 FloatSize remainingDelta = delta; 737 FloatSize remainingDelta = delta;
738 738
739 // If this is main frame, allow top controls to scroll first. 739 // If this is main frame, allow top controls to scroll first.
740 if (shouldScrollTopControls(delta)) 740 if (shouldScrollTopControls(delta))
741 remainingDelta = host()->topControls().scrollBy(remainingDelta); 741 remainingDelta = host()->topControls().scrollBy(remainingDelta);
742 742
743 if (remainingDelta.isZero()) 743 if (remainingDelta.isZero())
744 return true; 744 return ScrollResult(true);
745 745
746 bool consumed = remainingDelta != delta; 746 ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollab leArea());
747 747
748 if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) 748 if (result.didScroll)
749 return true; 749 return result;
750 750
751 return consumed; 751 result.didScroll = remainingDelta != delta;
752 return result;
752 } 753 }
753 754
754 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 755 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
755 { 756 {
756 if (!isMainFrame()) 757 if (!isMainFrame())
757 return false; 758 return false;
758 759
759 // Always give the delta to the top controls if the scroll is in 760 // Always give the delta to the top controls if the scroll is in
760 // the direction to show the top controls. If it's in the 761 // the direction to show the top controls. If it's in the
761 // direction to hide the top controls, only give the delta to the 762 // direction to hide the top controls, only give the delta to the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 , m_textZoomFactor(parentTextZoomFactor(this)) 818 , m_textZoomFactor(parentTextZoomFactor(this))
818 , m_inViewSourceMode(false) 819 , m_inViewSourceMode(false)
819 { 820 {
820 if (isLocalRoot()) 821 if (isLocalRoot())
821 m_instrumentingAgents = InstrumentingAgents::create(); 822 m_instrumentingAgents = InstrumentingAgents::create();
822 else 823 else
823 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 824 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
824 } 825 }
825 826
826 } // namespace blink 827 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698