Bug 858937 patch 1: Add nsLayoutUtils::GetStyleFrame() variant taking nsIContent*, and use it for two existing users of the variant taking nsIFrame*. r=nrc

This commit is contained in:
L. David Baron 2013-06-24 22:32:10 -07:00
parent 79549f98dd
commit 7ec07e319b
4 changed files with 22 additions and 5 deletions

View File

@ -8907,8 +8907,7 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
// our content
nsIContent* content = fixed->GetContent();
nsStyleContext* styleContext =
nsLayoutUtils::GetStyleFrame(content->GetPrimaryFrame())->
StyleContext();
nsLayoutUtils::GetStyleFrame(content)->StyleContext();
FrameConstructionItemList items;
AddFrameConstructionItemsInternal(state, content, canvasFrame,
content->Tag(),

View File

@ -713,6 +713,17 @@ nsLayoutUtils::GetStyleFrame(nsIFrame* aFrame)
return aFrame;
}
nsIFrame*
nsLayoutUtils::GetStyleFrame(const nsIContent* aContent)
{
nsIFrame *frame = aContent->GetPrimaryFrame();
if (!frame) {
return nullptr;
}
return nsLayoutUtils::GetStyleFrame(frame);
}
nsIFrame*
nsLayoutUtils::GetFloatFromPlaceholder(nsIFrame* aFrame) {
NS_ASSERTION(nsGkAtoms::placeholderFrame == aFrame->GetType(),

View File

@ -145,6 +145,14 @@ public:
*/
static nsIFrame* GetStyleFrame(nsIFrame* aPrimaryFrame);
/**
* Given a content node,
* return the frame that has the non-psuedoelement style context for
* the content. May return null.
* This is aContent->GetPrimaryFrame() except for tableOuter frames.
*/
static nsIFrame* GetStyleFrame(const nsIContent* aContent);
/**
* IsGeneratedContentFor returns true if aFrame is the outermost
* frame for generated content of type aPseudoElement for aContent.

View File

@ -307,10 +307,9 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
}
if (!aPseudo && aStyleType == eAll) {
nsIFrame* frame = aElement->GetPrimaryFrame();
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
if (frame) {
nsStyleContext* result =
nsLayoutUtils::GetStyleFrame(frame)->StyleContext();
nsStyleContext* result = frame->StyleContext();
// Don't use the style context if it was influenced by
// pseudo-elements, since then it's not the primary style
// for this element.