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

Unified Diff: content/child/webthemeengine_impl_default.cc

Issue 2426793002: Aura overlay scrollbars adjust color for dark backgrounds (Closed)
Patch Set: fix 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: content/child/webthemeengine_impl_default.cc
diff --git a/content/child/webthemeengine_impl_default.cc b/content/child/webthemeengine_impl_default.cc
index 7fa4ba7d6497c2d374257db255e91d283d2c24cc..f1e56ba56e90c7890a0033fe0eb0382ad597942c 100644
--- a/content/child/webthemeengine_impl_default.cc
+++ b/content/child/webthemeengine_impl_default.cc
@@ -8,12 +8,12 @@
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebSize.h"
-#include "ui/native_theme/native_theme.h"
using blink::WebCanvas;
using blink::WebColor;
using blink::WebRect;
using blink::WebThemeEngine;
+using blink::WebScrollbarOverlayColorTheme;
namespace content {
namespace {
@@ -78,6 +78,20 @@ static ui::NativeTheme::Part NativeThemePart(
}
}
+static ui::NativeTheme::ScrollbarOverlayColorTheme
+NativeThemeScrollbarOverlayColorTheme(WebScrollbarOverlayColorTheme theme) {
+ switch (theme) {
+ case WebScrollbarOverlayColorTheme::WebScrollbarOverlayColorThemeDefault:
+ return ui::NativeTheme::ScrollbarOverlayColorThemeDefault;
+ case WebScrollbarOverlayColorTheme::WebScrollbarOverlayColorThemeLight:
+ return ui::NativeTheme::ScrollbarOverlayColorThemeLight;
+ case WebScrollbarOverlayColorTheme::WebScrollbarOverlayColorThemeDark:
+ return ui::NativeTheme::ScrollbarOverlayColorThemeDark;
+ default:
+ return ui::NativeTheme::ScrollbarOverlayColorThemeDefault;
+ }
+}
+
static ui::NativeTheme::State NativeThemeState(
WebThemeEngine::State state) {
switch (state) {
@@ -177,6 +191,12 @@ static void GetNativeThemeExtraParams(
native_theme_extra_params->progress_bar.value_rect_height =
extra_params->progressBar.valueRectHeight;
break;
+ case WebThemeEngine::PartScrollbarHorizontalThumb:
+ case WebThemeEngine::PartScrollbarVerticalThumb:
+ native_theme_extra_params->scrollbar_thumb.scrollbar_theme =
+ static_cast<ui::NativeTheme::ScrollbarOverlayColorTheme>(
bokan 2016/10/21 20:11:38 use the NativeThemeScrollbarOverlayColorTheme func
+ extra_params->scrollbarThumb.scrollbarTheme);
+ break;
default:
break; // Parts that have no extra params get here.
}
@@ -221,15 +241,18 @@ void WebThemeEngineImpl::paint(
native_theme_extra_params);
}
-void WebThemeEngineImpl::paintStateTransition(blink::WebCanvas* canvas,
- WebThemeEngine::Part part,
- WebThemeEngine::State startState,
- WebThemeEngine::State endState,
- double progress,
- const blink::WebRect& rect) {
+void WebThemeEngineImpl::paintStateTransition(
+ blink::WebCanvas* canvas,
+ WebThemeEngine::Part part,
+ WebThemeEngine::State startState,
+ WebThemeEngine::State endState,
+ double progress,
+ const blink::WebRect& rect,
+ WebScrollbarOverlayColorTheme theme) {
ui::NativeTheme::GetInstanceForWeb()->PaintStateTransition(
canvas, NativeThemePart(part), NativeThemeState(startState),
- NativeThemeState(endState), progress, gfx::Rect(rect));
+ NativeThemeState(endState), progress, gfx::Rect(rect),
+ NativeThemeScrollbarOverlayColorTheme(theme));
}
#if defined(OS_WIN)

Powered by Google App Engine
This is Rietveld 408576698