<?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>108255</bug_id>
          
          <creation_ts>2013-01-29 16:50:51 -0800</creation_ts>
          <short_desc>Scrollbar and scroll corner composited layers positioned incorrectly</short_desc>
          <delta_ts>2013-01-29 22:33:18 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Robinson">jamesr</reporter>
          <assigned_to name="James Robinson">jamesr</assigned_to>
          <cc>bdakin</cc>
    
    <cc>sam</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>819499</commentid>
    <comment_count>0</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 16:50:51 -0800</bug_when>
    <thetext>Originally reported as https://code.google.com/p/chromium/issues/detail?id=170264

Open this repro case in Chrome with --force-compositing-mode or a recent WebKit nightlies:

&lt;!DOCTYPE html&gt;
&lt;html&gt;
 &lt;body&gt;
  &lt;div style=&quot;position:relative; float:right; width:40px; height:20px; right:-20px; background-color:#090&quot;&gt;&lt;/div&gt;
  &lt;div style=&quot;height:400px; background-color:#900;&quot;&gt;&lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;


data:text/html;charset=utf-8,&lt;!DOCTYPE%20html&gt;%0A&lt;html&gt;%0A%20&lt;body&gt;%0A%20%20&lt;div%20style%3D&quot;position%3Arelative%3B%20float%3Aright%3B%20width%3A40px%3B%20height%3A20px%3B%20right%3A-20px%3B%20background-color%3A%23090&quot;&gt;&lt;%2Fdiv&gt;%0A%20%20&lt;div%20style%3D&quot;height%3A400px%3B%20background-color%3A%23900%3B&quot;&gt;&lt;%2Fdiv&gt;%0A%20&lt;%2Fbody&gt;%0A&lt;%2Fhtml&gt;

and resize the window to be close to the size of the red square.  At certain sizes, the page goes nearly white.  The scroll corner layer on the root frame is positioned at 15x15 and occupies the rest of the frame.  Somehow the overflow control layer positioning logic is running before the scrollbars get correctly sized.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819531</commentid>
    <comment_count>1</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 17:07:48 -0800</bug_when>
    <thetext>When we end up doing multiple passes through ScrollView::updateScrollbars(), we sometimes end up not calling positionScrollbarLayers() at all since it&apos;s inside this check:

http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/platform/ScrollView.cpp&amp;exact_package=chromium&amp;q=ScrollView.cpp&amp;type=cs&amp;l=608

Just unconditionally calling positionScrollbarLayers() fixes this, but that&apos;s probably not ideal.

+cc a few other ScrollView folks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819677</commentid>
    <comment_count>2</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 18:49:23 -0800</bug_when>
    <thetext>We end up recursively calling updateScrollbars repeatedly on this page up to cMaxUpdateScrollbarPass.  On the first call, the ScrollView has horizontal and vertical scrollbars.  Layout results in no overflow, so updateScrollbars is called to remove them.  After a few rounds of this, we end up calling positionScrollbarLayers() with this callstack:

#0  WebCore::ScrollView::positionScrollbarLayers (this=0x79ac6800) at Source/WebCore/platform/ScrollView.cpp:940
#1  0x0c89576a in WebCore::RenderLayerCompositor::updateOverflowControlsLayers (this=0x79471db0) at Source/WebCore/rendering/RenderLayerCompositor.cpp:2411
#2  0x0c894614 in WebCore::RenderLayerCompositor::frameViewDidChangeSize (this=0x79471db0) at Source/WebCore/rendering/RenderLayerCompositor.cpp:1175
#3  0x0d7dbb2f in WebCore::FrameView::visibleContentsResized (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:2009
#4  0x0aca7354 in WebCore::ScrollView::updateScrollbars (this=0x79ac6800, desiredOffset=@0xbfff0a70) at Source/WebCore/platform/ScrollView.cpp:474
#5  0x0aca9670 in WebCore::ScrollView::setContentsSize (this=0x79ac6800, newSize=@0xbfff0b40) at Source/WebCore/platform/ScrollView.cpp:308
#6  0x0d7d2734 in WebCore::FrameView::setContentsSize (this=0x79ac6800, size=@0xbfff0b40) at Source/WebCore/page/FrameView.cpp:557
#7  0x0d7d2a01 in WebCore::FrameView::adjustViewSize (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:586
#8  0x0d7d5a42 in WebCore::FrameView::layout (this=0x79ac6800, allowSubtree=true) at Source/WebCore/page/FrameView.cpp:1231
#9  0x0d7dbae9 in WebCore::FrameView::visibleContentsResized (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:2004
#10 0x0aca7aac in WebCore::ScrollView::updateScrollbars (this=0x79ac6800, desiredOffset=@0xbfff1030) at Source/WebCore/platform/ScrollView.cpp:547
#11 0x0aca9670 in WebCore::ScrollView::setContentsSize (this=0x79ac6800, newSize=@0xbfff1100) at Source/WebCore/platform/ScrollView.cpp:308
#12 0x0d7d2734 in WebCore::FrameView::setContentsSize (this=0x79ac6800, size=@0xbfff1100) at Source/WebCore/page/FrameView.cpp:557
#13 0x0d7d2a01 in WebCore::FrameView::adjustViewSize (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:586
#14 0x0d7d5a42 in WebCore::FrameView::layout (this=0x79ac6800, allowSubtree=true) at Source/WebCore/page/FrameView.cpp:1231
#15 0x0d7dbae9 in WebCore::FrameView::visibleContentsResized (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:2004
#16 0x0aca7aac in WebCore::ScrollView::updateScrollbars (this=0x79ac6800, desiredOffset=@0xbfff15f0) at Source/WebCore/platform/ScrollView.cpp:547
#17 0x0aca9670 in WebCore::ScrollView::setContentsSize (this=0x79ac6800, newSize=@0xbfff16c0) at Source/WebCore/platform/ScrollView.cpp:308
#18 0x0d7d2734 in WebCore::FrameView::setContentsSize (this=0x79ac6800, size=@0xbfff16c0) at Source/WebCore/page/FrameView.cpp:557
#19 0x0d7d2a01 in WebCore::FrameView::adjustViewSize (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:586
#20 0x0d7d5a42 in WebCore::FrameView::layout (this=0x79ac6800, allowSubtree=true) at Source/WebCore/page/FrameView.cpp:1231
#21 0x0d7e0d5b in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive (this=0x79ac6800) at Source/WebCore/page/FrameView.cpp:3418

where we get a non-sensical scrollCornerRect():

  m_location = {
    m_x = 15, 
    m_y = 15
  }, 
  m_size = {
    m_width = 769, 
    m_height = 413
  }

since the scrollbars are inconsistent.  The scrollbars get fixed up as the stack unwinds, but since the ScrollView ends up with both vertical and horizontal scrollbars (just like it started with), it doesn&apos;t update the layer geometry again:

    if (hasHorizontalScrollbar != (m_horizontalScrollbar != 0) || hasVerticalScrollbar != (m_verticalScrollbar != 0)) {
        // FIXME: Is frameRectsChanged really necessary here? Have any frame rects changed?
        frameRectsChanged();
        positionScrollbarLayers();
        updateScrollCorner();</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819755</commentid>
    <comment_count>3</comment_count>
      <attachid>185387</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 21:14:16 -0800</bug_when>
    <thetext>Created attachment 185387
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819757</commentid>
    <comment_count>4</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 21:15:12 -0800</bug_when>
    <thetext>I&apos;ve had no luck creating a layout test.  The problem only seems to manifest on a Widget resize and I can&apos;t make it happen inside an iframe.

I am not 100% convinced this is the right patch but it fixes this bug and does not regress any other layout tests, so it&apos;s something for consideration.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819782</commentid>
    <comment_count>5</comment_count>
      <attachid>185387</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2013-01-29 21:45:58 -0800</bug_when>
    <thetext>Comment on attachment 185387
Patch

After staring at it a bit more I&apos;m pretty sure this is correct.  This should only cause us to do the update in more cases than we currently do, never less, and repositioning/etc more often should never produce incorrect behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819808</commentid>
    <comment_count>6</comment_count>
      <attachid>185387</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-01-29 22:33:15 -0800</bug_when>
    <thetext>Comment on attachment 185387
Patch

Clearing flags on attachment: 185387

Committed r141226: &lt;http://trac.webkit.org/changeset/141226&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>819809</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-01-29 22:33:18 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>185387</attachid>
            <date>2013-01-29 21:14:16 -0800</date>
            <delta_ts>2013-01-29 22:33:14 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-108255-20130129211107.patch</filename>
            <type>text/plain</type>
            <size>2428</size>
            <attacher name="James Robinson">jamesr</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQwNTQ3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ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