diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:08:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:08:41 +0000 |
commit | 1c83eb444727c703709f7deea88e51f8da2e504e (patch) | |
tree | 4c7153390bc1fafd217eff84d113f5ff1ae102f2 /webkit | |
parent | 303bdcbbda3d59a6fb2c475a98a1ce4793ab1817 (diff) | |
download | chromium_src-1c83eb444727c703709f7deea88e51f8da2e504e.zip chromium_src-1c83eb444727c703709f7deea88e51f8da2e504e.tar.gz chromium_src-1c83eb444727c703709f7deea88e51f8da2e504e.tar.bz2 |
Linux focus ring color: Go through WebKit::WebColor api rather than through the webview.
Also use SkColor isntead of a triplet of colors in RenderPreferences.
BUG=21521
Review URL: http://codereview.chromium.org/195059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/api/public/WebColor.h | 8 | ||||
-rw-r--r-- | webkit/api/src/WebColor.cpp | 176 | ||||
-rw-r--r-- | webkit/glue/webview.h | 4 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 3 |
5 files changed, 82 insertions, 118 deletions
diff --git a/webkit/api/public/WebColor.h b/webkit/api/public/WebColor.h index 8469520..64fbcbd 100644 --- a/webkit/api/public/WebColor.h +++ b/webkit/api/public/WebColor.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -36,7 +36,7 @@ namespace WebKit { - typedef unsigned WebColor; // RGBA quad + typedef unsigned WebColor; // RGBA quad. Equivalent to SkColor. // Sets the values of a set of named colors. WEBKIT_API void setNamedColors(const WebColorName*, const WebColor*, size_t length); diff --git a/webkit/api/src/WebColor.cpp b/webkit/api/src/WebColor.cpp index 72655a5..f2b6643 100644 --- a/webkit/api/src/WebColor.cpp +++ b/webkit/api/src/WebColor.cpp @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -28,110 +28,84 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebColor.h" +#include "Color.h" #include "CSSValueKeywords.h" +#include "RenderTheme.h" #include "UnusedParam.h" #include "WebColorName.h" +using namespace::WebCore; + namespace WebKit { static int toCSSValueKeyword(WebColorName in_value) { switch (in_value) { - case WebColorActiveBorder: - return CSSValueActiveborder; - break; - case WebColorActiveCaption: - return CSSValueActivecaption; - break; - case WebColorAppworkspace: - return CSSValueAppworkspace; - break; - case WebColorBackground: - return CSSValueBackground; - break; - case WebColorButtonFace: - return CSSValueButtonface; - break; - case WebColorButtonHighlight: - return CSSValueButtonhighlight; - break; - case WebColorButtonShadow: - return CSSValueButtonshadow; - break; - case WebColorButtonText: - return CSSValueButtontext; - break; - case WebColorCaptionText: - return CSSValueCaptiontext; - break; - case WebColorGrayText: - return CSSValueGraytext; - break; - case WebColorHighlight: - return CSSValueHighlight; - break; - case WebColorHighlightText: - return CSSValueHighlighttext; - break; - case WebColorInactiveBorder: - return CSSValueInactiveborder; - break; - case WebColorInactiveCaption: - return CSSValueInactivecaption; - break; - case WebColorInactiveCaptionText: - return CSSValueInactivecaptiontext; - break; - case WebColorInfoBackground: - return CSSValueInfobackground; - break; - case WebColorInfoText: - return CSSValueInfotext; - break; - case WebColorMenu: - return CSSValueMenu; - break; - case WebColorMenuText: - return CSSValueMenutext; - break; - case WebColorScrollbar: - return CSSValueScrollbar; - break; - case WebColorText: - return CSSValueText; - break; - case WebColorThreedDarkShadow: - return CSSValueThreeddarkshadow; - break; - case WebColorThreedShadow: - return CSSValueThreedshadow; - break; - case WebColorThreedFace: - return CSSValueThreedface; - break; - case WebColorThreedHighlight: - return CSSValueThreedhighlight; - break; - case WebColorThreedLightShadow: - return CSSValueThreedlightshadow; - break; - case WebColorWebkitFocusRingColor: - return CSSValueWebkitFocusRingColor; - break; - case WebColorWindow: - return CSSValueWindow; - break; - case WebColorWindowFrame: - return CSSValueWindowframe; - break; - case WebColorWindowText: - return CSSValueWindowtext; - break; - default: - return CSSValueInvalid; - break; + case WebColorActiveBorder: + return CSSValueActiveborder; + case WebColorActiveCaption: + return CSSValueActivecaption; + case WebColorAppworkspace: + return CSSValueAppworkspace; + case WebColorBackground: + return CSSValueBackground; + case WebColorButtonFace: + return CSSValueButtonface; + case WebColorButtonHighlight: + return CSSValueButtonhighlight; + case WebColorButtonShadow: + return CSSValueButtonshadow; + case WebColorButtonText: + return CSSValueButtontext; + case WebColorCaptionText: + return CSSValueCaptiontext; + case WebColorGrayText: + return CSSValueGraytext; + case WebColorHighlight: + return CSSValueHighlight; + case WebColorHighlightText: + return CSSValueHighlighttext; + case WebColorInactiveBorder: + return CSSValueInactiveborder; + case WebColorInactiveCaption: + return CSSValueInactivecaption; + case WebColorInactiveCaptionText: + return CSSValueInactivecaptiontext; + case WebColorInfoBackground: + return CSSValueInfobackground; + case WebColorInfoText: + return CSSValueInfotext; + case WebColorMenu: + return CSSValueMenu; + case WebColorMenuText: + return CSSValueMenutext; + case WebColorScrollbar: + return CSSValueScrollbar; + case WebColorText: + return CSSValueText; + case WebColorThreedDarkShadow: + return CSSValueThreeddarkshadow; + case WebColorThreedShadow: + return CSSValueThreedshadow; + case WebColorThreedFace: + return CSSValueThreedface; + case WebColorThreedHighlight: + return CSSValueThreedhighlight; + case WebColorThreedLightShadow: + return CSSValueThreedlightshadow; + case WebColorWebkitFocusRingColor: + return CSSValueWebkitFocusRingColor; + case WebColorWindow: + return CSSValueWindow; + case WebColorWindowFrame: + return CSSValueWindowframe; + case WebColorWindowText: + return CSSValueWindowtext; + default: + return CSSValueInvalid; } } @@ -143,13 +117,19 @@ void setNamedColors(const WebColorName* colorNames, const WebColor* colors, size // Convert color to internal value identifier. int internalColorName = toCSSValueKeyword(colorName); - + + if (internalColorName == CSSValueWebkitFocusRingColor) + { + RenderTheme::setCustomFocusRingColor(color); + continue; + } + // TODO(jeremy): Set Color in RenderTheme. UNUSED_PARAM(internalColorName); // Suppress compiler warnings for now. UNUSED_PARAM(colorName); UNUSED_PARAM(color); } - + // TODO(jeremy): Tell RenderTheme to update colors. } diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 6e58180..86f2d28 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -260,10 +260,6 @@ class WebView : public WebKit::WebWidget { // Gets the WebView's active state (i.e., state of control tints). virtual bool IsActive() = 0; -#if defined(OS_LINUX) - virtual void SetThemeFocusRingColor(int r, int g, int b) = 0; -#endif - private: DISALLOW_COPY_AND_ASSIGN(WebView); }; diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 2ff98d2..a58b0c3 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -45,8 +45,6 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "PopupMenuClient.h" #if defined(OS_WIN) #include "RenderThemeChromiumWin.h" -#elif defined(OS_LINUX) -#include "RenderThemeChromiumLinux.h" #else #include "RenderTheme.h" #endif @@ -1802,13 +1800,6 @@ bool WebViewImpl::IsActive() { : false; } -#if defined(OS_LINUX) -void WebViewImpl::SetThemeFocusRingColor(int r, int g, int b) { - reinterpret_cast<RenderThemeChromiumLinux*>(theme())-> - setFocusRingColor(Color(r, g, b)); -} -#endif - void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { if (is_new_navigation) *is_new_navigation = observed_new_navigation_; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 611f914..f81e9dd 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -153,9 +153,6 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual void SetActive(bool active); virtual bool IsActive(); -#if defined(OS_LINUX) - virtual void SetThemeFocusRingColor(int r, int g, int b); -#endif // WebViewImpl |