Changeset 142452 in webkit
- Timestamp:
- Feb 11, 2013 4:15:58 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142450 r142452 1 2013-02-11 Vladislav Kaznacheev <kaznacheev@chromium.org> 2 3 Web Inspector: Allow SplitView to keep the sidebar size as a fraction of the container size 4 https://bugs.webkit.org/show_bug.cgi?id=109414 5 6 Reviewed by Vsevolod Vlasov. 7 8 SplitView now interprets defaultSidebarWidth and defaultSidebarHeight values between 0 and 1 as 9 fractions of the total container size. The sidebar then will grow or shrink along with the container. 10 When the sidebar is resized manually the updated ratio is stored in the settings. 11 12 * inspector/front-end/SplitView.js: 13 (WebInspector.SplitView): 14 (WebInspector.SplitView.prototype._removeAllLayoutProperties): 15 (WebInspector.SplitView.prototype._updateTotalSize): 16 (WebInspector.SplitView.prototype._innerSetSidebarSize): 17 (WebInspector.SplitView.prototype._saveSidebarSize): 18 1 19 2013-02-11 Pavel Feldman <pfeldman@chromium.org> 2 20 -
trunk/Source/WebCore/inspector/front-end/SplitView.js
r140333 r142452 53 53 this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth; 54 54 55 if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 && 56 0 < this._savedSidebarHeight && this._savedSidebarHeight < 1) 57 this._useFraction = true; 58 55 59 this._sidebarSizeSettingName = sidebarSizeSettingName; 56 60 … … 218 222 this._resizerElement.style.removeProperty("top"); 219 223 this._resizerElement.style.removeProperty("bottom"); 224 225 this._resizerElement.style.removeProperty("margin-left"); 226 this._resizerElement.style.removeProperty("margin-right"); 227 this._resizerElement.style.removeProperty("margin-top"); 228 this._resizerElement.style.removeProperty("margin-bottom"); 220 229 }, 221 230 … … 280 289 { 281 290 this._totalSize = this._isVertical ? this.element.offsetWidth : this.element.offsetHeight; 282 }, 283 291 if (this._useFraction) 292 this._sidebarSize = this._lastSidebarSize(); 293 }, 294 284 295 /** 285 296 * @param {number} size … … 291 302 292 303 this._removeAllLayoutProperties(); 304 305 var sizeValue; 306 if (this._useFraction) 307 sizeValue = (size / this._totalSize) * 100 + "%"; 308 else 309 sizeValue = size + "px"; 293 310 294 311 if (this._isVertical) { 295 312 var resizerWidth = this._resizerElement.offsetWidth; 296 313 if (this._secondIsSidebar) { 297 this._firstElement.style.right = size + "px"; 298 this._secondElement.style.width = size + "px"; 299 this._resizerElement.style.right = size - resizerWidth / 2 + "px"; 314 this._firstElement.style.right = sizeValue; 315 this._secondElement.style.width = sizeValue; 316 this._resizerElement.style.right = sizeValue; 317 this._resizerElement.style.marginRight = -resizerWidth / 2 + "px"; 300 318 } else { 301 this._firstElement.style.width = size + "px"; 302 this._secondElement.style.left = size + "px"; 303 this._resizerElement.style.left = size - resizerWidth / 2 + "px"; 319 this._firstElement.style.width = sizeValue; 320 this._secondElement.style.left = sizeValue; 321 this._resizerElement.style.left = sizeValue; 322 this._resizerElement.style.marginLeft = -resizerWidth / 2 + "px"; 304 323 } 305 324 } else { 306 325 var resizerHeight = this._resizerElement.offsetHeight; 307 326 308 327 if (this._secondIsSidebar) { 309 this._firstElement.style.bottom = size + "px"; 310 this._secondElement.style.height = size + "px"; 311 this._resizerElement.style.bottom = size - resizerHeight / 2 + "px"; 328 this._firstElement.style.bottom = sizeValue; 329 this._secondElement.style.height = sizeValue; 330 this._resizerElement.style.bottom = sizeValue; 331 this._resizerElement.style.marginBottom = -resizerHeight / 2 + "px"; 312 332 } else { 313 this._firstElement.style.height = size + "px"; 314 this._secondElement.style.top = size + "px"; 315 this._resizerElement.style.top = size - resizerHeight / 2 + "px"; 333 this._firstElement.style.height = sizeValue; 334 this._secondElement.style.top = sizeValue; 335 this._resizerElement.style.top = sizeValue; 336 this._resizerElement.style.marginTop = -resizerHeight / 2 + "px"; 316 337 } 317 338 } … … 415 436 var sizeSetting = this._sizeSetting(); 416 437 var size = sizeSetting ? sizeSetting.get() : 0; 417 return size || (this._isVertical ? this._savedSidebarWidth : this._savedSidebarHeight); 438 if (!size) 439 size = this._isVertical ? this._savedSidebarWidth : this._savedSidebarHeight; 440 if (this._useFraction) 441 size *= this._totalSize; 442 return size; 418 443 }, 419 444 … … 423 448 _saveSidebarSize: function(size) 424 449 { 450 if (this._useFraction) 451 size /= this._totalSize; 452 425 453 if (this._isVertical) 426 454 this._savedSidebarWidth = size;
Note: See TracChangeset
for help on using the changeset viewer.