Closed
Bug 268576
Opened 20 years ago
Closed 20 years ago
[FIXr]Method to get screen coordinates on nsIFrame
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha6
People
(Reporter: aaronlev, Assigned: bzbarsky)
References
Details
(Keywords: memory-footprint)
Attachments
(1 file, 1 obsolete file)
21.13 KB,
patch
|
Details | Diff | Splinter Review |
Spun off from bug 175568. Here's the list of places that Boris mentioned all use some method of getting the screen coordinates from a frame: nsMenuPopupFrame::GetScreenPosition nsSVGSVGElement::GetScreenPosition nsBoxObject::GetScreenRect nsAccessibleText::GetCharacterExtents (this has the COORD_TYPE_WINDOW weirdness, though). Some Inspector code that's unused and removed in my tree...
Assignee | ||
Comment 1•20 years ago
|
||
Note: bug 175568 will add another consumer of this sort of thing.
Target Milestone: --- → mozilla1.8alpha6
Assignee | ||
Comment 2•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #166147 -
Flags: superreview?(roc)
Attachment #166147 -
Flags: review?(roc)
Assignee | ||
Comment 3•20 years ago
|
||
Note that for views I did position, not rect, because the bounds topleft may not match the origins and callers seemed to want the origin.
Summary: Method to get screen coordinates on nsIFrame → [FIX]Method to get screen coordinates on nsIFrame
Reporter | ||
Comment 4•20 years ago
|
||
Doesn't look like we can use this for context menu stuff in nsEventListenerManager after all, since that's not in screen coordinates. Too bad.
Comment on attachment 166147 [details] [diff] [review] Patch + // XXXbz there needs to be a better way to do this scaling + nsIntRect ourPxRect(NSTwipsToIntPixels(ourRect.x, t2p), + NSTwipsToIntPixels(ourRect.y, t2p), + NSTwipsToIntPixels(ourRect.width, t2p), + NSTwipsToIntPixels(ourRect.height, t2p)); There is: nsRect::ScaleRoundOut. With that, r+sr=roc
Attachment #166147 -
Flags: superreview?(roc)
Attachment #166147 -
Flags: superreview+
Attachment #166147 -
Flags: review?(roc)
Attachment #166147 -
Flags: review+
Assignee | ||
Comment 6•20 years ago
|
||
But that rounds out instead of rounding to the nearest int (which is what the code in question does, I think). Do we care?
Summary: [FIX]Method to get screen coordinates on nsIFrame → [FIXr]Method to get screen coordinates on nsIFrame
I don't think so. It really depends on the caller, but I bet that rounding out is always no less correct than rounding to the nearest int.
Assignee | ||
Comment 8•20 years ago
|
||
Sounds good.
Assignee | ||
Comment 9•20 years ago
|
||
Note to self:
> + frameScreenRect.x += NS_TwipsToIntPixels(beforeWidth. t2p);
Should have a comma, not a dot, after beforeWidth (this is in the accessibility
code).
Assignee | ||
Comment 10•20 years ago
|
||
Attachment #166147 -
Attachment is obsolete: true
Assignee | ||
Comment 11•20 years ago
|
||
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 12•20 years ago
|
||
This caused bug 271702 (because that code mis-treated screenY) and bug 271891 (because this patch had an error in it).
Comment 13•20 years ago
|
||
Could this have caused bug 273226?
You need to log in
before you can comment on or make changes to this bug.
Description
•