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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp

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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "platform/exported/WebScrollbarThemeGeometryNative.h" 28 #include "platform/exported/WebScrollbarThemeGeometryNative.h"
29 29
30 #include "platform/exported/WebScrollbarThemeClientImpl.h" 30 #include "platform/exported/WebScrollbarThemeClientImpl.h"
31 #include "platform/scroll/ScrollbarTheme.h" 31 #include "platform/scroll/ScrollbarTheme.h"
32 #include "public/platform/WebScrollbar.h" 32 #include "public/platform/WebScrollbar.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 PassOwnPtr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::cre ate(ScrollbarTheme* theme) 36 PassOwnPtr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::cre ate(ScrollbarTheme& theme)
37 { 37 {
38 return adoptPtr(new WebScrollbarThemeGeometryNative(theme)); 38 return adoptPtr(new WebScrollbarThemeGeometryNative(theme));
39 } 39 }
40 40
41 WebScrollbarThemeGeometryNative::WebScrollbarThemeGeometryNative(ScrollbarTheme* theme) 41 WebScrollbarThemeGeometryNative::WebScrollbarThemeGeometryNative(ScrollbarTheme& theme)
42 : m_theme(theme) 42 : m_theme(theme)
43 { 43 {
44 } 44 }
45 45
46 WebScrollbarThemeGeometryNative* WebScrollbarThemeGeometryNative::clone() const 46 WebScrollbarThemeGeometryNative* WebScrollbarThemeGeometryNative::clone() const
47 { 47 {
48 return new WebScrollbarThemeGeometryNative(m_theme); 48 return new WebScrollbarThemeGeometryNative(m_theme);
49 } 49 }
50 50
51 int WebScrollbarThemeGeometryNative::thumbPosition(WebScrollbar* scrollbar) 51 int WebScrollbarThemeGeometryNative::thumbPosition(WebScrollbar* scrollbar)
52 { 52 {
53 WebScrollbarThemeClientImpl client(scrollbar); 53 return m_theme.thumbPosition(WebScrollbarThemeClientImpl(*scrollbar));
54 return m_theme->thumbPosition(&client);
55 } 54 }
56 55
57 int WebScrollbarThemeGeometryNative::thumbLength(WebScrollbar* scrollbar) 56 int WebScrollbarThemeGeometryNative::thumbLength(WebScrollbar* scrollbar)
58 { 57 {
59 WebScrollbarThemeClientImpl client(scrollbar); 58 return m_theme.thumbLength(WebScrollbarThemeClientImpl(*scrollbar));
60 return m_theme->thumbLength(&client);
61 } 59 }
62 60
63 int WebScrollbarThemeGeometryNative::trackPosition(WebScrollbar* scrollbar) 61 int WebScrollbarThemeGeometryNative::trackPosition(WebScrollbar* scrollbar)
64 { 62 {
65 WebScrollbarThemeClientImpl client(scrollbar); 63 return m_theme.trackPosition(WebScrollbarThemeClientImpl(*scrollbar));
66 return m_theme->trackPosition(&client);
67 } 64 }
68 65
69 int WebScrollbarThemeGeometryNative::trackLength(WebScrollbar* scrollbar) 66 int WebScrollbarThemeGeometryNative::trackLength(WebScrollbar* scrollbar)
70 { 67 {
71 WebScrollbarThemeClientImpl client(scrollbar); 68 return m_theme.trackLength(WebScrollbarThemeClientImpl(*scrollbar));
72 return m_theme->trackLength(&client);
73 } 69 }
74 70
75 bool WebScrollbarThemeGeometryNative::hasButtons(WebScrollbar* scrollbar) 71 bool WebScrollbarThemeGeometryNative::hasButtons(WebScrollbar* scrollbar)
76 { 72 {
77 WebScrollbarThemeClientImpl client(scrollbar); 73 return m_theme.hasButtons(WebScrollbarThemeClientImpl(*scrollbar));
78 return m_theme->hasButtons(&client);
79 } 74 }
80 75
81 bool WebScrollbarThemeGeometryNative::hasThumb(WebScrollbar* scrollbar) 76 bool WebScrollbarThemeGeometryNative::hasThumb(WebScrollbar* scrollbar)
82 { 77 {
83 WebScrollbarThemeClientImpl client(scrollbar); 78 return m_theme.hasThumb(WebScrollbarThemeClientImpl(*scrollbar));
84 return m_theme->hasThumb(&client);
85 } 79 }
86 80
87 WebRect WebScrollbarThemeGeometryNative::trackRect(WebScrollbar* scrollbar) 81 WebRect WebScrollbarThemeGeometryNative::trackRect(WebScrollbar* scrollbar)
88 { 82 {
89 WebScrollbarThemeClientImpl client(scrollbar); 83 return m_theme.trackRect(WebScrollbarThemeClientImpl(*scrollbar));
90 return m_theme->trackRect(&client);
91 } 84 }
92 85
93 WebRect WebScrollbarThemeGeometryNative::thumbRect(WebScrollbar* scrollbar) 86 WebRect WebScrollbarThemeGeometryNative::thumbRect(WebScrollbar* scrollbar)
94 { 87 {
95 WebScrollbarThemeClientImpl client(scrollbar); 88 return m_theme.thumbRect(WebScrollbarThemeClientImpl(*scrollbar));
96 return m_theme->thumbRect(&client);
97 } 89 }
98 90
99 int WebScrollbarThemeGeometryNative::minimumThumbLength(WebScrollbar* scrollbar) 91 int WebScrollbarThemeGeometryNative::minimumThumbLength(WebScrollbar* scrollbar)
100 { 92 {
101 WebScrollbarThemeClientImpl client(scrollbar); 93 return m_theme.minimumThumbLength(WebScrollbarThemeClientImpl(*scrollbar));
102 return m_theme->minimumThumbLength(&client);
103 } 94 }
104 95
105 int WebScrollbarThemeGeometryNative::scrollbarThickness(WebScrollbar* scrollbar) 96 int WebScrollbarThemeGeometryNative::scrollbarThickness(WebScrollbar* scrollbar)
106 { 97 {
107 WebScrollbarThemeClientImpl client(scrollbar); 98 return m_theme.scrollbarThickness(WebScrollbarThemeClientImpl(*scrollbar).co ntrolSize());
108 return m_theme->scrollbarThickness(client.controlSize());
109 } 99 }
110 100
111 WebRect WebScrollbarThemeGeometryNative::backButtonStartRect(WebScrollbar* scrol lbar) 101 WebRect WebScrollbarThemeGeometryNative::backButtonStartRect(WebScrollbar* scrol lbar)
112 { 102 {
113 WebScrollbarThemeClientImpl client(scrollbar); 103 return m_theme.backButtonRect(WebScrollbarThemeClientImpl(*scrollbar), BackB uttonStartPart, false);
114 return m_theme->backButtonRect(&client, BackButtonStartPart, false);
115 } 104 }
116 105
117 WebRect WebScrollbarThemeGeometryNative::backButtonEndRect(WebScrollbar* scrollb ar) 106 WebRect WebScrollbarThemeGeometryNative::backButtonEndRect(WebScrollbar* scrollb ar)
118 { 107 {
119 WebScrollbarThemeClientImpl client(scrollbar); 108 return m_theme.backButtonRect(WebScrollbarThemeClientImpl(*scrollbar), BackB uttonEndPart, false);
120 return m_theme->backButtonRect(&client, BackButtonEndPart, false);
121 } 109 }
122 110
123 WebRect WebScrollbarThemeGeometryNative::forwardButtonStartRect(WebScrollbar* sc rollbar) 111 WebRect WebScrollbarThemeGeometryNative::forwardButtonStartRect(WebScrollbar* sc rollbar)
124 { 112 {
125 WebScrollbarThemeClientImpl client(scrollbar); 113 return m_theme.forwardButtonRect(WebScrollbarThemeClientImpl(*scrollbar), Fo rwardButtonStartPart, false);
126 return m_theme->forwardButtonRect(&client, ForwardButtonStartPart, false);
127 } 114 }
128 115
129 WebRect WebScrollbarThemeGeometryNative::forwardButtonEndRect(WebScrollbar* scro llbar) 116 WebRect WebScrollbarThemeGeometryNative::forwardButtonEndRect(WebScrollbar* scro llbar)
130 { 117 {
131 WebScrollbarThemeClientImpl client(scrollbar); 118 return m_theme.forwardButtonRect(WebScrollbarThemeClientImpl(*scrollbar), Fo rwardButtonEndPart, false);
132 return m_theme->forwardButtonRect(&client, ForwardButtonEndPart, false);
133 } 119 }
134 120
135 WebRect WebScrollbarThemeGeometryNative::constrainTrackRectToTrackPieces(WebScro llbar* scrollbar, const WebRect& rect) 121 WebRect WebScrollbarThemeGeometryNative::constrainTrackRectToTrackPieces(WebScro llbar* scrollbar, const WebRect& rect)
136 { 122 {
137 WebScrollbarThemeClientImpl client(scrollbar); 123 return m_theme.constrainTrackRectToTrackPieces(WebScrollbarThemeClientImpl(* scrollbar), IntRect(rect));
138 return m_theme->constrainTrackRectToTrackPieces(&client, IntRect(rect));
139 } 124 }
140 125
141 void WebScrollbarThemeGeometryNative::splitTrack(WebScrollbar* scrollbar, const WebRect& webTrack, WebRect& webStartTrack, WebRect& webThumb, WebRect& webEndTra ck) 126 void WebScrollbarThemeGeometryNative::splitTrack(WebScrollbar* scrollbar, const WebRect& webTrack, WebRect& webStartTrack, WebRect& webThumb, WebRect& webEndTra ck)
142 { 127 {
143 WebScrollbarThemeClientImpl client(scrollbar);
144 IntRect track(webTrack); 128 IntRect track(webTrack);
145 IntRect startTrack; 129 IntRect startTrack;
146 IntRect thumb; 130 IntRect thumb;
147 IntRect endTrack; 131 IntRect endTrack;
148 m_theme->splitTrack(&client, track, startTrack, thumb, endTrack); 132 m_theme.splitTrack(WebScrollbarThemeClientImpl(*scrollbar), track, startTrac k, thumb, endTrack);
149 133
150 webStartTrack = startTrack; 134 webStartTrack = startTrack;
151 webThumb = thumb; 135 webThumb = thumb;
152 webEndTrack = endTrack; 136 webEndTrack = endTrack;
153 } 137 }
154 138
155 } // namespace blink 139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698