diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 0887c54dc85..55fcd468791 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -3347,7 +3347,8 @@ FlushLayoutForTree(nsIDOMWindow* aWindow) NS_IMETHODIMP nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH, - const nsAString& aBGColor) + const nsAString& aBGColor, + PRUint32 flags) { NS_ENSURE_ARG(aWindow != nsnull); @@ -3367,9 +3368,10 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt3 // XXX ERRMSG we need to report an error to developers here! (bug 329026) return NS_ERROR_DOM_SECURITY_ERR; } - + // Flush layout updates - FlushLayoutForTree(aWindow); + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH) + FlushLayoutForTree(aWindow); nsCOMPtr presContext; nsCOMPtr win = do_QueryInterface(aWindow); diff --git a/dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl b/dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl index 06982872a15..65f6bd26ea5 100644 --- a/dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl +++ b/dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl @@ -60,7 +60,7 @@ interface nsIDOMTextMetrics : nsISupports readonly attribute float width; }; -[scriptable, uuid(ac35c6a9-bea7-4e5f-85f6-ed43a13c6a2b)] +[scriptable, uuid(66e6d87c-759c-43a7-b3d3-3348180b35df)] interface nsIDOMCanvasRenderingContext2D : nsISupports { // back-reference to the canvas element for which @@ -161,6 +161,12 @@ interface nsIDOMCanvasRenderingContext2D : nsISupports // ImageData createImageData(in float w, in float h); void createImageData(); + // Show the caret if appropriate when drawing + const unsigned long DRAWWINDOW_DRAW_CARET = 0x01; + // Don't flush pending layout notifications that could otherwise + // be batched up + const unsigned long DRAWWINDOW_DO_NOT_FLUSH = 0x02; + /** * Renders a region of a window into the canvas. The contents of * the window's viewport are rendered, ignoring viewport clipping @@ -177,6 +183,9 @@ interface nsIDOMCanvasRenderingContext2D : nsISupports * transparent/translucent. It is given as a CSS color string * (e.g., rgb() or rgba()). * + * @param flags Uused to better control the drawWindow call. + * Flags can be ORed together. + * * Of course, the rendering obeys the current scale, transform and * globalAlpha values. * @@ -194,5 +203,6 @@ interface nsIDOMCanvasRenderingContext2D : nsISupports * only. */ void drawWindow(in nsIDOMWindow window, in long x, in long y, - in long w, in long h, in DOMString bgColor); + in long w, in long h, in DOMString bgColor, + [optional] in unsigned long flags); };