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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 2824753005: Rename HostWindow to PlatformChromeClient (Closed)
Patch Set: mac Created 3 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) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 13 matching lines...) Expand all
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "platform/scroll/ScrollableArea.h" 32 #include "platform/scroll/ScrollableArea.h"
33 33
34 #include "platform/HostWindow.h" 34 #include "platform/PlatformChromeClient.h"
35 #include "platform/graphics/GraphicsLayer.h" 35 #include "platform/graphics/GraphicsLayer.h"
36 #include "platform/instrumentation/tracing/TraceEvent.h" 36 #include "platform/instrumentation/tracing/TraceEvent.h"
37 #include "platform/scroll/MainThreadScrollingReason.h" 37 #include "platform/scroll/MainThreadScrollingReason.h"
38 #include "platform/scroll/ProgrammaticScrollAnimator.h" 38 #include "platform/scroll/ProgrammaticScrollAnimator.h"
39 #include "platform/scroll/ScrollbarTheme.h" 39 #include "platform/scroll/ScrollbarTheme.h"
40 40
41 static const int kPixelsPerLineStep = 40; 41 static const int kPixelsPerLineStep = 40;
42 static const float kMinFractionToStepWhenPaging = 0.875f; 42 static const float kMinFractionToStepWhenPaging = 0.875f;
43 43
44 namespace blink { 44 namespace blink {
45 45
46 int ScrollableArea::PixelsPerLineStep(HostWindow* host) { 46 int ScrollableArea::PixelsPerLineStep(PlatformChromeClient* host) {
47 if (!host) 47 if (!host)
48 return kPixelsPerLineStep; 48 return kPixelsPerLineStep;
49 return host->WindowToViewportScalar(kPixelsPerLineStep); 49 return host->WindowToViewportScalar(kPixelsPerLineStep);
50 } 50 }
51 51
52 float ScrollableArea::MinFractionToStepWhenPaging() { 52 float ScrollableArea::MinFractionToStepWhenPaging() {
53 return kMinFractionToStepWhenPaging; 53 return kMinFractionToStepWhenPaging;
54 } 54 }
55 55
56 int ScrollableArea::MaxOverlapBetweenPages() { 56 int ScrollableArea::MaxOverlapBetweenPages() {
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 .ExpandedTo(MinimumScrollOffsetInt()); 608 .ExpandedTo(MinimumScrollOffsetInt());
609 } 609 }
610 610
611 ScrollOffset ScrollableArea::ClampScrollOffset( 611 ScrollOffset ScrollableArea::ClampScrollOffset(
612 const ScrollOffset& scroll_offset) const { 612 const ScrollOffset& scroll_offset) const {
613 return scroll_offset.ShrunkTo(MaximumScrollOffset()) 613 return scroll_offset.ShrunkTo(MaximumScrollOffset())
614 .ExpandedTo(MinimumScrollOffset()); 614 .ExpandedTo(MinimumScrollOffset());
615 } 615 }
616 616
617 int ScrollableArea::LineStep(ScrollbarOrientation) const { 617 int ScrollableArea::LineStep(ScrollbarOrientation) const {
618 return PixelsPerLineStep(GetHostWindow()); 618 return PixelsPerLineStep(GetChromeClient());
619 } 619 }
620 620
621 int ScrollableArea::PageStep(ScrollbarOrientation orientation) const { 621 int ScrollableArea::PageStep(ScrollbarOrientation orientation) const {
622 IntRect visible_rect = VisibleContentRect(kIncludeScrollbars); 622 IntRect visible_rect = VisibleContentRect(kIncludeScrollbars);
623 int length = (orientation == kHorizontalScrollbar) ? visible_rect.Width() 623 int length = (orientation == kHorizontalScrollbar) ? visible_rect.Width()
624 : visible_rect.Height(); 624 : visible_rect.Height();
625 int min_page_step = 625 int min_page_step =
626 static_cast<float>(length) * MinFractionToStepWhenPaging(); 626 static_cast<float>(length) * MinFractionToStepWhenPaging();
627 int page_step = std::max(min_page_step, length - MaxOverlapBetweenPages()); 627 int page_step = std::max(min_page_step, length - MaxOverlapBetweenPages());
628 628
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 offset.y() - ScrollOrigin().Y()); 671 offset.y() - ScrollOrigin().Y());
672 SetScrollOffset(new_offset, kCompositorScroll); 672 SetScrollOffset(new_offset, kCompositorScroll);
673 } 673 }
674 674
675 DEFINE_TRACE(ScrollableArea) { 675 DEFINE_TRACE(ScrollableArea) {
676 visitor->Trace(scroll_animator_); 676 visitor->Trace(scroll_animator_);
677 visitor->Trace(programmatic_scroll_animator_); 677 visitor->Trace(programmatic_scroll_animator_);
678 } 678 }
679 679
680 } // namespace blink 680 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | third_party/WebKit/Source/platform/scroll/Scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698