W3C home > Mailing lists > Public > www-style@w3.org > September 2013

Re: [CSSOM] Revisiting transforms and getBoundingClientRect()

From: Simon Pieters <simonp@opera.com>
Date: Wed, 25 Sep 2013 14:51:34 +0200
To: "Tab Atkins Jr." <jackalmage@gmail.com>, "Robert O'Callahan" <robert@ocallahan.org>
Cc: "Simon Fraser" <smfr@me.com>, "Andrew Dupont" <w3@andrewdupont.net>, www-style <www-style@w3.org>
Message-ID: <op.w3ywn8cdidj3kv@simons-macbook-pro.local>
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

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:32 UTC