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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master2
Patch Set: Rebase and resolve Created 5 years 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "platform/graphics/paint/DisplayItem.h" 31 #include "platform/graphics/paint/DisplayItem.h"
32 #include "platform/scroll/ScrollTypes.h" 32 #include "platform/scroll/ScrollTypes.h"
33 #include "public/platform/mac/MacScrollTypes.h" 33 #include "public/platform/mac/MacScrollTypes.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class CullRect; 37 class CullRect;
38 class GraphicsContext; 38 class GraphicsContext;
39 class PlatformMouseEvent; 39 class PlatformMouseEvent;
40 class ScrollbarThemeClient; 40 class ScrollbarThemeClient;
41 class ScrollbarThemePaintParams;
41 42
42 class PLATFORM_EXPORT ScrollbarTheme { 43 class PLATFORM_EXPORT ScrollbarTheme {
43 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme); 44 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme);
44 public: 45 public:
45 ScrollbarTheme() { } 46 ScrollbarTheme() { }
46 virtual ~ScrollbarTheme() { } 47 virtual ~ScrollbarTheme() { }
47 48
49 // If true, then scrollbars with this theme will be painted every time
50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then scrollbar
51 // thumb and track part painting results will be cached and not repainted
52 // unless requested by Scrollbar::setThumbNeedsRepaint or
53 // Scrollbar::setTrackNeedsRepaint.
54 virtual bool shouldRepaintAllPartsOnInvalidation() const { return true; }
55
48 virtual void updateEnabledState(const ScrollbarThemeClient*) { } 56 virtual void updateEnabledState(const ScrollbarThemeClient*) { }
49 57
50 virtual bool paint(const ScrollbarThemeClient*, GraphicsContext*, const Cull Rect&); 58 virtual bool paint(const ScrollbarThemeClient*, GraphicsContext*, const Cull Rect&);
51 59
52 virtual ScrollbarPart hitTest(const ScrollbarThemeClient*, const IntPoint&); 60 virtual ScrollbarPart hitTest(const ScrollbarThemeClient*, const IntPoint&);
53 61
54 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; } 62 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; }
55 virtual int scrollbarMargin() const { return 0; } 63 virtual int scrollbarMargin() const { return 0; }
56 64
57 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; } 65 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; }
(...skipping 12 matching lines...) Expand all
70 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, c onst PlatformMouseEvent&) { return false; } 78 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, c onst PlatformMouseEvent&) { return false; }
71 79
72 // The position of the thumb relative to the track. 80 // The position of the thumb relative to the track.
73 virtual int thumbPosition(const ScrollbarThemeClient*); 81 virtual int thumbPosition(const ScrollbarThemeClient*);
74 // The length of the thumb along the axis of the scrollbar. 82 // The length of the thumb along the axis of the scrollbar.
75 virtual int thumbLength(const ScrollbarThemeClient*); 83 virtual int thumbLength(const ScrollbarThemeClient*);
76 // The position of the track relative to the scrollbar. 84 // The position of the track relative to the scrollbar.
77 virtual int trackPosition(const ScrollbarThemeClient*); 85 virtual int trackPosition(const ScrollbarThemeClient*);
78 // The length of the track along the axis of the scrollbar. 86 // The length of the track along the axis of the scrollbar.
79 virtual int trackLength(const ScrollbarThemeClient*); 87 virtual int trackLength(const ScrollbarThemeClient*);
88 // The opacity to be applied to the thumb.
89 virtual float thumbOpacity(const ScrollbarThemeClient*) const { return 1.0f; }
80 90
81 virtual bool hasButtons(const ScrollbarThemeClient*) = 0; 91 virtual bool hasButtons(const ScrollbarThemeClient*) = 0;
82 virtual bool hasThumb(const ScrollbarThemeClient*) = 0; 92 virtual bool hasThumb(const ScrollbarThemeClient*) = 0;
83 93
84 virtual IntRect backButtonRect(const ScrollbarThemeClient*, ScrollbarPart, b ool painting = false) = 0; 94 virtual IntRect backButtonRect(const ScrollbarThemeClient*, ScrollbarPart, b ool painting = false) = 0;
85 virtual IntRect forwardButtonRect(const ScrollbarThemeClient*, ScrollbarPart , bool painting = false) = 0; 95 virtual IntRect forwardButtonRect(const ScrollbarThemeClient*, ScrollbarPart , bool painting = false) = 0;
86 virtual IntRect trackRect(const ScrollbarThemeClient*, bool painting = false ) = 0; 96 virtual IntRect trackRect(const ScrollbarThemeClient*, bool painting = false ) = 0;
87 virtual IntRect thumbRect(const ScrollbarThemeClient*); 97 virtual IntRect thumbRect(const ScrollbarThemeClient*);
88 virtual int thumbThickness(const ScrollbarThemeClient*); 98 virtual int thumbThickness(const ScrollbarThemeClient*);
89 99
(...skipping 28 matching lines...) Expand all
118 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); 128 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart);
119 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); 129 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart);
120 130
121 private: 131 private:
122 static ScrollbarTheme* nativeTheme(); // Must be implemented to return the c orrect theme subclass. 132 static ScrollbarTheme* nativeTheme(); // Must be implemented to return the c orrect theme subclass.
123 static bool gMockScrollbarsEnabled; 133 static bool gMockScrollbarsEnabled;
124 }; 134 };
125 135
126 } 136 }
127 #endif 137 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698