Changeset 195995 in webkit
- Timestamp:
- Feb 1, 2016 5:27:25 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r195967 r195995 1 2016-02-01 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: add a LayoutReason enum to the View base class 4 https://bugs.webkit.org/show_bug.cgi?id=153731 5 <rdar://problem/24430938> 6 7 Reviewed by Brian Burg. 8 9 Added a LayoutReason enum to the View base class, which can be passed as an optional 10 argument to needsLayout() and updateLayout(). The value is propagated to the view's 11 subtree during layout. 12 13 * UserInterface/Base/Main.js: 14 Update top-level views with Resize layout reason when window is resized. 15 16 * UserInterface/Views/DataGrid.js: 17 (WebInspector.DataGrid.prototype._positionHeaderViews): 18 Update header view with Resize layout reason when column is resized. 19 20 * UserInterface/Views/OverviewTimelineView.js: 21 (WebInspector.OverviewTimelineView.prototype.shown): 22 Assume the view has been resized when shown, and update layout. 23 (WebInspector.OverviewTimelineView.prototype.updateLayoutForResize): Deleted. 24 No longer needed, handled by the View base class. 25 26 * UserInterface/Views/TimelineOverview.js: 27 (WebInspector.TimelineOverview.prototype.shown): 28 Assume the view has been resized when shown, and update layout. 29 (WebInspector.TimelineOverview.prototype.layout): 30 Invalidate cached scroll container width if resized. 31 (WebInspector.TimelineOverview.prototype.updateLayoutForResize): Deleted. 32 No longer needed, handled by the View base class. 33 34 * UserInterface/Views/TimelineRecordingContentView.js: 35 (WebInspector.TimelineRecordingContentView.prototype.layout): Deleted. 36 No longer needed, handled by the View base class. 37 38 * UserInterface/Views/TimelineRuler.js: 39 (WebInspector.TimelineRuler.prototype.needsLayout): 40 (WebInspector.TimelineRuler.prototype.layout): 41 Update cached client width if resized. 42 (WebInspector.TimelineRuler.prototype.resize): Deleted. 43 Moved resize logic to layout override. 44 45 * UserInterface/Views/View.js: 46 (WebInspector.View): 47 (WebInspector.View.prototype.updateLayout): 48 Set layout reason. 49 (WebInspector.View.prototype.needsLayout): 50 Set layout reason even if an animation frame has already been scheduled, 51 since the layout reason could have changed. 52 (WebInspector.View.prototype._layoutSubtree): 53 Propagate layout reason to subtree, and reset the value when done. 54 (WebInspector.View.prototype._setLayoutReason): 55 Helper method for updating the layout reason. Ensures that LayoutReason.Resize 56 has priority over the default (LayoutReason.Dirty). 57 1 58 2016-02-01 Matt Baker <mattbaker@apple.com> 2 59 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r195835 r195995 1342 1342 WebInspector._windowResized = function(event) 1343 1343 { 1344 this.toolbar.updateLayout( );1345 this.tabBar.updateLayout( );1344 this.toolbar.updateLayout(WebInspector.View.LayoutReason.Resize); 1345 this.tabBar.updateLayout(WebInspector.View.LayoutReason.Resize); 1346 1346 this._tabBrowserSizeDidChange(); 1347 1347 }; … … 1455 1455 WebInspector._tabBrowserSizeDidChange = function() 1456 1456 { 1457 this.tabBrowser.updateLayout( );1458 this.splitContentBrowser.updateLayout( );1459 this.quickConsole.updateLayout( );1457 this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize); 1458 this.splitContentBrowser.updateLayout(WebInspector.View.LayoutReason.Resize); 1459 this.quickConsole.updateLayout(WebInspector.View.LayoutReason.Resize); 1460 1460 }; 1461 1461 1462 1462 WebInspector._quickConsoleDidResize = function(event) 1463 1463 { 1464 this.tabBrowser.updateLayout( );1464 this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize); 1465 1465 }; 1466 1466 -
trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
r195966 r195995 743 743 headerView.element.style.left = left + "px"; 744 744 headerView.element.style.width = columnWidth + "px"; 745 headerView.updateLayout( );745 headerView.updateLayout(WebInspector.View.LayoutReason.Resize); 746 746 } 747 747 -
trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
r195504 r195995 82 82 83 83 this._treeOutlineDataGridSynchronizer.synchronize(); 84 this._timelineRuler. resize();84 this._timelineRuler.updateLayout(WebInspector.View.LayoutReason.Resize); 85 85 } 86 86 … … 159 159 160 160 WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation); 161 }162 163 updateLayoutForResize()164 {165 this._timelineRuler.resize();166 161 } 167 162 -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js
r195881 r195995 266 266 this._visible = true; 267 267 268 this._timelineRuler.resize()269 270 268 for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) 271 269 timelineOverviewGraph.shown(); 272 270 273 this.updateLayout( );271 this.updateLayout(WebInspector.View.LayoutReason.Resize); 274 272 } 275 273 … … 321 319 } 322 320 323 updateLayoutForResize()324 {325 this._cachedScrollContainerWidth = NaN;326 this._timelineRuler.resize()327 this.updateLayout();328 }329 330 321 updateLayoutIfNeeded() 331 322 { … … 354 345 } 355 346 356 layout() 357 { 347 layout(layoutReason) 348 { 349 if (layoutReason === WebInspector.View.LayoutReason.Resize) 350 this._cachedScrollContainerWidth = NaN; 351 358 352 // Calculate the required width based on the duration and seconds per pixel. 359 353 let duration = this._endTime - this._startTime; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
r195967 r195995 325 325 } 326 326 327 // Protected328 329 layout()330 {331 this._currentTimelineOverview.updateLayoutForResize();332 333 let currentContentView = this._contentViewContainer.currentContentView;334 if (currentContentView && currentContentView.updateLayoutForResize)335 currentContentView.updateLayoutForResize();336 }337 338 327 // Private 339 328 -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
r195504 r195995 359 359 } 360 360 361 needsLayout( )361 needsLayout(layoutReason) 362 362 { 363 363 if (this.layoutPending) … … 374 374 } 375 375 376 super.needsLayout( );376 super.needsLayout(layoutReason); 377 377 } 378 378 379 379 // Protected 380 380 381 layout() 382 { 381 layout(layoutReason) 382 { 383 if (layoutReason === WebInspector.View.LayoutReason.Resize) 384 this._cachedClientWidth = this.element.clientWidth; 385 383 386 let visibleWidth = this._recalculate(); 384 387 if (visibleWidth <= 0) … … 536 539 this._updateSelection(visibleWidth, this.duration); 537 540 }); 538 }539 540 resize()541 {542 this._cachedClientWidth = this.element.clientWidth;543 this._recalculate();544 541 } 545 542 -
trunk/Source/WebInspectorUI/UserInterface/Views/View.js
r193872 r195995 38 38 this._needsLayoutWhenAttachedToRoot = false; 39 39 this._isAttachedToRoot = false; 40 this._layoutReason = null; 40 41 } 41 42 … … 138 139 } 139 140 140 updateLayout( )141 updateLayout(layoutReason) 141 142 { 142 143 WebInspector.View._cancelScheduledLayoutForView(this); 144 145 this._setLayoutReason(layoutReason); 143 146 this._layoutSubtree(); 144 147 } … … 152 155 } 153 156 154 needsLayout() 155 { 157 needsLayout(layoutReason) 158 { 159 this._setLayoutReason(layoutReason); 160 156 161 if (this._dirty) 157 162 return; … … 210 215 this._dirtyDescendantsCount = 0; 211 216 212 this.layout(); 213 214 for (let view of this._subviews) 217 this.layout(this._layoutReason); 218 219 for (let view of this._subviews) { 220 view._setLayoutReason(this._layoutReason); 215 221 view._layoutSubtree(); 222 } 223 224 this._layoutReason = null; 225 } 226 227 _setLayoutReason(layoutReason) 228 { 229 if (this._layoutReason === WebInspector.View.LayoutReason.Resize) 230 return; 231 232 this._layoutReason = layoutReason || WebInspector.View.LayoutReason.Dirty; 216 233 } 217 234 … … 284 301 }; 285 302 303 WebInspector.View.LayoutReason = { 304 Dirty: Symbol("layout-reason-dirty"), 305 Resize: Symbol("layout-reason-resize") 306 }; 307 286 308 WebInspector.View._rootView = null; 287 309 WebInspector.View._scheduledLayoutUpdateIdentifier = undefined;
Note: See TracChangeset
for help on using the changeset viewer.