OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/glue/webthemeengine_impl_win.h" | 5 #include "webkit/glue/webthemeengine_impl_win.h" |
6 | 6 |
7 #include <vsstyle.h> // To convert to ui::NativeTheme::State | 7 #include <vsstyle.h> // To convert to ui::NativeTheme::State |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
11 #include "skia/ext/skia_utils_win.h" | 11 #include "skia/ext/skia_utils_win.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 13 #include "ui/base/win/dpi.h" |
13 #include "ui/native_theme/native_theme.h" | 14 #include "ui/native_theme/native_theme.h" |
14 | 15 |
15 using WebKit::WebCanvas; | 16 using WebKit::WebCanvas; |
16 using WebKit::WebColor; | 17 using WebKit::WebColor; |
17 using WebKit::WebRect; | 18 using WebKit::WebRect; |
18 using WebKit::WebSize; | 19 using WebKit::WebSize; |
19 | 20 |
20 namespace webkit_glue { | 21 namespace webkit_glue { |
21 | 22 |
22 static RECT WebRectToRECT(const WebRect& rect) { | 23 static RECT WebRectToRECT(const WebRect& rect) { |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 extra); | 986 extra); |
986 } | 987 } |
987 | 988 |
988 WebSize WebThemeEngineImpl::getSize(int part) { | 989 WebSize WebThemeEngineImpl::getSize(int part) { |
989 switch (part) { | 990 switch (part) { |
990 case SBP_ARROWBTN: { | 991 case SBP_ARROWBTN: { |
991 gfx::Size size = ui::NativeTheme::instance()->GetPartSize( | 992 gfx::Size size = ui::NativeTheme::instance()->GetPartSize( |
992 ui::NativeTheme::kScrollbarUpArrow, | 993 ui::NativeTheme::kScrollbarUpArrow, |
993 ui::NativeTheme::kNormal, | 994 ui::NativeTheme::kNormal, |
994 ui::NativeTheme::ExtraParams()); | 995 ui::NativeTheme::ExtraParams()); |
| 996 // GetPartSize returns a size of (0, 0) when not using a themed style |
| 997 // (i.e. Windows Classic). Returning a non-zero size in this context |
| 998 // creates repaint conflicts, particularly in the window titlebar area |
| 999 // which significantly degrades performance. Fallback to using a system |
| 1000 // metric if required. |
| 1001 if (size.width() == 0) { |
| 1002 int width = static_cast<int>(GetSystemMetrics(SM_CXVSCROLL) / |
| 1003 ui::win::GetDeviceScaleFactor()); |
| 1004 size = gfx::Size(width, width); |
| 1005 } |
995 return WebSize(size.width(), size.height()); | 1006 return WebSize(size.width(), size.height()); |
996 } | 1007 } |
997 default: | 1008 default: |
998 NOTREACHED() << "Unhandled part: " << part; | 1009 NOTREACHED() << "Unhandled part: " << part; |
999 } | 1010 } |
1000 return WebSize(); | 1011 return WebSize(); |
1001 } | 1012 } |
1002 | 1013 |
1003 } // namespace webkit_glue | 1014 } // namespace webkit_glue |
OLD | NEW |