mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes
This commit is contained in:
parent
b1c9206051
commit
a93a7bed47
52 changed files with 274 additions and 1116 deletions
|
|
@ -202,9 +202,6 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
|
||||||
|
|
||||||
if (aRestyleType == RestyleType::Layer) {
|
if (aRestyleType == RestyleType::Layer) {
|
||||||
// Prompt layers to re-sync their animations.
|
// Prompt layers to re-sync their animations.
|
||||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: Servo-backed style system should not be using "
|
|
||||||
"EffectCompositor");
|
|
||||||
mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration();
|
mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration();
|
||||||
EffectSet* effectSet =
|
EffectSet* effectSet =
|
||||||
EffectSet::GetEffectSet(aElement, aPseudoType);
|
EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||||
|
|
@ -317,9 +314,6 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: Servo-backed style system should not be using "
|
|
||||||
"EffectCompositor");
|
|
||||||
if (mPresContext->RestyleManager()->AsGecko()->SkipAnimationRules()) {
|
if (mPresContext->RestyleManager()->AsGecko()->SkipAnimationRules()) {
|
||||||
// We don't need to worry about updating mElementsToRestyle in this case
|
// We don't need to worry about updating mElementsToRestyle in this case
|
||||||
// since this is not the animation restyle we requested when we called
|
// since this is not the animation restyle we requested when we called
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,6 @@ EffectSet::DestroyEffectSet(dom::Element* aElement,
|
||||||
void
|
void
|
||||||
EffectSet::UpdateAnimationGeneration(nsPresContext* aPresContext)
|
EffectSet::UpdateAnimationGeneration(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: Servo-backed style system should not be using "
|
|
||||||
"EffectSet");
|
|
||||||
mAnimationGeneration =
|
mAnimationGeneration =
|
||||||
aPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration();
|
aPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -296,10 +296,7 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
||||||
runningOnCompositorProperties.HasProperty(property.mProperty);
|
runningOnCompositorProperties.HasProperty(property.mProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME (bug 1303235): Do this for Servo too
|
|
||||||
if (aStyleContext->PresContext()->StyleSet()->IsGecko()) {
|
|
||||||
CalculateCumulativeChangeHint(aStyleContext);
|
CalculateCumulativeChangeHint(aStyleContext);
|
||||||
}
|
|
||||||
|
|
||||||
MarkCascadeNeedsUpdate();
|
MarkCascadeNeedsUpdate();
|
||||||
|
|
||||||
|
|
@ -1286,8 +1283,6 @@ CreateStyleContextForAnimationValue(nsCSSPropertyID aProperty,
|
||||||
nsCOMArray<nsIStyleRule> rules;
|
nsCOMArray<nsIStyleRule> rules;
|
||||||
rules.AppendObject(styleRule);
|
rules.AppendObject(styleRule);
|
||||||
|
|
||||||
MOZ_ASSERT(aBaseStyleContext->PresContext()->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSet should not use StyleAnimationValue for animations");
|
|
||||||
nsStyleSet* styleSet =
|
nsStyleSet* styleSet =
|
||||||
aBaseStyleContext->PresContext()->StyleSet()->AsGecko();
|
aBaseStyleContext->PresContext()->StyleSet()->AsGecko();
|
||||||
|
|
||||||
|
|
@ -1362,10 +1357,8 @@ KeyframeEffectReadOnly::CanIgnoreIfNotVisible() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME (bug 1303235): We don't calculate mCumulativeChangeHint for
|
|
||||||
// the Servo backend yet
|
|
||||||
nsPresContext* presContext = GetPresContext();
|
nsPresContext* presContext = GetPresContext();
|
||||||
if (!presContext || presContext->StyleSet()->IsServo()) {
|
if (!presContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include "mozilla/Move.h"
|
#include "mozilla/Move.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/RangedArray.h"
|
#include "mozilla/RangedArray.h"
|
||||||
#include "mozilla/ServoBindings.h"
|
|
||||||
#include "mozilla/StyleAnimationValue.h"
|
#include "mozilla/StyleAnimationValue.h"
|
||||||
#include "mozilla/TimingParams.h"
|
#include "mozilla/TimingParams.h"
|
||||||
#include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc.
|
#include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc.
|
||||||
|
|
@ -321,10 +320,6 @@ public:
|
||||||
inline bool
|
inline bool
|
||||||
IsInvalidValuePair(const PropertyValuePair& aPair, StyleBackendType aBackend)
|
IsInvalidValuePair(const PropertyValuePair& aPair, StyleBackendType aBackend)
|
||||||
{
|
{
|
||||||
if (aBackend == StyleBackendType::Servo) {
|
|
||||||
return !aPair.mServoDeclarationBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There are three types of values we store as token streams:
|
// There are three types of values we store as token streams:
|
||||||
//
|
//
|
||||||
// * Shorthand values (where we manually extract the token stream's string
|
// * Shorthand values (where we manually extract the token stream's string
|
||||||
|
|
@ -610,11 +605,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||||
ComputedKeyframeValues* computedValues = result.AppendElement();
|
ComputedKeyframeValues* computedValues = result.AppendElement();
|
||||||
for (const PropertyValuePair& pair :
|
for (const PropertyValuePair& pair :
|
||||||
PropertyPriorityIterator(frame.mPropertyValues)) {
|
PropertyPriorityIterator(frame.mPropertyValues)) {
|
||||||
MOZ_ASSERT(!pair.mServoDeclarationBlock ||
|
|
||||||
styleBackend == StyleBackendType::Servo,
|
|
||||||
"Animation values were parsed using Servo backend but target"
|
|
||||||
" element is not using Servo backend?");
|
|
||||||
|
|
||||||
if (IsInvalidValuePair(pair, styleBackend)) {
|
if (IsInvalidValuePair(pair, styleBackend)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -623,13 +613,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||||
// a KeyframeValueEntry for each value.
|
// a KeyframeValueEntry for each value.
|
||||||
nsTArray<PropertyStyleAnimationValuePair> values;
|
nsTArray<PropertyStyleAnimationValuePair> values;
|
||||||
|
|
||||||
if (styleBackend == StyleBackendType::Servo) {
|
|
||||||
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
|
|
||||||
CSSEnabledState::eForAllContent, aStyleContext,
|
|
||||||
*pair.mServoDeclarationBlock, values)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// For shorthands, we store the string as a token stream so we need to
|
// For shorthands, we store the string as a token stream so we need to
|
||||||
// extract that first.
|
// extract that first.
|
||||||
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
||||||
|
|
@ -650,7 +633,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||||
"Longhand properties should produce a single"
|
"Longhand properties should produce a single"
|
||||||
" StyleAnimationValue");
|
" StyleAnimationValue");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& value : values) {
|
for (auto& value : values) {
|
||||||
// If we already got a value for this property on the keyframe,
|
// If we already got a value for this property on the keyframe,
|
||||||
|
|
@ -999,30 +981,6 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
||||||
|
|
||||||
result.mProperty = aProperty;
|
result.mProperty = aProperty;
|
||||||
|
|
||||||
if (aDocument->GetStyleBackendType() == StyleBackendType::Servo) {
|
|
||||||
nsCString name = nsCSSProps::GetStringValue(aProperty);
|
|
||||||
|
|
||||||
NS_ConvertUTF16toUTF8 value(aStringValue);
|
|
||||||
RefPtr<ThreadSafeURIHolder> base =
|
|
||||||
new ThreadSafeURIHolder(aDocument->GetDocumentURI());
|
|
||||||
RefPtr<ThreadSafeURIHolder> referrer =
|
|
||||||
new ThreadSafeURIHolder(aDocument->GetDocumentURI());
|
|
||||||
RefPtr<ThreadSafePrincipalHolder> principal =
|
|
||||||
new ThreadSafePrincipalHolder(aDocument->NodePrincipal());
|
|
||||||
|
|
||||||
nsCString baseString;
|
|
||||||
aDocument->GetDocumentURI()->GetSpec(baseString);
|
|
||||||
|
|
||||||
RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
|
|
||||||
Servo_ParseProperty(&name, &value, &baseString,
|
|
||||||
base, referrer, principal).Consume();
|
|
||||||
|
|
||||||
if (servoDeclarationBlock) {
|
|
||||||
result.mServoDeclarationBlock = servoDeclarationBlock.forget();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCSSValue value;
|
nsCSSValue value;
|
||||||
if (!nsCSSProps::IsShorthand(aProperty)) {
|
if (!nsCSSProps::IsShorthand(aProperty)) {
|
||||||
aParser.ParseLonghandProperty(aProperty,
|
aParser.ParseLonghandProperty(aProperty,
|
||||||
|
|
@ -1054,13 +1012,6 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
||||||
"The shorthand property of a token stream should be initialized"
|
"The shorthand property of a token stream should be initialized"
|
||||||
" to unknown");
|
" to unknown");
|
||||||
value.SetTokenStreamValue(tokenStream);
|
value.SetTokenStreamValue(tokenStream);
|
||||||
} else {
|
|
||||||
// If we succeeded in parsing with Gecko, but not Servo the animation is
|
|
||||||
// not going to work since, for the purposes of animation, we're going to
|
|
||||||
// ignore |mValue| when the backend is Servo.
|
|
||||||
NS_WARNING_ASSERTION(aDocument->GetStyleBackendType() !=
|
|
||||||
StyleBackendType::Servo,
|
|
||||||
"Gecko succeeded in parsing where Servo failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.mValue = value;
|
result.mValue = value;
|
||||||
|
|
@ -1434,7 +1385,6 @@ HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
||||||
if (styleBackend == StyleBackendType::Gecko) {
|
|
||||||
nsCSSValueTokenStream* tokenStream =
|
nsCSSValueTokenStream* tokenStream =
|
||||||
pair.mValue.GetTokenStreamValue();
|
pair.mValue.GetTokenStreamValue();
|
||||||
nsCSSParser parser(aDocument->CSSLoader());
|
nsCSSParser parser(aDocument->CSSLoader());
|
||||||
|
|
@ -1442,12 +1392,6 @@ HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||||
tokenStream->mTokenStream)) {
|
tokenStream->mTokenStream)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// For the Servo backend, invalid shorthand values are represented by
|
|
||||||
// a null mServoDeclarationBlock member which we skip above in
|
|
||||||
// IsInvalidValuePair.
|
|
||||||
MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
|
|
||||||
pair.mServoDeclarationBlock);
|
|
||||||
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
|
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
|
||||||
prop, pair.mProperty, CSSEnabledState::eForAllContent) {
|
prop, pair.mProperty, CSSEnabledState::eForAllContent) {
|
||||||
addToPropertySets(*prop, offsetToUse);
|
addToPropertySets(*prop, offsetToUse);
|
||||||
|
|
|
||||||
|
|
@ -1749,14 +1749,10 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DeclarationBlock> decl;
|
RefPtr<DeclarationBlock> decl;
|
||||||
if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
|
|
||||||
decl = ServoDeclarationBlock::FromCssText(aString);
|
|
||||||
} else {
|
|
||||||
css::Loader* cssLoader = ownerDoc->CSSLoader();
|
css::Loader* cssLoader = ownerDoc->CSSLoader();
|
||||||
nsCSSParser cssParser(cssLoader);
|
nsCSSParser cssParser(cssLoader);
|
||||||
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
|
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
|
||||||
aElement->NodePrincipal());
|
aElement->NodePrincipal());
|
||||||
}
|
|
||||||
if (!decl) {
|
if (!decl) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1153,10 +1153,6 @@ nsDOMStyleSheetSetList::EnsureFresh()
|
||||||
StyleSheet* sheet = mDocument->SheetAt(index);
|
StyleSheet* sheet = mDocument->SheetAt(index);
|
||||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
// XXXheycam ServoStyleSheets don't expose their title yet.
|
// XXXheycam ServoStyleSheets don't expose their title yet.
|
||||||
if (sheet->IsServo()) {
|
|
||||||
NS_ERROR("stylo: ServoStyleSets don't expose their title yet");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
sheet->AsGecko()->GetTitle(title);
|
sheet->AsGecko()->GetTitle(title);
|
||||||
if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
|
if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -2193,7 +2189,6 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aStyleSet->IsGecko()) {
|
|
||||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
|
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
|
||||||
|
|
@ -2207,10 +2202,6 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
|
||||||
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: Not yet checking nsStyleSheetService for Servo-backed "
|
|
||||||
"documents. See bug 1290224");
|
|
||||||
}
|
|
||||||
|
|
||||||
AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAgentSheet],
|
AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAgentSheet],
|
||||||
SheetType::Agent);
|
SheetType::Agent);
|
||||||
|
|
@ -3850,11 +3841,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
|
||||||
className##Init init; \
|
className##Init init; \
|
||||||
init.mBubbles = true; \
|
init.mBubbles = true; \
|
||||||
init.mCancelable = true; \
|
init.mCancelable = true; \
|
||||||
/* XXXheycam ServoStyleSheet doesn't implement DOM interfaces yet */ \
|
init.mStylesheet = aSheet->AsGecko(); \
|
||||||
if (aSheet->IsServo()) { \
|
|
||||||
NS_ERROR("stylo: can't dispatch events for ServoStyleSheets yet"); \
|
|
||||||
} \
|
|
||||||
init.mStylesheet = aSheet->IsGecko() ? aSheet->AsGecko() : nullptr; \
|
|
||||||
init.memberName = argName; \
|
init.memberName = argName; \
|
||||||
\
|
\
|
||||||
RefPtr<className> event = \
|
RefPtr<className> event = \
|
||||||
|
|
@ -5623,12 +5610,6 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
|
||||||
StyleSheet* sheet = SheetAt(index);
|
StyleSheet* sheet = SheetAt(index);
|
||||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
|
|
||||||
// XXXheycam Make this work with ServoStyleSheets.
|
|
||||||
if (sheet->IsServo()) {
|
|
||||||
NS_ERROR("stylo: can't handle alternate ServoStyleSheets yet");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool disabled;
|
bool disabled;
|
||||||
sheet->AsGecko()->GetDisabled(&disabled);
|
sheet->AsGecko()->GetDisabled(&disabled);
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
|
|
@ -5743,12 +5724,6 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
|
||||||
StyleSheet* sheet = SheetAt(index);
|
StyleSheet* sheet = SheetAt(index);
|
||||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||||
|
|
||||||
// XXXheycam Make this work with ServoStyleSheets.
|
|
||||||
if (sheet->IsServo()) {
|
|
||||||
NS_ERROR("stylo: can't handle alternate ServoStyleSheets yet");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sheet->AsGecko()->GetTitle(title);
|
sheet->AsGecko()->GetTitle(title);
|
||||||
if (!title.IsEmpty()) {
|
if (!title.IsEmpty()) {
|
||||||
sheet->AsGecko()->SetEnabled(title.Equals(aSheetSet));
|
sheet->AsGecko()->SetEnabled(title.Equals(aSheetSet));
|
||||||
|
|
@ -9471,8 +9446,6 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
RefPtr<StyleSheet> sheet = SheetAt(i);
|
RefPtr<StyleSheet> sheet = SheetAt(i);
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
// XXXheycam Need to make ServoStyleSheet cloning work.
|
|
||||||
if (sheet->IsGecko()) {
|
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
||||||
NS_WARNING_ASSERTION(clonedSheet,
|
NS_WARNING_ASSERTION(clonedSheet,
|
||||||
|
|
@ -9480,9 +9453,6 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
if (clonedSheet) {
|
if (clonedSheet) {
|
||||||
clonedDoc->AddStyleSheet(clonedSheet);
|
clonedDoc->AddStyleSheet(clonedSheet);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_ERROR("stylo: ServoStyleSheet doesn't support cloning");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9491,8 +9461,6 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
|
for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
if (sheet->IsApplicable()) {
|
if (sheet->IsApplicable()) {
|
||||||
// XXXheycam Need to make ServoStyleSheet cloning work.
|
|
||||||
if (sheet->IsGecko()) {
|
|
||||||
RefPtr<CSSStyleSheet> clonedSheet =
|
RefPtr<CSSStyleSheet> clonedSheet =
|
||||||
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
||||||
NS_WARNING_ASSERTION(clonedSheet,
|
NS_WARNING_ASSERTION(clonedSheet,
|
||||||
|
|
@ -9500,9 +9468,6 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
||||||
if (clonedSheet) {
|
if (clonedSheet) {
|
||||||
clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet);
|
clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_ERROR("stylo: ServoStyleSheet doesn't support cloning");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12203,15 +12168,9 @@ nsIDocument::FlushUserFontSet()
|
||||||
nsTArray<nsFontFaceRuleContainer> rules;
|
nsTArray<nsFontFaceRuleContainer> rules;
|
||||||
nsIPresShell* shell = GetShell();
|
nsIPresShell* shell = GetShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
// XXXheycam ServoStyleSets don't support exposing @font-face rules yet.
|
|
||||||
if (shell->StyleSet()->IsGecko()) {
|
|
||||||
if (!shell->StyleSet()->AsGecko()->AppendFontFaceRules(rules)) {
|
if (!shell->StyleSet()->AsGecko()->AppendFontFaceRules(rules)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: ServoStyleSets cannot handle @font-face rules yet. "
|
|
||||||
"See bug 1290237.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
|
||||||
|
|
@ -319,15 +319,10 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXXheycam ServoStyleSheets do not support <style scoped>.
|
|
||||||
Element* oldScopeElement = nullptr;
|
Element* oldScopeElement = nullptr;
|
||||||
if (mStyleSheet) {
|
if (mStyleSheet) {
|
||||||
if (mStyleSheet->IsServo()) {
|
|
||||||
NS_WARNING("stylo: ServoStyleSheets don't support <style scoped>");
|
|
||||||
} else {
|
|
||||||
oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
|
oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
|
if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
|
||||||
MOZ_ASSERT(!(aOldDocument && aOldShadowRoot),
|
MOZ_ASSERT(!(aOldDocument && aOldShadowRoot),
|
||||||
|
|
@ -488,12 +483,6 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStyleSheet->IsServo()) {
|
|
||||||
// XXXheycam ServoStyleSheets don't support <style scoped>.
|
|
||||||
NS_ERROR("stylo: ServoStyleSheets don't support <style scoped>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSSStyleSheet* sheet = mStyleSheet->AsGecko();
|
CSSStyleSheet* sheet = mStyleSheet->AsGecko();
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> thisContent;
|
nsCOMPtr<nsIContent> thisContent;
|
||||||
|
|
|
||||||
|
|
@ -929,9 +929,6 @@ nsSVGElement::WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||||
// apply the SMILOverrideStyle.)
|
// apply the SMILOverrideStyle.)
|
||||||
RestyleManagerHandle restyleManager =
|
RestyleManagerHandle restyleManager =
|
||||||
aRuleWalker->PresContext()->RestyleManager();
|
aRuleWalker->PresContext()->RestyleManager();
|
||||||
MOZ_ASSERT(restyleManager->IsGecko(),
|
|
||||||
"stylo: Servo-backed style system should not be calling "
|
|
||||||
"WalkAnimatedContentStyleRules");
|
|
||||||
if (!restyleManager->AsGecko()->SkipAnimationRules()) {
|
if (!restyleManager->AsGecko()->SkipAnimationRules()) {
|
||||||
// update/walk the animated content style rule.
|
// update/walk the animated content style rule.
|
||||||
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
|
css::StyleRule* animContentStyleRule = GetAnimatedContentStyleRule();
|
||||||
|
|
|
||||||
|
|
@ -420,15 +420,6 @@ nsXBLBinding::GenerateAnonymousContent()
|
||||||
if (mContent)
|
if (mContent)
|
||||||
mContent->UnsetAttr(namespaceID, name, false);
|
mContent->UnsetAttr(namespaceID, name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we've finished shuffling the tree around, go ahead and restyle it
|
|
||||||
// since frame construction is about to happen.
|
|
||||||
nsIPresShell* presShell = mBoundElement->OwnerDoc()->GetShell();
|
|
||||||
ServoStyleSet* servoSet = presShell->StyleSet()->GetAsServo();
|
|
||||||
if (servoSet) {
|
|
||||||
mBoundElement->SetHasDirtyDescendantsForServo();
|
|
||||||
servoSet->StyleNewChildren(mBoundElement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIURI*
|
nsIURI*
|
||||||
|
|
|
||||||
|
|
@ -147,10 +147,6 @@ nsXBLPrototypeResources::GatherRuleProcessor()
|
||||||
{
|
{
|
||||||
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
|
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
|
||||||
for (StyleSheet* sheet : mStyleSheetList) {
|
for (StyleSheet* sheet : mStyleSheetList) {
|
||||||
MOZ_ASSERT(sheet->IsGecko(),
|
|
||||||
"GatherRuleProcessor must only be called for "
|
|
||||||
"nsXBLPrototypeResources objects with Gecko-flavored style "
|
|
||||||
"backends");
|
|
||||||
sheets.AppendElement(sheet->AsGecko());
|
sheets.AppendElement(sheet->AsGecko());
|
||||||
}
|
}
|
||||||
mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
|
mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
|
||||||
|
|
|
||||||
|
|
@ -552,10 +552,6 @@ CSSEditUtils::GetCSSInlinePropertyBase(nsINode* aNode,
|
||||||
if (!decl) {
|
if (!decl) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
if (decl->IsServo()) {
|
|
||||||
MOZ_CRASH("stylo: not implemented");
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
nsCSSPropertyID prop =
|
nsCSSPropertyID prop =
|
||||||
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
|
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
|
||||||
CSSEnabledState::eForAllContent);
|
CSSEnabledState::eForAllContent);
|
||||||
|
|
|
||||||
|
|
@ -2907,11 +2907,6 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL,
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
||||||
|
|
||||||
if (sheet->IsServo()) {
|
|
||||||
// XXXheycam ServoStyleSheets don't support being enabled/disabled yet.
|
|
||||||
NS_ERROR("stylo: ServoStyleSheets can't be disabled yet");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
return sheet->AsGecko()->SetDisabled(!aEnable);
|
return sheet->AsGecko()->SetDisabled(!aEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2929,11 +2924,6 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
||||||
|
|
||||||
if (sheet->IsServo()) {
|
|
||||||
// XXXheycam ServoStyleSheets don't support being enabled/disabled yet.
|
|
||||||
NS_ERROR("stylo: ServoStyleSheets can't be disabled yet");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
sheet->AsGecko()->SetDisabled(false);
|
sheet->AsGecko()->SetDisabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3877,9 +3877,6 @@ RestyleManager::ComputeAndProcessStyleChange(nsStyleContext* aNewContext,
|
||||||
nsStyleSet*
|
nsStyleSet*
|
||||||
ElementRestyler::StyleSet() const
|
ElementRestyler::StyleSet() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ElementRestyler should only be used with a Gecko-flavored "
|
|
||||||
"style backend");
|
|
||||||
return mPresContext->StyleSet()->AsGecko();
|
return mPresContext->StyleSet()->AsGecko();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -458,9 +458,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline nsStyleSet* StyleSet() const {
|
inline nsStyleSet* StyleSet() const {
|
||||||
MOZ_ASSERT(PresContext()->StyleSet()->IsGecko(),
|
|
||||||
"RestyleManager should only be used with a Gecko-flavored "
|
|
||||||
"style backend");
|
|
||||||
return PresContext()->StyleSet()->AsGecko();
|
return PresContext()->StyleSet()->AsGecko();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,14 +115,6 @@ protected:
|
||||||
return PresContext()->FrameConstructor();
|
return PresContext()->FrameConstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsGecko() const {
|
|
||||||
return !IsServo();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsServo() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsPresContext* mPresContext; // weak, can be null after Disconnect().
|
nsPresContext* mPresContext; // weak, can be null after Disconnect().
|
||||||
uint32_t mRestyleGeneration;
|
uint32_t mRestyleGeneration;
|
||||||
|
|
|
||||||
|
|
@ -48,47 +48,24 @@ public:
|
||||||
public:
|
public:
|
||||||
friend class ::mozilla::RestyleManagerHandle;
|
friend class ::mozilla::RestyleManagerHandle;
|
||||||
|
|
||||||
bool IsGecko() const { return !IsServo(); }
|
|
||||||
bool IsServo() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mValue, "RestyleManagerHandle null pointer dereference");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StyleBackendType BackendType() const
|
StyleBackendType BackendType() const
|
||||||
{
|
{
|
||||||
return IsGecko() ? StyleBackendType::Gecko :
|
return StyleBackendType::Gecko;
|
||||||
StyleBackendType::Servo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RestyleManager* AsGecko()
|
RestyleManager* AsGecko()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsGecko());
|
|
||||||
return reinterpret_cast<RestyleManager*>(mValue);
|
return reinterpret_cast<RestyleManager*>(mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServoRestyleManager* AsServo()
|
RestyleManager* GetAsGecko() { return AsGecko(); }
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsServo());
|
|
||||||
return reinterpret_cast<ServoRestyleManager*>(mValue & ~SERVO_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
RestyleManager* GetAsGecko() { return IsGecko() ? AsGecko() : nullptr; }
|
|
||||||
ServoRestyleManager* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
|
|
||||||
|
|
||||||
const RestyleManager* AsGecko() const
|
const RestyleManager* AsGecko() const
|
||||||
{
|
{
|
||||||
return const_cast<Ptr*>(this)->AsGecko();
|
return const_cast<Ptr*>(this)->AsGecko();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServoRestyleManager* AsServo() const
|
const RestyleManager* GetAsGecko() const { return AsGecko(); }
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsServo());
|
|
||||||
return const_cast<Ptr*>(this)->AsServo();
|
|
||||||
}
|
|
||||||
|
|
||||||
const RestyleManager* GetAsGecko() const { return IsGecko() ? AsGecko() : nullptr; }
|
|
||||||
const ServoRestyleManager* GetAsServo() const { return IsServo() ? AsServo() : nullptr; }
|
|
||||||
|
|
||||||
// These inline methods are defined in RestyleManagerHandleInlines.h.
|
// These inline methods are defined in RestyleManagerHandleInlines.h.
|
||||||
inline MozExternalRefCountType AddRef();
|
inline MozExternalRefCountType AddRef();
|
||||||
|
|
|
||||||
|
|
@ -7,35 +7,25 @@
|
||||||
#define mozilla_RestyleManagerHandleInlines_h
|
#define mozilla_RestyleManagerHandleInlines_h
|
||||||
|
|
||||||
#include "mozilla/RestyleManager.h"
|
#include "mozilla/RestyleManager.h"
|
||||||
#include "mozilla/ServoRestyleManager.h"
|
|
||||||
|
|
||||||
#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
|
||||||
if (IsGecko()) { \
|
|
||||||
return AsGecko()->method_ geckoargs_; \
|
|
||||||
} else { \
|
|
||||||
return AsServo()->method_ servoargs_; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
MozExternalRefCountType
|
MozExternalRefCountType
|
||||||
RestyleManagerHandle::Ptr::AddRef()
|
RestyleManagerHandle::Ptr::AddRef()
|
||||||
{
|
{
|
||||||
FORWARD(AddRef, ());
|
return AsGecko()->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
MozExternalRefCountType
|
MozExternalRefCountType
|
||||||
RestyleManagerHandle::Ptr::Release()
|
RestyleManagerHandle::Ptr::Release()
|
||||||
{
|
{
|
||||||
FORWARD(Release, ());
|
return AsGecko()->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::Disconnect()
|
RestyleManagerHandle::Ptr::Disconnect()
|
||||||
{
|
{
|
||||||
FORWARD(Disconnect, ());
|
AsGecko()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -43,20 +33,20 @@ RestyleManagerHandle::Ptr::PostRestyleEvent(dom::Element* aElement,
|
||||||
nsRestyleHint aRestyleHint,
|
nsRestyleHint aRestyleHint,
|
||||||
nsChangeHint aMinChangeHint)
|
nsChangeHint aMinChangeHint)
|
||||||
{
|
{
|
||||||
FORWARD(PostRestyleEvent, (aElement, aRestyleHint, aMinChangeHint));
|
AsGecko()->PostRestyleEvent(aElement, aRestyleHint, aMinChangeHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::PostRestyleEventForLazyConstruction()
|
RestyleManagerHandle::Ptr::PostRestyleEventForLazyConstruction()
|
||||||
{
|
{
|
||||||
FORWARD(PostRestyleEventForLazyConstruction, ());
|
AsGecko()->PostRestyleEventForLazyConstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::RebuildAllStyleData(nsChangeHint aExtraHint,
|
RestyleManagerHandle::Ptr::RebuildAllStyleData(nsChangeHint aExtraHint,
|
||||||
nsRestyleHint aRestyleHint)
|
nsRestyleHint aRestyleHint)
|
||||||
{
|
{
|
||||||
FORWARD(RebuildAllStyleData, (aExtraHint, aRestyleHint));
|
AsGecko()->RebuildAllStyleData(aExtraHint, aRestyleHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -64,39 +54,39 @@ RestyleManagerHandle::Ptr::PostRebuildAllStyleDataEvent(
|
||||||
nsChangeHint aExtraHint,
|
nsChangeHint aExtraHint,
|
||||||
nsRestyleHint aRestyleHint)
|
nsRestyleHint aRestyleHint)
|
||||||
{
|
{
|
||||||
FORWARD(PostRebuildAllStyleDataEvent, (aExtraHint, aRestyleHint));
|
AsGecko()->PostRebuildAllStyleDataEvent(aExtraHint, aRestyleHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::ProcessPendingRestyles()
|
RestyleManagerHandle::Ptr::ProcessPendingRestyles()
|
||||||
{
|
{
|
||||||
FORWARD(ProcessPendingRestyles, ());
|
AsGecko()->ProcessPendingRestyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
RestyleManagerHandle::Ptr::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
RestyleManagerHandle::Ptr::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||||
{
|
{
|
||||||
FORWARD(ProcessRestyledFrames, (aChangeList));
|
return AsGecko()->ProcessRestyledFrames(aChangeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::FlushOverflowChangedTracker()
|
RestyleManagerHandle::Ptr::FlushOverflowChangedTracker()
|
||||||
{
|
{
|
||||||
FORWARD(FlushOverflowChangedTracker, ());
|
AsGecko()->FlushOverflowChangedTracker();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::ContentInserted(nsINode* aContainer,
|
RestyleManagerHandle::Ptr::ContentInserted(nsINode* aContainer,
|
||||||
nsIContent* aChild)
|
nsIContent* aChild)
|
||||||
{
|
{
|
||||||
FORWARD(ContentInserted, (aContainer, aChild));
|
AsGecko()->ContentInserted(aContainer, aChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::ContentAppended(nsIContent* aContainer,
|
RestyleManagerHandle::Ptr::ContentAppended(nsIContent* aContainer,
|
||||||
nsIContent* aFirstNewContent)
|
nsIContent* aFirstNewContent)
|
||||||
{
|
{
|
||||||
FORWARD(ContentAppended, (aContainer, aFirstNewContent));
|
AsGecko()->ContentAppended(aContainer, aFirstNewContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -104,28 +94,28 @@ RestyleManagerHandle::Ptr::ContentRemoved(nsINode* aContainer,
|
||||||
nsIContent* aOldChild,
|
nsIContent* aOldChild,
|
||||||
nsIContent* aFollowingSibling)
|
nsIContent* aFollowingSibling)
|
||||||
{
|
{
|
||||||
FORWARD(ContentRemoved, (aContainer, aOldChild, aFollowingSibling));
|
AsGecko()->ContentRemoved(aContainer, aOldChild, aFollowingSibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::RestyleForInsertOrChange(nsINode* aContainer,
|
RestyleManagerHandle::Ptr::RestyleForInsertOrChange(nsINode* aContainer,
|
||||||
nsIContent* aChild)
|
nsIContent* aChild)
|
||||||
{
|
{
|
||||||
FORWARD(RestyleForInsertOrChange, (aContainer, aChild));
|
AsGecko()->RestyleForInsertOrChange(aContainer, aChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::RestyleForAppend(nsIContent* aContainer,
|
RestyleManagerHandle::Ptr::RestyleForAppend(nsIContent* aContainer,
|
||||||
nsIContent* aFirstNewContent)
|
nsIContent* aFirstNewContent)
|
||||||
{
|
{
|
||||||
FORWARD(RestyleForAppend, (aContainer, aFirstNewContent));
|
AsGecko()->RestyleForAppend(aContainer, aFirstNewContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::ContentStateChanged(nsIContent* aContent,
|
RestyleManagerHandle::Ptr::ContentStateChanged(nsIContent* aContent,
|
||||||
EventStates aStateMask)
|
EventStates aStateMask)
|
||||||
{
|
{
|
||||||
FORWARD(ContentStateChanged, (aContent, aStateMask));
|
AsGecko()->ContentStateChanged(aContent, aStateMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -135,8 +125,8 @@ RestyleManagerHandle::Ptr::AttributeWillChange(dom::Element* aElement,
|
||||||
int32_t aModType,
|
int32_t aModType,
|
||||||
const nsAttrValue* aNewValue)
|
const nsAttrValue* aNewValue)
|
||||||
{
|
{
|
||||||
FORWARD(AttributeWillChange, (aElement, aNameSpaceID, aAttribute, aModType,
|
AsGecko()->AttributeWillChange(aElement, aNameSpaceID, aAttribute, aModType,
|
||||||
aNewValue));
|
aNewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -146,49 +136,46 @@ RestyleManagerHandle::Ptr::AttributeChanged(dom::Element* aElement,
|
||||||
int32_t aModType,
|
int32_t aModType,
|
||||||
const nsAttrValue* aOldValue)
|
const nsAttrValue* aOldValue)
|
||||||
{
|
{
|
||||||
FORWARD(AttributeChanged, (aElement, aNameSpaceID, aAttribute, aModType,
|
AsGecko()->AttributeChanged(aElement, aNameSpaceID, aAttribute, aModType,
|
||||||
aOldValue));
|
aOldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
RestyleManagerHandle::Ptr::ReparentStyleContext(nsIFrame* aFrame)
|
RestyleManagerHandle::Ptr::ReparentStyleContext(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
FORWARD(ReparentStyleContext, (aFrame));
|
return AsGecko()->ReparentStyleContext(aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RestyleManagerHandle::Ptr::HasPendingRestyles()
|
RestyleManagerHandle::Ptr::HasPendingRestyles()
|
||||||
{
|
{
|
||||||
FORWARD(HasPendingRestyles, ());
|
return AsGecko()->HasPendingRestyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
RestyleManagerHandle::Ptr::GetRestyleGeneration() const
|
RestyleManagerHandle::Ptr::GetRestyleGeneration() const
|
||||||
{
|
{
|
||||||
FORWARD(GetRestyleGeneration, ());
|
return AsGecko()->GetRestyleGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
RestyleManagerHandle::Ptr::GetHoverGeneration() const
|
RestyleManagerHandle::Ptr::GetHoverGeneration() const
|
||||||
{
|
{
|
||||||
FORWARD(GetHoverGeneration, ());
|
return AsGecko()->GetHoverGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::SetObservingRefreshDriver(bool aObserving)
|
RestyleManagerHandle::Ptr::SetObservingRefreshDriver(bool aObserving)
|
||||||
{
|
{
|
||||||
FORWARD(SetObservingRefreshDriver, (aObserving));
|
AsGecko()->SetObservingRefreshDriver(aObserving);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RestyleManagerHandle::Ptr::NotifyDestroyingFrame(nsIFrame* aFrame)
|
RestyleManagerHandle::Ptr::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
FORWARD(NotifyDestroyingFrame, (aFrame));
|
AsGecko()->NotifyDestroyingFrame(aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#undef FORWARD
|
|
||||||
#undef FORWARD_CONCRETE
|
|
||||||
|
|
||||||
#endif // mozilla_RestyleManagerHandleInlines_h
|
#endif // mozilla_RestyleManagerHandleInlines_h
|
||||||
|
|
|
||||||
|
|
@ -2698,13 +2698,7 @@ nsCSSFrameConstructor::ConstructRootFrame()
|
||||||
|
|
||||||
// Set up our style rule observer.
|
// Set up our style rule observer.
|
||||||
// XXXbz wouldn't this make more sense as part of presshell init?
|
// XXXbz wouldn't this make more sense as part of presshell init?
|
||||||
if (styleSet->IsGecko()) {
|
|
||||||
// XXXheycam We don't support XBL bindings providing style to
|
|
||||||
// ServoStyleSets yet.
|
|
||||||
styleSet->AsGecko()->SetBindingManager(mDocument->BindingManager());
|
styleSet->AsGecko()->SetBindingManager(mDocument->BindingManager());
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: cannot get ServoStyleSheets from XBL bindings yet. See bug 1290276.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------- BUILD VIEWPORT -----------
|
// --------- BUILD VIEWPORT -----------
|
||||||
RefPtr<nsStyleContext> viewportPseudoStyle =
|
RefPtr<nsStyleContext> viewportPseudoStyle =
|
||||||
|
|
@ -4246,15 +4240,6 @@ nsCSSFrameConstructor::GetAnonymousContent(nsIContent* aParent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ServoStyleSet* styleSet = mPresShell->StyleSet()->GetAsServo()) {
|
|
||||||
// Eagerly compute styles for the anonymous content tree.
|
|
||||||
for (auto& info : aContent) {
|
|
||||||
if (info.mContent->IsElement()) {
|
|
||||||
styleSet->StyleNewSubtree(info.mContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10537,11 +10522,6 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
|
||||||
TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper
|
TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper
|
||||||
parentDisplayBasedStyleFixupSkipper(aState.mTreeMatchContext);
|
parentDisplayBasedStyleFixupSkipper(aState.mTreeMatchContext);
|
||||||
|
|
||||||
// Make sure we eagerly performed the servo cascade when the anonymous
|
|
||||||
// nodes were created.
|
|
||||||
MOZ_ASSERT_IF(content->IsStyledByServo() && content->IsElement(),
|
|
||||||
content->AsElement()->HasServoData());
|
|
||||||
|
|
||||||
// Determine whether this NAC is pseudo-implementing.
|
// Determine whether this NAC is pseudo-implementing.
|
||||||
nsIAtom* pseudo = nullptr;
|
nsIAtom* pseudo = nullptr;
|
||||||
if (content->IsElement()) {
|
if (content->IsElement()) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
/* container for a document and its presentation */
|
/* container for a document and its presentation */
|
||||||
|
|
||||||
#include "mozilla/ServoStyleSet.h"
|
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
@ -2279,12 +2278,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
|
|
||||||
StyleBackendType backendType = aDocument->GetStyleBackendType();
|
StyleBackendType backendType = aDocument->GetStyleBackendType();
|
||||||
|
|
||||||
StyleSetHandle styleSet;
|
StyleSetHandle styleSet = new nsStyleSet();
|
||||||
if (backendType == StyleBackendType::Gecko) {
|
|
||||||
styleSet = new nsStyleSet();
|
|
||||||
} else {
|
|
||||||
styleSet = new ServoStyleSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
styleSet->BeginUpdate();
|
styleSet->BeginUpdate();
|
||||||
|
|
||||||
|
|
@ -2440,7 +2434,6 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styleSet->IsGecko()) {
|
|
||||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||||
if (sheetService) {
|
if (sheetService) {
|
||||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
||||||
|
|
@ -2450,10 +2443,6 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||||
styleSet->PrependStyleSheet(SheetType::User, sheet);
|
styleSet->PrependStyleSheet(SheetType::User, sheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: Not yet checking nsStyleSheetService for Servo-backed "
|
|
||||||
"documents. See bug 1290224");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Caller will handle calling EndUpdate, per contract.
|
// Caller will handle calling EndUpdate, per contract.
|
||||||
return styleSet;
|
return styleSet;
|
||||||
|
|
|
||||||
|
|
@ -894,14 +894,10 @@ nsPresContext::AttachShell(nsIPresShell* aShell, StyleBackendType aBackendType)
|
||||||
MOZ_ASSERT(!mShell);
|
MOZ_ASSERT(!mShell);
|
||||||
mShell = aShell;
|
mShell = aShell;
|
||||||
|
|
||||||
if (aBackendType == StyleBackendType::Servo) {
|
|
||||||
mRestyleManager = new ServoRestyleManager(this);
|
|
||||||
} else {
|
|
||||||
// Since RestyleManager is also the name of a method of nsPresContext,
|
// Since RestyleManager is also the name of a method of nsPresContext,
|
||||||
// it is necessary to prefix the class with the mozilla namespace
|
// it is necessary to prefix the class with the mozilla namespace
|
||||||
// here.
|
// here.
|
||||||
mRestyleManager = new mozilla::RestyleManager(this);
|
mRestyleManager = new mozilla::RestyleManager(this);
|
||||||
}
|
|
||||||
|
|
||||||
// Since CounterStyleManager is also the name of a method of
|
// Since CounterStyleManager is also the name of a method of
|
||||||
// nsPresContext, it is necessary to prefix the class with the mozilla
|
// nsPresContext, it is necessary to prefix the class with the mozilla
|
||||||
|
|
@ -1886,16 +1882,9 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
|
||||||
|
|
||||||
// MediumFeaturesChanged updates the applied rules, so it always gets called.
|
// MediumFeaturesChanged updates the applied rules, so it always gets called.
|
||||||
if (mShell) {
|
if (mShell) {
|
||||||
// XXXheycam ServoStyleSets don't support responding to medium
|
|
||||||
// changes yet.
|
|
||||||
if (mShell->StyleSet()->IsGecko()) {
|
|
||||||
if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) {
|
if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) {
|
||||||
aRestyleHint |= eRestyle_Subtree;
|
aRestyleHint |= eRestyle_Subtree;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: ServoStyleSets don't support responding to medium "
|
|
||||||
"changes yet. See bug 1290228.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUsesViewportUnits && mPendingViewportChange) {
|
if (mUsesViewportUnits && mPendingViewportChange) {
|
||||||
|
|
|
||||||
|
|
@ -569,10 +569,6 @@ static void
|
||||||
VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
|
VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
|
||||||
{
|
{
|
||||||
if (nsFrame::GetVerifyStyleTreeEnable()) {
|
if (nsFrame::GetVerifyStyleTreeEnable()) {
|
||||||
if (aPresContext->RestyleManager()->IsServo()) {
|
|
||||||
NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
|
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
|
||||||
aPresContext->RestyleManager()->AsGecko()->DebugVerifyStyleTree(rootFrame);
|
aPresContext->RestyleManager()->AsGecko()->DebugVerifyStyleTree(rootFrame);
|
||||||
}
|
}
|
||||||
|
|
@ -893,8 +889,7 @@ PresShell::Init(nsIDocument* aDocument,
|
||||||
|
|
||||||
// Bind the context to the presentation shell.
|
// Bind the context to the presentation shell.
|
||||||
mPresContext = aPresContext;
|
mPresContext = aPresContext;
|
||||||
StyleBackendType backend = aStyleSet->IsServo() ? StyleBackendType::Servo
|
StyleBackendType backend = StyleBackendType::Gecko;
|
||||||
: StyleBackendType::Gecko;
|
|
||||||
aPresContext->AttachShell(this, backend);
|
aPresContext->AttachShell(this, backend);
|
||||||
|
|
||||||
// Now we can initialize the style set. Make sure to set the member before
|
// Now we can initialize the style set. Make sure to set the member before
|
||||||
|
|
@ -1425,11 +1420,6 @@ PresShell::RemovePreferenceStyles()
|
||||||
void
|
void
|
||||||
PresShell::AddUserSheet(nsISupports* aSheet)
|
PresShell::AddUserSheet(nsISupports* aSheet)
|
||||||
{
|
{
|
||||||
if (mStyleSet->IsServo()) {
|
|
||||||
NS_ERROR("stylo: nsStyleSheetService doesn't handle ServoStyleSheets yet");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure this does what nsDocumentViewer::CreateStyleSet does wrt
|
// Make sure this does what nsDocumentViewer::CreateStyleSet does wrt
|
||||||
// ordering. We want this new sheet to come after all the existing stylesheet
|
// ordering. We want this new sheet to come after all the existing stylesheet
|
||||||
// service sheets, but before other user sheets; see nsIStyleSheetService.idl
|
// service sheets, but before other user sheets; see nsIStyleSheetService.idl
|
||||||
|
|
@ -1692,17 +1682,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
|
||||||
|
|
||||||
mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
|
mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
|
||||||
|
|
||||||
if (mStyleSet->IsServo() && mDocument->GetRootElement()) {
|
|
||||||
// If we have the root element already, go ahead style it along with any
|
|
||||||
// descendants.
|
|
||||||
//
|
|
||||||
// Some things, like nsDocumentViewer::GetPageMode, recreate the PresShell
|
|
||||||
// while keeping the content tree alive (see bug 1292280) - so we
|
|
||||||
// unconditionally mark the root as dirty.
|
|
||||||
mDocument->GetRootElement()->SetIsDirtyForServo();
|
|
||||||
mStyleSet->AsServo()->StyleDocument(/* aLeaveDirtyBits = */ false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the root frame from the frame manager
|
// Get the root frame from the frame manager
|
||||||
// XXXbz it would be nice to move this somewhere else... like frame manager
|
// XXXbz it would be nice to move this somewhere else... like frame manager
|
||||||
// Init(), say. But we need to make sure our views are all set up by the
|
// Init(), say. But we need to make sure our views are all set up by the
|
||||||
|
|
@ -4508,17 +4487,11 @@ PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet)
|
||||||
if (mStylesHaveChanged)
|
if (mStylesHaveChanged)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (aStyleSheet->IsGecko()) {
|
|
||||||
// XXXheycam ServoStyleSheets don't support <style scoped> yet.
|
|
||||||
Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement();
|
Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement();
|
||||||
if (scopeElement) {
|
if (scopeElement) {
|
||||||
mChangedScopeStyleRoots.AppendElement(scopeElement);
|
mChangedScopeStyleRoots.AppendElement(scopeElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: ServoStyleSheets don't support <style scoped>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mStylesHaveChanged = true;
|
mStylesHaveChanged = true;
|
||||||
}
|
}
|
||||||
|
|
@ -6773,12 +6746,9 @@ FlushThrottledStyles(nsIDocument *aDocument, void *aData)
|
||||||
if (shell && shell->IsVisible()) {
|
if (shell && shell->IsVisible()) {
|
||||||
nsPresContext* presContext = shell->GetPresContext();
|
nsPresContext* presContext = shell->GetPresContext();
|
||||||
if (presContext) {
|
if (presContext) {
|
||||||
if (presContext->RestyleManager()->IsGecko()) {
|
|
||||||
// XXX stylo: ServoRestyleManager doesn't support animations yet.
|
|
||||||
presContext->RestyleManager()->AsGecko()->UpdateOnlyAnimationStyles();
|
presContext->RestyleManager()->AsGecko()->UpdateOnlyAnimationStyles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
aDocument->EnumerateSubDocuments(FlushThrottledStyles, nullptr);
|
aDocument->EnumerateSubDocuments(FlushThrottledStyles, nullptr);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -9519,10 +9489,6 @@ PresShell::Observe(nsISupports* aSubject,
|
||||||
nsAutoScriptBlocker scriptBlocker;
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
++mChangeNestCount;
|
++mChangeNestCount;
|
||||||
RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
|
RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
|
||||||
if (restyleManager->IsServo()) {
|
|
||||||
MOZ_CRASH("stylo: PresShell::Observe(\"chrome-flush-skin-caches\") "
|
|
||||||
"not implemented for Servo-backed style system");
|
|
||||||
}
|
|
||||||
restyleManager->AsGecko()->ProcessRestyledFrames(changeList);
|
restyleManager->AsGecko()->ProcessRestyledFrames(changeList);
|
||||||
restyleManager->AsGecko()->FlushOverflowChangedTracker();
|
restyleManager->AsGecko()->FlushOverflowChangedTracker();
|
||||||
--mChangeNestCount;
|
--mChangeNestCount;
|
||||||
|
|
@ -10004,10 +9970,6 @@ PresShell::VerifyIncrementalReflow()
|
||||||
|
|
||||||
// Create a new presentation shell to view the document. Use the
|
// Create a new presentation shell to view the document. Use the
|
||||||
// exact same style information that this document has.
|
// exact same style information that this document has.
|
||||||
if (mStyleSet->IsServo()) {
|
|
||||||
NS_WARNING("VerifyIncrementalReflow cannot handle ServoStyleSets");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
nsAutoPtr<nsStyleSet> newSet(CloneStyleSet(mStyleSet->AsGecko()));
|
nsAutoPtr<nsStyleSet> newSet(CloneStyleSet(mStyleSet->AsGecko()));
|
||||||
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet.get());
|
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet.get());
|
||||||
NS_ENSURE_TRUE(sh, false);
|
NS_ENSURE_TRUE(sh, false);
|
||||||
|
|
|
||||||
|
|
@ -176,16 +176,10 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
|
||||||
// We're guaranteed that the new sheet is the last sheet in
|
// We're guaranteed that the new sheet is the last sheet in
|
||||||
// mSheets[aSheetType]
|
// mSheets[aSheetType]
|
||||||
|
|
||||||
// XXXheycam Once the nsStyleSheetService can hold ServoStyleSheets too,
|
|
||||||
// we'll need to include them in the notification.
|
|
||||||
StyleSheet* sheet = mSheets[aSheetType].LastElement();
|
StyleSheet* sheet = mSheets[aSheetType].LastElement();
|
||||||
if (sheet->IsGecko()) {
|
|
||||||
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
||||||
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
||||||
message, nullptr);
|
message, nullptr);
|
||||||
} else {
|
|
||||||
NS_ERROR("stylo: can't notify observers of ServoStyleSheets");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
|
|
@ -294,9 +288,6 @@ nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType,
|
||||||
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
|
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
MOZ_ASSERT(sheet->IsGecko(),
|
|
||||||
"stylo: didn't expect Loader to create a ServoStyleSheet");
|
|
||||||
|
|
||||||
RefPtr<CSSStyleSheet> cssSheet = sheet->AsGecko();
|
RefPtr<CSSStyleSheet> cssSheet = sheet->AsGecko();
|
||||||
cssSheet.forget(aSheet);
|
cssSheet.forget(aSheet);
|
||||||
|
|
||||||
|
|
@ -331,15 +322,9 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
||||||
if (serv) {
|
if (serv) {
|
||||||
// XXXheycam Once the nsStyleSheetService can hold ServoStyleSheets too,
|
|
||||||
// we'll need to include them in the notification.
|
|
||||||
if (sheet->IsGecko()) {
|
|
||||||
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
CSSStyleSheet* cssSheet = sheet->AsGecko();
|
||||||
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
|
||||||
message, nullptr);
|
message, nullptr);
|
||||||
} else {
|
|
||||||
NS_ERROR("stylo: can't notify observers of ServoStyleSheets");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
|
|
|
||||||
|
|
@ -676,32 +676,23 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||||
// and not only those whose current style involves CSS transitions,
|
// and not only those whose current style involves CSS transitions,
|
||||||
// because what matters is whether the new style (not the old)
|
// because what matters is whether the new style (not the old)
|
||||||
// specifies CSS transitions.
|
// specifies CSS transitions.
|
||||||
if (presContext->RestyleManager()->IsGecko()) {
|
|
||||||
// stylo: ServoRestyleManager does not handle transitions yet, and when
|
|
||||||
// it does it probably won't need to track reframed style contexts to
|
|
||||||
// initiate transitions correctly.
|
|
||||||
RestyleManager::ReframingStyleContexts* rsc =
|
RestyleManager::ReframingStyleContexts* rsc =
|
||||||
presContext->RestyleManager()->AsGecko()->GetReframingStyleContexts();
|
presContext->RestyleManager()->AsGecko()->GetReframingStyleContexts();
|
||||||
if (rsc) {
|
if (rsc) {
|
||||||
rsc->Put(mContent, mStyleContext);
|
rsc->Put(mContent, mStyleContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (HasCSSAnimations() || HasCSSTransitions() ||
|
if (HasCSSAnimations() || HasCSSTransitions() ||
|
||||||
EffectSet::GetEffectSet(this)) {
|
EffectSet::GetEffectSet(this)) {
|
||||||
// If no new frame for this element is created by the end of the
|
// If no new frame for this element is created by the end of the
|
||||||
// restyling process, stop animations and transitions for this frame
|
// restyling process, stop animations and transitions for this frame
|
||||||
if (presContext->RestyleManager()->IsGecko()) {
|
|
||||||
RestyleManager::AnimationsWithDestroyedFrame* adf =
|
RestyleManager::AnimationsWithDestroyedFrame* adf =
|
||||||
presContext->RestyleManager()->AsGecko()->GetAnimationsWithDestroyedFrame();
|
presContext->RestyleManager()->AsGecko()->GetAnimationsWithDestroyedFrame();
|
||||||
// AnimationsWithDestroyedFrame only lives during the restyling process.
|
// AnimationsWithDestroyedFrame only lives during the restyling process.
|
||||||
if (adf) {
|
if (adf) {
|
||||||
adf->Put(mContent, mStyleContext);
|
adf->Put(mContent, mStyleContext);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_ERROR("stylo: ServoRestyleManager does not support animations yet");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable visibility tracking. Note that we have to do this before we clear
|
// Disable visibility tracking. Note that we have to do this before we clear
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength,
|
||||||
for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) {
|
for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) {
|
||||||
sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i));
|
sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i));
|
||||||
}
|
}
|
||||||
if (styleSet->IsGecko()) {
|
|
||||||
AutoTArray<CSSStyleSheet*, 32> xblSheetArray;
|
AutoTArray<CSSStyleSheet*, 32> xblSheetArray;
|
||||||
styleSet->AsGecko()->AppendAllXBLStyleSheets(xblSheetArray);
|
styleSet->AsGecko()->AppendAllXBLStyleSheets(xblSheetArray);
|
||||||
|
|
||||||
|
|
@ -108,9 +107,6 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength,
|
||||||
sheets.AppendElement(sheet);
|
sheets.AppendElement(sheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: XBL style sheets not supported yet");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the document sheets.
|
// Get the document sheets.
|
||||||
|
|
|
||||||
|
|
@ -137,10 +137,6 @@ void
|
||||||
AnimationCollection<AnimationType>::UpdateCheckGeneration(
|
AnimationCollection<AnimationType>::UpdateCheckGeneration(
|
||||||
nsPresContext* aPresContext)
|
nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
if (aPresContext->RestyleManager()->IsServo()) {
|
|
||||||
// stylo: ServoRestyleManager does not support animations yet.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mCheckGeneration =
|
mCheckGeneration =
|
||||||
aPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration();
|
aPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1929,9 +1929,6 @@ CSSStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
|
||||||
bool aWasAlternate,
|
bool aWasAlternate,
|
||||||
nsresult aStatus)
|
nsresult aStatus)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aSheet->IsGecko(),
|
|
||||||
"why we were called back with a ServoStyleSheet?");
|
|
||||||
|
|
||||||
CSSStyleSheet* sheet = aSheet->AsGecko();
|
CSSStyleSheet* sheet = aSheet->AsGecko();
|
||||||
|
|
||||||
if (sheet->GetParentSheet() == nullptr) {
|
if (sheet->GetParentSheet() == nullptr) {
|
||||||
|
|
|
||||||
|
|
@ -2030,11 +2030,8 @@ CounterStyleManager::BuildCounterStyle(const nsSubstring& aName)
|
||||||
// but the user-defined names case-sensitive.
|
// but the user-defined names case-sensitive.
|
||||||
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
||||||
StyleSetHandle styleSet = mPresContext->StyleSet();
|
StyleSetHandle styleSet = mPresContext->StyleSet();
|
||||||
NS_ASSERTION(styleSet->IsGecko(),
|
nsCSSCounterStyleRule* rule =
|
||||||
"stylo: ServoStyleSets do not support custom counter "
|
styleSet->AsGecko()->CounterStyleRuleForName(aName);
|
||||||
"styles yet");
|
|
||||||
nsCSSCounterStyleRule* rule = styleSet->IsGecko() ?
|
|
||||||
styleSet->AsGecko()->CounterStyleRuleForName(aName) : nullptr;
|
|
||||||
if (rule) {
|
if (rule) {
|
||||||
data = new (mPresContext) CustomCounterStyle(aName, this, rule);
|
data = new (mPresContext) CustomCounterStyle(aName, this, rule);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2076,11 +2073,8 @@ CounterStyleManager::NotifyRuleChanged()
|
||||||
bool toBeRemoved = false;
|
bool toBeRemoved = false;
|
||||||
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
||||||
StyleSetHandle styleSet = mPresContext->StyleSet();
|
StyleSetHandle styleSet = mPresContext->StyleSet();
|
||||||
NS_ASSERTION(styleSet->IsGecko(),
|
nsCSSCounterStyleRule* newRule =
|
||||||
"stylo: ServoStyleSets do not support custom counter "
|
styleSet->AsGecko()->CounterStyleRuleForName(iter.Key());
|
||||||
"styles yet");
|
|
||||||
nsCSSCounterStyleRule* newRule = styleSet->IsGecko() ?
|
|
||||||
styleSet->AsGecko()->CounterStyleRuleForName(iter.Key()) : nullptr;
|
|
||||||
if (!newRule) {
|
if (!newRule) {
|
||||||
if (style->IsCustomStyle()) {
|
if (style->IsCustomStyle()) {
|
||||||
toBeRemoved = true;
|
toBeRemoved = true;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ protected:
|
||||||
: DeclarationBlock(aCopy.mType) {}
|
: DeclarationBlock(aCopy.mType) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MOZ_DECL_STYLO_METHODS(css::Declaration, ServoDeclarationBlock)
|
MOZ_DECL_STYLO_METHODS(css::Declaration)
|
||||||
|
|
||||||
inline MozExternalRefCountType AddRef();
|
inline MozExternalRefCountType AddRef();
|
||||||
inline MozExternalRefCountType Release();
|
inline MozExternalRefCountType Release();
|
||||||
|
|
|
||||||
|
|
@ -7,33 +7,28 @@
|
||||||
#define mozilla_DeclarationBlockInlines_h
|
#define mozilla_DeclarationBlockInlines_h
|
||||||
|
|
||||||
#include "mozilla/css/Declaration.h"
|
#include "mozilla/css/Declaration.h"
|
||||||
#include "mozilla/ServoDeclarationBlock.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
MOZ_DEFINE_STYLO_METHODS(DeclarationBlock, css::Declaration, ServoDeclarationBlock)
|
MOZ_DEFINE_STYLO_METHODS(DeclarationBlock, css::Declaration)
|
||||||
|
|
||||||
MozExternalRefCountType
|
MozExternalRefCountType
|
||||||
DeclarationBlock::AddRef()
|
DeclarationBlock::AddRef()
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(AddRef, ())
|
return AsGecko()->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
MozExternalRefCountType
|
MozExternalRefCountType
|
||||||
DeclarationBlock::Release()
|
DeclarationBlock::Release()
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(Release, ())
|
return AsGecko()->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DeclarationBlock>
|
already_AddRefed<DeclarationBlock>
|
||||||
DeclarationBlock::Clone() const
|
DeclarationBlock::Clone() const
|
||||||
{
|
{
|
||||||
RefPtr<DeclarationBlock> result;
|
RefPtr<DeclarationBlock> result;
|
||||||
if (IsGecko()) {
|
|
||||||
result = new css::Declaration(*AsGecko());
|
result = new css::Declaration(*AsGecko());
|
||||||
} else {
|
|
||||||
result = new ServoDeclarationBlock(*AsServo());
|
|
||||||
}
|
|
||||||
return result.forget();
|
return result.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,9 +36,7 @@ already_AddRefed<DeclarationBlock>
|
||||||
DeclarationBlock::EnsureMutable()
|
DeclarationBlock::EnsureMutable()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (IsGecko()) {
|
|
||||||
AsGecko()->AssertNotExpanded();
|
AsGecko()->AssertNotExpanded();
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (!IsMutable()) {
|
if (!IsMutable()) {
|
||||||
return Clone();
|
return Clone();
|
||||||
|
|
@ -54,58 +47,58 @@ DeclarationBlock::EnsureMutable()
|
||||||
void
|
void
|
||||||
DeclarationBlock::ToString(nsAString& aString) const
|
DeclarationBlock::ToString(nsAString& aString) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(ToString, (aString))
|
AsGecko()->ToString(aString);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
DeclarationBlock::Count() const
|
DeclarationBlock::Count() const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(Count, ())
|
return AsGecko()->Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeclarationBlock::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
|
DeclarationBlock::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetNthProperty, (aIndex, aReturn))
|
return AsGecko()->GetNthProperty(aIndex, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
|
DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
|
||||||
nsAString& aValue) const
|
nsAString& aValue) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetPropertyValue, (aProperty, aValue))
|
AsGecko()->GetPropertyValue(aProperty, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
|
DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
|
||||||
nsAString& aValue) const
|
nsAString& aValue) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetPropertyValueByID, (aPropID, aValue))
|
AsGecko()->GetPropertyValueByID(aPropID, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeclarationBlock::GetAuthoredPropertyValue(const nsAString& aProperty,
|
DeclarationBlock::GetAuthoredPropertyValue(const nsAString& aProperty,
|
||||||
nsAString& aValue) const
|
nsAString& aValue) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetAuthoredPropertyValue, (aProperty, aValue))
|
AsGecko()->GetAuthoredPropertyValue(aProperty, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
|
DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetPropertyIsImportant, (aProperty))
|
return AsGecko()->GetPropertyIsImportant(aProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeclarationBlock::RemoveProperty(const nsAString& aProperty)
|
DeclarationBlock::RemoveProperty(const nsAString& aProperty)
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(RemoveProperty, (aProperty))
|
AsGecko()->RemoveProperty(aProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aProperty)
|
DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aProperty)
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(RemovePropertyByID, (aProperty))
|
AsGecko()->RemovePropertyByID(aProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
||||||
|
|
@ -1130,10 +1130,6 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
if (sheet->IsServo()) {
|
|
||||||
MOZ_CRASH("stylo: can't clone ServoStyleSheets yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
// This sheet came from the XUL cache or our per-document hashtable; it
|
// This sheet came from the XUL cache or our per-document hashtable; it
|
||||||
// better be a complete sheet.
|
// better be a complete sheet.
|
||||||
NS_ASSERTION(sheet->AsGecko()->IsComplete(),
|
NS_ASSERTION(sheet->AsGecko()->IsComplete(),
|
||||||
|
|
@ -1193,9 +1189,6 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||||
|
|
||||||
if (sheet) {
|
if (sheet) {
|
||||||
// The sheet we have now should be either incomplete or unmodified
|
// The sheet we have now should be either incomplete or unmodified
|
||||||
if (sheet->IsServo()) {
|
|
||||||
MOZ_CRASH("stylo: can't clone ServoStyleSheets yet");
|
|
||||||
}
|
|
||||||
NS_ASSERTION(!sheet->AsGecko()->IsModified() ||
|
NS_ASSERTION(!sheet->AsGecko()->IsModified() ||
|
||||||
!sheet->AsGecko()->IsComplete(),
|
!sheet->AsGecko()->IsComplete(),
|
||||||
"Unexpected modified complete sheet");
|
"Unexpected modified complete sheet");
|
||||||
|
|
@ -1252,11 +1245,7 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||||
&sriMetadata);
|
&sriMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetStyleBackendType() == StyleBackendType::Gecko) {
|
|
||||||
*aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
*aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||||
} else {
|
|
||||||
*aSheet = new ServoStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
|
||||||
}
|
|
||||||
(*aSheet)->SetURIs(sheetURI, originalURI, baseURI);
|
(*aSheet)->SetURIs(sheetURI, originalURI, baseURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1283,12 +1272,6 @@ Loader::PrepareSheet(StyleSheet* aSheet,
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aSheet, "Must have a sheet!");
|
NS_PRECONDITION(aSheet, "Must have a sheet!");
|
||||||
|
|
||||||
// XXXheycam Need to set media, title, etc. on ServoStyleSheets.
|
|
||||||
if (aSheet->IsServo()) {
|
|
||||||
NS_WARNING("stylo: should set metadata on ServoStyleSheets. See bug 1290209.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSSStyleSheet* sheet = aSheet->AsGecko();
|
CSSStyleSheet* sheet = aSheet->AsGecko();
|
||||||
|
|
||||||
RefPtr<nsMediaList> mediaList(aMediaList);
|
RefPtr<nsMediaList> mediaList(aMediaList);
|
||||||
|
|
@ -1414,12 +1397,6 @@ Loader::InsertChildSheet(StyleSheet* aSheet,
|
||||||
NS_PRECONDITION(aParentSheet, "Need a parent to insert into");
|
NS_PRECONDITION(aParentSheet, "Need a parent to insert into");
|
||||||
NS_PRECONDITION(aParentSheet, "How did we get imported?");
|
NS_PRECONDITION(aParentSheet, "How did we get imported?");
|
||||||
|
|
||||||
// XXXheycam The InsertChildSheet API doesn't work with ServoStyleSheets,
|
|
||||||
// since they won't have Gecko ImportRules in them.
|
|
||||||
if (aSheet->IsServo()) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// child sheets should always start out enabled, even if they got
|
// child sheets should always start out enabled, even if they got
|
||||||
// cloned off of top-level sheets which were disabled
|
// cloned off of top-level sheets which were disabled
|
||||||
aSheet->AsGecko()->SetEnabled(true);
|
aSheet->AsGecko()->SetEnabled(true);
|
||||||
|
|
@ -1766,17 +1743,10 @@ Loader::ParseSheet(const nsAString& aInput,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
if (aLoadData->mSheet->IsGecko()) {
|
|
||||||
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
||||||
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
||||||
aLoadData->mSheet->Principal(),
|
aLoadData->mSheet->Principal(),
|
||||||
aLoadData->mLineNumber);
|
aLoadData->mLineNumber);
|
||||||
} else {
|
|
||||||
rv =
|
|
||||||
aLoadData->mSheet->AsServo()->ParseSheet(aInput, sheetURI, baseURI,
|
|
||||||
aLoadData->mSheet->Principal(),
|
|
||||||
aLoadData->mLineNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
mParsingDatas.RemoveElementAt(mParsingDatas.Length() - 1);
|
mParsingDatas.RemoveElementAt(mParsingDatas.Length() - 1);
|
||||||
|
|
||||||
|
|
@ -1813,10 +1783,6 @@ Loader::SheetComplete(SheetLoadData* aLoadData, nsresult aStatus)
|
||||||
{
|
{
|
||||||
LOG(("css::Loader::SheetComplete"));
|
LOG(("css::Loader::SheetComplete"));
|
||||||
|
|
||||||
if (aLoadData->mSheet->IsServo() && NS_FAILED(aStatus)) {
|
|
||||||
aLoadData->mSheet->AsServo()->LoadFailed();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 8 is probably big enough for all our common cases. It's not likely that
|
// 8 is probably big enough for all our common cases. It's not likely that
|
||||||
// imports will nest more than 8 deep, and multiple sheets with the same URI
|
// imports will nest more than 8 deep, and multiple sheets with the same URI
|
||||||
// are rare.
|
// are rare.
|
||||||
|
|
@ -1893,8 +1859,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
// If mSheetAlreadyComplete, then the sheet could well be modified between
|
// If mSheetAlreadyComplete, then the sheet could well be modified between
|
||||||
// when we posted the async call to SheetComplete and now, since the sheet
|
// when we posted the async call to SheetComplete and now, since the sheet
|
||||||
// was page-accessible during that whole time.
|
// was page-accessible during that whole time.
|
||||||
MOZ_ASSERT(!(data->mSheet->IsGecko() &&
|
MOZ_ASSERT(!data->mSheet->AsGecko()->IsModified(),
|
||||||
data->mSheet->AsGecko()->IsModified()),
|
|
||||||
"should not get marked modified during parsing");
|
"should not get marked modified during parsing");
|
||||||
data->mSheet->SetComplete();
|
data->mSheet->SetComplete();
|
||||||
data->ScheduleLoadEventIfNeeded(aStatus);
|
data->ScheduleLoadEventIfNeeded(aStatus);
|
||||||
|
|
@ -1935,7 +1900,6 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
// one of the sheets that will be kept alive by a document or
|
// one of the sheets that will be kept alive by a document or
|
||||||
// parent sheet anyway, so that if someone then accesses it via
|
// parent sheet anyway, so that if someone then accesses it via
|
||||||
// CSSOM we won't have extra clones of the inner lying around.
|
// CSSOM we won't have extra clones of the inner lying around.
|
||||||
if (aLoadData->mSheet->IsGecko()) {
|
|
||||||
data = aLoadData;
|
data = aLoadData;
|
||||||
CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko();
|
CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko();
|
||||||
while (data) {
|
while (data) {
|
||||||
|
|
@ -1956,8 +1920,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
cache->PutStyleSheet(sheet);
|
cache->PutStyleSheet(sheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#endif
|
#endif
|
||||||
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aLoadData->mURI,
|
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aLoadData->mURI,
|
||||||
aLoadData->mLoaderPrincipal,
|
aLoadData->mLoaderPrincipal,
|
||||||
|
|
@ -1969,9 +1932,6 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
NS_WARNING("stylo: Stylesheet caching not yet supported - see bug 1290218.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_RELEASE(aLoadData); // this will release parents and siblings and all that
|
NS_RELEASE(aLoadData); // this will release parents and siblings and all that
|
||||||
|
|
@ -2258,9 +2218,6 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
||||||
LOG((" No parent load; must be CSSOM"));
|
LOG((" No parent load; must be CSSOM"));
|
||||||
// No parent load data, so the sheet will need to be notified when
|
// No parent load data, so the sheet will need to be notified when
|
||||||
// we finish, if it can be, if we do the load asynchronously.
|
// we finish, if it can be, if we do the load asynchronously.
|
||||||
// XXXheycam ServoStyleSheet doesn't implement nsICSSLoaderObserver yet.
|
|
||||||
MOZ_ASSERT(aParentSheet->IsGecko(),
|
|
||||||
"stylo: ServoStyleSheets don't support child sheet loading yet");
|
|
||||||
observer = aParentSheet->AsGecko();
|
observer = aParentSheet->AsGecko();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2628,12 +2585,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Loader)
|
||||||
!iter.Done();
|
!iter.Done();
|
||||||
iter.Next()) {
|
iter.Next()) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
|
||||||
if (iter.UserData()->IsGecko()) {
|
|
||||||
CSSStyleSheet* sheet = iter.UserData()->AsGecko();
|
CSSStyleSheet* sheet = iter.UserData()->AsGecko();
|
||||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet));
|
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver>>::ForwardIterator
|
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver>>::ForwardIterator
|
||||||
it(tmp->mObservers);
|
it(tmp->mObservers);
|
||||||
while (it.HasMore()) {
|
while (it.HasMore()) {
|
||||||
|
|
|
||||||
|
|
@ -10,66 +10,25 @@
|
||||||
|
|
||||||
#include "mozilla/TypeTraits.h"
|
#include "mozilla/TypeTraits.h"
|
||||||
|
|
||||||
# define MOZ_DECL_STYLO_CHECK_METHODS \
|
|
||||||
bool IsGecko() const { return true; } \
|
|
||||||
bool IsServo() const { return false; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro used in a base class of |geckotype_| and |servotype_|.
|
* Macro used in a base class of |geckotype_| and |servotype_|.
|
||||||
* The class should define |StyleBackendType mType;| itself.
|
* The class should define |StyleBackendType mType;| itself.
|
||||||
*/
|
*/
|
||||||
#define MOZ_DECL_STYLO_METHODS(geckotype_, servotype_) \
|
#define MOZ_DECL_STYLO_METHODS(geckotype_) \
|
||||||
MOZ_DECL_STYLO_CHECK_METHODS \
|
|
||||||
inline geckotype_* AsGecko(); \
|
inline geckotype_* AsGecko(); \
|
||||||
inline servotype_* AsServo(); \
|
inline const geckotype_* AsGecko() const;
|
||||||
inline const geckotype_* AsGecko() const; \
|
|
||||||
inline const servotype_* AsServo() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro used in inline header of class |type_| with its Gecko and Servo
|
* Macro used in inline header of class |type_| with its Gecko and Servo
|
||||||
* subclasses named |geckotype_| and |servotype_| correspondingly for
|
* subclasses named |geckotype_| and |servotype_| correspondingly for
|
||||||
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
|
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
|
||||||
*/
|
*/
|
||||||
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
|
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_) \
|
||||||
geckotype_* type_::AsGecko() { \
|
geckotype_* type_::AsGecko() { \
|
||||||
MOZ_ASSERT(IsGecko()); \
|
|
||||||
return static_cast<geckotype_*>(this); \
|
return static_cast<geckotype_*>(this); \
|
||||||
} \
|
} \
|
||||||
servotype_* type_::AsServo() { \
|
|
||||||
MOZ_ASSERT(IsServo()); \
|
|
||||||
return static_cast<servotype_*>(this); \
|
|
||||||
} \
|
|
||||||
const geckotype_* type_::AsGecko() const { \
|
const geckotype_* type_::AsGecko() const { \
|
||||||
MOZ_ASSERT(IsGecko()); \
|
|
||||||
return static_cast<const geckotype_*>(this); \
|
return static_cast<const geckotype_*>(this); \
|
||||||
} \
|
|
||||||
const servotype_* type_::AsServo() const { \
|
|
||||||
MOZ_ASSERT(IsServo()); \
|
|
||||||
return static_cast<const servotype_*>(this); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOZ_STYLO_THIS_TYPE mozilla::RemovePointer<decltype(this)>::Type
|
|
||||||
#define MOZ_STYLO_GECKO_TYPE mozilla::RemovePointer<decltype(AsGecko())>::Type
|
|
||||||
#define MOZ_STYLO_SERVO_TYPE mozilla::RemovePointer<decltype(AsServo())>::Type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Macro used to forward a method call to the concrete method defined by
|
|
||||||
* the Servo or Gecko implementation. The class of the method using it
|
|
||||||
* should use MOZ_DECL_STYLO_METHODS to define basic stylo methods.
|
|
||||||
*/
|
|
||||||
#define MOZ_STYLO_FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
|
||||||
static_assert(!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::method_), \
|
|
||||||
decltype(&MOZ_STYLO_GECKO_TYPE::method_)> \
|
|
||||||
::value, "Gecko subclass should define its own " #method_); \
|
|
||||||
static_assert(!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::method_), \
|
|
||||||
decltype(&MOZ_STYLO_SERVO_TYPE::method_)> \
|
|
||||||
::value, "Servo subclass should define its own " #method_); \
|
|
||||||
if (IsServo()) { \
|
|
||||||
return AsServo()->method_ servoargs_; \
|
|
||||||
} \
|
|
||||||
return AsGecko()->method_ geckoargs_;
|
|
||||||
|
|
||||||
#define MOZ_STYLO_FORWARD(method_, args_) \
|
|
||||||
MOZ_STYLO_FORWARD_CONCRETE(method_, args_, args_)
|
|
||||||
|
|
||||||
#endif // mozilla_ServoUtils_h
|
#endif // mozilla_ServoUtils_h
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/FloatingPoint.h"
|
#include "mozilla/FloatingPoint.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/ServoBindings.h" // RawServoDeclarationBlock
|
|
||||||
#include "gfxMatrix.h"
|
#include "gfxMatrix.h"
|
||||||
#include "gfxQuaternion.h"
|
#include "gfxQuaternion.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
|
@ -3262,8 +3261,6 @@ ComputeValuesFromStyleRule(nsCSSPropertyID aProperty,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(aStyleContext->PresContext()->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSet should not use StyleAnimationValue for animations");
|
|
||||||
nsStyleSet* styleSet = aStyleContext->PresContext()->StyleSet()->AsGecko();
|
nsStyleSet* styleSet = aStyleContext->PresContext()->StyleSet()->AsGecko();
|
||||||
|
|
||||||
RefPtr<nsStyleContext> tmpStyleContext;
|
RefPtr<nsStyleContext> tmpStyleContext;
|
||||||
|
|
@ -3426,45 +3423,6 @@ StyleAnimationValue::ComputeValues(
|
||||||
aResult);
|
aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
|
||||||
StyleAnimationValue::ComputeValues(
|
|
||||||
nsCSSPropertyID aProperty,
|
|
||||||
CSSEnabledState aEnabledState,
|
|
||||||
nsStyleContext* aStyleContext,
|
|
||||||
const RawServoDeclarationBlock& aDeclarations,
|
|
||||||
nsTArray<PropertyStyleAnimationValuePair>& aValues)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aStyleContext->PresContext()->StyleSet()->IsServo(),
|
|
||||||
"Should be using ServoStyleSet if we have a"
|
|
||||||
" RawServoDeclarationBlock");
|
|
||||||
|
|
||||||
if (!nsCSSProps::IsEnabled(aProperty, aEnabledState)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ServoComputedValues* previousStyle =
|
|
||||||
aStyleContext->StyleSource().AsServoComputedValues();
|
|
||||||
|
|
||||||
// FIXME: Servo bindings don't yet represent const-ness so we just
|
|
||||||
// cast it away for now.
|
|
||||||
auto declarations = const_cast<RawServoDeclarationBlock*>(&aDeclarations);
|
|
||||||
RefPtr<ServoComputedValues> computedValues =
|
|
||||||
Servo_RestyleWithAddedDeclaration(declarations, previousStyle).Consume();
|
|
||||||
if (!computedValues) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsStyleContext> tmpStyleContext =
|
|
||||||
NS_NewStyleContext(aStyleContext, aStyleContext->PresContext(),
|
|
||||||
aStyleContext->GetPseudo(),
|
|
||||||
aStyleContext->GetPseudoType(),
|
|
||||||
computedValues.forget(),
|
|
||||||
false /* skipFixup */);
|
|
||||||
|
|
||||||
return ComputeValuesFromStyleContext(aProperty, aEnabledState,
|
|
||||||
tmpStyleContext, aValues);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
|
StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
|
||||||
const StyleAnimationValue& aComputedValue,
|
const StyleAnimationValue& aComputedValue,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsStyleContext;
|
class nsStyleContext;
|
||||||
class gfx3DMatrix;
|
class gfx3DMatrix;
|
||||||
struct RawServoDeclarationBlock;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
@ -240,17 +239,6 @@ public:
|
||||||
bool aUseSVGMode,
|
bool aUseSVGMode,
|
||||||
nsTArray<PropertyStyleAnimationValuePair>& aResult);
|
nsTArray<PropertyStyleAnimationValuePair>& aResult);
|
||||||
|
|
||||||
/**
|
|
||||||
* A variant of ComputeValues that takes a RawServoDeclarationBlock
|
|
||||||
* as the specified value.
|
|
||||||
*/
|
|
||||||
static MOZ_MUST_USE bool
|
|
||||||
ComputeValues(nsCSSPropertyID aProperty,
|
|
||||||
mozilla::CSSEnabledState aEnabledState,
|
|
||||||
nsStyleContext* aStyleContext,
|
|
||||||
const RawServoDeclarationBlock& aDeclarations,
|
|
||||||
nsTArray<PropertyStyleAnimationValuePair>& aValues);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a specified value for the given computed value.
|
* Creates a specified value for the given computed value.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -33,55 +33,23 @@ struct NonOwningStyleContextSource
|
||||||
: mBits(reinterpret_cast<uintptr_t>(aComputedValues) | 1) {}
|
: mBits(reinterpret_cast<uintptr_t>(aComputedValues) | 1) {}
|
||||||
|
|
||||||
bool operator==(const NonOwningStyleContextSource& aOther) const {
|
bool operator==(const NonOwningStyleContextSource& aOther) const {
|
||||||
MOZ_ASSERT(IsServoComputedValues() == aOther.IsServoComputedValues(),
|
// TODO: remove this servo-specific function.
|
||||||
"Comparing Servo to Gecko - probably a bug");
|
|
||||||
return mBits == aOther.mBits;
|
return mBits == aOther.mBits;
|
||||||
}
|
}
|
||||||
bool operator!=(const NonOwningStyleContextSource& aOther) const {
|
bool operator!=(const NonOwningStyleContextSource& aOther) const {
|
||||||
return !(*this == aOther);
|
return !(*this == aOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We intentionally avoid exposing IsGeckoRuleNode() here, because that would
|
|
||||||
// encourage callers to do:
|
|
||||||
//
|
|
||||||
// if (source.IsGeckoRuleNode()) {
|
|
||||||
// // Code that we would run unconditionally if it weren't for Servo.
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// We want these branches to compile away when MOZ_STYLO is disabled, but that
|
|
||||||
// won't happen if there's an implicit null-check.
|
|
||||||
bool IsNull() const { return !mBits; }
|
bool IsNull() const { return !mBits; }
|
||||||
bool IsGeckoRuleNodeOrNull() const { return !IsServoComputedValues(); }
|
|
||||||
bool IsServoComputedValues() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRuleNode* AsGeckoRuleNode() const {
|
nsRuleNode* AsGeckoRuleNode() const {
|
||||||
MOZ_ASSERT(IsGeckoRuleNodeOrNull() && !IsNull());
|
|
||||||
return reinterpret_cast<nsRuleNode*>(mBits);
|
return reinterpret_cast<nsRuleNode*>(mBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServoComputedValues* AsServoComputedValues() const {
|
|
||||||
MOZ_ASSERT(IsServoComputedValues());
|
|
||||||
return reinterpret_cast<ServoComputedValues*>(mBits & ~1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MatchesNoRules() const {
|
bool MatchesNoRules() const {
|
||||||
if (IsGeckoRuleNodeOrNull()) {
|
|
||||||
return AsGeckoRuleNode()->IsRoot();
|
return AsGeckoRuleNode()->IsRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just assume a Servo-backed StyleContextSource always matches some rules.
|
|
||||||
//
|
|
||||||
// MatchesNoRules is used to ensure style contexts that match no rules
|
|
||||||
// go into a separate mEmptyChild list on their parent. This is only used
|
|
||||||
// as an optimization so that calling FindChildWithRules for style context
|
|
||||||
// sharing is faster for text nodes (which match no rules, and are common).
|
|
||||||
// Since Servo will handle sharing for us, there's no need to split children
|
|
||||||
// into two lists.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uintptr_t mBits;
|
uintptr_t mBits;
|
||||||
};
|
};
|
||||||
|
|
@ -118,12 +86,8 @@ struct OwningStyleContextSource
|
||||||
MOZ_COUNT_DTOR(OwningStyleContextSource);
|
MOZ_COUNT_DTOR(OwningStyleContextSource);
|
||||||
if (mRaw.IsNull()) {
|
if (mRaw.IsNull()) {
|
||||||
// We must have invoked the move constructor.
|
// We must have invoked the move constructor.
|
||||||
} else if (IsGeckoRuleNode()) {
|
|
||||||
RefPtr<nsRuleNode> releaseme = dont_AddRef(AsGeckoRuleNode());
|
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(IsServoComputedValues());
|
RefPtr<nsRuleNode> releaseme = dont_AddRef(AsGeckoRuleNode());
|
||||||
RefPtr<ServoComputedValues> releaseme =
|
|
||||||
dont_AddRef(AsServoComputedValues());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,17 +98,9 @@ struct OwningStyleContextSource
|
||||||
return !(*this == aOther);
|
return !(*this == aOther);
|
||||||
}
|
}
|
||||||
bool IsNull() const { return mRaw.IsNull(); }
|
bool IsNull() const { return mRaw.IsNull(); }
|
||||||
bool IsGeckoRuleNode() const {
|
|
||||||
MOZ_ASSERT(!mRaw.IsNull());
|
|
||||||
return mRaw.IsGeckoRuleNodeOrNull();
|
|
||||||
}
|
|
||||||
bool IsServoComputedValues() const { return mRaw.IsServoComputedValues(); }
|
|
||||||
|
|
||||||
NonOwningStyleContextSource AsRaw() const { return mRaw; }
|
NonOwningStyleContextSource AsRaw() const { return mRaw; }
|
||||||
nsRuleNode* AsGeckoRuleNode() const { return mRaw.AsGeckoRuleNode(); }
|
nsRuleNode* AsGeckoRuleNode() const { return mRaw.AsGeckoRuleNode(); }
|
||||||
ServoComputedValues* AsServoComputedValues() const {
|
|
||||||
return const_cast<ServoComputedValues*>(mRaw.AsServoComputedValues());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MatchesNoRules() const { return mRaw.MatchesNoRules(); }
|
bool MatchesNoRules() const { return mRaw.MatchesNoRules(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class CSSStyleSheet;
|
class CSSStyleSheet;
|
||||||
class ServoStyleSet;
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Element;
|
class Element;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
@ -32,11 +31,8 @@ struct TreeMatchContext;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
#define SERVO_BIT 0x1
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart pointer class that can hold a pointer to either an nsStyleSet
|
* Smart pointer class that can hold a pointer to an nsStyleSet.
|
||||||
* or a ServoStyleSet.
|
|
||||||
*/
|
*/
|
||||||
class StyleSetHandle
|
class StyleSetHandle
|
||||||
{
|
{
|
||||||
|
|
@ -50,55 +46,32 @@ public:
|
||||||
public:
|
public:
|
||||||
friend class ::mozilla::StyleSetHandle;
|
friend class ::mozilla::StyleSetHandle;
|
||||||
|
|
||||||
bool IsGecko() const { return !IsServo(); }
|
|
||||||
bool IsServo() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StyleBackendType BackendType() const
|
StyleBackendType BackendType() const
|
||||||
{
|
{
|
||||||
return IsGecko() ? StyleBackendType::Gecko :
|
return StyleBackendType::Gecko;
|
||||||
StyleBackendType::Servo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleSet* AsGecko()
|
nsStyleSet* AsGecko()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsGecko());
|
|
||||||
return reinterpret_cast<nsStyleSet*>(mValue);
|
return reinterpret_cast<nsStyleSet*>(mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServoStyleSet* AsServo()
|
nsStyleSet* GetAsGecko() { return AsGecko(); }
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsServo());
|
|
||||||
return reinterpret_cast<ServoStyleSet*>(mValue & ~SERVO_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsStyleSet* GetAsGecko() { return IsGecko() ? AsGecko() : nullptr; }
|
|
||||||
ServoStyleSet* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
|
|
||||||
|
|
||||||
const nsStyleSet* AsGecko() const
|
const nsStyleSet* AsGecko() const
|
||||||
{
|
{
|
||||||
return const_cast<Ptr*>(this)->AsGecko();
|
return const_cast<Ptr*>(this)->AsGecko();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServoStyleSet* AsServo() const
|
const nsStyleSet* GetAsGecko() const { return AsGecko(); }
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsServo());
|
|
||||||
return const_cast<Ptr*>(this)->AsServo();
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsStyleSet* GetAsGecko() const { return IsGecko() ? AsGecko() : nullptr; }
|
|
||||||
const ServoStyleSet* GetAsServo() const { return IsServo() ? AsServo() : nullptr; }
|
|
||||||
|
|
||||||
// These inline methods are defined in StyleSetHandleInlines.h.
|
// These inline methods are defined in StyleSetHandleInlines.h.
|
||||||
inline void Delete();
|
inline void Delete();
|
||||||
|
|
||||||
// Style set interface. These inline methods are defined in
|
// Style set interface. These inline methods are defined in
|
||||||
// StyleSetHandleInlines.h and just forward to the underlying
|
// StyleSetHandleInlines.h and just forward to the underlying
|
||||||
// nsStyleSet or ServoStyleSet. See corresponding comments in
|
// nsStyleSet. See corresponding comments in nsStyleSet.h for
|
||||||
// nsStyleSet.h for descriptions of these methods.
|
// descriptions of these methods.
|
||||||
|
|
||||||
inline void Init(nsPresContext* aPresContext);
|
inline void Init(nsPresContext* aPresContext);
|
||||||
inline void BeginShutdown();
|
inline void BeginShutdown();
|
||||||
|
|
@ -161,7 +134,7 @@ public:
|
||||||
inline void RootStyleContextRemoved();
|
inline void RootStyleContextRemoved();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Stores a pointer to an nsStyleSet or a ServoStyleSet. The least
|
// Stores a pointer to an nsStyleSet. The least
|
||||||
// significant bit is 0 for the former, 1 for the latter. This is
|
// significant bit is 0 for the former, 1 for the latter. This is
|
||||||
// valid as the least significant bit will never be used for a pointer
|
// valid as the least significant bit will never be used for a pointer
|
||||||
// value on platforms we care about.
|
// value on platforms we care about.
|
||||||
|
|
@ -171,22 +144,13 @@ public:
|
||||||
StyleSetHandle() { mPtr.mValue = 0; }
|
StyleSetHandle() { mPtr.mValue = 0; }
|
||||||
StyleSetHandle(const StyleSetHandle& aOth) { mPtr.mValue = aOth.mPtr.mValue; }
|
StyleSetHandle(const StyleSetHandle& aOth) { mPtr.mValue = aOth.mPtr.mValue; }
|
||||||
MOZ_IMPLICIT StyleSetHandle(nsStyleSet* aSet) { *this = aSet; }
|
MOZ_IMPLICIT StyleSetHandle(nsStyleSet* aSet) { *this = aSet; }
|
||||||
MOZ_IMPLICIT StyleSetHandle(ServoStyleSet* aSet) { *this = aSet; }
|
|
||||||
|
|
||||||
StyleSetHandle& operator=(nsStyleSet* aStyleSet)
|
StyleSetHandle& operator=(nsStyleSet* aStyleSet)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!(reinterpret_cast<uintptr_t>(aStyleSet) & SERVO_BIT),
|
|
||||||
"least significant bit shouldn't be set; we use it for state");
|
|
||||||
mPtr.mValue = reinterpret_cast<uintptr_t>(aStyleSet);
|
mPtr.mValue = reinterpret_cast<uintptr_t>(aStyleSet);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSetHandle& operator=(ServoStyleSet* aStyleSet)
|
|
||||||
{
|
|
||||||
MOZ_CRASH("should not have a ServoStyleSet object when MOZ_STYLO is "
|
|
||||||
"disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make StyleSetHandle usable in boolean contexts.
|
// Make StyleSetHandle usable in boolean contexts.
|
||||||
explicit operator bool() const { return !!mPtr.mValue; }
|
explicit operator bool() const { return !!mPtr.mValue; }
|
||||||
bool operator!() const { return !mPtr.mValue; }
|
bool operator!() const { return !mPtr.mValue; }
|
||||||
|
|
@ -199,8 +163,6 @@ private:
|
||||||
Ptr mPtr;
|
Ptr mPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef SERVO_BIT
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_StyleSetHandle_h
|
#endif // mozilla_StyleSetHandle_h
|
||||||
|
|
|
||||||
|
|
@ -7,72 +7,58 @@
|
||||||
#define mozilla_StyleSetHandleInlines_h
|
#define mozilla_StyleSetHandleInlines_h
|
||||||
|
|
||||||
#include "mozilla/StyleSheetInlines.h"
|
#include "mozilla/StyleSheetInlines.h"
|
||||||
#include "mozilla/ServoStyleSet.h"
|
|
||||||
#include "nsStyleSet.h"
|
#include "nsStyleSet.h"
|
||||||
|
|
||||||
#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
|
||||||
if (IsGecko()) { \
|
|
||||||
return AsGecko()->method_ geckoargs_; \
|
|
||||||
} else { \
|
|
||||||
return AsServo()->method_ servoargs_; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::Delete()
|
StyleSetHandle::Ptr::Delete()
|
||||||
{
|
{
|
||||||
if (mValue) {
|
if (mValue) {
|
||||||
if (IsGecko()) {
|
|
||||||
delete AsGecko();
|
delete AsGecko();
|
||||||
} else {
|
|
||||||
delete AsServo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::Init(nsPresContext* aPresContext)
|
StyleSetHandle::Ptr::Init(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
FORWARD(Init, (aPresContext));
|
AsGecko()->Init(aPresContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::BeginShutdown()
|
StyleSetHandle::Ptr::BeginShutdown()
|
||||||
{
|
{
|
||||||
FORWARD(BeginShutdown, ());
|
AsGecko()->BeginShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::Shutdown()
|
StyleSetHandle::Ptr::Shutdown()
|
||||||
{
|
{
|
||||||
FORWARD(Shutdown, ());
|
AsGecko()->Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StyleSetHandle::Ptr::GetAuthorStyleDisabled() const
|
StyleSetHandle::Ptr::GetAuthorStyleDisabled() const
|
||||||
{
|
{
|
||||||
FORWARD(GetAuthorStyleDisabled, ());
|
return AsGecko()->GetAuthorStyleDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::SetAuthorStyleDisabled(bool aStyleDisabled)
|
StyleSetHandle::Ptr::SetAuthorStyleDisabled(bool aStyleDisabled)
|
||||||
{
|
{
|
||||||
FORWARD(SetAuthorStyleDisabled, (aStyleDisabled));
|
return AsGecko()->SetAuthorStyleDisabled(aStyleDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::BeginUpdate()
|
StyleSetHandle::Ptr::BeginUpdate()
|
||||||
{
|
{
|
||||||
FORWARD(BeginUpdate, ());
|
AsGecko()->BeginUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::EndUpdate()
|
StyleSetHandle::Ptr::EndUpdate()
|
||||||
{
|
{
|
||||||
FORWARD(EndUpdate, ());
|
return AsGecko()->EndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve a style context
|
// resolve a style context
|
||||||
|
|
@ -80,7 +66,7 @@ already_AddRefed<nsStyleContext>
|
||||||
StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
|
StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
|
||||||
nsStyleContext* aParentContext)
|
nsStyleContext* aParentContext)
|
||||||
{
|
{
|
||||||
FORWARD(ResolveStyleFor, (aElement, aParentContext));
|
return AsGecko()->ResolveStyleFor(aElement, aParentContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
|
|
@ -88,20 +74,20 @@ StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
|
||||||
nsStyleContext* aParentContext,
|
nsStyleContext* aParentContext,
|
||||||
TreeMatchContext& aTreeMatchContext)
|
TreeMatchContext& aTreeMatchContext)
|
||||||
{
|
{
|
||||||
FORWARD(ResolveStyleFor, (aElement, aParentContext, aTreeMatchContext));
|
return AsGecko()->ResolveStyleFor(aElement, aParentContext, aTreeMatchContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode,
|
StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode,
|
||||||
nsStyleContext* aParentContext)
|
nsStyleContext* aParentContext)
|
||||||
{
|
{
|
||||||
FORWARD(ResolveStyleForText, (aTextNode, aParentContext));
|
return AsGecko()->ResolveStyleForText(aTextNode, aParentContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
StyleSetHandle::Ptr::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext)
|
StyleSetHandle::Ptr::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext)
|
||||||
{
|
{
|
||||||
FORWARD(ResolveStyleForOtherNonElement, (aParentContext));
|
return AsGecko()->ResolveStyleForOtherNonElement(aParentContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
|
|
@ -110,8 +96,8 @@ StyleSetHandle::Ptr::ResolvePseudoElementStyle(dom::Element* aParentElement,
|
||||||
nsStyleContext* aParentContext,
|
nsStyleContext* aParentContext,
|
||||||
dom::Element* aPseudoElement)
|
dom::Element* aPseudoElement)
|
||||||
{
|
{
|
||||||
FORWARD(ResolvePseudoElementStyle, (aParentElement, aType, aParentContext,
|
return AsGecko()->ResolvePseudoElementStyle(
|
||||||
aPseudoElement));
|
aParentElement, aType, aParentContext, aPseudoElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// aFlags is an nsStyleSet flags bitfield
|
// aFlags is an nsStyleSet flags bitfield
|
||||||
|
|
@ -120,48 +106,37 @@ StyleSetHandle::Ptr::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
||||||
nsStyleContext* aParentContext,
|
nsStyleContext* aParentContext,
|
||||||
uint32_t aFlags)
|
uint32_t aFlags)
|
||||||
{
|
{
|
||||||
FORWARD(ResolveAnonymousBoxStyle, (aPseudoTag, aParentContext, aFlags));
|
return AsGecko()->ResolveAnonymousBoxStyle(aPseudoTag, aParentContext, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// manage the set of style sheets in the style set
|
// manage the set of style sheets in the style set
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
|
StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(AppendStyleSheet, (aType, aSheet->AsGecko()),
|
return AsGecko()->AppendStyleSheet(aType, aSheet->AsGecko());
|
||||||
(aType, aSheet->AsServo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet)
|
StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(PrependStyleSheet, (aType, aSheet->AsGecko()),
|
return AsGecko()->PrependStyleSheet(aType, aSheet->AsGecko());
|
||||||
(aType, aSheet->AsServo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet)
|
StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(RemoveStyleSheet, (aType, aSheet->AsGecko()),
|
return AsGecko()->RemoveStyleSheet(aType, aSheet->AsGecko());
|
||||||
(aType, aSheet->AsServo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
|
StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
|
||||||
const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
|
const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
|
||||||
{
|
{
|
||||||
if (IsGecko()) {
|
|
||||||
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aNewSheets.Length());
|
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aNewSheets.Length());
|
||||||
for (auto& sheet : aNewSheets) {
|
for (auto& sheet : aNewSheets) {
|
||||||
newSheets.AppendElement(sheet->AsGecko());
|
newSheets.AppendElement(sheet->AsGecko());
|
||||||
}
|
}
|
||||||
return AsGecko()->ReplaceSheets(aType, newSheets);
|
return AsGecko()->ReplaceSheets(aType, newSheets);
|
||||||
} else {
|
|
||||||
nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
|
|
||||||
for (auto& sheet : aNewSheets) {
|
|
||||||
newSheets.AppendElement(sheet->AsServo());
|
|
||||||
}
|
|
||||||
return AsServo()->ReplaceSheets(aType, newSheets);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -169,37 +144,33 @@ StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType,
|
||||||
StyleSheet* aNewSheet,
|
StyleSheet* aNewSheet,
|
||||||
StyleSheet* aReferenceSheet)
|
StyleSheet* aReferenceSheet)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(
|
return AsGecko()->InsertStyleSheetBefore(
|
||||||
InsertStyleSheetBefore,
|
aType, aNewSheet->AsGecko(), aReferenceSheet->AsGecko());
|
||||||
(aType, aNewSheet->AsGecko(), aReferenceSheet->AsGecko()),
|
|
||||||
(aType, aReferenceSheet->AsServo(), aReferenceSheet->AsServo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
StyleSetHandle::Ptr::SheetCount(SheetType aType) const
|
StyleSetHandle::Ptr::SheetCount(SheetType aType) const
|
||||||
{
|
{
|
||||||
FORWARD(SheetCount, (aType));
|
return AsGecko()->SheetCount(aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const
|
StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const
|
||||||
{
|
{
|
||||||
FORWARD(StyleSheetAt, (aType, aIndex));
|
return AsGecko()->StyleSheetAt(aType, aIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet)
|
StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(RemoveDocStyleSheet, (aSheet->AsGecko()),
|
return AsGecko()->RemoveDocStyleSheet(aSheet->AsGecko());
|
||||||
(aSheet->AsServo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet,
|
StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet,
|
||||||
nsIDocument* aDocument)
|
nsIDocument* aDocument)
|
||||||
{
|
{
|
||||||
FORWARD_CONCRETE(AddDocStyleSheet, (aSheet->AsGecko(), aDocument),
|
return AsGecko()->AddDocStyleSheet(aSheet->AsGecko(), aDocument);
|
||||||
(aSheet->AsServo(), aDocument));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether there is ::before/::after style for an element
|
// check whether there is ::before/::after style for an element
|
||||||
|
|
@ -208,7 +179,7 @@ StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||||
CSSPseudoElementType aType,
|
CSSPseudoElementType aType,
|
||||||
nsStyleContext* aParentContext)
|
nsStyleContext* aParentContext)
|
||||||
{
|
{
|
||||||
FORWARD(ProbePseudoElementStyle, (aParentElement, aType, aParentContext));
|
return AsGecko()->ProbePseudoElementStyle(aParentElement, aType, aParentContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
|
|
@ -218,15 +189,15 @@ StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||||
TreeMatchContext& aTreeMatchContext,
|
TreeMatchContext& aTreeMatchContext,
|
||||||
dom::Element* aPseudoElement)
|
dom::Element* aPseudoElement)
|
||||||
{
|
{
|
||||||
FORWARD(ProbePseudoElementStyle, (aParentElement, aType, aParentContext,
|
return AsGecko()->ProbePseudoElementStyle(
|
||||||
aTreeMatchContext, aPseudoElement));
|
aParentElement, aType, aParentContext, aTreeMatchContext, aPseudoElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRestyleHint
|
nsRestyleHint
|
||||||
StyleSetHandle::Ptr::HasStateDependentStyle(dom::Element* aElement,
|
StyleSetHandle::Ptr::HasStateDependentStyle(dom::Element* aElement,
|
||||||
EventStates aStateMask)
|
EventStates aStateMask)
|
||||||
{
|
{
|
||||||
FORWARD(HasStateDependentStyle, (aElement, aStateMask));
|
return AsGecko()->HasStateDependentStyle(aElement, aStateMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRestyleHint
|
nsRestyleHint
|
||||||
|
|
@ -235,32 +206,21 @@ StyleSetHandle::Ptr::HasStateDependentStyle(dom::Element* aElement,
|
||||||
dom::Element* aPseudoElement,
|
dom::Element* aPseudoElement,
|
||||||
EventStates aStateMask)
|
EventStates aStateMask)
|
||||||
{
|
{
|
||||||
FORWARD(HasStateDependentStyle, (aElement, aPseudoType, aPseudoElement,
|
return AsGecko()->HasStateDependentStyle(aElement, aPseudoType, aPseudoElement, aStateMask);
|
||||||
aStateMask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::RootStyleContextAdded()
|
StyleSetHandle::Ptr::RootStyleContextAdded()
|
||||||
{
|
{
|
||||||
if (IsGecko()) {
|
|
||||||
AsGecko()->RootStyleContextAdded();
|
AsGecko()->RootStyleContextAdded();
|
||||||
} else {
|
|
||||||
// Not needed.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSetHandle::Ptr::RootStyleContextRemoved()
|
StyleSetHandle::Ptr::RootStyleContextRemoved()
|
||||||
{
|
{
|
||||||
if (IsGecko()) {
|
|
||||||
RootStyleContextAdded();
|
RootStyleContextAdded();
|
||||||
} else {
|
|
||||||
// Not needed.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#undef FORWARD
|
|
||||||
|
|
||||||
#endif // mozilla_StyleSetHandleInlines_h
|
#endif // mozilla_StyleSetHandleInlines_h
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ StyleSheet::IsComplete() const
|
||||||
void
|
void
|
||||||
StyleSheet::SetComplete()
|
StyleSheet::SetComplete()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!IsGecko() || !AsGecko()->mDirty,
|
NS_ASSERTION(!AsGecko()->mDirty,
|
||||||
"Can't set a dirty sheet complete!");
|
"Can't set a dirty sheet complete!");
|
||||||
SheetInfo().mComplete = true;
|
SheetInfo().mComplete = true;
|
||||||
if (mDocument && !mDisabled) {
|
if (mDocument && !mDisabled) {
|
||||||
|
|
@ -138,11 +138,7 @@ StyleSheet::SetDisabled(bool aDisabled)
|
||||||
{
|
{
|
||||||
// DOM method, so handle BeginUpdate/EndUpdate
|
// DOM method, so handle BeginUpdate/EndUpdate
|
||||||
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
|
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
|
||||||
if (IsGecko()) {
|
|
||||||
AsGecko()->SetEnabled(!aDisabled);
|
AsGecko()->SetEnabled(!aDisabled);
|
||||||
} else {
|
|
||||||
MOZ_CRASH("stylo: unimplemented SetEnabled");
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,12 +225,6 @@ StyleSheet::DeleteRule(uint32_t aIndex)
|
||||||
|
|
||||||
// WebIDL CSSStyleSheet API
|
// WebIDL CSSStyleSheet API
|
||||||
|
|
||||||
#define FORWARD_INTERNAL(method_, args_) \
|
|
||||||
if (IsServo()) { \
|
|
||||||
return AsServo()->method_ args_; \
|
|
||||||
} \
|
|
||||||
return AsGecko()->method_ args_;
|
|
||||||
|
|
||||||
dom::CSSRuleList*
|
dom::CSSRuleList*
|
||||||
StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
|
|
@ -242,7 +232,7 @@ StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
FORWARD_INTERNAL(GetCssRulesInternal, (aRv))
|
return AsGecko()->GetCssRulesInternal(aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -253,7 +243,7 @@ StyleSheet::InsertRule(const nsAString& aRule, uint32_t aIndex,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FORWARD_INTERNAL(InsertRuleInternal, (aRule, aIndex, aRv))
|
return AsGecko()->InsertRuleInternal(aRule, aIndex, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -264,7 +254,7 @@ StyleSheet::DeleteRule(uint32_t aIndex,
|
||||||
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FORWARD_INTERNAL(DeleteRuleInternal, (aIndex, aRv))
|
AsGecko()->DeleteRuleInternal(aIndex, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
|
|
@ -288,13 +278,11 @@ StyleSheet::AddRule(const nsAString& aSelector, const nsAString& aBlock,
|
||||||
auto index =
|
auto index =
|
||||||
aIndex.WasPassed() ? aIndex.Value() : GetCssRules(aSubjectPrincipal, aRv)->Length();
|
aIndex.WasPassed() ? aIndex.Value() : GetCssRules(aSubjectPrincipal, aRv)->Length();
|
||||||
|
|
||||||
FORWARD_INTERNAL(InsertRuleInternal, (rule, index, aRv));
|
return AsGecko()->InsertRuleInternal(rule, index, aRv);
|
||||||
// As per Microsoft documentation, always return -1.
|
// As per Microsoft documentation, always return -1.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef FORWARD_INTERNAL
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSheet::SubjectSubsumesInnerPrincipal(nsIPrincipal& aSubjectPrincipal,
|
StyleSheet::SubjectSubsumesInnerPrincipal(nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public:
|
||||||
bool IsComplete() const;
|
bool IsComplete() const;
|
||||||
void SetComplete();
|
void SetComplete();
|
||||||
|
|
||||||
MOZ_DECL_STYLO_METHODS(CSSStyleSheet, ServoStyleSheet)
|
MOZ_DECL_STYLO_METHODS(CSSStyleSheet)
|
||||||
|
|
||||||
// Whether the sheet is for an inline <style> element.
|
// Whether the sheet is for an inline <style> element.
|
||||||
inline bool IsInline() const;
|
inline bool IsInline() const;
|
||||||
|
|
|
||||||
|
|
@ -7,28 +7,21 @@
|
||||||
#define mozilla_StyleSheetInlines_h
|
#define mozilla_StyleSheetInlines_h
|
||||||
|
|
||||||
#include "mozilla/StyleSheetInfo.h"
|
#include "mozilla/StyleSheetInfo.h"
|
||||||
#include "mozilla/ServoStyleSheet.h"
|
|
||||||
#include "mozilla/CSSStyleSheet.h"
|
#include "mozilla/CSSStyleSheet.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet, ServoStyleSheet)
|
MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet)
|
||||||
|
|
||||||
StyleSheetInfo&
|
StyleSheetInfo&
|
||||||
StyleSheet::SheetInfo()
|
StyleSheet::SheetInfo()
|
||||||
{
|
{
|
||||||
if (IsServo()) {
|
|
||||||
return AsServo()->mSheetInfo;
|
|
||||||
}
|
|
||||||
return *AsGecko()->mInner;
|
return *AsGecko()->mInner;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyleSheetInfo&
|
const StyleSheetInfo&
|
||||||
StyleSheet::SheetInfo() const
|
StyleSheet::SheetInfo() const
|
||||||
{
|
{
|
||||||
if (IsServo()) {
|
|
||||||
return AsServo()->mSheetInfo;
|
|
||||||
}
|
|
||||||
return *AsGecko()->mInner;
|
return *AsGecko()->mInner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,7 +71,7 @@ StyleSheet::IsApplicable() const
|
||||||
bool
|
bool
|
||||||
StyleSheet::HasRules() const
|
StyleSheet::HasRules() const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(HasRules, ())
|
return AsGecko()->HasRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -86,19 +79,19 @@ StyleSheet::SetAssociatedDocument(nsIDocument* aDocument,
|
||||||
DocumentAssociationMode aAssociationMode)
|
DocumentAssociationMode aAssociationMode)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aDocument);
|
MOZ_ASSERT(aDocument);
|
||||||
MOZ_STYLO_FORWARD(SetAssociatedDocument, (aDocument, aAssociationMode))
|
AsGecko()->SetAssociatedDocument(aDocument, aAssociationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleSheet::ClearAssociatedDocument()
|
StyleSheet::ClearAssociatedDocument()
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(SetAssociatedDocument, (nullptr, NotOwnedByDocument));
|
AsGecko()->SetAssociatedDocument(nullptr, NotOwnedByDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
StyleSheet::GetParentSheet() const
|
StyleSheet::GetParentSheet() const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(GetParentSheet, ())
|
return AsGecko()->GetParentSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
|
|
@ -119,8 +112,7 @@ StyleSheet::GetParentObject() const
|
||||||
void
|
void
|
||||||
StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
|
StyleSheet::AppendStyleSheet(StyleSheet* aSheet)
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD_CONCRETE(AppendStyleSheet,
|
AsGecko()->AppendStyleSheet(aSheet->AsGecko());
|
||||||
(aSheet->AsGecko()), (aSheet->AsServo()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPrincipal*
|
nsIPrincipal*
|
||||||
|
|
@ -163,19 +155,19 @@ StyleSheet::GetIntegrity(dom::SRIMetadata& aResult) const
|
||||||
size_t
|
size_t
|
||||||
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
StyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(SizeOfIncludingThis, (aMallocSizeOf))
|
return AsGecko()->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void
|
void
|
||||||
StyleSheet::List(FILE* aOut, int32_t aIndex) const
|
StyleSheet::List(FILE* aOut, int32_t aIndex) const
|
||||||
{
|
{
|
||||||
MOZ_STYLO_FORWARD(List, (aOut, aIndex))
|
AsGecko()->List(aOut, aIndex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void StyleSheet::WillDirty() { MOZ_STYLO_FORWARD(WillDirty, ()) }
|
void StyleSheet::WillDirty() { AsGecko()->WillDirty(); }
|
||||||
void StyleSheet::DidDirty() { MOZ_STYLO_FORWARD(DidDirty, ()) }
|
void StyleSheet::DidDirty() { AsGecko()->DidDirty(); }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,9 +525,6 @@ ResolvedStyleCache::Get(nsPresContext *aPresContext,
|
||||||
|
|
||||||
nsCOMArray<nsIStyleRule> rules;
|
nsCOMArray<nsIStyleRule> rules;
|
||||||
rules.AppendObject(aKeyframeDeclaration);
|
rules.AppendObject(aKeyframeDeclaration);
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSet should not use nsAnimationManager for "
|
|
||||||
"animations");
|
|
||||||
RefPtr<nsStyleContext> resultStrong = aPresContext->StyleSet()->AsGecko()->
|
RefPtr<nsStyleContext> resultStrong = aPresContext->StyleSet()->AsGecko()->
|
||||||
ResolveStyleByAddingRules(aParentStyleContext, rules);
|
ResolveStyleByAddingRules(aParentStyleContext, rules);
|
||||||
mCache.Put(aKeyframeDeclaration, resultStrong);
|
mCache.Put(aKeyframeDeclaration, resultStrong);
|
||||||
|
|
@ -1055,9 +1052,6 @@ CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext,
|
||||||
StyleAnimationValue computedValue;
|
StyleAnimationValue computedValue;
|
||||||
|
|
||||||
if (!mStyleWithoutAnimation) {
|
if (!mStyleWithoutAnimation) {
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSet should not use nsAnimationManager for "
|
|
||||||
"animations");
|
|
||||||
mStyleWithoutAnimation = aPresContext->StyleSet()->AsGecko()->
|
mStyleWithoutAnimation = aPresContext->StyleSet()->AsGecko()->
|
||||||
ResolveStyleWithoutAnimation(mTarget, mStyleContext,
|
ResolveStyleWithoutAnimation(mTarget, mStyleContext,
|
||||||
eRestyle_AllHintsWithAnimations);
|
eRestyle_AllHintsWithAnimations);
|
||||||
|
|
@ -1101,9 +1095,6 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
||||||
// "none" which is represented by an empty name in the StyleAnimation.
|
// "none" which is represented by an empty name in the StyleAnimation.
|
||||||
// Since such animations neither affect style nor dispatch events, we do
|
// Since such animations neither affect style nor dispatch events, we do
|
||||||
// not generate a corresponding CSSAnimation for them.
|
// not generate a corresponding CSSAnimation for them.
|
||||||
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSet should not use nsAnimationManager for "
|
|
||||||
"animations");
|
|
||||||
nsCSSKeyframesRule* rule =
|
nsCSSKeyframesRule* rule =
|
||||||
src.GetName().IsEmpty()
|
src.GetName().IsEmpty()
|
||||||
? nullptr
|
? nullptr
|
||||||
|
|
|
||||||
|
|
@ -523,11 +523,6 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aStyleType == eDefaultOnly) {
|
if (aStyleType == eDefaultOnly) {
|
||||||
if (styleSet->IsServo()) {
|
|
||||||
NS_ERROR("stylo: ServoStyleSets cannot supply UA-only styles yet");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We really only want the user and UA rules. Filter out the other ones.
|
// We really only want the user and UA rules. Filter out the other ones.
|
||||||
nsTArray< nsCOMPtr<nsIStyleRule> > rules;
|
nsTArray< nsCOMPtr<nsIStyleRule> > rules;
|
||||||
for (nsRuleNode* ruleNode = sc->RuleNode();
|
for (nsRuleNode* ruleNode = sc->RuleNode();
|
||||||
|
|
@ -653,10 +648,7 @@ MustReresolveStyle(const nsStyleContext* aContext)
|
||||||
MOZ_ASSERT(aContext);
|
MOZ_ASSERT(aContext);
|
||||||
|
|
||||||
if (aContext->HasPseudoElementData()) {
|
if (aContext->HasPseudoElementData()) {
|
||||||
if (!aContext->GetPseudo() ||
|
if (!aContext->GetPseudo()) {
|
||||||
aContext->StyleSource().IsServoComputedValues()) {
|
|
||||||
// TODO(emilio): When ::first-line is supported in Servo, we may want to
|
|
||||||
// fix this to avoid re-resolving pseudo-element styles.
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,6 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
|
||||||
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
||||||
|
|
||||||
RefPtr<DeclarationBlock> newdecl;
|
RefPtr<DeclarationBlock> newdecl;
|
||||||
if (olddecl->IsServo()) {
|
|
||||||
newdecl = ServoDeclarationBlock::FromCssText(aCssText);
|
|
||||||
} else {
|
|
||||||
RefPtr<css::Declaration> decl(new css::Declaration());
|
RefPtr<css::Declaration> decl(new css::Declaration());
|
||||||
decl->InitializeEmpty();
|
decl->InitializeEmpty();
|
||||||
nsCSSParser cssParser(env.mCSSLoader);
|
nsCSSParser cssParser(env.mCSSLoader);
|
||||||
|
|
@ -145,7 +142,6 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
newdecl = decl.forget();
|
newdecl = decl.forget();
|
||||||
}
|
|
||||||
|
|
||||||
return SetCSSDeclaration(newdecl);
|
return SetCSSDeclaration(newdecl);
|
||||||
}
|
}
|
||||||
|
|
@ -300,17 +296,10 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
|
||||||
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
|
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
|
||||||
|
|
||||||
bool changed;
|
bool changed;
|
||||||
if (decl->IsGecko()) {
|
|
||||||
nsCSSParser cssParser(env.mCSSLoader);
|
nsCSSParser cssParser(env.mCSSLoader);
|
||||||
cssParser.ParseProperty(aPropID, aPropValue,
|
cssParser.ParseProperty(aPropID, aPropValue,
|
||||||
env.mSheetURI, env.mBaseURI, env.mPrincipal,
|
env.mSheetURI, env.mBaseURI, env.mPrincipal,
|
||||||
decl->AsGecko(), &changed, aIsImportant);
|
decl->AsGecko(), &changed, aIsImportant);
|
||||||
} else {
|
|
||||||
nsIAtom* atom = nsCSSProps::AtomForProperty(aPropID);
|
|
||||||
NS_ConvertUTF16toUTF8 value(aPropValue);
|
|
||||||
changed = Servo_DeclarationBlock_SetProperty(
|
|
||||||
decl->AsServo()->Raw(), atom, false, &value, aIsImportant);
|
|
||||||
}
|
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
// Parsing failed -- but we don't throw an exception for that.
|
// Parsing failed -- but we don't throw an exception for that.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -347,17 +336,10 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
|
||||||
|
|
||||||
bool changed;
|
bool changed;
|
||||||
auto propName = Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
|
auto propName = Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
|
||||||
if (decl->IsGecko()) {
|
|
||||||
nsCSSParser cssParser(env.mCSSLoader);
|
nsCSSParser cssParser(env.mCSSLoader);
|
||||||
cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
|
cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
|
||||||
env.mBaseURI, env.mPrincipal, decl->AsGecko(),
|
env.mBaseURI, env.mPrincipal, decl->AsGecko(),
|
||||||
&changed, aIsImportant);
|
&changed, aIsImportant);
|
||||||
} else {
|
|
||||||
RefPtr<nsIAtom> atom = NS_Atomize(propName);
|
|
||||||
NS_ConvertUTF16toUTF8 value(aPropValue);
|
|
||||||
changed = Servo_DeclarationBlock_SetProperty(
|
|
||||||
decl->AsServo()->Raw(), atom, true, &value, aIsImportant);
|
|
||||||
}
|
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
// Parsing failed -- but we don't throw an exception for that.
|
// Parsing failed -- but we don't throw an exception for that.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,6 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
|
||||||
|
|
||||||
declaration = aElement->GetSMILOverrideStyleDeclaration();
|
declaration = aElement->GetSMILOverrideStyleDeclaration();
|
||||||
if (declaration) {
|
if (declaration) {
|
||||||
MOZ_ASSERT(aPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: ElementRulesMatching must not be called when we have "
|
|
||||||
"a Servo-backed style system");
|
|
||||||
RestyleManager* restyleManager = aPresContext->RestyleManager()->AsGecko();
|
RestyleManager* restyleManager = aPresContext->RestyleManager()->AsGecko();
|
||||||
if (!restyleManager->SkipAnimationRules()) {
|
if (!restyleManager->SkipAnimationRules()) {
|
||||||
// Animation restyle (or non-restyle traversal of rules)
|
// Animation restyle (or non-restyle traversal of rules)
|
||||||
|
|
|
||||||
|
|
@ -505,9 +505,6 @@ nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aGeckoSheet,
|
||||||
const bool gotGeckoSheet = aGeckoSheet && *aGeckoSheet;
|
const bool gotGeckoSheet = aGeckoSheet && *aGeckoSheet;
|
||||||
const bool gotServoSheet = aServoSheet && *aServoSheet;
|
const bool gotServoSheet = aServoSheet && *aServoSheet;
|
||||||
|
|
||||||
// Make sure sheets have the expected types
|
|
||||||
MOZ_ASSERT(!gotGeckoSheet || (*aGeckoSheet)->IsGecko());
|
|
||||||
MOZ_ASSERT(!gotServoSheet || (*aServoSheet)->IsServo());
|
|
||||||
// Make sure the URIs match
|
// Make sure the URIs match
|
||||||
MOZ_ASSERT(!gotServoSheet || !gotGeckoSheet ||
|
MOZ_ASSERT(!gotServoSheet || !gotGeckoSheet ||
|
||||||
(*aGeckoSheet)->GetSheetURI() == (*aServoSheet)->GetSheetURI(),
|
(*aGeckoSheet)->GetSheetURI() == (*aServoSheet)->GetSheetURI(),
|
||||||
|
|
@ -574,13 +571,8 @@ void
|
||||||
nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||||
nsPresContext* aPresContext)
|
nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
if (mBackendType == StyleBackendType::Gecko) {
|
|
||||||
*aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
|
*aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
|
||||||
mozilla::net::RP_Default);
|
mozilla::net::RP_Default);
|
||||||
} else {
|
|
||||||
*aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE,
|
|
||||||
mozilla::net::RP_Default, dom::SRIMetadata());
|
|
||||||
}
|
|
||||||
|
|
||||||
StyleSheet* sheet = *aSheet;
|
StyleSheet* sheet = *aSheet;
|
||||||
|
|
||||||
|
|
@ -675,14 +667,7 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||||
"kPreallocSize should be big enough to build preference style "
|
"kPreallocSize should be big enough to build preference style "
|
||||||
"sheet without reallocation");
|
"sheet without reallocation");
|
||||||
|
|
||||||
if (sheet->IsGecko()) {
|
|
||||||
sheet->AsGecko()->ReparseSheet(sheetText);
|
sheet->AsGecko()->ReparseSheet(sheetText);
|
||||||
} else {
|
|
||||||
nsresult rv = sheet->AsServo()->ParseSheet(sheetText, uri, uri, nullptr, 0);
|
|
||||||
// Parsing the about:PreferenceStyleSheet URI can only fail on OOM. If we
|
|
||||||
// are OOM before we parsed any documents we might as well abort.
|
|
||||||
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef NS_GET_R_G_B
|
#undef NS_GET_R_G_B
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1659,8 +1659,6 @@ nsRuleNode::nsRuleNode(nsPresContext* aContext, nsRuleNode* aParent,
|
||||||
|
|
||||||
NS_ASSERTION(IsRoot() || GetLevel() == aLevel, "not enough bits");
|
NS_ASSERTION(IsRoot() || GetLevel() == aLevel, "not enough bits");
|
||||||
NS_ASSERTION(IsRoot() || IsImportantRule() == aIsImportant, "yikes");
|
NS_ASSERTION(IsRoot() || IsImportantRule() == aIsImportant, "yikes");
|
||||||
MOZ_ASSERT(aContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSets should not have rule nodes");
|
|
||||||
aContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ false);
|
aContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ false);
|
||||||
|
|
||||||
// nsStyleSet::GetContext depends on there being only one animation
|
// nsStyleSet::GetContext depends on there being only one animation
|
||||||
|
|
@ -3904,8 +3902,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
|
||||||
|
|
||||||
if (variantAlternates & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) {
|
if (variantAlternates & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) {
|
||||||
// fetch the feature lookup object from the styleset
|
// fetch the feature lookup object from the styleset
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSets should not have rule nodes");
|
|
||||||
aFont->mFont.featureValueLookup =
|
aFont->mFont.featureValueLookup =
|
||||||
aPresContext->StyleSet()->AsGecko()->GetFontFeatureValuesLookup();
|
aPresContext->StyleSet()->AsGecko()->GetFontFeatureValuesLookup();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,7 @@ nsStyleContext::FinishConstruction(bool aSkipParentDisplayBasedStyleFixup)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetStyleBits();
|
SetStyleBits();
|
||||||
if (!mSource.IsServoComputedValues()) {
|
|
||||||
ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup);
|
ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup);
|
||||||
}
|
|
||||||
|
|
||||||
#define eStyleStruct_LastItem (nsStyleStructID_Length - 1)
|
#define eStyleStruct_LastItem (nsStyleStructID_Length - 1)
|
||||||
NS_ASSERTION(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
|
NS_ASSERTION(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
|
||||||
|
|
@ -450,44 +448,12 @@ const void* nsStyleContext::StyleData(nsStyleStructID aSID)
|
||||||
return cachedData; // We have computed data stored on this node in the context tree.
|
return cachedData; // We have computed data stored on this node in the context tree.
|
||||||
// Our style source will take care of it for us.
|
// Our style source will take care of it for us.
|
||||||
const void* newData;
|
const void* newData;
|
||||||
if (mSource.IsGeckoRuleNode()) {
|
|
||||||
newData = mSource.AsGeckoRuleNode()->GetStyleData(aSID, this, true);
|
newData = mSource.AsGeckoRuleNode()->GetStyleData(aSID, this, true);
|
||||||
if (!nsCachedStyleData::IsReset(aSID)) {
|
if (!nsCachedStyleData::IsReset(aSID)) {
|
||||||
// always cache inherited data on the style context; the rule
|
// always cache inherited data on the style context; the rule
|
||||||
// node set the bit in mBits for us if needed.
|
// node set the bit in mBits for us if needed.
|
||||||
mCachedInheritedData.mStyleStructs[aSID] = const_cast<void*>(newData);
|
mCachedInheritedData.mStyleStructs[aSID] = const_cast<void*>(newData);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
newData = StyleStructFromServoComputedValues(aSID);
|
|
||||||
|
|
||||||
// perform any remaining main thread work on the struct
|
|
||||||
switch (aSID) {
|
|
||||||
#define STYLE_STRUCT(name_, checkdata_cb_) \
|
|
||||||
case eStyleStruct_##name_: { \
|
|
||||||
auto data = static_cast<const nsStyle##name_*>(newData); \
|
|
||||||
const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext()); \
|
|
||||||
break; \
|
|
||||||
}
|
|
||||||
#include "nsStyleStructList.h"
|
|
||||||
#undef STYLE_STRUCT
|
|
||||||
default:
|
|
||||||
MOZ_ASSERT_UNREACHABLE("unexpected nsStyleStructID value");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Servo-backed StyleContextSource owns the struct.
|
|
||||||
AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
|
|
||||||
|
|
||||||
// XXXbholley: Unconditionally caching reset structs here defeats the memory
|
|
||||||
// optimization where we lazily allocate mCachedResetData, so that we can avoid
|
|
||||||
// performing an FFI call each time we want to get the style structs. We should
|
|
||||||
// measure the tradeoffs at some point. If the FFI overhead is low and the memory
|
|
||||||
// win significant, we should consider _always_ grabbing the struct over FFI, and
|
|
||||||
// potentially giving mCachedInheritedData the same treatment.
|
|
||||||
//
|
|
||||||
// Note that there is a similar comment in the struct getters in nsStyleContext.h.
|
|
||||||
SetStyle(aSID, const_cast<void*>(newData));
|
|
||||||
}
|
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -497,9 +463,6 @@ const void* nsStyleContext::StyleData(nsStyleStructID aSID)
|
||||||
void*
|
void*
|
||||||
nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
|
nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!mSource.IsServoComputedValues(),
|
|
||||||
"Can't COW-mutate servo values from Gecko!");
|
|
||||||
|
|
||||||
// If we already own the struct and no kids could depend on it, then
|
// If we already own the struct and no kids could depend on it, then
|
||||||
// just return it. (We leak in this case if there are kids -- and this
|
// just return it. (We leak in this case if there are kids -- and this
|
||||||
// function really shouldn't be called for style contexts that could
|
// function really shouldn't be called for style contexts that could
|
||||||
|
|
@ -715,9 +678,6 @@ nsStyleContext::SetStyleBits()
|
||||||
void
|
void
|
||||||
nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
|
nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!mSource.IsServoComputedValues(),
|
|
||||||
"Can't do Gecko style fixups on Servo values");
|
|
||||||
|
|
||||||
#define GET_UNIQUE_STYLE_DATA(name_) \
|
#define GET_UNIQUE_STYLE_DATA(name_) \
|
||||||
static_cast<nsStyle##name_*>(GetUniqueStyleData(eStyleStruct_##name_))
|
static_cast<nsStyle##name_*>(GetUniqueStyleData(eStyleStruct_##name_))
|
||||||
|
|
||||||
|
|
@ -1351,9 +1311,7 @@ void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
|
||||||
str.Append(' ');
|
str.Append(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSource.IsServoComputedValues()) {
|
if (mSource.AsGeckoRuleNode()) {
|
||||||
fprintf_stderr(out, "%s{ServoComputedValues}\n", str.get());
|
|
||||||
} else if (mSource.IsGeckoRuleNode()) {
|
|
||||||
fprintf_stderr(out, "%s{\n", str.get());
|
fprintf_stderr(out, "%s{\n", str.get());
|
||||||
str.Truncate();
|
str.Truncate();
|
||||||
nsRuleNode* ruleNode = mSource.AsGeckoRuleNode();
|
nsRuleNode* ruleNode = mSource.AsGeckoRuleNode();
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRuleNode* RuleNode() {
|
nsRuleNode* RuleNode() {
|
||||||
MOZ_RELEASE_ASSERT(mSource.IsGeckoRuleNode());
|
|
||||||
return mSource.AsGeckoRuleNode();
|
return mSource.AsGeckoRuleNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -530,19 +529,6 @@ private:
|
||||||
void SetStyleBits();
|
void SetStyleBits();
|
||||||
void ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup);
|
void ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup);
|
||||||
|
|
||||||
const void* StyleStructFromServoComputedValues(nsStyleStructID aSID) {
|
|
||||||
switch (aSID) {
|
|
||||||
#define STYLE_STRUCT(name_, checkdata_cb_) \
|
|
||||||
case eStyleStruct_##name_: \
|
|
||||||
return Servo_GetStyle##name_(mSource.AsServoComputedValues());
|
|
||||||
#include "nsStyleStructList.h"
|
|
||||||
#undef STYLE_STRUCT
|
|
||||||
default:
|
|
||||||
MOZ_ASSERT_UNREACHABLE("unexpected nsStyleStructID value");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
struct AutoCheckDependency {
|
struct AutoCheckDependency {
|
||||||
|
|
||||||
|
|
@ -589,61 +575,8 @@ private:
|
||||||
/* Have the rulenode deal */ \
|
/* Have the rulenode deal */ \
|
||||||
AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_); \
|
AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_); \
|
||||||
const nsStyle##name_ * newData; \
|
const nsStyle##name_ * newData; \
|
||||||
if (mSource.IsGeckoRuleNode()) { \
|
|
||||||
newData = mSource.AsGeckoRuleNode()-> \
|
newData = mSource.AsGeckoRuleNode()-> \
|
||||||
GetStyle##name_<aComputeData>(this, mBits); \
|
GetStyle##name_<aComputeData>(this, mBits); \
|
||||||
} else { \
|
|
||||||
/** \
|
|
||||||
* Reach the parent to grab the inherited style struct if \
|
|
||||||
* we're a text node. \
|
|
||||||
* \
|
|
||||||
* This causes the parent element's style context to cache any \
|
|
||||||
* inherited structs we request for a text node, which means we \
|
|
||||||
* don't have to compute change hints for the text node, as \
|
|
||||||
* handling the change on the parent element is sufficient. \
|
|
||||||
* \
|
|
||||||
* Note that adding the inherit bit is ok, because the struct \
|
|
||||||
* pointer returned by the parent and the child is owned by \
|
|
||||||
* Servo. This is fine if the pointers are the same (as it \
|
|
||||||
* should, read below), because both style context sources will \
|
|
||||||
* hold it. \
|
|
||||||
* \
|
|
||||||
* In the case of a mishandled frame, we could end up with the \
|
|
||||||
* pointer to and old parent style, but that's fine too, since \
|
|
||||||
* the parent style context will remain alive until we reframe, \
|
|
||||||
* in which case we'll discard both style contexts. Also, we \
|
|
||||||
* hold a strong reference to the parent style context, which \
|
|
||||||
* makes it a non-issue. \
|
|
||||||
* \
|
|
||||||
* Also, note that the assertion below should be true, except \
|
|
||||||
* for those frames we still don't handle correctly, like \
|
|
||||||
* anonymous table wrappers, in which case the pointers will \
|
|
||||||
* differ. \
|
|
||||||
* \
|
|
||||||
* That means we're not going to restyle correctly text frames \
|
|
||||||
* of anonymous table wrappers, for example. It's kind of \
|
|
||||||
* embarrassing, but I think it's not worth it to add more \
|
|
||||||
* logic here unconditionally, given that's going to be fixed. \
|
|
||||||
* \
|
|
||||||
* TODO(emilio): Convert to a strong assertion once we support \
|
|
||||||
* all kinds of random frames. In fact, this can be a great \
|
|
||||||
* assertion to debug them. \
|
|
||||||
*/ \
|
|
||||||
if (mPseudoTag == nsCSSAnonBoxes::mozText) { \
|
|
||||||
MOZ_ASSERT(mParent); \
|
|
||||||
newData = mParent->DoGetStyle##name_<true>(); \
|
|
||||||
NS_WARNING_ASSERTION( \
|
|
||||||
newData == Servo_GetStyle##name_(mSource.AsServoComputedValues()), \
|
|
||||||
"bad newData"); \
|
|
||||||
} else { \
|
|
||||||
newData = \
|
|
||||||
Servo_GetStyle##name_(mSource.AsServoComputedValues()); \
|
|
||||||
} \
|
|
||||||
/* perform any remaining main thread work on the struct */ \
|
|
||||||
const_cast<nsStyle##name_*>(newData)->FinishStyle(PresContext());\
|
|
||||||
/* the Servo-backed StyleContextSource owns the struct */ \
|
|
||||||
AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
|
|
||||||
} \
|
|
||||||
/* always cache inherited data on the style context; the rule */ \
|
/* always cache inherited data on the style context; the rule */ \
|
||||||
/* node set the bit in mBits for us if needed. */ \
|
/* node set the bit in mBits for us if needed. */ \
|
||||||
mCachedInheritedData.mStyleStructs[eStyleStruct_##name_] = \
|
mCachedInheritedData.mStyleStructs[eStyleStruct_##name_] = \
|
||||||
|
|
@ -663,31 +596,8 @@ private:
|
||||||
/* Have the rulenode deal */ \
|
/* Have the rulenode deal */ \
|
||||||
AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_); \
|
AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_); \
|
||||||
const nsStyle##name_ * newData; \
|
const nsStyle##name_ * newData; \
|
||||||
if (mSource.IsGeckoRuleNode()) { \
|
|
||||||
newData = mSource.AsGeckoRuleNode()-> \
|
newData = mSource.AsGeckoRuleNode()-> \
|
||||||
GetStyle##name_<aComputeData>(this); \
|
GetStyle##name_<aComputeData>(this); \
|
||||||
} else { \
|
|
||||||
newData = \
|
|
||||||
Servo_GetStyle##name_(mSource.AsServoComputedValues()); \
|
|
||||||
/* perform any remaining main thread work on the struct */ \
|
|
||||||
const_cast<nsStyle##name_*>(newData)->FinishStyle(PresContext());\
|
|
||||||
/* The Servo-backed StyleContextSource owns the struct. \
|
|
||||||
* \
|
|
||||||
* XXXbholley: Unconditionally caching reset structs here \
|
|
||||||
* defeats the memory optimization where we lazily allocate \
|
|
||||||
* mCachedResetData, so that we can avoid performing an FFI \
|
|
||||||
* call each time we want to get the style structs. We should \
|
|
||||||
* measure the tradeoffs at some point. If the FFI overhead is \
|
|
||||||
* low and the memory win significant, we should consider \
|
|
||||||
* _always_ grabbing the struct over FFI, and potentially \
|
|
||||||
* giving mCachedInheritedData the same treatment. \
|
|
||||||
* \
|
|
||||||
* Note that there is a similar comment in StyleData(). \
|
|
||||||
*/ \
|
|
||||||
AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
|
|
||||||
SetStyle(eStyleStruct_##name_, \
|
|
||||||
const_cast<nsStyle##name_*>(newData)); \
|
|
||||||
} \
|
|
||||||
return newData; \
|
return newData; \
|
||||||
}
|
}
|
||||||
#include "nsStyleStructList.h"
|
#include "nsStyleStructList.h"
|
||||||
|
|
|
||||||
|
|
@ -754,8 +754,6 @@ nsStyleSet::AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) c
|
||||||
AutoTArray<StyleSheet*, 32> sheets;
|
AutoTArray<StyleSheet*, 32> sheets;
|
||||||
mBindingManager->AppendAllSheets(sheets);
|
mBindingManager->AppendAllSheets(sheets);
|
||||||
for (StyleSheet* handle : sheets) {
|
for (StyleSheet* handle : sheets) {
|
||||||
MOZ_ASSERT(handle->IsGecko(), "stylo: AppendAllSheets shouldn't give us "
|
|
||||||
"ServoStyleSheets yet");
|
|
||||||
aArray.AppendElement(handle->AsGecko());
|
aArray.AppendElement(handle->AsGecko());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1760,9 +1758,6 @@ nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
|
||||||
pseudoType == CSSPseudoElementType::before ||
|
pseudoType == CSSPseudoElementType::before ||
|
||||||
pseudoType == CSSPseudoElementType::after,
|
pseudoType == CSSPseudoElementType::after,
|
||||||
"unexpected type for animations");
|
"unexpected type for animations");
|
||||||
MOZ_ASSERT(PresContext()->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: the style set and restyle manager must have the same "
|
|
||||||
"StyleBackendType");
|
|
||||||
RestyleManager* restyleManager = PresContext()->RestyleManager()->AsGecko();
|
RestyleManager* restyleManager = PresContext()->RestyleManager()->AsGecko();
|
||||||
|
|
||||||
bool oldSkipAnimationRules = restyleManager->SkipAnimationRules();
|
bool oldSkipAnimationRules = restyleManager->SkipAnimationRules();
|
||||||
|
|
@ -2243,9 +2238,6 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
|
||||||
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
|
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
|
||||||
nsRuleNode* ruleNode = aStyleContext->RuleNode();
|
nsRuleNode* ruleNode = aStyleContext->RuleNode();
|
||||||
|
|
||||||
MOZ_ASSERT(PresContext()->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: the style set and restyle manager must have the same "
|
|
||||||
"StyleBackendType");
|
|
||||||
NS_ASSERTION(!PresContext()->RestyleManager()->AsGecko()->SkipAnimationRules(),
|
NS_ASSERTION(!PresContext()->RestyleManager()->AsGecko()->SkipAnimationRules(),
|
||||||
"we no longer handle SkipAnimationRules()");
|
"we no longer handle SkipAnimationRules()");
|
||||||
|
|
||||||
|
|
@ -2481,8 +2473,6 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets()
|
||||||
// CSSStyleSheets).
|
// CSSStyleSheets).
|
||||||
mBindingManager->AppendAllSheets(sheets);
|
mBindingManager->AppendAllSheets(sheets);
|
||||||
for (StyleSheet* sheet : sheets) {
|
for (StyleSheet* sheet : sheets) {
|
||||||
MOZ_ASSERT(sheet->IsGecko(), "stylo: AppendAllSheets shouldn't give us "
|
|
||||||
"ServoStyleSheets yet");
|
|
||||||
queue.AppendElement(sheet->AsGecko());
|
queue.AppendElement(sheet->AsGecko());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2531,8 +2521,5 @@ nsStyleSet::ClearSelectors()
|
||||||
if (!mRuleTree) {
|
if (!mRuleTree) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(PresContext()->RestyleManager()->IsGecko(),
|
|
||||||
"stylo: the style set and restyle manager must have the same "
|
|
||||||
"StyleBackendType");
|
|
||||||
PresContext()->RestyleManager()->AsGecko()->ClearSelectors();
|
PresContext()->RestyleManager()->AsGecko()->ClearSelectors();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -580,8 +580,6 @@ inline
|
||||||
void nsRuleNode::AddRef()
|
void nsRuleNode::AddRef()
|
||||||
{
|
{
|
||||||
if (mRefCnt++ == 0) {
|
if (mRefCnt++ == 0) {
|
||||||
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSets should not have rule nodes");
|
|
||||||
mPresContext->StyleSet()->AsGecko()->RuleNodeInUse(this);
|
mPresContext->StyleSet()->AsGecko()->RuleNodeInUse(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -590,8 +588,6 @@ inline
|
||||||
void nsRuleNode::Release()
|
void nsRuleNode::Release()
|
||||||
{
|
{
|
||||||
if (--mRefCnt == 0) {
|
if (--mRefCnt == 0) {
|
||||||
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSets should not have rule nodes");
|
|
||||||
mPresContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ true);
|
mPresContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -453,7 +453,6 @@ void
|
||||||
nsStyleBorder::FinishStyle(nsPresContext* aPresContext)
|
nsStyleBorder::FinishStyle(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
|
||||||
|
|
||||||
mBorderImageSource.ResolveImage(aPresContext);
|
mBorderImageSource.ResolveImage(aPresContext);
|
||||||
}
|
}
|
||||||
|
|
@ -676,7 +675,6 @@ void
|
||||||
nsStyleList::FinishStyle(nsPresContext* aPresContext)
|
nsStyleList::FinishStyle(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
|
||||||
|
|
||||||
if (mListStyleImage && !mListStyleImage->IsResolved()) {
|
if (mListStyleImage && !mListStyleImage->IsResolved()) {
|
||||||
mListStyleImage->Resolve(aPresContext);
|
mListStyleImage->Resolve(aPresContext);
|
||||||
|
|
@ -1208,7 +1206,6 @@ void
|
||||||
nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext)
|
nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
|
||||||
|
|
||||||
mMask.ResolveImages(aPresContext);
|
mMask.ResolveImages(aPresContext);
|
||||||
}
|
}
|
||||||
|
|
@ -2945,7 +2942,6 @@ void
|
||||||
nsStyleBackground::FinishStyle(nsPresContext* aPresContext)
|
nsStyleBackground::FinishStyle(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
|
||||||
|
|
||||||
mImage.ResolveImages(aPresContext);
|
mImage.ResolveImages(aPresContext);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -501,9 +501,6 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"ServoRestyleManager should not use nsTransitionManager "
|
|
||||||
"for transitions");
|
|
||||||
if (collection &&
|
if (collection &&
|
||||||
collection->mCheckGeneration ==
|
collection->mCheckGeneration ==
|
||||||
mPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration()) {
|
mPresContext->RestyleManager()->AsGecko()->GetAnimationGeneration()) {
|
||||||
|
|
@ -533,9 +530,6 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||||
// not stopping or starting right now.
|
// not stopping or starting right now.
|
||||||
RefPtr<nsStyleContext> afterChangeStyle;
|
RefPtr<nsStyleContext> afterChangeStyle;
|
||||||
if (collection) {
|
if (collection) {
|
||||||
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
||||||
"ServoStyleSets should not use nsTransitionManager "
|
|
||||||
"for transitions");
|
|
||||||
nsStyleSet* styleSet = mPresContext->StyleSet()->AsGecko();
|
nsStyleSet* styleSet = mPresContext->StyleSet()->AsGecko();
|
||||||
afterChangeStyle =
|
afterChangeStyle =
|
||||||
styleSet->ResolveStyleWithoutAnimation(aElement, newStyleContext,
|
styleSet->ResolveStyleWithoutAnimation(aElement, newStyleContext,
|
||||||
|
|
@ -914,10 +908,6 @@ nsTransitionManager::ConsiderInitiatingTransition(
|
||||||
Move(startValue), Move(endValue), tf),
|
Move(startValue), Move(endValue), tf),
|
||||||
aNewStyleContext);
|
aNewStyleContext);
|
||||||
|
|
||||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
|
|
||||||
"ServoRestyleManager should not use nsTransitionManager "
|
|
||||||
"for transitions");
|
|
||||||
|
|
||||||
RefPtr<CSSTransition> animation =
|
RefPtr<CSSTransition> animation =
|
||||||
new CSSTransition(mPresContext->Document()->GetScopeObject());
|
new CSSTransition(mPresContext->Document()->GetScopeObject());
|
||||||
animation->SetOwningElement(
|
animation->SetOwningElement(
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,6 @@ nsTreeStyleCache::GetStyleContext(nsICSSPseudoComparator* aComparator,
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// We missed the cache. Resolve this pseudo-style.
|
// We missed the cache. Resolve this pseudo-style.
|
||||||
// XXXheycam ServoStyleSets do not support XUL tree styles.
|
|
||||||
if (aPresContext->StyleSet()->IsServo()) {
|
|
||||||
MOZ_CRASH("stylo: ServoStyleSets should not support XUL tree styles yet");
|
|
||||||
}
|
|
||||||
RefPtr<nsStyleContext> newResult = aPresContext->StyleSet()->AsGecko()->
|
RefPtr<nsStyleContext> newResult = aPresContext->StyleSet()->AsGecko()->
|
||||||
ResolveXULTreePseudoStyle(aContent->AsElement(), aPseudoElement,
|
ResolveXULTreePseudoStyle(aContent->AsElement(), aPseudoElement,
|
||||||
aContext, aComparator);
|
aContext, aComparator);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue