<?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>234193</bug_id>
          
          <creation_ts>2021-12-10 21:40:44 -0800</creation_ts>
          <short_desc>Page doesn&apos;t draw content if a &lt;style&gt; tag with a Google Fonts @import rule is removed during the DOMContentLoaded event</short_desc>
          <delta_ts>2022-02-12 18:58:24 -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>Text</component>
          <version>Safari 15</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 12</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Neil Jhaveri">neil</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>mitz</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1823165</commentid>
    <comment_count>0</comment_count>
      <attachid>446861</attachid>
    <who name="Neil Jhaveri">neil</who>
    <bug_when>2021-12-10 21:40:44 -0800</bug_when>
    <thetext>Created attachment 446861
Simplified test case

Page doesn&apos;t draw content if a &lt;style&gt; tag with a font @import is removed during the DOMContentLoaded event

STEPS TO REPRODUCE:
- Open the attached test.html file in Safari

RESULTS:
- Expect to see lines of text in sans-serif font
- Actual: Text isn&apos;t painted at all

NOTES:
- It takes a few seconds, but the page is scrollable
- Text can be selected and copied, even though it&apos;s not painted

CONFIGURATION
Safari 15.1 (17612.2.9.1.20)
macOS 12.0.1 (21A559)
MacBookPro18,1 (16&quot; M1 Pro)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823597</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-12-13 10:20:21 -0800</bug_when>
    <thetext>Confirmed that this reproduces in Safari, does not reproduce in Chrome.

This is clearly a bug, and seems to have the workaround of &quot;just don&apos;t do this&quot;. Could you please clarify if it&apos;s important in some way?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823632</commentid>
    <comment_count>2</comment_count>
    <who name="Neil Jhaveri">neil</who>
    <bug_when>2021-12-13 10:57:05 -0800</bug_when>
    <thetext>Sure, happy to give context. In an email client, when replying to certain messages (e.g. with Google fonts imports), the compose window&apos;s web view was drawing blank (this bug).

When replying to or forwarding a message, the client takes the original message&apos;s text/html part, inserts it into a `&lt;blockquote&gt;`, and loads this into a `WKWebView`. During load, there is logic to inline styles resulting from `&lt;style&gt;` and `&lt;link&gt;` elements in the quoted text, and remove them from the DOM, so they don&apos;t impact the style of newly-typed text above the quote block. This is done as early as possible (e.g. during `DOMContentLoaded`) to avoid visual flicker.

For now, I have deferred the removal of `&lt;style&gt;` elements with @imports until the `load` event fires, which works around this issue. However, it has the trade-off of seeing some possible &quot;flicker&quot; on screen because `&lt;style&gt;` element removal has been deferred. I haven&apos;t fully investigated if there are any other good approaches to solving this general style-inlining problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1825306</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-12-17 21:41:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/86661749&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1840788</commentid>
    <comment_count>4</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-02-12 18:58:24 -0800</bug_when>
    <thetext>This should now be fixed in STP 139, iOS 15.4 Beta, and macOS 12.3 Beta.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>446861</attachid>
            <date>2021-12-10 21:40:44 -0800</date>
            <delta_ts>2021-12-10 21:40:44 -0800</delta_ts>
            <desc>Simplified test case</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>620</size>
            <attacher name="Neil Jhaveri">neil</attacher>
            
              <data encoding="base64">PGh0bWw+Cgk8aGVhZD4KCQk8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CgkJCS8vIFdp
dGggdGhpcyBET01Db250ZW50TG9hZGVkIGxpc3RlbmVyLCB0aGUgcGFnZSB3aWxsIG5vdCBwYWlu
dC4KCQkJLy8gTm90ZTogSWYgc3dpdGNoZWQgdG8gdGhlIHdpbmRvdydzICJsb2FkIiBldmVudCwg
dGhlIHBhZ2UgcGFpbnRzIGZpbmUuCgkJCWRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoIkRPTUNv
bnRlbnRMb2FkZWQiLCAoKSA9PiB7CgkJCQlkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJzdHlsZSIp
LnJlbW92ZSgpOwoJCQl9KTsKCQk8L3NjcmlwdD4KCQk8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJ
CQlAaW1wb3J0IHVybChodHRwczovL2ZvbnRzLmdvb2dsZWFwaXMuY29tL2Nzcz9mYW1pbHk9T3Bl
bitTYW5zOjMwMCw0MDAsNTAwLDYwMCw3MDApOwoJCTwvc3R5bGU+Cgk8L2hlYWQ+CgoJPGJvZHkg
c3R5bGU9ImZvbnQtZmFtaWx5OiAmcXVvdDtPcGVuIFNhbnMmcXVvdDssIHNhbnMtc2VyaWY7Ij4K
CQlUZXN0PGJyPlRlc3Q8YnI+VGVzdDxicj5UZXN0PGJyPlRlc3Q8YnI+VGVzdDxicj5UZXN0PGJy
PlRlc3Q8YnI+VGVzdDxicj5UZXN0PGJyPlRlc3Q8YnI+Cgk8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>