<?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>221252</bug_id>
          
          <creation_ts>2021-02-02 04:46:55 -0800</creation_ts>
          <short_desc>Assertion failure in Debug build blocks webpage rendering</short_desc>
          <delta_ts>2021-02-09 04:47: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>WebKit Local Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=191962</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=166008</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eleni Maria Stea">estea</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>estea</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1724618</commentid>
    <comment_count>0</comment_count>
    <who name="Eleni Maria Stea">estea</who>
    <bug_when>2021-02-02 04:46:55 -0800</bug_when>
    <thetext>Overview:

Assertion failure from: ASSERT(willBeComposited == needsToBeComposited(layer, queryData)); in rendering/RenderLayerCompositor.cpp stops the rendering of some webpages in MiniBrowser in Debug builds. The reason seems to be that the layers are asynchronously updated since the time willBeComposited is set and needsToBeComposited is called, and so events like scrolling overflow can cause assertion failure. The assertion should be moved right after willBeComposited is set.

Steps to reproduce:
Build WPE/Webkit in Debug mode and run MiniBrowser with https://www.igalia.com. 

Results:
An empty page will be displayed.

Expected Result:
The webpage to be displayed.

Proposed Fix:
If the assertion is moved right after:

    if (layer.needsPostLayoutCompositingUpdate() || compositingState.fullPaintOrderTraversalRequired || compositingState.descendantsRequireCompositingUpdate) {
        layer.setIndirectCompositingReason(IndirectCompositingReason::None);
        willBeComposited = needsToBeComposited(layer, queryData);
    }
the page will appear fine in MiniBrowser.

Additional Information:
Bug was spotted on Linux/X11 using nested Weston and running MiniBrowser like this:
./run-wpe-x11 &lt;path_to_minibrowser_installdir&gt;MiniBrowser https://www.igalia.com</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724619</commentid>
    <comment_count>1</comment_count>
      <attachid>418983</attachid>
    <who name="Eleni Maria Stea">estea</who>
    <bug_when>2021-02-02 05:03:54 -0800</bug_when>
    <thetext>Created attachment 418983
proposed patch

Proposed patch: move the assertion before all other checks that might change the needsToBeComposited(layer, queryData) value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724717</commentid>
    <comment_count>2</comment_count>
      <attachid>418983</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-02-02 09:58:50 -0800</bug_when>
    <thetext>Comment on attachment 418983
proposed patch

The whole point of this assertion is to check that willBeComposited has the correct value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724888</commentid>
    <comment_count>3</comment_count>
    <who name="Eleni Maria Stea">estea</who>
    <bug_when>2021-02-02 14:23:07 -0800</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #2)
&gt; Comment on attachment 418983 [details]
&gt; proposed patch
&gt; 
&gt; The whole point of this assertion is to check that willBeComposited has the
&gt; correct value.

Thank you for your reply, 

What I tried to prevent by moving the assertion earlier was the case that needsToBeComposited() is different from willBeComposited value without that being a bug. I noticed that willBeComposited and needsToBeComposited have the same value at the beginning of the function but further down there are cases that change the value of the variable and so, the same check fails.

I thought that the willBeComposited changes were correctly made and so I assumed that the problem is that the assertion failure takes place too late after the changes.

My description was not so clear, sorry.

What are your thoughts on this?
Thanks in advance!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724900</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-02-02 14:37:38 -0800</bug_when>
    <thetext>If this assertion fires, it means that some state changed that affected the answer to needsToBeComposited() inside this function, which implies there&apos;s some side-effect. If willBeComposited does not match needsToBeComposited() then the behavior is wrong.

You should go looking for why needsToBeComposited() changes its answer unexpectedly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724910</commentid>
    <comment_count>5</comment_count>
    <who name="Eleni Maria Stea">estea</who>
    <bug_when>2021-02-02 15:05:34 -0800</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #4)
&gt; If this assertion fires, it means that some state changed that affected the
&gt; answer to needsToBeComposited() inside this function, which implies there&apos;s
&gt; some side-effect. If willBeComposited does not match needsToBeComposited()
&gt; then the behavior is wrong.
&gt; 
&gt; You should go looking for why needsToBeComposited() changes its answer
&gt; unexpectedly.

Alright, thank you very much! 

needsToBeComposited() was true because compositing was required for overflow scrolling (although I saw the assertion failure in some other cases too). I hadn&apos;t realized this is unexpected, I will investigate it further.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1727005</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-02-09 04:47:54 -0800</bug_when>
    <thetext>&lt;rdar://problem/74138081&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>418983</attachid>
            <date>2021-02-02 05:03:54 -0800</date>
            <delta_ts>2021-02-02 09:58:50 -0800</delta_ts>
            <desc>proposed patch</desc>
            <filename>0001-rendering-Moved-assertion-that-was-blocking-the-rend.patch</filename>
            <type>text/plain</type>
            <size>2057</size>
            <attacher name="Eleni Maria Stea">estea</attacher>
            
              <data encoding="base64">RnJvbSA4NDc0YTNiNThhZjgxYmU3YzMxNmQxNTBiODUyNGFjMTQ1MjQ3M2JhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBFbGVuaSBNYXJpYSBTdGVhIDxlc3RlYUBpZ2FsaWEuY29tPgpE
YXRlOiBUdWUsIDIgRmViIDIwMjEgMTM6MjU6MzYgKzAyMDAKU3ViamVjdDogW1BBVENIXSByZW5k
ZXJpbmc6IE1vdmVkIGFzc2VydGlvbiB0aGF0IHdhcyBibG9ja2luZyB0aGUgcmVuZGVyaW5nIGlu
CiBEZWJ1ZyBtb2RlCgp3aWxsQmVDb21wb3NpdGVkIGNhbiBtYXRjaCBuZWVkc1RvQmVDb21wb3Np
dGVkIG9ubHkgcmlnaHQgYWZ0ZXIgaXMgc2V0LgpJZiB0aGUgY2hlY2sgaXMgcGVyZm9ybWVkIGxh
dGVyIGFzeW5jaHJvbm91cyBldmVudHMgbGlrZSBzY3JvbGxpbmcKb3ZlcmZsb3cgbWlnaHQgaGF2
ZSBhbHRlciBuZWVkc1RvQmVDb21wb3NpdGVkIHJldHVybiB2YWx1ZS4KCkZpeDogaHR0cHM6Ly9i
dWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTIyMTI1MgoKUGxlYXNlIGVudGVyIHRoZSBj
b21taXQgbWVzc2FnZSBmb3IgeW91ciBjaGFuZ2VzLiBMaW5lcyBzdGFydGluZwotLS0KIFNvdXJj
ZS9XZWJDb3JlL3JlbmRlcmluZy9SZW5kZXJMYXllckNvbXBvc2l0b3IuY3BwIHwgNCArKy0tCiAx
IGZpbGUgY2hhbmdlZCwgMiBpbnNlcnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdp
dCBhL1NvdXJjZS9XZWJDb3JlL3JlbmRlcmluZy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Y2tpbmdTaGFyaW5nU3RhdGUuYXBwZW5kU2hhcmluZ0xheWVyKGxh
eWVyKTsKQEAgLTExMjMsOCArMTEyNSw2IEBAIHZvaWQgUmVuZGVyTGF5ZXJDb21wb3NpdG9yOjpj
b21wdXRlQ29tcG9zaXRpbmdSZXF1aXJlbWVudHMoUmVuZGVyTGF5ZXIqIGFuY2VzdG9yCiAjZW5k
aWYKICAgICB9CiAKLSAgICBBU1NFUlQod2lsbEJlQ29tcG9zaXRlZCA9PSBuZWVkc1RvQmVDb21w
b3NpdGVkKGxheWVyLCBxdWVyeURhdGEpKTsKLQogICAgIC8vIENyZWF0ZSBvciBkZXN0cm95IGJh
Y2tpbmcgaGVyZS4gSG93ZXZlciwgd2UgY2FuJ3QgdXBkYXRlIGdlb21ldHJ5IGJlY2F1c2UgbGF5
ZXJzIGFib3ZlIHVzIG1heSBiZWNvbWUgY29tcG9zaXRlZAogICAgIC8vIGR1cmluZyBwb3N0LW9y
ZGVyIHRyYXZlcnNhbCAoZS5nLiBmb3IgY2xpcHBpbmcpLgogICAgIGlmICh1cGRhdGVCYWNraW5n
KGxheWVyLCBxdWVyeURhdGEsICZiYWNraW5nU2hhcmluZ1N0YXRlLCB3aWxsQmVDb21wb3NpdGVk
ID8gQmFja2luZ1JlcXVpcmVkOjpZZXMgOiBCYWNraW5nUmVxdWlyZWQ6Ok5vKSkgewotLSAKMi4z
MC4wCgo=
</data>
<flag name="review"
          id="437152"
          type_id="1"
          status="-"
          setter="simon.fraser"
    />
          </attachment>
      

    </bug>

</bugzilla>