| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 WebKit::WebCanvas* webCanvas = drawingContext->canvas(); | 249 WebKit::WebCanvas* webCanvas = drawingContext->canvas(); |
| 250 WebKit::Platform::current()->themeEngine()->paintScrollbarThumb( | 250 WebKit::Platform::current()->themeEngine()->paintScrollbarThumb( |
| 251 webCanvas, | 251 webCanvas, |
| 252 scrollbarStateToThemeState(scrollbar), | 252 scrollbarStateToThemeState(scrollbar), |
| 253 scrollbar->controlSize() == RegularScrollbar ? WebKit::WebThemeEngin
e::SizeRegular : WebKit::WebThemeEngine::SizeSmall, | 253 scrollbar->controlSize() == RegularScrollbar ? WebKit::WebThemeEngin
e::SizeRegular : WebKit::WebThemeEngine::SizeSmall, |
| 254 WebKit::WebRect(scrollbar->frameRect()), | 254 WebKit::WebRect(scrollbar->frameRect()), |
| 255 scrollbarInfo); | 255 scrollbarInfo); |
| 256 } | 256 } |
| 257 | 257 |
| 258 if (!canDrawDirectly) | 258 if (!canDrawDirectly) |
| 259 context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, scrollb
ar->frameRect().location()); | 259 context->drawImageBuffer(imageBuffer.get(), scrollbar->frameRect().locat
ion()); |
| 260 | 260 |
| 261 return true; | 261 return true; |
| 262 } | 262 } |
| 263 | 263 |
| 264 void ScrollbarThemeChromiumMac::paintGivenTickmarks(GraphicsContext* context, Sc
rollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickm
arks) | 264 void ScrollbarThemeChromiumMac::paintGivenTickmarks(GraphicsContext* context, Sc
rollbarThemeClient* scrollbar, const IntRect& rect, const Vector<IntRect>& tickm
arks) |
| 265 { | 265 { |
| 266 if (scrollbar->orientation() != VerticalScrollbar) | 266 if (scrollbar->orientation() != VerticalScrollbar) |
| 267 return; | 267 return; |
| 268 | 268 |
| 269 if (rect.height() <= 0 || rect.width() <= 0) | 269 if (rect.height() <= 0 || rect.width() <= 0) |
| 270 return; // nothing to draw on. | 270 return; // nothing to draw on. |
| 271 | 271 |
| 272 if (!tickmarks.size()) | 272 if (!tickmarks.size()) |
| 273 return; | 273 return; |
| 274 | 274 |
| 275 GraphicsContextStateSaver stateSaver(*context); | 275 GraphicsContextStateSaver stateSaver(*context); |
| 276 context->setShouldAntialias(false); | 276 context->setShouldAntialias(false); |
| 277 context->setStrokeColor(Color(0xCC, 0xAA, 0x00, 0xFF), ColorSpaceDeviceRGB); | 277 context->setStrokeColor(Color(0xCC, 0xAA, 0x00, 0xFF)); |
| 278 context->setFillColor(Color(0xFF, 0xDD, 0x00, 0xFF), ColorSpaceDeviceRGB); | 278 context->setFillColor(Color(0xFF, 0xDD, 0x00, 0xFF)); |
| 279 | 279 |
| 280 for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.e
nd(); ++i) { | 280 for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.e
nd(); ++i) { |
| 281 // Calculate how far down (in %) the tick-mark should appear. | 281 // Calculate how far down (in %) the tick-mark should appear. |
| 282 const float percent = static_cast<float>(i->y()) / scrollbar->totalSize(
); | 282 const float percent = static_cast<float>(i->y()) / scrollbar->totalSize(
); |
| 283 if (percent < 0.0 || percent > 1.0) | 283 if (percent < 0.0 || percent > 1.0) |
| 284 continue; | 284 continue; |
| 285 | 285 |
| 286 // Calculate how far down (in pixels) the tick-mark should appear. | 286 // Calculate how far down (in pixels) the tick-mark should appear. |
| 287 const int yPos = rect.y() + (rect.height() * percent); | 287 const int yPos = rect.y() + (rect.height() * percent); |
| 288 | 288 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 return; | 430 return; |
| 431 | 431 |
| 432 // Inset a bit. | 432 // Inset a bit. |
| 433 IntRect tickmarkTrackRect = rect; | 433 IntRect tickmarkTrackRect = rect; |
| 434 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); | 434 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); |
| 435 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); | 435 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); |
| 436 paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks); | 436 paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks); |
| 437 } | 437 } |
| 438 | 438 |
| 439 } | 439 } |
| OLD | NEW |