Bug 1230701 - Make will-change:position create a containing block for absolutely-positioned elements. r=dholbert

This commit is contained in:
L. David Baron 2015-12-07 18:39:41 -05:00
parent 8367c0acf9
commit 986cfbad91
5 changed files with 21 additions and 5 deletions

View File

@ -3029,7 +3029,8 @@ CSS_PROP_DISPLAY(
Position,
CSS_PROPERTY_PARSE_VALUE |
// For position: sticky/fixed
CSS_PROPERTY_CREATES_STACKING_CONTEXT,
CSS_PROPERTY_CREATES_STACKING_CONTEXT |
CSS_PROPERTY_ABSPOS_CB,
"",
VARIANT_HK,
kPositionKTable,

View File

@ -262,6 +262,15 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
// nsStyleDisplay::IsFixedPosContainingBlock.
#define CSS_PROPERTY_FIXPOS_CB (1<<29)
// This property has values that can establish a containing block for
// absolutely positioned elements.
// This should be set for any properties that can cause an element to be
// such a containing block, as implemented in
// nsStyleDisplay::IsAbsPosContainingBlock.
// It does not need to be set for properties that also have
// CSS_PROPERTY_FIXPOS_CB set.
#define CSS_PROPERTY_ABSPOS_CB (1<<30)
/**
* Types of animatable values.
*/

View File

@ -6084,8 +6084,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
}
if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_FIXPOS_CB)) {
display->mWillChangeBitField |=
NS_STYLE_WILL_CHANGE_FIXPOS_CB;
display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_FIXPOS_CB;
}
if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_ABSPOS_CB)) {
display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_ABSPOS_CB;
}
}
}

View File

@ -244,6 +244,7 @@ enum class StyleBoxSizing : uint8_t {
#define NS_STYLE_WILL_CHANGE_SCROLL (1<<2)
#define NS_STYLE_WILL_CHANGE_OPACITY (1<<3)
#define NS_STYLE_WILL_CHANGE_FIXPOS_CB (1<<4)
#define NS_STYLE_WILL_CHANGE_ABSPOS_CB (1<<5)
// See AnimationEffectReadOnly.webidl
// and mozilla/dom/AnimationEffectReadOnlyBinding.h

View File

@ -154,8 +154,11 @@ nsStyleDisplay::IsAbsPosContainingBlock(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return ((IsAbsolutelyPositionedStyle() || IsRelativelyPositionedStyle()) &&
!aContextFrame->IsSVGText()) || IsFixedPosContainingBlock(aContextFrame);
return ((IsAbsolutelyPositionedStyle() ||
IsRelativelyPositionedStyle() ||
(mWillChangeBitField & NS_STYLE_WILL_CHANGE_ABSPOS_CB)) &&
!aContextFrame->IsSVGText()) ||
IsFixedPosContainingBlock(aContextFrame);
}
bool