mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Backed out 3 changesets (bug 1449321, bug 1449566, bug 1449565) as per developer request.
Backed out changeset c31de7e26809 (bug 1449565) Backed out changeset 72f9188800af (bug 1449566) Backed out changeset 763277b299e4 (bug 1449321) --HG-- extra : rebase_source : 212b357a3079dff30845a5f82e47b94e2d7f93cd
This commit is contained in:
parent
cfaaf3c336
commit
619e0c5b90
@ -311,26 +311,27 @@ EffectCompositor::PostRestyleForAnimation(dom::Element* aElement,
|
||||
eRestyle_CSSTransitions :
|
||||
eRestyle_CSSAnimations;
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Restyle request during restyling should be requested only on "
|
||||
"the main-thread. e.g. after the parallel traversal");
|
||||
if (ServoStyleSet::IsInServoTraversal() || mIsInPreTraverse) {
|
||||
MOZ_ASSERT(hint == eRestyle_CSSAnimations ||
|
||||
hint == eRestyle_CSSTransitions);
|
||||
if (mPresContext->StyleSet()->IsServo()) {
|
||||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Restyle request during restyling should be requested only on "
|
||||
"the main-thread. e.g. after the parallel traversal");
|
||||
if (ServoStyleSet::IsInServoTraversal() || mIsInPreTraverse) {
|
||||
MOZ_ASSERT(hint == eRestyle_CSSAnimations ||
|
||||
hint == eRestyle_CSSTransitions);
|
||||
|
||||
// We can't call Servo_NoteExplicitHints here since AtomicRefCell does not
|
||||
// allow us mutate ElementData of the |aElement| in SequentialTask.
|
||||
// Instead we call Servo_NoteExplicitHints for the element in PreTraverse()
|
||||
// which will be called right before the second traversal that we do for
|
||||
// updating CSS animations.
|
||||
// In that case PreTraverse() will return true so that we know to do the
|
||||
// second traversal so we don't need to post any restyle requests to the
|
||||
// PresShell.
|
||||
return;
|
||||
// We can't call Servo_NoteExplicitHints here since AtomicRefCell does not
|
||||
// allow us mutate ElementData of the |aElement| in SequentialTask.
|
||||
// Instead we call Servo_NoteExplicitHints for the element in PreTraverse()
|
||||
// which will be called right before the second traversal that we do for
|
||||
// updating CSS animations.
|
||||
// In that case PreTraverse() will return true so that we know to do the
|
||||
// second traversal so we don't need to post any restyle requests to the
|
||||
// PresShell.
|
||||
return;
|
||||
} else {
|
||||
MOZ_ASSERT(!mPresContext->RestyleManager()->IsInStyleRefresh());
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mPresContext->RestyleManager()->IsInStyleRefresh());
|
||||
|
||||
mPresContext->PresShell()->RestyleForAnimation(element, hint);
|
||||
}
|
||||
|
||||
@ -811,6 +812,7 @@ EffectCompositor::PreTraverseInSubtree(ServoTraversalFlags aFlags,
|
||||
Element* aRoot)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
|
||||
MOZ_ASSERT(!aRoot || nsContentUtils::GetPresShellForContent(aRoot),
|
||||
"Traversal root, if provided, should be bound to a display "
|
||||
"document");
|
||||
@ -959,6 +961,7 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
|
||||
|
||||
// If |aElement|'s document does not have a pres shell, e.g. it is document
|
||||
// without a browsing context such as we might get from an XMLHttpRequest, we
|
||||
|
@ -1314,9 +1314,15 @@ nsIDocument::SelectorCache::~SelectorCache()
|
||||
void
|
||||
nsIDocument::SelectorCache::SelectorList::Reset()
|
||||
{
|
||||
if (mServo) {
|
||||
Servo_SelectorList_Drop(mServo);
|
||||
mServo = nullptr;
|
||||
if (mIsServo) {
|
||||
if (mServo) {
|
||||
Servo_SelectorList_Drop(mServo);
|
||||
mServo = nullptr;
|
||||
}
|
||||
} else {
|
||||
if (mGecko) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1505,7 +1505,8 @@ public:
|
||||
{
|
||||
public:
|
||||
SelectorList()
|
||||
: mGecko(nullptr)
|
||||
: mIsServo(false)
|
||||
, mGecko(nullptr)
|
||||
{}
|
||||
|
||||
SelectorList(SelectorList&& aOther)
|
||||
@ -1516,15 +1517,21 @@ public:
|
||||
SelectorList& operator=(SelectorList&& aOther)
|
||||
{
|
||||
Reset();
|
||||
mServo = aOther.mServo;
|
||||
aOther.mServo = nullptr;
|
||||
mIsServo = aOther.mIsServo;
|
||||
if (mIsServo) {
|
||||
mServo = aOther.mServo;
|
||||
aOther.mServo = nullptr;
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelectorList(const SelectorList& aOther) = delete;
|
||||
|
||||
explicit SelectorList(mozilla::UniquePtr<RawServoSelectorList>&& aList)
|
||||
: mServo(aList.release())
|
||||
: mIsServo(true)
|
||||
, mServo(aList.release())
|
||||
{}
|
||||
|
||||
|
||||
@ -1532,24 +1539,31 @@ public:
|
||||
Reset();
|
||||
}
|
||||
|
||||
bool IsServo() const { return mIsServo; }
|
||||
bool IsGecko() const { return !IsServo(); }
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return !!AsServo();
|
||||
return IsServo() ? !!AsServo() : !!AsGecko();
|
||||
}
|
||||
|
||||
nsCSSSelectorList* AsGecko() const
|
||||
{
|
||||
MOZ_ASSERT(IsGecko());
|
||||
return mGecko;
|
||||
}
|
||||
|
||||
RawServoSelectorList* AsServo() const
|
||||
{
|
||||
MOZ_ASSERT(IsServo());
|
||||
return mServo;
|
||||
}
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
|
||||
bool mIsServo;
|
||||
|
||||
union {
|
||||
nsCSSSelectorList* mGecko;
|
||||
RawServoSelectorList* mServo;
|
||||
|
@ -2689,6 +2689,8 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
||||
nsAString& aOutUsedFont,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(aPresShell->StyleSet()->IsServo());
|
||||
|
||||
RefPtr<RawServoDeclarationBlock> declarations =
|
||||
CreateFontDeclarationForServo(aFont, aPresShell->GetDocument());
|
||||
if (!declarations) {
|
||||
@ -2758,6 +2760,8 @@ ResolveFilterStyleForServo(const nsAString& aFilterString,
|
||||
nsIPresShell* aPresShell,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(aPresShell->StyleSet()->IsServo());
|
||||
|
||||
RefPtr<RawServoDeclarationBlock> declarations =
|
||||
CreateFilterDeclarationForServo(aFilterString, aPresShell->GetDocument());
|
||||
if (!declarations) {
|
||||
@ -2796,7 +2800,14 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
||||
return false;
|
||||
}
|
||||
|
||||
nsString usedFont; // unused
|
||||
nsString usedFont;
|
||||
if (presShell->StyleSet()->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
// For stylo
|
||||
MOZ_ASSERT(presShell->StyleSet()->IsServo());
|
||||
|
||||
RefPtr<ComputedStyle> parentStyle =
|
||||
GetFontStyleForServo(mCanvasElement,
|
||||
@ -3724,9 +3735,14 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ComputedStyle> sc;
|
||||
nsString usedFont;
|
||||
RefPtr<ComputedStyle> sc =
|
||||
GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
if (presShell->StyleSet()->IsServo()) {
|
||||
sc =
|
||||
GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
if (!sc) {
|
||||
return false;
|
||||
}
|
||||
@ -3739,8 +3755,8 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
||||
// size (fontStyle->mSize). See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=698652.
|
||||
// FIXME: Nobody initializes mAllowZoom for servo?
|
||||
//MOZ_ASSERT(!fontStyle->mAllowZoom,
|
||||
// "expected text zoom to be disabled on this nsStyleFont");
|
||||
MOZ_ASSERT(presShell->StyleSet()->IsServo() || !fontStyle->mAllowZoom,
|
||||
"expected text zoom to be disabled on this nsStyleFont");
|
||||
nsFont resizedFont(fontStyle->mFont);
|
||||
// Create a font group working in units of CSS pixels instead of the usual
|
||||
// device pixels, to avoid being affected by page zoom. nsFontMetrics will
|
||||
|
@ -216,7 +216,8 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
}
|
||||
|
||||
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color)) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color) &&
|
||||
!aData->ShouldIgnoreColors()) {
|
||||
// color: color
|
||||
nscolor color;
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::text);
|
||||
|
@ -75,7 +75,8 @@ HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
}
|
||||
}
|
||||
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color)) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color) &&
|
||||
!aData->ShouldIgnoreColors()) {
|
||||
// color: color
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
|
||||
nscolor color;
|
||||
|
@ -167,7 +167,7 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Color))) {
|
||||
// color: a color
|
||||
// (we got the color attribute earlier)
|
||||
if (colorIsSet) {
|
||||
if (colorIsSet && !aData->ShouldIgnoreColors()) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_color, color);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
// bordercolor
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bordercolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
if (value && !aData->ShouldIgnoreColors() && value->GetColorValue(color)) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_top_color, color);
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_left_color, color);
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_bottom_color, color);
|
||||
|
@ -1475,7 +1475,8 @@ nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
|
||||
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
|
||||
return;
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_image)) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_image) &&
|
||||
!aData->ShouldIgnoreColors()) {
|
||||
// background
|
||||
nsAttrValue* value =
|
||||
const_cast<nsAttrValue*>(aAttributes->GetAttr(nsGkAtoms::background));
|
||||
@ -1492,7 +1493,8 @@ nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
|
||||
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
|
||||
return;
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_color)) {
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_color) &&
|
||||
!aData->ShouldIgnoreColors()) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bgcolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
@ -2957,7 +2959,13 @@ nsGenericHTMLElement::NewURIFromString(const nsAString& aURISpec,
|
||||
static bool
|
||||
IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell)
|
||||
{
|
||||
return !aElement->HasServoData() || Servo_Element_IsDisplayNone(aElement);
|
||||
if (aPresShell->StyleSet()->IsServo()) {
|
||||
return !aElement->HasServoData() || Servo_Element_IsDisplayNone(aElement);
|
||||
}
|
||||
|
||||
MOZ_CRASH("Old style system disabled");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -715,6 +715,8 @@ nsSMILAnimationController::PreTraverseInSubtree(Element* aRoot)
|
||||
if (!context) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(context->RestyleManager()->IsServo(),
|
||||
"PreTraverse should only be called for the servo style system");
|
||||
|
||||
bool foundElementsNeedingRestyle = false;
|
||||
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
|
@ -118,7 +118,7 @@ nsSVGElement::DidAnimateClass()
|
||||
nsIPresShell* shell = OwnerDoc()->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
if (presContext) {
|
||||
if (presContext && presContext->RestyleManager()->IsServo()) {
|
||||
presContext->RestyleManager()
|
||||
->AsServo()
|
||||
->ClassAttributeWillBeChangedBySMIL(this);
|
||||
|
@ -182,8 +182,12 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
|
||||
|
||||
if (mPendingSheets == 0) {
|
||||
// All stylesheets are loaded.
|
||||
mResources->ComputeServoStyles(
|
||||
*mBoundDocument->GetShell()->StyleSet()->AsServo());
|
||||
if (aSheet->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
mResources->ComputeServoStyles(
|
||||
*mBoundDocument->GetShell()->StyleSet()->AsServo());
|
||||
}
|
||||
|
||||
// XXX Check for mPendingScripts when scripts also come online.
|
||||
if (!mInLoadResourcesFunc)
|
||||
|
@ -3013,8 +3013,12 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
|
||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||
sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
|
||||
|
||||
// FIXME: This used to do sheet->SetDisabled(false), figure out if we can
|
||||
// just remove all this code in bug 1449522, since it seems unused.
|
||||
if (sheet->IsServo()) {
|
||||
// XXXheycam ServoStyleSheets don't support being enabled/disabled yet.
|
||||
NS_ERROR("stylo: ServoStyleSheets can't be disabled yet");
|
||||
return true;
|
||||
}
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -604,7 +604,11 @@ static void
|
||||
VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
|
||||
{
|
||||
if (nsFrame::GetVerifyStyleTreeEnable()) {
|
||||
NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
|
||||
if (aPresContext->RestyleManager()->IsServo()) {
|
||||
NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
|
||||
return;
|
||||
}
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
}
|
||||
#define VERIFY_STYLE_TREE ::VerifyStyleTree(mPresContext, mFrameConstructor)
|
||||
@ -4368,7 +4372,11 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
|
||||
MOZ_ASSERT(!aStateMask.IsEmpty());
|
||||
|
||||
if (mDidInitialize) {
|
||||
mStyleSet->AsServo()->InvalidateStyleForDocumentStateChanges(aStateMask);
|
||||
if (mStyleSet->IsServo()) {
|
||||
mStyleSet->AsServo()->InvalidateStyleForDocumentStateChanges(aStateMask);
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if (aStateMask.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||
@ -4588,6 +4596,7 @@ PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet,
|
||||
{
|
||||
// too bad we can't check that the update is UPDATE_STYLE
|
||||
NS_ASSERTION(mUpdateCount != 0, "must be in an update");
|
||||
MOZ_ASSERT(aStyleSheet->IsServo() == mStyleSet->IsServo());
|
||||
|
||||
mStyleSet->RecordStyleSheetChange(aStyleSheet, aChangeType);
|
||||
}
|
||||
@ -9633,9 +9642,14 @@ PresShell::VerifyIncrementalReflow()
|
||||
|
||||
// Create a new presentation shell to view the document. Use the
|
||||
// exact same style information that this document has.
|
||||
nsAutoPtr<ServoStyleSet> newServoSet(CloneStyleSet(mStyleSet->AsServo()));
|
||||
StyleSetHandle newSet(newServoSet);
|
||||
|
||||
nsAutoPtr<ServoStyleSet> newServoSet;
|
||||
StyleSetHandle newSet;
|
||||
if (mStyleSet->IsServo()) {
|
||||
newServoSet = CloneStyleSet(mStyleSet->AsServo());
|
||||
newSet = newServoSet;
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet);
|
||||
NS_ENSURE_TRUE(sh, false);
|
||||
newServoSet.forget();
|
||||
@ -10366,7 +10380,11 @@ PresShell::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
mApproximatelyVisibleFrames.ShallowSizeOfExcludingThis(mallocSizeOf) +
|
||||
mFramesToDirty.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
|
||||
if (StyleSet()->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
|
||||
}
|
||||
|
||||
aSizes.mLayoutTextRunsSize += SizeOfTextRuns(mallocSizeOf);
|
||||
|
||||
@ -10563,6 +10581,9 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
||||
bool* aRetVal)
|
||||
{
|
||||
*aRetVal = false;
|
||||
if (mStyleSet->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ RestyleManager::ContentRemoved(nsINode* aContainer,
|
||||
{
|
||||
// Computed style data isn't useful for detached nodes, and we'll need to
|
||||
// recompute it anyway if we ever insert the nodes back into a document.
|
||||
if (aOldChild->IsElement()) {
|
||||
if (IsServo() && aOldChild->IsElement()) {
|
||||
ServoRestyleManager::ClearServoDataFromSubtree(aOldChild->AsElement());
|
||||
}
|
||||
|
||||
@ -629,9 +629,13 @@ static bool gInApplyRenderingChangeToTree = false;
|
||||
void
|
||||
RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
|
||||
{
|
||||
// XXXheycam For now, we know that we don't use the same inheritance
|
||||
// hierarchy for certain cases, so just skip these assertions until
|
||||
// we work out what we want to assert (bug 1322570).
|
||||
if (IsServo()) {
|
||||
// XXXheycam For now, we know that we don't use the same inheritance
|
||||
// hierarchy for certain cases, so just skip these assertions until
|
||||
// we work out what we want to assert (bug 1322570).
|
||||
return;
|
||||
}
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
#endif // DEBUG
|
||||
@ -1746,9 +1750,14 @@ RestyleManager::IncrementAnimationGeneration()
|
||||
// We update the animation generation at start of each call to
|
||||
// ProcessPendingRestyles so we should ignore any subsequent (redundant)
|
||||
// calls that occur while we are still processing restyles.
|
||||
if (!mInStyleRefresh) {
|
||||
++mAnimationGeneration;
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
if (mInStyleRefresh) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
++mAnimationGeneration;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
@ -1151,7 +1151,7 @@ ServoRestyleManager::DoProcessPendingRestyles(ServoTraversalFlags aFlags)
|
||||
while (styleSet->StyleDocument(aFlags)) {
|
||||
ClearSnapshots();
|
||||
|
||||
nsStyleChangeList currentChanges;
|
||||
nsStyleChangeList currentChanges(StyleBackendType::Servo);
|
||||
bool anyStyleChanged = false;
|
||||
|
||||
// Recreate styles , and queue up change hints (which also handle lazy frame
|
||||
|
@ -305,6 +305,9 @@ private:
|
||||
|
||||
inline ServoStyleSet* StyleSet() const
|
||||
{
|
||||
MOZ_ASSERT(PresContext()->StyleSet()->IsServo(),
|
||||
"ServoRestyleManager should only be used with a Servo-flavored "
|
||||
"style backend");
|
||||
return PresContext()->StyleSet()->AsServo();
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,12 @@ ReparentFrame(RestyleManager* aRestyleManager,
|
||||
aFrame->SetParent(aNewParentFrame);
|
||||
// We reparent frames for two reasons: to put them inside ::first-line, and to
|
||||
// put them inside some wrapper anonymous boxes.
|
||||
if (aForceStyleReparent) {
|
||||
//
|
||||
// The latter shouldn't affect any styles in practice, so only needs style
|
||||
// context reparenting in the Gecko backend.
|
||||
//
|
||||
// FIXME(emilio): Remove old Gecko stuff.
|
||||
if (aForceStyleReparent || aRestyleManager->IsGecko()) {
|
||||
aRestyleManager->ReparentComputedStyle(aFrame);
|
||||
}
|
||||
}
|
||||
@ -10627,6 +10632,11 @@ nsCSSFrameConstructor::CheckForFirstLineInsertion(nsIFrame* aParentFrame,
|
||||
}
|
||||
|
||||
class RestyleManager* restyleManager = RestyleManager();
|
||||
if (!restyleManager->IsServo()) {
|
||||
// Gecko's style resolution is frame-based, so already has the right styles
|
||||
// even in the ::first-line case.
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether there's a ::first-line on the path up from aParentFrame.
|
||||
// Note that we can't stop until we've run out of ancestors with
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
*/
|
||||
static nsIContent* GetApplicableParent(nsIContent* aParent);
|
||||
|
||||
void AddSizeOfIncludingThis(nsWindowSizes& aSizes) const;
|
||||
void AddSizeOfIncludingThis(nsWindowSizes& aSizes, bool aIsServo) const;
|
||||
|
||||
protected:
|
||||
LinkedList<UndisplayedNode>* GetListFor(nsIContent* aParentContent);
|
||||
@ -693,12 +693,13 @@ nsFrameManager::DestroyAnonymousContent(already_AddRefed<nsIContent> aContent)
|
||||
void
|
||||
nsFrameManager::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
{
|
||||
bool isServo = mPresShell->StyleSet()->IsServo();
|
||||
aSizes.mLayoutPresShellSize += aSizes.mState.mMallocSizeOf(this);
|
||||
if (mDisplayNoneMap) {
|
||||
mDisplayNoneMap->AddSizeOfIncludingThis(aSizes);
|
||||
mDisplayNoneMap->AddSizeOfIncludingThis(aSizes, isServo);
|
||||
}
|
||||
if (mDisplayContentsMap) {
|
||||
mDisplayContentsMap->AddSizeOfIncludingThis(aSizes);
|
||||
mDisplayContentsMap->AddSizeOfIncludingThis(aSizes, isServo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -839,7 +840,7 @@ nsFrameManager::UndisplayedMap::RemoveNodesFor(nsIContent* aParentContent)
|
||||
|
||||
void
|
||||
nsFrameManager::UndisplayedMap::
|
||||
AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
AddSizeOfIncludingThis(nsWindowSizes& aSizes, bool aIsServo) const
|
||||
{
|
||||
MallocSizeOf mallocSizeOf = aSizes.mState.mMallocSizeOf;
|
||||
aSizes.mLayoutPresShellSize += ShallowSizeOfIncludingThis(mallocSizeOf);
|
||||
@ -848,6 +849,11 @@ AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
for (auto iter = ConstIter(); !iter.Done(); iter.Next()) {
|
||||
const LinkedList<UndisplayedNode>* list = iter.UserData();
|
||||
aSizes.mLayoutPresShellSize += list->sizeOfExcludingThis(mallocSizeOf);
|
||||
if (!aIsServo) {
|
||||
// Computed values and style structs can only be stale when using
|
||||
// Servo style system.
|
||||
continue;
|
||||
}
|
||||
for (const UndisplayedNode* node = list->getFirst();
|
||||
node; node = node->getNext()) {
|
||||
ComputedStyle* computedStyle = node->mStyle;
|
||||
|
@ -1207,7 +1207,9 @@ nsPresContext::CompatibilityModeChanged()
|
||||
}
|
||||
|
||||
StyleSetHandle styleSet = mShell->StyleSet();
|
||||
styleSet->AsServo()->CompatibilityModeChanged();
|
||||
if (styleSet->IsServo()) {
|
||||
styleSet->AsServo()->CompatibilityModeChanged();
|
||||
}
|
||||
|
||||
if (doc->IsSVGDocument()) {
|
||||
// SVG documents never load quirk.css.
|
||||
|
@ -45,21 +45,30 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
|
||||
if (aHint & nsChangeHint_ReconstructFrame) {
|
||||
// If Servo fires reconstruct at a node, it is the only change hint fired at
|
||||
// that node.
|
||||
|
||||
// Note: Because we check whether |aHint| is a reconstruct above (which is
|
||||
// necessary to avoid debug test timeouts on certain crashtests), this check
|
||||
// will not find bugs where we add a non-reconstruct hint for an element after
|
||||
// adding a reconstruct. This is ok though, since ProcessRestyledFrames will
|
||||
// handle that case via mDestroyedFrames.
|
||||
if (IsServo()) {
|
||||
// Note: Because we check whether |aHint| is a reconstruct above (which is
|
||||
// necessary to avoid debug test timeouts on certain crashtests), this check
|
||||
// will not find bugs where we add a non-reconstruct hint for an element after
|
||||
// adding a reconstruct. This is ok though, since ProcessRestyledFrames will
|
||||
// handle that case via mDestroyedFrames.
|
||||
#ifdef DEBUG
|
||||
for (size_t i = 0; i < Length(); ++i) {
|
||||
MOZ_ASSERT(aContent != (*this)[i].mContent ||
|
||||
!((*this)[i].mHint & nsChangeHint_ReconstructFrame),
|
||||
"Should not append a non-ReconstructFrame hint after \
|
||||
appending a ReconstructFrame hint for the same \
|
||||
content.");
|
||||
}
|
||||
for (size_t i = 0; i < Length(); ++i) {
|
||||
MOZ_ASSERT(aContent != (*this)[i].mContent ||
|
||||
!((*this)[i].mHint & nsChangeHint_ReconstructFrame),
|
||||
"Should not append a non-ReconstructFrame hint after \
|
||||
appending a ReconstructFrame hint for the same \
|
||||
content.");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// Filter out all other changes for same content for Gecko (Servo asserts against this
|
||||
// case above).
|
||||
// NOTE: This is captured by reference to please static analysis.
|
||||
// Capturing it by value as a pointer should be fine in this case.
|
||||
RemoveElementsBy([&](const nsStyleChangeData& aData) {
|
||||
return aData.mContent == aContent;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsEmpty() && aFrame && aFrame == LastElement().mFrame) {
|
||||
|
@ -41,9 +41,8 @@ public:
|
||||
using base_type::Length;
|
||||
using base_type::operator[];
|
||||
|
||||
nsStyleChangeList() {
|
||||
MOZ_COUNT_CTOR(nsStyleChangeList);
|
||||
}
|
||||
explicit nsStyleChangeList(mozilla::StyleBackendType aType) :
|
||||
mType(aType) { MOZ_COUNT_CTOR(nsStyleChangeList); }
|
||||
~nsStyleChangeList() { MOZ_COUNT_DTOR(nsStyleChangeList); }
|
||||
void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
|
||||
|
||||
@ -55,6 +54,12 @@ public:
|
||||
RemoveLastElement();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsGecko() const { return mType == mozilla::StyleBackendType::Gecko; }
|
||||
bool IsServo() const { return mType == mozilla::StyleBackendType::Servo; }
|
||||
|
||||
private:
|
||||
mozilla::StyleBackendType mType;
|
||||
};
|
||||
|
||||
#endif /* nsStyleChangeList_h___ */
|
||||
|
@ -768,6 +768,14 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
|
||||
if (IsPrimaryFrame()) {
|
||||
// This needs to happen before we clear our Properties() table.
|
||||
ActiveLayerTracker::TransferActivityToContent(this, mContent);
|
||||
|
||||
// Unfortunately, we need to do this for all frames being reframed
|
||||
// and not only those whose current style involves CSS transitions,
|
||||
// because what matters is whether the new style (not the old)
|
||||
// specifies CSS transitions.
|
||||
if (presContext->RestyleManager()->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if (HasCSSAnimations() || HasCSSTransitions() ||
|
||||
|
@ -28,13 +28,21 @@ DeclarationBlock::Release()
|
||||
already_AddRefed<DeclarationBlock>
|
||||
DeclarationBlock::Clone() const
|
||||
{
|
||||
return do_AddRef(new ServoDeclarationBlock(*AsServo()));
|
||||
RefPtr<DeclarationBlock> result;
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
result = new ServoDeclarationBlock(*AsServo());
|
||||
}
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DeclarationBlock>
|
||||
DeclarationBlock::EnsureMutable()
|
||||
{
|
||||
if (!IsDirty()) {
|
||||
#ifdef DEBUG
|
||||
#endif
|
||||
if (IsServo() && !IsDirty()) {
|
||||
// In stylo, the old DeclarationBlock is stored in element's rule node tree
|
||||
// directly, to avoid new values replacing the DeclarationBlock in the tree
|
||||
// directly, we need to copy the old one here if we haven't yet copied.
|
||||
|
@ -138,12 +138,20 @@ ErrorReporter::ReleaseGlobals()
|
||||
NS_IF_RELEASE(sSpecCache);
|
||||
}
|
||||
|
||||
ErrorReporter::ErrorReporter(const StyleSheet* aSheet,
|
||||
ErrorReporter::ErrorReporter(const nsCSSScanner& aScanner,
|
||||
const StyleSheet* aSheet,
|
||||
const Loader* aLoader,
|
||||
nsIURI* aURI)
|
||||
: mSheet(aSheet)
|
||||
, mLoader(aLoader)
|
||||
, mURI(aURI),
|
||||
: mScanner(&aScanner), mSheet(aSheet), mLoader(aLoader), mURI(aURI),
|
||||
mInnerWindowID(0), mErrorLineNumber(0), mPrevErrorLineNumber(0),
|
||||
mErrorColNumber(0)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorReporter::ErrorReporter(const ServoStyleSheet* aSheet,
|
||||
const Loader* aLoader,
|
||||
nsIURI* aURI)
|
||||
: mScanner(nullptr), mSheet(aSheet), mLoader(aLoader), mURI(aURI),
|
||||
mInnerWindowID(0), mErrorLineNumber(0), mPrevErrorLineNumber(0),
|
||||
mErrorColNumber(0)
|
||||
{
|
||||
@ -280,6 +288,23 @@ ErrorReporter::AddToError(const nsString &aErrorText)
|
||||
|
||||
if (mError.IsEmpty()) {
|
||||
mError = aErrorText;
|
||||
// If this error reporter is being used from Stylo, the equivalent operation occurs
|
||||
// in the OutputError variant that provides source information.
|
||||
if (!IsServo()) {
|
||||
mErrorLineNumber = mScanner->GetLineNumber();
|
||||
mErrorColNumber = mScanner->GetColumnNumber();
|
||||
// Retrieve the error line once per line, and reuse the same nsString
|
||||
// for all errors on that line. That causes the text of the line to
|
||||
// be shared among all the nsIScriptError objects.
|
||||
if (mErrorLine.IsEmpty() || mErrorLineNumber != mPrevErrorLineNumber) {
|
||||
// Be careful here: the error line might be really long and OOM
|
||||
// when we try to make a copy here. If so, just leave it empty.
|
||||
if (!mErrorLine.Assign(mScanner->GetCurrentLine(), fallible)) {
|
||||
mErrorLine.Truncate();
|
||||
}
|
||||
mPrevErrorLineNumber = mErrorLineNumber;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mError.AppendLiteral(" ");
|
||||
mError.Append(aErrorText);
|
||||
@ -403,6 +428,12 @@ ErrorReporter::ReportUnexpectedEOF(char16_t aExpected)
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
bool
|
||||
ErrorReporter::IsServo() const
|
||||
{
|
||||
return !mScanner;
|
||||
}
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsString.h"
|
||||
|
||||
struct nsCSSToken;
|
||||
class nsCSSScanner;
|
||||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
@ -29,9 +30,13 @@ class Loader;
|
||||
// methods become inline stubs.
|
||||
class ErrorReporter {
|
||||
public:
|
||||
ErrorReporter(const StyleSheet* aSheet,
|
||||
const Loader* aLoader,
|
||||
nsIURI* aURI);
|
||||
ErrorReporter(const nsCSSScanner &aScanner,
|
||||
const StyleSheet *aSheet,
|
||||
const Loader *aLoader,
|
||||
nsIURI *aURI);
|
||||
ErrorReporter(const ServoStyleSheet *aSheet,
|
||||
const Loader *aLoader,
|
||||
nsIURI *aURI);
|
||||
~ErrorReporter();
|
||||
|
||||
static void ReleaseGlobals();
|
||||
@ -70,10 +75,13 @@ public:
|
||||
private:
|
||||
void AddToError(const nsString &aErrorText);
|
||||
|
||||
bool IsServo() const;
|
||||
|
||||
#ifdef CSS_REPORT_PARSE_ERRORS
|
||||
nsAutoString mError;
|
||||
nsString mErrorLine;
|
||||
nsString mFileName;
|
||||
const nsCSSScanner *mScanner;
|
||||
const StyleSheet *mSheet;
|
||||
const Loader *mLoader;
|
||||
nsIURI *mURI;
|
||||
@ -85,7 +93,8 @@ private:
|
||||
};
|
||||
|
||||
#ifndef CSS_REPORT_PARSE_ERRORS
|
||||
inline ErrorReporter::ErrorReporter(const StyleSheet*,
|
||||
inline ErrorReporter::ErrorReporter(const nsCSSScanner&,
|
||||
const StyleSheet*,
|
||||
const Loader*,
|
||||
nsIURI*) {}
|
||||
inline ErrorReporter::~ErrorReporter() {}
|
||||
|
@ -46,6 +46,9 @@ public:
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
// Whether we should ignore document colors.
|
||||
inline bool ShouldIgnoreColors() const;
|
||||
|
||||
// Check if we already contain a certain longhand
|
||||
inline bool PropertyIsSet(nsCSSPropertyID aId);
|
||||
|
||||
|
@ -23,6 +23,19 @@ MOZ_DEFINE_STYLO_METHODS(GenericSpecifiedValues,
|
||||
nsRuleData,
|
||||
ServoSpecifiedValues)
|
||||
|
||||
bool
|
||||
GenericSpecifiedValues::ShouldIgnoreColors() const
|
||||
{
|
||||
if (IsServo()) {
|
||||
// Servo handles this during cascading.
|
||||
//
|
||||
// FIXME(emilio): We should eventually move it to the document though.
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
bool
|
||||
GenericSpecifiedValues::PropertyIsSet(nsCSSPropertyID aId)
|
||||
{
|
||||
@ -64,7 +77,10 @@ void
|
||||
GenericSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
|
||||
{
|
||||
|
||||
return AsServo()->SetKeywordValue(aId, aValue);
|
||||
if (IsServo()) {
|
||||
return AsServo()->SetKeywordValue(aId, aValue);
|
||||
}
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1198,15 +1198,20 @@ Loader::InsertSheetInDoc(StyleSheet* aSheet,
|
||||
*/
|
||||
nsresult
|
||||
Loader::InsertChildSheet(StyleSheet* aSheet,
|
||||
StyleSheet* aParentSheet)
|
||||
StyleSheet* aParentSheet,
|
||||
ImportRule* aGeckoParentRule)
|
||||
{
|
||||
LOG(("css::Loader::InsertChildSheet"));
|
||||
MOZ_ASSERT(aSheet, "Nothing to insert");
|
||||
MOZ_ASSERT(aParentSheet, "Need a parent to insert into");
|
||||
MOZ_ASSERT(aSheet->IsGecko() == !!aGeckoParentRule);
|
||||
|
||||
// child sheets should always start out enabled, even if they got
|
||||
// cloned off of top-level sheets which were disabled
|
||||
aSheet->SetEnabled(true);
|
||||
if (aGeckoParentRule) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
aParentSheet->PrependStyleSheet(aSheet);
|
||||
|
||||
LOG((" Inserting into parent sheet"));
|
||||
@ -2081,11 +2086,13 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
||||
SheetLoadData* aParentData,
|
||||
nsIURI* aURL,
|
||||
dom::MediaList* aMedia,
|
||||
ImportRule* aGeckoParentRule,
|
||||
LoaderReusableStyleSheets* aReusableSheets)
|
||||
{
|
||||
LOG(("css::Loader::LoadChildSheet"));
|
||||
NS_PRECONDITION(aURL, "Must have a URI to load");
|
||||
NS_PRECONDITION(aParentSheet, "Must have a parent sheet");
|
||||
MOZ_ASSERT(aParentSheet->IsGecko() == !!aGeckoParentRule);
|
||||
|
||||
if (!mEnabled) {
|
||||
LOG_WARN((" Not enabled"));
|
||||
@ -2151,6 +2158,9 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
||||
RefPtr<StyleSheet> sheet;
|
||||
StyleSheetState state;
|
||||
if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, sheet)) {
|
||||
if (aParentSheet->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
state = eSheetComplete;
|
||||
} else {
|
||||
bool isAlternate;
|
||||
@ -2167,7 +2177,7 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
||||
PrepareSheet(sheet, empty, empty, aMedia, isAlternate);
|
||||
}
|
||||
|
||||
rv = InsertChildSheet(sheet, aParentSheet);
|
||||
rv = InsertChildSheet(sheet, aParentSheet, aGeckoParentRule);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state == eSheetComplete) {
|
||||
|
@ -301,6 +301,9 @@ public:
|
||||
* parent sheet.
|
||||
* @param aURL the URL of the child sheet
|
||||
* @param aMedia the already-parsed media list for the child sheet
|
||||
* @param aGeckoParentRule the @import rule importing this child, when using
|
||||
* Gecko's style system. This is used to properly
|
||||
* order the child sheet list of aParentSheet.
|
||||
* @param aSavedSheets any saved style sheets which could be reused
|
||||
* for this load
|
||||
*/
|
||||
@ -308,6 +311,7 @@ public:
|
||||
SheetLoadData* aParentData,
|
||||
nsIURI* aURL,
|
||||
dom::MediaList* aMedia,
|
||||
ImportRule* aGeckoParentRule,
|
||||
LoaderReusableStyleSheets* aSavedSheets);
|
||||
|
||||
/**
|
||||
@ -527,7 +531,8 @@ private:
|
||||
nsIDocument* aDocument);
|
||||
|
||||
nsresult InsertChildSheet(StyleSheet* aSheet,
|
||||
StyleSheet* aParentSheet);
|
||||
StyleSheet* aParentSheet,
|
||||
ImportRule* aGeckoParentRule);
|
||||
|
||||
nsresult InternalLoadNonDocumentSheet(
|
||||
nsIURI* aURL,
|
||||
|
@ -57,6 +57,10 @@ public:
|
||||
virtual void SetText(const nsAString& aMediaText) = 0;
|
||||
virtual bool Matches(nsPresContext* aPresContext) const = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual bool IsServo() const = 0;
|
||||
#endif
|
||||
|
||||
void SetStyleSheet(StyleSheet* aSheet);
|
||||
|
||||
// WebIDL
|
||||
|
@ -405,6 +405,12 @@ Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
|
||||
if (!decl) {
|
||||
return nullptr;
|
||||
}
|
||||
if (decl->IsGecko()) {
|
||||
// XXX This can happen when nodes are adopted from a Gecko-style-backend
|
||||
// document into a Servo-style-backend document. See bug 1330051.
|
||||
NS_WARNING("stylo: requesting a Gecko declaration block?");
|
||||
return nullptr;
|
||||
}
|
||||
return decl->AsServo()->RefRawStrong();
|
||||
}
|
||||
|
||||
@ -415,6 +421,12 @@ Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed aElement)
|
||||
if (!decl) {
|
||||
return;
|
||||
}
|
||||
if (decl->IsGecko()) {
|
||||
// XXX This can happen when nodes are adopted from a Gecko-style-backend
|
||||
// document into a Servo-style-backend document. See bug 1330051.
|
||||
NS_WARNING("stylo: requesting a Gecko declaration block?");
|
||||
return;
|
||||
}
|
||||
decl->UnsetDirty();
|
||||
}
|
||||
|
||||
@ -2530,7 +2542,7 @@ Gecko_LoadStyleSheet(css::Loader* aLoader,
|
||||
|
||||
StyleSheet* previousFirstChild = aParent->GetFirstChild();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = aLoader->LoadChildSheet(aParent, aParentLoadData, uri, media, aReusableSheets);
|
||||
rv = aLoader->LoadChildSheet(aParent, aParentLoadData, uri, media, nullptr, aReusableSheets);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) ||
|
||||
|
@ -33,6 +33,10 @@ public:
|
||||
|
||||
bool Matches(nsPresContext*) const final;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsServo() const final { return true; }
|
||||
#endif
|
||||
|
||||
RawServoMediaList& RawList() { return *mRawList; }
|
||||
|
||||
protected:
|
||||
|
@ -72,6 +72,8 @@ ServoStyleRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
|
||||
{
|
||||
ServoStyleRule* rule = Rule();
|
||||
if (RefPtr<StyleSheet> sheet = rule->GetStyleSheet()) {
|
||||
MOZ_ASSERT(sheet->IsServo(), "Servo style rules should have "
|
||||
"servo stylesheets.");
|
||||
nsCOMPtr<nsIDocument> doc = sheet->GetAssociatedDocument();
|
||||
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true);
|
||||
if (aDecl != mDecls) {
|
||||
|
@ -208,6 +208,7 @@ ServoStyleSheet::ParseSheet(css::Loader* aLoader,
|
||||
{
|
||||
MOZ_ASSERT(mParsePromise.IsEmpty());
|
||||
RefPtr<StyleSheetParsePromise> p = mParsePromise.Ensure(__func__);
|
||||
MOZ_ASSERT(!mMedia || mMedia->IsServo());
|
||||
Inner()->mURLData = new URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal); // RefPtr
|
||||
Inner()->mContents = Servo_StyleSheet_FromUTF8Bytes(aLoader,
|
||||
this,
|
||||
@ -236,6 +237,7 @@ ServoStyleSheet::ParseSheetSync(css::Loader* aLoader,
|
||||
nsCompatibility aCompatMode,
|
||||
css::LoaderReusableStyleSheets* aReusableSheets)
|
||||
{
|
||||
MOZ_ASSERT(!mMedia || mMedia->IsServo());
|
||||
Inner()->mURLData = new URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal); // RefPtr
|
||||
|
||||
Inner()->mContents = Servo_StyleSheet_FromUTF8Bytes(aLoader,
|
||||
@ -373,6 +375,9 @@ ServoStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
|
||||
bool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
MOZ_ASSERT(aSheet->IsServo(),
|
||||
"why we were called back with a CSSStyleSheet?");
|
||||
|
||||
ServoStyleSheet* sheet = aSheet->AsServo();
|
||||
if (!sheet->GetParentSheet()) {
|
||||
return NS_OK; // ignore if sheet has been detached already
|
||||
|
@ -35,6 +35,10 @@ inline bool IsInServoTraversal()
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
# define MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
bool IsGecko() const { return false; } \
|
||||
bool IsServo() const { return true; }
|
||||
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \
|
||||
inline servotype_* AsServo(); \
|
||||
inline const servotype_* AsServo() const; \
|
||||
@ -55,34 +59,39 @@ inline bool IsInServoTraversal()
|
||||
* The class should define |StyleBackendType mType;| itself.
|
||||
*/
|
||||
#define MOZ_DECL_STYLO_METHODS(geckotype_, servotype_) \
|
||||
MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_)
|
||||
|
||||
#define MOZ_DEFINE_STYLO_METHODS_GECKO(type_, geckotype_) \
|
||||
geckotype_* type_::AsGecko() { \
|
||||
MOZ_ASSERT(IsGecko()); \
|
||||
return static_cast<geckotype_*>(this); \
|
||||
} \
|
||||
const geckotype_* type_::AsGecko() const { \
|
||||
MOZ_ASSERT(IsGecko()); \
|
||||
return static_cast<const geckotype_*>(this); \
|
||||
} \
|
||||
geckotype_* type_::GetAsGecko() { \
|
||||
return nullptr; \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
} \
|
||||
const geckotype_* type_::GetAsGecko() const { \
|
||||
return nullptr; \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
}
|
||||
|
||||
#define MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_) \
|
||||
servotype_* type_::AsServo() { \
|
||||
MOZ_ASSERT(IsServo()); \
|
||||
return static_cast<servotype_*>(this); \
|
||||
} \
|
||||
const servotype_* type_::AsServo() const { \
|
||||
MOZ_ASSERT(IsServo()); \
|
||||
return static_cast<const servotype_*>(this); \
|
||||
} \
|
||||
servotype_* type_::GetAsServo() { \
|
||||
return AsServo(); \
|
||||
return IsServo() ? AsServo() : nullptr; \
|
||||
} \
|
||||
const servotype_* type_::GetAsServo() const { \
|
||||
return AsServo(); \
|
||||
return IsServo() ? AsServo() : nullptr; \
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@ StreamLoader::StreamLoader(mozilla::css::SheetLoadData* aSheetLoadData)
|
||||
: mSheetLoadData(aSheetLoadData)
|
||||
, mStatus(NS_OK)
|
||||
{
|
||||
MOZ_ASSERT(!aSheetLoadData->mSheet->IsGecko());
|
||||
}
|
||||
|
||||
StreamLoader::~StreamLoader()
|
||||
|
@ -43,6 +43,8 @@ namespace css {
|
||||
class Rule;
|
||||
} // namespace css
|
||||
|
||||
#define SERVO_BIT 0x1
|
||||
|
||||
/**
|
||||
* Smart pointer class that can hold a pointer to either an nsStyleSet
|
||||
* or a ServoStyleSet.
|
||||
@ -59,26 +61,40 @@ public:
|
||||
public:
|
||||
friend class ::mozilla::StyleSetHandle;
|
||||
|
||||
bool IsGecko() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsServo() const
|
||||
{
|
||||
MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
|
||||
return mValue & SERVO_BIT;
|
||||
}
|
||||
|
||||
StyleBackendType BackendType() const
|
||||
{
|
||||
return StyleBackendType::Servo;
|
||||
return IsGecko() ? StyleBackendType::Gecko :
|
||||
StyleBackendType::Servo;
|
||||
}
|
||||
|
||||
|
||||
ServoStyleSet* AsServo()
|
||||
{
|
||||
return reinterpret_cast<ServoStyleSet*>(mValue);
|
||||
MOZ_ASSERT(IsServo());
|
||||
return reinterpret_cast<ServoStyleSet*>(mValue & ~SERVO_BIT);
|
||||
}
|
||||
|
||||
ServoStyleSet* GetAsServo() { return AsServo(); }
|
||||
ServoStyleSet* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
|
||||
|
||||
|
||||
const ServoStyleSet* AsServo() const
|
||||
{
|
||||
MOZ_ASSERT(IsServo());
|
||||
return const_cast<Ptr*>(this)->AsServo();
|
||||
}
|
||||
|
||||
const ServoStyleSet* GetAsServo() const { return AsServo(); }
|
||||
const ServoStyleSet* GetAsServo() const { return IsServo() ? AsServo() : nullptr; }
|
||||
|
||||
// These inline methods are defined in StyleSetHandleInlines.h.
|
||||
inline void Delete();
|
||||
@ -162,6 +178,8 @@ public:
|
||||
inline already_AddRefed<ComputedStyle>
|
||||
ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||
mozilla::CSSPseudoElementType aType);
|
||||
inline void RootComputedStyleAdded();
|
||||
inline void RootComputedStyleRemoved();
|
||||
|
||||
inline bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
|
||||
inline nsCSSCounterStyleRule* CounterStyleRuleForName(nsAtom* aName);
|
||||
@ -185,14 +203,18 @@ public:
|
||||
|
||||
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);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StyleSetHandle& operator=(ServoStyleSet* aStyleSet)
|
||||
{
|
||||
MOZ_ASSERT(!(reinterpret_cast<uintptr_t>(aStyleSet) & SERVO_BIT),
|
||||
"least significant bit shouldn't be set; we use it for state");
|
||||
mPtr.mValue =
|
||||
aStyleSet ? reinterpret_cast<uintptr_t>(aStyleSet) : 0;
|
||||
aStyleSet ? (reinterpret_cast<uintptr_t>(aStyleSet) | SERVO_BIT) : 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -213,6 +235,8 @@ private:
|
||||
Ptr mPtr;
|
||||
};
|
||||
|
||||
#undef SERVO_BIT
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_StyleSetHandle_h
|
||||
|
@ -25,6 +25,9 @@ void
|
||||
StyleSetHandle::Ptr::Delete()
|
||||
{
|
||||
if (mValue) {
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
delete AsServo();
|
||||
}
|
||||
}
|
||||
@ -158,6 +161,10 @@ nsresult
|
||||
StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
|
||||
const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
|
||||
{
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
|
||||
for (auto& sheet : aNewSheets) {
|
||||
newSheets.AppendElement(sheet->AsServo());
|
||||
@ -269,6 +276,26 @@ StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||
FORWARD(ProbePseudoElementStyle, (aParentElement, aType, aParentStyle));
|
||||
}
|
||||
|
||||
void
|
||||
StyleSetHandle::Ptr::RootComputedStyleAdded()
|
||||
{
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
void
|
||||
StyleSetHandle::Ptr::RootComputedStyleRemoved()
|
||||
{
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
bool
|
||||
StyleSetHandle::Ptr::
|
||||
AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
|
||||
|
@ -80,7 +80,11 @@ StyleSheet::LastRelease()
|
||||
MOZ_ASSERT(mInner->mSheets.Contains(this), "Our mInner should include us.");
|
||||
|
||||
UnparentChildren();
|
||||
AsServo()->LastRelease();
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
AsServo()->LastRelease();
|
||||
}
|
||||
|
||||
mInner->RemoveSheet(this);
|
||||
mInner = nullptr;
|
||||
@ -393,10 +397,14 @@ StyleSheet::EnsureUniqueInner()
|
||||
mInner->RemoveSheet(this);
|
||||
mInner = clone;
|
||||
|
||||
// Fixup the child lists and parent links in the Servo sheet. This is done
|
||||
// here instead of in StyleSheetInner::CloneFor, because it's just more
|
||||
// convenient to do so instead.
|
||||
AsServo()->BuildChildListAfterInnerClone();
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
// Fixup the child lists and parent links in the Servo sheet. This is done
|
||||
// here instead of in StyleSheetInner::CloneFor, because it's just more
|
||||
// convenient to do so instead.
|
||||
AsServo()->BuildChildListAfterInnerClone();
|
||||
}
|
||||
|
||||
// let our containing style sets know that if we call
|
||||
// nsPresContext::EnsureSafeToHandOutCSSRules we will need to restyle the
|
||||
@ -417,7 +425,10 @@ StyleSheet::AppendAllChildSheets(nsTArray<StyleSheet*>& aArray)
|
||||
// WebIDL CSSStyleSheet API
|
||||
|
||||
#define FORWARD_INTERNAL(method_, args_) \
|
||||
return AsServo()->method_ args_;
|
||||
if (IsServo()) { \
|
||||
return AsServo()->method_ args_; \
|
||||
} \
|
||||
MOZ_CRASH("old style system disabled");
|
||||
|
||||
dom::CSSRuleList*
|
||||
StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
||||
@ -593,8 +604,12 @@ StyleSheet::InsertRuleIntoGroup(const nsAString& aRule,
|
||||
|
||||
WillDirty();
|
||||
|
||||
nsresult result =
|
||||
AsServo()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
nsresult result;
|
||||
if (IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
result = AsServo()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
RuleAdded(*aGroup->GetStyleRuleAt(aIndex));
|
||||
|
||||
|
@ -389,12 +389,19 @@ nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsCSSValue value;
|
||||
bool ok;
|
||||
|
||||
StyleSheet* sheet = GetStyleSheet();
|
||||
|
||||
URLExtraData* data = sheet ? sheet->AsServo()->URLData() : nullptr;
|
||||
bool ok = ServoCSSParser::ParseCounterStyleDescriptor(aDescID, aValue, data,
|
||||
value);
|
||||
bool useServo = !sheet || sheet->IsServo();
|
||||
|
||||
if (useServo) {
|
||||
URLExtraData* data = sheet ? sheet->AsServo()->URLData() : nullptr;
|
||||
ok = ServoCSSParser::ParseCounterStyleDescriptor(aDescID, aValue, data,
|
||||
value);
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
if (ok && CheckDescValue(GetSystem(), aDescID, value)) {
|
||||
SetDesc(aDescID, value);
|
||||
|
@ -121,16 +121,20 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText,
|
||||
// rule (see stack in bug 209575).
|
||||
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
||||
|
||||
ServoCSSParsingEnvironment servoEnv =
|
||||
GetServoCSSParsingEnvironment(aSubjectPrincipal);
|
||||
if (!servoEnv.mUrlExtraData) {
|
||||
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
return;
|
||||
}
|
||||
RefPtr<DeclarationBlock> newdecl;
|
||||
if (olddecl->IsServo()) {
|
||||
ServoCSSParsingEnvironment servoEnv = GetServoCSSParsingEnvironment(
|
||||
aSubjectPrincipal);
|
||||
if (!servoEnv.mUrlExtraData) {
|
||||
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<DeclarationBlock> newdecl =
|
||||
ServoDeclarationBlock::FromCssText(aCssText, servoEnv.mUrlExtraData,
|
||||
servoEnv.mCompatMode, servoEnv.mLoader);
|
||||
newdecl = ServoDeclarationBlock::FromCssText(aCssText, servoEnv.mUrlExtraData,
|
||||
servoEnv.mCompatMode, servoEnv.mLoader);
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
aRv = SetCSSDeclaration(newdecl);
|
||||
}
|
||||
@ -291,14 +295,17 @@ nsDOMCSSDeclaration::ModifyDeclaration(nsIPrincipal* aSubjectPrincipal,
|
||||
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
|
||||
|
||||
bool changed;
|
||||
ServoCSSParsingEnvironment servoEnv = GetServoCSSParsingEnvironment(
|
||||
aSubjectPrincipal);
|
||||
if (!servoEnv.mUrlExtraData) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
if (decl->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
ServoCSSParsingEnvironment servoEnv = GetServoCSSParsingEnvironment(
|
||||
aSubjectPrincipal);
|
||||
if (!servoEnv.mUrlExtraData) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
changed = aServoFunc(decl->AsServo(), servoEnv);
|
||||
}
|
||||
|
||||
changed = aServoFunc(decl->AsServo(), servoEnv);
|
||||
|
||||
if (!changed) {
|
||||
// Parsing failed -- but we don't throw an exception for that.
|
||||
return NS_OK;
|
||||
|
@ -116,10 +116,14 @@ nsHTMLStyleSheet::ImplLinkColorSetter(
|
||||
|
||||
RestyleManager* restyle = mDocument->GetPresContext()->RestyleManager();
|
||||
|
||||
MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal());
|
||||
aDecl = Servo_DeclarationBlock_CreateEmpty().Consume();
|
||||
Servo_DeclarationBlock_SetColorValue(aDecl.get(), eCSSProperty_color,
|
||||
aColor);
|
||||
if (restyle->IsServo()) {
|
||||
MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal());
|
||||
aDecl = Servo_DeclarationBlock_CreateEmpty().Consume();
|
||||
Servo_DeclarationBlock_SetColorValue(aDecl.get(), eCSSProperty_color,
|
||||
aColor);
|
||||
} else {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
// Now make sure we restyle any links that might need it. This
|
||||
// shouldn't happen often, so just rebuilding everything is ok.
|
||||
|
@ -820,6 +820,67 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aGeckoSheet,
|
||||
RefPtr<StyleSheet>* aServoSheet)
|
||||
{
|
||||
MOZ_ASSERT(gCSSLoader_Gecko || gCSSLoader_Servo,
|
||||
"pref changed before we loaded a sheet?");
|
||||
|
||||
const bool gotGeckoSheet = aGeckoSheet && *aGeckoSheet;
|
||||
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
|
||||
MOZ_ASSERT(!gotServoSheet || !gotGeckoSheet ||
|
||||
(*aGeckoSheet)->GetSheetURI() == (*aServoSheet)->GetSheetURI(),
|
||||
"Sheets passed should have the same URI");
|
||||
|
||||
nsIURI* uri;
|
||||
if (gotGeckoSheet) {
|
||||
uri = (*aGeckoSheet)->GetSheetURI();
|
||||
} else if (gotServoSheet) {
|
||||
uri = (*aServoSheet)->GetSheetURI();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gCSSLoader_Gecko) {
|
||||
gCSSLoader_Gecko->ObsoleteSheet(uri);
|
||||
}
|
||||
if (gCSSLoader_Servo) {
|
||||
gCSSLoader_Servo->ObsoleteSheet(uri);
|
||||
}
|
||||
if (gotGeckoSheet) {
|
||||
*aGeckoSheet = nullptr;
|
||||
}
|
||||
if (gotServoSheet) {
|
||||
*aServoSheet = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
|
||||
{
|
||||
MOZ_ASSERT(gStyleCache_Gecko || gStyleCache_Servo,
|
||||
"pref changed after shutdown?");
|
||||
|
||||
// Cause any UA style sheets whose parsing depends on the value of prefs
|
||||
// to be re-parsed by dropping the sheet from gCSSLoader_{Gecko,Servo}'s cache
|
||||
// then setting our cached sheet pointer to null. This will only work for
|
||||
// sheets that are loaded lazily.
|
||||
|
||||
#define INVALIDATE(sheet_) \
|
||||
InvalidateSheet(gStyleCache_Gecko ? &gStyleCache_Gecko->sheet_ : nullptr, \
|
||||
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
|
||||
|
||||
// INVALIDATE(mUASheet); // for layout.css.example-pref.enabled
|
||||
|
||||
#undef INVALIDATE
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutStylesheetCache::InvalidatePreferenceSheets()
|
||||
{
|
||||
@ -937,10 +998,14 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||
"kPreallocSize should be big enough to build preference style "
|
||||
"sheet without reallocation");
|
||||
|
||||
ServoStyleSheet* servoSheet = sheet->AsServo();
|
||||
// NB: The pref sheet never has @import rules.
|
||||
servoSheet->ParseSheetSync(
|
||||
nullptr, sheetText, uri, uri, nullptr, /* aLoadData = */ nullptr, 0, eCompatibility_FullStandards);
|
||||
if (sheet->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
ServoStyleSheet* servoSheet = sheet->AsServo();
|
||||
// NB: The pref sheet never has @import rules.
|
||||
servoSheet->ParseSheetSync(
|
||||
nullptr, sheetText, uri, uri, nullptr, /* aLoadData = */ nullptr, 0, eCompatibility_FullStandards);
|
||||
}
|
||||
|
||||
#undef NS_GET_R_G_B
|
||||
}
|
||||
|
@ -100,6 +100,9 @@ private:
|
||||
void LoadSheet(nsIURI* aURI, RefPtr<mozilla::StyleSheet>* aSheet,
|
||||
mozilla::css::SheetParsingMode aParsingMode,
|
||||
mozilla::css::FailureAction aFailureAction);
|
||||
static void InvalidateSheet(RefPtr<mozilla::StyleSheet>* aGeckoSheet,
|
||||
RefPtr<mozilla::StyleSheet>* aServoSheet);
|
||||
static void DependentPrefChanged(const char* aPref, void* aData);
|
||||
void BuildPreferenceSheet(RefPtr<mozilla::StyleSheet>* aSheet,
|
||||
nsPresContext* aPresContext);
|
||||
|
||||
|
@ -396,6 +396,7 @@ void
|
||||
nsStyleBorder::FinishStyle(nsPresContext* aPresContext, const nsStyleBorder* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
mBorderImageSource.ResolveImage(
|
||||
aPresContext, aOldStyle ? &aOldStyle->mBorderImageSource : nullptr);
|
||||
@ -616,6 +617,7 @@ void
|
||||
nsStyleList::FinishStyle(nsPresContext* aPresContext, const nsStyleList* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
if (mListStyleImage && !mListStyleImage->IsResolved()) {
|
||||
mListStyleImage->Resolve(
|
||||
@ -1303,6 +1305,7 @@ void
|
||||
nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext, const nsStyleSVGReset* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mMask) {
|
||||
nsStyleImage& image = mMask.mLayers[i].mImage;
|
||||
@ -3370,6 +3373,7 @@ nsStyleBackground::FinishStyle(
|
||||
nsPresContext* aPresContext, const nsStyleBackground* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
mImage.ResolveImages(aPresContext, aOldStyle ? &aOldStyle->mImage : nullptr);
|
||||
}
|
||||
@ -3749,6 +3753,7 @@ nsStyleDisplay::FinishStyle(
|
||||
nsPresContext* aPresContext, const nsStyleDisplay* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
if (mShapeOutside.GetType() == StyleShapeSourceType::Image) {
|
||||
const UniquePtr<nsStyleImage>& shapeImage = mShapeOutside.GetShapeImage();
|
||||
@ -4672,6 +4677,7 @@ nsStyleUserInterface::FinishStyle(
|
||||
nsPresContext* aPresContext, const nsStyleUserInterface* aOldStyle)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
|
||||
|
||||
for (size_t i = 0; i < mCursorImages.Length(); ++i) {
|
||||
nsCursorImage& cursor = mCursorImages[i];
|
||||
|
Loading…
Reference in New Issue
Block a user