summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGColor.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:52 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:52 -0800
commit8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (patch)
tree11425ea0b299d6fb89c6d3618a22d97d5bf68d0f /WebCore/svg/SVGColor.h
parent648161bb0edfc3d43db63caed5cc5213bc6cb78f (diff)
downloadexternal_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.zip
external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.gz
external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/svg/SVGColor.h')
-rw-r--r--WebCore/svg/SVGColor.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h
new file mode 100644
index 0000000..e3a4b19
--- /dev/null
+++ b/WebCore/svg/SVGColor.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SVGColor_h
+#define SVGColor_h
+#if ENABLE(SVG)
+
+#include "CSSValue.h"
+#include "Color.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class SVGColor : public CSSValue {
+ public:
+ static PassRefPtr<SVGColor> create(const String& color)
+ {
+ return adoptRef(new SVGColor(color));
+ }
+ static PassRefPtr<SVGColor> create(const Color& color)
+ {
+ return adoptRef(new SVGColor(color));
+ }
+ static PassRefPtr<SVGColor> createCurrentColor()
+ {
+ return adoptRef(new SVGColor(SVG_COLORTYPE_CURRENTCOLOR));
+ }
+
+ virtual ~SVGColor();
+
+ enum SVGColorType {
+ SVG_COLORTYPE_UNKNOWN = 0,
+ SVG_COLORTYPE_RGBCOLOR = 1,
+ SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2,
+ SVG_COLORTYPE_CURRENTCOLOR = 3
+ };
+
+ // 'SVGColor' functions
+ unsigned short colorType() const;
+
+ unsigned rgbColor() const;
+
+ static Color colorFromRGBColorString(const String&);
+
+ void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); }
+ void setRGBColor(const String& rgbColor, ExceptionCode&);
+ void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionCode&);
+ void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionCode&);
+
+ virtual String cssText() const;
+
+ // Helpers
+ const Color& color() const;
+
+ protected:
+ SVGColor();
+ SVGColor(const String& color);
+ SVGColor(const Color&);
+
+ private:
+ SVGColor(SVGColorType);
+
+ static void create(int); // compile-time guard
+
+ virtual bool isSVGColor() const { return true; }
+
+ Color m_color;
+ unsigned short m_colorType;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGColor_h
+
+// vim:ts=4:noet