mirror of
https://github.com/roytam1/UXP.git
synced 2026-07-20 22:18:32 +00:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
@@ -9337,3 +9337,28 @@ nsLayoutUtils::ComputeGeometryBox(nsIFrame* aFrame,
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* static */ nsStyleContext*
|
||||
nsLayoutUtils::GetNonAnonymousStyleContext(nsIFrame* aFrame)
|
||||
{
|
||||
nsIContent* node = aFrame->GetContent();
|
||||
MOZ_ASSERT(node, "No content for the given frame?");
|
||||
while (node && node->IsInNativeAnonymousSubtree()) {
|
||||
node = node->GetParent();
|
||||
}
|
||||
MOZ_ASSERT(node, "Native anonymous element with no originating node?");
|
||||
if (nsIFrame* primaryFrame = node->GetPrimaryFrame()) {
|
||||
return primaryFrame->StyleContext();
|
||||
}
|
||||
// If the element doesn't have primary frame, get the computed style
|
||||
// from the element directly.
|
||||
nsPresContext* pc = aFrame->PresContext();
|
||||
MOZ_ASSERT(node == pc->Document()->GetRootElement(),
|
||||
"Root element is the only case for this fallback "
|
||||
"path to be triggered");
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
pc->StyleSet()->ResolveStyleFor(node->AsElement(), nullptr);
|
||||
// Dropping the strong reference is fine because the style should be
|
||||
// held strongly by the element.
|
||||
return styleContext.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user