<?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>103452</bug_id>
          
          <creation_ts>2012-11-27 13:24:01 -0800</creation_ts>
          <short_desc>[EFL][Qt][WK2] Fixed position elements are not always fixed</short_desc>
          <delta_ts>2012-12-11 09:40:54 -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>Layout and Rendering</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>http://trac.webkit.org/export/135909/trunk/ManualTests/fixed-position.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>103105</blocked>
    
    <blocked>103747</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Yael">yael</reporter>
          <assigned_to name="Yael">yael</assigned_to>
          <cc>bdakin</cc>
    
    <cc>eric</cc>
    
    <cc>hausmann</cc>
    
    <cc>jturcotte</cc>
    
    <cc>kenneth</cc>
    
    <cc>leviw</cc>
    
    <cc>michael.bruning</cc>
    
    <cc>noam</cc>
    
    <cc>ojan</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>skyostil</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>777167</commentid>
    <comment_count>0</comment_count>
    <who name="Yael">yael</who>
    <bug_when>2012-11-27 13:24:01 -0800</bug_when>
    <thetext>SSIA</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781303</commentid>
    <comment_count>1</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 03:37:11 -0800</bug_when>
    <thetext>fixed layer fount, but do we have backing? (nil)
fixed layer fount, but do we have backing? 0x7fd4e2768380

In static void updateOffsetFromViewportForSelf(RenderLayer* renderLayer) the fixed elements fail because they have no backing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781306</commentid>
    <comment_count>2</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 03:39:36 -0800</bug_when>
    <thetext>This is the check which fails in 

1951 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* renderer, const RenderLayer* layer) const

1977     // Fixed position elements that are invisible in the current view don&apos;t get their own layer.
1978     if (FrameView* frameView = m_renderView-&gt;frameView()) {
1979         IntRect viewBounds = IntRect(IntPoint(frameView-&gt;scrollOffsetForFixedPosition()), frameView-&gt;layoutSize());
1980         IntRect layerBounds = calculateCompositedBounds(layer, rootRenderLayer());
1981         if (!viewBounds.intersects(layerBounds))
1982             return false;
1983     }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781311</commentid>
    <comment_count>3</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 03:45:21 -0800</bug_when>
    <thetext>This fixes it, but I don&apos;t know why things were done the other way:

--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1974,7 +1974,8 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere
 
     // Fixed position elements that are invisible in the current view don&apos;t get their own layer.
     if (FrameView* frameView = m_renderView-&gt;frameView()) {
-        IntRect viewBounds = IntRect(IntPoint(frameView-&gt;scrollOffsetForFixedPosition()), frameView-&gt;layoutSize());
+        //IntRect viewBounds = IntRect(IntPoint(frameView-&gt;scrollOffsetForFixedPosition()), frameView-&gt;layoutSize());
+        IntRect viewBounds = frameView-&gt;visibleContentRect();
         IntRect layerBounds = calculateCompositedBounds(layer, rootRenderLayer());
         if (!viewBounds.intersects(layerBounds))
             return false;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781349</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Brüning">michael.bruning</who>
    <bug_when>2012-12-03 05:08:52 -0800</bug_when>
    <thetext>Qt is affected by this as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781377</commentid>
    <comment_count>5</comment_count>
      <attachid>177240</attachid>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 05:58:52 -0800</bug_when>
    <thetext>Created attachment 177240
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781489</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2012-12-03 08:41:31 -0800</bug_when>
    <thetext>What&apos;s the difference between visibleContentRect().location() and scrollOffsetForFixedPosition()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781526</commentid>
    <comment_count>7</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 09:22:06 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; What&apos;s the difference between visibleContentRect().location() and scrollOffsetForFixedPosition()?

I am not really sure, so it would be good with Beth&apos;s comments here.

I think that is relates t how you are doing scrolling with the scrolling coordinator which we don&apos;t use. The method actually calls a similar name method in ScrollingCoordinator.

Maybe we could ifdef it for platforms not using ScrollingCoordinator. But I would like to first understand if there is something that I am missing here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781699</commentid>
    <comment_count>8</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2012-12-03 11:30:35 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; What&apos;s the difference between visibleContentRect().location() and scrollOffsetForFixedPosition()?

scrollOffsetForFixedPosition() is adjusted for scroll origin, frame scale factor, and he Settings::fixedElementsLayoutRelativeToFrame(). I&apos;m not sure why the code wouldn&apos;t work on other platforms. In case it&apos;s not clear from the svn-blaming, I did not write that code, I just moved it so that it could also be called from the scrolling thread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781795</commentid>
    <comment_count>9</comment_count>
      <attachid>177240</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2012-12-03 13:02:05 -0800</bug_when>
    <thetext>Comment on attachment 177240
Patch

Please survey the code for other places which might get this wrong. Maybe scrollOffsetForFixedPosition() needs some comments next to it in the header.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781864</commentid>
    <comment_count>10</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 14:02:20 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #6)
&gt; &gt; What&apos;s the difference between visibleContentRect().location() and scrollOffsetForFixedPosition()?
&gt; 
&gt; scrollOffsetForFixedPosition() is adjusted for scroll origin, frame scale factor, and he Settings::fixedElementsLayoutRelativeToFrame(). I&apos;m not sure why the code wouldn&apos;t work on other platforms. In case it&apos;s not clear from the svn-blaming, I did not write that code, I just moved it so that it could also be called from the scrolling thread.

For one, Qt and EFL doesn&apos;t use frameScaleFactor() but does scaling outside of WebCore. We might consider using it, if there are compelling reasons for doing so, beyond sharing more code paths.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781933</commentid>
    <comment_count>11</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2012-12-03 15:16:45 -0800</bug_when>
    <thetext>I don&apos;t think we want this change on the Mac!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781937</commentid>
    <comment_count>12</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 15:19:14 -0800</bug_when>
    <thetext>(In reply to comment #11)
&gt; I don&apos;t think we want this change on the Mac!

Ok, I can ifdef it then. Can you explain me in that situations IntRect(IntPoint(frameView-&gt;scrollOffsetForFixedPosition()), frameView-&gt;layoutSize()); is different that the visible contents rect on mac?

Maybe there are some cases we need to be aware of as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781940</commentid>
    <comment_count>13</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2012-12-03 15:23:31 -0800</bug_when>
    <thetext>(In reply to comment #12)
&gt; (In reply to comment #11)
&gt; &gt; I don&apos;t think we want this change on the Mac!
&gt; 
&gt; Ok, I can ifdef it then. Can you explain me in that situations IntRect(IntPoint(frameView-&gt;scrollOffsetForFixedPosition()), frameView-&gt;layoutSize()); is different that the visible contents rect on mac?
&gt; 
&gt; Maybe there are some cases we need to be aware of as well.

I take it back! scrollOffsetForFixedPosition() is needed sometimes in the Mac code because visibleContentRect() will return negative offsets when you are in the rubber-band phase of a scroll on the Mac. However, we don&apos;t need to worry about that in the RenderLayerCompositor code, so I think it is safe to use visibleContentRect here.

Sorry for the confusion!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781942</commentid>
    <comment_count>14</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 15:25:06 -0800</bug_when>
    <thetext>&gt; I take it back! scrollOffsetForFixedPosition() is needed sometimes in the Mac code because visibleContentRect() will return negative offsets when you are in the rubber-band phase of a scroll on the Mac. However, we don&apos;t need to worry about that in the RenderLayerCompositor code, so I think it is safe to use visibleContentRect here.
&gt; 
&gt; Sorry for the confusion!

OK, thanks for the explanation! I will land it then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781986</commentid>
    <comment_count>15</comment_count>
      <attachid>177240</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-12-03 15:56:13 -0800</bug_when>
    <thetext>Comment on attachment 177240
Patch

Rejecting attachment 177240 from commit-queue.

Failed to run &quot;[&apos;/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch&apos;, &apos;--status-host=queues.webkit.org&apos;, &apos;-...&quot; exit_code: 2

Last 500 characters of output:
ripts/update-webkit line 152.

Failed to run &quot;[&apos;Tools/Scripts/update-webkit&apos;, &apos;--chromium&apos;, &apos;--force-update&apos;]&quot; exit_code: 2
Updating OpenSource
From http://git.chromium.org/external/Webkit
   ae22de8..2a054f9  HEAD       -&gt; origin/HEAD
error: Ref refs/remotes/origin/master is at 2a054f9cb1bc438521d4764c001d072db3d434b7 but expected ae22de8513848241262c5d0b497139a3847cd99d
 ! ae22de8..2a054f9  master     -&gt; origin/master  (unable to update local ref)
Died at Tools/Scripts/update-webkit line 152.

Full output: http://queues.webkit.org/results/15132151</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>781999</commentid>
    <comment_count>16</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-03 16:05:54 -0800</bug_when>
    <thetext>Landed in 136452</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>788397</commentid>
    <comment_count>17</comment_count>
    <who name="Sami Kyöstilä">skyostil</who>
    <bug_when>2012-12-11 06:39:25 -0800</bug_when>
    <thetext>This change seems to be causing some trouble when page pageScaleFactor != 1. This is because viewBounds is now in logical pixels while layerBounds is in CSS pixels. I&apos;ll put together a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>788401</commentid>
    <comment_count>18</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-12-11 06:42:06 -0800</bug_when>
    <thetext>(In reply to comment #17)
&gt; This change seems to be causing some trouble when page pageScaleFactor != 1. This is because viewBounds is now in logical pixels while layerBounds is in CSS pixels. I&apos;ll put together a patch.

Ah sorry about that. For Qt and EFL the viewport contents rect is in css pixels as we do scaling outside of webcore (not using frameScaleFactor)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>788516</commentid>
    <comment_count>19</comment_count>
    <who name="Sami Kyöstilä">skyostil</who>
    <bug_when>2012-12-11 09:40:54 -0800</bug_when>
    <thetext>FYI, Xianzhu has a fix here: https://bugs.webkit.org/show_bug.cgi?id=104303.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>177240</attachid>
            <date>2012-12-03 05:58:52 -0800</date>
            <delta_ts>2012-12-03 16:06:08 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-103452-20121203145617.patch</filename>
            <type>text/plain</type>
            <size>2068</size>
            <attacher name="Kenneth Rohde Christiansen">kenneth</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTM2Mzg3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNjgzZDk2YjQ3YjUzMzlh
MjliNDJlZWNhMzNmM2Y1ZDIwM2UzY2E3ZC4uMGEzZGI0YzJiNmEzNDU3ZWFlOGU1MzMwZjFkNzM5
MTY4ZjQ3ZmVlYiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIwIEBACisyMDEyLTEyLTAzICBLZW5u
ZXRoIFJvaGRlIENocmlzdGlhbnNlbiAgPGtlbm5ldGhAd2Via2l0Lm9yZz4KKworICAgICAgICBb
RUZMXVtRdF1bV0syXSBGaXhlZCBwb3NpdGlvbiBlbGVtZW50cyBhcmUgbm90IGFsd2F5cyBmaXhl
ZAorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTAzNDUy
CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgVGhlIGNv
ZGUgZmlndXJpbmcgb3V0IHdoZXRoZXIgZml4ZWQgcG9zaXRpb24gbGF5ZXJzIGFyZSBpbnNpZGUK
KyAgICAgICAgdGhlIHZp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VuZGVyTGF5ZXJDb21wb3NpdG9yLmNwcAorKysgYi9Tb3VyY2UvV2ViQ29y
ZS9yZW5kZXJpbmcvUmVuZGVyTGF5ZXJDb21wb3NpdG9yLmNwcApAQCAtMTk3NCw3ICsxOTc0LDcg
QEAgYm9vbCBSZW5kZXJMYXllckNvbXBvc2l0b3I6OnJlcXVpcmVzQ29tcG9zaXRpbmdGb3JQb3Np
dGlvbihSZW5kZXJPYmplY3QqIHJlbmRlcmUKIAogICAgIC8vIEZpeGVkIHBvc2l0aW9uIGVsZW1l
bnRzIHRoYXQgYXJlIGludmlzaWJsZSBpbiB0aGUgY3VycmVudCB2aWV3IGRvbid0IGdldCB0aGVp
ciBvd24gbGF5ZXIuCiAgICAgaWYgKEZyYW1lVmlldyogZnJhbWVWaWV3ID0gbV9yZW5kZXJWaWV3
LT5mcmFtZVZpZXcoKSkgewotICAgICAgICBJbnRSZWN0IHZpZXdCb3VuZHMgPSBJbnRSZWN0KElu
dFBvaW50KGZyYW1lVmlldy0+c2Nyb2xsT2Zmc2V0Rm9yRml4ZWRQb3NpdGlvbigpKSwgZnJhbWVW
aWV3LT5sYXlvdXRTaXplKCkpOworICAgICAgICBJbnRSZWN0IHZpZXdCb3VuZHMgPSBmcmFtZVZp
ZXctPnZpc2libGVDb250ZW50UmVjdCgpOwogICAgICAgICBJbnRSZWN0IGxheWVyQm91bmRzID0g
Y2FsY3VsYXRlQ29tcG9zaXRlZEJvdW5kcyhsYXllciwgcm9vdFJlbmRlckxheWVyKCkpOwogICAg
ICAgICBpZiAoIXZpZXdCb3VuZHMuaW50ZXJzZWN0cyhsYXllckJvdW5kcykpCiAgICAgICAgICAg
ICByZXR1cm4gZmFsc2U7Cg==
</data>
<flag name="review"
          id="193297"
          type_id="1"
          status="+"
          setter="simon.fraser"
    />
    <flag name="commit-queue"
          id="193456"
          type_id="3"
          status="-"
          setter="webkit.review.bot"
    />
          </attachment>
      

    </bug>

</bugzilla>