<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>150741</bug_id>
          
          <creation_ts>2015-10-30 16:46:53 -0700</creation_ts>
          <short_desc>Web Inspector: Unify management of visibility state for views</short_desc>
          <delta_ts>2026-01-12 09:04:19 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>149186</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Matt Baker">mattbaker</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>graouts</cc>
    
    <cc>inspector-bugzilla-changes</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1138040</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Baker">mattbaker</who>
    <bug_when>2015-10-30 16:46:53 -0700</bug_when>
    <thetext>* 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) =&gt; {
      console.assert(view.visible !== flag, &quot;Unexpected subview visible state.&quot;);
      view.visible = flag;
   });
}


* NOTES
A few things to consider:

1. Currently when a view is shown, shown() isn&apos;t necessarily called for all child views that support it. ConsoleTabContentView.shown() doesn&apos;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&apos;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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138041</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2015-10-30 16:47:35 -0700</bug_when>
    <thetext>&lt;rdar://problem/23341812&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>