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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 m_allowHitTest(allowHitTest), 58 m_allowHitTest(allowHitTest),
59 m_useSolidColor(false) {} 59 m_useSolidColor(false) {}
60 60
61 bool ScrollbarThemeOverlay::shouldRepaintAllPartsOnInvalidation() const { 61 bool ScrollbarThemeOverlay::shouldRepaintAllPartsOnInvalidation() const {
62 return false; 62 return false;
63 } 63 }
64 64
65 ScrollbarPart ScrollbarThemeOverlay::invalidateOnThumbPositionChange( 65 ScrollbarPart ScrollbarThemeOverlay::invalidateOnThumbPositionChange(
66 const ScrollbarThemeClient&, 66 const ScrollbarThemeClient&,
67 float oldPosition, 67 float oldPosition,
68 float newPosition) const { 68 float newPosition,
69 bool hitBeginOrEndChanged) const {
70 if (hitBeginOrEndChanged)
71 return ThumbPart;
69 return NoPart; 72 return NoPart;
70 } 73 }
71 74
72 ScrollbarPart ScrollbarThemeOverlay::invalidateOnEnabledChange() const { 75 ScrollbarPart ScrollbarThemeOverlay::invalidateOnEnabledChange() const {
73 return NoPart; 76 return NoPart;
74 } 77 }
75 78
76 int ScrollbarThemeOverlay::scrollbarThickness( 79 int ScrollbarThemeOverlay::scrollbarThickness(
77 ScrollbarControlSize controlSize) { 80 ScrollbarControlSize controlSize) {
78 return m_thumbThickness + m_scrollbarMargin; 81 return m_thumbThickness + m_scrollbarMargin;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 WebCanvas* canvas = context.canvas(); 200 WebCanvas* canvas = context.canvas();
198 201
199 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb; 202 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb;
200 if (scrollbar.orientation() == VerticalScrollbar) 203 if (scrollbar.orientation() == VerticalScrollbar)
201 part = WebThemeEngine::PartScrollbarVerticalThumb; 204 part = WebThemeEngine::PartScrollbarVerticalThumb;
202 205
203 blink::WebThemeEngine::ExtraParams params; 206 blink::WebThemeEngine::ExtraParams params;
204 params.scrollbarThumb.scrollbarTheme = 207 params.scrollbarThumb.scrollbarTheme =
205 static_cast<WebScrollbarOverlayColorTheme>( 208 static_cast<WebScrollbarOverlayColorTheme>(
206 scrollbar.getScrollbarOverlayColorTheme()); 209 scrollbar.getScrollbarOverlayColorTheme());
210 params.scrollbarThumb.isVerticalScrollbar =
211 scrollbar.orientation() == VerticalScrollbar;
212 params.scrollbarThumb.isLeftVerticalScrollbar =
213 scrollbar.isLeftSideVerticalScrollbar();
214
215 int currentThumbPosition = ScrollbarTheme::thumbPosition(scrollbar);
216
217 params.scrollbarThumb.hitStart = currentThumbPosition == 0;
218 params.scrollbarThumb.hitEnd =
219 !scrollbar.hasScrollCorner() &&
220 currentThumbPosition + thumbLength(scrollbar) == trackLength(scrollbar);
207 221
208 Platform::current()->themeEngine()->paint(canvas, part, state, WebRect(rect), 222 Platform::current()->themeEngine()->paint(canvas, part, state, WebRect(rect),
209 &params); 223 &params);
210 } 224 }
211 225
212 ScrollbarPart ScrollbarThemeOverlay::hitTest( 226 ScrollbarPart ScrollbarThemeOverlay::hitTest(
213 const ScrollbarThemeClient& scrollbar, 227 const ScrollbarThemeClient& scrollbar,
214 const IntPoint& position) { 228 const IntPoint& position) {
215 if (m_allowHitTest == DisallowHitTest) 229 if (m_allowHitTest == DisallowHitTest)
216 return NoPart; 230 return NoPart;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 278
265 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb; 279 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb;
266 if (scrollbar.orientation() == VerticalScrollbar) 280 if (scrollbar.orientation() == VerticalScrollbar)
267 part = WebThemeEngine::PartScrollbarVerticalThumb; 281 part = WebThemeEngine::PartScrollbarVerticalThumb;
268 282
269 DCHECK(Platform::current()->themeEngine()); 283 DCHECK(Platform::current()->themeEngine());
270 return Platform::current()->themeEngine()->ninePatchAperture(part); 284 return Platform::current()->themeEngine()->ninePatchAperture(part);
271 } 285 }
272 286
273 } // namespace blink 287 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698