Bug 1283242: style: Whitespace cleanup and remove dead code.
gNewCount and gSharedCount aren't even declared.
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -1024,25 +1024,25 @@ public:
// style structs.
bool NodeHasCachedUnconditionalData(const nsStyleStructID aSID) {
return !!mStyleData.GetStyleData(aSID);
}
static void ComputeFontFeatures(const nsCSSValuePairList *aFeaturesList,
nsTArray<gfxFontFeature>& 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);
/**
* @param aValue The color value, returned from nsCSSParser::ParseColorString
* @param aPresContext Presentation context whose preferences are used
* for certain enumerated colors
* @param aStyleContext Style context whose color is used for 'currentColor'
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -26,20 +26,16 @@
#include "nsIDocument.h"
#include "nsPrintfCString.h"
#include "RubyUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/ArenaObjectID.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
-#ifdef DEBUG
-// #define NOISY_DEBUG
-#endif
-
using namespace mozilla;
//----------------------------------------------------------------------
#ifdef DEBUG
// Check that the style struct IDs are in the same order as they are
// in nsStyleStructList.h, since when we set up the IDs, we include
@@ -326,17 +322,17 @@ void nsStyleContext::RemoveChild(nsStyle
NS_PRECONDITION(nullptr != aChild && this == aChild->mParent, "bad argument");
nsStyleContext **list = aChild->mSource.MatchesNoRules() ? &mEmptyChild : &mChild;
if (aChild->mPrevSibling != aChild) { // has siblings
if ((*list) == aChild) {
(*list) = (*list)->mNextSibling;
}
- }
+ }
else {
NS_ASSERTION((*list) == aChild, "bad sibling pointers");
(*list) = nullptr;
}
aChild->mPrevSibling->mNextSibling = aChild->mNextSibling;
aChild->mNextSibling->mPrevSibling = aChild->mPrevSibling;
aChild->mNextSibling = aChild;
@@ -469,17 +465,17 @@ const void* nsStyleContext::StyleData(ns
SetStyle(aSID, const_cast<void*>(newData));
}
return newData;
}
// 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(),
"Can't COW-mutate servo values from Gecko!");
// If we already own the struct and no kids could depend on it, then
// just return it. (We leak in this case if there are kids -- and this
// function really shouldn't be called for style contexts that could
@@ -554,17 +550,17 @@ nsStyleContext::CreateEmptyStyleData(con
return result;
}
void
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.
// See the comments there (in nsRuleNode.h) for more details about
// what this is doing and why.
void** dataSlot;
if (nsCachedStyleData::IsReset(aSID)) {
@@ -1138,19 +1134,19 @@ nsStyleContext::CalcStyleDifference(nsSt
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleOutline()) {
const nsStyleOutline *thisVisOutline = thisVis->StyleOutline();
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;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleColumn()) {
@@ -1273,27 +1269,27 @@ void nsStyleContext::List(FILE* out, int
} while (mEmptyChild != child);
}
}
}
#endif
// 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.
return aPresContext->PresShell()->
AllocateByObjectID(eArenaObjectID_nsStyleContext, sz);
}
// 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.
RefPtr<nsPresContext> presContext = PresContext();
// Call our destructor.
this->~nsStyleContext();
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -416,17 +416,17 @@ nsStyleSet::GatherRuleProcessors(SheetTy
Element* scope =
static_cast<nsCSSRuleProcessor*>(processor)->GetScopeElement();
scope->ClearIsScopedStyleRoot();
}
// 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
// preshint sheets no matter what, but then skip them for some
// elements later if mAuthorStyleDisabled.
return NS_OK;
}
switch (aType) {
@@ -902,23 +902,16 @@ nsStyleSet::GetContext(nsStyleContext* a
(aParentContext && aParentContext->RelevantLinkVisited());
RefPtr<nsStyleContext> result;
if (aParentContext)
result = aParentContext->FindChildWithRules(aPseudoTag, aRuleNode,
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,
aFlags & eSkipParentDisplayBasedStyleFixup);
if (aVisitedRuleNode) {
RefPtr<nsStyleContext> resultIfVisited =
NS_NewStyleContext(parentIfVisited, aPseudoTag, aPseudoType,
aVisitedRuleNode,
@@ -1063,17 +1056,17 @@ nsStyleSet::AssertNoCSSRules(nsRuleNode*
"Unexpected CSS rule");
}
}
}
#endif
// 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)
{
PROFILER_LABEL("nsStyleSet", "FileRules",
js::ProfileEntry::Category::CSS);
NS_ASSERTION(mBatching == 0, "rule processors out of date");
--- a/layout/style/nsStyleSet.h
+++ b/layout/style/nsStyleSet.h
@@ -456,24 +456,24 @@ private:
nsRuleWalker* aRuleWalker);
#ifdef DEBUG
// Just like AddImportantRules except it doesn't actually add anything; it
// just asserts that there are no important rules between aCurrLevelNode and
// 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
// is the closure to pass to aCollectorFunc. If aContent is not null,
// aData must be a RuleProcessorData*
void FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
RuleProcessorData* aData, mozilla::dom::Element* aElement,
nsRuleWalker* aRuleWalker);