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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 2426793002: Aura overlay scrollbars adjust color for dark backgrounds (Closed)
Patch Set: update Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index b991948fc11d2ae8bbdbd734b007b4528396ef94..82d8a42b3ec5f29facf8f62a97151616e615a0d8 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -403,17 +403,27 @@ void ScrollableArea::setScrollbarOverlayStyle(
}
}
-void ScrollableArea::recalculateScrollbarOverlayStyle(Color backgroundColor) {
- ScrollbarOverlayStyle oldOverlayStyle = getScrollbarOverlayStyle();
- ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
-
+ScrollbarOverlayStyle ScrollableArea::calculateScrollbarOverlayStyle(
+ Color backgroundColor) {
// Reduce the background color from RGB to a lightness value
// and determine which scrollbar style to use based on a lightness
// heuristic.
double hue, saturation, lightness;
backgroundColor.getHSL(hue, saturation, lightness);
if (lightness <= .5)
- overlayStyle = ScrollbarOverlayStyleLight;
+ return ScrollbarOverlayStyleLight;
+ return ScrollbarOverlayStyleDark;
+}
+
+void ScrollableArea::recalculateScrollbarOverlayStyle(Color backgroundColor,
+ bool isTransparent) {
+ ScrollbarOverlayStyle oldOverlayStyle = getScrollbarOverlayStyle();
+ ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
+
+ // will calc color when paint if it is transparent
+ if (!isTransparent) {
+ overlayStyle = calculateScrollbarOverlayStyle(backgroundColor);
+ }
if (oldOverlayStyle != overlayStyle)
setScrollbarOverlayStyle(overlayStyle);

Powered by Google App Engine
This is Rietveld 408576698