Bug 620512. Part 1: Only fire MozPaintWait and change window visibility in BuildDisplayList if we're painting. r=bsmedberg, a=b:b9
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 21 Dec 2010 12:12:00 -0800
changeset 59757 a05e91710adb88a0247db7c1a009062c6ded659e
parent 59756 bbb7cd978802863fba71108ed4773db0261f24eb
child 59758 61c91f2a9d8801a3082ab8ff8ea8535e54f8263c
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbsmedberg, b
bugs620512
milestone2.0b9pre
Bug 620512. Part 1: Only fire MozPaintWait and change window visibility in BuildDisplayList if we're painting. r=bsmedberg, a=b:b9
layout/base/nsDisplayList.h
layout/generic/nsObjectFrame.cpp
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -146,21 +146,25 @@ public:
   ~nsDisplayListBuilder();
 
   /**
    * @return PR_TRUE if the display is being built in order to determine which
    * frame is under the mouse position.
    */
   PRBool IsForEventDelivery() { return mMode == EVENT_DELIVERY; }
   /**
-   * @return PR_TRUE if the display list is being build to compute geometry
+   * @return PR_TRUE if the display list is being built to compute geometry
    * for plugins.
    */
   PRBool IsForPluginGeometry() { return mMode == PLUGIN_GEOMETRY; }
   /**
+   * @return PR_TRUE if the display list is being built for painting.
+   */
+  PRBool IsForPainting() { return mMode == PAINTING; }
+  /**
    * @return PR_TRUE if "painting is suppressed" during page load and we
    * should paint only the background of the document.
    */
   PRBool IsBackgroundOnly() {
     NS_ASSERTION(mPresShellStates.Length() > 0,
                  "don't call this if we're not in a presshell");
     return CurrentPresShellState()->mIsBackgroundOnly;
   }
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -1464,17 +1464,17 @@ nsObjectFrame::BuildDisplayList(nsDispla
   if (mWidget && aBuilder->IsInTransform()) {
     // Windowed plugins should not be rendered inside a transform.
     return NS_OK;
   }
 #endif
 
   nsDisplayList replacedContent;
 
-  if (mInstanceOwner && mInstanceOwner->UseLayers()) {
+  if (aBuilder->IsForPainting() && mInstanceOwner && mInstanceOwner->UseLayers()) {
     NPWindow* window = nsnull;
     mInstanceOwner->GetWindow(window);
     PRBool isVisible = window && window->width > 0 && window->height > 0;
     if (isVisible) {
   #ifndef XP_MACOSX
       mInstanceOwner->UpdateWindowVisibility(PR_TRUE);
   #endif
     }