Bug 46506 - [mac] Pass all of Philip's Canvas Test Suite
Summary: [mac] Pass all of Philip's Canvas Test Suite
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.6
: P2 Normal
Assignee: Matthew Delaney
URL:
Keywords:
Depends on: 28832 61799 39027 40147 48277 48288 48289 48290 48291 48292 48293 48294 48295 48296 48297 48298 48299 48300 48301 48302 48303 48304 48305 48306 48307 48894 49225 49230 49368 49369 61528 92974
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-24 13:42 PDT by Matthew Delaney
Modified: 2012-12-13 05:46 PST (History)
9 users (show)

See Also:


Attachments
Fixes the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test (3.81 KB, patch)
2011-05-25 07:38 PDT, Philip Rogers
kling: review-
Details | Formatted Diff | Diff
canvas globalCompositeOperation implementation differs with Firefox, Opera and IE9 (319.42 KB, image/png)
2012-12-13 05:46 PST, witichis
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Delaney 2010-09-24 13:42:43 PDT
This bug will serve as the master bug that will be closed out once all of Philip's test suite's failing tests are fixed or resolved. All bugs for these individual tests should block this one and progress on the overall list of tests should be update here when convenient/sensible. Any help creating the subtask bugs for individual tests would be much appreciated!

Most of these tests require direct fixes but some may require resolving outstanding issues/changes to the spec and then updating the tests/code to reflect these changes. It's also possible that some tests may need to be put back on the skip list indefinitely depending on their issue, such as the globalCompositeOperation.clear test due legacy support that conflicts with the current spec. This example however is being revisited for a possible spec change at the moment.

Here is the current list of failing tests I see on my local Safari build from yesterday:

canvas/philip/tests/2d.composite.operation.darker.html
canvas/philip/tests/2d.composite.operation.highlight.html
canvas/philip/tests/2d.composite.uncovered.fill.copy.html
canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
canvas/philip/tests/2d.composite.uncovered.image.copy.html
canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.image.destination-in.html
canvas/philip/tests/2d.composite.uncovered.image.source-in.html
canvas/philip/tests/2d.composite.uncovered.image.source-out.html
canvas/philip/tests/2d.composite.uncovered.pattern.copy.html
canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
canvas/philip/tests/2d.drawImage.incomplete.html
canvas/philip/tests/2d.drawImage.null.html
canvas/philip/tests/2d.fillStyle.parse.current.basic.html
canvas/philip/tests/2d.fillStyle.parse.current.changed.html
canvas/philip/tests/2d.fillStyle.parse.current.removed.html
canvas/philip/tests/2d.fillStyle.parse.system.html
canvas/philip/tests/2d.gradient.radial.cone.front.html
canvas/philip/tests/2d.gradient.radial.cone.top.html
canvas/philip/tests/2d.gradient.radial.inside2.html
canvas/philip/tests/2d.gradient.radial.inside3.html
canvas/philip/tests/2d.gradient.radial.negative.html
canvas/philip/tests/2d.gradient.radial.outside1.html
canvas/philip/tests/2d.imageData.create1.type.html
canvas/philip/tests/2d.imageData.create2.type.html
canvas/philip/tests/2d.imageData.get.source.negative.html
canvas/philip/tests/2d.imageData.get.type.html
canvas/philip/tests/2d.line.cap.closed.html
canvas/philip/tests/2d.line.join.parallel.html
canvas/philip/tests/2d.line.miter.lineedge.html
canvas/philip/tests/2d.missingargs.html
canvas/philip/tests/2d.path.rect.winding.html
canvas/philip/tests/2d.pattern.image.broken.html
canvas/philip/tests/2d.pattern.image.incomplete.html
canvas/philip/tests/2d.pattern.image.null.html
canvas/philip/tests/2d.pattern.image.undefined.html
canvas/philip/tests/2d.shadow.enable.blur.html
canvas/philip/tests/2d.shadow.enable.x.html
canvas/philip/tests/2d.shadow.enable.y.html
canvas/philip/tests/2d.shadow.gradient.alpha.html
canvas/philip/tests/2d.shadow.gradient.basic.html
canvas/philip/tests/2d.shadow.gradient.transparent.2.html
canvas/philip/tests/2d.strokeRect.zero.4.html
canvas/philip/tests/2d.text.draw.baseline.bottom.html
canvas/philip/tests/2d.text.draw.baseline.hanging.html
canvas/philip/tests/2d.text.draw.baseline.ideographic.html
canvas/philip/tests/2d.text.draw.baseline.middle.html
canvas/philip/tests/2d.text.draw.baseline.top.html
canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html
canvas/philip/tests/2d.text.draw.space.collapse.end.html
canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html
canvas/philip/tests/2d.text.draw.space.collapse.other.html
canvas/philip/tests/2d.text.draw.space.collapse.space.html
canvas/philip/tests/2d.text.draw.space.collapse.start.html
canvas/philip/tests/2d.text.font.parse.basic.html
canvas/philip/tests/2d.text.font.parse.complex.html
canvas/philip/tests/2d.text.font.parse.invalid.html
canvas/philip/tests/2d.text.font.parse.size.percentage.default.html
canvas/philip/tests/2d.text.font.parse.size.percentage.html
canvas/philip/tests/2d.text.font.parse.system.html
canvas/philip/tests/2d.text.measure.width.space.html
canvas/philip/tests/toDataURL.jpeg.alpha.html
canvas/philip/tests/type.prototype.html
Comment 1 James Robinson 2010-09-24 13:48:04 PDT
I've categorized a number of these tests locally, here are my notes so far:


// We fail these three tests because we recognize 'clear', 'darker', and
// 'highlight' as valid globalCompositeOperations but the spec does not.
// Firefox fails on 'clear' but passes on 'darker', 'highlight'.
// Opera passes on all.
canvas/philip/tests/2d.composite.operation.clear.html
canvas/philip/tests/2d.composite.operation.darker.html
canvas/philip/tests/2d.composite.operation.highlight.html

// We fail these because we only apply the globalCompositeOperation within
// the bounds of a draw.  Firefox passes most of these, Opera passes all.
canvas/philip/tests/2d.composite.uncovered.fill.copy.html
canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
canvas/philip/tests/2d.composite.uncovered.image.copy.html
canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.image.destination-in.html
canvas/philip/tests/2d.composite.uncovered.image.source-in.html
canvas/philip/tests/2d.composite.uncovered.image.source-out.html
canvas/philip/tests/2d.composite.uncovered.pattern.copy.html
canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html

// Firefox and Opera fail these too. Seems we should pass
canvas/philip/tests/2d.drawImage.broken.html
canvas/philip/tests/2d.drawImage.incomplete.html
canvas/philip/tests/2d.pattern.image.broken.html
canvas/philip/tests/2d.pattern.image.incomplete.html

// Firefox and Opera fail, but differently.  They uses the fillStyle color set before
// the assignment to 'currentColor', we use rgba(0,0,0,0).
// From inspector it's a WebKit bug, we should do either what the spec says or
// what FFx does.
canvas/philip/tests/2d.fillStyle.parse.current.basic.html
canvas/philip/tests/2d.fillStyle.parse.current.changed.html
canvas/philip/tests/2d.fillStyle.parse.current.removed.html
canvas/philip/tests/2d.fillStyle.parse.system.html

// We don't seem to draw the gradient at all? FFx does, Opera doesn't
canvas/philip/tests/2d.gradient.radial.cone.top.html

// FFx fails the same way.  We check isfinite but not negative values. Opera passes.
canvas/philip/tests/2d.gradient.radial.negative.html

// Don't seem to have a CanvasPixelArray ctor on the window. FFx/Opera don't either
canvas/philip/tests/2d.imageData.create1.type.html
canvas/philip/tests/2d.imageData.create2.type.html
canvas/philip/tests/2d.imageData.get.type.html

// We fail to do the right math here.  FFx/Opera abort with exception
canvas/philip/tests/2d.imageData.get.source.negative.html

// We agree with FFx here on wrapping/rounding behavior.  Opera matches
// the test.
// This behavior is covered by WebIDL's definition of the 'octet' type.
canvas/philip/tests/2d.imageData.object.round.html
canvas/philip/tests/2d.imageData.object.wrap.html

// We're inconsistent about what error we generate for these.
// FFx always generates 'Not enough arguments' which is not what the spec
// says but is probably more useful.
canvas/philip/tests/2d.missingargs.html

// We pass these (on linux at least)
canvas/philip/tests/2d.path.arcTo.coincide.1.html
canvas/philip/tests/2d.path.stroke.prune.arc.html

// We throw the wrong error. FFx also throws the wrong error here
canvas/philip/tests/2d.pattern.image.undefined.html

// FFx passes, we should too.
canvas/philip/tests/2d.path.rect.winding.html
canvas/philip/tests/2d.shadow.enable.blur.html
canvas/philip/tests/2d.shadow.gradient.alpha.html
canvas/philip/tests/2d.shadow.gradient.basic.html
canvas/philip/tests/2d.shadow.gradient.transparent.2.html

// We fail all of these as does Opera.
// Firefox passes these
canvas/philip/tests/2d.text.draw.baseline.bottom.html
canvas/philip/tests/2d.text.draw.baseline.hanging.html
canvas/philip/tests/2d.text.draw.baseline.top.html
// FFx fails these as well
canvas/philip/tests/2d.text.draw.baseline.ideographic.html
canvas/philip/tests/2d.text.draw.baseline.middle.html

// FFx and Opera pass.
canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html

// Opera passes, FFx fails but apparently with a different issue.
canvas/philip/tests/2d.text.draw.space.collapse.end.html
canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html

// FFx and Opera also fail
canvas/philip/tests/2d.text.draw.space.collapse.other.html

// Opera fails same way we do, FFx fails differently
canvas/philip/tests/2d.text.draw.space.collapse.space.html
canvas/philip/tests/2d.text.draw.space.collapse.start.html

// We produce an uppercase string as does FFx. Opera agrees with test.
// CSSOM appears to require lowercase keywords
canvas/philip/tests/2d.text.font.parse.basic.html

// Opera passes, we serialize differently from FFx and from the test
canvas/philip/tests/2d.text.font.parse.complex.html

// We fail more that FFx/Opera do
canvas/philip/tests/2d.text.font.parse.invalid.html

// FFx and Opera fail in the same way
canvas/philip/tests/2d.text.font.parse.size.percentage.default.html
canvas/philip/tests/2d.text.font.parse.size.percentage.html

// FFx passes, Opera fails the same way
canvas/philip/tests/2d.text.font.parse.system.html

// FFx and Opera fail differently from each other and from us
canvas/philip/tests/2d.text.measure.width.space.html

// Opera passes, FFx only fails on window.HTMLCanvasElement.prototype.getContext === undefined
canvas/philip/tests/type.prototype.html


I've also looked at a few of these in IE9 beta.  The most significant data point from the IE9 beta is that they still do not implement globalCompositeOperation at all.
Comment 2 James Robinson 2010-10-04 17:15:24 PDT
The resolution to http://www.w3.org/Bugs/Public/show_bug.cgi?id=10930 should fix canvas/philip/tests/2d.imageData.object.round.html and canvas/philip/tests/2d.imageData.object.wrap.html for us by changing the WebIDL behavior to not be so stupid.
Comment 3 Matthew Delaney 2010-11-07 15:35:00 PST
Blindly copied list of newly added philip canvas tests that we're also failing. (Some may be repeats from original list)

# Failing tests after sync with Philip Taylor's upstream tests
canvas/philip/tests/2d.drawImage.image.incomplete.omitted.html
canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-6.html
canvas/philip/tests/2d.fillStyle.parse.rgb-eof.html
canvas/philip/tests/2d.fillStyle.parse.rgba-eof.html
canvas/philip/tests/2d.imageData.put.wrongtype.html
canvas/philip/tests/2d.pattern.image.incomplete.empty.html
canvas/philip/tests/2d.pattern.image.incomplete.omitted.html
canvas/philip/tests/security.drawImage.canvas.html
canvas/philip/tests/security.drawImage.image.html
canvas/philip/tests/security.pattern.canvas.fillStyle.html
canvas/philip/tests/security.pattern.canvas.strokeStyle.html
canvas/philip/tests/security.reset.html
Comment 4 Philip Rogers 2011-05-24 06:20:44 PDT
I've started work on implementing the optional maxWidth parameter in fillText() which will let us pass canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html
Comment 5 Philip Rogers 2011-05-25 07:38:15 PDT
Created attachment 94780 [details]
Fixes the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test

Implement maxWidth for fillText and strokeText, fixing the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test. See bug https://bugs.webkit.org/show_bug.cgi?id=46506
Comment 6 WebKit Review Bot 2011-05-25 07:39:55 PDT
Attachment 94780 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1990:  One line control clauses should not use braces.  [whitespace/braces] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Andreas Kling 2011-05-25 08:33:11 PDT
Comment on attachment 94780 [details]
Fixes the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test

View in context: https://bugs.webkit.org/attachment.cgi?id=94780&action=review

Also, this patch should be on its own bug, and that bug should block 46506.

> Source/WebCore/ChangeLog:7
> +        No new tests. (OOPS!)

You should remove the now-passing test(s) from the relevant skip lists.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1868
> +    if (useMaxWidth && maxWidth <= 0)
> +        return;

We should also return if !isfinite(maxWidth).
(HTML5: "Except where otherwise specified, for the 2D context interface, any method call with a numeric argument whose value is infinite or a NaN value must be ignored.")

> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1909
> +    if (fontWidth <= 0)
> +        return;

This check should be right after assigning to 'fontWidth'.
Comment 8 Rafael Brandao 2012-05-24 13:03:06 PDT
 > // We fail these three tests because we recognize 'clear', 'darker', and
> // 'highlight' as valid globalCompositeOperations but the spec does not.
> // Firefox fails on 'clear' but passes on 'darker', 'highlight'.
> // Opera passes on all.
> canvas/philip/tests/2d.composite.operation.clear.html
> canvas/philip/tests/2d.composite.operation.darker.html
> canvas/philip/tests/2d.composite.operation.highlight.html
> 

Clear and darker are still failing for us. Highlight has been dropped it seems. Should we still keep the support for clear and darker? If we are keeping those, should we at least update the expected result for webkit with a failure for those tests or just keep them skipped on all ports?
Comment 9 witichis 2012-12-13 05:46:36 PST
Created attachment 179257 [details]
canvas globalCompositeOperation implementation differs with Firefox, Opera and IE9

here the code to this test:

<!DOCTYPE html>
<html>
<head>
</head>
<body>

Canvas ctx.globalCompositeOperation test <br>
<b><script>document.write( 
	document.URL.toString().split('#')[1] )</script></b>
<script type="text/javascript">
var ops =
['source-over',
'source-in',
'source-out',
'source-atop',
'destination-over',
'destination-in',
'destination-out',
'destination-atop',
'lighter', 
'copy', 
'xor'];

for(i in ops ){
	drawcan(ops[i]);
}

function drawcan(op){
	di = document.createElement('div');
	document.body.appendChild(di);
	di.innerHTML = op;
	di.style.width = '200';
	di.style.height = '70';
	di.style.border = '1px black solid';
	di.style.margin = '1px';
	can = document.createElement('canvas');
	di.appendChild(can);
	can.width = '40';
	can.height = '60';
	ctx = can.getContext('2d');
	ctx.font = "50px Impact";
	ctx.fillStyle = '#ff0000'; 
	ctx.fillText('A', 10,  40 );
	ctx.globalCompositeOperation = op;
	ctx.fillStyle = '#0000ff'; 
	ctx.fillText('B', 10,  60 );
}
</script>
</body>
</html>