Commit f46c05f3 authored by darin's avatar darin

LayoutTests:

        Reviewed by Darin.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7830
          <canvas> createPattern 'repeat' options fail

        * fast/canvas/patternfill-repeat-expected.checksum: Added.
        * fast/canvas/patternfill-repeat-expected.png: Added.
        * fast/canvas/patternfill-repeat-expected.txt: Added.
        * fast/canvas/patternfill-repeat.html: Added.

WebCore:

        Test: fast/canvas/patternfill-repeat.html

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7830
          <canvas> createPattern 'repeat' options fail

        * CanvasPattern.cpp (CanvasPattern::createPattern)
        Change stepping so that repeat-x, repeat-y, and no-repeat repeat 
        outside the view area by using large values for repeat interval.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bbf2fa2b
2006-03-18 David Carson <dacarson@gmail.com>
Reviewed by Darin.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7830
<canvas> createPattern 'repeat' options fail
* fast/canvas/patternfill-repeat-expected.checksum: Added.
* fast/canvas/patternfill-repeat-expected.png: Added.
* fast/canvas/patternfill-repeat-expected.txt: Added.
* fast/canvas/patternfill-repeat.html: Added.
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
......
9473c7a33468930d21f2770b730e4d1c
\ No newline at end of file
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x460
RenderBlock {HTML} at (0,0) size 800x460
RenderBody {BODY} at (8,16) size 784x428
RenderBlock {P} at (0,0) size 784x72
RenderText {TEXT} at (0,0) size 773x72
text run at (0,0) width 751: "There should be one big square below containing four squares. Top left square should be filled with 3 rows of 2 and bit"
text run at (0,18) width 773: "Apple images. Top right square should be 2 and a bit rows with one Apple image column along the left edge of the square."
text run at (0,36) width 764: "Bottom left square should be one row with three Apple images along the top of the square. Bottom right square should be"
text run at (0,54) width 220: "one Apple image in top left corner."
RenderBlock {P} at (0,88) size 784x340
RenderCanvasImage {CANVAS} at (0,0) size 336x336 [border: (3px solid #000000)]
<!DOCTYPE html>
<html lang="en">
<head>
<title>createPattern repeat test</title>
<style> canvas { border:solid #000 } </style>
<script>
if (window.layoutTestController)
layoutTestController.waitUntilDone();
window.onload = function(){
var i = new Image();
i.src = "resources/apple.gif";
i.onload = function() {
var ctx = document.getElementsByTagName('canvas')[0].getContext('2d');
var p;
//ctx.strokeWidth(1.0);
p = ctx.createPattern(i, "repeat");
ctx.fillStyle = p;
ctx.translate(10, 10);
ctx.strokeRect(0, 0, 150, 150);
ctx.fillRect(0, 0, 150, 150);
px = ctx.createPattern(i, "repeat-x");
ctx.fillStyle = px;
ctx.translate(0, 160);
ctx.strokeRect(0, 0, 150, 150);
ctx.fillRect(0, 0, 150, 150);
pn = ctx.createPattern(i, "no-repeat");
ctx.fillStyle = pn;
ctx.translate(160, 0);
ctx.strokeRect(0, 0, 150, 150);
ctx.fillRect(0, 0, 150, 150);
py = ctx.createPattern(i, "repeat-y");
ctx.fillStyle = py;
ctx.translate(0, -160);
ctx.strokeRect(0, 0, 150, 150);
ctx.fillRect(0, 0, 150, 150);
if (window.layoutTestController)
layoutTestController.notifyDone();
}
}
</script>
</head>
<body>
<p>There should be one big square below containing four squares. Top left square should be filled with 3 rows of 2 and bit Apple images. Top right square should be 2 and a bit rows with one Apple image column along the left edge of the square. Bottom left square should be one row with three Apple images along the top of the square. Bottom right square should be one Apple image in top left corner.</p>
<p><canvas height="330" width="330"></canvas></p>
</body>
</html>
2006-03-18 David Carson <dacarson@gmail.com>
Test: fast/canvas/patternfill-repeat.html
Reviewed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7830
<canvas> createPattern 'repeat' options fail
* CanvasPattern.cpp (CanvasPattern::createPattern)
Change stepping so that repeat-x, repeat-y, and no-repeat repeat
outside the view area by using large values for repeat interval.
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Test: fast/dom/Element/class-attribute-whitespace.html
......@@ -85,8 +85,13 @@ CGPatternRef CanvasPattern::createPattern(const CGAffineTransform& transform)
CGAffineTransform patternTransform =
CGAffineTransformTranslate(CGAffineTransformScale(transform, 1, -1), 0, -image->height());
float xStep = m_repeatX ? image->width() : 0;
float yStep = m_repeatY ? image->height() : 0;
float xStep = m_repeatX ? image->width() : FLT_MAX;
// If FLT_MAX should also be used for yStep, nothing is rendered. Using fractions of FLT_MAX also
// result in nothing being rendered. This is not a problem with xStep.
// INT_MAX is almost correct, but there seems to be some number wrapping occuring making the fill
// pattern is not filled correctly.
// So, just pick a really large number that works.
float yStep = m_repeatY ? image->height() : (100000000.0);
const CGPatternCallbacks patternCallbacks = { 0, patternCallback, patternReleaseCallback };
ref();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment