зеркало из https://github.com/mozilla/gecko-dev.git
Bug 816359. Part 2: Make nsStyleDisplay::HasTransform take a frame parameter and check that the frame supports transforms. r=mats"
This commit is contained in:
Родитель
7df631d1f7
Коммит
90b99242be
|
@ -925,7 +925,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
|
|||
mAdditionalStateBits(0),
|
||||
mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
|
||||
aAbsoluteContainingBlock->GetStyleDisplay()->
|
||||
HasTransform()),
|
||||
HasTransform(aAbsoluteContainingBlock)),
|
||||
mHavePendingPopupgroup(false),
|
||||
mCreatingExtraFrames(false),
|
||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
|
@ -958,7 +958,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
|||
mAdditionalStateBits(0),
|
||||
mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
|
||||
aAbsoluteContainingBlock->GetStyleDisplay()->
|
||||
HasTransform()),
|
||||
HasTransform(aAbsoluteContainingBlock)),
|
||||
mHavePendingPopupgroup(false),
|
||||
mCreatingExtraFrames(false),
|
||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
|
@ -1038,8 +1038,8 @@ nsFrameConstructorState::PushAbsoluteContainingBlock(nsIFrame* aNewAbsoluteConta
|
|||
/* See if we're wiring the fixed-pos and abs-pos lists together. This happens iff
|
||||
* we're a transformed element.
|
||||
*/
|
||||
mFixedPosIsAbsPos = (aNewAbsoluteContainingBlock &&
|
||||
aNewAbsoluteContainingBlock->GetStyleDisplay()->HasTransform());
|
||||
mFixedPosIsAbsPos = aNewAbsoluteContainingBlock &&
|
||||
aNewAbsoluteContainingBlock->GetStyleDisplay()->HasTransform(aNewAbsoluteContainingBlock);
|
||||
|
||||
if (aNewAbsoluteContainingBlock) {
|
||||
aNewAbsoluteContainingBlock->MarkAsAbsoluteContainingBlock();
|
||||
|
@ -7774,7 +7774,8 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
|||
needInvalidatingPaint = true;
|
||||
aFrame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer);
|
||||
}
|
||||
if (aChange & nsChangeHint_UpdateTransformLayer) {
|
||||
if ((aChange & nsChangeHint_UpdateTransformLayer) &&
|
||||
aFrame->IsTransformed()) {
|
||||
aFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
|
||||
// If we're not already going to do an invalidating paint, see
|
||||
// if we can get away with only updating the transform on a
|
||||
|
@ -7808,7 +7809,7 @@ ApplyRenderingChangeToTree(nsPresContext* aPresContext,
|
|||
// CSS transforms.
|
||||
NS_ASSERTION(!(aChange & nsChangeHint_UpdateTransformLayer) ||
|
||||
aFrame->IsTransformed() ||
|
||||
aFrame->GetStyleDisplay()->HasTransform(),
|
||||
aFrame->GetStyleDisplay()->HasTransformStyle(),
|
||||
"Unexpected UpdateTransformLayer hint");
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
|
|
|
@ -518,7 +518,7 @@ nsFrame::Init(nsIContent* aContent,
|
|||
NS_FRAME_IN_POPUP);
|
||||
}
|
||||
const nsStyleDisplay *disp = GetStyleDisplay();
|
||||
if (disp->HasTransform()) {
|
||||
if (disp->HasTransform(this)) {
|
||||
// The frame gets reconstructed if we toggle the -moz-transform
|
||||
// property, so we can set this bit here and then ignore it.
|
||||
mState |= NS_FRAME_MAY_BE_TRANSFORMED;
|
||||
|
@ -985,7 +985,7 @@ bool
|
|||
nsIFrame::IsTransformed() const
|
||||
{
|
||||
return ((mState & NS_FRAME_MAY_BE_TRANSFORMED) &&
|
||||
((GetStyleDisplay()->HasTransform() && IsFrameOfType(eSupportsCSSTransforms)) ||
|
||||
(GetStyleDisplay()->HasTransform(this) ||
|
||||
IsSVGTransformed() ||
|
||||
(mContent &&
|
||||
nsLayoutUtils::HasAnimationsForCompositor(mContent,
|
||||
|
@ -1014,7 +1014,7 @@ bool
|
|||
nsIFrame::Preserves3DChildren() const
|
||||
{
|
||||
if (GetStyleDisplay()->mTransformStyle != NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
!GetStyleDisplay()->HasTransform())
|
||||
!GetStyleDisplay()->HasTransform(this))
|
||||
return false;
|
||||
|
||||
// If we're all scroll frame, then all descendants will be clipped, so we can't preserve 3d.
|
||||
|
@ -1031,7 +1031,7 @@ bool
|
|||
nsIFrame::Preserves3D() const
|
||||
{
|
||||
if (!GetParent() || !GetParent()->Preserves3DChildren() ||
|
||||
!GetStyleDisplay()->HasTransform()) {
|
||||
!GetStyleDisplay()->HasTransform(this)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -2224,7 +2224,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
/* If we've added or removed the transform property, we need to reconstruct the frame to add
|
||||
* or remove the view object, and also to handle abs-pos and fixed-pos containers.
|
||||
*/
|
||||
if (HasTransform() != aOther.HasTransform()) {
|
||||
if (HasTransformStyle() != aOther.HasTransformStyle()) {
|
||||
// We do not need to apply nsChangeHint_UpdateTransformLayer since
|
||||
// nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
|
||||
// ensure layers are rebuilt (or removed).
|
||||
|
@ -2232,7 +2232,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
|||
NS_CombineHint(nsChangeHint_UpdateOverflow,
|
||||
nsChangeHint_RepaintFrame)));
|
||||
}
|
||||
else if (HasTransform()) {
|
||||
else if (HasTransformStyle()) {
|
||||
/* Otherwise, if we've kept the property lying around and we already had a
|
||||
* transform, we need to see whether or not we've changed the transform.
|
||||
* If so, we need to recompute its overflow rect (which probably changed
|
||||
|
|
|
@ -1692,8 +1692,9 @@ struct nsStyleDisplay {
|
|||
mOverflowX != NS_STYLE_OVERFLOW_CLIP;
|
||||
}
|
||||
|
||||
/* Returns whether the element has the -moz-transform property. */
|
||||
bool HasTransform() const {
|
||||
/* Returns whether the element has the -moz-transform property
|
||||
* or a related property. */
|
||||
bool HasTransformStyle() const {
|
||||
return mSpecifiedTransform != nullptr ||
|
||||
mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN;
|
||||
|
@ -1709,6 +1710,9 @@ struct nsStyleDisplay {
|
|||
inline bool IsPositioned(const nsIFrame* aFrame) const;
|
||||
inline bool IsRelativelyPositioned(const nsIFrame* aFrame) const;
|
||||
inline bool IsAbsolutelyPositioned(const nsIFrame* aFrame) const;
|
||||
/* Returns whether the element has the -moz-transform property
|
||||
* or a related property, and supports CSS transforms. */
|
||||
inline bool HasTransform(const nsIFrame* aFrame) const;
|
||||
};
|
||||
|
||||
struct nsStyleTable {
|
||||
|
|
|
@ -124,12 +124,18 @@ nsStyleDisplay::IsFloating(const nsIFrame* aFrame) const
|
|||
return IsFloatingStyle() && !aFrame->IsSVGText();
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleDisplay::HasTransform(const nsIFrame* aFrame) const
|
||||
{
|
||||
return HasTransformStyle() && aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms);
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleDisplay::IsPositioned(const nsIFrame* aFrame) const
|
||||
{
|
||||
return (IsAbsolutelyPositionedStyle() ||
|
||||
IsRelativelyPositionedStyle() ||
|
||||
(HasTransform() && aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) &&
|
||||
HasTransform(aFrame)) &&
|
||||
!aFrame->IsSVGText();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче