Bug 1448663: Remove dead code in nsComputedDOMStyle. r=jwatt

MozReview-Commit-ID: 4KggxmlBcRK
This commit is contained in:
Emilio Cobos Álvarez 2018-03-25 15:37:03 +02:00
Родитель dff4e17b14
Коммит d113c535e3
1 изменённых файлов: 31 добавлений и 54 удалений

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

@ -151,28 +151,24 @@ DocumentNeedsRestyle(
} }
} }
if (styleSet->IsServo()) { // For Servo, we need to process the restyle-hint-invalidations first, to
// For Servo, we need to process the restyle-hint-invalidations first, to // expand LaterSiblings hint, so that we can look whether ancestors need
// expand LaterSiblings hint, so that we can look whether ancestors need // restyling.
// restyling. ServoRestyleManager* restyleManager =
ServoRestyleManager* restyleManager = presContext->RestyleManager()->AsServo();
presContext->RestyleManager()->AsServo(); restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
if (!presContext->EffectCompositor()->HasPendingStyleUpdates() && if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
!aDocument->GetServoRestyleRoot()) { !aDocument->GetServoRestyleRoot()) {
return false; 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"); // 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);
} }
/** /**
@ -425,7 +421,7 @@ nsComputedDOMStyle::Length()
// properties. // properties.
UpdateCurrentStyleSources(false); UpdateCurrentStyleSources(false);
if (mComputedStyle) { if (mComputedStyle) {
length += Servo_GetCustomPropertiesCount(mComputedStyle->AsServo()); length += Servo_GetCustomPropertiesCount(mComputedStyle);
} }
ClearCurrentStyleSources(); ClearCurrentStyleSources();
@ -511,16 +507,7 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
if (!presShell) { if (!presShell) {
inDocWithShell = false; inDocWithShell = false;
presShell = aPresShell; presShell = aPresShell;
if (!presShell) 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()) {
return nullptr; return nullptr;
} }
} }
@ -565,21 +552,16 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
// The existing style may have animation styles so check if we need to // The existing style may have animation styles so check if we need to
// remove them. // remove them.
if (aAnimationFlag == eWithoutAnimation) { if (aAnimationFlag == eWithoutAnimation) {
nsPresContext* presContext = presShell->GetPresContext(); nsPresContext* presContext = frame->PresContext();
MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame"); Element* elementOrPseudoElement =
if (presContext && presContext->StyleSet()->IsGecko()) { EffectCompositor::GetElementToRestyle(aElement, pseudoType);
MOZ_CRASH("old style system disabled"); if (!elementOrPseudoElement) {
} else { return nullptr;
Element* elementOrPseudoElement =
EffectCompositor::GetElementToRestyle(aElement, pseudoType);
if (!elementOrPseudoElement) {
return nullptr;
}
return presContext->StyleSet()->AsServo()->
GetBaseContextForElement(elementOrPseudoElement,
presContext,
result->AsServo());
} }
return presContext->StyleSet()->AsServo()->
GetBaseContextForElement(elementOrPseudoElement,
presContext,
result);
} }
RefPtr<ComputedStyle> ret = result; RefPtr<ComputedStyle> ret = result;
@ -592,8 +574,9 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
// for the default style, so resolve the style ourselves. // for the default style, so resolve the style ourselves.
nsPresContext* presContext = presShell->GetPresContext(); nsPresContext* presContext = presShell->GetPresContext();
if (!presContext) if (!presContext) {
return nullptr; return nullptr;
}
ServoStyleSet* styleSet = presShell->StyleSet()->AsServo(); ServoStyleSet* styleSet = presShell->StyleSet()->AsServo();
@ -990,17 +973,12 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
"should not have pseudo-element data"); "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 // mExposeVisitedStyle is set to true only by testing APIs that
// require chrome privilege. // require chrome privilege.
MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(), MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(),
"mExposeVisitedStyle set incorrectly"); "mExposeVisitedStyle set incorrectly");
if (mExposeVisitedStyle && mComputedStyle->RelevantLinkVisited()) { if (mExposeVisitedStyle && mComputedStyle->RelevantLinkVisited()) {
ComputedStyle *styleIfVisited = mComputedStyle->GetStyleIfVisited(); if (ComputedStyle* styleIfVisited = mComputedStyle->GetStyleIfVisited()) {
if (styleIfVisited) {
mComputedStyle = styleIfVisited; mComputedStyle = styleIfVisited;
} }
} }
@ -1151,7 +1129,7 @@ nsComputedDOMStyle::IndexedGetter(uint32_t aIndex,
if (index < count) { if (index < count) {
aFound = true; aFound = true;
nsString varName; nsString varName;
Servo_GetCustomPropertyNameAt(mComputedStyle->AsServo(), index, &varName); Servo_GetCustomPropertyNameAt(mComputedStyle, index, &varName);
aPropName.AssignLiteral("--"); aPropName.AssignLiteral("--");
aPropName.Append(varName); aPropName.Append(varName);
} else { } else {
@ -7169,8 +7147,7 @@ nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
const nsAString& name = Substring(aPropertyName, const nsAString& name = Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH); CSS_CUSTOM_NAME_PREFIX_LENGTH);
bool present = bool present =
Servo_GetCustomPropertyValue(mComputedStyle->AsServo(), &name, Servo_GetCustomPropertyValue(mComputedStyle, &name, &variableValue);
&variableValue);
if (!present) { if (!present) {
return nullptr; return nullptr;
} }