[Webkit-unassigned] [Bug 150741] New: Web Inspector: Unify management of visibility state for views

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 30 16:46:53 PDT 2015


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

            Bug ID: 150741
           Summary: Web Inspector: Unify management of visibility state
                    for views
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mattbaker at apple.com
                CC: bburg at apple.com, graouts at webkit.org,
                    joepeck at webkit.org, mattbaker at apple.com,
                    nvasilyev at apple.com, timothy at apple.com,
                    webkit-bug-importer at group.apple.com
        Depends on: 149186

* SUMMARY
Unify management of visibility state for views. We use methods shown() and hidden(), often coupled with a `visible` flag, throughout the UI to control layouts and perform other tasks. ContentView, DashboardView, and SidebarPanel define shown/hidden as base class methods, and elsewhere the pattern is implemented in an ad-hoc fashion. We should promote this concept to the View base class.

* EXAMPLE
Although implementations differ, the typical pattern is as follows:

shown()
{
   this._visible = true;
   this._childView.shown();
   this.updateLayout();
}

hidden()
{
   this._visible = false;
   this._childView.hidden();
}

needsLayout()
{
   if (!this._visible)
      return;

   ...
}

This could be moved into View as:

get visible()
{
   return this._visible;
}

set visible(flag)
{
   if (flag === this._visible)
      return;

   this._visible = flag;
   if (this._visible)
      this.shown();   // Implemented by subclasses.
   else
      this.hidden();  // Implemented by subclasses.

   this._subviews.forEach((view) => {
      console.assert(view.visible !== flag, "Unexpected subview visible state.");
      view.visible = flag;
   });
}


* NOTES
A few things to consider:

1. Currently when a view is shown, shown() isn't necessarily called for all child views that support it. ConsoleTabContentView.shown() doesn't call ContentBrowser.shown(), but ContentBrowserTabContentView does.
2. Visibility can be derived from other state, rather than being a simple flag (see SidebarPanel.visible).
3. Can all shown()/hidden() call sites simply be replaced with visible = true/false?
4. Layout isn't always updated when a view is shown (maybe limited to ApplicationCacheFrameContentView).
5. Should child views always become visible when the parent does? For example, what if a child view is collapsed?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151030/c44e95f6/attachment.html>


More information about the webkit-unassigned mailing list