<?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>52832</bug_id>
          
          <creation_ts>2011-01-20 12:24:38 -0800</creation_ts>
          <short_desc>New float positioning is O(k*n^2) for n k-height floats</short_desc>
          <delta_ts>2023-09-28 07:05:35 -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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></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>mitz</reporter>
          <assigned_to name="Dave Hyatt">hyatt</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>hyatt</cc>
    
    <cc>joepeck</cc>
    
    <cc>koivisto</cc>
    
    <cc>sam</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>337502</commentid>
    <comment_count>0</comment_count>
    <who name="">mitz</who>
    <bug_when>2011-01-20 12:24:38 -0800</bug_when>
    <thetext>&lt;rdar://problem/8534202&gt;

Positioning a single new float is pretty bad. It is as bad as O(k*n) where n is the number of already-placed floats and k is the height of the last float. The *RelOffset() is O(n) and the inner while loop in positionNewFloats() can end up calling *RelOffset() up to k times, since strangely if there are no interfering floats on one side, the remainingHeight for that side is set to 1, and so we advance k times. That’s just bizarre. So we end up with positioning n floats being O(k*n^2).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>371588</commentid>
    <comment_count>1</comment_count>
      <attachid>86497</attachid>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2011-03-22 13:26:18 -0700</bug_when>
    <thetext>Created attachment 86497
This would help?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1980696</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-09-27 16:03:56 -0700</bug_when>
    <thetext>@Alan - is this optimisation still applicable or required?

We don&apos;t have it applied:

https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderBlockFlow.cpp#2721

if (RenderStyle::usedFloat(childBox) == UsedFloat::Left) {
        LayoutUnit heightRemainingLeft = 1_lu;
        LayoutUnit heightRemainingRight = 1_lu;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1980950</commentid>
    <comment_count>3</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2023-09-28 07:05:35 -0700</bug_when>
    <thetext>This change may not help too much anymore as most of the floats are positioned by LFC&apos;s FloatingContext but the bug report may still be valid (for the new float code).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>86497</attachid>
            <date>2011-03-22 13:26:18 -0700</date>
            <delta_ts>2011-03-22 13:26:18 -0700</delta_ts>
            <desc>This would help?</desc>
            <filename>patch.txt</filename>
            <type>text/plain</type>
            <size>1389</size>
            <attacher name="Dave Hyatt">hyatt</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL3JlbmRlcmluZy9SZW5kZXJCbG9jay5jcHAKPT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PQotLS0gU291cmNlL1dlYkNvcmUvcmVuZGVyaW5nL1JlbmRlckJsb2NrLmNwcAkocmV2aXNpb24g
ODE2OTEpCisrK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