diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 04:08:09 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 04:08:09 +0000 |
commit | 64f42ca695cc8192351936ba3c4c7cdf5cef0724 (patch) | |
tree | 802120e0708f5749b8f14686e8cddfa75c37f775 /ui/native_theme | |
parent | bf3ea334ae72962f6c71c350caaceae0b33db5ea (diff) | |
download | chromium_src-64f42ca695cc8192351936ba3c4c7cdf5cef0724.zip chromium_src-64f42ca695cc8192351936ba3c4c7cdf5cef0724.tar.gz chromium_src-64f42ca695cc8192351936ba3c4c7cdf5cef0724.tar.bz2 |
Revert 200431 "Use the default theme as the fallback UI in Blink"
> Use the default theme as the fallback UI in Blink
>
> Most native themes don't support zooming or styling required by Blink.
> We will be using the default theme as fallback.
>
> We introduce NativeThemeDefault that can be used in parallel with NativeThemeMac/Gtk/Win/Android.
> Rename webthemeengine_impl_default to webdefaultthemeengine_impl.
>
> Blink side change: https://codereview.chromium.org/14108007/
>
> BUG=84973
>
> Review URL: https://chromiumcodereview.appspot.com/14424007
BUG=241327
TBR=keishi@chromium.org
Review URL: https://codereview.chromium.org/14951005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/native_theme')
-rw-r--r-- | ui/native_theme/fallback_theme.cc | 201 | ||||
-rw-r--r-- | ui/native_theme/fallback_theme.h | 31 | ||||
-rw-r--r-- | ui/native_theme/native_theme.gyp | 2 | ||||
-rw-r--r-- | ui/native_theme/native_theme_aura.cc | 168 | ||||
-rw-r--r-- | ui/native_theme/native_theme_aura.h | 5 |
5 files changed, 171 insertions, 236 deletions
diff --git a/ui/native_theme/fallback_theme.cc b/ui/native_theme/fallback_theme.cc deleted file mode 100644 index 57a55cb..0000000 --- a/ui/native_theme/fallback_theme.cc +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/native_theme/fallback_theme.h" - -#include "base/basictypes.h" -#include "base/logging.h" -#include "ui/gfx/color_utils.h" -#include "ui/gfx/skia_utils_gtk.h" -#include "ui/native_theme/common_theme.h" - -namespace { - -const SkColor kMenuBackgroundColor = SK_ColorWHITE; - -// Theme colors returned by GetSystemColor(). -const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); -// Windows: -const SkColor kWindowBackgroundColor = SK_ColorWHITE; -// Dialogs: -const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); -// FocusableBorder: -const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); -const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); -// TextButton: -const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xDE, 0xDE, 0xDE); -const SkColor kTextButtonEnabledColor = SkColorSetRGB(0x22, 0x22, 0x22); -const SkColor kTextButtonDisabledColor = SkColorSetRGB(0x99, 0x99, 0x99); -const SkColor kTextButtonHighlightColor = SkColorSetRGB(0, 0, 0); -const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; -// MenuItem: -const SkColor kEnabledMenuItemForegroundColor = kTextButtonEnabledColor; -const SkColor kDisabledMenuItemForegroundColor = kTextButtonDisabledColor; -const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(0xF1, 0xF1, 0xF1); -const SkColor kHoverMenuItemBackgroundColor = - SkColorSetARGB(204, 255, 255, 255); -const SkColor kMenuSeparatorColor = SkColorSetRGB(0xED, 0xED, 0xED); -const SkColor kEnabledMenuButtonBorderColor = SkColorSetARGB(36, 0, 0, 0); -const SkColor kFocusedMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); -const SkColor kHoverMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); -// Label: -const SkColor kLabelEnabledColor = kTextButtonEnabledColor; -const SkColor kLabelDisabledColor = kTextButtonDisabledColor; -const SkColor kLabelBackgroundColor = SK_ColorWHITE; -// Textfield: -const SkColor kTextfieldDefaultColor = SK_ColorBLACK; -const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; -const SkColor kTextfieldReadOnlyColor = SK_ColorDKGRAY; -const SkColor kTextfieldReadOnlyBackground = SK_ColorWHITE; -const SkColor kTextfieldSelectionBackgroundFocused = - SkColorSetARGB(0x54, 0x60, 0xA8, 0xEB); -const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; -const SkColor kTextfieldSelectionColor = - color_utils::AlphaBlend(SK_ColorBLACK, - kTextfieldSelectionBackgroundFocused, 0xdd); -// Tree -const SkColor kTreeBackground = SK_ColorWHITE; -const SkColor kTreeTextColor = SK_ColorBLACK; -const SkColor kTreeSelectedTextColor = SK_ColorBLACK; -const SkColor kTreeSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); -const SkColor kTreeArrowColor = SkColorSetRGB(0x7A, 0x7A, 0x7A); -// Table -const SkColor kTableBackground = SK_ColorWHITE; -const SkColor kTableTextColor = SK_ColorBLACK; -const SkColor kTableSelectedTextColor = SK_ColorBLACK; -const SkColor kTableSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); -const SkColor kTableGroupingIndicatorColor = SkColorSetRGB(0xCC, 0xCC, 0xCC); - -} // namespace - -namespace ui { - -// static -FallbackTheme* FallbackTheme::instance() { - CR_DEFINE_STATIC_LOCAL(FallbackTheme, s_native_theme, ()); - return &s_native_theme; -} - -FallbackTheme::FallbackTheme() { -} - -FallbackTheme::~FallbackTheme() { -} - -SkColor FallbackTheme::GetSystemColor(ColorId color_id) const { - // This implementation returns hardcoded colors. - SkColor color; - if (CommonThemeGetSystemColor(color_id, &color)) - return color; - - switch (color_id) { - // Windows - case kColorId_WindowBackground: - return kWindowBackgroundColor; - - // Dialogs - case kColorId_DialogBackground: - return kDialogBackgroundColor; - - // FocusableBorder - case kColorId_FocusedBorderColor: - return kFocusedBorderColor; - case kColorId_UnfocusedBorderColor: - return kUnfocusedBorderColor; - - // TextButton - case kColorId_TextButtonBackgroundColor: - return kTextButtonBackgroundColor; - case kColorId_TextButtonEnabledColor: - return kTextButtonEnabledColor; - case kColorId_TextButtonDisabledColor: - return kTextButtonDisabledColor; - case kColorId_TextButtonHighlightColor: - return kTextButtonHighlightColor; - case kColorId_TextButtonHoverColor: - return kTextButtonHoverColor; - - // MenuItem - case kColorId_EnabledMenuItemForegroundColor: - return kEnabledMenuItemForegroundColor; - case kColorId_DisabledMenuItemForegroundColor: - return kDisabledMenuItemForegroundColor; - case kColorId_SelectedMenuItemForegroundColor: - return kEnabledMenuItemForegroundColor; - case kColorId_FocusedMenuItemBackgroundColor: - return kFocusedMenuItemBackgroundColor; - case kColorId_HoverMenuItemBackgroundColor: - return kHoverMenuItemBackgroundColor; - case kColorId_MenuSeparatorColor: - return kMenuSeparatorColor; - case kColorId_EnabledMenuButtonBorderColor: - return kEnabledMenuButtonBorderColor; - case kColorId_FocusedMenuButtonBorderColor: - return kFocusedMenuButtonBorderColor; - case kColorId_HoverMenuButtonBorderColor: - return kHoverMenuButtonBorderColor; - - // Label - case kColorId_LabelEnabledColor: - return kLabelEnabledColor; - case kColorId_LabelDisabledColor: - return kLabelDisabledColor; - case kColorId_LabelBackgroundColor: - return kLabelBackgroundColor; - - // Textfield - case kColorId_TextfieldDefaultColor: - return kTextfieldDefaultColor; - case kColorId_TextfieldDefaultBackground: - return kTextfieldDefaultBackground; - case kColorId_TextfieldReadOnlyColor: - return kTextfieldReadOnlyColor; - case kColorId_TextfieldReadOnlyBackground: - return kTextfieldReadOnlyBackground; - case kColorId_TextfieldSelectionColor: - return kTextfieldSelectionColor; - case kColorId_TextfieldSelectionBackgroundFocused: - return kTextfieldSelectionBackgroundFocused; - case kColorId_TextfieldSelectionBackgroundUnfocused: - return kTextfieldSelectionBackgroundUnfocused; - - // Tree - case kColorId_TreeBackground: - return kTreeBackground; - case kColorId_TreeText: - return kTreeTextColor; - case kColorId_TreeSelectedText: - case kColorId_TreeSelectedTextUnfocused: - return kTreeSelectedTextColor; - case kColorId_TreeSelectionBackgroundFocused: - case kColorId_TreeSelectionBackgroundUnfocused: - return kTreeSelectionBackgroundColor; - case kColorId_TreeArrow: - return kTreeArrowColor; - - // Table - case kColorId_TableBackground: - return kTableBackground; - case kColorId_TableText: - return kTableTextColor; - case kColorId_TableSelectedText: - case kColorId_TableSelectedTextUnfocused: - return kTableSelectedTextColor; - case kColorId_TableSelectionBackgroundFocused: - case kColorId_TableSelectionBackgroundUnfocused: - return kTableSelectionBackgroundColor; - case kColorId_TableGroupingIndicatorColor: - return kTableGroupingIndicatorColor; - - case kColorId_MenuBackgroundColor: - return kMenuBackgroundColor; - case kColorId_MenuBorderColor: - NOTREACHED(); - break; - } - - return kInvalidColorIdColor; -} - -} // namespace ui diff --git a/ui/native_theme/fallback_theme.h b/ui/native_theme/fallback_theme.h deleted file mode 100644 index a20b326e..0000000 --- a/ui/native_theme/fallback_theme.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_NATIVE_THEME_FALLBACK_THEME_H_ -#define UI_NATIVE_THEME_FALLBACK_THEME_H_ - -#include "ui/native_theme/native_theme_base.h" - -namespace ui { - -// This theme can draw UI controls on every platform. This is only used when -// zooming a web page and the native theme doesn't support scaling. -class NATIVE_THEME_EXPORT FallbackTheme : public NativeThemeBase { - public: - static FallbackTheme* instance(); - - protected: - FallbackTheme(); - virtual ~FallbackTheme(); - - private: - // Overridden from NativeThemeBase: - virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; - - DISALLOW_COPY_AND_ASSIGN(FallbackTheme); -}; - -} // namespace ui - -#endif // UI_NATIVE_THEME_FALLBACK_THEME_H_ diff --git a/ui/native_theme/native_theme.gyp b/ui/native_theme/native_theme.gyp index 671f286..70d27a3 100644 --- a/ui/native_theme/native_theme.gyp +++ b/ui/native_theme/native_theme.gyp @@ -23,8 +23,6 @@ 'sources': [ 'common_theme.cc', 'common_theme.h', - 'fallback_theme.cc', - 'fallback_theme.h', 'native_theme.cc', 'native_theme.h', 'native_theme_android.cc', diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc index 6cbc255..3e597b5 100644 --- a/ui/native_theme/native_theme_aura.cc +++ b/ui/native_theme/native_theme_aura.cc @@ -19,6 +19,59 @@ namespace { const SkColor kMenuBackgroundColor = SK_ColorWHITE; +// Theme colors returned by GetSystemColor(). +const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); +// Windows: +const SkColor kWindowBackgroundColor = SK_ColorWHITE; +// Dialogs: +const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); +// FocusableBorder: +const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); +const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); +// TextButton: +const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xDE, 0xDE, 0xDE); +const SkColor kTextButtonEnabledColor = SkColorSetRGB(0x22, 0x22, 0x22); +const SkColor kTextButtonDisabledColor = SkColorSetRGB(0x99, 0x99, 0x99); +const SkColor kTextButtonHighlightColor = SkColorSetRGB(0, 0, 0); +const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; +// MenuItem: +const SkColor kEnabledMenuItemForegroundColor = kTextButtonEnabledColor; +const SkColor kDisabledMenuItemForegroundColor = kTextButtonDisabledColor; +const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(0xF1, 0xF1, 0xF1); +const SkColor kHoverMenuItemBackgroundColor = + SkColorSetARGB(204, 255, 255, 255); +const SkColor kMenuSeparatorColor = SkColorSetRGB(0xED, 0xED, 0xED); +const SkColor kEnabledMenuButtonBorderColor = SkColorSetARGB(36, 0, 0, 0); +const SkColor kFocusedMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); +const SkColor kHoverMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); +// Label: +const SkColor kLabelEnabledColor = kTextButtonEnabledColor; +const SkColor kLabelDisabledColor = kTextButtonDisabledColor; +const SkColor kLabelBackgroundColor = SK_ColorWHITE; +// Textfield: +const SkColor kTextfieldDefaultColor = SK_ColorBLACK; +const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; +const SkColor kTextfieldReadOnlyColor = SK_ColorDKGRAY; +const SkColor kTextfieldReadOnlyBackground = SK_ColorWHITE; +const SkColor kTextfieldSelectionBackgroundFocused = + SkColorSetARGB(0x54, 0x60, 0xA8, 0xEB); +const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; +const SkColor kTextfieldSelectionColor = + color_utils::AlphaBlend(SK_ColorBLACK, + kTextfieldSelectionBackgroundFocused, 0xdd); +// Tree +const SkColor kTreeBackground = SK_ColorWHITE; +const SkColor kTreeTextColor = SK_ColorBLACK; +const SkColor kTreeSelectedTextColor = SK_ColorBLACK; +const SkColor kTreeSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); +const SkColor kTreeArrowColor = SkColorSetRGB(0x7A, 0x7A, 0x7A); +// Table +const SkColor kTableBackground = SK_ColorWHITE; +const SkColor kTableTextColor = SK_ColorBLACK; +const SkColor kTableSelectedTextColor = SK_ColorBLACK; +const SkColor kTableSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); +const SkColor kTableGroupingIndicatorColor = SkColorSetRGB(0xCC, 0xCC, 0xCC); + } // namespace namespace ui { @@ -42,6 +95,121 @@ NativeThemeAura::NativeThemeAura() { NativeThemeAura::~NativeThemeAura() { } +SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const { + // This implementation returns hardcoded colors. + SkColor color; + if (CommonThemeGetSystemColor(color_id, &color)) + return color; + + switch (color_id) { + // Windows + case kColorId_WindowBackground: + return kWindowBackgroundColor; + + // Dialogs + case kColorId_DialogBackground: + return kDialogBackgroundColor; + + // FocusableBorder + case kColorId_FocusedBorderColor: + return kFocusedBorderColor; + case kColorId_UnfocusedBorderColor: + return kUnfocusedBorderColor; + + // TextButton + case kColorId_TextButtonBackgroundColor: + return kTextButtonBackgroundColor; + case kColorId_TextButtonEnabledColor: + return kTextButtonEnabledColor; + case kColorId_TextButtonDisabledColor: + return kTextButtonDisabledColor; + case kColorId_TextButtonHighlightColor: + return kTextButtonHighlightColor; + case kColorId_TextButtonHoverColor: + return kTextButtonHoverColor; + + // MenuItem + case kColorId_EnabledMenuItemForegroundColor: + return kEnabledMenuItemForegroundColor; + case kColorId_DisabledMenuItemForegroundColor: + return kDisabledMenuItemForegroundColor; + case kColorId_SelectedMenuItemForegroundColor: + return kEnabledMenuItemForegroundColor; + case kColorId_FocusedMenuItemBackgroundColor: + return kFocusedMenuItemBackgroundColor; + case kColorId_HoverMenuItemBackgroundColor: + return kHoverMenuItemBackgroundColor; + case kColorId_MenuSeparatorColor: + return kMenuSeparatorColor; + case kColorId_EnabledMenuButtonBorderColor: + return kEnabledMenuButtonBorderColor; + case kColorId_FocusedMenuButtonBorderColor: + return kFocusedMenuButtonBorderColor; + case kColorId_HoverMenuButtonBorderColor: + return kHoverMenuButtonBorderColor; + + // Label + case kColorId_LabelEnabledColor: + return kLabelEnabledColor; + case kColorId_LabelDisabledColor: + return kLabelDisabledColor; + case kColorId_LabelBackgroundColor: + return kLabelBackgroundColor; + + // Textfield + case kColorId_TextfieldDefaultColor: + return kTextfieldDefaultColor; + case kColorId_TextfieldDefaultBackground: + return kTextfieldDefaultBackground; + case kColorId_TextfieldReadOnlyColor: + return kTextfieldReadOnlyColor; + case kColorId_TextfieldReadOnlyBackground: + return kTextfieldReadOnlyBackground; + case kColorId_TextfieldSelectionColor: + return kTextfieldSelectionColor; + case kColorId_TextfieldSelectionBackgroundFocused: + return kTextfieldSelectionBackgroundFocused; + case kColorId_TextfieldSelectionBackgroundUnfocused: + return kTextfieldSelectionBackgroundUnfocused; + + // Tree + case kColorId_TreeBackground: + return kTreeBackground; + case kColorId_TreeText: + return kTreeTextColor; + case kColorId_TreeSelectedText: + case kColorId_TreeSelectedTextUnfocused: + return kTreeSelectedTextColor; + case kColorId_TreeSelectionBackgroundFocused: + case kColorId_TreeSelectionBackgroundUnfocused: + return kTreeSelectionBackgroundColor; + case kColorId_TreeArrow: + return kTreeArrowColor; + + // Table + case kColorId_TableBackground: + return kTableBackground; + case kColorId_TableText: + return kTableTextColor; + case kColorId_TableSelectedText: + case kColorId_TableSelectedTextUnfocused: + return kTableSelectedTextColor; + case kColorId_TableSelectionBackgroundFocused: + case kColorId_TableSelectionBackgroundUnfocused: + return kTableSelectionBackgroundColor; + case kColorId_TableGroupingIndicatorColor: + return kTableGroupingIndicatorColor; + + case kColorId_MenuBackgroundColor: + return kMenuBackgroundColor; + case kColorId_MenuBorderColor: + NOTREACHED(); + break; + } + + return kInvalidColorIdColor; +} + void NativeThemeAura::PaintMenuPopupBackground( SkCanvas* canvas, const gfx::Size& size, diff --git a/ui/native_theme/native_theme_aura.h b/ui/native_theme/native_theme_aura.h index b3417b3..51ebd38 100644 --- a/ui/native_theme/native_theme_aura.h +++ b/ui/native_theme/native_theme_aura.h @@ -7,12 +7,12 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "ui/native_theme/fallback_theme.h" +#include "ui/native_theme/native_theme_base.h" namespace ui { // Aura implementation of native theme support. -class NATIVE_THEME_EXPORT NativeThemeAura : public FallbackTheme { +class NATIVE_THEME_EXPORT NativeThemeAura : public NativeThemeBase { public: static NativeThemeAura* instance(); @@ -21,6 +21,7 @@ class NATIVE_THEME_EXPORT NativeThemeAura : public FallbackTheme { virtual ~NativeThemeAura(); // Overridden from NativeThemeBase: + virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; virtual void PaintMenuPopupBackground( SkCanvas* canvas, const gfx::Size& size, |