Henri Sivonen wrote:
I need to get the following layout data for an element
Who is "I"? That is, where does this code live? nsIFrame is not exactly a
public API...
Furthermore, how do you want to handle elements that are rendered in multiple
places at once (eg <area> elements).
and I think getting it directly off the primary nsIFrame of the element is probably
the way to go.
What if there is no frame?
* Whether the element is being rendered (display: none; or visibility:
hidden;)
Those are two very different things, for what it's worth....
* The rendering width and height of the element's box in CSS px.
This is assuming this box exists, right? What if it doesn't?
* The font size in px.
Is this conditional on the CSS box existing?
For font size, I see code like this around the codebase:
const nsStyleText* styleText = frame->GetStyleText();
Yet, by searching LXR and grepping my CVS sandbox I can't find the
definition of the GetStyleText() method. What am I missing?
It's defined by a macro. See
http://lxr.mozilla.org/seamonkey/source/layout/generic/nsIFrame.h#598
For the width and height, I suppose I should use GetSize(). Am I right?
This is conditional to the answers to my question above.
What's the right way to convert twips into CSS px or vice versa?
NSTwipsToFloatPixels or NSTwipsToIntPixels, both of which need a scaling factor
off the prescontext. Also see NSFloatPixelsToTwips and NSIntPixelsToTwips. For
CSS px you want the ScaledPixels thing on prescontext.
What's the right way to query display: none; and visibility: hidden;?
Again, depends on your answers to my questions above.
Does an element even have a primary nsIFrame if it has display: none;?
No.
-Boris
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout