https://bugs.webkit.org/show_bug.cgi?id=104923
Reviewed by James Robinson.
* ManualTests/canvas-font-speed.html: Added.
Source/WebCore: CanvasRenderingContext2D::setFont() is slow.
https://bugs.webkit.org/show_bug.cgi?id=104923
Reviewed by James Robinson.
This spends most of its time in the CSS parser. As a first step,
early-out if the new value is the same as unparsed string for the current font.
See also http://code.google.com/p/chromium/issues/detail?id=164016.
Covered by existing tests in canvas/ and fast/canvas, and ManualTests/canvas-font-speed.html.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137630
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-12-13 Stephen White <senorblanco@chromium.org>
+
+ Added manual test for canvas setFont speed.
+ https://bugs.webkit.org/show_bug.cgi?id=104923
+
+ Reviewed by James Robinson.
+
+ * ManualTests/canvas-font-speed.html: Added.
+
2012-12-13 Jerome Pasion <jerome.pasion@digia.com>
[Qt] Doc: Fixing Qt WebKit reference documentation.
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<title>Canvas 2d Context Font Property Speed</title>
+</head>
+<body>
+ <canvas id='thecanvas' height=100 width=100/>
+ <script>
+ var canvas = document.getElementById('thecanvas');
+ var context = canvas.getContext('2d');
+ var t0 = Date.now();
+ for (var i = 0; i < 1000; i++) {
+ context.font = 'bold 13px Arial';
+ }
+ alert('Elapsed for 1000 font settings: ' + (Date.now() - t0));
+ </script>
+</body>
+</html>
+2012-12-13 Stephen White <senorblanco@chromium.org>
+
+ CanvasRenderingContext2D::setFont() is slow.
+ https://bugs.webkit.org/show_bug.cgi?id=104923
+
+ Reviewed by James Robinson.
+
+ This spends most of its time in the CSS parser. As a first step,
+ early-out if the new value is the same as unparsed string for the current font.
+ See also http://code.google.com/p/chromium/issues/detail?id=164016.
+
+ Covered by existing tests in canvas/ and fast/canvas, and ManualTests/canvas-font-speed.html.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::setFont):
+
2012-12-13 Parth Patel <parpatel@rim.com>, Max Feil <mfeil@rim.com>
Allow plugins to be disabled by shared library filename
void CanvasRenderingContext2D::setFont(const String& newFont)
{
+ if (newFont == state().m_unparsedFont && state().m_realizedFont)
+ return;
+
RefPtr<StylePropertySet> parsedStyle = StylePropertySet::create();
CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, newFont, true, strictToCSSParserMode(!m_usesCSSCompatibilityParseMode), 0);
if (parsedStyle->isEmpty())