Bug 1180120 - Part 1: Record on style contexts that reset style is explicitly inherited. r=dbaron

This commit is contained in:
Cameron McCormack 2015-08-29 06:13:47 +10:00
parent b9c4097e25
commit 188f43bf45
4 changed files with 18 additions and 1 deletions

View File

@ -2754,6 +2754,14 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
/* We can't be cached in the rule node. We have to be put right */ \
/* on the style context. */ \
aContext->SetStyle(eStyleStruct_##type_, data_); \
if (aContext->GetParent()) { \
/* This is pessimistic; we could be uncacheable because we had a */ \
/* relative font-weight, for example, which does not need to defeat */ \
/* the restyle optimizations in RestyleManager.cpp that look at */ \
/* NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE. */ \
aContext->GetParent()-> \
AddStyleBit(NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE); \
} \
} \
\
return data_;

View File

@ -316,6 +316,10 @@ nsStyleContext::MoveTo(nsStyleContext* aNewParent)
nsStyleContext* oldParent = mParent;
if (oldParent->HasChildThatUsesResetStyle()) {
aNewParent->AddStyleBit(NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE);
}
aNewParent->AddRef();
mParent->RemoveChild(this);

View File

@ -173,6 +173,9 @@ public:
bool HasPseudoElementData() const
{ return !!(mBits & NS_STYLE_HAS_PSEUDO_ELEMENT_DATA); }
bool HasChildThatUsesResetStyle() const
{ return mBits & NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE; }
// Is the only link whose visitedness is allowed to influence the
// style of the node this style context is for (which is that element
// or its nearest ancestor that is a link) visited?

View File

@ -63,8 +63,10 @@ class imgIContainer;
#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE 0x100000000
// See nsStyleContext::FindChildWithRules
#define NS_STYLE_INELIGIBLE_FOR_SHARING 0x200000000
// See nsStyleContext::HasChildThatUsesResetStyle
#define NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE 0x400000000
// See nsStyleContext::GetPseudoEnum
#define NS_STYLE_CONTEXT_TYPE_SHIFT 34
#define NS_STYLE_CONTEXT_TYPE_SHIFT 35
// Additional bits for nsRuleNode's mDependentBits:
#define NS_RULE_NODE_IS_ANIMATION_RULE 0x01000000