code: function(rect, from, to) {
  			if (!this._clientDiv) { return rect; }
  			var _scroll = this._getScroll();
  			var viewPad = this._getViewPadding();
  			var viewRect = this._viewDiv.getBoundingClientRect();
  			if (from === "document") { //$NON-NLS-1$
  				if (rect.x !== undefined) {
  					rect.x += - _scroll.x + viewRect.left + viewPad.left;
  				}
  				if (rect.y !== undefined) {
  					rect.y += - _scroll.y + viewRect.top + viewPad.top;
  				}
  			}
  			//At this point rect is in the widget coordinate space
  			if (to === "document") { //$NON-NLS-1$
  				if (rect.x !== undefined) {
  					rect.x += _scroll.x - viewRect.left - viewPad.left;
  				}
  				if (rect.y !== undefined) {
  					rect.y += _scroll.y - viewRect.top - viewPad.top;
  				}
  			}
  			return rect;
  		}
docs: Converts the given rectangle from one coordinate spaces to another.
  <p>The supported coordinate spaces are:
  <ul>
  <li>"document" - relative to document, the origin is the top-left corner of first line</li>
  <li>"page" - relative to html page that contains the text view</li>
  </ul>
  </p>
  <p>All methods in the view that take or return a position are in the document coordinate space.</p>
  
  @param rect the rectangle to convert.
  @param rect.x the x of the rectangle.
  @param rect.y the y of the rectangle.
  @param rect.width the width of the rectangle.
  @param rect.height the height of the rectangle.
  @param {String} from the source coordinate space.
  @param {String} to the destination coordinate space.
  
  @see orion.editor.TextView#getLocationAtOffset
  @see orion.editor.TextView#getOffsetAtLocation
  @see orion.editor.TextView#getTopPixel
  @see orion.editor.TextView#setTopPixel