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

jamesr at google.com jamesr at google.com
Wed Dec 22 11:27:02 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2ae21ee4779def6298dda1b6d72921f865cca308
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jul 24 00:09:52 2010 +0000

    2010-07-23  James Robinson  <jamesr at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            CanvasRenderingContext2D has lots of style errors
            https://bugs.webkit.org/show_bug.cgi?id=42918
    
            CanvasRenderingContext2D.h and .cpp have lots of style errors.  I'm planning to post patches
            to both of these files soon, so to minimize merge conflicts and additional style violations
            it seems best to fix all of these errors in bulk before posting any functional changes.  In
            particular the header file is incorrectly indented so any correctly formatted addition will
            be out of place.
    
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
            (WebCore::CanvasRenderingContext2D::setFillStyle):
            (WebCore::CanvasRenderingContext2D::transform):
            (WebCore::CanvasRenderingContext2D::setTransform):
            (WebCore::CanvasRenderingContext2D::arcTo):
            (WebCore::CanvasRenderingContext2D::arc):
            (WebCore::validateRectForCanvas):
            (WebCore::CanvasRenderingContext2D::strokeRect):
            (WebCore::CanvasRenderingContext2D::drawImage):
            (WebCore::CanvasRenderingContext2D::createRadialGradient):
            (WebCore::CanvasRenderingContext2D::createPattern):
            (WebCore::CanvasRenderingContext2D::willDraw):
            (WebCore::CanvasRenderingContext2D::createImageData):
            (WebCore::CanvasRenderingContext2D::putImageData):
            (WebCore::CanvasRenderingContext2D::setFont):
            (WebCore::CanvasRenderingContext2D::drawTextInternal):
            * html/canvas/CanvasRenderingContext2D.h:
            (WebCore::CanvasRenderingContext2D::is2d):
            (WebCore::CanvasRenderingContext2D::getLineCap):
            (WebCore::CanvasRenderingContext2D::getLineJoin):
            (WebCore::CanvasRenderingContext2D::state):
            (WebCore::CanvasRenderingContext2D::):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64004 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4e2bf74..5cb83b9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-07-23  James Robinson  <jamesr at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        CanvasRenderingContext2D has lots of style errors
+        https://bugs.webkit.org/show_bug.cgi?id=42918
+
+        CanvasRenderingContext2D.h and .cpp have lots of style errors.  I'm planning to post patches
+        to both of these files soon, so to minimize merge conflicts and additional style violations
+        it seems best to fix all of these errors in bulk before posting any functional changes.  In
+        particular the header file is incorrectly indented so any correctly formatted addition will
+        be out of place.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
+        (WebCore::CanvasRenderingContext2D::setFillStyle):
+        (WebCore::CanvasRenderingContext2D::transform):
+        (WebCore::CanvasRenderingContext2D::setTransform):
+        (WebCore::CanvasRenderingContext2D::arcTo):
+        (WebCore::CanvasRenderingContext2D::arc):
+        (WebCore::validateRectForCanvas):
+        (WebCore::CanvasRenderingContext2D::strokeRect):
+        (WebCore::CanvasRenderingContext2D::drawImage):
+        (WebCore::CanvasRenderingContext2D::createRadialGradient):
+        (WebCore::CanvasRenderingContext2D::createPattern):
+        (WebCore::CanvasRenderingContext2D::willDraw):
+        (WebCore::CanvasRenderingContext2D::createImageData):
+        (WebCore::CanvasRenderingContext2D::putImageData):
+        (WebCore::CanvasRenderingContext2D::setFont):
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+        * html/canvas/CanvasRenderingContext2D.h:
+        (WebCore::CanvasRenderingContext2D::is2d):
+        (WebCore::CanvasRenderingContext2D::getLineCap):
+        (WebCore::CanvasRenderingContext2D::getLineJoin):
+        (WebCore::CanvasRenderingContext2D::state):
+        (WebCore::CanvasRenderingContext2D::):
+
 2010-07-23  Adam Barth  <abarth at webkit.org>
 
         Remove FIXME that we already fixed.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index acd15d2..6c3d372 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -32,14 +32,14 @@
 #include "CanvasRenderingContext2D.h"
 
 #include "AffineTransform.h"
+#include "CSSMutableStyleDeclaration.h"
 #include "CSSParser.h"
+#include "CSSPropertyNames.h"
+#include "CSSStyleSelector.h"
 #include "CachedImage.h"
 #include "CanvasGradient.h"
 #include "CanvasPattern.h"
 #include "CanvasStyle.h"
-#include "CSSMutableStyleDeclaration.h"
-#include "CSSPropertyNames.h"
-#include "CSSStyleSelector.h"
 #include "ExceptionCode.h"
 #include "FloatConversion.h"
 #include "GraphicsContext.h"
@@ -47,6 +47,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLMediaElement.h"
 #include "HTMLNames.h"
+#include "HTMLVideoElement.h"
 #include "ImageBuffer.h"
 #include "ImageData.h"
 #include "KURL.h"
@@ -56,8 +57,9 @@
 #include "Settings.h"
 #include "StrokeStyleApplier.h"
 #include "TextMetrics.h"
-#include "HTMLVideoElement.h"
+
 #include <stdio.h>
+
 #include <wtf/ByteArray.h>
 #include <wtf/MathExtras.h>
 #include <wtf/OwnPtr.h>
@@ -78,7 +80,7 @@ public:
         : m_canvasContext(canvasContext)
     {
     }
-    
+
     virtual void strokeStyle(GraphicsContext* c)
     {
         c->setStrokeThickness(m_canvasContext->lineWidth());
@@ -100,7 +102,7 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bo
 #endif
 {
 #if !ENABLE(DASHBOARD_SUPPORT)
-   ASSERT_UNUSED(usesDashboardCompatibilityMode, !usesDashboardCompatibilityMode);
+    ASSERT_UNUSED(usesDashboardCompatibilityMode, !usesDashboardCompatibilityMode);
 #endif
 
     // Make sure that even if the drawingContext() has a different default
@@ -202,7 +204,7 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style)
 
     if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(*style))
         return;
- 
+
     if (canvas()->originClean()) {
         if (CanvasPattern* pattern = style->canvasPattern()) {
             if (!pattern->originClean())
@@ -446,8 +448,7 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float
     if (!state().m_invertibleCTM)
         return;
 
-    if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | 
-        !isfinite(m12) | !isfinite(m22) | !isfinite(dy))
+    if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | !isfinite(m12) | !isfinite(m22) | !isfinite(dy))
         return;
 
     AffineTransform transform(m11, m12, m21, m22, dx, dy);
@@ -467,9 +468,8 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo
     GraphicsContext* c = drawingContext();
     if (!c)
         return;
-    
-    if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | 
-        !isfinite(m12) | !isfinite(m22) | !isfinite(dy))
+
+    if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | !isfinite(m12) | !isfinite(m22) | !isfinite(dy))
         return;
 
     AffineTransform ctm = state().m_transform;
@@ -621,15 +621,15 @@ void CanvasRenderingContext2D::arcTo(float x1, float y1, float x2, float y2, flo
     ec = 0;
     if (!isfinite(x1) | !isfinite(y1) | !isfinite(x2) | !isfinite(y2) | !isfinite(r))
         return;
-    
+
     if (r < 0) {
         ec = INDEX_SIZE_ERR;
         return;
     }
-    
+
     if (!state().m_invertibleCTM)
         return;
-    
+
     FloatPoint p1 = FloatPoint(x1, y1);
     FloatPoint p2 = FloatPoint(x2, y2);
 
@@ -646,7 +646,7 @@ void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea
     ec = 0;
     if (!isfinite(x) | !isfinite(y) | !isfinite(r) | !isfinite(sa) | !isfinite(ea))
         return;
-    
+
     if (r < 0) {
         ec = INDEX_SIZE_ERR;
         return;
@@ -659,7 +659,7 @@ void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea
         return;
     m_path.addArc(FloatPoint(x, y), r, sa, ea, anticlockwise);
 }
-    
+
 static bool validateRectForCanvas(float& x, float& y, float& width, float& height)
 {
     if (!isfinite(x) | !isfinite(y) | !isfinite(width) | !isfinite(height))
@@ -672,12 +672,12 @@ static bool validateRectForCanvas(float& x, float& y, float& width, float& heigh
         width = -width;
         x -= width;
     }
-    
+
     if (height < 0) {
         height = -height;
         y -= height;
     }
-    
+
     return true;
 }
 
@@ -835,7 +835,7 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
 {
     if (!validateRectForCanvas(x, y, width, height))
         return;
-    
+ 
     if (!(lineWidth >= 0))
         return;
 
@@ -1082,7 +1082,7 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
         return;
 
     FloatRect imageRect = FloatRect(FloatPoint(), size(image));
-    if (!imageRect.contains(normalizeRect(srcRect)) || srcRect.width() == 0 || srcRect.height() == 0) {
+    if (!imageRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) {
         ec = INDEX_SIZE_ERR;
         return;
     }
@@ -1153,7 +1153,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
         return;
     }
 
-    if (!srcCanvasRect.contains(normalizeRect(srcRect)) || srcRect.width() == 0 || srcRect.height() == 0) {
+    if (!srcCanvasRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) {
         ec = INDEX_SIZE_ERR;
         return;
     }
@@ -1168,10 +1168,10 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
         return;
     if (!state().m_invertibleCTM)
         return;
-        
+ 
     FloatRect sourceRect = c->roundToDevicePixels(srcRect);
     FloatRect destRect = c->roundToDevicePixels(dstRect);
-        
+
     // FIXME: Do this through platform-independent GraphicsContext API.
     ImageBuffer* buffer = sourceCanvas->buffer();
     if (!buffer)
@@ -1223,21 +1223,21 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
         ec = TYPE_MISMATCH_ERR;
         return;
     }
-    
+
     ec = 0;
 
     if (video->readyState() == HTMLMediaElement::HAVE_NOTHING || video->readyState() == HTMLMediaElement::HAVE_METADATA)
         return;
 
     FloatRect videoRect = FloatRect(FloatPoint(), size(video));
-    if (!videoRect.contains(normalizeRect(srcRect)) || srcRect.width() == 0 || srcRect.height() == 0) {
+    if (!videoRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) {
         ec = INDEX_SIZE_ERR;
         return;
     }
-    
+
     if (!dstRect.width() || !dstRect.height())
         return;
-    
+
     GraphicsContext* c = drawingContext();
     if (!c)
         return;
@@ -1257,7 +1257,7 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
     c->save();
     c->clip(destRect);
     c->translate(destRect.x(), destRect.y());
-    c->scale(FloatSize(destRect.width()/sourceRect.width(), destRect.height()/sourceRect.height()));
+    c->scale(FloatSize(destRect.width() / sourceRect.width(), destRect.height() / sourceRect.height()));
     c->translate(-sourceRect.x(), -sourceRect.y());
     video->paintCurrentFrameInContext(c, IntRect(IntPoint(), size(video)));
     c->restore();
@@ -1332,8 +1332,7 @@ PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float
 
 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode& ec)
 {
-    if (!isfinite(x0) || !isfinite(y0) || !isfinite(r0) || 
-        !isfinite(x1) || !isfinite(y1) || !isfinite(r1)) {
+    if (!isfinite(x0) || !isfinite(y0) || !isfinite(r0) || !isfinite(x1) || !isfinite(y1) || !isfinite(r1)) {
         ec = NOT_SUPPORTED_ERR;
         return 0;
     }
@@ -1377,7 +1376,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem
         ec = INVALID_STATE_ERR;
         return 0;
     }
-    
+
     bool repeatX, repeatY;
     ec = 0;
     CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec);
@@ -1399,7 +1398,7 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options)
         AffineTransform ctm = state().m_transform;
         dirtyRect = ctm.mapRect(r);
     }
-    
+
     if (options & CanvasWillDrawApplyShadow && alphaChannel(state().m_shadowColor)) {
         // The shadow gets applied after transformation
         FloatRect shadowRect(dirtyRect);
@@ -1407,13 +1406,13 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options)
         shadowRect.inflate(state().m_shadowBlur);
         dirtyRect.unite(shadowRect);
     }
-    
+
     if (options & CanvasWillDrawApplyClip) {
         // FIXME: apply the current clip to the rectangle. Unfortunately we can't get the clip
         // back out of the GraphicsContext, so to take clip into account for incremental painting,
         // we'd have to keep the clip path around.
     }
-    
+
     canvas()->willDraw(dirtyRect);
 }
 
@@ -1458,7 +1457,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float
         scaledSize.setWidth(1);
     if (scaledSize.height() < 1)
         scaledSize.setHeight(1);
-    
+
     return createEmptyImageData(scaledSize);
 }
 
@@ -1498,15 +1497,14 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
     putImageData(data, dx, dy, 0, 0, data->width(), data->height(), ec);
 }
 
-void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY, 
+void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY,
                                             float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
 {
     if (!data) {
         ec = TYPE_MISMATCH_ERR;
         return;
     }
-    if (!isfinite(dx) || !isfinite(dy) || !isfinite(dirtyX) || 
-        !isfinite(dirtyY) || !isfinite(dirtyWidth) || !isfinite(dirtyHeight)) {
+    if (!isfinite(dx) || !isfinite(dy) || !isfinite(dirtyX) || !isfinite(dirtyY) || !isfinite(dirtyWidth) || !isfinite(dirtyHeight)) {
         ec = NOT_SUPPORTED_ERR;
         return;
     }
@@ -1533,10 +1531,10 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
     sourceRect.intersect(IntRect(IntPoint(), buffer->size()));
     if (sourceRect.isEmpty())
         return;
-    willDraw(sourceRect, 0);  // ignore transform, shadow and clip
+    willDraw(sourceRect, 0); // ignore transform, shadow and clip
     sourceRect.move(-destOffset);
     IntPoint destPoint(destOffset.width(), destOffset.height());
-    
+
     buffer->putUnmultipliedImageData(data, sourceRect, destPoint);
 }
 
@@ -1549,16 +1547,16 @@ void CanvasRenderingContext2D::setFont(const String& newFont)
 {
     RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create();
     CSSParser parser(!m_usesCSSCompatibilityParseMode);
-        
+
     String declarationText("font: ");
     declarationText += newFont;
     parser.parseDeclaration(tempDecl.get(), declarationText);
     if (!tempDecl->length())
         return;
-            
+
     // The parse succeeded.
     state().m_unparsedFont = newFont;
-    
+
     // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
     // relative to the canvas.
     RefPtr<RenderStyle> newStyle = RenderStyle::create();
@@ -1568,7 +1566,7 @@ void CanvasRenderingContext2D::setFont(const String& newFont)
     // Now map the font property into the style.
     CSSStyleSelector* styleSelector = canvas()->styleSelector();
     styleSelector->applyPropertyToStyle(CSSPropertyFont, tempDecl->getPropertyCSSValue(CSSPropertyFont).get(), newStyle.get());
-    
+
     state().m_font = newStyle->font();
     state().m_font.update(styleSelector->fontSelector());
     state().m_realizedFont = true;
@@ -1595,7 +1593,7 @@ void CanvasRenderingContext2D::setTextAlign(const String& s)
         return;
     state().m_textAlign = align;
 }
-        
+
 String CanvasRenderingContext2D::textBaseline() const
 {
     return textBaselineName(state().m_textBaseline);
@@ -1643,7 +1641,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
         return;
     if (!state().m_invertibleCTM)
         return;
-    
+
     const Font& font = accessFont();
 
     // FIXME: Handle maxWidth.
@@ -1660,23 +1658,23 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
     // Draw the item text at the correct point.
     FloatPoint location(x, y);
     switch (state().m_textBaseline) {
-        case TopTextBaseline:
-        case HangingTextBaseline:
-            location.setY(y + font.ascent());
-            break;
-        case BottomTextBaseline:
-        case IdeographicTextBaseline:
-            location.setY(y - font.descent());
-            break;
-        case MiddleTextBaseline:
-            location.setY(y - font.descent() + font.height() / 2);
-            break;
-        case AlphabeticTextBaseline:
-        default:
-             // Do nothing.
-            break;
+    case TopTextBaseline:
+    case HangingTextBaseline:
+        location.setY(y + font.ascent());
+        break;
+    case BottomTextBaseline:
+    case IdeographicTextBaseline:
+        location.setY(y - font.descent());
+        break;
+    case MiddleTextBaseline:
+        location.setY(y - font.descent() + font.height() / 2);
+        break;
+    case AlphabeticTextBaseline:
+    default:
+         // Do nothing.
+        break;
     }
-    
+
     float width = font.width(TextRun(text, false, 0, 0, rtl, override));
 
     TextAlign align = state().m_textAlign;
@@ -1684,18 +1682,18 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
          align = rtl ? RightTextAlign : LeftTextAlign;
     else if (align == EndTextAlign)
         align = rtl ? LeftTextAlign : RightTextAlign;
-    
+
     switch (align) {
-        case CenterTextAlign:
-            location.setX(location.x() - width / 2);
-            break;
-        case RightTextAlign:
-            location.setX(location.x() - width);
-            break;
-        default:
-            break;
+    case CenterTextAlign:
+        location.setX(location.x() - width / 2);
+        break;
+    case RightTextAlign:
+        location.setX(location.x() - width);
+        break;
+    default:
+        break;
     }
-    
+
     // The slop built in to this mask rect matches the heuristic used in FontCGWin.cpp for GDI text.
     FloatRect textRect = FloatRect(location.x() - font.height() / 2, location.y() - font.ascent() - font.lineGap(),
                                    width + font.height(), font.lineSpacing());
@@ -1709,7 +1707,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
         // punt and dirty the whole canvas.
         canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height()));
     }
-    
+
 #if PLATFORM(CG)
     CanvasStyle* drawStyle = fill ? state().m_fillStyle.get() : state().m_strokeStyle.get();
     if (drawStyle->canvasGradient() || drawStyle->canvasPattern()) {
@@ -1729,9 +1727,9 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
 
         maskImageContext->setTextDrawingMode(fill ? cTextFill : cTextStroke);
         maskImageContext->translate(-maskRect.x(), -maskRect.y());
-        
+
         maskImageContext->drawBidiText(font, textRun, location);
-        
+
         c->save();
         c->clipToImageBuffer(maskRect, maskImage.get());
         drawStyle->applyFillColor(c);
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index 2eac88d..fb5f27a 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -34,8 +34,9 @@
 #include "GraphicsTypes.h"
 #include "Path.h"
 #include "PlatformString.h"
-#include <wtf/text/StringHash.h>
+
 #include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
 
 #if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
@@ -43,243 +44,243 @@
 
 namespace WebCore {
 
-    class CanvasGradient;
-    class CanvasPattern;
-    class CanvasStyle;
-    class FloatRect;
-    class GraphicsContext;
-    class HTMLCanvasElement;
-    class HTMLImageElement;
-    class HTMLVideoElement;
-    class ImageData;
-    class KURL;
-    class TextMetrics;
-
-    typedef int ExceptionCode;
+class CanvasGradient;
+class CanvasPattern;
+class CanvasStyle;
+class FloatRect;
+class GraphicsContext;
+class HTMLCanvasElement;
+class HTMLImageElement;
+class HTMLVideoElement;
+class ImageData;
+class KURL;
+class TextMetrics;
+
+typedef int ExceptionCode;
+
+class CanvasRenderingContext2D : public CanvasRenderingContext {
+public:
+    CanvasRenderingContext2D(HTMLCanvasElement*, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode);
 
-    class CanvasRenderingContext2D : public CanvasRenderingContext {
-    public:
-        CanvasRenderingContext2D(HTMLCanvasElement*, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode);
-
-        virtual ~CanvasRenderingContext2D();
-        
-        virtual bool is2d() const { return true; }
-
-        CanvasStyle* strokeStyle() const;
-        void setStrokeStyle(PassRefPtr<CanvasStyle>);
-
-        CanvasStyle* fillStyle() const;
-        void setFillStyle(PassRefPtr<CanvasStyle>);
-
-        float lineWidth() const;
-        void setLineWidth(float);
-
-        String lineCap() const;
-        void setLineCap(const String&);
-
-        String lineJoin() const;
-        void setLineJoin(const String&);
-
-        float miterLimit() const;
-        void setMiterLimit(float);
-
-        float shadowOffsetX() const;
-        void setShadowOffsetX(float);
-
-        float shadowOffsetY() const;
-        void setShadowOffsetY(float);
-
-        float shadowBlur() const;
-        void setShadowBlur(float);
-
-        String shadowColor() const;
-        void setShadowColor(const String&);
-
-        float globalAlpha() const;
-        void setGlobalAlpha(float);
-
-        String globalCompositeOperation() const;
-        void setGlobalCompositeOperation(const String&);
-
-        void save();
-        void restore();
-
-        void scale(float sx, float sy);
-        void rotate(float angleInRadians);
-        void translate(float tx, float ty);
-        void transform(float m11, float m12, float m21, float m22, float dx, float dy);
-        void setTransform(float m11, float m12, float m21, float m22, float dx, float dy);
-
-        void setStrokeColor(const String& color);
-        void setStrokeColor(float grayLevel);
-        void setStrokeColor(const String& color, float alpha);
-        void setStrokeColor(float grayLevel, float alpha);
-        void setStrokeColor(float r, float g, float b, float a);
-        void setStrokeColor(float c, float m, float y, float k, float a);
-
-        void setFillColor(const String& color);
-        void setFillColor(float grayLevel);
-        void setFillColor(const String& color, float alpha);
-        void setFillColor(float grayLevel, float alpha);
-        void setFillColor(float r, float g, float b, float a);
-        void setFillColor(float c, float m, float y, float k, float a);
-
-        void beginPath();
-        void closePath();
-
-        void moveTo(float x, float y);
-        void lineTo(float x, float y);
-        void quadraticCurveTo(float cpx, float cpy, float x, float y);
-        void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
-        void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);
-        void arc(float x, float y, float r, float sa, float ea, bool clockwise, ExceptionCode&);
-        void rect(float x, float y, float width, float height);
-
-        void fill();
-        void stroke();
-        void clip();
-
-        bool isPointInPath(const float x, const float y);
-
-        void clearRect(float x, float y, float width, float height);
-        void fillRect(float x, float y, float width, float height);
-        void strokeRect(float x, float y, float width, float height);
-        void strokeRect(float x, float y, float width, float height, float lineWidth);
-
-        void setShadow(float width, float height, float blur);
-        void setShadow(float width, float height, float blur, const String& color);
-        void setShadow(float width, float height, float blur, float grayLevel);
-        void setShadow(float width, float height, float blur, const String& color, float alpha);
-        void setShadow(float width, float height, float blur, float grayLevel, float alpha);
-        void setShadow(float width, float height, float blur, float r, float g, float b, float a);
-        void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a);
+    virtual ~CanvasRenderingContext2D();
+
+    virtual bool is2d() const { return true; }
+
+    CanvasStyle* strokeStyle() const;
+    void setStrokeStyle(PassRefPtr<CanvasStyle>);
+
+    CanvasStyle* fillStyle() const;
+    void setFillStyle(PassRefPtr<CanvasStyle>);
+
+    float lineWidth() const;
+    void setLineWidth(float);
+
+    String lineCap() const;
+    void setLineCap(const String&);
+
+    String lineJoin() const;
+    void setLineJoin(const String&);
+
+    float miterLimit() const;
+    void setMiterLimit(float);
+
+    float shadowOffsetX() const;
+    void setShadowOffsetX(float);
+
+    float shadowOffsetY() const;
+    void setShadowOffsetY(float);
+
+    float shadowBlur() const;
+    void setShadowBlur(float);
+
+    String shadowColor() const;
+    void setShadowColor(const String&);
+
+    float globalAlpha() const;
+    void setGlobalAlpha(float);
+
+    String globalCompositeOperation() const;
+    void setGlobalCompositeOperation(const String&);
+
+    void save();
+    void restore();
+
+    void scale(float sx, float sy);
+    void rotate(float angleInRadians);
+    void translate(float tx, float ty);
+    void transform(float m11, float m12, float m21, float m22, float dx, float dy);
+    void setTransform(float m11, float m12, float m21, float m22, float dx, float dy);
+
+    void setStrokeColor(const String& color);
+    void setStrokeColor(float grayLevel);
+    void setStrokeColor(const String& color, float alpha);
+    void setStrokeColor(float grayLevel, float alpha);
+    void setStrokeColor(float r, float g, float b, float a);
+    void setStrokeColor(float c, float m, float y, float k, float a);
+
+    void setFillColor(const String& color);
+    void setFillColor(float grayLevel);
+    void setFillColor(const String& color, float alpha);
+    void setFillColor(float grayLevel, float alpha);
+    void setFillColor(float r, float g, float b, float a);
+    void setFillColor(float c, float m, float y, float k, float a);
+
+    void beginPath();
+    void closePath();
+
+    void moveTo(float x, float y);
+    void lineTo(float x, float y);
+    void quadraticCurveTo(float cpx, float cpy, float x, float y);
+    void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
+    void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);
+    void arc(float x, float y, float r, float sa, float ea, bool clockwise, ExceptionCode&);
+    void rect(float x, float y, float width, float height);
+
+    void fill();
+    void stroke();
+    void clip();
+
+    bool isPointInPath(const float x, const float y);
+
+    void clearRect(float x, float y, float width, float height);
+    void fillRect(float x, float y, float width, float height);
+    void strokeRect(float x, float y, float width, float height);
+    void strokeRect(float x, float y, float width, float height, float lineWidth);
+
+    void setShadow(float width, float height, float blur);
+    void setShadow(float width, float height, float blur, const String& color);
+    void setShadow(float width, float height, float blur, float grayLevel);
+    void setShadow(float width, float height, float blur, const String& color, float alpha);
+    void setShadow(float width, float height, float blur, float grayLevel, float alpha);
+    void setShadow(float width, float height, float blur, float r, float g, float b, float a);
+    void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a);
 
-        void clearShadow();
-
-        void drawImage(HTMLImageElement*, float x, float y, ExceptionCode&);
-        void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&);
-        void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-        void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
-        void drawImage(HTMLCanvasElement*, float x, float y, ExceptionCode&);
-        void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&);
-        void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-        void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+    void clearShadow();
+
+    void drawImage(HTMLImageElement*, float x, float y, ExceptionCode&);
+    void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&);
+    void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
+    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+    void drawImage(HTMLCanvasElement*, float x, float y, ExceptionCode&);
+    void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&);
+    void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
+    void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
 #if ENABLE(VIDEO)
-        void drawImage(HTMLVideoElement*, float x, float y, ExceptionCode&);
-        void drawImage(HTMLVideoElement*, float x, float y, float width, float height, ExceptionCode&);
-        void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-        void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+    void drawImage(HTMLVideoElement*, float x, float y, ExceptionCode&);
+    void drawImage(HTMLVideoElement*, float x, float y, float width, float height, ExceptionCode&);
+    void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
+    void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
 #endif
 
-        void drawImageFromRect(HTMLImageElement*, float sx, float sy, float sw, float sh,
-            float dx, float dy, float dw, float dh, const String& compositeOperation);
-
-        void setAlpha(float);
-
-        void setCompositeOperation(const String&);
-
-        PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&);
-        PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&);
-        PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&);
-        PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
-        
-        PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData> imageData, ExceptionCode&) const;
-        PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const;
-        PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
-        void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
-        void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
-        
-        void reset();
-
-        String font() const;
-        void setFont(const String&);
-        void updateFont();
-        
-        String textAlign() const;
-        void setTextAlign(const String&);
-        
-        String textBaseline() const;
-        void setTextBaseline(const String&);
-        
-        void fillText(const String& text, float x, float y);
-        void fillText(const String& text, float x, float y, float maxWidth);
-        void strokeText(const String& text, float x, float y);
-        void strokeText(const String& text, float x, float y, float maxWidth);
-        PassRefPtr<TextMetrics> measureText(const String& text);
-
-        LineCap getLineCap() const { return state().m_lineCap; }
-        LineJoin getLineJoin() const { return state().m_lineJoin; }
-
-    private:
-        struct State {
-            State();
-            
-            String m_unparsedStrokeColor;
-            String m_unparsedFillColor;
-            RefPtr<CanvasStyle> m_strokeStyle;
-            RefPtr<CanvasStyle> m_fillStyle;
-            float m_lineWidth;
-            LineCap m_lineCap;
-            LineJoin m_lineJoin;
-            float m_miterLimit;
-            FloatSize m_shadowOffset;
-            float m_shadowBlur;
-            RGBA32 m_shadowColor;
-            float m_globalAlpha;
-            CompositeOperator m_globalComposite;
-            AffineTransform m_transform;
-            bool m_invertibleCTM;
-            
-            // Text state.
-            TextAlign m_textAlign;
-            TextBaseline m_textBaseline;
-            
-            String m_unparsedFont;
-            Font m_font;
-            bool m_realizedFont;
-        };
-        Path m_path;
-
-        State& state() { return m_stateStack.last(); }
-        const State& state() const { return m_stateStack.last(); }
-
-        void applyShadow();
-
-        enum CanvasWillDrawOption {
-            CanvasWillDrawApplyTransform = 1,
-            CanvasWillDrawApplyShadow = 1 << 1,
-            CanvasWillDrawApplyClip = 1 << 2,
-            CanvasWillDrawApplyAll = 0xffffffff
-        };
-        
-        void willDraw(const FloatRect&, unsigned options = CanvasWillDrawApplyAll);
-
-        GraphicsContext* drawingContext() const;
-
-        void applyStrokePattern();
-        void applyFillPattern();
-
-        void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false);
-
-        const Font& accessFont();
+    void drawImageFromRect(HTMLImageElement*, float sx, float sy, float sw, float sh,
+        float dx, float dy, float dw, float dh, const String& compositeOperation);
+
+    void setAlpha(float);
+
+    void setCompositeOperation(const String&);
+
+    PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&);
+    PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&);
+    PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&);
+    PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
+
+    PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData> imageData, ExceptionCode&) const;
+    PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const;
+    PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
+    void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
+    void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+
+    void reset();
+
+    String font() const;
+    void setFont(const String&);
+    void updateFont();
+
+    String textAlign() const;
+    void setTextAlign(const String&);
+
+    String textBaseline() const;
+    void setTextBaseline(const String&);
+
+    void fillText(const String& text, float x, float y);
+    void fillText(const String& text, float x, float y, float maxWidth);
+    void strokeText(const String& text, float x, float y);
+    void strokeText(const String& text, float x, float y, float maxWidth);
+    PassRefPtr<TextMetrics> measureText(const String& text);
+
+    LineCap getLineCap() const { return state().m_lineCap; }
+    LineJoin getLineJoin() const { return state().m_lineJoin; }
+
+private:
+    struct State {
+        State();
+
+        String m_unparsedStrokeColor;
+        String m_unparsedFillColor;
+        RefPtr<CanvasStyle> m_strokeStyle;
+        RefPtr<CanvasStyle> m_fillStyle;
+        float m_lineWidth;
+        LineCap m_lineCap;
+        LineJoin m_lineJoin;
+        float m_miterLimit;
+        FloatSize m_shadowOffset;
+        float m_shadowBlur;
+        RGBA32 m_shadowColor;
+        float m_globalAlpha;
+        CompositeOperator m_globalComposite;
+        AffineTransform m_transform;
+        bool m_invertibleCTM;
+
+        // Text state.
+        TextAlign m_textAlign;
+        TextBaseline m_textBaseline;
+
+        String m_unparsedFont;
+        Font m_font;
+        bool m_realizedFont;
+    };
+    Path m_path;
+
+    State& state() { return m_stateStack.last(); }
+    const State& state() const { return m_stateStack.last(); }
+
+    void applyShadow();
+
+    enum CanvasWillDrawOption {
+        CanvasWillDrawApplyTransform = 1,
+        CanvasWillDrawApplyShadow = 1 << 1,
+        CanvasWillDrawApplyClip = 1 << 2,
+        CanvasWillDrawApplyAll = 0xffffffff
+    };
+
+    void willDraw(const FloatRect&, unsigned options = CanvasWillDrawApplyAll);
+
+    GraphicsContext* drawingContext() const;
+
+    void applyStrokePattern();
+    void applyFillPattern();
+
+    void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false);
+
+    const Font& accessFont();
 
 #if ENABLE(DASHBOARD_SUPPORT)
-        void clearPathForDashboardBackwardCompatibilityMode();
+    void clearPathForDashboardBackwardCompatibilityMode();
 #endif
-        
-        void prepareGradientForDashboard(CanvasGradient* gradient) const;
 
-        HashSet<String> m_cleanOrigins;
+    void prepareGradientForDashboard(CanvasGradient* gradient) const;
 
-        void checkOrigin(const KURL&);
-        void checkOrigin(const String&);
+    HashSet<String> m_cleanOrigins;
 
-        Vector<State, 1> m_stateStack;
-        bool m_usesCSSCompatibilityParseMode;
+    void checkOrigin(const KURL&);
+    void checkOrigin(const String&);
+
+    Vector<State, 1> m_stateStack;
+    bool m_usesCSSCompatibilityParseMode;
 #if ENABLE(DASHBOARD_SUPPORT)
-        bool m_usesDashboardCompatibilityMode;
+    bool m_usesDashboardCompatibilityMode;
 #endif
-    };
+};
 
 } // namespace WebCore
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list