Bug 1584173 [wpt PR 19325] - Update interfaces/fullscreen.idl, a=testonly
[gecko.git] / layout / style / DeclarationBlock.cpp
blobbb4d562fe22c300c199d97c92e90628939075b91
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/DeclarationBlock.h"
9 #include "mozilla/css/Rule.h"
10 #include "mozilla/ServoBindings.h"
12 #include "nsCSSProps.h"
13 #include "nsIMemoryReporter.h"
15 namespace mozilla {
17 /* static */
18 already_AddRefed<DeclarationBlock> DeclarationBlock::FromCssText(
19 const nsAString& aCssText, URLExtraData* aExtraData, nsCompatibility aMode,
20 css::Loader* aLoader) {
21 NS_ConvertUTF16toUTF8 value(aCssText);
22 RefPtr<RawServoDeclarationBlock> raw =
23 Servo_ParseStyleAttribute(&value, aExtraData, aMode, aLoader).Consume();
24 RefPtr<DeclarationBlock> decl = new DeclarationBlock(raw.forget());
25 return decl.forget();
28 MOZ_DEFINE_MALLOC_SIZE_OF(ServoDeclarationBlockMallocSizeOf)
29 MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoDeclarationBlockEnclosingSizeOf)
31 size_t DeclarationBlock::SizeofIncludingThis(MallocSizeOf aMallocSizeOf) {
32 size_t n = aMallocSizeOf(this);
33 n += Servo_DeclarationBlock_SizeOfIncludingThis(
34 ServoDeclarationBlockMallocSizeOf, ServoDeclarationBlockEnclosingSizeOf,
35 mRaw.get());
36 return n;
39 bool DeclarationBlock::OwnerIsReadOnly() const {
40 css::Rule* rule = GetOwningRule();
41 return rule && rule->IsReadOnly();
44 } // namespace mozilla