Bug 93344 - CanvasRenderingContext2D::createPattern() should return null, if non-decodable image argument
Summary: CanvasRenderingContext2D::createPattern() should return null, if non-decodabl...
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-07 01:07 PDT by Jussi Kukkonen (jku)
Modified: 2012-08-08 06:12 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jussi Kukkonen (jku) 2012-08-07 01:07:51 PDT
Spec says: "If the image argument is an HTMLImageElement object that is not fully decodable ... then the implementation must return null." This does not currently happen so these tests fail:
  canvas/philip/tests/2d.pattern.image.broken.html = TEXT
  canvas/philip/tests/2d.pattern.image.incomplete.empty.html = TEXT
  canvas/philip/tests/2d.pattern.image.incomplete.omitted.html = TEXT


HTMLImageElement does not seem to have "decodability" as a property and things are slightly complicated by the img.complete property being slightly illogical for this: currently images with empty, missing or non-existing source are "complete" (and IIRC this is according to current spec). So possibly these cases would have to be tested in CanvasRenderingContext2D. I'll take a closer look, advice is welcome also.
Comment 1 Jussi Kukkonen (jku) 2012-08-07 01:24:11 PDT
to improve searchability: above comment relates to CanvasRenderingContext2D::createPattern()
Comment 2 Jussi Kukkonen (jku) 2012-08-08 06:12:55 PDT
After some testing:

2d.pattern.image.incomplete.omitted:
works after checking image->src().isValid()) before creating pattern

2d.pattern.image.broken:
needs knowledge of whether image really is decodable

2d.pattern.image.incomplete.empty:
the image url used in createPattern() ends up as the _page_ url because HTMLIMageElement does document().completeURL(). This would still work with knowledge of whether image really is decodable