Backed out changeset b456daa0503f (bug 1221842) for B2G ICS Emulator Opt R7 bustage on a CLOSED TREE
authorNigel Babu <nigelbabu@gmail.com>
Fri, 06 Nov 2015 12:50:58 +0530
changeset 293141 e8b7b5321acddf4316dacfd521400fcef9c3ce7b
parent 293140 20fd31f8df9a6ce32b51715a6367c81bcfc4cfd1
child 293142 512caeeb5565bb819a24ebda6a37b44fdf71b6c3
child 293222 2d5f09d89424c6337f17891dd86bdffdddd7c1ec
push id8824
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:18:56 +0000
treeherdermozilla-aurora@e2031358e2a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1221842
milestone45.0a1
backs outb456daa0503f373e29017cc7060d73231137d865
Backed out changeset b456daa0503f (bug 1221842) for B2G ICS Emulator Opt R7 bustage on a CLOSED TREE
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -168,21 +168,18 @@ FrameLayerBuilder::DisplayItemData::EndU
   mUsed = false;
 }
 
 void
 FrameLayerBuilder::DisplayItemData::EndUpdate(nsAutoPtr<nsDisplayItemGeometry> aGeometry)
 {
   MOZ_RELEASE_ASSERT(mLayer);
   MOZ_ASSERT(mItem);
-  MOZ_ASSERT(mGeometry || aGeometry);
-
-  if (aGeometry) {
-    mGeometry = aGeometry;
-  }
+
+  mGeometry = aGeometry;
   mClip = mItem->GetClip();
   mFrameListChanges.Clear();
 
   mItem = nullptr;
   EndUpdate();
 }
 
 void
@@ -4321,77 +4318,74 @@ FrameLayerBuilder::ComputeGeometryChange
   PaintedLayer* paintedLayer = aData->mLayer->AsPaintedLayer();
   if (!item || !paintedLayer) {
     aData->EndUpdate();
     return;
   }
 
   PaintedLayerItemsEntry* entry = mPaintedLayerItems.GetEntry(paintedLayer);
 
-  nsAutoPtr<nsDisplayItemGeometry> geometry;
+  nsAutoPtr<nsDisplayItemGeometry> geometry(item->AllocateGeometry(mDisplayListBuilder));
 
   PaintedDisplayItemLayerUserData* layerData =
     static_cast<PaintedDisplayItemLayerUserData*>(aData->mLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
   nsPoint shift = layerData->mAnimatedGeometryRootOrigin - layerData->mLastAnimatedGeometryRootOrigin;
 
   const DisplayItemClip& clip = item->GetClip();
 
-  // If the frame is marked as invalidated, and didn't specify a rect to invalidate then we want to
+  // If the frame is marked as invalidated, and didn't specify a rect to invalidate  then we want to
   // invalidate both the old and new bounds, otherwise we only want to invalidate the changed areas.
   // If we do get an invalid rect, then we want to add this on top of the change areas.
   nsRect invalid;
   nsRegion combined;
   bool notifyRenderingChanged = true;
   if (!aData->mGeometry) {
     // This item is being added for the first time, invalidate its entire area.
-    geometry = item->AllocateGeometry(mDisplayListBuilder);
+    //TODO: We call GetGeometry again in AddPaintedDisplayItem, we should reuse this.
     combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
 #ifdef MOZ_DUMP_PAINTING
     if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
       printf_stderr("Display item type %s(%p) added to layer %p!\n", item->Name(), item->Frame(), aData->mLayer.get());
     }
 #endif
   } else if (aData->mIsInvalid || (item->IsInvalid(invalid) && invalid.IsEmpty())) {
-    // Layout marked item/frame as needing repainting (without an explicit rect), invalidate the entire old and new areas.
-    geometry = item->AllocateGeometry(mDisplayListBuilder);
+    // Either layout marked item as needing repainting, invalidate the entire old and new areas.
     combined = aData->mClip.ApplyNonRoundedIntersection(aData->mGeometry->ComputeInvalidationRegion());
     combined.MoveBy(shift);
     combined.Or(combined, clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion()));
 #ifdef MOZ_DUMP_PAINTING
     if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
       printf_stderr("Display item type %s(%p) (in layer %p) belongs to an invalidated frame!\n", item->Name(), item->Frame(), aData->mLayer.get());
     }
 #endif
   } else {
     // Let the display item check for geometry changes and decide what needs to be
     // repainted.
 
     const nsTArray<nsIFrame*>& changedFrames = aData->GetFrameListChanges();
-    aData->mGeometry->MoveBy(shift);
-    item->ComputeInvalidationRegion(mDisplayListBuilder, aData->mGeometry, &combined);
-
-    // We have an optimization to cache the drawing of background-attachment: fixed canvas
+
+    // We have an optimization to cache the drawing background-attachment: fixed canvas
     // background images so we can scroll and just blit them when they are flattened into
     // the same layer as scrolling content. NotifyRenderingChanged is only used to tell
     // the canvas bg image item to purge this cache. We want to be careful not to accidentally
     // purge the cache if we are just invalidating due to scrolling (ie the background image
     // moves on the scrolling layer but it's rendering stays the same) so if
     // AddOffsetAndComputeDifference is the only thing that will invalidate we skip the
     // NotifyRenderingChanged call (ComputeInvalidationRegion for background images also calls
     // NotifyRenderingChanged if anything changes).
-    if (!combined.IsEmpty()) {
-      geometry = item->AllocateGeometry(mDisplayListBuilder);
-    } else if (aData->mClip == clip && invalid.IsEmpty() && changedFrames.Length() == 0) {
+    if (aData->mGeometry->ComputeInvalidationRegion() == geometry->ComputeInvalidationRegion() &&
+        aData->mClip == clip && invalid.IsEmpty() && changedFrames.Length() == 0) {
       notifyRenderingChanged = false;
     }
+
+    aData->mGeometry->MoveBy(shift);
+    item->ComputeInvalidationRegion(mDisplayListBuilder, aData->mGeometry, &combined);
     aData->mClip.AddOffsetAndComputeDifference(entry->mCommonClipCount,
                                                shift, aData->mGeometry->ComputeInvalidationRegion(),
-                                               clip, entry->mLastCommonClipCount,
-                                               geometry ? geometry->ComputeInvalidationRegion() :
-                                                          aData->mGeometry->ComputeInvalidationRegion(),
+                                               clip, entry->mLastCommonClipCount, geometry->ComputeInvalidationRegion(),
                                                &combined);
 
     // Add in any rect that the frame specified
     combined.Or(combined, invalid);
 
     for (uint32_t i = 0; i < changedFrames.Length(); i++) {
       combined.Or(combined, changedFrames[i]->GetVisualOverflowRect());
     }