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

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

Issue 1511003003: Use refs for non-null GraphicsContext, Scrollbar, etc. in scrollbar related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarRemove
Patch Set: yet another mac fix 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ScrollbarTheme() { } 46 ScrollbarTheme() { }
47 virtual ~ScrollbarTheme() { } 47 virtual ~ScrollbarTheme() { }
48 48
49 // If true, then scrollbars with this theme will be painted every time 49 // If true, then scrollbars with this theme will be painted every time
50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then scrollbar 50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then scrollbar
51 // thumb and track part painting results will be cached and not repainted 51 // thumb and track part painting results will be cached and not repainted
52 // unless requested by Scrollbar::setThumbNeedsRepaint or 52 // unless requested by Scrollbar::setThumbNeedsRepaint or
53 // Scrollbar::setTrackNeedsRepaint. 53 // Scrollbar::setTrackNeedsRepaint.
54 virtual bool shouldRepaintAllPartsOnInvalidation() const { return true; } 54 virtual bool shouldRepaintAllPartsOnInvalidation() const { return true; }
55 55
56 virtual void updateEnabledState(const ScrollbarThemeClient*) { } 56 virtual void updateEnabledState(const ScrollbarThemeClient&) { }
57 57
58 virtual bool paint(const ScrollbarThemeClient*, GraphicsContext*, const Cull Rect&); 58 virtual bool paint(const ScrollbarThemeClient&, GraphicsContext&, const Cull Rect&);
59 59
60 virtual ScrollbarPart hitTest(const ScrollbarThemeClient*, const IntPoint&); 60 virtual ScrollbarPart hitTest(const ScrollbarThemeClient&, const IntPoint&);
61 61
62 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; } 62 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; }
63 virtual int scrollbarMargin() const { return 0; } 63 virtual int scrollbarMargin() const { return 0; }
64 64
65 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; } 65 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; }
66 66
67 virtual bool supportsControlTints() const { return false; } 67 virtual bool supportsControlTints() const { return false; }
68 virtual bool usesOverlayScrollbars() const { return false; } 68 virtual bool usesOverlayScrollbars() const { return false; }
69 virtual void updateScrollbarOverlayStyle(const ScrollbarThemeClient*) { } 69 virtual void updateScrollbarOverlayStyle(const ScrollbarThemeClient&) { }
70 70
71 virtual bool invalidateOnMouseEnterExit() { return false; } 71 virtual bool invalidateOnMouseEnterExit() { return false; }
72 virtual bool invalidateOnWindowActiveChange() const { return false; } 72 virtual bool invalidateOnWindowActiveChange() const { return false; }
73 73
74 virtual void paintScrollCorner(GraphicsContext*, const DisplayItemClient&, c onst IntRect& cornerRect); 74 virtual void paintScrollCorner(GraphicsContext&, const DisplayItemClient&, c onst IntRect& cornerRect);
75 virtual void paintTickmarks(GraphicsContext*, const ScrollbarThemeClient*, c onst IntRect&) { } 75 virtual void paintTickmarks(GraphicsContext&, const ScrollbarThemeClient&, c onst IntRect&) { }
76 76
77 virtual bool shouldCenterOnThumb(const ScrollbarThemeClient*, const Platform MouseEvent&); 77 virtual bool shouldCenterOnThumb(const ScrollbarThemeClient&, const Platform MouseEvent&);
78 virtual bool shouldSnapBackToDragOrigin(const ScrollbarThemeClient*, const P latformMouseEvent&); 78 virtual bool shouldSnapBackToDragOrigin(const ScrollbarThemeClient&, const P latformMouseEvent&);
79 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, c onst PlatformMouseEvent&) { return false; } 79 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, c onst PlatformMouseEvent&) { return false; }
80 80
81 // The position of the thumb relative to the track. 81 // The position of the thumb relative to the track.
82 virtual int thumbPosition(const ScrollbarThemeClient*); 82 virtual int thumbPosition(const ScrollbarThemeClient&);
83 // The length of the thumb along the axis of the scrollbar. 83 // The length of the thumb along the axis of the scrollbar.
84 virtual int thumbLength(const ScrollbarThemeClient*); 84 virtual int thumbLength(const ScrollbarThemeClient&);
85 // The position of the track relative to the scrollbar. 85 // The position of the track relative to the scrollbar.
86 virtual int trackPosition(const ScrollbarThemeClient*); 86 virtual int trackPosition(const ScrollbarThemeClient&);
87 // The length of the track along the axis of the scrollbar. 87 // The length of the track along the axis of the scrollbar.
88 virtual int trackLength(const ScrollbarThemeClient*); 88 virtual int trackLength(const ScrollbarThemeClient&);
89 // The opacity to be applied to the thumb. 89 // The opacity to be applied to the thumb.
90 virtual float thumbOpacity(const ScrollbarThemeClient*) const { return 1.0f; } 90 virtual float thumbOpacity(const ScrollbarThemeClient&) const { return 1.0f; }
91 91
92 virtual bool hasButtons(const ScrollbarThemeClient*) = 0; 92 virtual bool hasButtons(const ScrollbarThemeClient&) = 0;
93 virtual bool hasThumb(const ScrollbarThemeClient*) = 0; 93 virtual bool hasThumb(const ScrollbarThemeClient&) = 0;
94 94
95 virtual IntRect backButtonRect(const ScrollbarThemeClient*, ScrollbarPart, b ool painting = false) = 0; 95 virtual IntRect backButtonRect(const ScrollbarThemeClient&, ScrollbarPart, b ool painting = false) = 0;
96 virtual IntRect forwardButtonRect(const ScrollbarThemeClient*, ScrollbarPart , bool painting = false) = 0; 96 virtual IntRect forwardButtonRect(const ScrollbarThemeClient&, ScrollbarPart , bool painting = false) = 0;
97 virtual IntRect trackRect(const ScrollbarThemeClient*, bool painting = false ) = 0; 97 virtual IntRect trackRect(const ScrollbarThemeClient&, bool painting = false ) = 0;
98 virtual IntRect thumbRect(const ScrollbarThemeClient*); 98 virtual IntRect thumbRect(const ScrollbarThemeClient&);
99 virtual int thumbThickness(const ScrollbarThemeClient*); 99 virtual int thumbThickness(const ScrollbarThemeClient&);
100 100
101 virtual int minimumThumbLength(const ScrollbarThemeClient*); 101 virtual int minimumThumbLength(const ScrollbarThemeClient&);
102 102
103 virtual void splitTrack(const ScrollbarThemeClient*, const IntRect& track, I ntRect& startTrack, IntRect& thumb, IntRect& endTrack); 103 virtual void splitTrack(const ScrollbarThemeClient&, const IntRect& track, I ntRect& startTrack, IntRect& thumb, IntRect& endTrack);
104 104
105 virtual void paintScrollbarBackground(GraphicsContext*, const ScrollbarTheme Client*) { } 105 virtual void paintScrollbarBackground(GraphicsContext&, const ScrollbarTheme Client&) { }
106 virtual void paintTrackBackground(GraphicsContext*, const ScrollbarThemeClie nt*, const IntRect&) { } 106 virtual void paintTrackBackground(GraphicsContext&, const ScrollbarThemeClie nt&, const IntRect&) { }
107 virtual void paintTrackPiece(GraphicsContext*, const ScrollbarThemeClient*, const IntRect&, ScrollbarPart) { } 107 virtual void paintTrackPiece(GraphicsContext&, const ScrollbarThemeClient&, const IntRect&, ScrollbarPart) { }
108 virtual void paintButton(GraphicsContext*, const ScrollbarThemeClient*, cons t IntRect&, ScrollbarPart) { } 108 virtual void paintButton(GraphicsContext&, const ScrollbarThemeClient&, cons t IntRect&, ScrollbarPart) { }
109 virtual void paintThumb(GraphicsContext*, const ScrollbarThemeClient*, const IntRect&) { } 109 virtual void paintThumb(GraphicsContext&, const ScrollbarThemeClient&, const IntRect&) { }
110 110
111 virtual int maxOverlapBetweenPages() { return std::numeric_limits<int>::max( ); } 111 virtual int maxOverlapBetweenPages() { return std::numeric_limits<int>::max( ); }
112 112
113 virtual double initialAutoscrollTimerDelay() { return 0.25; } 113 virtual double initialAutoscrollTimerDelay() { return 0.25; }
114 virtual double autoscrollTimerDelay() { return 0.05; } 114 virtual double autoscrollTimerDelay() { return 0.05; }
115 115
116 virtual IntRect constrainTrackRectToTrackPieces(const ScrollbarThemeClient*, const IntRect& rect) { return rect; } 116 virtual IntRect constrainTrackRectToTrackPieces(const ScrollbarThemeClient&, const IntRect& rect) { return rect; }
117 117
118 virtual void registerScrollbar(ScrollbarThemeClient*) { } 118 virtual void registerScrollbar(ScrollbarThemeClient&) { }
119 virtual void unregisterScrollbar(ScrollbarThemeClient*) { } 119 virtual void unregisterScrollbar(ScrollbarThemeClient&) { }
120 120
121 virtual bool isMockTheme() const { return false; } 121 virtual bool isMockTheme() const { return false; }
122 122
123 static ScrollbarTheme* theme(); 123 static ScrollbarTheme& theme();
124 124
125 static void setMockScrollbarsEnabled(bool flag); 125 static void setMockScrollbarsEnabled(bool flag);
126 static bool mockScrollbarsEnabled(); 126 static bool mockScrollbarsEnabled();
127 127
128 protected: 128 protected:
129 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); 129 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart);
130 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); 130 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart);
131 131
132 private: 132 private:
133 static ScrollbarTheme* nativeTheme(); // Must be implemented to return the c orrect theme subclass. 133 static ScrollbarTheme& nativeTheme(); // Must be implemented to return the c orrect theme subclass.
134 static bool gMockScrollbarsEnabled; 134 static bool gMockScrollbarsEnabled;
135 }; 135 };
136 136
137 } 137 }
138 #endif 138 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.cpp ('k') | third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698