| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 if (rect.height() <= 0 || rect.width() <= 0) | 217 if (rect.height() <= 0 || rect.width() <= 0) |
| 218 return; | 218 return; |
| 219 | 219 |
| 220 // Get the tickmarks for the frameview. | 220 // Get the tickmarks for the frameview. |
| 221 Vector<IntRect> tickmarks; | 221 Vector<IntRect> tickmarks; |
| 222 scrollbar.getTickmarks(tickmarks); | 222 scrollbar.getTickmarks(tickmarks); |
| 223 if (!tickmarks.size()) | 223 if (!tickmarks.size()) |
| 224 return; | 224 return; |
| 225 | 225 |
| 226 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarTickmarks)) | 226 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::kScrollbarTickmarks)) |
| 227 return; | 227 return; |
| 228 | 228 |
| 229 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarTickmarks
, rect); | 229 DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarTickmark
s, rect); |
| 230 GraphicsContextStateSaver stateSaver(context); | 230 GraphicsContextStateSaver stateSaver(context); |
| 231 context.setShouldAntialias(false); | 231 context.setShouldAntialias(false); |
| 232 | 232 |
| 233 for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.e
nd(); ++i) { | 233 for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.e
nd(); ++i) { |
| 234 // Calculate how far down (in %) the tick-mark should appear. | 234 // Calculate how far down (in %) the tick-mark should appear. |
| 235 const float percent = static_cast<float>(i->y()) / scrollbar.totalSize()
; | 235 const float percent = static_cast<float>(i->y()) / scrollbar.totalSize()
; |
| 236 | 236 |
| 237 // Calculate how far down (in pixels) the tick-mark should appear. | 237 // Calculate how far down (in pixels) the tick-mark should appear. |
| 238 const int yPos = rect.y() + (rect.height() * percent); | 238 const int yPos = rect.y() + (rect.height() * percent); |
| 239 | 239 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return; | 282 return; |
| 283 PartPaintingParams params = buttonPartPaintingParams(scrollbar, scrollbar.cu
rrentPos(), part); | 283 PartPaintingParams params = buttonPartPaintingParams(scrollbar, scrollbar.cu
rrentPos(), part); |
| 284 if (!params.shouldPaint) | 284 if (!params.shouldPaint) |
| 285 return; | 285 return; |
| 286 DrawingRecorder recorder(gc, scrollbar, displayItemType, rect); | 286 DrawingRecorder recorder(gc, scrollbar, displayItemType, rect); |
| 287 Platform::current()->themeEngine()->paint(gc.canvas(), params.part, params.s
tate, WebRect(rect), 0); | 287 Platform::current()->themeEngine()->paint(gc.canvas(), params.part, params.s
tate, WebRect(rect), 0); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void ScrollbarThemeAura::paintThumb(GraphicsContext& gc, const Scrollbar& scroll
bar, const IntRect& rect) | 290 void ScrollbarThemeAura::paintThumb(GraphicsContext& gc, const Scrollbar& scroll
bar, const IntRect& rect) |
| 291 { | 291 { |
| 292 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, DisplayItem::
ScrollbarThumb)) | 292 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, DisplayItem::
kScrollbarThumb)) |
| 293 return; | 293 return; |
| 294 | 294 |
| 295 DrawingRecorder recorder(gc, scrollbar, DisplayItem::ScrollbarThumb, rect); | 295 DrawingRecorder recorder(gc, scrollbar, DisplayItem::kScrollbarThumb, rect); |
| 296 | 296 |
| 297 WebThemeEngine::State state; | 297 WebThemeEngine::State state; |
| 298 WebCanvas* canvas = gc.canvas(); | 298 WebCanvas* canvas = gc.canvas(); |
| 299 if (scrollbar.pressedPart() == ThumbPart) | 299 if (scrollbar.pressedPart() == ThumbPart) |
| 300 state = WebThemeEngine::StatePressed; | 300 state = WebThemeEngine::StatePressed; |
| 301 else if (scrollbar.hoveredPart() == ThumbPart) | 301 else if (scrollbar.hoveredPart() == ThumbPart) |
| 302 state = WebThemeEngine::StateHover; | 302 state = WebThemeEngine::StateHover; |
| 303 else | 303 else |
| 304 state = WebThemeEngine::StateNormal; | 304 state = WebThemeEngine::StateNormal; |
| 305 Platform::current()->themeEngine()->paint(canvas, scrollbar.orientation() ==
HorizontalScrollbar ? WebThemeEngine::PartScrollbarHorizontalThumb : WebThemeEn
gine::PartScrollbarVerticalThumb, state, WebRect(rect), 0); | 305 Platform::current()->themeEngine()->paint(canvas, scrollbar.orientation() ==
HorizontalScrollbar ? WebThemeEngine::PartScrollbarHorizontalThumb : WebThemeEn
gine::PartScrollbarVerticalThumb, state, WebRect(rect), 0); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 int squareSize = scrollbar.width(); | 341 int squareSize = scrollbar.width(); |
| 342 return IntSize(squareSize, scrollbar.height() < 2 * squareSize ? scrollb
ar.height() / 2 : squareSize); | 342 return IntSize(squareSize, scrollbar.height() < 2 * squareSize ? scrollb
ar.height() / 2 : squareSize); |
| 343 } | 343 } |
| 344 | 344 |
| 345 // HorizontalScrollbar | 345 // HorizontalScrollbar |
| 346 int squareSize = scrollbar.height(); | 346 int squareSize = scrollbar.height(); |
| 347 return IntSize(scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 :
squareSize, squareSize); | 347 return IntSize(scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 :
squareSize, squareSize); |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace blink | 350 } // namespace blink |
| OLD | NEW |