Skip to content
Permalink
Browse files
Web Inspector: Computed tab scrolls back to top when <style> is added…
… to page

https://bugs.webkit.org/show_bug.cgi?id=245478

Reviewed by Patrick Angle.

`WI.GeneralStyleDetailsSidebarPanel` forces a full layout of `WI.ComputedStyleDetailsPanel`,
`WI.SpreadsheetRulesStyleDetailsPanel`, and `WI.FontDetailsPanel` when adding or removing a
stylesheet. This is also resets their scroll position.

The full layout is unnecessary. The panels update their contents in reaction to the
`WI.DOMNodeStyles.Event.NeedsRefresh` event from the selected node and ensure the
scroll position is preserved in `WI.StyleDetailsPanel._refreshPreservingScrollPosition()`.

* Source/WebInspectorUI/UserInterface/Views/GeneralStyleDetailsSidebarPanel.js:
(WI.GeneralStyleDetailsSidebarPanel.prototype._styleSheetAddedOrRemoved):
(WI.GeneralStyleDetailsSidebarPanel):

Canonical link: https://commits.webkit.org/255001@main
  • Loading branch information
rcaliman-apple committed Sep 29, 2022
1 parent 91710de commit 94fb9bb96d6a72ffedacc547d913d00efff91838
Showing 1 changed file with 5 additions and 1 deletion.
@@ -432,7 +432,11 @@ WI.GeneralStyleDetailsSidebarPanel = class GeneralStyleDetailsSidebarPanel exten

_styleSheetAddedOrRemoved()
{
this.needsLayout();
let domNode = this.domNode;
if (!domNode || domNode.destroyed)
return;

this._panel.markAsNeedsRefresh(domNode);
}
};

0 comments on commit 94fb9bb

Please sign in to comment.