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

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: addressed review comments 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.unu sedScrollDelta, 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, 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(delta.width(), delta.height(), 0.0f, 0.0f);
MuVen 2015/06/02 09:04:00 Even this returns didScrollX, didScrollY. ple let
majidvp 2015/06/02 17:00:31 This looks reasonable.
MuVen 2015/06/03 09:32:18 Done.
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;
majidvp 2015/06/02 17:00:31 I believe this is no longer correct. Consider this
MuVen 2015/06/03 09:32:18 Done.
746 745
747 return consumed; 746 result.didScrollX = remainingDelta.width() != delta.width();
747 result.didScrollY = remainingDelta.height() != delta.height();
majidvp 2015/06/02 17:00:31 If you get rid of the conditional above and replac
MuVen 2015/06/03 09:32:18 Done.
748 return result;
748 } 749 }
749 750
750 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 751 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
751 { 752 {
752 if (!isMainFrame()) 753 if (!isMainFrame())
753 return false; 754 return false;
754 755
755 // Always give the delta to the top controls if the scroll is in 756 // 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 757 // 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 758 // 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)) 814 , m_textZoomFactor(parentTextZoomFactor(this))
814 , m_inViewSourceMode(false) 815 , m_inViewSourceMode(false)
815 { 816 {
816 if (isLocalRoot()) 817 if (isLocalRoot())
817 m_instrumentingAgents = InstrumentingAgents::create(); 818 m_instrumentingAgents = InstrumentingAgents::create();
818 else 819 else
819 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 820 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
820 } 821 }
821 822
822 } // namespace blink 823 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698