[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 11:11:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 91f8dc62aa237d94f06c998e6c2ec64644ec6f09
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jul 14 19:33:13 2010 +0000
2010-07-14 Andreas Kling <andreas.kling at nokia.com>
Reviewed by Darin Adler.
Canvas: Fast-path for assigning the same color string as before to fillStyle or strokeStyle
https://bugs.webkit.org/show_bug.cgi?id=42272
Always route assignment of color strings via setFillColor() or setStrokeColor()
where we can check it against the previous value and return early if it's the same.
* bindings/js/JSCanvasRenderingContext2DCustom.cpp:
(WebCore::toHTMLCanvasStyle):
(WebCore::JSCanvasRenderingContext2D::strokeStyle):
(WebCore::JSCanvasRenderingContext2D::setStrokeStyle):
(WebCore::JSCanvasRenderingContext2D::setFillStyle):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setStrokeStyle):
(WebCore::CanvasRenderingContext2D::setFillStyle):
(WebCore::CanvasRenderingContext2D::setStrokeColor):
(WebCore::CanvasRenderingContext2D::setFillColor):
* html/canvas/CanvasRenderingContext2D.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a32ac85..d01facd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-07-14 Andreas Kling <andreas.kling at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Canvas: Fast-path for assigning the same color string as before to fillStyle or strokeStyle
+ https://bugs.webkit.org/show_bug.cgi?id=42272
+
+ Always route assignment of color strings via setFillColor() or setStrokeColor()
+ where we can check it against the previous value and return early if it's the same.
+
+ * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+ (WebCore::toHTMLCanvasStyle):
+ (WebCore::JSCanvasRenderingContext2D::strokeStyle):
+ (WebCore::JSCanvasRenderingContext2D::setStrokeStyle):
+ (WebCore::JSCanvasRenderingContext2D::setFillStyle):
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::setStrokeStyle):
+ (WebCore::CanvasRenderingContext2D::setFillStyle):
+ (WebCore::CanvasRenderingContext2D::setStrokeColor):
+ (WebCore::CanvasRenderingContext2D::setFillColor):
+ * html/canvas/CanvasRenderingContext2D.h:
+
2010-07-14 Kinuko Yasuda <kinuko at chromium.org>
Reviewed by Jian Li.
diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
index 9b3f79f..8221fed 100644
--- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
@@ -51,10 +51,8 @@ static JSValue toJS(ExecState* exec, CanvasStyle* style)
return jsString(exec, style->color());
}
-static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState* exec, JSValue value)
+static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState*, JSValue value)
{
- if (value.isString())
- return CanvasStyle::create(ustringToString(asString(value)->value(exec)));
if (!value.isObject())
return 0;
JSObject* object = asObject(value);
@@ -74,6 +72,10 @@ JSValue JSCanvasRenderingContext2D::strokeStyle(ExecState* exec) const
void JSCanvasRenderingContext2D::setStrokeStyle(ExecState* exec, JSValue value)
{
CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
+ if (value.isString()) {
+ context->setStrokeColor(ustringToString(asString(value)->value(exec)));
+ return;
+ }
context->setStrokeStyle(toHTMLCanvasStyle(exec, value));
}
@@ -86,6 +88,10 @@ JSValue JSCanvasRenderingContext2D::fillStyle(ExecState* exec) const
void JSCanvasRenderingContext2D::setFillStyle(ExecState* exec, JSValue value)
{
CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl());
+ if (value.isString()) {
+ context->setFillColor(ustringToString(asString(value)->value(exec)));
+ return;
+ }
context->setFillStyle(toHTMLCanvasStyle(exec, value));
}
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index c1b2142..451dc62 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -187,6 +187,7 @@ void CanvasRenderingContext2D::setStrokeStyle(PassRefPtr<CanvasStyle> style)
if (!c)
return;
state().m_strokeStyle->applyStrokeColor(c);
+ state().m_unparsedStrokeColor = String();
}
CanvasStyle* CanvasRenderingContext2D::fillStyle() const
@@ -214,6 +215,7 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style)
if (!c)
return;
state().m_fillStyle->applyFillColor(c);
+ state().m_unparsedFillColor = String();
}
float CanvasRenderingContext2D::lineWidth() const
@@ -484,7 +486,10 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo
void CanvasRenderingContext2D::setStrokeColor(const String& color)
{
+ if (color == state().m_unparsedStrokeColor)
+ return;
setStrokeStyle(CanvasStyle::create(color));
+ state().m_unparsedStrokeColor = color;
}
void CanvasRenderingContext2D::setStrokeColor(float grayLevel)
@@ -514,7 +519,10 @@ void CanvasRenderingContext2D::setStrokeColor(float c, float m, float y, float k
void CanvasRenderingContext2D::setFillColor(const String& color)
{
+ if (color == state().m_unparsedFillColor)
+ return;
setFillStyle(CanvasStyle::create(color));
+ state().m_unparsedFillColor = color;
}
void CanvasRenderingContext2D::setFillColor(float grayLevel)
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index 43f3b35..2eac88d 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -214,6 +214,8 @@ namespace WebCore {
struct State {
State();
+ String m_unparsedStrokeColor;
+ String m_unparsedFillColor;
RefPtr<CanvasStyle> m_strokeStyle;
RefPtr<CanvasStyle> m_fillStyle;
float m_lineWidth;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list