<?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>218211</bug_id>
          
          <creation_ts>2020-10-26 15:55:02 -0700</creation_ts>
          <short_desc>RenderStyle::resetPadding sets incorrect computed value (auto)</short_desc>
          <delta_ts>2020-10-27 10:02:11 -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>WebKit 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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="alan">zalan</reporter>
          <assigned_to name="alan">zalan</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>changseok</cc>
    
    <cc>darin</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>glenn</cc>
    
    <cc>koivisto</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>pdr</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>1701662</commentid>
    <comment_count>0</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-26 15:55:02 -0700</bug_when>
    <thetext>should be 0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701664</commentid>
    <comment_count>1</comment_count>
      <attachid>412361</attachid>
    <who name="alan">zalan</who>
    <bug_when>2020-10-26 16:01:33 -0700</bug_when>
    <thetext>Created attachment 412361
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701665</commentid>
    <comment_count>2</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-26 16:02:17 -0700</bug_when>
    <thetext>Alternatively we could just set it to LengthBox(Fixed). Not sure what the preferred way is in RenderStyle.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701675</commentid>
    <comment_count>3</comment_count>
      <attachid>412361</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-10-26 16:33:35 -0700</bug_when>
    <thetext>Comment on attachment 412361
Patch

Is this testable with CSS reset?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701692</commentid>
    <comment_count>4</comment_count>
      <attachid>412361</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-10-26 17:09:40 -0700</bug_when>
    <thetext>Comment on attachment 412361
Patch

Does this have any effect?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701714</commentid>
    <comment_count>5</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-26 18:49:18 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #4)
&gt; Comment on attachment 412361 [details]
&gt; Patch
&gt; 
&gt; Does this have any effect?
Absolutely.

This is how in IFC we normally resolve the computed padding value (e.g. padding left):
 valueForLength(style.paddingLeft(), containingBlockWidth);
Now for the (incorrect)auto specified value, valueForLength returns the containingBlockWidth as opposed to the expected, initial value of 0.
(I noticed this after enabling &lt;select&gt; element in IFC. RenderTheme calls style.resetPadding() on the select renderer and when IFC resolves the computed value, it sees a non-zero padding left/right/top/bottom).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701717</commentid>
    <comment_count>6</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-26 18:59:26 -0700</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #3)
&gt; Comment on attachment 412361 [details]
&gt; Patch
&gt; 
&gt; Is this testable with CSS reset?
the unset? It does not seem to call resetPadding.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701846</commentid>
    <comment_count>7</comment_count>
      <attachid>412361</attachid>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2020-10-27 06:14:13 -0700</bug_when>
    <thetext>Comment on attachment 412361
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412361&amp;action=review

&gt; Source/WebCore/rendering/style/RenderStyle.h:1027
&gt; +    void resetPadding() { SET_VAR(m_surroundData, padding, LengthBox(initialPadding().intValue())); }

Just initialPadding()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701848</commentid>
    <comment_count>8</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-27 06:19:07 -0700</bug_when>
    <thetext>(In reply to Antti Koivisto from comment #7)
&gt; Comment on attachment 412361 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=412361&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/rendering/style/RenderStyle.h:1027
&gt; &gt; +    void resetPadding() { SET_VAR(m_surroundData, padding, LengthBox(initialPadding().intValue())); }
&gt; 
&gt; Just initialPadding()?
That was my initial attempt, but LengthBox does not take Length.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701853</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-10-27 06:28:45 -0700</bug_when>
    <thetext>Committed r269037: &lt;https://trac.webkit.org/changeset/269037&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 412361.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701854</commentid>
    <comment_count>10</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-10-27 06:29:21 -0700</bug_when>
    <thetext>&lt;rdar://problem/70719975&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701906</commentid>
    <comment_count>11</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-10-27 09:21:54 -0700</bug_when>
    <thetext>If this has an effect why isn’t a test case going from fail to pass?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701923</commentid>
    <comment_count>12</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2020-10-27 09:55:21 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #11)
&gt; If this has an effect why isn’t a test case going from fail to pass?
I should have been more specific. There&apos;s no effect on trunk yet because the rendering code is written in a way that the incorrect &apos;auto&apos; value gets resolved to 0.   

LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length&amp; padding) const
{
    LayoutUnit w;
    if (padding.isPercentOrCalculated())
        w = containingBlockLogicalWidthForContent();
    return minimumValueForLength(padding, w);
}
minimumValueForLength() returns 0 for auto values. 
The &quot;from fail to pass&quot; progression is behind a flag which is currently turned off on trunk (where we start exercising some more LFC code for inline content, specifically where LFC calls valueForLength(style.paddingLeft(), containingBlockWidth) to resolve the computed value.)
I could have waited with this fix until after we enabled the flag to show the progression but it looked like a valid correctness fix in itself (since &apos;auto&apos; is an incorrect value for padding).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1701931</commentid>
    <comment_count>13</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-10-27 10:02:11 -0700</bug_when>
    <thetext>(In reply to zalan from comment #12)
&gt; There&apos;s no effect on trunk yet because the
&gt; rendering code is written in a way that the incorrect &apos;auto&apos; value gets
&gt; resolved to 0.

OK.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>412361</attachid>
            <date>2020-10-26 16:01:33 -0700</date>
            <delta_ts>2020-10-27 06:28:46 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-218211-20201026160132.patch</filename>
            <type>text/plain</type>
            <size>1604</size>
            <attacher name="alan">zalan</attacher>
            
              <data encoding="base64">U3VidmV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