summaryrefslogtreecommitdiffstats
path: root/webkit
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 /webkit
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 'webkit')
-rw-r--r--webkit/api/public/WebColor.h6
-rw-r--r--webkit/api/public/WebColorName.h71
-rw-r--r--webkit/api/src/WebColor.cpp156
-rw-r--r--webkit/webkit.gyp2
4 files changed, 235 insertions, 0 deletions
diff --git a/webkit/api/public/WebColor.h b/webkit/api/public/WebColor.h
index 2f77c76..8469520 100644
--- a/webkit/api/public/WebColor.h
+++ b/webkit/api/public/WebColor.h
@@ -31,10 +31,16 @@
#ifndef WebColor_h
#define WebColor_h
+#include "WebCommon.h"
+#include "WebColorName.h"
+
namespace WebKit {
typedef unsigned WebColor; // RGBA quad
+ // Sets the values of a set of named colors.
+ WEBKIT_API void setNamedColors(const WebColorName*, const WebColor*, size_t length);
+
} // namespace WebKit
#endif
diff --git a/webkit/api/public/WebColorName.h b/webkit/api/public/WebColorName.h
new file mode 100644
index 0000000..0a302dd
--- /dev/null
+++ b/webkit/api/public/WebColorName.h
@@ -0,0 +1,71 @@
+/*
+* 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
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+* * 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
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef WebColorName_h
+#define WebColorName_h
+
+namespace WebKit {
+
+ enum WebColorName {
+ WebColorActiveBorder,
+ WebColorActiveCaption,
+ WebColorAppworkspace,
+ WebColorBackground,
+ WebColorButtonFace,
+ WebColorButtonHighlight,
+ WebColorButtonShadow,
+ WebColorButtonText,
+ WebColorCaptionText,
+ WebColorGrayText,
+ WebColorHighlight,
+ WebColorHighlightText,
+ WebColorInactiveBorder,
+ WebColorInactiveCaption,
+ WebColorInactiveCaptionText,
+ WebColorInfoBackground,
+ WebColorInfoText,
+ WebColorMenu,
+ WebColorMenuText,
+ WebColorScrollbar,
+ WebColorText,
+ WebColorThreedDarkShadow,
+ WebColorThreedShadow,
+ WebColorThreedFace,
+ WebColorThreedHighlight,
+ WebColorThreedLightShadow,
+ WebColorWebkitFocusRingColor,
+ WebColorWindow,
+ WebColorWindowFrame,
+ WebColorWindowText
+ };
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/src/WebColor.cpp b/webkit/api/src/WebColor.cpp
new file mode 100644
index 0000000..72655a5
--- /dev/null
+++ b/webkit/api/src/WebColor.cpp
@@ -0,0 +1,156 @@
+/*
+ * 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
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * 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
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebColor.h"
+
+#include "CSSValueKeywords.h"
+#include "UnusedParam.h"
+#include "WebColorName.h"
+
+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;
+ }
+}
+
+void setNamedColors(const WebColorName* colorNames, const WebColor* colors, size_t length)
+{
+ for (size_t i = 0; i < length; ++i) {
+ WebColorName colorName = colorNames[i];
+ WebColor color = colors[i];
+
+ // Convert color to internal value identifier.
+ int internalColorName = toCSSValueKeyword(colorName);
+
+ // 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.
+}
+
+} // namespace webkit_glue
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index a8f2774..b81eb13 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -979,6 +979,7 @@
'api/public/WebCanvas.h',
'api/public/WebClipboard.h',
'api/public/WebColor.h',
+ 'api/public/WebColorName.h',
'api/public/WebCommon.h',
'api/public/WebCompositionCommand.h',
'api/public/WebConsoleMessage.h',
@@ -1053,6 +1054,7 @@
'api/src/TemporaryGlue.h',
'api/src/WebBindings.cpp',
'api/src/WebCache.cpp',
+ 'api/src/WebColor.cpp',
'api/src/WebCString.cpp',
'api/src/WebCursorInfo.cpp',
'api/src/WebData.cpp',