Bug 1361938 - Set the dirty flag of DeclarationBlock when the DeclarationBlock is modified and clear the flag when it's resyled. r=heycam

MozReview-Commit-ID: 9GpFgx8N13e

--HG--
extra : rebase_source : 149b7e542583621ef9d9e4b8591119e92512ea7b
This commit is contained in:
Hiroyuki Ikezoe 2017-05-31 09:24:40 +09:00
parent 245517d977
commit 5179c72ee9
3 changed files with 18 additions and 0 deletions

View File

@ -411,6 +411,22 @@ Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
return decl->AsServo()->RefRawStrong();
}
void
Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed aElement)
{
DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
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();
}
RawServoDeclarationBlockStrongBorrowedOrNull
Gecko_GetSMILOverrideDeclarationBlock(RawGeckoElementBorrowed aElement)
{

View File

@ -192,6 +192,7 @@ SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot,
// Style attributes.
RawServoDeclarationBlockStrongBorrowedOrNull
Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed element);
void Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed element);
RawServoDeclarationBlockStrongBorrowedOrNull
Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed element);
RawServoDeclarationBlockStrongBorrowedOrNull

View File

@ -73,6 +73,7 @@ nsresult
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
aDecl->SetDirty();
return mIsSMILOverride
? mElement->SetSMILOverrideStyleDeclaration(aDecl, true)
: mElement->SetInlineStyleDeclaration(aDecl, nullptr, true);