Changeset 272934 in webkit
- Timestamp:
- Feb 16, 2021 3:36:08 PM (17 months ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Localizations/en.lproj/localizedStrings.js (modified) (1 diff)
-
UserInterface/Views/CSSGridSection.js (modified) (4 diffs)
-
UserInterface/Views/LayoutDetailsSidebarPanel.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r272737 r272934 1 2021-02-16 Razvan Caliman <rcaliman@apple.com> 2 3 Web Inspector: Grid list in Layout panel missing empty message 4 https://bugs.webkit.org/show_bug.cgi?id=221763 5 <rdar://problem/74242610> 6 7 Reviewed by BJ Burg. 8 9 Show a message instead of an empty list in the Layout sidebar panel 10 when there are no CSS Grid contexts found on the inspected page. 11 12 * Localizations/en.lproj/localizedStrings.js: 13 * UserInterface/Views/CSSGridSection.js: 14 (WI.CSSGridSection.prototype.set gridNodeSet): 15 (WI.CSSGridSection.prototype.attached): 16 (WI.CSSGridSection.prototype.detached): 17 (WI.CSSGridSection.prototype._handleGridOverlayStateChanged): 18 (WI.CSSGridSection): 19 Move logic to update the `gridNodeSet` from `CSSGridSection` up to `LayoutDetailsSidebarPanel` 20 so the parent view can toggle between the empty message and the populated CSS grid section accordingly. 21 22 * UserInterface/Views/LayoutDetailsSidebarPanel.js: 23 (WI.LayoutDetailsSidebarPanel): 24 (WI.LayoutDetailsSidebarPanel.prototype.attached): 25 (WI.LayoutDetailsSidebarPanel.prototype.detached): 26 (WI.LayoutDetailsSidebarPanel.prototype.initialLayout): 27 (WI.LayoutDetailsSidebarPanel.prototype.layout): 28 (WI.LayoutDetailsSidebarPanel.prototype._handleLayoutContextTypeChanged): 29 (WI.LayoutDetailsSidebarPanel.prototype._refreshGridNodeSet): 30 1 31 2021-02-11 Razvan Caliman <rcaliman@apple.com> 2 32 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r272737 r272934 940 940 localizedStrings["No Box Model Information"] = "No Box Model Information"; 941 941 localizedStrings["No CSS Changes"] = "No CSS Changes"; 942 /* Message shown when there are no CSS Grid contexts on the inspected page. */ 943 localizedStrings["No CSS Grid Contexts @ Layout Details Sidebar Panel"] = "No CSS Grid Contexts"; 942 944 localizedStrings["No Canvas Contexts"] = "No Canvas Contexts"; 943 945 localizedStrings["No Canvas Selected"] = "No Canvas Selected"; -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSGridSection.js
r272737 r272934 24 24 */ 25 25 26 // FIXME: <https://webkit.org/b/152269> convert `WI.CSSGridSection` to be a subclass of `WI.DetailsSectionRow` 27 26 28 WI.CSSGridSection = class CSSGridSection extends WI.View 27 29 { … … 36 38 } 37 39 40 // Public 41 42 set gridNodeSet(value) 43 { 44 this._gridNodeSet = value; 45 this.needsLayout(); 46 } 47 38 48 // Protected 39 49 … … 42 52 super.attached(); 43 53 44 WI.DOMNode.addEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);45 54 WI.overlayManager.addEventListener(WI.OverlayManager.Event.GridOverlayShown, this._handleGridOverlayStateChanged, this); 46 55 WI.overlayManager.addEventListener(WI.OverlayManager.Event.GridOverlayHidden, this._handleGridOverlayStateChanged, this); 47 48 this._refreshGridNodeSet();49 56 } 50 57 51 58 detached() 52 59 { 53 WI.DOMNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);54 60 WI.overlayManager.removeEventListener(WI.OverlayManager.Event.GridOverlayShown, this._handleGridOverlayStateChanged, this); 55 61 WI.overlayManager.removeEventListener(WI.OverlayManager.Event.GridOverlayHidden, this._handleGridOverlayStateChanged, this); … … 124 130 checkboxElement.checked = event.type === WI.OverlayManager.Event.GridOverlayShown; 125 131 } 126 127 _handleLayoutContextTypeChanged(event)128 {129 let domNode = event.target;130 if (domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid)131 this._gridNodeSet.add(domNode);132 else133 this._gridNodeSet.delete(domNode);134 135 this.needsLayout();136 }137 138 _refreshGridNodeSet()139 {140 this._gridNodeSet = new Set(WI.domManager.nodesWithLayoutContextType(WI.DOMNode.LayoutContextType.Grid));141 this.needsLayout();142 }143 132 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js
r272670 r272934 30 30 super("layout-details", WI.UIString("Layout", "Layout @ Styles Sidebar", "Title of the CSS style panel.")); 31 31 32 this._gridNodeSet = new Set; 32 33 this._nodeStyles = null; 33 34 this.element.classList.add("layout-panel"); … … 76 77 } 77 78 79 // Protected 80 78 81 attached() 79 82 { 80 83 super.attached(); 81 84 85 WI.DOMNode.addEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this); 82 86 WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 83 87 84 88 WI.cssManager.layoutContextTypeChangedMode = WI.CSSManager.LayoutContextTypeChangedMode.All; 89 90 this._refreshGridNodeSet(); 85 91 } 86 92 … … 89 95 WI.cssManager.layoutContextTypeChangedMode = WI.CSSManager.LayoutContextTypeChangedMode.Observed; 90 96 97 WI.DOMNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this); 91 98 WI.Frame.removeEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 92 99 93 100 super.detached(); 94 101 } 95 96 // Protected97 102 98 103 initialLayout() … … 103 108 this.contentView.element.appendChild(boxModelSection.element); 104 109 105 let cssGridRow = new WI.DetailsSectionRow;106 let gridGroup = new WI.DetailsSectionGroup([ cssGridRow]);107 let grid Section = new WI.DetailsSection("layout-css-grid", WI.UIString("Grid", "Grid @ Elements details sidebar", "CSS Grid layout section name"), [gridGroup]);108 this.contentView.element.appendChild(grid Section.element);110 this._gridDetailsSectionRow = new WI.DetailsSectionRow(WI.UIString("No CSS Grid Contexts", "No CSS Grid Contexts @ Layout Details Sidebar Panel", "Message shown when there are no CSS Grid contexts on the inspected page.")); 111 let gridGroup = new WI.DetailsSectionGroup([this._gridDetailsSectionRow]); 112 let gridDetailsSection = new WI.DetailsSection("layout-css-grid", WI.UIString("Grid", "Grid @ Elements details sidebar", "CSS Grid layout section name"), [gridGroup]); 113 this.contentView.element.appendChild(gridDetailsSection.element); 109 114 110 let cssGridSection = new WI.CSSGridSection; 111 cssGridRow.element.appendChild(cssGridSection.element); 112 this.addSubview(cssGridSection); 115 this._gridSection = new WI.CSSGridSection; 113 116 } 114 117 … … 117 120 super.layout(); 118 121 122 if (!this._gridNodeSet.size) { 123 this._gridDetailsSectionRow.showEmptyMessage(); 124 125 if (this._gridSection.isAttached) 126 this.removeSubview(this._gridSection); 127 128 } else { 129 this._gridDetailsSectionRow.hideEmptyMessage(); 130 this._gridDetailsSectionRow.element.appendChild(this._gridSection.element); 131 132 if (!this._gridSection.isAttached) 133 this.addSubview(this._gridSection); 134 135 this._gridSection.gridNodeSet = this._gridNodeSet; 136 } 137 119 138 if (this._boxModelDiagramRow.nodeStyles !== this._nodeStyles) 120 139 this._boxModelDiagramRow.nodeStyles = this._nodeStyles; … … 122 141 123 142 // Private 143 144 _handleLayoutContextTypeChanged(event) 145 { 146 let domNode = event.target; 147 if (domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid) 148 this._gridNodeSet.add(domNode); 149 else 150 this._gridNodeSet.delete(domNode); 151 152 this.needsLayout(); 153 } 124 154 125 155 _mainResourceDidChange(event) … … 142 172 this._nodeStyles?.refresh(); 143 173 } 174 175 _refreshGridNodeSet() 176 { 177 this._gridNodeSet = new Set(WI.domManager.nodesWithLayoutContextType(WI.DOMNode.LayoutContextType.Grid)); 178 } 144 179 };
Note: See TracChangeset
for help on using the changeset viewer.