OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(ScrollbarButtonsPlace
ment buttonPlacement) | 62 void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(ScrollbarButtonsPlace
ment buttonPlacement) |
63 { | 63 { |
64 gButtonPlacement = buttonPlacement; | 64 gButtonPlacement = buttonPlacement; |
65 } | 65 } |
66 | 66 |
67 // Override ScrollbarThemeMacCommon::paint() to add support for the following: | 67 // Override ScrollbarThemeMacCommon::paint() to add support for the following: |
68 // - drawing using WebThemeEngine functions | 68 // - drawing using WebThemeEngine functions |
69 // - drawing tickmarks | 69 // - drawing tickmarks |
70 // - Skia specific changes | 70 // - Skia specific changes |
71 bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient* scrollbar
, GraphicsContext* context, const CullRect& cullRect) | 71 bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient& scrollbar
, GraphicsContext& context, const CullRect& cullRect) |
72 { | 72 { |
73 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc
rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; | 73 DisplayItem::Type displayItemType = scrollbar.orientation() == HorizontalScr
ollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; |
74 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa
yItemType)) | 74 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, displayI
temType)) |
75 return true; | 75 return true; |
76 | 76 |
77 DrawingRecorder recorder(*context, *scrollbar, displayItemType, scrollbar->f
rameRect()); | 77 DrawingRecorder recorder(context, scrollbar, displayItemType, scrollbar.fram
eRect()); |
78 | 78 |
79 // Get the tickmarks for the frameview. | 79 // Get the tickmarks for the frameview. |
80 Vector<IntRect> tickmarks; | 80 Vector<IntRect> tickmarks; |
81 scrollbar->getTickmarks(tickmarks); | 81 scrollbar.getTickmarks(tickmarks); |
82 | 82 |
83 HIThemeTrackDrawInfo trackInfo; | 83 HIThemeTrackDrawInfo trackInfo; |
84 trackInfo.version = 0; | 84 trackInfo.version = 0; |
85 trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMedium
ScrollBar : kThemeSmallScrollBar; | 85 trackInfo.kind = scrollbar.controlSize() == RegularScrollbar ? kThemeMediumS
crollBar : kThemeSmallScrollBar; |
86 trackInfo.bounds = scrollbar->frameRect(); | 86 trackInfo.bounds = scrollbar.frameRect(); |
87 trackInfo.min = 0; | 87 trackInfo.min = 0; |
88 trackInfo.max = scrollbar->maximum(); | 88 trackInfo.max = scrollbar.maximum(); |
89 trackInfo.value = scrollbar->currentPos(); | 89 trackInfo.value = scrollbar.currentPos(); |
90 trackInfo.trackInfo.scrollbar.viewsize = scrollbar->visibleSize(); | 90 trackInfo.trackInfo.scrollbar.viewsize = scrollbar.visibleSize(); |
91 trackInfo.attributes = hasThumb(scrollbar) ? kThemeTrackShowThumb : 0; | 91 trackInfo.attributes = hasThumb(scrollbar) ? kThemeTrackShowThumb : 0; |
92 | 92 |
93 if (scrollbar->orientation() == HorizontalScrollbar) | 93 if (scrollbar.orientation() == HorizontalScrollbar) |
94 trackInfo.attributes |= kThemeTrackHorizontal; | 94 trackInfo.attributes |= kThemeTrackHorizontal; |
95 | 95 |
96 if (!scrollbar->enabled()) | 96 if (!scrollbar.enabled()) |
97 trackInfo.enableState = kThemeTrackDisabled; | 97 trackInfo.enableState = kThemeTrackDisabled; |
98 else | 98 else |
99 trackInfo.enableState = scrollbar->isScrollableAreaActive() ? kThemeTrac
kActive : kThemeTrackInactive; | 99 trackInfo.enableState = scrollbar.isScrollableAreaActive() ? kThemeTrack
Active : kThemeTrackInactive; |
100 | 100 |
101 if (!hasButtons(scrollbar)) | 101 if (!hasButtons(scrollbar)) |
102 trackInfo.enableState = kThemeTrackNothingToScroll; | 102 trackInfo.enableState = kThemeTrackNothingToScroll; |
103 trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scr
ollbar->pressedPart()); | 103 trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scr
ollbar.pressedPart()); |
104 | 104 |
105 SkCanvas* canvas = context->canvas(); | 105 SkCanvas* canvas = context.canvas(); |
106 CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getT
otalMatrix()); | 106 CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getT
otalMatrix()); |
107 | 107 |
108 // The Aqua scrollbar is buggy when rotated and scaled. We will just draw i
nto a bitmap if we detect a scale or rotation. | 108 // The Aqua scrollbar is buggy when rotated and scaled. We will just draw i
nto a bitmap if we detect a scale or rotation. |
109 bool canDrawDirectly = currentCTM.a == 1.0f && currentCTM.b == 0.0f && curre
ntCTM.c == 0.0f && (currentCTM.d == 1.0f || currentCTM.d == -1.0f); | 109 bool canDrawDirectly = currentCTM.a == 1.0f && currentCTM.b == 0.0f && curre
ntCTM.c == 0.0f && (currentCTM.d == 1.0f || currentCTM.d == -1.0f); |
110 OwnPtr<ImageBuffer> imageBuffer; | 110 OwnPtr<ImageBuffer> imageBuffer; |
111 SkCanvas* drawingCanvas; | 111 SkCanvas* drawingCanvas; |
112 if (!canDrawDirectly) { | 112 if (!canDrawDirectly) { |
113 trackInfo.bounds = IntRect(IntPoint(), scrollbar->frameRect().size()); | 113 trackInfo.bounds = IntRect(IntPoint(), scrollbar.frameRect().size()); |
114 | 114 |
115 IntRect bufferRect(scrollbar->frameRect()); | 115 IntRect bufferRect(scrollbar.frameRect()); |
116 bufferRect.intersect(cullRect.m_rect); | 116 bufferRect.intersect(cullRect.m_rect); |
117 bufferRect.move(-scrollbar->frameRect().x(), -scrollbar->frameRect().y()
); | 117 bufferRect.move(-scrollbar.frameRect().x(), -scrollbar.frameRect().y()); |
118 | 118 |
119 imageBuffer = ImageBuffer::create(bufferRect.size()); | 119 imageBuffer = ImageBuffer::create(bufferRect.size()); |
120 if (!imageBuffer) | 120 if (!imageBuffer) |
121 return true; | 121 return true; |
122 | 122 |
123 drawingCanvas = imageBuffer->canvas(); | 123 drawingCanvas = imageBuffer->canvas(); |
124 } else { | 124 } else { |
125 drawingCanvas = canvas; | 125 drawingCanvas = canvas; |
126 } | 126 } |
127 | 127 |
128 // Draw the track and its thumb. | 128 // Draw the track and its thumb. |
129 gfx::SkiaBitLocker bitLocker( | 129 gfx::SkiaBitLocker bitLocker( |
130 drawingCanvas, | 130 drawingCanvas, |
131 ThemeMac::inflateRectForAA(scrollbar->frameRect()), | 131 ThemeMac::inflateRectForAA(scrollbar.frameRect()), |
132 canDrawDirectly ? context->deviceScaleFactor() : 1.0f); | 132 canDrawDirectly ? context.deviceScaleFactor() : 1.0f); |
133 CGContextRef cgContext = bitLocker.cgContext(); | 133 CGContextRef cgContext = bitLocker.cgContext(); |
134 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); | 134 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
135 | 135 |
136 IntRect tickmarkTrackRect = trackRect(scrollbar, false); | 136 IntRect tickmarkTrackRect = trackRect(scrollbar, false); |
137 if (!canDrawDirectly) { | 137 if (!canDrawDirectly) { |
138 tickmarkTrackRect.setX(0); | 138 tickmarkTrackRect.setX(0); |
139 tickmarkTrackRect.setY(0); | 139 tickmarkTrackRect.setY(0); |
140 } | 140 } |
141 // The ends are rounded and the thumb doesn't go there. | 141 // The ends are rounded and the thumb doesn't go there. |
142 tickmarkTrackRect.inflateY(-tickmarkTrackRect.width()); | 142 tickmarkTrackRect.inflateY(-tickmarkTrackRect.width()); |
143 // Inset a bit. | 143 // Inset a bit. |
144 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); | 144 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); |
145 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 5); | 145 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 5); |
146 paintGivenTickmarks(drawingCanvas, scrollbar, tickmarkTrackRect, tickmarks); | 146 paintGivenTickmarks(drawingCanvas, scrollbar, tickmarkTrackRect, tickmarks); |
147 | 147 |
148 if (!canDrawDirectly) { | 148 if (!canDrawDirectly) { |
149 ASSERT(imageBuffer); | 149 ASSERT(imageBuffer); |
150 if (!context->contextDisabled()) { | 150 if (!context.contextDisabled()) { |
151 imageBuffer->draw(context, FloatRect(scrollbar->frameRect().location
(), FloatSize(imageBuffer->size())), | 151 imageBuffer->draw(&context, FloatRect(scrollbar.frameRect().location
(), FloatSize(imageBuffer->size())), |
152 nullptr, SkXfermode::kSrcOver_Mode); | 152 nullptr, SkXfermode::kSrcOver_Mode); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 int ScrollbarThemeMacNonOverlayAPI::scrollbarThickness(ScrollbarControlSize cont
rolSize) | 159 int ScrollbarThemeMacNonOverlayAPI::scrollbarThickness(ScrollbarControlSize cont
rolSize) |
160 { | 160 { |
161 return cScrollbarThickness[controlSize]; | 161 return cScrollbarThickness[controlSize]; |
162 } | 162 } |
163 | 163 |
164 ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlayAPI::buttonsPlacement() con
st | 164 ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlayAPI::buttonsPlacement() con
st |
165 { | 165 { |
166 return gButtonPlacement; | 166 return gButtonPlacement; |
167 } | 167 } |
168 | 168 |
169 bool ScrollbarThemeMacNonOverlayAPI::hasButtons(const ScrollbarThemeClient* scro
llbar) | 169 bool ScrollbarThemeMacNonOverlayAPI::hasButtons(const ScrollbarThemeClient& scro
llbar) |
170 { | 170 { |
171 return scrollbar->enabled() && buttonsPlacement() != ScrollbarButtonsPlaceme
ntNone | 171 return scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsPlacemen
tNone |
172 && (scrollbar->orientation() == HorizontalScrollbar | 172 && (scrollbar.orientation() == HorizontalScrollbar |
173 ? scrollbar->width() | 173 ? scrollbar.width() |
174 : scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->control
Size()] - cButtonHitInset[scrollbar->controlSize()]); | 174 : scrollbar.height()) >= 2 * (cRealButtonLength[scrollbar.controlSi
ze()] - cButtonHitInset[scrollbar.controlSize()]); |
175 } | 175 } |
176 | 176 |
177 bool ScrollbarThemeMacNonOverlayAPI::hasThumb(const ScrollbarThemeClient* scroll
bar) | 177 bool ScrollbarThemeMacNonOverlayAPI::hasThumb(const ScrollbarThemeClient& scroll
bar) |
178 { | 178 { |
179 int minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbM
inLength[scrollbar->controlSize()] + 1; | 179 int minLengthForThumb = 2 * cButtonInset[scrollbar.controlSize()] + cThumbMi
nLength[scrollbar.controlSize()] + 1; |
180 return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScroll
bar ? | 180 return scrollbar.enabled() && (scrollbar.orientation() == HorizontalScrollba
r ? |
181 scrollbar->width() : | 181 scrollbar.width() : |
182 scrollbar->height()) >= minLengthForThumb; | 182 scrollbar.height()) >= minLengthForThumb; |
183 } | 183 } |
184 | 184 |
185 static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation
orientation, ScrollbarControlSize controlSize, bool start) | 185 static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation
orientation, ScrollbarControlSize controlSize, bool start) |
186 { | 186 { |
187 ASSERT(gButtonPlacement != ScrollbarButtonsPlacementNone); | 187 ASSERT(gButtonPlacement != ScrollbarButtonsPlacementNone); |
188 | 188 |
189 IntRect paintRect(buttonRect); | 189 IntRect paintRect(buttonRect); |
190 if (orientation == HorizontalScrollbar) { | 190 if (orientation == HorizontalScrollbar) { |
191 paintRect.setWidth(cRealButtonLength[controlSize]); | 191 paintRect.setWidth(cRealButtonLength[controlSize]); |
192 if (!start) | 192 if (!start) |
193 paintRect.setX(buttonRect.x() - (cRealButtonLength[controlSize] - bu
ttonRect.width())); | 193 paintRect.setX(buttonRect.x() - (cRealButtonLength[controlSize] - bu
ttonRect.width())); |
194 } else { | 194 } else { |
195 paintRect.setHeight(cRealButtonLength[controlSize]); | 195 paintRect.setHeight(cRealButtonLength[controlSize]); |
196 if (!start) | 196 if (!start) |
197 paintRect.setY(buttonRect.y() - (cRealButtonLength[controlSize] - bu
ttonRect.height())); | 197 paintRect.setY(buttonRect.y() - (cRealButtonLength[controlSize] - bu
ttonRect.height())); |
198 } | 198 } |
199 | 199 |
200 return paintRect; | 200 return paintRect; |
201 } | 201 } |
202 | 202 |
203 IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(const ScrollbarThemeClien
t* scrollbar, ScrollbarPart part, bool painting) | 203 IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(const ScrollbarThemeClien
t& scrollbar, ScrollbarPart part, bool painting) |
204 { | 204 { |
205 IntRect result; | 205 IntRect result; |
206 | 206 |
207 if (part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsPl
acementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd)) | 207 if (part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsPl
acementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd)) |
208 return result; | 208 return result; |
209 | 209 |
210 if (part == BackButtonEndPart && (buttonsPlacement() == ScrollbarButtonsPlac
ementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart || butto
nsPlacement() == ScrollbarButtonsPlacementSingle)) | 210 if (part == BackButtonEndPart && (buttonsPlacement() == ScrollbarButtonsPlac
ementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart || butto
nsPlacement() == ScrollbarButtonsPlacementSingle)) |
211 return result; | 211 return result; |
212 | 212 |
213 int thickness = scrollbarThickness(scrollbar->controlSize()); | 213 int thickness = scrollbarThickness(scrollbar.controlSize()); |
214 bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == Scr
ollbarButtonsPlacementDoubleStart || buttonsPlacement() == ScrollbarButtonsPlace
mentDoubleBoth); | 214 bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == Scr
ollbarButtonsPlacementDoubleStart || buttonsPlacement() == ScrollbarButtonsPlace
mentDoubleBoth); |
215 if (outerButton) { | 215 if (outerButton) { |
216 if (scrollbar->orientation() == HorizontalScrollbar) | 216 if (scrollbar.orientation() == HorizontalScrollbar) |
217 result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[
scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness); | 217 result = IntRect(scrollbar.x(), scrollbar.y(), cOuterButtonLength[sc
rollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness); |
218 else | 218 else |
219 result = IntRect(scrollbar->x(), scrollbar->y(), thickness, cOuterBu
ttonLength[scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0)); | 219 result = IntRect(scrollbar.x(), scrollbar.y(), thickness, cOuterButt
onLength[scrollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0)); |
220 return result; | 220 return result; |
221 } | 221 } |
222 | 222 |
223 // Our repaint rect is slightly larger, since we are a button that is adjace
nt to the track. | 223 // Our repaint rect is slightly larger, since we are a button that is adjace
nt to the track. |
224 if (scrollbar->orientation() == HorizontalScrollbar) { | 224 if (scrollbar.orientation() == HorizontalScrollbar) { |
225 int start = part == BackButtonStartPart ? scrollbar->x() : scrollbar->x(
) + scrollbar->width() - cOuterButtonLength[scrollbar->controlSize()] - cButtonL
ength[scrollbar->controlSize()]; | 225 int start = part == BackButtonStartPart ? scrollbar.x() : scrollbar.x()
+ scrollbar.width() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLengt
h[scrollbar.controlSize()]; |
226 result = IntRect(start, scrollbar->y(), cButtonLength[scrollbar->control
Size()], thickness); | 226 result = IntRect(start, scrollbar.y(), cButtonLength[scrollbar.controlSi
ze()], thickness); |
227 } else { | 227 } else { |
228 int start = part == BackButtonStartPart ? scrollbar->y() : scrollbar->y(
) + scrollbar->height() - cOuterButtonLength[scrollbar->controlSize()] - cButton
Length[scrollbar->controlSize()]; | 228 int start = part == BackButtonStartPart ? scrollbar.y() : scrollbar.y()
+ scrollbar.height() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLeng
th[scrollbar.controlSize()]; |
229 result = IntRect(scrollbar->x(), start, thickness, cButtonLength[scrollb
ar->controlSize()]); | 229 result = IntRect(scrollbar.x(), start, thickness, cButtonLength[scrollba
r.controlSize()]); |
230 } | 230 } |
231 | 231 |
232 if (painting) | 232 if (painting) |
233 return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->co
ntrolSize(), part == BackButtonStartPart); | 233 return buttonRepaintRect(result, scrollbar.orientation(), scrollbar.cont
rolSize(), part == BackButtonStartPart); |
234 return result; | 234 return result; |
235 } | 235 } |
236 | 236 |
237 IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(const ScrollbarThemeCl
ient* scrollbar, ScrollbarPart part, bool painting) | 237 IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(const ScrollbarThemeCl
ient& scrollbar, ScrollbarPart part, bool painting) |
238 { | 238 { |
239 IntRect result; | 239 IntRect result; |
240 | 240 |
241 if (part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsP
lacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart)) | 241 if (part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsP
lacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart)) |
242 return result; | 242 return result; |
243 | 243 |
244 if (part == ForwardButtonStartPart && (buttonsPlacement() == ScrollbarButton
sPlacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd || bu
ttonsPlacement() == ScrollbarButtonsPlacementSingle)) | 244 if (part == ForwardButtonStartPart && (buttonsPlacement() == ScrollbarButton
sPlacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd || bu
ttonsPlacement() == ScrollbarButtonsPlacementSingle)) |
245 return result; | 245 return result; |
246 | 246 |
247 int thickness = scrollbarThickness(scrollbar->controlSize()); | 247 int thickness = scrollbarThickness(scrollbar.controlSize()); |
248 int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()]; | 248 int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()]; |
249 int buttonLength = cButtonLength[scrollbar->controlSize()]; | 249 int buttonLength = cButtonLength[scrollbar.controlSize()]; |
250 | 250 |
251 bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == Sc
rollbarButtonsPlacementDoubleEnd || buttonsPlacement() == ScrollbarButtonsPlacem
entDoubleBoth); | 251 bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == Sc
rollbarButtonsPlacementDoubleEnd || buttonsPlacement() == ScrollbarButtonsPlacem
entDoubleBoth); |
252 if (outerButton) { | 252 if (outerButton) { |
253 if (scrollbar->orientation() == HorizontalScrollbar) { | 253 if (scrollbar.orientation() == HorizontalScrollbar) { |
254 result = IntRect(scrollbar->x() + scrollbar->width() - outerButtonLe
ngth, scrollbar->y(), outerButtonLength, thickness); | 254 result = IntRect(scrollbar.x() + scrollbar.width() - outerButtonLeng
th, scrollbar.y(), outerButtonLength, thickness); |
255 if (painting) | 255 if (painting) |
256 result.inflateX(cOuterButtonOverlap); | 256 result.inflateX(cOuterButtonOverlap); |
257 } else { | 257 } else { |
258 result = IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height(
) - outerButtonLength, thickness, outerButtonLength); | 258 result = IntRect(scrollbar.x(), scrollbar.y() + scrollbar.height() -
outerButtonLength, thickness, outerButtonLength); |
259 if (painting) | 259 if (painting) |
260 result.inflateY(cOuterButtonOverlap); | 260 result.inflateY(cOuterButtonOverlap); |
261 } | 261 } |
262 return result; | 262 return result; |
263 } | 263 } |
264 | 264 |
265 if (scrollbar->orientation() == HorizontalScrollbar) { | 265 if (scrollbar.orientation() == HorizontalScrollbar) { |
266 int start = part == ForwardButtonEndPart ? scrollbar->x() + scrollbar->w
idth() - buttonLength : scrollbar->x() + outerButtonLength; | 266 int start = part == ForwardButtonEndPart ? scrollbar.x() + scrollbar.wid
th() - buttonLength : scrollbar.x() + outerButtonLength; |
267 result = IntRect(start, scrollbar->y(), buttonLength, thickness); | 267 result = IntRect(start, scrollbar.y(), buttonLength, thickness); |
268 } else { | 268 } else { |
269 int start = part == ForwardButtonEndPart ? scrollbar->y() + scrollbar->h
eight() - buttonLength : scrollbar->y() + outerButtonLength; | 269 int start = part == ForwardButtonEndPart ? scrollbar.y() + scrollbar.hei
ght() - buttonLength : scrollbar.y() + outerButtonLength; |
270 result = IntRect(scrollbar->x(), start, thickness, buttonLength); | 270 result = IntRect(scrollbar.x(), start, thickness, buttonLength); |
271 } | 271 } |
272 if (painting) | 272 if (painting) |
273 return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->co
ntrolSize(), part == ForwardButtonStartPart); | 273 return buttonRepaintRect(result, scrollbar.orientation(), scrollbar.cont
rolSize(), part == ForwardButtonStartPart); |
274 return result; | 274 return result; |
275 } | 275 } |
276 | 276 |
277 IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(const ScrollbarThemeClient* sc
rollbar, bool painting) | 277 IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(const ScrollbarThemeClient& sc
rollbar, bool painting) |
278 { | 278 { |
279 if (painting || !hasButtons(scrollbar)) | 279 if (painting || !hasButtons(scrollbar)) |
280 return scrollbar->frameRect(); | 280 return scrollbar.frameRect(); |
281 | 281 |
282 IntRect result; | 282 IntRect result; |
283 int thickness = scrollbarThickness(scrollbar->controlSize()); | 283 int thickness = scrollbarThickness(scrollbar.controlSize()); |
284 int startWidth = 0; | 284 int startWidth = 0; |
285 int endWidth = 0; | 285 int endWidth = 0; |
286 int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()]; | 286 int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()]; |
287 int buttonLength = cButtonLength[scrollbar->controlSize()]; | 287 int buttonLength = cButtonLength[scrollbar.controlSize()]; |
288 int doubleButtonLength = outerButtonLength + buttonLength; | 288 int doubleButtonLength = outerButtonLength + buttonLength; |
289 switch (buttonsPlacement()) { | 289 switch (buttonsPlacement()) { |
290 case ScrollbarButtonsPlacementSingle: | 290 case ScrollbarButtonsPlacementSingle: |
291 startWidth = buttonLength; | 291 startWidth = buttonLength; |
292 endWidth = buttonLength; | 292 endWidth = buttonLength; |
293 break; | 293 break; |
294 case ScrollbarButtonsPlacementDoubleStart: | 294 case ScrollbarButtonsPlacementDoubleStart: |
295 startWidth = doubleButtonLength; | 295 startWidth = doubleButtonLength; |
296 break; | 296 break; |
297 case ScrollbarButtonsPlacementDoubleEnd: | 297 case ScrollbarButtonsPlacementDoubleEnd: |
298 endWidth = doubleButtonLength; | 298 endWidth = doubleButtonLength; |
299 break; | 299 break; |
300 case ScrollbarButtonsPlacementDoubleBoth: | 300 case ScrollbarButtonsPlacementDoubleBoth: |
301 startWidth = doubleButtonLength; | 301 startWidth = doubleButtonLength; |
302 endWidth = doubleButtonLength; | 302 endWidth = doubleButtonLength; |
303 break; | 303 break; |
304 default: | 304 default: |
305 break; | 305 break; |
306 } | 306 } |
307 | 307 |
308 int totalWidth = startWidth + endWidth; | 308 int totalWidth = startWidth + endWidth; |
309 if (scrollbar->orientation() == HorizontalScrollbar) | 309 if (scrollbar.orientation() == HorizontalScrollbar) |
310 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w
idth() - totalWidth, thickness); | 310 return IntRect(scrollbar.x() + startWidth, scrollbar.y(), scrollbar.widt
h() - totalWidth, thickness); |
311 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol
lbar->height() - totalWidth); | 311 return IntRect(scrollbar.x(), scrollbar.y() + startWidth, thickness, scrollb
ar.height() - totalWidth); |
312 } | 312 } |
313 | 313 |
314 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClien
t* scrollbar) | 314 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClien
t& scrollbar) |
315 { | 315 { |
316 return cThumbMinLength[scrollbar->controlSize()]; | 316 return cThumbMinLength[scrollbar.controlSize()]; |
317 } | 317 } |
318 | 318 |
319 } | 319 } |
OLD | NEW |