WebCore:

2008-09-02  David Hyatt  <hyatt@apple.com>

        Add support for canvas text drawing APIs.

        Reviewed by olliej

        Tests added as fast/canvas/canvas-text-*.html

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
        (WebCore::JSCanvasRenderingContext2D::fillText):
        (WebCore::JSCanvasRenderingContext2D::strokeText):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::initForStyleResolve):
        (WebCore::CSSStyleSelector::applyPropertyToStyle):
        * css/CSSStyleSelector.h:
        * html/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::State::State):
        (WebCore::CanvasRenderingContext2D::font):
        (WebCore::CanvasRenderingContext2D::setFont):
        (WebCore::CanvasRenderingContext2D::textAlign):
        (WebCore::CanvasRenderingContext2D::setTextAlign):
        (WebCore::CanvasRenderingContext2D::textBaseline):
        (WebCore::CanvasRenderingContext2D::setTextBaseline):
        (WebCore::CanvasRenderingContext2D::fillText):
        (WebCore::CanvasRenderingContext2D::strokeText):
        (WebCore::CanvasRenderingContext2D::measureText):
        (WebCore::CanvasRenderingContext2D::drawTextInternal):
        (WebCore::CanvasRenderingContext2D::accessFont):
        * html/CanvasRenderingContext2D.h:
        * html/CanvasRenderingContext2D.idl:
        * html/TextMetrics.h: Added.
        (WebCore::TextMetrics::create):
        (WebCore::TextMetrics::width):
        (WebCore::TextMetrics::setWidth):
        (WebCore::TextMetrics::TextMetrics):
        * html/TextMetrics.idl: Added.
        * platform/graphics/Font.cpp:
        (WebCore::Font::lineGap):
        * platform/graphics/Font.h:
        * platform/graphics/GraphicsContext.cpp:
        (WebCore::GraphicsContext::drawBidiText):
        * platform/graphics/GraphicsContext.h:
        * platform/graphics/GraphicsTypes.cpp:
        (WebCore::textAlignName):
        (WebCore::parseTextAlign):
        (WebCore::textBaselineName):
        (WebCore::parseTextBaseline):
        * platform/graphics/GraphicsTypes.h:
        (WebCore::):

LayoutTests:

2008-09-02  David Hyatt  <hyatt@apple.com>

        Add support for the canvas text APIs.

        Reviewed by olliej

        * fast/canvas/canvas-text-alignment.html: Added.
        * fast/canvas/canvas-text-baseline.html: Added.
        * platform/mac/fast/canvas/canvas-text-alignment-expected.checksum: Added.
        * platform/mac/fast/canvas/canvas-text-alignment-expected.png: Added.
        * platform/mac/fast/canvas/canvas-text-alignment-expected.txt: Added.
        * platform/mac/fast/canvas/canvas-text-baseline-expected.checksum: Added.
        * platform/mac/fast/canvas/canvas-text-baseline-expected.png: Added.
        * platform/mac/fast/canvas/canvas-text-baseline-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/canvas/canvas-text-alignment.html b/LayoutTests/fast/canvas/canvas-text-alignment.html
new file mode 100644
index 0000000..efb1264
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-text-alignment.html
@@ -0,0 +1,81 @@
+<html>
+<body>
+<canvas id="canvas" width=600 height=600 style="border:5px solid black">
+<script>
+var ctx = document.getElementById('canvas').getContext('2d');
+var lingrad = ctx.createLinearGradient(0,0,600,600);
+lingrad.addColorStop(0, '#00ABEB');
+lingrad.addColorStop(1.0, '#fff');
+
+var x = 10;
+var y = 30;
+
+ctx.font = "32px 'Times New Roman'";
+ctx.fillText("Normal Fill Text", x, y);
+
+y += 40;
+
+ctx.lineWidth = 2;
+ctx.strokeText("Normal Stroke Text", x, y);
+
+y += 40;
+
+ctx.fillStyle = lingrad;
+ctx.fillText("Gradient Fill Text", x, y);
+
+y += 40;
+
+ctx.strokeStyle = lingrad;
+ctx.strokeText("Gradient Stroke Text", x, y);
+
+ctx.textAlign = "end";
+
+x = 590;
+y += 40;
+
+ctx.fillStyle = 'black';
+ctx.fillText("Normal Fill Text", x, y);
+
+y += 40;
+
+ctx.strokeStyle = 'black';
+ctx.lineWidth = 2;
+ctx.strokeText("Normal Stroke Text", x, y);
+
+y += 40;
+
+ctx.fillStyle = lingrad;
+ctx.fillText("Gradient Fill Text", x, y);
+
+y += 40;
+
+ctx.strokeStyle = lingrad;
+ctx.strokeText("Gradient Stroke Text", x, y);
+
+y += 40;
+x = 300;
+
+ctx.textAlign = "center";
+
+ctx.fillStyle = 'black';
+ctx.fillText("Normal Fill Text", x, y);
+
+y += 40;
+
+ctx.strokeStyle = 'black';
+ctx.lineWidth = 2;
+ctx.strokeText("Normal Stroke Text", x, y);
+
+y += 40;
+
+ctx.fillStyle = lingrad;
+ctx.fillText("Gradient Fill Text", x, y);
+
+y += 40;
+
+ctx.strokeStyle = lingrad;
+ctx.strokeText("Gradient Stroke Text", x, y);
+
+y += 40;
+
+</script>