Bug 1344914 - stylo: Stop pretending to handle style fixups on the C++ side. r=bz

MozReview-Commit-ID: FBM2NOlXIe5

--HG--
extra : rebase_source : b197089498e261a3abc7a50f4f06df92d7478d97
This commit is contained in:
Cameron McCormack 2017-04-25 12:52:51 +08:00
Родитель 0a88649960
Коммит a34d0bbc9d
3 изменённых файлов: 20 добавлений и 30 удалений

Просмотреть файл

@ -212,13 +212,8 @@ ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
{
// XXXbholley: nsStyleSet does visited handling here.
// XXXbholley: Figure out the correct thing to pass here. Does this fixup
// duplicate something that servo already does?
// See bug 1344914.
bool skipFixup = false;
RefPtr<nsStyleContext> result = NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag,
aPseudoType, Move(aComputedValues), skipFixup);
aPseudoType, Move(aComputedValues));
// Set the body color on the pres context. See nsStyleSet::GetContext
if (aElementForAnimation &&
@ -495,12 +490,8 @@ ServoStyleSet::ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
}
#endif
// FIXME(bz, bug 1344914) We should really GetContext here.
// FIXME(heycam) We pass in false for the "skip fixup" argument, since it
// does nothing for nsStyleContexts backed by ServoComputedValues.
return NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag,
CSSPseudoElementType::InheritingAnonBox,
computedValues.forget(), false);
return GetContext(computedValues.forget(), aParentContext, aPseudoTag,
CSSPseudoElementType::InheritingAnonBox, nullptr);
}
already_AddRefed<nsStyleContext>

Просмотреть файл

@ -126,15 +126,15 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
}
mSource.AsGeckoRuleNode()->SetUsedDirectly(); // before ApplyStyleFixups()!
FinishConstruction(aSkipParentDisplayBasedStyleFixup);
FinishConstruction();
ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup);
}
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
nsPresContext* aPresContext,
nsIAtom* aPseudoTag,
CSSPseudoElementType aPseudoType,
already_AddRefed<ServoComputedValues> aComputedValues,
bool aSkipParentDisplayBasedStyleFixup)
already_AddRefed<ServoComputedValues> aComputedValues)
: nsStyleContext(aParent, OwningStyleContextSource(Move(aComputedValues)),
aPseudoTag, aPseudoType)
{
@ -142,11 +142,14 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
mPresContext = aPresContext;
#endif
FinishConstruction(aSkipParentDisplayBasedStyleFixup);
FinishConstruction();
// No need to call ApplyStyleFixups here, since fixups are handled by Servo when
// producing the ServoComputedValues.
}
void
nsStyleContext::FinishConstruction(bool aSkipParentDisplayBasedStyleFixup)
nsStyleContext::FinishConstruction()
{
// This check has to be done "backward", because if it were written the
// more natural way it wouldn't fail even when it needed to.
@ -169,13 +172,10 @@ nsStyleContext::FinishConstruction(bool aSkipParentDisplayBasedStyleFixup)
}
SetStyleBits();
if (!mSource.IsServoComputedValues()) {
ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup);
}
#define eStyleStruct_LastItem (nsStyleStructID_Length - 1)
NS_ASSERTION(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
"NS_STYLE_INHERIT_MASK must be bigger, and other bits shifted");
static_assert(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
"NS_STYLE_INHERIT_MASK must be bigger, and other bits shifted");
#undef eStyleStruct_LastItem
}
@ -1394,13 +1394,12 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
nsPresContext* aPresContext,
nsIAtom* aPseudoTag,
CSSPseudoElementType aPseudoType,
already_AddRefed<ServoComputedValues> aComputedValues,
bool aSkipParentDisplayBasedStyleFixup)
already_AddRefed<ServoComputedValues> aComputedValues)
{
RefPtr<nsStyleContext> context =
new (aPresContext)
nsStyleContext(aParentContext, aPresContext, aPseudoTag, aPseudoType,
Move(aComputedValues), aSkipParentDisplayBasedStyleFixup);
Move(aComputedValues));
return context.forget();
}

Просмотреть файл

@ -90,8 +90,7 @@ public:
nsPresContext* aPresContext,
nsIAtom* aPseudoTag,
mozilla::CSSPseudoElementType aPseudoType,
already_AddRefed<ServoComputedValues> aComputedValues,
bool aSkipParentDisplayBasedStyleFixup);
already_AddRefed<ServoComputedValues> aComputedValues);
void* operator new(size_t sz, nsPresContext* aPresContext);
void Destroy();
@ -551,7 +550,7 @@ private:
mozilla::CSSPseudoElementType aPseudoType);
// Helper post-contruct hook.
void FinishConstruction(bool aSkipParentDisplayBasedStyleFixup);
void FinishConstruction();
void AddChild(nsStyleContext* aChild);
void RemoveChild(nsStyleContext* aChild);
@ -560,6 +559,8 @@ private:
void* CreateEmptyStyleData(const nsStyleStructID& aSID);
void SetStyleBits();
// Only called for Gecko-backed nsStyleContexts.
void ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup);
const void* StyleStructFromServoComputedValues(nsStyleStructID aSID) {
@ -811,7 +812,6 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
nsPresContext* aPresContext,
nsIAtom* aPseudoTag,
mozilla::CSSPseudoElementType aPseudoType,
already_AddRefed<ServoComputedValues> aComputedValues,
bool aSkipParentDisplayBasedStyleFixup);
already_AddRefed<ServoComputedValues> aComputedValues);
#endif