source: [view]
if(size){
if(size.h){
dojo.style(this.domNode,'height',size.h+'px');
}
if(size.w){
dojo.style(this.domNode,'width',size.w+'px');
}
}
var dir = this._dir,
vert = this._vertical,
val = this.containerNode[(vert ? "scrollHeight" : "scrollWidth")];
dojo.style(this.wrapper, this._dir, this.domNode.style[this._dir]);
this._lo = dojo.coords(this.wrapper, true);
this._size = Math.max(0, val - this._lo[(vert ? "h" : "w")]);
if(!this._size){
this.helper.style.display="none";
//make sure we reset scroll position, otherwise the content may be hidden
this.wrapper[this._scroll]=0;
return;
}else{
this.helper.style.display="";
}
this._line = new dojo._Line(0 - this._offset, this._size + (this._offset * 2));
// share a relative position w the scroll offset via a line
var u = this._lo[(vert ? "h" : "w")],
r = Math.min(1, u / val), // ratio
s = u * r, // size
c = Math.floor(u - (u * r)); // center
this._helpLine = new dojo._Line(0, c);
// size the helper
dojo.style(this.helper, dir, Math.floor(s) + "px");