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

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

Issue 2467693002: Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: overlay-scrollbar-mouse-capture now works on Mac Created 4 years, 1 month 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb; 161 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb;
162 if (scrollbar.orientation() == VerticalScrollbar) 162 if (scrollbar.orientation() == VerticalScrollbar)
163 part = WebThemeEngine::PartScrollbarVerticalThumb; 163 part = WebThemeEngine::PartScrollbarVerticalThumb;
164 164
165 blink::WebThemeEngine::ExtraParams params; 165 blink::WebThemeEngine::ExtraParams params;
166 params.scrollbarThumb.scrollbarTheme = 166 params.scrollbarThumb.scrollbarTheme =
167 static_cast<WebScrollbarOverlayColorTheme>( 167 static_cast<WebScrollbarOverlayColorTheme>(
168 scrollbar.getScrollbarOverlayColorTheme()); 168 scrollbar.getScrollbarOverlayColorTheme());
169 169
170 if (!scrollbar.enabled())
skobes 2016/11/02 21:02:43 Move this up next to the rest of the "state = " lo
bokan 2016/11/02 22:41:57 Done.
171 state = WebThemeEngine::StateDisabled;
172
170 Platform::current()->themeEngine()->paint(canvas, part, state, WebRect(rect), 173 Platform::current()->themeEngine()->paint(canvas, part, state, WebRect(rect),
171 &params); 174 &params);
172 } 175 }
173 176
174 ScrollbarPart ScrollbarThemeOverlay::hitTest( 177 ScrollbarPart ScrollbarThemeOverlay::hitTest(
175 const ScrollbarThemeClient& scrollbar, 178 const ScrollbarThemeClient& scrollbar,
176 const IntPoint& position) { 179 const IntPoint& position) {
177 if (m_allowHitTest == DisallowHitTest) 180 if (m_allowHitTest == DisallowHitTest)
178 return NoPart; 181 return NoPart;
179 182
180 return ScrollbarTheme::hitTest(scrollbar, position); 183 ScrollbarPart part = ScrollbarTheme::hitTest(scrollbar, position);
184 if (part != ThumbPart)
185 return NoPart;
186
187 return ThumbPart;
181 } 188 }
182 189
183 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() { 190 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() {
184 static ScrollbarThemeOverlay* theme; 191 static ScrollbarThemeOverlay* theme;
185 if (!theme) { 192 if (!theme) {
186 WebThemeEngine::ScrollbarStyle style = {3, 3, 0x80808080}; // default style 193 WebThemeEngine::ScrollbarStyle style = {3, 3, 0x80808080}; // default style
187 if (Platform::current()->themeEngine()) { 194 if (Platform::current()->themeEngine()) {
188 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style); 195 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style);
189 } 196 }
190 theme = new ScrollbarThemeOverlay( 197 theme = new ScrollbarThemeOverlay(
191 style.thumbThickness, style.scrollbarMargin, 198 style.thumbThickness, style.scrollbarMargin,
192 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); 199 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color));
193 } 200 }
194 return *theme; 201 return *theme;
195 } 202 }
196 203
197 } // namespace blink 204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698