Bug 972088: Make nsIFrame::Preserves3DChildren not call nsStyleDisplay::HasTransform (pure refactoring). r=mattwoodrow
authorL. David Baron <dbaron@dbaron.org>
Fri, 14 Feb 2014 21:29:12 -0800
changeset 169263 488467210d8424f5ef048afbcfed93224298a8bf
parent 169262 7cd180ea79fe5299d98f16eb6d16184dbd53451c
child 169264 6e53e28ec25615400bf6499614c8c7f1c45b9f4b
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmattwoodrow
bugs972088, 968555
milestone30.0a1
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.
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1017,17 +1017,17 @@ nsIFrame::IsSVGTransformed(gfx::Matrix *
   return false;
 }
 
 bool
 nsIFrame::Preserves3DChildren() const
 {
   const nsStyleDisplay* disp = StyleDisplay();
   if (disp->mTransformStyle != NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
-      !disp->HasTransform(this)) {
+      !IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
     return false;
   }
 
   // If we're all scroll frame, then all descendants will be clipped, so we can't preserve 3d.
   if (GetType() == nsGkAtoms::scrollFrame) {
     return false;
   }