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

Side by Side Diff: gfx/native_theme_linux.cc

Issue 3697003: Make drawing consistent with webkit wrt default colors and effects (Closed)
Patch Set: bad indent Created 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "gfx/native_theme_linux.h" 5 #include "gfx/native_theme_linux.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gfx/size.h" 8 #include "gfx/size.h"
9 #include "gfx/rect.h" 9 #include "gfx/rect.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 unsigned int NativeThemeLinux::button_length_ = 14; 13 unsigned int NativeThemeLinux::button_length_ = 14;
14 unsigned int NativeThemeLinux::scrollbar_width_ = 15; 14 unsigned int NativeThemeLinux::scrollbar_width_ = 15;
15 unsigned int NativeThemeLinux::thumb_inactive_color_ = 0xf0ebe5; 15 unsigned int NativeThemeLinux::thumb_inactive_color_ = 0xeaeaea;
16 unsigned int NativeThemeLinux::thumb_active_color_ = 0xfaf8f5; 16 unsigned int NativeThemeLinux::thumb_active_color_ = 0xf4f4f4;
17 unsigned int NativeThemeLinux::track_color_ = 0xe3ddd8; 17 unsigned int NativeThemeLinux::track_color_ = 0xd3d3d3;
18 18
19 #if !defined(OS_CHROMEOS) 19 #if !defined(OS_CHROMEOS)
20 // Chromeos has a different look. 20 // Chromeos has a different look.
21 // static 21 // static
22 NativeThemeLinux* NativeThemeLinux::instance() { 22 NativeThemeLinux* NativeThemeLinux::instance() {
23 // The global NativeThemeLinux instance. 23 // The global NativeThemeLinux instance.
24 static NativeThemeLinux s_native_theme; 24 static NativeThemeLinux s_native_theme;
25 return &s_native_theme; 25 return &s_native_theme;
26 } 26 }
27 #endif 27 #endif
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // others the thickness is very unpredictable. 372 // others the thickness is very unpredictable.
373 // 373 //
374 // So, instead of trying to approximate the system theme, we 374 // So, instead of trying to approximate the system theme, we
375 // instead try to compute a reasonable looking choice based on the 375 // instead try to compute a reasonable looking choice based on the
376 // known color of the track and the thumb piece. This is difficult 376 // known color of the track and the thumb piece. This is difficult
377 // when trying to deal both with high- and low-contrast themes, 377 // when trying to deal both with high- and low-contrast themes,
378 // and both with positive and inverted themes. 378 // and both with positive and inverted themes.
379 // 379 //
380 // The following code has been tested to look OK with all of the 380 // The following code has been tested to look OK with all of the
381 // default GTK themes. 381 // default GTK themes.
382 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.2, 0.5); 382 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.28, 0.5);
383 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5); 383 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5);
384 384
385 if (hsv1[2] + hsv2[2] > 1.0) 385 if (hsv1[2] + hsv2[2] > 1.0)
386 diff = -diff; 386 diff = -diff;
387 387
388 return SaturateAndBrighten(hsv2, -0.2, diff); 388 return SaturateAndBrighten(hsv2, -0.2, diff);
389 } 389 }
390 390
391 void NativeThemeLinux::SetScrollbarColors(unsigned inactive_color, 391 void NativeThemeLinux::SetScrollbarColors(unsigned inactive_color,
392 unsigned active_color, 392 unsigned active_color,
393 unsigned track_color) const { 393 unsigned track_color) const {
394 thumb_inactive_color_ = inactive_color; 394 thumb_inactive_color_ = inactive_color;
395 thumb_active_color_ = active_color; 395 thumb_active_color_ = active_color;
396 track_color_ = track_color; 396 track_color_ = track_color;
397 } 397 }
398 398
399 } // namespace gfx 399 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698