Bug 735857 - Factor out a helper function nsLayoutUtils::IsTransformed(). r=mstange draft
authorBotond Ballo <botond@mozilla.com>
Mon, 25 Apr 2016 14:21:24 -0400
changeset 356123 a84cda133f64388c496e035f018d27fb197001ee
parent 355442 1a3779ab7154282388c2e57251886863e818b168
child 356124 cbaaa81f2ca8e809303e91c113ed8de419239c97
child 356162 0cfd2c2a7926210775b6a1beff69ba32f2a10d6c
push id16444
push userbballo@mozilla.com
push dateMon, 25 Apr 2016 18:29:46 +0000
reviewersmstange
bugs735857
milestone48.0a1
Bug 735857 - Factor out a helper function nsLayoutUtils::IsTransformed(). r=mstange MozReview-Commit-ID: 4AJUVDLAYrc
layout/base/nsCSSRendering.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3073,27 +3073,16 @@ nsCSSRendering::PaintBackgroundWithSC(ns
         }
       }
     }
   }
 
   return result;
 }
 
-static inline bool
-IsTransformed(nsIFrame* aForFrame, nsIFrame* aTopFrame)
-{
-  for (nsIFrame* f = aForFrame; f != aTopFrame; f = f->GetParent()) {
-    if (f->IsTransformed()) {
-      return true;
-    }
-  }
-  return false;
-}
-
 nsRect
 nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
                                                  nsIFrame* aForFrame,
                                                  const nsRect& aBorderArea,
                                                  const nsStyleImageLayers::Layer& aLayer,
                                                  nsIFrame** aAttachedToFrame)
 {
   // Compute background origin area relative to aBorderArea now as we may need
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -9132,8 +9132,20 @@ nsLayoutUtils::UpdateDisplayPortMarginsF
           }
 
           UpdateDisplayPortMarginsForPendingMetrics(frame);
         }
         return true;
       });
   }
 }
+
+/* static */ bool
+nsLayoutUtils::IsTransformed(nsIFrame* aForFrame, nsIFrame* aTopFrame)
+{
+  for (nsIFrame* f = aForFrame; f != aTopFrame; f = f->GetParent()) {
+    if (f->IsTransformed()) {
+      return true;
+    }
+  }
+  return false;
+}
+
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2801,16 +2801,23 @@ public:
   static CSSRect GetBoundingContentRect(const nsIContent* aContent,
                                         const nsIScrollableFrame* aRootScrollFrame);
 
   /**
    * Returns the first ancestor who is a float containing block.
    */
   static nsBlockFrame* GetFloatContainingBlock(nsIFrame* aFrame);
 
+  /**
+   * Walks up the frame tree from |aForFrame| up to |aTopFrame|, or to the
+   * root of the frame tree if |aTopFrame| is nullptr, and returns true if
+   * a transformed frame is encountered.
+   */
+  static bool IsTransformed(nsIFrame* aForFrame, nsIFrame* aTopFrame = nullptr);
+
 private:
   static uint32_t sFontSizeInflationEmPerLine;
   static uint32_t sFontSizeInflationMinTwips;
   static uint32_t sFontSizeInflationLineThreshold;
   static int32_t  sFontSizeInflationMappingIntercept;
   static uint32_t sFontSizeInflationMaxRatio;
   static bool sFontSizeInflationForceEnabled;
   static bool sFontSizeInflationDisabledInMasterProcess;