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

Unified Diff: content/child/webthemeengine_impl_default.cc

Issue 2290743002: Partial revert of https://codereview.chromium.org/1911973002/ (Closed)
Patch Set: . 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 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 3cbc96027f92082ba66c7953330e541f095c5884..7fa4ba7d6497c2d374257db255e91d283d2c24cc 100644
--- a/content/child/webthemeengine_impl_default.cc
+++ b/content/child/webthemeengine_impl_default.cc
@@ -16,6 +16,23 @@ using blink::WebRect;
using blink::WebThemeEngine;
namespace content {
+namespace {
+
+#if defined(OS_WIN)
+// The width of a vertical scroll bar in dips.
+int32_t g_vertical_scroll_bar_width;
+
+// The height of a horizontal scroll bar in dips.
+int32_t g_horizontal_scroll_bar_height;
+
+// The height of the arrow bitmap on a vertical scroll bar in dips.
+int32_t g_vertical_arrow_bitmap_height;
+
+// The width of the arrow bitmap on a horizontal scroll bar in dips.
+int32_t g_horizontal_arrow_bitmap_width;
+#endif
+
+} // namespace
static ui::NativeTheme::Part NativeThemePart(
WebThemeEngine::Part part) {
@@ -167,8 +184,27 @@ static void GetNativeThemeExtraParams(
blink::WebSize WebThemeEngineImpl::getSize(WebThemeEngine::Part part) {
ui::NativeTheme::ExtraParams extra;
+ ui::NativeTheme::Part native_theme_part = NativeThemePart(part);
+#if defined(OS_WIN)
+ switch (native_theme_part) {
+ case ui::NativeTheme::kScrollbarDownArrow:
+ case ui::NativeTheme::kScrollbarLeftArrow:
+ case ui::NativeTheme::kScrollbarRightArrow:
+ case ui::NativeTheme::kScrollbarUpArrow:
+ case ui::NativeTheme::kScrollbarHorizontalThumb:
+ case ui::NativeTheme::kScrollbarVerticalThumb:
+ case ui::NativeTheme::kScrollbarHorizontalTrack:
+ case ui::NativeTheme::kScrollbarVerticalTrack: {
+ return gfx::Size(g_vertical_scroll_bar_width,
+ g_vertical_scroll_bar_width);
+ }
+
+ default:
+ break;
+ }
+#endif
return ui::NativeTheme::GetInstanceForWeb()->GetPartSize(
- NativeThemePart(part), ui::NativeTheme::kNormal, extra);
+ native_theme_part, ui::NativeTheme::kNormal, extra);
}
void WebThemeEngineImpl::paint(
@@ -196,4 +232,18 @@ void WebThemeEngineImpl::paintStateTransition(blink::WebCanvas* canvas,
NativeThemeState(endState), progress, gfx::Rect(rect));
}
+#if defined(OS_WIN)
+// static
+void WebThemeEngineImpl::cacheScrollBarMetrics(
+ int32_t vertical_scroll_bar_width,
+ int32_t horizontal_scroll_bar_height,
+ int32_t vertical_arrow_bitmap_height,
+ int32_t horizontal_arrow_bitmap_width) {
+ g_vertical_scroll_bar_width = vertical_scroll_bar_width;
+ g_horizontal_scroll_bar_height = horizontal_scroll_bar_height;
+ g_vertical_arrow_bitmap_height = vertical_arrow_bitmap_height;
+ g_horizontal_arrow_bitmap_width = horizontal_arrow_bitmap_width;
+}
+#endif
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698