<?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>311064</bug_id>
          
          <creation_ts>2026-03-29 22:51:08 -0700</creation_ts>
          <short_desc>Table with fixed-height cells and border-spacing doesn&apos;t respect specified height</short_desc>
          <delta_ts>2026-04-27 22:50:30 -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>Tables</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>226002</dup_id>
          
          <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="Karl Dubost">karlcow</reporter>
          <assigned_to name="Karl Dubost">karlcow</assigned_to>
          <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2195002</commentid>
    <comment_count>0</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-03-29 22:51:08 -0700</bug_when>
    <thetext>A table with height: 500px, border-spacing: 0 50px, and two rows with fixed-height cells (td { height: 20px }) renders at 418px in Safari instead of the specified 500px. Chrome and
Firefox both correctly render the table at 500px.

The root cause is in RenderTableSection::distributeRemainingExtraLogicalHeight (RenderTableSection.cpp). The function distributes extra height proportionally using m_rowPos[totalRows]
  as the denominator, but this value includes the initial m_rowPos[0] offset which is set to vBorderSpacing() for the top section. The code has a FIXME acknowledging this:

// FIXME: m_rowPos[totalRows] - m_rowPos[0] is the total rows&apos; size.
LayoutUnit totalRowSize = m_rowPos[totalRows];

The sum of all row-slice numerators in the loop equals m_rowPos[totalRows] - m_rowPos[0], which is less than the denominator m_rowPos[totalRows]. This means a fraction of the extra
height proportional to m_rowPos[0] / m_rowPos[totalRows] is never distributed, leaving the table shorter than specified.

For the test case: m_rowPos is [50, 120, 190]. The extra height to distribute is 500 - 190 = 310px. The sum of numerators is (120-50) + (190-120) = 140, but the denominator is 190.
Only 310 * 140/190 ≈ 228px gets distributed, yielding a final height of 190 + 228 = 418px instead of 500px.

The fix is to change the denominator to m_rowPos[totalRows] - m_rowPos[0], matching what the FIXME describes.

Steps to Reproduce:
1. Create a table with height: 500px; border-spacing: 0 50px; border: none
2. Add two rows with td { height: 20px }
3. Compare table height across browsers

Expected: Table renders at 500px (Chrome, Firefox behavior)
Actual: Table renders at 418px in Safari</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195003</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-03-29 22:51:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/173665148&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195004</commentid>
    <comment_count>2</comment_count>
      <attachid>478838</attachid>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-03-29 22:52:41 -0700</bug_when>
    <thetext>Created attachment 478838
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195006</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-03-29 23:12:58 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61659</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2205249</commentid>
    <comment_count>4</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-04-27 22:50:30 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 226002 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>478838</attachid>
            <date>2026-03-29 22:52:41 -0700</date>
            <delta_ts>2026-03-29 22:52:41 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>bug02-table-height-border-spacing.html</filename>
            <type>text/html</type>
            <size>1617</size>
            <attacher name="Karl Dubost">karlcow</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPG1ldGEgY2hhcnNldD0idXRmLTgiPgo8dGl0
bGU+VGFibGUgaGVpZ2h0IG5vdCByZXNwZWN0ZWQgd2l0aCBib3JkZXItc3BhY2luZyBhbmQgZml4
ZWQtaGVpZ2h0IGNlbGxzPC90aXRsZT4KPHN0eWxlPgogICN0YWJsZXRlc3QgewogICAgaGVpZ2h0
OiA1MDBweDsKICAgIHdpZHRoOiAyMDBweDsKICAgIGJvcmRlci1zcGFjaW5nOiAwIDUwcHg7CiAg
ICBib3JkZXI6IG5vbmU7CiAgICBiYWNrZ3JvdW5kOiBvcmFuZ2U7CiAgfQogICN0YWJsZXRlc3Qg
dGQgewogICAgaGVpZ2h0OiAyMHB4OwogICAgYmFja2dyb3VuZDogbGlnaHRibHVlOwogICAgcGFk
ZGluZzogMDsKICB9Cjwvc3R5bGU+CjwvaGVhZD4KPGJvZHk+CjxoMz5UYWJsZSBoZWlnaHQgbm90
IHJlc3BlY3RlZCB3aXRoIGJvcmRlci1zcGFjaW5nIGFuZCBmaXhlZC1oZWlnaHQgY2VsbHM8L2gz
Pgo8cD5UaGUgdGFibGUgaGFzIDxjb2RlPmhlaWdodDogNTAwcHg8L2NvZGU+IGFuZCA8Y29kZT5i
b3JkZXItc3BhY2luZzogMCA1MHB4PC9jb2RlPgp3aXRoIHR3byBmaXhlZC1oZWlnaHQgY2VsbHMg
KDxjb2RlPnRkIHsgaGVpZ2h0OiAyMHB4IH08L2NvZGU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