summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:09:55 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:09:55 +0000
commitb9ab10cd0c07c9c4bc5c9f09742c3ee8e03ab7a3 (patch)
treecfa98ae941be636ec692f3ac15ebf82aa0885d99 /chrome/renderer
parentf290f3e46ee27cf48b9b6dbc0f35c0d8af6d0c00 (diff)
downloadchromium_src-b9ab10cd0c07c9c4bc5c9f09742c3ee8e03ab7a3.zip
chromium_src-b9ab10cd0c07c9c4bc5c9f09742c3ee8e03ab7a3.tar.gz
chromium_src-b9ab10cd0c07c9c4bc5c9f09742c3ee8e03ab7a3.tar.bz2
Add CSS Keyword values and conversion routines to webkit glue.
Review URL: http://codereview.chromium.org/149044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_thread.cc23
-rw-r--r--chrome/renderer/render_thread.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 46711d4..3571f6d 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -40,6 +40,7 @@
#include "chrome/renderer/render_view.h"
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "chrome/renderer/user_script_slave.h"
+#include "webkit/api/public/WebColor.h"
#include "webkit/api/public/WebCache.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebString.h"
@@ -211,6 +212,7 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks)
IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks)
IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID)
+ IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors)
// TODO(port): removed from render_messages_internal.h;
// is there a new non-windows message I should add here?
IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView)
@@ -240,6 +242,27 @@ void RenderThread::OnSetNextPageID(int32 next_page_id) {
RenderView::SetNextPageID(next_page_id);
}
+// Called when to register CSS Color name->system color mappings.
+// We update the colors one by one and then tell WebKit to refresh all render
+// views.
+void RenderThread::OnSetCSSColors(
+ const std::vector<CSSColors::CSSColorMapping>& colors) {
+
+ size_t num_colors = colors.size();
+ scoped_array<WebKit::WebColorName> color_names(
+ new WebKit::WebColorName[num_colors]);
+ scoped_array<WebKit::WebColor> web_colors(new WebKit::WebColor[num_colors]);
+ size_t i = 0;
+ for (std::vector<CSSColors::CSSColorMapping>::const_iterator it =
+ colors.begin();
+ it != colors.end();
+ ++it, ++i) {
+ color_names[i] = it->first;
+ web_colors[i] = it->second;
+ }
+ WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors);
+}
+
void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd,
ModalDialogEvent modal_dialog_event,
const RendererPreferences& renderer_prefs,
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index c242c61..d9cd1fb 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -13,6 +13,7 @@
#include "base/task.h"
#include "build/build_config.h"
#include "chrome/common/child_thread.h"
+#include "chrome/common/css_colors.h"
#include "chrome/renderer/renderer_histogram_snapshots.h"
#include "chrome/renderer/visitedlink_slave.h"
@@ -126,6 +127,7 @@ class RenderThread : public RenderThreadBase,
void OnPageActionsUpdated(const std::string& extension_id,
const std::vector<std::string>& page_actions);
void OnSetNextPageID(int32 next_page_id);
+ void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors);
void OnCreateNewView(gfx::NativeViewId parent_hwnd,
ModalDialogEvent modal_dialog_event,
const RendererPreferences& renderer_prefs,