This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26097 - Bounds of DOMQuad not computed correctly
Summary: Bounds of DOMQuad not computed correctly
Status: RESOLVED FIXED
Alias: None
Product: FXTF
Classification: Unclassified
Component: Geometry (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: sideshowbarker+geometry
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-15 06:46 UTC by Dirk Schulze
Modified: 2014-06-15 07:33 UTC (History)
1 user (show)

See Also:


Attachments

Description Dirk Schulze 2014-06-15 06:46:28 UTC
The bounds for

    new DOMQuad(new DOMRect(0,0,-100,-100))

are not computed correctly. IMO there is no reason why the width and height should be negative for the example above.
Comment 1 Dirk Schulze 2014-06-15 07:19:56 UTC
With the old description, bounds would have returned a DOMRectReadOnly with (0,0,-100,-100).

I added an algorithm how to compute the associate bounding rect. All constructors and the bounds attribute itself reference this algorithm now:

1. Let bounds be a new DOMRectReadOnly object.
2. Let left of bounds be the minimum of p1.x, p2.x, p3.x and p4.x.
3. Let top of bounds be the minimum of p1.y, p2.y, p3.y and p4.y.
4. Let right of bounds be the maximum of p1.x, p2.x, p3.x and p4.x.
5. Let bottom of bounds be the maximum of p1.y, p2.y, p3.y and p4.y.
6. Set x of bounds to left, y of bounds to top, width of bounds to right - left and height of bounds to bottom - top.

http://dev.w3.org/fxtf/geometry/#associated-bounding-rectangle