зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1355348 - Fix hazard bustage by duplicating code in Gecko_GetStyleAttrDeclarationBlock and Gecko_GetSMILOverrideDeclarationBlock on a CLOSED TREE; r=me a=bustage-fix
This commit is contained in:
Родитель
fcd72ab331
Коммит
9325ab468e
|
@ -359,15 +359,10 @@ Gecko_DropElementSnapshot(ServoElementSnapshotOwned aSnapshot)
|
|||
}
|
||||
}
|
||||
|
||||
typedef DeclarationBlock*(*DeclarationBlockGetter)(RawGeckoElementBorrowed);
|
||||
|
||||
static RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
UnwrapDeclarationBlock(RawGeckoElementBorrowed aElement,
|
||||
DeclarationBlockGetter aGetterFunc)
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement, "Invalid GeckoElement");
|
||||
|
||||
DeclarationBlock* decl = aGetterFunc(aElement);
|
||||
DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
|
||||
if (!decl) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -380,20 +375,26 @@ UnwrapDeclarationBlock(RawGeckoElementBorrowed aElement,
|
|||
return decl->AsServo()->RefRawStrong();
|
||||
}
|
||||
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return UnwrapDeclarationBlock(aElement, [](RawGeckoElementBorrowed elem) {
|
||||
return elem->GetInlineStyleDeclaration();
|
||||
});
|
||||
}
|
||||
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
Gecko_GetSMILOverrideDeclarationBlock(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return UnwrapDeclarationBlock(aElement, [](RawGeckoElementBorrowed elem) {
|
||||
return const_cast<dom::Element*>(elem)->GetSMILOverrideStyleDeclaration();
|
||||
});
|
||||
// This function duplicates a lot of the code in
|
||||
// Gecko_GetStyleAttrDeclarationBlock above because I haven't worked out a way
|
||||
// to persuade hazard analysis that a pointer-to-lambda is ok yet.
|
||||
MOZ_ASSERT(aElement, "Invalid GeckoElement");
|
||||
|
||||
DeclarationBlock* decl =
|
||||
const_cast<dom::Element*>(aElement)->GetSMILOverrideStyleDeclaration();
|
||||
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();
|
||||
}
|
||||
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
|
|
Загрузка…
Ссылка в новой задаче