<?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>146256</bug_id>
          
          <creation_ts>2015-06-23 15:45:17 -0700</creation_ts>
          <short_desc>Web Inspector: Nested ContentBrowsers / ContentViewContainers cause too many ContentView updates</short_desc>
          <delta_ts>2015-11-19 09:33:57 -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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>151058</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Matt Baker">mattbaker</assigned_to>
          <cc>bburg</cc>
    
    <cc>graouts</cc>
    
    <cc>joepeck</cc>
    
    <cc>jonowells</cc>
    
    <cc>mattbaker</cc>
    
    <cc>nvasilyev</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1104213</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-23 15:45:17 -0700</bug_when>
    <thetext>* 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;http://apple.com&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&apos;t) triggers another updateLayout</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1104215</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2015-06-23 15:45:37 -0700</bug_when>
    <thetext>&lt;rdar://problem/21513227&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1104217</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-23 15:47:19 -0700</bug_when>
    <thetext>&gt;     1. prepareToShow ResourceClusterContentView triggers
&gt; restoreFromCookie/showContentView for the TextResourceContentView (call
&gt; shown false) and updateLayout

This one is particularly nasty, because this is the ResourceClusterContentView triggering an updateLayout on its sub-ContentView (TextResourceContentView) without having shown() on that view first. So the elements may not actually be in the DOM, and therefore may get incorrect / unexpected values for its views.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1104231</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-06-23 16:05:01 -0700</bug_when>
    <thetext>&gt;     7. Quick Console claims it resized (probably didn&apos;t) triggers another updateLayout

Eliminating this one as part of:
&lt;https://webkit.org/b/146258&gt; Web Inspector: Reduce QuickConsole DidResize events if it did not change</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1143006</commentid>
    <comment_count>4</comment_count>
    <who name="Blaze Burg">bburg</who>
    <bug_when>2015-11-18 15:13:05 -0800</bug_when>
    <thetext>Matt, what&apos;s the status of this bug now that we have batched async layout?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1143061</commentid>
    <comment_count>5</comment_count>
    <who name="Matt Baker">mattbaker</who>
    <bug_when>2015-11-18 16:10:37 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; Matt, what&apos;s the status of this bug now that we have batched async layout?

Batching layouts reduced the updates to around 3 (from around 7). The fix for https://bugs.webkit.org/show_bug.cgi?id=151058 brings the total down to two (the first of which is skipped because the TextEditor hasn&apos;t become visible yet).

Will close out when the above issue lands.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>