Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / StyleSheetInlines.h
blob54cbba855f208bd2f8769f504caf55b3713c83e0
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 #ifndef mozilla_StyleSheetInlines_h
8 #define mozilla_StyleSheetInlines_h
10 #include "mozilla/dom/Document.h"
11 #include "mozilla/StyleSheet.h"
12 #include "nsIGlobalObject.h"
13 #include "nsINode.h"
15 namespace mozilla {
17 void StyleSheet::SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
18 nsIURI* aBaseURI) {
19 MOZ_ASSERT(aSheetURI && aBaseURI, "null ptr");
20 MOZ_ASSERT(!HasRules() && !IsComplete(),
21 "Can't call SetURIs on sheets that are complete or have rules");
22 StyleSheetInfo& info = Inner();
23 info.mSheetURI = aSheetURI;
24 info.mOriginalSheetURI = aOriginalSheetURI;
25 info.mBaseURI = aBaseURI;
28 dom::ParentObject StyleSheet::GetParentObject() const {
29 if (mRelevantGlobal) {
30 return dom::ParentObject(mRelevantGlobal);
32 if (IsConstructed()) {
33 return dom::ParentObject(mConstructorDocument.get());
35 if (mOwningNode) {
36 return dom::ParentObject(mOwningNode);
38 return dom::ParentObject(mParentSheet);
41 } // namespace mozilla
43 #endif // mozilla_StyleSheetInlines_h