<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Web Inspector: Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates"
   href="https://bugs.webkit.org/show_bug.cgi?id=146256">146256</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Web Inspector: Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Web Inspector
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>joepeck&#64;webkit.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>burg&#64;cs.washington.edu, graouts&#64;webkit.org, joepeck&#64;webkit.org, jonowells&#64;apple.com, mattbaker&#64;apple.com, nvasilyev&#64;apple.com, timothy&#64;apple.com, webkit-bug-importer&#64;group.apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>* SUMMARY
Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates.

For resources the View hierarchy looks something like this:

  - TabBrowser
    - ContentViewContainer
      - ResourcesTabContentView (1) (ContentBrowserTabContentView with a ContentBrowser)
        - ContentViewContainer
          - ResourceClusterContentView (2) (ClusterContentView)
            - ContentViewContainer
              - TextResourceContentView (3)
                - TextEditor

In the process of showing each of the 3 ContentViews, actions are taken on its sub-views that repeat over and over depending on the nested level. ContentViewContainer.showContentView triggers BackForwardEntry.prepareToShow, and BackForwardEntry.prepareToShow triggers multiple actions which may cascade:

    - _restoreFromCookie() may cascade actions to sub ContentViews
    - shown() may cascade actions to sub ContentViews
    - updateLayout() may cascade actions to sub ContentViews

This situation is not ideal! It would be much better to reduce duplication of work here.

* STEPS TO REPRODUCE
1. Load &lt;<a href="http://apple.com">http://apple.com</a>&gt;
2. Show page source (Web Inspector, Resources Tab, Main Resource selected)
3. Scroll down the text editor
4. Switch to the Elements tab
5. Switch back to the Resources tab
  =&gt; updateLayout was called 6+ times on the TextEditor

* NOTES
- Here are annotations of the different updateLayout calls I saw in this case:
    1. prepareToShow ResourceClusterContentView triggers restoreFromCookie/showContentView for the TextResourceContentView (call shown false) and updateLayout
    2. prepareToShow-&gt;shown ResourceClusterContentView triggers shown for the TextResourceContentView (call shown true) and updateLayout
    3. prepareToShow-&gt;shown ResourceClusterContentView triggers another showContentView for TextResourceContentView (call shown false) and updateLayout
    4. prepareToShow-&gt;updateLayout ResourceClusterContentView triggers another updateLayout for TextResourceContentView
    5. prepareToShow-&gt;updateLayout Tab ContentView triggers another updateLayout down the cascade to TextResourceContentView
    6. Left Sidebar opening (I came from Elements -&gt; Resources) triggers another updateLayout
    7. Quick Console claims it resized (probably didn't) triggers another updateLayout</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>