Bug 795576 - Correctly add the NS_FRAME_UPDATE_LAYER_TREE when invalidating inside a popup. r=cjones
authorMatt Woodrow <mwoodrow@mozilla.com>
Sun, 30 Sep 2012 19:20:24 +1300
changeset 108764 8cc407a142e866e28d726e1fb850df7777e4f92b
parent 108763 6b1bc45be7f5723d38bb66bc43bb13f3b977460a
child 108765 b332f047a93bf9492740435cd0aad176bec2d162
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerscjones
bugs795576
milestone18.0a1
Bug 795576 - Correctly add the NS_FRAME_UPDATE_LAYER_TREE when invalidating inside a popup. r=cjones
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4765,27 +4765,34 @@ nsIFrame::GetTransformMatrix(const nsIFr
 
 static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = true)
 {
   if (aHasDisplayItem) {
     aFrame->AddStateBits(NS_FRAME_NEEDS_PAINT);
   }
   nsSVGEffects::InvalidateDirectRenderingObservers(aFrame);
   nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame);
+  bool needsSchedulePaint = false;
   while (parent && !parent->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
     if (aHasDisplayItem) {
       parent->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
     }
+    // If we're inside a popup, then we need to make sure that we
+    // call schedule paint so that the NS_FRAME_UPDATE_LAYER_TREE
+    // flag gets added to the popup display root frame.
+    if (nsLayoutUtils::IsPopup(parent)) {
+      needsSchedulePaint = true;
+    }
     nsSVGEffects::InvalidateDirectRenderingObservers(parent);
     parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
   }
   if (!aHasDisplayItem) {
     return;
   }
-  if (!parent) {
+  if (!parent || needsSchedulePaint) {
     aFrame->SchedulePaint();
   }
   if (aFrame->HasAnyStateBits(NS_FRAME_HAS_INVALID_RECT)) {
     aFrame->Properties().Delete(nsIFrame::InvalidationRect());
     aFrame->RemoveStateBits(NS_FRAME_HAS_INVALID_RECT);
   }
 }