B2G/gecko/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
/**
   * Actually draw the browser content into the dirty region of this
   * tile.  This requires us to actually draw with the
   * nsIDOMCanvasRenderingContext2D object's drawWindow method, which
   * we expect to be a relatively heavy operation.
   *
   * You likely want to check if the tile isDirty() before asking it
   * to render, as this will cause the entire tile to re-render in the
   * case that it is not dirty.
   */
Actually draw the browser content into the dirty region of this
tile.  This requires us to actually draw with the
nsIDOMCanvasRenderingContext2D object's drawWindow method, which
we expect to be a relatively heavy operation.

You likely want to check if the tile isDirty() before asking it
to render, as this will cause the entire tile to re-render in the
case that it is not dirty.
Actually draw the browser content into the dirty region of this tile . This requires us to actually draw with the nsIDOMCanvasRenderingContext2D object ' s drawWindow method which we expect to be a relatively heavy operation . You likely want to check if the tile isDirty () before asking it to render as this will cause the entire tile to re - render in the case that it is not dirty .
function render(browser, browserView) {
    if (!this.isDirty())
      this.markDirty();
    let rect = this._dirtyTileCanvasRect;
    let x = rect.left - this.boundRect.left;
    let y = rect.top - this.boundRect.top;
    let ctx = this._canvas.getContext("2d");
    ctx.save();
    browserView.browserToViewportCanvasContext(ctx);
    ctx.translate(x, y);
    let cw = browserView._contentWindow;
    ctx.asyncDrawXULElement(browserView._browser,
                   rect.left, rect.top,
                   rect.right - rect.left, rect.bottom - rect.top,
                   "grey",
                   (ctx.DRAWWINDOW_DO_NOT_FLUSH | ctx.DRAWWINDOW_DRAW_CARET));
    ctx.restore();
    this.unmarkDirty();
  }
function render ( browser , browserView ) { if ( ! this . isDirty ( ) ) this . markDirty ( ) ; let rect = this . _dirtyTileCanvasRect ; let x = rect . left - this . boundRect . left ; let y = rect . top - this . boundRect . top ; let ctx = this . _canvas . getContext ( "2d" ) ; ctx . save ( ) ; browserView . browserToViewportCanvasContext ( ctx ) ; ctx . translate ( x , y ) ; let cw = browserView . _contentWindow ; ctx . asyncDrawXULElement ( browserView . _browser , rect . left , rect . top , rect . right - rect . left , rect . bottom - rect . top , "grey" , ( ctx . DRAWWINDOW_DO_NOT_FLUSH | ctx . DRAWWINDOW_DRAW_CARET ) ) ; ctx . restore ( ) ; this . unmarkDirty ( ) ; }
Actually draw the browser content into the dirty region of this
 tile.
Actually draw the browser content into the dirty region of this tile .
// content process is not being scaled, so don't scale our rect either //browserView.viewportToBrowserRect(rect); //rect.round(); // snap outward to get whole "pixel" (in browser coords) //let cw = browser.contentWindow;