Bug 51362 - box-sizing: border-box and percentage heights double-count border and padding width when in a table cell
Summary: box-sizing: border-box and percentage heights double-count border and padding...
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL: data:text/html,<!doctype html><table>...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-20 16:14 PST by Tab Atkins
Modified: 2022-07-12 13:11 PDT (History)
11 users (show)

See Also:


Attachments
Screenshot of provided data: url. (642 bytes, image/png)
2010-12-20 16:16 PST, Tab Atkins
no flags Details
Safari 15.5 matches other browsers (520.97 KB, image/png)
2022-07-12 12:52 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tab Atkins 2010-12-20 16:14:55 PST
Chrome Version       : 8.0.552.224 (Official Build 68599) beta

URLs (if applicable) : data:text/html,<!doctype html><table><tr><td style="height: 80px; border: 1px solid black; padding: 0;"><div style="height: 100%; background: silver; -webkit-box-sizing: border-box; border: 5px solid;">foo</div>

Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5: didn't test
  Firefox 3.x: OK
       IE 7/8: N/A (doesn't support box-sizing)


What steps will reproduce the problem?
--------------------------------------
1. Create a table, where a cell contains an element with box-sizing:border-box, percentage height (for ease of viewing, use 100%), and a non-zero border or padding.  The cell should have a definite height set that is larger than the element.


What is the expected result?
----------------------------
With height:100%, the element should fill the cell exactly.


What happens instead?
---------------------
The vertical borders or padding are double-counted when figuring the height of the element, so, for example, in the provided data url there is 5px of empty space above and below the element's borders.
Comment 1 Tab Atkins 2010-12-20 16:16:11 PST
Created attachment 77048 [details]
Screenshot of provided data: url.
Comment 2 Simon Fraser (smfr) 2010-12-20 16:33:14 PST
Confirmed, happens in Safari 5 too.
Comment 3 Simon Fraser (smfr) 2010-12-20 16:47:03 PST
Place to start looking is RenderTableSection::layoutRows().
Comment 4 Ahmad Saleem 2022-07-12 12:52:44 PDT
Created attachment 460820 [details]
Safari 15.5 matches other browsers

I am unable to reproduce this bug using test case from Description and URL field in Safari 15.5 on macOS 12.4.

I changed the test case into following JSFiddle:

Link - https://jsfiddle.net/3qz2t1ah/show

Later, as can be seen from attached screenshot, Safari renders the output same as other browser and does not show behavior similar to attached reference screenshot.

I think it was fixed along the way and now can be marked as "RESOLVED CONFIGURATION CHANGED". In case, if I am testing incorrectly, please test accordingly. Thanks!
Comment 5 Ryosuke Niwa 2022-07-12 13:11:04 PDT
Thanks for testing.