OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 (10, 0, ScrollbarThemeOverlay::AllowHitTest)); | 134 (10, 0, ScrollbarThemeOverlay::AllowHitTest)); |
135 return theme; | 135 return theme; |
136 } | 136 } |
137 | 137 |
138 DEFINE_STATIC_LOCAL(ScrollbarThemeAura, theme, ()); | 138 DEFINE_STATIC_LOCAL(ScrollbarThemeAura, theme, ()); |
139 return theme; | 139 return theme; |
140 } | 140 } |
141 | 141 |
142 int ScrollbarThemeAura::scrollbarThickness(ScrollbarControlSize controlSize) { | 142 int ScrollbarThemeAura::scrollbarThickness(ScrollbarControlSize controlSize) { |
143 // Horiz and Vert scrollbars are the same thickness. | 143 // Horiz and Vert scrollbars are the same thickness. |
144 // In unit tests we don't have the mock theme engine (because of layering viol
ations), so we hard code the size (see bug 327470). | 144 // In unit tests we don't have the mock theme engine (because of layering |
| 145 // violations), so we hard code the size (see bug 327470). |
145 if (useMockTheme()) | 146 if (useMockTheme()) |
146 return 15; | 147 return 15; |
147 IntSize scrollbarSize = Platform::current()->themeEngine()->getSize( | 148 IntSize scrollbarSize = Platform::current()->themeEngine()->getSize( |
148 WebThemeEngine::PartScrollbarVerticalTrack); | 149 WebThemeEngine::PartScrollbarVerticalTrack); |
149 return scrollbarSize.width(); | 150 return scrollbarSize.width(); |
150 } | 151 } |
151 | 152 |
152 bool ScrollbarThemeAura::hasThumb(const ScrollbarThemeClient& scrollbar) { | 153 bool ScrollbarThemeAura::hasThumb(const ScrollbarThemeClient& scrollbar) { |
153 // This method is just called as a paint-time optimization to see if | 154 // This method is just called as a paint-time optimization to see if |
154 // painting the thumb can be skipped. We don't have to be exact here. | 155 // painting the thumb can be skipped. We don't have to be exact here. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 context.fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF)); | 253 context.fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF)); |
253 | 254 |
254 FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1); | 255 FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1); |
255 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF)); | 256 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF)); |
256 } | 257 } |
257 } | 258 } |
258 | 259 |
259 void ScrollbarThemeAura::paintTrackBackground(GraphicsContext& context, | 260 void ScrollbarThemeAura::paintTrackBackground(GraphicsContext& context, |
260 const Scrollbar& scrollbar, | 261 const Scrollbar& scrollbar, |
261 const IntRect& rect) { | 262 const IntRect& rect) { |
262 // Just assume a forward track part. We only paint the track as a single piece
when there is no thumb. | 263 // Just assume a forward track part. We only paint the track as a single piece |
| 264 // when there is no thumb. |
263 if (!hasThumb(scrollbar) && !rect.isEmpty()) | 265 if (!hasThumb(scrollbar) && !rect.isEmpty()) |
264 paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); | 266 paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); |
265 } | 267 } |
266 | 268 |
267 void ScrollbarThemeAura::paintTrackPiece(GraphicsContext& gc, | 269 void ScrollbarThemeAura::paintTrackPiece(GraphicsContext& gc, |
268 const Scrollbar& scrollbar, | 270 const Scrollbar& scrollbar, |
269 const IntRect& rect, | 271 const IntRect& rect, |
270 ScrollbarPart partType) { | 272 ScrollbarPart partType) { |
271 DisplayItem::Type displayItemType = trackPiecePartToDisplayItemType(partType); | 273 DisplayItem::Type displayItemType = trackPiecePartToDisplayItemType(partType); |
272 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, | 274 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 383 } |
382 | 384 |
383 // HorizontalScrollbar | 385 // HorizontalScrollbar |
384 int squareSize = scrollbar.height(); | 386 int squareSize = scrollbar.height(); |
385 return IntSize( | 387 return IntSize( |
386 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, | 388 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, |
387 squareSize); | 389 squareSize); |
388 } | 390 } |
389 | 391 |
390 } // namespace blink | 392 } // namespace blink |
OLD | NEW |