Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp

Issue 2763373002: Overlay scrollbars flush with window edge (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 bool ScrollbarThemeAura::shouldRepaintAllPartsOnInvalidation() const { 309 bool ScrollbarThemeAura::shouldRepaintAllPartsOnInvalidation() const {
310 // This theme can separately handle thumb invalidation. 310 // This theme can separately handle thumb invalidation.
311 return false; 311 return false;
312 } 312 }
313 313
314 ScrollbarPart ScrollbarThemeAura::invalidateOnThumbPositionChange( 314 ScrollbarPart ScrollbarThemeAura::invalidateOnThumbPositionChange(
315 const ScrollbarThemeClient& scrollbar, 315 const ScrollbarThemeClient& scrollbar,
316 float oldPosition, 316 float oldPosition,
317 float newPosition) const { 317 float newPosition,
318 bool hitBeginOrEndChanged) const {
318 ScrollbarPart invalidParts = NoPart; 319 ScrollbarPart invalidParts = NoPart;
319 ASSERT(buttonsPlacement() == WebScrollbarButtonsPlacementSingle); 320 ASSERT(buttonsPlacement() == WebScrollbarButtonsPlacementSingle);
320 static const ScrollbarPart kButtonParts[] = {BackButtonStartPart, 321 static const ScrollbarPart kButtonParts[] = {BackButtonStartPart,
321 ForwardButtonEndPart}; 322 ForwardButtonEndPart};
322 for (ScrollbarPart part : kButtonParts) { 323 for (ScrollbarPart part : kButtonParts) {
323 if (buttonPartPaintingParams(scrollbar, oldPosition, part) != 324 if (buttonPartPaintingParams(scrollbar, oldPosition, part) !=
324 buttonPartPaintingParams(scrollbar, newPosition, part)) 325 buttonPartPaintingParams(scrollbar, newPosition, part))
325 invalidParts = static_cast<ScrollbarPart>(invalidParts | part); 326 invalidParts = static_cast<ScrollbarPart>(invalidParts | part);
326 } 327 }
327 return invalidParts; 328 return invalidParts;
328 } 329 }
329 330
330 bool ScrollbarThemeAura::hasScrollbarButtons( 331 bool ScrollbarThemeAura::hasScrollbarButtons(
331 ScrollbarOrientation orientation) const { 332 ScrollbarOrientation orientation) const {
332 WebThemeEngine* themeEngine = Platform::current()->themeEngine(); 333 WebThemeEngine* themeEngine = Platform::current()->themeEngine();
333 if (orientation == VerticalScrollbar) { 334 if (orientation == VerticalScrollbar) {
334 return !themeEngine->getSize(WebThemeEngine::PartScrollbarDownArrow) 335 return !themeEngine->getSize(WebThemeEngine::PartScrollbarDownArrow)
335 .isEmpty(); 336 .isEmpty();
336 } 337 }
337 return !themeEngine->getSize(WebThemeEngine::PartScrollbarLeftArrow) 338 return !themeEngine->getSize(WebThemeEngine::PartScrollbarLeftArrow)
338 .isEmpty(); 339 .isEmpty();
339 }; 340 }
340 341
341 IntSize ScrollbarThemeAura::buttonSize(const ScrollbarThemeClient& scrollbar) { 342 IntSize ScrollbarThemeAura::buttonSize(const ScrollbarThemeClient& scrollbar) {
342 if (!hasScrollbarButtons(scrollbar.orientation())) 343 if (!hasScrollbarButtons(scrollbar.orientation()))
343 return IntSize(0, 0); 344 return IntSize(0, 0);
344 345
345 if (scrollbar.orientation() == VerticalScrollbar) { 346 if (scrollbar.orientation() == VerticalScrollbar) {
346 int squareSize = scrollbar.width(); 347 int squareSize = scrollbar.width();
347 return IntSize(squareSize, scrollbar.height() < 2 * squareSize 348 return IntSize(squareSize, scrollbar.height() < 2 * squareSize
348 ? scrollbar.height() / 2 349 ? scrollbar.height() / 2
349 : squareSize); 350 : squareSize);
350 } 351 }
351 352
352 // HorizontalScrollbar 353 // HorizontalScrollbar
353 int squareSize = scrollbar.height(); 354 int squareSize = scrollbar.height();
354 return IntSize( 355 return IntSize(
355 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, 356 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize,
356 squareSize); 357 squareSize);
357 } 358 }
358 359
359 } // namespace blink 360 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698