From e6ed33b04e7f8ff99c7524aa6ef02e6f16e22837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 29 Jun 2016 11:27:42 +0000 Subject: [PATCH] Bug 1283242: style: Whitespace cleanup and remove dead code. r=bobbyholley+313730 gNewCount and gSharedCount aren't even declared. --HG-- extra : rebase_source : 3c7d79a360ad6eef2e884de513ee45a289d4cd0a --- layout/style/nsRuleNode.h | 6 +++--- layout/style/nsStyleContext.cpp | 18 +++++++----------- layout/style/nsStyleSet.cpp | 11 ++--------- layout/style/nsStyleSet.h | 4 ++-- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 6c1597f6f234..ec4d305e6d97 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -1029,15 +1029,15 @@ public: static void ComputeFontFeatures(const nsCSSValuePairList *aFeaturesList, nsTArray& aFeatureSettings); - static nscoord CalcFontPointSize(int32_t aHTMLSize, int32_t aBasePointSize, + static nscoord CalcFontPointSize(int32_t aHTMLSize, int32_t aBasePointSize, nsPresContext* aPresContext, nsFontSizeType aFontSizeType = eFontSize_HTML); - static nscoord FindNextSmallerFontSize(nscoord aFontSize, int32_t aBasePointSize, + static nscoord FindNextSmallerFontSize(nscoord aFontSize, int32_t aBasePointSize, nsPresContext* aPresContext, nsFontSizeType aFontSizeType = eFontSize_HTML); - static nscoord FindNextLargerFontSize(nscoord aFontSize, int32_t aBasePointSize, + static nscoord FindNextLargerFontSize(nscoord aFontSize, int32_t aBasePointSize, nsPresContext* aPresContext, nsFontSizeType aFontSizeType = eFontSize_HTML); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 6d267aa8d445..1ec328d13aea 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -31,10 +31,6 @@ #include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSetHandleInlines.h" -#ifdef DEBUG -// #define NOISY_DEBUG -#endif - using namespace mozilla; //---------------------------------------------------------------------- @@ -331,7 +327,7 @@ void nsStyleContext::RemoveChild(nsStyleContext* aChild) if ((*list) == aChild) { (*list) = (*list)->mNextSibling; } - } + } else { NS_ASSERTION((*list) == aChild, "bad sibling pointers"); (*list) = nullptr; @@ -474,7 +470,7 @@ const void* nsStyleContext::StyleData(nsStyleStructID aSID) // This is an evil evil function, since it forces you to alloc your own separate copy of // style data! Do not use this function unless you absolutely have to! You should avoid // this at all costs! -dwh -void* +void* nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID) { MOZ_ASSERT(!mSource.IsServoComputedValues(), @@ -559,7 +555,7 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, void* aStruct) { // This method should only be called from nsRuleNode! It is not a public // method! - + NS_ASSERTION(aSID >= 0 && aSID < nsStyleStructID_Length, "out of bounds"); // NOTE: nsCachedStyleData::GetStyleData works roughly the same way. @@ -1143,9 +1139,9 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext, const nsStyleOutline *otherVisOutline = otherVis->StyleOutline(); bool haveColor; nscolor thisColor, otherColor; - if (thisVisOutline->GetOutlineInitialColor() != + if (thisVisOutline->GetOutlineInitialColor() != otherVisOutline->GetOutlineInitialColor() || - (haveColor = thisVisOutline->GetOutlineColor(thisColor)) != + (haveColor = thisVisOutline->GetOutlineColor(thisColor)) != otherVisOutline->GetOutlineColor(otherColor) || (haveColor && thisColor != otherColor)) { change = true; @@ -1278,7 +1274,7 @@ void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants) // Overloaded new operator. Initializes the memory to 0 and relies on an arena // (which comes from the presShell) to perform the allocation. -void* +void* nsStyleContext::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW { // Check the recycle list first. @@ -1288,7 +1284,7 @@ nsStyleContext::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_N // Overridden to prevent the global delete from being called, since the memory // came out of an nsIArena instead of the global delete operator's heap. -void +void nsStyleContext::Destroy() { // Get the pres context. diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 0352f2d217af..3b068b63ef32 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -421,7 +421,7 @@ nsStyleSet::GatherRuleProcessors(SheetType aType) // Clear mScopedDocSheetRuleProcessors, but save it. oldScopedDocRuleProcessors.SwapElements(mScopedDocSheetRuleProcessors); } - if (mAuthorStyleDisabled && (aType == SheetType::Doc || + if (mAuthorStyleDisabled && (aType == SheetType::Doc || aType == SheetType::ScopedDoc || aType == SheetType::StyleAttr)) { // Don't regather if this level is disabled. Note that we gather @@ -907,13 +907,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, aVisitedRuleNode, relevantLinkVisited); -#ifdef NOISY_DEBUG - if (result) - fprintf(stdout, "--- SharedSC %d ---\n", ++gSharedCount); - else - fprintf(stdout, "+++ NewSC %d +++\n", ++gNewCount); -#endif - if (!result) { result = NS_NewStyleContext(aParentContext, aPseudoTag, aPseudoType, aRuleNode, @@ -1068,7 +1061,7 @@ nsStyleSet::AssertNoCSSRules(nsRuleNode* aCurrLevelNode, // Enumerate the rules in a way that cares about the order of the rules. void -nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc, +nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc, RuleProcessorData* aData, Element* aElement, nsRuleWalker* aRuleWalker) { diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index a6298edb2722..8aed8c85ba59 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -461,14 +461,14 @@ private: // aLastPrevLevelNode. void AssertNoImportantRules(nsRuleNode* aCurrLevelNode, nsRuleNode* aLastPrevLevelNode); - + // Just like AddImportantRules except it doesn't actually add anything; it // just asserts that there are no CSS rules between aCurrLevelNode and // aLastPrevLevelNode. Mostly useful for the preshint level. void AssertNoCSSRules(nsRuleNode* aCurrLevelNode, nsRuleNode* aLastPrevLevelNode); #endif - + // Enumerate the rules in a way that cares about the order of the // rules. // aElement is the element the rules are for. It might be null. aData