1 /**
  2  * The Render Engine
  3  * DocumentContext
  4  *
  5  * @fileoverview A render context which wraps the DOM document node.
  6  *
  7  * @author: Brett Fattori (brettf@renderengine.com)
  8  * @author: $Author: bfattori $
  9  * @version: $Revision: 1555 $
 10  *
 11  * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com)
 12  *
 13  * Permission is hereby granted, free of charge, to any person obtaining a copy
 14  * of this software and associated documentation files (the "Software"), to deal
 15  * in the Software without restriction, including without limitation the rights
 16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 17  * copies of the Software, and to permit persons to whom the Software is
 18  * furnished to do so, subject to the following conditions:
 19  *
 20  * The above copyright notice and this permission notice shall be included in
 21  * all copies or substantial portions of the Software.
 22  *
 23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 29  * THE SOFTWARE.
 30  *
 31  */
 32 
 33 // The class this file defines and its required classes
 34 R.Engine.define({
 35     "class":"R.rendercontexts.DocumentContext",
 36     "requires":[
 37         "R.rendercontexts.HTMLElementContext"
 38     ]
 39 });
 40 
 41 /**
 42  * @class A reference to the <tt>document.body</tt> element as a rendering context.
 43  * Aside from being The Render Engine's default rendering context, the context
 44  * is essentially a wrapper for the HTML document.  Wrapping, in this way, allows
 45  * us to update not only this context, but all other contexts during an engine frame.
 46  *
 47  * @extends R.rendercontexts.HTMLElementContext
 48  * @constructor
 49  * @description Create an instance of a document rendering context.  This context
 50  * represents the HTML document body.  Theoretically, only one of these
 51  * contexts should ever be created.
 52  */
 53 R.rendercontexts.DocumentContext = function () {
 54     return R.rendercontexts.HTMLElementContext.extend(/** @scope R.rendercontexts.DocumentContext.prototype */{
 55 
 56         /** @private */
 57         constructor:function () {
 58             this.base("DocumentContext", document.body);
 59 
 60             // Special case
 61             this.setObjectDataModel("DOMPosition", R.math.Point2D.ZERO);
 62         },
 63 
 64         /**
 65          * Reset the context, clearing it and preparing it for drawing.
 66          */
 67         reset:function (rect) {
 68         }
 69 
 70     }, { /** @scope R.rendercontexts.DocumentContext.prototype */
 71         /**
 72          * Get the class name of this object
 73          *
 74          * @return {String} "R.rendercontexts.DocumentContext"
 75          */
 76         getClassName:function () {
 77             return "R.rendercontexts.DocumentContext";
 78         },
 79 
 80         // The engine looks for this field to know when to startup
 81         started:true
 82 
 83     });
 84 };