From aa21f96cf57a12111a5edf27cb5e4e2ea8f4be3d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 30 Apr 2020 16:41:13 +0000 Subject: Issue #80 - De-unify layout/style (redwood) --- layout/style/CSSLexer.h | 1 + layout/style/CSSStyleSheet.cpp | 1 + layout/style/RuleProcessorCache.cpp | 1 + layout/style/ServoStyleSet.cpp | 1 + layout/style/ServoStyleSheet.cpp | 4 ++++ layout/style/StyleRule.cpp | 1 + layout/style/StyleSheet.cpp | 3 +++ layout/style/moz.build | 12 +++--------- layout/style/nsCSSProps.h | 4 ++-- layout/style/nsCSSPseudoClassList.h | 2 ++ layout/style/nsCSSPseudoClasses.cpp | 1 + layout/style/nsCSSPseudoClasses.h | 2 ++ layout/style/nsCSSValue.cpp | 7 ++++--- layout/style/nsComputedDOMStyle.cpp | 2 ++ layout/style/nsDOMCSSAttrDeclaration.cpp | 5 +++++ layout/style/nsMediaFeatures.cpp | 1 + layout/style/nsStyleContext.cpp | 3 +++ layout/style/nsStyleStruct.cpp | 1 + 18 files changed, 38 insertions(+), 14 deletions(-) (limited to 'layout/style') diff --git a/layout/style/CSSLexer.h b/layout/style/CSSLexer.h index 8b41d2778..4eff7a528 100644 --- a/layout/style/CSSLexer.h +++ b/layout/style/CSSLexer.h @@ -9,6 +9,7 @@ #include "mozilla/UniquePtr.h" #include "nsCSSScanner.h" #include "mozilla/dom/CSSLexerBinding.h" +#include "mozilla/dom/NonRefcountedDOMObject.h" namespace mozilla { namespace dom { diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 71ca6e3f2..9404fa713 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -47,6 +47,7 @@ #include "mozilla/RuleProcessorCache.h" #include "nsIStyleSheetLinkingElement.h" #include "nsDOMWindowUtils.h" +#include "nsStyleSet.h" using namespace mozilla; using namespace mozilla::dom; diff --git a/layout/style/RuleProcessorCache.cpp b/layout/style/RuleProcessorCache.cpp index 23832c230..e2e788c56 100644 --- a/layout/style/RuleProcessorCache.cpp +++ b/layout/style/RuleProcessorCache.cpp @@ -13,6 +13,7 @@ #include #include "nsCSSRuleProcessor.h" #include "nsThreadUtils.h" +#include "CSSStyleSheet.h" using namespace mozilla; diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 519d17aa8..f0230b55b 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -6,6 +6,7 @@ #include "mozilla/ServoStyleSet.h" +#include "ServoBindings.h" #include "mozilla/ServoRestyleManager.h" #include "mozilla/dom/ChildIterator.h" #include "nsCSSAnonBoxes.h" diff --git a/layout/style/ServoStyleSheet.cpp b/layout/style/ServoStyleSheet.cpp index cfeae20d2..340ecc22a 100644 --- a/layout/style/ServoStyleSheet.cpp +++ b/layout/style/ServoStyleSheet.cpp @@ -4,8 +4,12 @@ * 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 "ServoBindings.h" #include "mozilla/ServoStyleSheet.h" #include "mozilla/StyleBackendType.h" +#include "CSSRuleList.h" + +using namespace mozilla::dom; namespace mozilla { diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 598cb7c74..6c374404d 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -36,6 +36,7 @@ class nsIDOMCSSStyleDeclaration; class nsIDOMCSSStyleSheet; using namespace mozilla; +using namespace mozilla::dom; #define NS_IF_CLONE(member_) \ PR_BEGIN_MACRO \ diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index f307f3918..a9f6b7ef5 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -6,6 +6,7 @@ #include "mozilla/StyleSheet.h" +#include "mozilla/dom/BindingDeclarations.h" // for Optional<> #include "mozilla/dom/CSSRuleList.h" #include "mozilla/dom/ShadowRoot.h" #include "mozilla/ServoStyleSheet.h" @@ -14,6 +15,8 @@ #include "nsNullPrincipal.h" +using namespace mozilla::dom; + namespace mozilla { StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode) diff --git a/layout/style/moz.build b/layout/style/moz.build index 3dc2a19af..ff06b5101 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -139,7 +139,7 @@ EXPORTS.mozilla.css += [ 'StyleRule.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'AnimationCollection.cpp', 'AnimationCommon.cpp', 'CounterStyleManager.cpp', @@ -169,6 +169,7 @@ UNIFIED_SOURCES += [ 'nsCSSProps.cpp', 'nsCSSPseudoClasses.cpp', 'nsCSSPseudoElements.cpp', + 'nsCSSRuleProcessor.cpp', 'nsCSSRules.cpp', 'nsCSSScanner.cpp', 'nsCSSValue.cpp', @@ -181,6 +182,7 @@ UNIFIED_SOURCES += [ 'nsFontFaceUtils.cpp', 'nsHTMLCSSStyleSheet.cpp', 'nsHTMLStyleSheet.cpp', + 'nsLayoutStylesheetCache.cpp', 'nsMediaFeatures.cpp', 'nsNthIndexCache.cpp', 'nsROCSSPrimitiveValue.cpp', @@ -206,14 +208,6 @@ UNIFIED_SOURCES += [ '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', - 'nsLayoutStylesheetCache.cpp', -] - EXTRA_COMPONENTS += [ 'CSSUnprefixingService.js', 'CSSUnprefixingService.manifest', diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index e67e1d41d..aabbac07a 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -345,7 +345,7 @@ public: // KTableEntry objects can be initialized either with an int16_t value // or a value of an enumeration type that can fit within an int16_t. - constexpr KTableEntry(nsCSSKeyword aKeyword, int16_t aValue) + KTableEntry(nsCSSKeyword aKeyword, int16_t aValue) : mKeyword(aKeyword) , mValue(aValue) { @@ -353,7 +353,7 @@ public: template::value>::type> - constexpr KTableEntry(nsCSSKeyword aKeyword, T aValue) + KTableEntry(nsCSSKeyword aKeyword, T aValue) : mKeyword(aKeyword) , mValue(static_cast(aValue)) { diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h index 701578338..ec7bfcb77 100644 --- a/layout/style/nsCSSPseudoClassList.h +++ b/layout/style/nsCSSPseudoClassList.h @@ -38,6 +38,8 @@ * automatically defined to CSS_PSEUDO_CLASS. */ +#include "nsCSSPseudoElements.h" + // OUTPUT_CLASS=nsCSSPseudoClasses // MACRO_NAME=CSS_PSEUDO_CLASS diff --git a/layout/style/nsCSSPseudoClasses.cpp b/layout/style/nsCSSPseudoClasses.cpp index 9b26459dd..a174525b1 100644 --- a/layout/style/nsCSSPseudoClasses.cpp +++ b/layout/style/nsCSSPseudoClasses.cpp @@ -13,6 +13,7 @@ #include "nsString.h" using namespace mozilla; +using namespace mozilla::css; // define storage for all atoms #define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \ diff --git a/layout/style/nsCSSPseudoClasses.h b/layout/style/nsCSSPseudoClasses.h index ca1cb2f39..55e5bf9d2 100644 --- a/layout/style/nsCSSPseudoClasses.h +++ b/layout/style/nsCSSPseudoClasses.h @@ -9,6 +9,8 @@ #define nsCSSPseudoClasses_h___ #include "nsStringFwd.h" +#include "mozilla/CSSEnabledState.h" +#include "nsStyleStruct.h" // The following two flags along with the pref defines where this pseudo // class can be used: diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index baf5b7897..0a905a055 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -6,11 +6,12 @@ /* representation of simple property values within CSS declarations */ +#include "mozilla/ArrayUtils.h" + #include "nsCSSValue.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/Likely.h" -#include "mozilla/MemoryReporting.h" #include "mozilla/Move.h" #include "mozilla/css/ImageLoader.h" #include "CSSCalc.h" @@ -18,8 +19,6 @@ #include "imgIRequest.h" #include "imgRequestProxy.h" #include "nsIDocument.h" -#include "nsIPrincipal.h" -#include "nsCSSProps.h" #include "nsNetUtil.h" #include "nsPresContext.h" #include "nsStyleUtil.h" @@ -27,7 +26,9 @@ #include "nsStyleSet.h" #include "nsContentUtils.h" + using namespace mozilla; +using namespace mozilla::css; static bool IsLocalRefURL(nsStringBuffer* aString) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 910c1de8a..db39ef727 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -54,6 +54,8 @@ using namespace mozilla; using namespace mozilla::dom; +typedef nsCSSProps::KTableEntry KTableEntry; + #if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon) #define DEBUG_ComputedDOMStyle #endif diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp index ce638a9c2..f94998478 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -10,6 +10,7 @@ #include "mozilla/css/Declaration.h" #include "mozilla/css/StyleRule.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/DocGroup.h" #include "nsIDocument.h" #include "nsIDOMMutationEvent.h" #include "nsIURI.h" @@ -17,8 +18,12 @@ #include "nsWrapperCacheInlines.h" #include "nsIFrame.h" #include "ActiveLayerTracker.h" +#include "ServoDeclarationBlock.h" +#include "StyleSetHandle.h" +#include "DeclarationBlockInlines.h" using namespace mozilla; +using namespace mozilla::dom; nsDOMCSSAttributeDeclaration::nsDOMCSSAttributeDeclaration(dom::Element* aElement, bool aIsSMILOverride) diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 854236e51..f33f8dd33 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -19,6 +19,7 @@ #include "nsDeviceContext.h" #include "nsIBaseWindow.h" #include "nsIDocument.h" +#include "nsIWidget.h" #include "nsContentUtils.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 7ad260f1b..4b1a14897 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -12,6 +12,8 @@ #include "nsCSSAnonBoxes.h" #include "nsCSSPseudoElements.h" #include "nsStyleConsts.h" +#include "nsStyleStruct.h" +#include "nsStyleStructInlines.h" #include "nsString.h" #include "nsPresContext.h" #include "nsIStyleRule.h" @@ -35,6 +37,7 @@ #include "mozilla/ReflowInput.h" #include "nsLayoutUtils.h" #include "nsCoord.h" +#include "nsFontMetrics.h" // Ensure the binding function declarations in nsStyleContext.h matches // those in ServoBindings.h. diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 72c103724..200f934c5 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -40,6 +40,7 @@ #include using namespace mozilla; +using namespace mozilla::dom; static_assert((((1 << nsStyleStructID_Length) - 1) & ~(NS_STYLE_INHERIT_MASK)) == 0, -- cgit v1.2.3