OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } else if (backButtonRect(scrollbar, BackButtonEndPart).contains(testPositio
n)) { | 163 } else if (backButtonRect(scrollbar, BackButtonEndPart).contains(testPositio
n)) { |
164 result = BackButtonEndPart; | 164 result = BackButtonEndPart; |
165 } else if (forwardButtonRect(scrollbar, ForwardButtonStartPart).contains(tes
tPosition)) { | 165 } else if (forwardButtonRect(scrollbar, ForwardButtonStartPart).contains(tes
tPosition)) { |
166 result = ForwardButtonStartPart; | 166 result = ForwardButtonStartPart; |
167 } else if (forwardButtonRect(scrollbar, ForwardButtonEndPart).contains(testP
osition)) { | 167 } else if (forwardButtonRect(scrollbar, ForwardButtonEndPart).contains(testP
osition)) { |
168 result = ForwardButtonEndPart; | 168 result = ForwardButtonEndPart; |
169 } | 169 } |
170 return result; | 170 return result; |
171 } | 171 } |
172 | 172 |
173 void ScrollbarTheme::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPa
rt part) | |
174 { | |
175 if (part == NoPart) | |
176 return; | |
177 | |
178 IntRect result; | |
179 switch (part) { | |
180 case BackButtonStartPart: | |
181 result = backButtonRect(scrollbar, BackButtonStartPart, true); | |
182 break; | |
183 case BackButtonEndPart: | |
184 result = backButtonRect(scrollbar, BackButtonEndPart, true); | |
185 break; | |
186 case ForwardButtonStartPart: | |
187 result = forwardButtonRect(scrollbar, ForwardButtonStartPart, true); | |
188 break; | |
189 case ForwardButtonEndPart: | |
190 result = forwardButtonRect(scrollbar, ForwardButtonEndPart, true); | |
191 break; | |
192 case TrackBGPart: | |
193 result = trackRect(scrollbar, true); | |
194 break; | |
195 case ScrollbarBGPart: | |
196 result = scrollbar->frameRect(); | |
197 break; | |
198 default: { | |
199 IntRect beforeThumbRect, thumbRect, afterThumbRect; | |
200 splitTrack(scrollbar, trackRect(scrollbar), beforeThumbRect, thumbRect,
afterThumbRect); | |
201 if (part == BackTrackPart) | |
202 result = beforeThumbRect; | |
203 else if (part == ForwardTrackPart) | |
204 result = afterThumbRect; | |
205 else | |
206 result = thumbRect; | |
207 } | |
208 } | |
209 result.moveBy(-scrollbar->location()); | |
210 scrollbar->invalidateRect(result); | |
211 } | |
212 | |
213 void ScrollbarTheme::paintScrollCorner(GraphicsContext* context, const DisplayIt
emClientWrapper& displayItemClient, const IntRect& cornerRect) | 173 void ScrollbarTheme::paintScrollCorner(GraphicsContext* context, const DisplayIt
emClientWrapper& displayItemClient, const IntRect& cornerRect) |
214 { | 174 { |
215 if (cornerRect.isEmpty()) | 175 if (cornerRect.isEmpty()) |
216 return; | 176 return; |
217 | 177 |
218 if (DrawingRecorder::useCachedDrawingIfPossible(*context, displayItemClient,
DisplayItem::ScrollbarCorner)) | 178 if (DrawingRecorder::useCachedDrawingIfPossible(*context, displayItemClient,
DisplayItem::ScrollbarCorner)) |
219 return; | 179 return; |
220 | 180 |
221 DrawingRecorder recorder(*context, displayItemClient, DisplayItem::Scrollbar
Corner, cornerRect); | 181 DrawingRecorder recorder(*context, displayItemClient, DisplayItem::Scrollbar
Corner, cornerRect); |
222 #if OS(MACOSX) | 182 #if OS(MACOSX) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 return DisplayItem::ScrollbarBackTrack; | 332 return DisplayItem::ScrollbarBackTrack; |
373 case ForwardTrackPart: | 333 case ForwardTrackPart: |
374 return DisplayItem::ScrollbarForwardTrack; | 334 return DisplayItem::ScrollbarForwardTrack; |
375 default: | 335 default: |
376 ASSERT_NOT_REACHED(); | 336 ASSERT_NOT_REACHED(); |
377 return DisplayItem::ScrollbarBackTrack; | 337 return DisplayItem::ScrollbarBackTrack; |
378 } | 338 } |
379 } | 339 } |
380 | 340 |
381 } // namespace blink | 341 } // namespace blink |
OLD | NEW |