Bug 1341083: Don't fall back to reframing with display: contents. r=heycam

MozReview-Commit-ID: KD3QBiU7M5f
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-02-21 14:21:07 +01:00
parent 2cbefa7db5
commit b903e8dcf2
3 changed files with 18 additions and 6 deletions

View File

@ -218,7 +218,8 @@ ParentForUndisplayedMap(const nsIContent* aContent)
}
/* static */ nsStyleContext*
nsFrameManager::GetStyleContextInMap(UndisplayedMap* aMap, nsIContent* aContent)
nsFrameManager::GetStyleContextInMap(UndisplayedMap* aMap,
const nsIContent* aContent)
{
UndisplayedNode* node = GetUndisplayedNodeInMapFor(aMap, aContent);
return node ? node->mStyle.get() : nullptr;

View File

@ -102,7 +102,7 @@ public:
void ClearPlaceholderFrameMap();
// Mapping undisplayed content
nsStyleContext* GetUndisplayedContent(nsIContent* aContent)
nsStyleContext* GetUndisplayedContent(const nsIContent* aContent)
{
if (!mUndisplayedMap) {
return nullptr;
@ -127,7 +127,7 @@ public:
/**
* Return the registered display:contents style context for aContent, if any.
*/
nsStyleContext* GetDisplayContentsStyleFor(nsIContent* aContent)
nsStyleContext* GetDisplayContentsStyleFor(const nsIContent* aContent)
{
if (!mDisplayContentsMap) {
return nullptr;
@ -220,7 +220,7 @@ public:
nsILayoutHistoryState* aState);
protected:
static nsStyleContext* GetStyleContextInMap(UndisplayedMap* aMap,
nsIContent* aContent);
const nsIContent* aContent);
static mozilla::UndisplayedNode*
GetUndisplayedNodeInMapFor(UndisplayedMap* aMap,
const nsIContent* aContent);

View File

@ -9,6 +9,7 @@
#include "ChildIterator.h"
#include "gfxFontFamilyList.h"
#include "nsAttrValueInlines.h"
#include "nsCSSFrameConstructor.h"
#include "nsCSSProps.h"
#include "nsCSSParser.h"
#include "nsCSSPseudoElements.h"
@ -279,11 +280,21 @@ Gecko_GetStyleContext(RawGeckoNodeBorrowed aNode, nsIAtom* aPseudoTagOrNull)
nsIFrame* relevantFrame =
ServoRestyleManager::FrameForPseudoElement(aNode->AsContent(),
aPseudoTagOrNull);
if (!relevantFrame) {
if (relevantFrame) {
return relevantFrame->StyleContext();
}
if (aPseudoTagOrNull) {
return nullptr;
}
return relevantFrame->StyleContext();
// FIXME(emilio): Is there a shorter path?
nsCSSFrameConstructor* fc =
aNode->OwnerDoc()->GetShell()->GetPresContext()->FrameConstructor();
// NB: This is only called for CalcStyleDifference, and we handle correctly
// the display: none case since Servo still has the older style.
return fc->GetDisplayContentsStyleFor(aNode->AsContent());
}
nsChangeHint