Bug 1306212 part 3 - Move the only constructor of StyleSheetInfo to StyleSheet.cpp. r=heycam
MozReview-Commit-ID: Fv2AyBE1Js0
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -6,16 +6,18 @@
#include "mozilla/StyleSheet.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/ServoStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/CSSStyleSheet.h"
+#include "nsNullPrincipal.h"
+
namespace mozilla {
StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode)
: mDocument(nullptr)
, mOwningNode(nullptr)
, mParsingMode(aParsingMode)
, mType(aType)
, mDisabled(false)
@@ -71,9 +73,26 @@ StyleSheet::SetComplete()
if (mOwningNode && !mDisabled &&
mOwningNode->HasFlag(NODE_IS_IN_SHADOW_TREE) &&
mOwningNode->IsContent()) {
dom::ShadowRoot* shadowRoot = mOwningNode->AsContent()->GetContainingShadow();
shadowRoot->StyleSheetChanged();
}
}
+StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
+ ReferrerPolicy aReferrerPolicy,
+ const dom::SRIMetadata& aIntegrity)
+ : mPrincipal(nsNullPrincipal::Create())
+ , mCORSMode(aCORSMode)
+ , mReferrerPolicy(aReferrerPolicy)
+ , mIntegrity(aIntegrity)
+ , mComplete(false)
+#ifdef DEBUG
+ , mPrincipalSet(false)
+#endif
+{
+ if (!mPrincipal) {
+ NS_RUNTIMEABORT("nsNullPrincipal::Init failed");
+ }
+}
+
} // namespace mozilla
deleted file mode 100644
--- a/layout/style/StyleSheetInfo.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "StyleSheetInfo.h"
-
-#include "nsIURI.h"
-#include "nsNullPrincipal.h"
-
-namespace mozilla {
-
-using namespace mozilla::dom;
-
-StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
- ReferrerPolicy aReferrerPolicy,
- const SRIMetadata& aIntegrity)
- : mPrincipal(nsNullPrincipal::Create())
- , mCORSMode(aCORSMode)
- , mReferrerPolicy(aReferrerPolicy)
- , mIntegrity(aIntegrity)
- , mComplete(false)
-#ifdef DEBUG
- , mPrincipalSet(false)
-#endif
-{
- if (!mPrincipal) {
- NS_RUNTIMEABORT("nsNullPrincipal::Init failed");
- }
-}
-
-StyleSheetInfo::StyleSheetInfo(const StyleSheetInfo& aCopy)
- : mSheetURI(aCopy.mSheetURI)
- , mOriginalSheetURI(aCopy.mOriginalSheetURI)
- , mBaseURI(aCopy.mBaseURI)
- , mPrincipal(aCopy.mPrincipal)
- , mCORSMode(aCopy.mCORSMode)
- , mReferrerPolicy(aCopy.mReferrerPolicy)
- , mIntegrity(aCopy.mIntegrity)
- , mComplete(aCopy.mComplete)
-#ifdef DEBUG
- , mPrincipalSet(aCopy.mPrincipalSet)
-#endif
-{
-}
-
-} // namespace mozilla
--- a/layout/style/StyleSheetInfo.h
+++ b/layout/style/StyleSheetInfo.h
@@ -26,17 +26,16 @@ namespace mozilla {
*/
struct StyleSheetInfo
{
typedef net::ReferrerPolicy ReferrerPolicy;
StyleSheetInfo(CORSMode aCORSMode,
ReferrerPolicy aReferrerPolicy,
const dom::SRIMetadata& aIntegrity);
- StyleSheetInfo(const StyleSheetInfo& aCopy);
nsCOMPtr<nsIURI> mSheetURI; // for error reports, etc.
nsCOMPtr<nsIURI> mOriginalSheetURI; // for GetHref. Can be null.
nsCOMPtr<nsIURI> mBaseURI; // for resolving relative URIs
nsCOMPtr<nsIPrincipal> mPrincipal;
CORSMode mCORSMode;
// The Referrer Policy of a stylesheet is used for its child sheets, so it is
// stored here.
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -193,17 +193,16 @@ UNIFIED_SOURCES += [
'RuleProcessorCache.cpp',
'ServoBindings.cpp',
'ServoElementSnapshot.cpp',
'ServoStyleSet.cpp',
'ServoStyleSheet.cpp',
'StyleAnimationValue.cpp',
'StyleRule.cpp',
'StyleSheet.cpp',
- 'StyleSheetInfo.cpp',
'SVGAttrAnimationRuleProcessor.cpp',
]
# nsCSSRuleProcessor.cpp needs to be built separately because it uses plarena.h.
# nsLayoutStylesheetCache.cpp needs to be built separately because it uses
# nsExceptionHandler.h, which includes windows.h.
SOURCES += [
'nsCSSRuleProcessor.cpp',