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

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 of bokan 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const 706 bool LocalFrame::shouldReuseDefaultView(const KURL& url) const
707 { 707 {
708 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url); 708 return loader().stateMachine()->isDisplayingInitialEmptyDocument() && docume nt()->isSecureTransitionTo(url);
709 } 709 }
710 710
711 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) 711 void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
712 { 712 {
713 spellChecker().removeSpellingMarkersUnderWords(words); 713 spellChecker().removeSpellingMarkersUnderWords(words);
714 } 714 }
715 715
716 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) 716 static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view)
717 { 717 {
718 bool scrolledHorizontal = view.userScroll(ScrollLeft, ScrollByPrecisePixel, delta.width()); 718 ScrollResultOneDimensional scrolledHorizontal = view.userScroll(ScrollLeft, ScrollByPrecisePixel, delta.width());
719 bool scrolledVertical = view.userScroll(ScrollUp, ScrollByPrecisePixel, delt a.height()); 719 ScrollResultOneDimensional scrolledVertical = view.userScroll(ScrollUp, Scro llByPrecisePixel, delta.height());
720 return scrolledHorizontal || scrolledVertical; 720 return ScrollResult(scrolledHorizontal.didScroll, scrolledVertical.didScroll , scrolledHorizontal.unusedScrollDelta, scrolledVertical.unusedScrollDelta);
721 } 721 }
722 722
723 // Returns true if a scroll occurred. 723 // Returns true if a scroll occurred.
724 bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) 724 ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollB egin)
725 { 725 {
726 if (isScrollBegin) 726 if (isScrollBegin)
727 host()->topControls().scrollBegin(); 727 host()->topControls().scrollBegin();
728 728
729 if (!view() || delta.isZero()) 729 if (!view() || delta.isZero())
730 return false; 730 return ScrollResult(false, false, delta.width(), delta.height());
731 731
732 FloatSize remainingDelta = delta; 732 FloatSize remainingDelta = delta;
733 733
734 // If this is main frame, allow top controls to scroll first. 734 // If this is main frame, allow top controls to scroll first.
735 if (shouldScrollTopControls(delta)) 735 if (shouldScrollTopControls(delta))
736 remainingDelta = host()->topControls().scrollBy(remainingDelta); 736 remainingDelta = host()->topControls().scrollBy(remainingDelta);
737 737
738 if (remainingDelta.isZero()) 738 if (remainingDelta.isZero())
739 return true; 739 return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
740 740
741 bool consumed = remainingDelta != delta; 741 ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollab leArea());
742 result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.wi dth());
743 result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.h eight());
742 744
743 if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) 745 return result;
744 return true;
745
746 return consumed;
747 } 746 }
748 747
749 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const 748 bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
750 { 749 {
751 if (!isMainFrame()) 750 if (!isMainFrame())
752 return false; 751 return false;
753 752
754 // Always give the delta to the top controls if the scroll is in 753 // Always give the delta to the top controls if the scroll is in
755 // the direction to show the top controls. If it's in the 754 // the direction to show the top controls. If it's in the
756 // direction to hide the top controls, only give the delta to the 755 // direction to hide the top controls, only give the delta to the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 , m_textZoomFactor(parentTextZoomFactor(this)) 811 , m_textZoomFactor(parentTextZoomFactor(this))
813 , m_inViewSourceMode(false) 812 , m_inViewSourceMode(false)
814 { 813 {
815 if (isLocalRoot()) 814 if (isLocalRoot())
816 m_instrumentingAgents = InstrumentingAgents::create(); 815 m_instrumentingAgents = InstrumentingAgents::create();
817 else 816 else
818 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 817 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
819 } 818 }
820 819
821 } // namespace blink 820 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698