Open
Bug 1095166
Opened 10 years ago
Updated 2 years ago
Add a method like "ContentRectOriginRelativeToSelf()" to nsIFrame, for layout code that just needs upper-left corner of content rect
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
NEW
People
(Reporter: dholbert, Unassigned)
Details
In bug 624647, I'm finding myself frequently needing the upper-left corner of the content box (in units relative to the frame's rect, i.e. relative to the border-box). Right now, the cleanest way to do this is to use GetContentRectRelativeToSelf().TopLeft() ...or... GetInnerArea().TopLeft(); (GetInnerArea is just a wrapper for GetContentRectRelativeToSelf, in some classes) This is a bit wasteful, as it makes us calculate the full content-box -- e.g. subtracting off borderpadding on the bottom and the right side, which we actually don't care about. We should add a utility function that's equivalent to GetContentRectRelativeToSelf().TopLeft(), but is more efficient by skipping any consideration of bottom/right edges under the hood.
Reporter | ||
Comment 1•10 years ago
|
||
I'm proposing we call this function "GetContentRectOriginRelativeToSelf" (so "ContentRectOrigin" instead of "ContentRect"), but I'm open to alternative names. I probably won't work on this right away, but I might make this a mentored bug.
Comment 2•10 years ago
|
||
I think the "Get" prefix on all these methods is a remnant from an obsolete naming policy and we should drop them. For the new method, "Rect" is superfluous. How about ContentOriginRelativeToSelf() ?
Reporter | ||
Comment 3•10 years ago
|
||
(In reply to Mats Palmgren (:mats) from comment #2) > I think the "Get" prefix on all these methods is a remnant from an obsolete > naming policy and we should drop them. Fair enough, yup. > For the new method, "Rect" is superfluous. > How about ContentOriginRelativeToSelf() ? That seems like it could be confusing/ambiguous... "Content" and "Origin" are both overloaded terms, and "ContentOrigin" sounds like it could mean something about where on the web this frame's content is coming from. In contrast, "ContentRectOrigin" (or maybe even "ContentRectTopLeft"?) is more clearly talking about something spacial.
Summary: Add "GetContentRectOriginRelativeToSelf()", for layout code that just needs upper-left corner of content rect → Add a method like "ContentRectOriginRelativeToSelf()" to nsIFrame, for layout code that just needs upper-left corner of content rect
Comment 4•10 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #3) > That seems like it could be confusing/ambiguous... "Content" and "Origin" > are both overloaded terms, and "ContentOrigin" sounds like it could mean > something about where on the web this frame's content is coming from. It's a nsIFrame method returning a nsPoint so I think you're overestimating the risk for confusion. :-) > In contrast, "ContentRectOrigin" (or maybe even "ContentRectTopLeft"?) is > more clearly talking about something spacial. ContentTopLeft might be clearer that it's a physical position, rather than logical.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•