mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1376655 - Use ServoStyleContext in more places. r=emilio
This commit is contained in:
parent
0025816358
commit
5681b4713c
@ -469,8 +469,8 @@ ServoRestyleManager::ProcessPostTraversal(Element* aElement,
|
||||
// Hold the old style context alive, because it could become a dangling
|
||||
// pointer during the replacement. In practice it's not a huge deal, but
|
||||
// better not playing with dangling pointers if not needed.
|
||||
RefPtr<nsStyleContext> oldStyleContext =
|
||||
styleFrame ? styleFrame->StyleContext() : nullptr;
|
||||
RefPtr<ServoStyleContext> oldStyleContext =
|
||||
styleFrame ? styleFrame->StyleContext()->AsServo() : nullptr;
|
||||
|
||||
UndisplayedNode* displayContentsNode = nullptr;
|
||||
// FIXME(emilio, bug 1303605): This can be simpler for Servo.
|
||||
@ -479,7 +479,7 @@ ServoRestyleManager::ProcessPostTraversal(Element* aElement,
|
||||
displayContentsNode =
|
||||
PresContext()->FrameConstructor()->GetDisplayContentsNodeFor(aElement);
|
||||
if (displayContentsNode) {
|
||||
oldStyleContext = displayContentsNode->mStyle;
|
||||
oldStyleContext = displayContentsNode->mStyle->AsServo();
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ ServoRestyleManager::ProcessPostTraversal(Element* aElement,
|
||||
ServoRestyleState& childrenRestyleState =
|
||||
thisFrameRestyleState ? *thisFrameRestyleState : aRestyleState;
|
||||
|
||||
RefPtr<nsStyleContext> newContext = nullptr;
|
||||
RefPtr<ServoStyleContext> newContext = nullptr;
|
||||
if (recreateContext) {
|
||||
MOZ_ASSERT(styleFrame || displayContentsNode);
|
||||
|
||||
|
@ -418,9 +418,9 @@ ViewportFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
|
||||
void
|
||||
ViewportFrame::UpdateStyle(ServoRestyleState& aRestyleState)
|
||||
{
|
||||
nsStyleContext* oldContext = StyleContext();
|
||||
ServoStyleContext* oldContext = StyleContext()->AsServo();
|
||||
nsIAtom* pseudo = oldContext->GetPseudo();
|
||||
RefPtr<nsStyleContext> newContext =
|
||||
RefPtr<ServoStyleContext> newContext =
|
||||
aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(pseudo, nullptr);
|
||||
|
||||
// We're special because we have a null GetContent(), so don't call things
|
||||
|
@ -13,6 +13,14 @@ namespace mozilla {
|
||||
|
||||
class ServoStyleContext final : public nsStyleContext {
|
||||
public:
|
||||
|
||||
static already_AddRefed<ServoStyleContext>
|
||||
Create(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
mozilla::CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues);
|
||||
|
||||
ServoStyleContext(nsStyleContext* aParent,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
|
@ -259,7 +259,7 @@ ServoStyleSet::ResolveStyleFor(Element* aElement,
|
||||
CSSPseudoElementType::NotPseudo, aMayCompute);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ServoStyleSet::GetContext(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
@ -283,7 +283,7 @@ ServoStyleSet::GetContext(nsIContent* aContent,
|
||||
element);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
@ -323,14 +323,14 @@ ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
bool relevantLinkVisited = isLink ? isVisitedLink :
|
||||
(aParentContext && aParentContext->RelevantLinkVisited());
|
||||
|
||||
RefPtr<nsStyleContext> result =
|
||||
NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag, aPseudoType,
|
||||
computedValues.forget());
|
||||
RefPtr<ServoStyleContext> result =
|
||||
ServoStyleContext::Create(aParentContext, mPresContext, aPseudoTag, aPseudoType,
|
||||
computedValues.forget());
|
||||
|
||||
if (visitedComputedValues) {
|
||||
RefPtr<nsStyleContext> resultIfVisited =
|
||||
NS_NewStyleContext(parentIfVisited, mPresContext, aPseudoTag, aPseudoType,
|
||||
visitedComputedValues.forget());
|
||||
RefPtr<ServoStyleContext> resultIfVisited =
|
||||
ServoStyleContext::Create(parentIfVisited, mPresContext, aPseudoTag, aPseudoType,
|
||||
visitedComputedValues.forget());
|
||||
resultIfVisited->SetIsStyleIfVisited();
|
||||
result->SetStyleIfVisited(resultIfVisited.forget());
|
||||
|
||||
@ -621,7 +621,7 @@ ServoStyleSet::ResolveTransientServoStyle(
|
||||
return ResolveStyleLazily(aElement, aPseudoType, aRuleInclusion);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ServoStyleSet::ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ class ServoRestyleManager;
|
||||
class ServoStyleSheet;
|
||||
struct Keyframe;
|
||||
class ServoElementSnapshotTable;
|
||||
class ServoStyleContext;
|
||||
class ServoStyleRuleMap;
|
||||
} // namespace mozilla
|
||||
class nsCSSCounterStyleRule;
|
||||
@ -226,7 +227,7 @@ public:
|
||||
// Get a style context for an anonymous box. aPseudoTag is the pseudo-tag to
|
||||
// use and must be non-null. It must be an anon box, and must be one that
|
||||
// inherits style from the given aParentContext.
|
||||
already_AddRefed<nsStyleContext>
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
@ -492,17 +493,17 @@ private:
|
||||
ServoStyleSet* mSet;
|
||||
};
|
||||
|
||||
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
dom::Element* aElementForAnimation);
|
||||
already_AddRefed<ServoStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
dom::Element* aElementForAnimation);
|
||||
|
||||
already_AddRefed<nsStyleContext> GetContext(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
LazyComputeBehavior aMayCompute);
|
||||
already_AddRefed<ServoStyleContext> GetContext(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
LazyComputeBehavior aMayCompute);
|
||||
|
||||
/**
|
||||
* Rebuild the style data. This will force a stylesheet flush, and also
|
||||
|
@ -641,8 +641,8 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
|
||||
RefPtr<ServoComputedValues> baseComputedValues =
|
||||
presContext->StyleSet()->AsServo()->
|
||||
GetBaseComputedValuesForElement(aElement, pseudoType);
|
||||
return NS_NewStyleContext(nullptr, presContext, aPseudo,
|
||||
pseudoType, baseComputedValues.forget());
|
||||
return ServoStyleContext::Create(nullptr, presContext, aPseudo,
|
||||
pseudoType, baseComputedValues.forget());
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,8 +676,8 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
|
||||
|
||||
RefPtr<ServoComputedValues> baseComputedValues =
|
||||
servoSet->GetBaseComputedValuesForElement(aElement, pseudoType);
|
||||
return NS_NewStyleContext(nullptr, presContext, aPseudo,
|
||||
pseudoType, baseComputedValues.forget());
|
||||
return ServoStyleContext::Create(nullptr, presContext, aPseudo,
|
||||
pseudoType, baseComputedValues.forget());
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> parentContext;
|
||||
|
@ -634,20 +634,23 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues)
|
||||
namespace mozilla {
|
||||
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ServoStyleContext::Create(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues)
|
||||
{
|
||||
RefPtr<nsStyleContext> context =
|
||||
new
|
||||
ServoStyleContext(aParentContext, aPresContext, aPseudoTag, aPseudoType,
|
||||
Move(aComputedValues));
|
||||
RefPtr<ServoStyleContext> context =
|
||||
new ServoStyleContext(aParentContext, aPresContext, aPseudoTag, aPseudoType,
|
||||
Move(aComputedValues));
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
nsIPresShell*
|
||||
nsStyleContext::Arena()
|
||||
{
|
||||
|
@ -511,11 +511,4 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsRuleNode* aRuleNode,
|
||||
bool aSkipParentDisplayBasedStyleFixup);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
mozilla::CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user