Bug 196667 - REGRESSION(r237196): Web Inspector: Computed panel shouldn't update when it isn't visible
Summary: REGRESSION(r237196): Web Inspector: Computed panel shouldn't update when it i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-05 19:52 PDT by Nikita Vasilyev
Modified: 2019-04-06 19:55 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.15 KB, patch)
2019-04-06 18:23 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2019-04-05 19:52:50 PDT
Currently, Computed panel gets updated even when another panel, such as Styles, is selected. There's a lot of unnecessary work happening.

This doesn't appear to be a regression.
Comment 1 Radar WebKit Bug Importer 2019-04-05 19:54:17 PDT
<rdar://problem/49664912>
Comment 2 Nikita Vasilyev 2019-04-05 20:08:20 PDT
It seems like there's logic in-place. However, it has been broken for years and maybe never even worked.


GeneralStyleDetailsSidebarPanel.js:

    visibilityDidChange()
    {
        super.visibilityDidChange();

        if (!this._panel)
            return;

        if (!this.visible) { // <-- NEVER PASSES!
            this._panel.hidden(); 
            return;
        }

        this._updateNoForcedPseudoClassesScrollOffset();

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

So, what is this `visible` property and why is it always false there.

SidebarPanel.js:

    get visible()
    {
        return this.selected && this.parentSidebar && !this.parentSidebar.collapsed;
    }

Okay, the sidebar panel has to be selected to be visible.

Sidebar.js:

    set selectedSidebarPanel(sidebarPanelOrIdentifierOrIndex)
    {
        var sidebarPanel = this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);
        if (this._selectedSidebarPanel === sidebarPanel)
            return;

        if (this._selectedSidebarPanel) {
            if (this._selectedSidebarPanel.visible) {
                this._selectedSidebarPanel.hidden();
                this._selectedSidebarPanel.visibilityDidChange(); // <-- `visible` is true because `selected` hasn't been set to false yet!
            }

            this._selectedSidebarPanel.selected = false;
        }
Comment 3 Nikita Vasilyev 2019-04-06 18:12:51 PDT
Actually, this regressed 6 months ago in https://trac.webkit.org/changeset/237196/webkit.
Comment 4 Nikita Vasilyev 2019-04-06 18:23:45 PDT
Created attachment 366895 [details]
Patch
Comment 5 WebKit Commit Bot 2019-04-06 19:55:03 PDT
Comment on attachment 366895 [details]
Patch

Clearing flags on attachment: 366895

Committed r243964: <https://trac.webkit.org/changeset/243964>
Comment 6 WebKit Commit Bot 2019-04-06 19:55:05 PDT
All reviewed patches have been landed.  Closing bug.