<?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>89019</bug_id>
          
          <creation_ts>2012-06-13 10:36:04 -0700</creation_ts>
          <short_desc>Remove redundant code from RenderView and RenderBlock</short_desc>
          <delta_ts>2012-06-13 19:04:19 -0700</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></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="Yael">yael</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>eric</cc>
    
    <cc>hyatt</cc>
    
    <cc>inferno</cc>
    
    <cc>mitz</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>648232</commentid>
    <comment_count>0</comment_count>
    <who name="Yael">yael</who>
    <bug_when>2012-06-13 10:36:04 -0700</bug_when>
    <thetext>As pointed out in https://bugs.webkit.org/show_bug.cgi?id=83981#c7 , RenderView::insertFixedPositionedObject() is redundant.
A separate solution is needed for fixed elements that are inside a ForeignObject.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648247</commentid>
    <comment_count>1</comment_count>
      <attachid>147362</attachid>
    <who name="Yael">yael</who>
    <bug_when>2012-06-13 10:53:43 -0700</bug_when>
    <thetext>Created attachment 147362
Patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648475</commentid>
    <comment_count>2</comment_count>
    <who name="Abhishek Arya">inferno</who>
    <bug_when>2012-06-13 14:37:06 -0700</bug_when>
    <thetext>Putting history here if someone wants to check

Comment #7 From Abhishek Arya 2012-06-11 00:03:45 PST (-) [reply] 
(From update of attachment 137332 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=137332&amp;action=review

&gt; Source/WebCore/rendering/RenderBlock.cpp:3422
&gt; +    if (o-&gt;style()-&gt;position() == FixedPosition &amp;&amp; view())

I don&apos;t think this is right and you should definitely ask Dave Hyatt for a review of this patch. Two reasons::
1) 99% of the time, fixed positioned objects are always added to their containing view.
    if (child-&gt;isPositioned()) {
        child-&gt;containingBlock()-&gt;insertPositionedObject(child);
and if you see containingBlock()
if (!isText() &amp;&amp; m_style-&gt;position() == FixedPosition) {
        while (o &amp;&amp; !o-&gt;isRenderView() &amp;&amp; !(o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock()))
            o = o-&gt;parent();
we would only return our containing view.
2) There are some exceptions for cases like &lt;foreignObject&gt;. http://trac.webkit.org/changeset/119914

This call is just redundant and forces things to be always added to renderview which is incorrect for cases like &lt;foreignObject&gt;, etc.
 Comment #8 From Yael 2012-06-11 05:45:08 PST (-) [reply] 
(In reply to comment #7)
&gt; (From update of attachment 137332 [details] [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=137332&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/rendering/RenderBlock.cpp:3422
&gt; &gt; +    if (o-&gt;style()-&gt;position() == FixedPosition &amp;&amp; view())
&gt; 
&gt; I don&apos;t think this is right and you should definitely ask Dave Hyatt for a review of this patch. Two reasons::
&gt; 1) 99% of the time, fixed positioned objects are always added to their containing view.
&gt;     if (child-&gt;isPositioned()) {
&gt;         child-&gt;containingBlock()-&gt;insertPositionedObject(child);
&gt; and if you see containingBlock()
&gt; if (!isText() &amp;&amp; m_style-&gt;position() == FixedPosition) {
&gt;         while (o &amp;&amp; !o-&gt;isRenderView() &amp;&amp; !(o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock()))
&gt;             o = o-&gt;parent();
&gt; we would only return our containing view.
&gt; 2) There are some exceptions for cases like &lt;foreignObject&gt;. http://trac.webkit.org/changeset/119914
&gt; 
&gt; This call is just redundant and forces things to be always added to renderview which is incorrect for cases like &lt;foreignObject&gt;, etc.
thanks for your comment, I&apos;ll take a look :)
 Comment #9 From Yael 2012-06-12 18:15:45 PST (-) [reply] 
(In reply to comment #7)
&gt; (From update of attachment 137332 [details] [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=137332&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/rendering/RenderBlock.cpp:3422
&gt; &gt; +    if (o-&gt;style()-&gt;position() == FixedPosition &amp;&amp; view())
&gt; 
&gt; I don&apos;t think this is right and you should definitely ask Dave Hyatt for a review of this patch. Two reasons::
&gt; 1) 99% of the time, fixed positioned objects are always added to their containing view.
&gt;     if (child-&gt;isPositioned()) {
&gt;         child-&gt;containingBlock()-&gt;insertPositionedObject(child);
&gt; and if you see containingBlock()
&gt; if (!isText() &amp;&amp; m_style-&gt;position() == FixedPosition) {
&gt;         while (o &amp;&amp; !o-&gt;isRenderView() &amp;&amp; !(o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock()))
&gt;             o = o-&gt;parent();
&gt; we would only return our containing view.
&gt; 2) There are some exceptions for cases like &lt;foreignObject&gt;. http://trac.webkit.org/changeset/119914
&gt; 
&gt; This call is just redundant and forces things to be always added to renderview which is incorrect for cases like &lt;foreignObject&gt;, etc.

This list is used for quickly identifying all the fixed position elements, so that we can mark them for layout, is that an incorrect way for doing that?
BTW, The same idea is used in http://opensource.apple.com/source/WebCore/WebCore-1298.39/rendering/RenderView.cpp (search for RenderView::setCustomFixedPositionedObjectsNeedLayout).
 Comment #10 From Abhishek Arya 2012-06-12 19:19:51 PST (-) [reply] 
(In reply to comment #9)
&gt; (In reply to comment #7)
&gt; &gt; (From update of attachment 137332 [details] [details] [details])
&gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=137332&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/rendering/RenderBlock.cpp:3422
&gt; &gt; &gt; +    if (o-&gt;style()-&gt;position() == FixedPosition &amp;&amp; view())
&gt; &gt; 
&gt; &gt; I don&apos;t think this is right and you should definitely ask Dave Hyatt for a review of this patch. Two reasons::
&gt; &gt; 1) 99% of the time, fixed positioned objects are always added to their containing view.
&gt; &gt;     if (child-&gt;isPositioned()) {
&gt; &gt;         child-&gt;containingBlock()-&gt;insertPositionedObject(child);
&gt; &gt; and if you see containingBlock()
&gt; &gt; if (!isText() &amp;&amp; m_style-&gt;position() == FixedPosition) {
&gt; &gt;         while (o &amp;&amp; !o-&gt;isRenderView() &amp;&amp; !(o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock()))
&gt; &gt;             o = o-&gt;parent();
&gt; &gt; we would only return our containing view.
&gt; &gt; 2) There are some exceptions for cases like &lt;foreignObject&gt;. http://trac.webkit.org/changeset/119914
&gt; &gt; 
&gt; &gt; This call is just redundant and forces things to be always added to renderview which is incorrect for cases like &lt;foreignObject&gt;, etc.
&gt; 
&gt; This list is used for quickly identifying all the fixed position elements, so that we can mark them for layout, is that an incorrect way for doing that?
&gt; BTW, The same idea is used in http://opensource.apple.com/source/WebCore/WebCore-1298.39/rendering/RenderView.cpp (search for RenderView::setCustomFixedPositionedObjectsNeedLayout).

Fixed position objects are already added to their RenderView in most cases. Why did you need to define insertFixedPositionedObject, removeFixedPositionedObject and call them in insertPositionedObject and removePositionedObject ? That part is wrong. you should see that all callers to insertPositionedObject are like child-&gt;containingBlock()-&gt;insertPositionedObject and read the containingBlock code

if (!isText() &amp;&amp; m_style-&gt;position() == FixedPosition) {
        while (o &amp;&amp; !o-&gt;isRenderView() &amp;&amp; !(o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock())) {
#if ENABLE(SVG)
            // foreignObject is the containing block for its contents.
            if (o-&gt;isSVGForeignObject())
                break;
#endif
            o = o-&gt;parent();
        }
    }

What you are doing here is causing redundant calls which will slow down insertPositionedObject and will cause it to be added in RenderView where it was not intended. e.g. o-&gt;hasTransform() &amp;&amp; o-&gt;isRenderBlock() AND o-&gt;isSVGForeignObject()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648681</commentid>
    <comment_count>3</comment_count>
      <attachid>147362</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-06-13 19:04:14 -0700</bug_when>
    <thetext>Comment on attachment 147362
Patch.

Clearing flags on attachment: 147362

Committed r120265: &lt;http://trac.webkit.org/changeset/120265&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648682</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-06-13 19:04:19 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>147362</attachid>
            <date>2012-06-13 10:53:43 -0700</date>
            <delta_ts>2012-06-13 19:04:14 -0700</delta_ts>
            <desc>Patch.</desc>
            <filename>89019.diff</filename>
            <type>text/plain</type>
            <size>3125</size>
            <attacher name="Yael">yael</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEyMDIyNCkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIyIEBACisyMDEyLTA2LTEzICBZYWVsIEFo
YXJvbiA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uZWRPYmplY3RzTGlzdEhhc2hTZXQpOwogCiAgICAgbV9wb3NpdGlvbmVkT2JqZWN0
cy0+YWRkKG8pOwotCi0gICAgaWYgKG8tPnN0eWxlKCktPnBvc2l0aW9uKCkgPT0gRml4ZWRQb3Np
dGlvbiAmJiB2aWV3KCkpCi0gICAgICAgIHZpZXcoKS0+aW5zZXJ0Rml4ZWRQb3NpdGlvbmVkT2Jq
ZWN0KG8pOwogfQogCiB2b2lkIFJlbmRlckJsb2NrOjpyZW1vdmVQb3NpdGlvbmVkT2JqZWN0KFJl
bmRlckJveCogbykKIHsKICAgICBpZiAobV9wb3NpdGlvbmVkT2JqZWN0cykKICAgICAgICAgbV9w
b3NpdGlvbmVkT2JqZWN0cy0+cmVtb3ZlKG8pOwotCi0gICAgaWYgKHZpZXcoKSkKLSAgICAgICAg
dmlldygpLT5yZW1vdmVGaXhlZFBvc2l0aW9uZWRPYmplY3Qobyk7CiB9CiAKIHZvaWQgUmVuZGVy
QmxvY2s6OnJlbW92ZVBvc2l0aW9uZWRPYmplY3RzKFJlbmRlckJsb2NrKiBvKQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>