Re: [CSSOM] Revisiting transforms and getBoundingClientRect()

On Fri, 20 Sep 2013 23:57:52 +0200, Robert O'Callahan  
<robert@ocallahan.org> wrote:

> On Sat, Sep 21, 2013 at 5:11 AM, Tab Atkins Jr.  
> <jackalmage@gmail.com>wrote:
>
>> On Thu, Sep 19, 2013 at 8:30 PM, Robert O'Callahan  
>> <robert@ocallahan.org>
>> wrote:
>> > For DOMRect I suggest:
>> > [Constructor(double left, double top, double width, double height)]
>> > For DOMQuad:
>> > [Constructor(DOMRect rect),
>> >  Constructor(DOMPoint p1, DOMPoint p2, DOMPoint p3, DOMPoint p4)]
>>
>> Yeah, these are all good.
>>
>> > One question about the DOMRect constructor: Should we allow negative
>> > width/height? I think not. (And APIs should never create DOMRects with
>> > negative width/height.)
>>
>> We should "allow", where that means at least "not throw".  I'm
>> undecided on whether it should clamp to zero, or just construct the
>> appropriate rectangle (with a top/left different from what you passed
>> in).  Or just go ahead and allow negative width/height directly, with
>> the obvious mapping to a quad?  That would mean that the top/left
>> properties aren't actually the top left corner of the shape, though.
>>
>
> Yes, that sounds bad. I think it'd be best to have the DOMRect  
> constructor
> flip things around to ensure that width and height are not negative.

If the DOMRect attributes are mutable, we can end up with negative  
width/height anyway. Unless we add more magic to the attributes, but that  
seems quite confusing.

If the author specifies a negative width/height in the constructor, why  
should we flip it? Isn't it expected to get what you ask for?

-- 
Simon Pieters
Opera Software

Received on Wednesday, 25 September 2013 12:52:07 UTC