зеркало из https://github.com/mozilla/gecko-dev.git
Remove aPresContext parameter to nsStyleContext constructor and document parameters to constructor. (Bug 791416) r=bzbarsky
This commit is contained in:
Родитель
e7c289ffa5
Коммит
7204dd91a1
|
@ -33,8 +33,7 @@ using namespace mozilla;
|
|||
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
nsRuleNode* aRuleNode,
|
||||
nsPresContext* aPresContext)
|
||||
nsRuleNode* aRuleNode)
|
||||
: mParent(aParent),
|
||||
mChild(nullptr),
|
||||
mEmptyChild(nullptr),
|
||||
|
@ -66,7 +65,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
|||
#endif
|
||||
}
|
||||
|
||||
ApplyStyleFixups(aPresContext);
|
||||
ApplyStyleFixups();
|
||||
|
||||
#define eStyleStruct_LastItem (nsStyleStructID_Length - 1)
|
||||
NS_ASSERTION(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
|
||||
|
@ -298,7 +297,7 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, void* aStruct)
|
|||
}
|
||||
|
||||
void
|
||||
nsStyleContext::ApplyStyleFixups(nsPresContext* aPresContext)
|
||||
nsStyleContext::ApplyStyleFixups()
|
||||
{
|
||||
// See if we have any text decorations.
|
||||
// First see if our parent has text decorations. If our parent does, then we inherit the bit.
|
||||
|
@ -675,12 +674,11 @@ already_AddRefed<nsStyleContext>
|
|||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
nsRuleNode* aRuleNode,
|
||||
nsPresContext* aPresContext)
|
||||
nsRuleNode* aRuleNode)
|
||||
{
|
||||
nsStyleContext* context =
|
||||
new (aPresContext) nsStyleContext(aParentContext, aPseudoTag, aPseudoType,
|
||||
aRuleNode, aPresContext);
|
||||
new (aRuleNode->GetPresContext())
|
||||
nsStyleContext(aParentContext, aPseudoTag, aPseudoType, aRuleNode);
|
||||
if (context)
|
||||
context->AddRef();
|
||||
return context;
|
||||
|
|
|
@ -39,9 +39,27 @@ class nsPresContext;
|
|||
class nsStyleContext
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new style context.
|
||||
* @param aParent The parent of a style context is used for CSS
|
||||
* inheritance. When the element or pseudo-element
|
||||
* this style context represents the style data of
|
||||
* inherits a CSS property, the value comes from the
|
||||
* parent style context. This means style context
|
||||
* parentage must match the definitions of inheritance
|
||||
* in the CSS specification.
|
||||
* @param aPseudoTag The pseudo-element or anonymous box for which
|
||||
* this style context represents style. Null if
|
||||
* this style context is for a normal DOM element.
|
||||
* @param aPseudoType Must match aPseudoTag.
|
||||
* @param aRuleNode A rule node representing the ordered sequence of
|
||||
* rules that any element, pseudo-element, or
|
||||
* anonymous box that this style context is for
|
||||
* matches. See |nsRuleNode| and |nsIStyleRule|.
|
||||
*/
|
||||
nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
nsRuleNode* aRuleNode, nsPresContext* aPresContext);
|
||||
nsRuleNode* aRuleNode);
|
||||
~nsStyleContext();
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW;
|
||||
|
@ -323,7 +341,7 @@ protected:
|
|||
void AddChild(nsStyleContext* aChild);
|
||||
void RemoveChild(nsStyleContext* aChild);
|
||||
|
||||
void ApplyStyleFixups(nsPresContext* aPresContext);
|
||||
void ApplyStyleFixups();
|
||||
|
||||
void FreeAllocations(nsPresContext* aPresContext);
|
||||
|
||||
|
@ -416,6 +434,5 @@ already_AddRefed<nsStyleContext>
|
|||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
nsRuleNode* aRuleNode,
|
||||
nsPresContext* aPresContext);
|
||||
nsRuleNode* aRuleNode);
|
||||
#endif
|
||||
|
|
|
@ -574,13 +574,13 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
|
|||
|
||||
if (!result) {
|
||||
result = NS_NewStyleContext(aParentContext, aPseudoTag, aPseudoType,
|
||||
aRuleNode, PresContext());
|
||||
aRuleNode);
|
||||
if (!result)
|
||||
return nullptr;
|
||||
if (aVisitedRuleNode) {
|
||||
nsRefPtr<nsStyleContext> resultIfVisited =
|
||||
NS_NewStyleContext(parentIfVisited, aPseudoTag, aPseudoType,
|
||||
aVisitedRuleNode, PresContext());
|
||||
aVisitedRuleNode);
|
||||
if (!resultIfVisited) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче