Bug 828173 patch 1: Add nsLayoutUtils::GetReferenceFrame. r=mattwoodrow

This commit is contained in:
L. David Baron 2014-03-04 20:13:21 -08:00
parent 2b83b4d126
commit 69150cf2a4
2 changed files with 30 additions and 0 deletions

View File

@ -4787,6 +4787,22 @@ nsLayoutUtils::GetDisplayRootFrame(nsIFrame* aFrame)
}
}
/* static */ nsIFrame*
nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame)
{
nsIFrame *f = aFrame;
for (;;) {
if (f->IsTransformed() || IsPopup(f)) {
return f;
}
nsIFrame* parent = GetCrossDocParentFrame(f);
if (!parent) {
return f;
}
f = parent;
}
}
/* static */ uint32_t
nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
const nsStyleFont* aStyleFont,

View File

@ -1516,6 +1516,20 @@ public:
*/
static nsIFrame* GetDisplayRootFrame(nsIFrame* aFrame);
/**
* Get the reference frame that would be used when constructing a
* display item for this frame. (Note, however, that
* nsDisplayTransform use the reference frame appropriate for their
* parent, rather than using their own frame as a reference frame.)
*
* This duplicates some of the logic of GetDisplayRootFrame above and
* of nsDisplayListBuilder::FindReferenceFrameFor.
*
* If you have an nsDisplayListBuilder, you should get the reference
* frame from it instead of calling this.
*/
static nsIFrame* GetReferenceFrame(nsIFrame* aFrame);
/**
* Get textrun construction flags determined by a given style; in particular
* some combination of: