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

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

Issue 2239313002: Hide non-composited native scrollbars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use hidden overlay theme on all platforms. Created 4 years, 4 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 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } else { 289 } else {
290 thumbRect = IntRect(trackRect.x(), trackRect.y() + thumbPos, scrollbar.w idth(), thumbLength(scrollbar)); 290 thumbRect = IntRect(trackRect.x(), trackRect.y() + thumbPos, scrollbar.w idth(), thumbLength(scrollbar));
291 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width( ), thumbPos + thumbRect.height() / 2); 291 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width( ), thumbPos + thumbRect.height() / 2);
292 afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect. height(), trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY()); 292 afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect. height(), trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY());
293 } 293 }
294 } 294 }
295 295
296 ScrollbarTheme& ScrollbarTheme::theme() 296 ScrollbarTheme& ScrollbarTheme::theme()
297 { 297 {
298 if (ScrollbarTheme::mockScrollbarsEnabled()) { 298 if (ScrollbarTheme::mockScrollbarsEnabled()) {
299 if (RuntimeEnabledFeatures::hideScrollbarsEnabled()) {
300 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlayMock, hiddenMockTheme, (Scr ollbarThemeOverlayMock::HideScrollbars));
301 return hiddenMockTheme;
302 }
299 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { 303 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) {
300 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlayMock, overlayMockTheme, ()) ; 304 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlayMock, overlayMockTheme, ()) ;
301 return overlayMockTheme; 305 return overlayMockTheme;
302 } 306 }
303 307
304 DEFINE_STATIC_LOCAL(ScrollbarThemeMock, mockTheme, ()); 308 DEFINE_STATIC_LOCAL(ScrollbarThemeMock, mockTheme, ());
305 return mockTheme; 309 return mockTheme;
306 } 310 }
311 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled() && RuntimeEnabledFeat ures::hideScrollbarsEnabled()) {
skobes 2016/08/12 18:29:54 Do we need to check overlayScrollbarsEnabled(), or
312 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, hiddenTheme, (0, 0, Scrollbar ThemeOverlay::DisallowHitTest, Color()));
313 return hiddenTheme;
314 }
307 return nativeTheme(); 315 return nativeTheme();
308 } 316 }
309 317
310 void ScrollbarTheme::setMockScrollbarsEnabled(bool flag) 318 void ScrollbarTheme::setMockScrollbarsEnabled(bool flag)
311 { 319 {
312 gMockScrollbarsEnabled = flag; 320 gMockScrollbarsEnabled = flag;
313 } 321 }
314 322
315 bool ScrollbarTheme::mockScrollbarsEnabled() 323 bool ScrollbarTheme::mockScrollbarsEnabled()
316 { 324 {
(...skipping 24 matching lines...) Expand all
341 return DisplayItem::ScrollbarBackTrack; 349 return DisplayItem::ScrollbarBackTrack;
342 case ForwardTrackPart: 350 case ForwardTrackPart:
343 return DisplayItem::ScrollbarForwardTrack; 351 return DisplayItem::ScrollbarForwardTrack;
344 default: 352 default:
345 ASSERT_NOT_REACHED(); 353 ASSERT_NOT_REACHED();
346 return DisplayItem::ScrollbarBackTrack; 354 return DisplayItem::ScrollbarBackTrack;
347 } 355 }
348 } 356 }
349 357
350 } // namespace blink 358 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698