Bug 225263

Summary: Update operations in CanvasImageData.idl to use long rather than float as per spec
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: annevk, cdumez, changseok, esprehn+autocc, ews-watchlist, gyuyoung.kim, hi, kondapallykalyan, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 225140    
Attachments:
Description Flags
Patch
none
Patch none

Sam Weinig
Reported 2021-04-30 18:41:34 PDT
Update operations in CanvasImageData.idl to use long rather than float as per spec
Attachments
Patch (7.64 KB, patch)
2021-04-30 18:42 PDT, Sam Weinig
no flags
Patch (43.64 KB, patch)
2021-05-01 09:15 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2021-04-30 18:42:45 PDT
Sam Weinig
Comment 2 2021-05-01 09:15:39 PDT
Simon Fraser (smfr)
Comment 3 2021-05-01 10:27:08 PDT
Comment on attachment 427498 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427498&action=review I'm a bit nervous about compat fallout from this one. > Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:2172 > + IntSize size { std::abs(sw), std::abs(sh) }; Is this what the spec says; that negative values become positive? Are there tests for it? > Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:2196 > + IntRect imageDataRect { sx, sy, sw, sh }; Presumably the getImageData() call will fail if this rect ends up being outside the backing store rect? What if it's half outside?
Sam Weinig
Comment 4 2021-05-01 10:59:51 PDT
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 427498 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=427498&action=review > > I'm a bit nervous about compat fallout from this one. Anything you would like me to do to make you feel less nervous? All the other engines, according to WPT and my testing have this new behavior. > > > Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:2172 > > + IntSize size { std::abs(sw), std::abs(sh) }; > > Is this what the spec says; that negative values become positive? Are there > tests for it? Yes (it's also not new in the change, I just added some braces). The spec says: "When the createImageData() method is invoked with two numeric arguments sw and sh, it must create an ImageData object, with parameter pixelsPerRow set to the absolute magnitude of sw, and parameter rows set to the absolute magnitude of sh." And yes, we have tests with negatives for these values. > > > Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:2196 > > + IntRect imageDataRect { sx, sy, sw, sh }; > > Presumably the getImageData() call will fail if this rect ends up being > outside the backing store rect? What if it's half outside? This is also not new behavior but no, getImageData() returns transparent black pixels for any pixel outside the backing store. We also have testing of this.
EWS
Comment 5 2021-05-01 13:41:04 PDT
Committed r276877 (237223@main): <https://commits.webkit.org/237223@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427498 [details].
Radar WebKit Bug Importer
Comment 6 2021-05-01 13:42:15 PDT
Anne van Kesteren
Comment 7 2024-09-04 01:26:02 PDT
*** Bug 220496 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.