Bug 42211

Summary: Canvas: rect(x,y,w,h) should move to (x,y) even if w=0 and h=0
Product: WebKit Reporter: Andreas Kling <kling>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: HTML5
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed patch darin: review+, kling: commit-queue-

Andreas Kling
Reported 2010-07-13 16:37:42 PDT
Quoth HTML5: The rect(x, y, w, h) method must create a new subpath containing just the four points (x, y), (x+w, y), (x+w, y+h), (x, y+h), with those four points connected by straight lines, and must then mark the subpath as closed. It must then create a new subpath with the point (x, y) as the only point in the subpath. This would fix one in-tree layout test: - canvas/philip/tests/2d.path.rect.zero.4.html Spec link: http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-rect
Attachments
Proposed patch (3.47 KB, patch)
2010-07-13 16:40 PDT, Andreas Kling
darin: review+
kling: commit-queue-
Andreas Kling
Comment 1 2010-07-13 16:40:45 PDT
Created attachment 61433 [details] Proposed patch
Darin Adler
Comment 2 2010-07-13 17:18:57 PDT
Comment on attachment 61433 [details] Proposed patch Do we still need the validateRectForCanvas function? Can we refactor it so we can still use it? > + if (!isfinite(x) | !isfinite(y) | !isfinite(width) | !isfinite(height)) > + return; Why "|" instead of "||"? > + if (width < 0) { > + width = -width; > + x -= width; > + } > + > + if (height < 0) { > + height = -height; > + y -= height; > + } It’s inelegant to modify the arguments like this. r=me
Andreas Kling
Comment 3 2010-07-13 17:45:43 PDT
Note You need to log in before you can comment on or make changes to this bug.