[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 12:17:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fa09fd151a0d0d6cf0f8c477182b767c80ce5f52
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 17:28:11 2010 +0000

    2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Darin Adler.
    
            CanvasStyle method naming cleanup
            https://bugs.webkit.org/show_bug.cgi?id=44184
    
            Renamed the various create() overloads to reflect what they're
            constructing the CanvasStyle from.
    
            The unused CanvasStyle::create(grayLevel) and accompanying constructor
            were removed.
    
            Also renamed the isEquivalentColor overloads to isEquivalent{RGBA,CMYKA}
    
            * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
            (WebCore::toHTMLCanvasStyle):
            * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
            (WebCore::toCanvasStyle):
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::State::State):
            (WebCore::CanvasRenderingContext2D::setStrokeColor):
            (WebCore::CanvasRenderingContext2D::setFillColor):
            * html/canvas/CanvasStyle.cpp:
            (WebCore::CanvasStyle::createFromString):
            (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
            (WebCore::CanvasStyle::createFromGradient):
            (WebCore::CanvasStyle::createFromPattern):
            (WebCore::CanvasStyle::isEquivalentRGBA):
            (WebCore::CanvasStyle::isEquivalentCMYKA):
            * html/canvas/CanvasStyle.h:
            (WebCore::CanvasStyle::createFromRGBA):
            (WebCore::CanvasStyle::createFromGrayLevelWithAlpha):
            (WebCore::CanvasStyle::createFromRGBAChannels):
            (WebCore::CanvasStyle::createFromCMYKAChannels):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65613 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1dacf00..a107c10 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,39 @@
+2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Darin Adler.
+
+        CanvasStyle method naming cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=44184
+
+        Renamed the various create() overloads to reflect what they're
+        constructing the CanvasStyle from.
+
+        The unused CanvasStyle::create(grayLevel) and accompanying constructor
+        were removed.
+
+        Also renamed the isEquivalentColor overloads to isEquivalent{RGBA,CMYKA}
+
+        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+        (WebCore::toHTMLCanvasStyle):
+        * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+        (WebCore::toCanvasStyle):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::State::State):
+        (WebCore::CanvasRenderingContext2D::setStrokeColor):
+        (WebCore::CanvasRenderingContext2D::setFillColor):
+        * html/canvas/CanvasStyle.cpp:
+        (WebCore::CanvasStyle::createFromString):
+        (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
+        (WebCore::CanvasStyle::createFromGradient):
+        (WebCore::CanvasStyle::createFromPattern):
+        (WebCore::CanvasStyle::isEquivalentRGBA):
+        (WebCore::CanvasStyle::isEquivalentCMYKA):
+        * html/canvas/CanvasStyle.h:
+        (WebCore::CanvasStyle::createFromRGBA):
+        (WebCore::CanvasStyle::createFromGrayLevelWithAlpha):
+        (WebCore::CanvasStyle::createFromRGBAChannels):
+        (WebCore::CanvasStyle::createFromCMYKAChannels):
+
 2010-08-18  Girish Ramakrishnan  <girish at forwardbias.in>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
index 8221fed..532b38b 100644
--- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
@@ -57,9 +57,9 @@ static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState*, JSValue value)
         return 0;
     JSObject* object = asObject(value);
     if (object->inherits(&JSCanvasGradient::s_info))
-        return CanvasStyle::create(static_cast<JSCanvasGradient*>(object)->impl());
+        return CanvasStyle::createFromGradient(static_cast<JSCanvasGradient*>(object)->impl());
     if (object->inherits(&JSCanvasPattern::s_info))
-        return CanvasStyle::create(static_cast<JSCanvasPattern*>(object)->impl());
+        return CanvasStyle::createFromPattern(static_cast<JSCanvasPattern*>(object)->impl());
     return 0;
 }
 
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 26fc626..3491170 100644
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -63,13 +63,13 @@ static v8::Handle<v8::Value> toV8Object(CanvasStyle* style)
 static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value)
 {
     if (value->IsString())
-        return CanvasStyle::create(toWebCoreString(value));
+        return CanvasStyle::createFromString(toWebCoreString(value));
 
     if (V8CanvasGradient::HasInstance(value))
-        return CanvasStyle::create(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value)));
+        return CanvasStyle::createFromGradient(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value)));
 
     if (V8CanvasPattern::HasInstance(value))
-        return CanvasStyle::create(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value)));
+        return CanvasStyle::createFromPattern(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value)));
 
     return 0;
 }
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 5ff9a72..58ec1d0 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -167,8 +167,8 @@ void CanvasRenderingContext2D::reset()
 }
 
 CanvasRenderingContext2D::State::State()
-    : m_strokeStyle(CanvasStyle::create(Color::black))
-    , m_fillStyle(CanvasStyle::create(Color::black))
+    : m_strokeStyle(CanvasStyle::createFromRGBA(Color::black))
+    , m_fillStyle(CanvasStyle::createFromRGBA(Color::black))
     , m_lineWidth(1)
     , m_lineCap(ButtCap)
     , m_lineJoin(MiterJoin)
@@ -550,82 +550,82 @@ void CanvasRenderingContext2D::setStrokeColor(const String& color)
 {
     if (color == state().m_unparsedStrokeColor)
         return;
-    setStrokeStyle(CanvasStyle::create(color));
+    setStrokeStyle(CanvasStyle::createFromString(color));
     state().m_unparsedStrokeColor = color;
 }
 
 void CanvasRenderingContext2D::setStrokeColor(float grayLevel)
 {
-    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f))
+    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f))
         return;
-    setStrokeStyle(CanvasStyle::create(grayLevel, 1));
+    setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f));
 }
 
 void CanvasRenderingContext2D::setStrokeColor(const String& color, float alpha)
 {
-    setStrokeStyle(CanvasStyle::create(color, alpha));
+    setStrokeStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha));
 }
 
 void CanvasRenderingContext2D::setStrokeColor(float grayLevel, float alpha)
 {
-    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha))
+    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, alpha))
         return;
-    setStrokeStyle(CanvasStyle::create(grayLevel, alpha));
+    setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, alpha));
 }
 
 void CanvasRenderingContext2D::setStrokeColor(float r, float g, float b, float a)
 {
-    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(r, g, b, a))
+    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(r, g, b, a))
         return;
-    setStrokeStyle(CanvasStyle::create(r, g, b, a));
+    setStrokeStyle(CanvasStyle::createFromRGBAChannels(r, g, b, a));
 }
 
 void CanvasRenderingContext2D::setStrokeColor(float c, float m, float y, float k, float a)
 {
-    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(c, m, y, k, a))
+    if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentCMYKA(c, m, y, k, a))
         return;
-    setStrokeStyle(CanvasStyle::create(c, m, y, k, a));
+    setStrokeStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a));
 }
 
 void CanvasRenderingContext2D::setFillColor(const String& color)
 {
     if (color == state().m_unparsedFillColor)
         return;
-    setFillStyle(CanvasStyle::create(color));
+    setFillStyle(CanvasStyle::createFromString(color));
     state().m_unparsedFillColor = color;
 }
 
 void CanvasRenderingContext2D::setFillColor(float grayLevel)
 {
-    if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f))
+    if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f))
         return;
-    setFillStyle(CanvasStyle::create(grayLevel, 1));
+    setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f));
 }
 
 void CanvasRenderingContext2D::setFillColor(const String& color, float alpha)
 {
-    setFillStyle(CanvasStyle::create(color, alpha));
+    setFillStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha));
 }
 
 void CanvasRenderingContext2D::setFillColor(float grayLevel, float alpha)
 {
-    if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha))
+    if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, alpha))
         return;
-    setFillStyle(CanvasStyle::create(grayLevel, alpha));
+    setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, alpha));
 }
 
 void CanvasRenderingContext2D::setFillColor(float r, float g, float b, float a)
 {
-    if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(r, g, b, a))
+    if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(r, g, b, a))
         return;
-    setFillStyle(CanvasStyle::create(r, g, b, a));
+    setFillStyle(CanvasStyle::createFromRGBAChannels(r, g, b, a));
 }
 
 void CanvasRenderingContext2D::setFillColor(float c, float m, float y, float k, float a)
 {
-    if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(c, m, y, k, a))
+    if (state().m_fillStyle && state().m_fillStyle->isEquivalentCMYKA(c, m, y, k, a))
         return;
-    setFillStyle(CanvasStyle::create(c, m, y, k, a));
+    setFillStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a));
 }
 
 void CanvasRenderingContext2D::beginPath()
diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp
index 52b31c8..fd3c6e5 100644
--- a/WebCore/html/canvas/CanvasStyle.cpp
+++ b/WebCore/html/canvas/CanvasStyle.cpp
@@ -55,12 +55,6 @@ CanvasStyle::CanvasStyle(RGBA32 rgba)
 {
 }
 
-CanvasStyle::CanvasStyle(float grayLevel)
-    : m_type(RGBA)
-    , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f))
-{
-}
-
 CanvasStyle::CanvasStyle(float grayLevel, float alpha)
     : m_type(RGBA)
     , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha))
@@ -92,7 +86,7 @@ CanvasStyle::CanvasStyle(PassRefPtr<CanvasPattern> pattern)
 {
 }
 
-PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color)
+PassRefPtr<CanvasStyle> CanvasStyle::createFromString(const String& color)
 {
     RGBA32 rgba;
     if (!CSSParser::parseColor(rgba, color))
@@ -100,7 +94,7 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color)
     return adoptRef(new CanvasStyle(rgba));
 }
 
-PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color, float alpha)
+PassRefPtr<CanvasStyle> CanvasStyle::createFromStringWithOverrideAlpha(const String& color, float alpha)
 {
     RGBA32 rgba;
     if (!CSSParser::parseColor(rgba, color))
@@ -108,13 +102,13 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color, float alpha)
     return adoptRef(new CanvasStyle(colorWithOverrideAlpha(rgba, alpha)));
 }
 
-PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasGradient> gradient)
+PassRefPtr<CanvasStyle> CanvasStyle::createFromGradient(PassRefPtr<CanvasGradient> gradient)
 {
     if (!gradient)
         return 0;
     return adoptRef(new CanvasStyle(gradient));
 }
-PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasPattern> pattern)
+PassRefPtr<CanvasStyle> CanvasStyle::createFromPattern(PassRefPtr<CanvasPattern> pattern)
 {
     if (!pattern)
         return 0;
@@ -144,7 +138,7 @@ bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const
     return false;
 }
 
-bool CanvasStyle::isEquivalentColor(float r, float g, float b, float a) const
+bool CanvasStyle::isEquivalentRGBA(float r, float g, float b, float a) const
 {
     if (m_type != RGBA)
         return false;
@@ -152,7 +146,7 @@ bool CanvasStyle::isEquivalentColor(float r, float g, float b, float a) const
     return m_rgba == makeRGBA32FromFloats(r, g, b, a);
 }
 
-bool CanvasStyle::isEquivalentColor(float c, float m, float y, float k, float a) const
+bool CanvasStyle::isEquivalentCMYKA(float c, float m, float y, float k, float a) const
 {
     if (m_type != CMYKA)
         return false;
diff --git a/WebCore/html/canvas/CanvasStyle.h b/WebCore/html/canvas/CanvasStyle.h
index 8e47e63..3ca760a 100644
--- a/WebCore/html/canvas/CanvasStyle.h
+++ b/WebCore/html/canvas/CanvasStyle.h
@@ -38,15 +38,14 @@ namespace WebCore {
 
     class CanvasStyle : public RefCounted<CanvasStyle> {
     public:
-        static PassRefPtr<CanvasStyle> create(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); }
-        static PassRefPtr<CanvasStyle> create(const String& color);
-        static PassRefPtr<CanvasStyle> create(const String& color, float alpha);
-        static PassRefPtr<CanvasStyle> create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); }
-        static PassRefPtr<CanvasStyle> create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
-        static PassRefPtr<CanvasStyle> create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
-        static PassRefPtr<CanvasStyle> create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); }
-        static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient);
-        static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern);
+        static PassRefPtr<CanvasStyle> createFromRGBA(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); }
+        static PassRefPtr<CanvasStyle> createFromString(const String& color);
+        static PassRefPtr<CanvasStyle> createFromStringWithOverrideAlpha(const String& color, float alpha);
+        static PassRefPtr<CanvasStyle> createFromGrayLevelWithAlpha(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
+        static PassRefPtr<CanvasStyle> createFromRGBAChannels(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
+        static PassRefPtr<CanvasStyle> createFromCMYKAChannels(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); }
+        static PassRefPtr<CanvasStyle> createFromGradient(PassRefPtr<CanvasGradient>);
+        static PassRefPtr<CanvasStyle> createFromPattern(PassRefPtr<CanvasPattern>);
 
         String color() const { return Color(m_rgba).serialized(); }
         CanvasGradient* canvasGradient() const { return m_gradient.get(); }
@@ -56,12 +55,11 @@ namespace WebCore {
         void applyStrokeColor(GraphicsContext*);
 
         bool isEquivalentColor(const CanvasStyle&) const;
-        bool isEquivalentColor(float r, float g, float b, float a) const;
-        bool isEquivalentColor(float c, float m, float y, float k, float a) const;
+        bool isEquivalentRGBA(float r, float g, float b, float a) const;
+        bool isEquivalentCMYKA(float c, float m, float y, float k, float a) const;
 
     private:
         CanvasStyle(RGBA32 rgba);
-        CanvasStyle(float grayLevel);
         CanvasStyle(float grayLevel, float alpha);
         CanvasStyle(float r, float g, float b, float a);
         CanvasStyle(float c, float m, float y, float k, float a);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list