Commit d86762b6 authored by roc+%cs.cmu.edu's avatar roc+%cs.cmu.edu
Browse files

Bug 328541. Flush content and layout changes before drawWindow'ing a document. r+sr=bzbarsky

parent 8a0dfe45
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@

#include "nsContentUtils.h"

#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsPresContext.h"
@@ -1871,6 +1873,16 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt3
        return NS_ERROR_DOM_SECURITY_ERR;
    }
    
    // Flush layout updates
    nsCOMPtr<nsIDOMDocument> domDoc;
    aWindow->GetDocument(getter_AddRefs(domDoc));
    if (domDoc) {
        nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
        if (doc) {
            doc->FlushPendingNotifications(Flush_Layout);
        }
    }

    nsCOMPtr<nsPresContext> presContext;
    nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
    if (win) {