--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -146,38 +146,34 @@ DocumentNeedsRestyle(
}
} else if (aPseudo == nsCSSPseudoElements::after) {
if (EffectSet::GetEffectSet(aElement, CSSPseudoElementType::after)) {
return true;
}
}
}
- if (styleSet->IsServo()) {
- // For Servo, we need to process the restyle-hint-invalidations first, to
- // expand LaterSiblings hint, so that we can look whether ancestors need
- // restyling.
- ServoRestyleManager* restyleManager =
- presContext->RestyleManager()->AsServo();
- restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
-
- if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
- !aDocument->GetServoRestyleRoot()) {
- return false;
- }
-
- // Then if there is a restyle root, we check if the root is an ancestor of
- // this content. If it is not, then we don't need to restyle immediately.
- // Note this is different from Gecko: we only check if any ancestor needs
- // to restyle _itself_, not descendants, since dirty descendants can be
- // another subtree.
- return restyleManager->HasPendingRestyleAncestor(aElement);
- }
-
- MOZ_CRASH("old style system disabled");
+ // For Servo, we need to process the restyle-hint-invalidations first, to
+ // expand LaterSiblings hint, so that we can look whether ancestors need
+ // restyling.
+ ServoRestyleManager* restyleManager =
+ presContext->RestyleManager()->AsServo();
+ restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
+
+ if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
+ !aDocument->GetServoRestyleRoot()) {
+ return false;
+ }
+
+ // Then if there is a restyle root, we check if the root is an ancestor of
+ // this content. If it is not, then we don't need to restyle immediately.
+ // Note this is different from Gecko: we only check if any ancestor needs
+ // to restyle _itself_, not descendants, since dirty descendants can be
+ // another subtree.
+ return restyleManager->HasPendingRestyleAncestor(aElement);
}
/**
* An object that represents the ordered set of properties that are exposed on
* an nsComputedDOMStyle object and how their computed values can be obtained.
*/
struct ComputedStyleMap
{
@@ -420,17 +416,17 @@ uint32_t
nsComputedDOMStyle::Length()
{
uint32_t length = GetComputedStyleMap()->Length();
// Make sure we have up to date style so that we can include custom
// properties.
UpdateCurrentStyleSources(false);
if (mComputedStyle) {
- length += Servo_GetCustomPropertiesCount(mComputedStyle->AsServo());
+ length += Servo_GetCustomPropertiesCount(mComputedStyle);
}
ClearCurrentStyleSources();
return length;
}
css::Rule*
@@ -506,26 +502,17 @@ nsComputedDOMStyle::DoGetComputedStyleNo
// set. Using the pres shell from the content also means that any
// content that's actually *in* a document will get the style from the
// correct document.
nsIPresShell* presShell = nsContentUtils::GetPresShellForContent(aElement);
bool inDocWithShell = true;
if (!presShell) {
inDocWithShell = false;
presShell = aPresShell;
- if (!presShell)
- return nullptr;
-
- // In some edge cases, the caller document might be using a different style
- // backend than the callee. This causes problems because the cached parsed
- // style attributes in the callee document will be a different format than
- // the caller expects. Supporting this would be a pain, and we're already
- // in edge-case-squared, so we just return.
- if (presShell->GetDocument()->GetStyleBackendType() !=
- aElement->OwnerDoc()->GetStyleBackendType()) {
+ if (!presShell) {
return nullptr;
}
}
// We do this check to avoid having to add too much special casing of
// Servo functions we call to explicitly ignore any element data in
// the tree. (See comment in ServoStyleSet::ResolveStyleLazily.)
MOZ_RELEASE_ASSERT((aStyleType == eAll && aAnimationFlag == eWithAnimation) ||
@@ -560,45 +547,41 @@ nsComputedDOMStyle::DoGetComputedStyleNo
if (frame) {
ComputedStyle* result = frame->Style();
// Don't use the style if it was influenced by pseudo-elements, since then
// it's not the primary style for this element / pseudo.
if (!MustReresolveStyle(result)) {
// The existing style may have animation styles so check if we need to
// remove them.
if (aAnimationFlag == eWithoutAnimation) {
- nsPresContext* presContext = presShell->GetPresContext();
- MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame");
- if (presContext && presContext->StyleSet()->IsGecko()) {
- MOZ_CRASH("old style system disabled");
- } else {
- Element* elementOrPseudoElement =
- EffectCompositor::GetElementToRestyle(aElement, pseudoType);
- if (!elementOrPseudoElement) {
- return nullptr;
- }
- return presContext->StyleSet()->AsServo()->
- GetBaseContextForElement(elementOrPseudoElement,
- presContext,
- result->AsServo());
+ nsPresContext* presContext = frame->PresContext();
+ Element* elementOrPseudoElement =
+ EffectCompositor::GetElementToRestyle(aElement, pseudoType);
+ if (!elementOrPseudoElement) {
+ return nullptr;
}
+ return presContext->StyleSet()->AsServo()->
+ GetBaseContextForElement(elementOrPseudoElement,
+ presContext,
+ result);
}
RefPtr<ComputedStyle> ret = result;
return ret.forget();
}
}
}
// No frame has been created, or we have a pseudo, or we're looking
// for the default style, so resolve the style ourselves.
nsPresContext* presContext = presShell->GetPresContext();
- if (!presContext)
+ if (!presContext) {
return nullptr;
+ }
ServoStyleSet* styleSet = presShell->StyleSet()->AsServo();
StyleRuleInclusion rules = aStyleType == eDefaultOnly
? StyleRuleInclusion::DefaultOnly
: StyleRuleInclusion::All;
RefPtr<ComputedStyle> result =
styleSet->ResolveStyleLazily(aElement, pseudoType, rules);
@@ -984,27 +967,22 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
mPresShell->GetPresContext()->GetUndisplayedRestyleGeneration(),
"why should we have flushed style again?");
SetResolvedComputedStyle(Move(resolvedComputedStyle), currentGeneration);
NS_ASSERTION(mPseudo || !mComputedStyle->HasPseudoElementData(),
"should not have pseudo-element data");
}
- if (mAnimationFlag == eWithoutAnimation) {
- MOZ_CRASH("old style system disabled");
- }
-
// mExposeVisitedStyle is set to true only by testing APIs that
// require chrome privilege.
MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(),
"mExposeVisitedStyle set incorrectly");
if (mExposeVisitedStyle && mComputedStyle->RelevantLinkVisited()) {
- ComputedStyle *styleIfVisited = mComputedStyle->GetStyleIfVisited();
- if (styleIfVisited) {
+ if (ComputedStyle* styleIfVisited = mComputedStyle->GetStyleIfVisited()) {
mComputedStyle = styleIfVisited;
}
}
}
void
nsComputedDOMStyle::ClearCurrentStyleSources()
{
@@ -1132,17 +1110,17 @@ nsComputedDOMStyle::IndexedGetter(uint32
uint32_t count =
Servo_GetCustomPropertiesCount(mComputedStyle);
const uint32_t index = aIndex - length;
if (index < count) {
aFound = true;
nsString varName;
- Servo_GetCustomPropertyNameAt(mComputedStyle->AsServo(), index, &varName);
+ Servo_GetCustomPropertyNameAt(mComputedStyle, index, &varName);
aPropName.AssignLiteral("--");
aPropName.Append(varName);
} else {
aFound = false;
}
ClearCurrentStyleSources();
}
@@ -7150,18 +7128,17 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
{
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
nsString variableValue;
const nsAString& name = Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH);
bool present =
- Servo_GetCustomPropertyValue(mComputedStyle->AsServo(), &name,
- &variableValue);
+ Servo_GetCustomPropertyValue(mComputedStyle, &name, &variableValue);
if (!present) {
return nullptr;
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetString(variableValue);
return val.forget();