Bug 1104809 - Log accumulation of event regions into a PaintedLayer. r=mstange,tn
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 25 Nov 2014 17:05:39 -0500
changeset 217497 d0c4d779391b6c1cde292f57e201993b4920fcb0
parent 217496 05c138a502c2841c718b3263fcba7c80fe151049
child 217498 5a77aacfd82eb776580ad448aa334fa30d77a174
push id27883
push usercbook@mozilla.com
push dateWed, 26 Nov 2014 11:58:25 +0000
treeherdermozilla-central@7bcc6573d204 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, tn
bugs1104809
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1104809 - Log accumulation of event regions into a PaintedLayer. r=mstange,tn
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -263,16 +263,30 @@ public:
     mForceTransparentSurface(false),
     mHideAllLayersBelow(false),
     mOpaqueForAnimatedGeometryRootParent(false),
     mImage(nullptr),
     mCommonClipCount(-1),
     mNewChildLayersIndex(-1),
     mAllDrawingAbove(false)
   {}
+
+#ifdef MOZ_DUMP_PAINTING
+  /**
+   * Keep track of important decisions for debugging.
+   */
+  nsAutoCString mLog;
+
+  #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \
+          tld->mLog.AppendPrintf("\t\t\t\t"); \
+          tld->mLog.AppendPrintf(__VA_ARGS__);
+#else
+  #define FLB_LOG_PAINTED_LAYER_DECISION(...)
+#endif
+
   /**
    * Record that an item has been added to the PaintedLayer, so we
    * need to update our regions.
    * @param aVisibleRect the area of the item that's visible
    * @param aDrawRect the area of the item that would be drawn if it
    * was completely visible
    * @param aOpaqueRect if non-null, the area of the item that's opaque.
    * We pass in a separate opaque rect because the opaque rect can be
@@ -285,26 +299,26 @@ public:
                   nsDisplayItem* aItem,
                   const nsIntRegion& aClippedOpaqueRegion,
                   const nsIntRect& aVisibleRect,
                   const nsIntRect& aDrawRect,
                   const DisplayItemClip& aClip);
   const nsIFrame* GetAnimatedGeometryRoot() { return mAnimatedGeometryRoot; }
 
   /**
-   * Add aHitRegion, aMaybeHitRegion, and aDispatchToContentHitRegion to the
-   * hit regions for this PaintedLayer.
+   * Add the given hit regions to the hit regions to the hit retions for this
+   * PaintedLayer.
    */
-  void AccumulateEventRegions(const nsRegion& aHitRegion,
-                              const nsRegion& aMaybeHitRegion,
-                              const nsRegion& aDispatchToContentHitRegion)
+  void AccumulateEventRegions(nsDisplayLayerEventRegions* aEventRegions)
   {
-    mHitRegion.Or(mHitRegion, aHitRegion);
-    mMaybeHitRegion.Or(mMaybeHitRegion, aMaybeHitRegion);
-    mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aDispatchToContentHitRegion);
+    FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating event regions %p against tld=%p\n", aEventRegions, this);
+
+    mHitRegion.Or(mHitRegion, aEventRegions->HitRegion());
+    mMaybeHitRegion.Or(mMaybeHitRegion, aEventRegions->MaybeHitRegion());
+    mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aEventRegions->DispatchToContentHitRegion());
   }
 
   /**
    * If this represents only a nsDisplayImage, and the image type
    * supports being optimized to an ImageLayer (TYPE_RASTER only) returns
    * an ImageContainer for the image.
    */
   already_AddRefed<ImageContainer> CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder);
@@ -369,30 +383,16 @@ public:
     return true;
   }
 
   bool IsSubjectToAsyncTransforms()
   {
     return mFixedPosFrameForLayerData != nullptr;
   }
 
-#ifdef MOZ_DUMP_PAINTING
-
-  /**
-   * Keep track of important decisions for debugging.
-   */
-  nsAutoCString mLog;
-
-  #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \
-          tld->mLog.AppendPrintf("\t\t\t\t"); \
-          tld->mLog.AppendPrintf(__VA_ARGS__);
-#else
-  #define FLB_LOG_PAINTED_LAYER_DECISION(...)
-#endif
-
   /**
    * The region of visible content in the layer, relative to the
    * container layer (which is at the snapped top-left of the display
    * list reference frame).
    */
   nsIntRegion  mVisibleRegion;
   /**
    * The region containing the bounds of all display items in the layer,
@@ -3050,19 +3050,17 @@ ContainerState::ProcessDisplayItems(nsDi
     } else {
       PaintedLayerData* paintedLayerData =
         FindPaintedLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
                            shouldFixToViewport);
 
       if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
         nsDisplayLayerEventRegions* eventRegions =
             static_cast<nsDisplayLayerEventRegions*>(item);
-        paintedLayerData->AccumulateEventRegions(eventRegions->HitRegion(),
-                                                eventRegions->MaybeHitRegion(),
-                                                eventRegions->DispatchToContentHitRegion());
+        paintedLayerData->AccumulateEventRegions(eventRegions);
       } else {
         // check to see if the new item has rounded rect clips in common with
         // other items in the layer
         paintedLayerData->UpdateCommonClipCount(itemClip);
 
         InvalidateForLayerChange(item, paintedLayerData->mLayer);
 
         mLayerBuilder->AddPaintedDisplayItem(paintedLayerData, item, itemClip, itemVisibleRect,