Changeset 13743
- Timestamp:
- 05/15/08 15:12:56 (6 months ago)
- Location:
- dijit/trunk
- Files:
-
- 2 modified
-
layout/BorderContainer.js (modified) (6 diffs)
-
tests/layout/test_BorderContainer.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/layout/BorderContainer.js
r13547 r13743 135 135 var changedSide = /left|right/.test(changedRegion); 136 136 137 var cs = dojo.getComputedStyle(this.domNode); 138 var pe = dojo._getPadExtents(this.domNode, cs); 139 pe.r = parseFloat(cs.paddingRight); pe.b = parseFloat(cs.paddingBottom); 140 137 141 var layoutSides = !changedRegion || (!changedSide && !sidebarLayout); 138 142 var layoutTopBottom = !changedRegion || (changedSide && sidebarLayout); … … 178 182 179 183 var splitterBounds = { 180 left: (sidebarLayout ? leftWidth + leftSplitterThickness: "0")+ "px",181 right: (sidebarLayout ? rightWidth + rightSplitterThickness: "0")+ "px"184 left: (sidebarLayout ? leftWidth + leftSplitterThickness: 0) + pe.l + "px", 185 right: (sidebarLayout ? rightWidth + rightSplitterThickness: 0) + pe.r + "px" 182 186 }; 183 187 184 188 if(topSplitter){ 185 189 dojo.mixin(topSplitter.style, splitterBounds); 186 topSplitter.style.top = topHeight + "px";190 topSplitter.style.top = topHeight + pe.t + "px"; 187 191 } 188 192 189 193 if(bottomSplitter){ 190 194 dojo.mixin(bottomSplitter.style, splitterBounds); 191 bottomSplitter.style.bottom = bottomHeight + "px";195 bottomSplitter.style.bottom = bottomHeight + pe.b + "px"; 192 196 } 193 197 194 198 splitterBounds = { 195 top: (sidebarLayout ? "0" : topHeight + topSplitterThickness)+ "px",196 bottom: (sidebarLayout ? "0" : bottomHeight + bottomSplitterThickness)+ "px"199 top: (sidebarLayout ? 0 : topHeight + topSplitterThickness) + pe.t + "px", 200 bottom: (sidebarLayout ? 0 : bottomHeight + bottomSplitterThickness) + pe.b + "px" 197 201 }; 198 202 199 203 if(leftSplitter){ 200 204 dojo.mixin(leftSplitter.style, splitterBounds); 201 leftSplitter.style.left = leftWidth + "px";205 leftSplitter.style.left = leftWidth + pe.l + "px"; 202 206 } 203 207 204 208 if(rightSplitter){ 205 209 dojo.mixin(rightSplitter.style, splitterBounds); 206 rightSplitter.style.right = rightWidth + "px";210 rightSplitter.style.right = rightWidth + pe.r + "px"; 207 211 } 208 212 209 213 dojo.mixin(centerStyle, { 210 top: topHeight + topSplitterThickness + "px",211 left: leftWidth + leftSplitterThickness + "px",212 right: rightWidth + rightSplitterThickness + "px",213 bottom: bottomHeight + bottomSplitterThickness + "px"214 top: pe.t + topHeight + topSplitterThickness + "px", 215 left: pe.l + leftWidth + leftSplitterThickness + "px", 216 right: pe.r + rightWidth + rightSplitterThickness + "px", 217 bottom: pe.b + bottomHeight + bottomSplitterThickness + "px" 214 218 }); 215 219 216 220 var bounds = { 217 top: sidebarLayout ? "0" : centerStyle.top,218 bottom: sidebarLayout ? "0" : centerStyle.bottom221 top: sidebarLayout ? pe.t + "px" : centerStyle.top, 222 bottom: sidebarLayout ? pe.b + "px" : centerStyle.bottom 219 223 }; 220 224 dojo.mixin(leftStyle, bounds); 221 225 dojo.mixin(rightStyle, bounds); 222 leftStyle.left = rightStyle.right = topStyle.top = bottomStyle.bottom = "0";226 leftStyle.left = pe.l + "px"; rightStyle.right = pe.r + "px"; topStyle.top = pe.t + "px"; bottomStyle.bottom = pe.b + "px"; 223 227 if(sidebarLayout){ 224 topStyle.left = bottomStyle.left = leftWidth + (this.isLeftToRight() ? leftSplitterThickness : 0) + "px";225 topStyle.right = bottomStyle.right = rightWidth + (this.isLeftToRight() ? 0 : rightSplitterThickness) + "px";228 topStyle.left = bottomStyle.left = leftWidth + (this.isLeftToRight() ? leftSplitterThickness : 0) + pe.l + "px"; 229 topStyle.right = bottomStyle.right = rightWidth + (this.isLeftToRight() ? 0 : rightSplitterThickness) + pe.r + "px"; 226 230 }else{ 227 topStyle.left = topStyle.right = bottomStyle.left = bottomStyle.right = "0"; 231 topStyle.left = bottomStyle.left = pe.l + "px"; 232 topStyle.right = bottomStyle.right = pe.r + "px"; 228 233 } 229 234 … … 236 241 // childNode.resize({h: int, w: int}) for each child node) 237 242 238 var borderBox = function(n, b ){243 var borderBox = function(n, b, s){ 239 244 n=dojo.byId(n); 240 var s =dojo.getComputedStyle(n);245 s = s || dojo.getComputedStyle(n); 241 246 if(!b){ return dojo._getBorderBox(n, s); } 242 247 var me = dojo._getMarginExtents(n, s); … … 247 252 var resizeWidget = function(widget, dim){ 248 253 if(widget){ 249 widget.resize ? widget.resize(dim) : dojo.marginBox(widget.domNode, dim);254 (widget.resize ? widget.resize(dim) : dojo.marginBox(widget.domNode, dim)); 250 255 } 251 256 }; … … 253 258 // TODO: use dim passed in to resize() (see _LayoutWidget.js resize()) 254 259 // Then can make borderBox setBorderBox(), since no longer need to ever get the borderBox() size 255 var thisBorderBox = borderBox(this.domNode );256 257 var containerHeight = thisBorderBox.h ;260 var thisBorderBox = borderBox(this.domNode, null, cs); 261 262 var containerHeight = thisBorderBox.h - pe.t - pe.b; 258 263 var middleHeight = containerHeight; 259 264 if(this._top){ middleHeight -= topHeight; } … … 269 274 resizeWidget(this._rightWidget, {h: sidebarHeight}); 270 275 271 var containerWidth = thisBorderBox.w ;276 var containerWidth = thisBorderBox.w - pe.l - pe.r; 272 277 var middleWidth = containerWidth; 273 278 if(this._left){ middleWidth -= leftWidth; } -
dijit/trunk/tests/layout/test_BorderContainer.html
r13735 r13743 56 56 </script> 57 57 </head> 58 <body >58 <body class="tundra"> 59 59 60 60 <h2 class="testTitle">dijit.layout.BorderContainer tests</h2> … … 62 62 63 63 <div id="border1" dojoType="dijit.layout.BorderContainer" 64 style=" border: 2px solid black; width: 90%; height: 300px; padding: 10px;">64 style="padding: 5px; border: 2px solid blue; width: 90%; height: 300px; padding: 10px;"> 65 65 <div dojoType="dijit.layout.ContentPane" region="top" style="background-color: #b39b86; border: 15px black solid; height: 100px;" splitter="true"> 66 66 top bar