Bug 1345696 part 1 - Lots of fixup for the next patch. r=heycam
The next patch moves nsCSSFontFaceRule into a separate header, which
somehow affects lots of header dependencies. I'm not completely sure
why this happens, though.
MozReview-Commit-ID: KuXbsaX0NUd
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -22,16 +22,17 @@
#include "nsIDOMLocation.h"
#include "nsIDOMWindowCollection.h"
#include "nsIDOMWindow.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "nsIPrefService.h"
+#include "mozilla/Preferences.h"
#include "mozilla/Printf.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#ifdef ENABLE_INTL_API
#include "unicode/uloc.h"
#endif
--- a/dom/base/CustomElementRegistry.h
+++ b/dom/base/CustomElementRegistry.h
@@ -7,16 +7,17 @@
#ifndef mozilla_dom_CustomElementRegistry_h
#define mozilla_dom_CustomElementRegistry_h
#include "js/GCHashTable.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
+#include "mozilla/dom/Element.h"
#include "mozilla/dom/FunctionBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
class nsDocument;
namespace mozilla {
namespace dom {
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -225,17 +225,17 @@
#include "nsDOMCaretPosition.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsViewportInfo.h"
#include "mozilla/StaticPtr.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIEditor.h"
#include "nsIDOMCSSStyleRule.h"
-#include "mozilla/css/Rule.h"
+#include "mozilla/css/StyleRule.h"
#include "nsIDOMLocation.h"
#include "nsIHttpChannelInternal.h"
#include "nsISecurityConsoleMessage.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/dom/XPathEvaluator.h"
#include "mozilla/dom/XPathNSResolverBinding.h"
#include "mozilla/dom/XPathResult.h"
#include "nsIDocumentEncoder.h"
@@ -1202,16 +1202,21 @@ nsDOMStyleSheetSetList::EnsureFresh()
}
}
// ==================================================================
nsIDocument::SelectorCache::SelectorCache()
: nsExpirationTracker<SelectorCacheKey, 4>(1000, "nsIDocument::SelectorCache")
{ }
+nsIDocument::SelectorCache::~SelectorCache()
+{
+ AgeAllGenerations();
+}
+
// CacheList takes ownership of aSelectorList.
void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
nsCSSSelectorList* aSelectorList)
{
MOZ_ASSERT(NS_IsMainThread());
SelectorCacheKey* key = new SelectorCacheKey(aSelector);
mTable.Put(key->mKey, aSelectorList);
AddObject(key);
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1080,20 +1080,17 @@ public:
// being used. Returns whether we actually had an entry for aSelector.
// If we have an entry and *aList is null, that indicates that aSelector
// has already been parsed and is not a syntactically valid selector.
bool GetList(const nsAString& aSelector, nsCSSSelectorList** aList)
{
return mTable.Get(aSelector, aList);
}
- ~SelectorCache()
- {
- AgeAllGenerations();
- }
+ ~SelectorCache();
private:
nsClassHashtable<nsStringHashKey, nsCSSSelectorList> mTable;
};
SelectorCache& GetSelectorCache()
{
return mSelectorCache;
--- a/dom/presentation/ipc/PresentationParent.cpp
+++ b/dom/presentation/ipc/PresentationParent.cpp
@@ -1,16 +1,17 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=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 "DCPresentationChannelDescription.h"
#include "mozilla/dom/ContentProcessManager.h"
+#include "mozilla/dom/Element.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/Unused.h"
#include "nsIPresentationDeviceManager.h"
#include "nsIPresentationSessionTransport.h"
#include "nsIPresentationSessionTransportBuilder.h"
#include "nsServiceManagerUtils.h"
#include "PresentationBuilderParent.h"
#include "PresentationParent.h"
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -720,16 +720,22 @@ CSSStyleSheet::RegisterNamespaceRule(css
nsresult rv = Inner()->CreateNamespaceMap();
NS_ENSURE_SUCCESS(rv, rv);
}
AddNamespaceRuleToMap(aRule, Inner()->mNameSpaceMap);
return NS_OK;
}
+void
+CSSStyleSheet::SetScopeElement(dom::Element* aScopeElement)
+{
+ mScopeElement = aScopeElement;
+}
+
css::Rule*
CSSStyleSheet::GetDOMOwnerRule() const
{
return mOwnerRule;
}
CSSRuleList*
CSSStyleSheet::GetCssRulesInternal(ErrorResult& aRv)
--- a/layout/style/CSSStyleSheet.h
+++ b/layout/style/CSSStyleSheet.h
@@ -10,17 +10,16 @@
#define mozilla_CSSStyleSheet_h
#include "mozilla/Attributes.h"
#include "mozilla/IncrementalClearCOMRuleArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInfo.h"
#include "mozilla/css/SheetParsingMode.h"
-#include "mozilla/dom/Element.h"
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsICSSLoaderObserver.h"
#include "nsTArrayForwardDeclare.h"
#include "nsString.h"
#include "mozilla/CORSMode.h"
@@ -40,16 +39,17 @@ namespace mozilla {
class CSSStyleSheet;
struct ChildSheetListBuilder;
namespace css {
class GroupRule;
} // namespace css
namespace dom {
class CSSRuleList;
+class Element;
} // namespace dom
// -------------------------------
// CSS Style Sheet Inner Data Container
//
struct CSSStyleSheetInner : public StyleSheetInfo
{
@@ -163,20 +163,17 @@ public:
// Function used as a callback to rebuild our inner's child sheet
// list after we clone a unique inner for ourselves.
static bool RebuildChildList(css::Rule* aRule,
ChildSheetListBuilder* aBuilder);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
dom::Element* GetScopeElement() const { return mScopeElement; }
- void SetScopeElement(dom::Element* aScopeElement)
- {
- mScopeElement = aScopeElement;
- }
+ void SetScopeElement(dom::Element* aScopeElement);
// WebIDL CSSStyleSheet API
// Can't be inline because we can't include ImportRule here. And can't be
// called GetOwnerRule because that would be ambiguous with the ImportRule
// version.
css::Rule* GetDOMOwnerRule() const final;
void WillDirty();
--- a/layout/style/Rule.h
+++ b/layout/style/Rule.h
@@ -3,17 +3,17 @@
* 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/. */
/* base class for all rule types in a CSS style sheet */
#ifndef mozilla_css_Rule_h___
#define mozilla_css_Rule_h___
-#include "mozilla/StyleSheetInlines.h"
+#include "mozilla/StyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "nsISupports.h"
#include "nsIDOMCSSRule.h"
#include "nsWrapperCache.h"
class nsIDocument;
struct nsRuleData;
template<class T> struct already_AddRefed;
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -9,32 +9,34 @@
#include "mozilla/EnumeratedArray.h"
#include "mozilla/EventStates.h"
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/ServoElementSnapshot.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/SheetType.h"
#include "mozilla/UniquePtr.h"
+#include "MainThreadUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSAnonBoxes.h"
#include "nsChangeHint.h"
#include "nsIAtom.h"
#include "nsTArray.h"
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
class CSSStyleSheet;
class ServoRestyleManager;
class ServoStyleSheet;
struct Keyframe;
struct ServoComputedValuesWithParent;
} // namespace mozilla
+class nsIContent;
class nsIDocument;
class nsStyleContext;
class nsPresContext;
struct nsTimingFunction;
struct TreeMatchContext;
namespace mozilla {
@@ -219,25 +221,25 @@ public:
*/
bool StyleDocument();
/**
* Eagerly styles a subtree of unstyled nodes that was just appended to the
* tree. This is used in situations where we need the style immediately and
* cannot wait for a future batch restyle.
*/
- void StyleNewSubtree(Element* aRoot);
+ void StyleNewSubtree(dom::Element* aRoot);
/**
* Like the above, but skips the root node, and only styles unstyled children.
* When potentially appending multiple children, it's preferable to call
* StyleNewChildren on the node rather than making multiple calls to
* StyleNewSubtree on each child, since it allows for more parallelism.
*/
- void StyleNewChildren(Element* aParent);
+ void StyleNewChildren(dom::Element* aParent);
/**
* Records that the contents of style sheets have changed since the last
* restyle. Calling this will ensure that the Stylist rebuilds its
* selector maps.
*/
void NoteStyleSheetsChanged();
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -5,16 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_StyleSheetInlines_h
#define mozilla_StyleSheetInlines_h
#include "mozilla/StyleSheetInfo.h"
#include "mozilla/ServoStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
+#include "nsINode.h"
namespace mozilla {
MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet, ServoStyleSheet)
StyleSheetInfo&
StyleSheet::SheetInfo()
{
--- a/layout/style/nsICSSDeclaration.h
+++ b/layout/style/nsICSSDeclaration.h
@@ -17,17 +17,17 @@
* nsCSSPropertyID enums for the prop names instead of using strings.
* This is meant for use in performance-sensitive code only! Most
* consumers should continue to use nsIDOMCSSStyleDeclaration.
*/
#include "mozilla/Attributes.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsCSSPropertyID.h"
-#include "CSSValue.h"
+#include "mozilla/dom/CSSValue.h"
#include "nsWrapperCache.h"
#include "nsString.h"
#include "nsIDOMCSSRule.h"
#include "nsIDOMCSSValue.h"
#include "mozilla/ErrorResult.h"
#include "nsCOMPtr.h"
class nsINode;
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -9,22 +9,25 @@
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/SRIMetadata.h"
+#include "MainThreadUtils.h"
+#include "nsColor.h"
#include "nsIConsoleService.h"
#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsIXULRuntime.h"
+#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
// Includes for the crash report annotation in ErrorLoadingSheet.
#ifdef MOZ_CRASHREPORTER
#include "mozilla/Omnijar.h"
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
--- a/parser/html/nsHtml5Parser.cpp
+++ b/parser/html/nsHtml5Parser.cpp
@@ -2,16 +2,17 @@
/* vim: set sw=2 ts=2 et tw=79: */
/* 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 "nsHtml5Parser.h"
#include "mozilla/AutoRestore.h"
+#include "nsCRT.h"
#include "nsContentUtils.h" // for kLoadAsData
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"
#include "nsHtml5AtomTable.h"
#include "nsHtml5DependentUTF16Buffer.h"
#include "nsNetUtil.h"
NS_INTERFACE_TABLE_HEAD(nsHtml5Parser)
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
@@ -58,16 +58,17 @@
#include "nsFocusManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsContentUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsSandboxFlags.h"
#include "mozilla/Preferences.h"
+#include "mozilla/dom/Element.h"
#include "mozilla/dom/Storage.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
#include "nsIXULWindow.h"
#include "nsIXULBrowserWindow.h"
#include "nsGlobalWindow.h"