<?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>285576</bug_id>
          
          <creation_ts>2025-01-07 21:40:13 -0800</creation_ts>
          <short_desc>REGRESSION(282648@main): A tweet with 12000+ emojis takes Safari forever to display</short_desc>
          <delta_ts>2025-10-10 15:46:27 -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>DOM</component>
          <version>Safari 18</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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>cueball045</reporter>
          <assigned_to name="Said Abou-Hallawa">sabouhallawa</assigned_to>
          <cc>fantasai.bugs</cc>
    
    <cc>karlcow</cc>
    
    <cc>rniwa</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>vitor.roriz</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2085702</commentid>
    <comment_count>0</comment_count>
    <who name="">cueball045</who>
    <bug_when>2025-01-07 21:40:13 -0800</bug_when>
    <thetext>A reply[1] to this parent tweet[2] shows some crab emojis. On clicking &quot;Show more&quot;, Safari takes a good upwards of 10 seconds to open and show the entire tweet.
Firefox and Chrome are much snappier in comparison (this also could be because I tested this on a new launch of these browsers but I was using Safari with multiple tabs already).
Regardless, I would not expect Safari to be so laggy. The tweet has 12,090 🦀 emojis which is roughly 48.36 KB.

Steps to reproduce:
1. Visit the parent tweet[2]
2. Scroll down to find a comment by the account @Jonathan_Blow which is just lots of 🦀.
3. Click &quot;Show more&quot;.

[1] https://x.com/Jonathan_Blow/status/1876748466908787124
[2] https://x.com/ThePrimeagen/status/1876739118350111093</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086179</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-09 13:24:23 -0800</bug_when>
    <thetext>&lt;rdar://problem/142638658&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086181</commentid>
    <comment_count>2</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2025-01-09 13:28:33 -0800</bug_when>
    <thetext>It looks like we are busy with appending all those images elements to DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086275</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2025-01-09 23:39:34 -0800</bug_when>
    <thetext>I&apos;ve confirmed that the tweet in question (https://x.com/Jonathan_Blow/status/1876748466908787124) almost instantly loads at 282640@main.

We&apos;re spending most of our time inside elementTextDirectionState and in particular, looking up dir attribute in Element::findAttributeByName.

I&apos;m having a trouble making a reproduction out of it though. Naively appending a bunch of img elements like this doesn&apos;t seem to fully replicate the pathology:

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;
&lt;style&gt; img { width: 1.2em; height: 1.2em; } &lt;/style&gt;
&lt;div id=&quot;container&quot; dir=&quot;auto&quot; lang=&quot;qme&quot;&gt;&lt;p id=&quot;tail&quot; dir=&quot;ltr&quot;&gt;tail&lt;/p&gt;&lt;/div&gt;
&lt;script&gt;

onload = () =&gt; {
  requestAnimationFrame(() =&gt; {
    for (let i = 0; i &lt; 12000; ++i) {
      const img = document.createElement(&apos;img&apos;);
      img.alt = &apos;🦀&apos;;
      img.src = &apos;https://abs-0.twimg.com/emoji/v2/svg/1f980.svg&apos;;
      img.setAttribute(&apos;draggable&apos;, &apos;false&apos;);
      img.setAttribute(&apos;class&apos;, &apos;r-4qtqp9 r-dflpy8 r-k4bwe5 r-1kpi4qh r-pp5qcn r-h9hxbl&apos;);
      container.insertBefore(img, tail);
    }
  });
}

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2120843</commentid>
    <comment_count>4</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2025-05-30 17:33:42 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/46151</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2150078</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-10-10 15:46:24 -0700</bug_when>
    <thetext>Committed 301333@main (50da6f725760): &lt;https://commits.webkit.org/301333@main&gt;

Reviewed commits have been landed. Closing PR #46151 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>