зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1294299 part 3 - Make it possible to create empty ServoDeclarationBlock. r=heycam
MozReview-Commit-ID: FSdSXDFoxM --HG-- extra : source : 47bdaffadab2dca8be8b6e49c7decf8ef02ea1e5
This commit is contained in:
Родитель
60ba3c835d
Коммит
92119e2034
|
@ -62,6 +62,8 @@ SERVO_BINDING_FUNC(Servo_RestyleWithAddedDeclaration,
|
|||
// Style attribute
|
||||
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
|
||||
const nsACString* data)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty,
|
||||
RawServoDeclarationBlockStrong)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace mozilla {
|
|||
class ServoDeclarationBlock final : public DeclarationBlock
|
||||
{
|
||||
public:
|
||||
ServoDeclarationBlock()
|
||||
: ServoDeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServoDeclarationBlock)
|
||||
|
||||
static already_AddRefed<ServoDeclarationBlock>
|
||||
|
|
|
@ -128,8 +128,13 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
|
|||
}
|
||||
|
||||
// cannot fail
|
||||
RefPtr<css::Declaration> decl = new css::Declaration();
|
||||
decl->InitializeEmpty();
|
||||
RefPtr<DeclarationBlock> decl;
|
||||
if (mElement->IsStyledByServo()) {
|
||||
decl = new ServoDeclarationBlock();
|
||||
} else {
|
||||
decl = new css::Declaration();
|
||||
decl->AsGecko()->InitializeEmpty();
|
||||
}
|
||||
|
||||
// this *can* fail (inside SetAttrAndNotify, at least).
|
||||
nsresult rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче