Bug 972088: Make nsIFrame::Preserves3DChildren not call nsStyleDisplay::HasTransform (pure refactoring). r=mattwoodrow

The purpose of this change is to make the code less confusing (since it's not clear to me why one would check HasTransform here), and in general to reduce the number of callers of HasTransform, since HasTransform is a complicated check that checks too many things and probably isn't the right thing for many of its callers (see, e.g., bug 968555).

This is pure refactoring because:
 (1) We're calling HasTransform only if mTransformStyle is
     NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D.
 (2) HasTransform can return false for either of two reasons:
     (a) because HasTransformStyle is false, which cannot be the case
         here because HasTransformStyle checks mTransformStyle, and we
         already know that check passes because of (1)
     (b) because IsFrameOfType(nsIFrame::eSupportsCSSTransforms) is
         false.
This means that we can replace the HasTransform check with solely the
IsFrameOfType check.
This commit is contained in:
L. David Baron 2014-02-14 21:29:12 -08:00
parent 2fe5b8ce55
commit c98f68542e

View File

@ -1022,7 +1022,7 @@ nsIFrame::Preserves3DChildren() const
{
const nsStyleDisplay* disp = StyleDisplay();
if (disp->mTransformStyle != NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
!disp->HasTransform(this)) {
!IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
return false;
}