summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/port/bindings/v8/RGBColor.cpp26
-rw-r--r--webkit/port/bindings/v8/RGBColor.h18
2 files changed, 28 insertions, 16 deletions
diff --git a/webkit/port/bindings/v8/RGBColor.cpp b/webkit/port/bindings/v8/RGBColor.cpp
index 4a37ea6..fbeff38 100644
--- a/webkit/port/bindings/v8/RGBColor.cpp
+++ b/webkit/port/bindings/v8/RGBColor.cpp
@@ -31,19 +31,27 @@
namespace WebCore {
-PassRefPtr<CSSPrimitiveValue> RGBColor::red() {
- unsigned int value = (m_rgbcolor >> 16) & 0xFF;
- return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+PassRefPtr<RGBColor> RGBColor::create(unsigned rgbcolor)
+{
+ return adoptRef(new RGBColor(rgbcolor));
}
-PassRefPtr<CSSPrimitiveValue> RGBColor::green() {
- unsigned int value = (m_rgbcolor >> 8) & 0xFF;
- return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+PassRefPtr<CSSPrimitiveValue> RGBColor::red()
+{
+ unsigned int value = (m_rgbcolor >> 16) & 0xFF;
+ return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
}
-PassRefPtr<CSSPrimitiveValue> RGBColor::blue() {
- unsigned int value = m_rgbcolor & 0xFF;
- return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+PassRefPtr<CSSPrimitiveValue> RGBColor::green()
+{
+ unsigned int value = (m_rgbcolor >> 8) & 0xFF;
+ return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+PassRefPtr<CSSPrimitiveValue> RGBColor::blue()
+{
+ unsigned int value = m_rgbcolor & 0xFF;
+ return CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
}
} // namespace WebCore
diff --git a/webkit/port/bindings/v8/RGBColor.h b/webkit/port/bindings/v8/RGBColor.h
index afc0500..c96edfd 100644
--- a/webkit/port/bindings/v8/RGBColor.h
+++ b/webkit/port/bindings/v8/RGBColor.h
@@ -12,15 +12,19 @@
namespace WebCore {
class RGBColor : public RefCounted<RGBColor> {
- public:
- RGBColor(unsigned rgbcolor) : m_rgbcolor(rgbcolor) { }
+public:
+ // TODO(ager): Make constructor private once codegenerator changes
+ // have landed upstream.
+ RGBColor(unsigned rgbcolor) : m_rgbcolor(rgbcolor) { }
- PassRefPtr<CSSPrimitiveValue> red();
- PassRefPtr<CSSPrimitiveValue> green();
- PassRefPtr<CSSPrimitiveValue> blue();
+ static PassRefPtr<RGBColor> create(unsigned rgbcolor);
- private:
- unsigned m_rgbcolor;
+ PassRefPtr<CSSPrimitiveValue> red();
+ PassRefPtr<CSSPrimitiveValue> green();
+ PassRefPtr<CSSPrimitiveValue> blue();
+
+private:
+ unsigned m_rgbcolor;
};
} // namespace WebCore