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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 state = WebThemeEngine::StateDisabled; | 251 state = WebThemeEngine::StateDisabled; |
252 | 252 |
253 IntRect alignRect = trackRect(scrollbar, false); | 253 IntRect alignRect = trackRect(scrollbar, false); |
254 WebThemeEngine::ExtraParams extraParams; | 254 WebThemeEngine::ExtraParams extraParams; |
255 extraParams.scrollbarTrack.isBack = (partType == BackTrackPart); | 255 extraParams.scrollbarTrack.isBack = (partType == BackTrackPart); |
256 extraParams.scrollbarTrack.trackX = alignRect.x(); | 256 extraParams.scrollbarTrack.trackX = alignRect.x(); |
257 extraParams.scrollbarTrack.trackY = alignRect.y(); | 257 extraParams.scrollbarTrack.trackY = alignRect.y(); |
258 extraParams.scrollbarTrack.trackWidth = alignRect.width(); | 258 extraParams.scrollbarTrack.trackWidth = alignRect.width(); |
259 extraParams.scrollbarTrack.trackHeight = alignRect.height(); | 259 extraParams.scrollbarTrack.trackHeight = alignRect.height(); |
260 Platform::current()->themeEngine()->paint( | 260 Platform::current()->themeEngine()->paint( |
261 gc.canvas(), scrollbar.orientation() == HorizontalScrollbar | 261 gc.canvas(), |
262 ? WebThemeEngine::PartScrollbarHorizontalTrack | 262 scrollbar.orientation() == HorizontalScrollbar |
263 : WebThemeEngine::PartScrollbarVerticalTrack, | 263 ? WebThemeEngine::PartScrollbarHorizontalTrack |
| 264 : WebThemeEngine::PartScrollbarVerticalTrack, |
264 state, WebRect(rect), &extraParams); | 265 state, WebRect(rect), &extraParams); |
265 } | 266 } |
266 | 267 |
267 void ScrollbarThemeAura::paintButton(GraphicsContext& gc, | 268 void ScrollbarThemeAura::paintButton(GraphicsContext& gc, |
268 const Scrollbar& scrollbar, | 269 const Scrollbar& scrollbar, |
269 const IntRect& rect, | 270 const IntRect& rect, |
270 ScrollbarPart part) { | 271 ScrollbarPart part) { |
271 DisplayItem::Type displayItemType = buttonPartToDisplayItemType(part); | 272 DisplayItem::Type displayItemType = buttonPartToDisplayItemType(part); |
272 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, | 273 if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, |
273 displayItemType)) | 274 displayItemType)) |
(...skipping 19 matching lines...) Expand all Loading... |
293 WebThemeEngine::State state; | 294 WebThemeEngine::State state; |
294 WebCanvas* canvas = gc.canvas(); | 295 WebCanvas* canvas = gc.canvas(); |
295 if (scrollbar.pressedPart() == ThumbPart) | 296 if (scrollbar.pressedPart() == ThumbPart) |
296 state = WebThemeEngine::StatePressed; | 297 state = WebThemeEngine::StatePressed; |
297 else if (scrollbar.hoveredPart() == ThumbPart) | 298 else if (scrollbar.hoveredPart() == ThumbPart) |
298 state = WebThemeEngine::StateHover; | 299 state = WebThemeEngine::StateHover; |
299 else | 300 else |
300 state = WebThemeEngine::StateNormal; | 301 state = WebThemeEngine::StateNormal; |
301 | 302 |
302 Platform::current()->themeEngine()->paint( | 303 Platform::current()->themeEngine()->paint( |
303 canvas, scrollbar.orientation() == HorizontalScrollbar | 304 canvas, |
304 ? WebThemeEngine::PartScrollbarHorizontalThumb | 305 scrollbar.orientation() == HorizontalScrollbar |
305 : WebThemeEngine::PartScrollbarVerticalThumb, | 306 ? WebThemeEngine::PartScrollbarHorizontalThumb |
| 307 : WebThemeEngine::PartScrollbarVerticalThumb, |
306 state, WebRect(rect), nullptr); | 308 state, WebRect(rect), nullptr); |
307 } | 309 } |
308 | 310 |
309 bool ScrollbarThemeAura::shouldRepaintAllPartsOnInvalidation() const { | 311 bool ScrollbarThemeAura::shouldRepaintAllPartsOnInvalidation() const { |
310 // This theme can separately handle thumb invalidation. | 312 // This theme can separately handle thumb invalidation. |
311 return false; | 313 return false; |
312 } | 314 } |
313 | 315 |
314 ScrollbarPart ScrollbarThemeAura::invalidateOnThumbPositionChange( | 316 ScrollbarPart ScrollbarThemeAura::invalidateOnThumbPositionChange( |
315 const ScrollbarThemeClient& scrollbar, | 317 const ScrollbarThemeClient& scrollbar, |
(...skipping 21 matching lines...) Expand all Loading... |
337 return !themeEngine->getSize(WebThemeEngine::PartScrollbarLeftArrow) | 339 return !themeEngine->getSize(WebThemeEngine::PartScrollbarLeftArrow) |
338 .isEmpty(); | 340 .isEmpty(); |
339 }; | 341 }; |
340 | 342 |
341 IntSize ScrollbarThemeAura::buttonSize(const ScrollbarThemeClient& scrollbar) { | 343 IntSize ScrollbarThemeAura::buttonSize(const ScrollbarThemeClient& scrollbar) { |
342 if (!hasScrollbarButtons(scrollbar.orientation())) | 344 if (!hasScrollbarButtons(scrollbar.orientation())) |
343 return IntSize(0, 0); | 345 return IntSize(0, 0); |
344 | 346 |
345 if (scrollbar.orientation() == VerticalScrollbar) { | 347 if (scrollbar.orientation() == VerticalScrollbar) { |
346 int squareSize = scrollbar.width(); | 348 int squareSize = scrollbar.width(); |
347 return IntSize(squareSize, scrollbar.height() < 2 * squareSize | 349 return IntSize(squareSize, |
348 ? scrollbar.height() / 2 | 350 scrollbar.height() < 2 * squareSize ? scrollbar.height() / 2 |
349 : squareSize); | 351 : squareSize); |
350 } | 352 } |
351 | 353 |
352 // HorizontalScrollbar | 354 // HorizontalScrollbar |
353 int squareSize = scrollbar.height(); | 355 int squareSize = scrollbar.height(); |
354 return IntSize( | 356 return IntSize( |
355 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, | 357 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, |
356 squareSize); | 358 squareSize); |
357 } | 359 } |
358 | 360 |
359 } // namespace blink | 361 } // namespace blink |
OLD | NEW |