- From: Charles Pritchard <chuck@jumis.com>
- Date: Thu, 8 Sep 2011 22:44:09 -0700
- To: "robert@ocallahan.org" <robert@ocallahan.org>
- Cc: Simon Fraser <smfr@me.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Andrew Dupont <w3@andrewdupont.net>, "www-style@w3.org" <www-style@w3.org>
- Message-Id: <2B773D88-EDC9-4089-8EE1-7A4C4D38EE04@jumis.com>
CSSRect is a mighty fine prefix. CSSMatrix is waiting in the wings. On Sep 8, 2011, at 10:29 PM, "Robert O'Callahan" <robert@ocallahan.org> wrote: > On Fri, Sep 9, 2011 at 7:01 AM, Simon Fraser <smfr@me.com> wrote: > Sure. With all these new point/quad methods, maybe we should bite the bullet and have a WebPoint class with x, y members. Then WebQuad can have 4 WebPoints. > > The poorly-named ClientRect should become WebRect. > > I don't think we should have "Web" prefixes on Web APIs. If we need a prefix, maybe CSSRect. > > > Having a variety of functions for the content, padding and margin rects seems like overkill; I would prefer one or two "bottleneck" quad mapping functions with helper methods to get the various boxes for a given element. > > > > I'm not quite sure what you mean. Can you suggest something? > > The basic pieces seem to be: > > 1. Get an element's padding, content, border and margin boxes relative to its own border-box, as rects. > 2. Convert a rect to a quad. > 3. Map arbitrary point from one element to another. > 4. Map arbitrary quad from one element to another (mapping 4 points) > > We should make sure each of these steps is available to web developers, possibly with the addition of convenience wrappers. > > That suggests: > > const CONTENT_BOX; > const PADDING_BOX; > const BORDER_BOX; > const MARGIN_BOX; > WebRectList element.localBoxes(boxType); // relative to border-box of first box. > > Quad to rect conversions: > WebQuad rect.toQuad(); > WebRect quad.boundingRect(); > > Would be nice to have a way to convert a WebRectList to a WebQuadList. > > WebPoint element.mapPoint(WebPoint, [relativeTo]) // point is border-box relative on both ends. > WebQuad element.mapQuad(WebQuad, [relativeTo]) // quads are border-box relative on both eneds > WebQuadList element.mapQuads(WebQuadList, [relativeTo]) // ditto > > That breakdown makes a lot of sense. I'd bikeshed a little over the syntax for localBoxes() and boundingRect(). We should definitely use multiple methods instead of a boxType parameter IMHO. > > Rob > -- > "If we claim to be without sin, we deceive ourselves and the truth is not in us. If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness. If we claim we have not sinned, we make him out to be a liar and his word is not in us." [1 John 1:8-10]
Received on Friday, 9 September 2011 05:44:36 UTC