REOPENED 52185
Cell heights are disproportional when a row-spanning cell contains a block element that determines the height of the rows
https://bugs.webkit.org/show_bug.cgi?id=52185
Summary Cell heights are disproportional when a row-spanning cell contains a block el...
Ryosuke Niwa
Reported 2011-01-10 18:15:35 PST
<table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="border: 1px #F00 solid;">1</td> <td rowspan="3"> <div style="background: #AEE; width: 100px; height: 200px;"></div> </td> </tr> <tr><td style="border: 1px #0F0 solid;">2</td></tr> <tr><td style="border: 1px #00F solid;">3</td></tr> </table> And only the cell with 3 stretches to the end but we expect each cell to have the same height.
Attachments
Patch (959.77 KB, patch)
2013-04-29 09:11 PDT, Suchit Agrawal
no flags
Patch (959.81 KB, patch)
2013-04-29 22:01 PDT, Suchit Agrawal
no flags
Patch (962.36 KB, patch)
2013-04-30 00:00 PDT, Suchit Agrawal
no flags
Patch (959.86 KB, patch)
2013-04-30 00:14 PDT, Suchit Agrawal
no flags
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (788.81 KB, application/zip)
2013-04-30 05:35 PDT, Build Bot
no flags
Patch (965.97 KB, patch)
2013-05-02 07:57 PDT, Suchit Agrawal
no flags
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion (562.54 KB, application/zip)
2013-05-02 09:42 PDT, Build Bot
no flags
Patch (966.86 KB, patch)
2013-05-02 21:56 PDT, Suchit Agrawal
no flags
Patch (967.64 KB, patch)
2013-05-03 03:13 PDT, Suchit Agrawal
no flags
Patch (967.64 KB, patch)
2013-05-03 03:28 PDT, Suchit Agrawal
no flags
Patch (967.79 KB, patch)
2013-05-13 00:21 PDT, Suchit Agrawal
no flags
Patch (967.78 KB, patch)
2013-05-13 00:27 PDT, Suchit Agrawal
no flags
Patch (930.84 KB, patch)
2013-05-30 06:24 PDT, Suchit Agrawal
beidson: review-
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2 (554.78 KB, application/zip)
2013-05-30 06:53 PDT, Build Bot
no flags
Safari 15.5 differs from other browsers (502.64 KB, image/png)
2022-07-26 10:38 PDT, Ahmad Saleem
no flags
Peter Kasting
Comment 1 2011-01-10 18:18:13 PST
Note: WebKit's behavior here doesn't match IE/Fx.
Julien Chaffraix
Comment 2 2012-02-17 11:05:21 PST
For the record, I spend some time investigating this bug and here is the analysis. It's not a trivial bug to fix as our current rowspan algorithm is too simple. We just add the extra rowspan height to the last row of a rowspan which matches other browsers in some cases but not all cases. To properly implement that, I think we need to do something akin to FF and implement a 2 pass-algorithm: one without the rowspans and then we patch the logical heights to account for them. See nsTableRowGroupFrame::CalculateRowHeights and more importantly http://mxr.mozilla.org/mozilla-central/source/layout/tables/nsTableRowGroupFrame.cpp#682 about how FF handles rowspans.
Suchit Agrawal
Comment 3 2013-04-29 09:11:07 PDT
EFL EWS Bot
Comment 4 2013-04-29 09:19:58 PDT
EFL EWS Bot
Comment 5 2013-04-29 09:26:20 PDT
Suchit Agrawal
Comment 6 2013-04-29 09:39:09 PDT
(In reply to comment #3) > Created an attachment (id=200020) [details] > Patch Cells heights are not proper when rowspan cell have its own height which is more then the height of the rows under rowspan. After calculating the logical height, we need to recalculate height of rows under rowspan. After calculating logical height of the rows in the table, we are recalculating the height of the rows those are under rowspan. Based on the ratio of row's logical height, we are distributing rowspan cell height in the rows under rowspan. We are storing all cell which have rowspan and then we are rearraging them in the order in which we need to calculate the height. First rowspan cell in the table processed first but if any nested rowspan cell present then it will be calculated first. If 2 or more rowspan cell have same start index and end index then only one rowspan cell will be processed which would have highest height. After sorting them in the order, we are processing one by one rowspan cell : 1. We takes the heights of rows in rowspan. 2. if any row contains only rowspan cells then height of that row will be zero then in this case, we are taking one part of the rowspan cell height. 3. Based on the ratio, we calculate new height of the rows if rowspan height is more then total rows height in the rowspan. Beth, some time back, we had submiited the patch for bug 18092, that code is removed because that code logic is moved down for fixing this bug.
Suchit Agrawal
Comment 7 2013-04-29 09:41:14 PDT
Beth, Please review this patch and share your comment. Thanks.
Build Bot
Comment 8 2013-04-29 09:45:32 PDT
Build Bot
Comment 9 2013-04-29 10:45:00 PDT
Tim Horton
Comment 10 2013-04-29 15:56:00 PDT
Comment on attachment 200020 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=200020&action=review > Source/WebCore/ChangeLog:12 > + fter calculating logical height of the rows in the table, we are recalculating the height fter?
Suchit Agrawal
Comment 11 2013-04-29 17:29:25 PDT
(In reply to comment #10) > (From update of attachment 200020 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=200020&action=review > > > Source/WebCore/ChangeLog:12 > > + fter calculating logical height of the rows in the table, we are recalculating the height > > fter? > It is 'After'. By mistake it happened.
Suchit Agrawal
Comment 12 2013-04-29 22:01:03 PDT
Suchit Agrawal
Comment 13 2013-04-29 22:03:44 PDT
(In reply to comment #12) > Created an attachment (id=200080) [details] > Patch > Changes in previous patch for compilation issue on mac and efl.
Suchit Agrawal
Comment 14 2013-04-30 00:00:46 PDT
Suchit Agrawal
Comment 15 2013-04-30 00:02:58 PDT
(In reply to comment #14) > Created an attachment (id=200084) [details] > Patch > Fixed compilation issue on mac and efl,
Suchit Agrawal
Comment 16 2013-04-30 00:14:23 PDT
Suchit Agrawal
Comment 17 2013-04-30 02:37:48 PDT
(In reply to comment #16) > Created an attachment (id=200086) [details] > Patch > With this patch, WebKit behaves same as IE and Firefox. In some cases Firefox is not doing well.
Build Bot
Comment 18 2013-04-30 05:35:34 PDT
Comment on attachment 200086 [details] Patch Attachment 200086 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/238830 New failing tests: fast/table/table-rowspan-height-distribution-in-rows.html accessibility/table-attributes.html fast/css/vertical-align-baseline-rowspan-010.html fast/css/vertical-align-baseline-rowspan-002.htm css2.1/20110323/table-height-algorithm-012.htm fast/css/vertical-align-baseline-rowspan-001.htm fast/css/vertical-align-baseline-rowspan-008.htm fast/css/vertical-align-baseline-rowspan-005.htm accessibility/table-cells.html fast/css/vertical-align-baseline-rowspan-011.html fast/css/vertical-align-baseline-rowspan-007.htm fast/css/vertical-align-baseline-rowspan-006.htm
Build Bot
Comment 19 2013-04-30 05:35:38 PDT
Created attachment 200101 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.2
Suchit Agrawal
Comment 20 2013-05-01 17:40:54 PDT
(In reply to comment #17) > (In reply to comment #16) > > Created an attachment (id=200086) [details] [details] > > Patch > > > With this patch, WebKit behaves same as IE and Firefox. In some cases Firefox is not doing well. > Hello Beth, Please check the patch and share your comments. Thanks you
Suchit Agrawal
Comment 21 2013-05-02 07:57:45 PDT
Suchit Agrawal
Comment 22 2013-05-02 08:05:14 PDT
(In reply to comment #21) > Created an attachment (id=200316) [details] > Patch > Handled baseline issue in the patch. Now all failed test cases are working fine. Updated some of the test cases those are required. fast/css/vertical-align-baseline-rowspan-007.htm Purpose of this above test case is not valid now. I compared the result with IE and FF. So I updated the test case and its reference test case. This test case does not have any purpose now so we can remove it also.
Build Bot
Comment 23 2013-05-02 09:42:54 PDT
Comment on attachment 200316 [details] Patch Attachment 200316 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/290163 New failing tests: fast/table/table-rowspan-height-distribution-in-rows.html accessibility/table-cells.html accessibility/table-attributes.html
Build Bot
Comment 24 2013-05-02 09:42:58 PDT
Created attachment 200320 [details] Archive of layout-test-results from webkit-ews-03 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-03 Port: mac-mountainlion Platform: Mac OS X 10.8.2
Suchit Agrawal
Comment 25 2013-05-02 10:18:23 PDT
(In reply to comment #23) > (From update of attachment 200316 [details]) > Attachment 200316 [details] did not pass mac-ews (mac): > Output: http://webkit-queues.appspot.com/results/290163 > > New failing tests: > fast/table/table-rowspan-height-distribution-in-rows.html > accessibility/table-cells.html > accessibility/table-attributes.html > First test case is newly added for this patch. Other two test cases need to be rebaseline.
Suchit Agrawal
Comment 26 2013-05-02 21:56:42 PDT
Suchit Agrawal
Comment 27 2013-05-02 21:58:07 PDT
(In reply to comment #26) > Created an attachment (id=200387) [details] > Patch > Rebaseline failed test cases in previous patch.
Dave Hyatt
Comment 28 2013-05-02 22:43:36 PDT
Comment on attachment 200387 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=200387&action=review Looks pretty good. A couple of comments. > Source/WebCore/rendering/RenderTableSection.cpp:279 > + Vector<RenderTableCell*> rowspanCells; This should be rowSpanCells (capitalize the S). I imagine this is empty or small most of the time, so maybe give it a small inline capacity, e.g., Vector<RenderTableCell*, 2> rowSpanCells; > Source/WebCore/rendering/RenderTableSection.cpp:346 > + if (rowspanCells.size() > 0) { We should pull all this code into a helper function rather than making calcRowLogicalHeight so much bigger and just call the helper function if rowspanCells is non-empty. if (!rowSpanCells.isEmpty()) callHelperFunction(rowSpanCells);
Suchit Agrawal
Comment 29 2013-05-03 03:13:27 PDT
Suchit Agrawal
Comment 30 2013-05-03 03:28:52 PDT
Suchit Agrawal
Comment 31 2013-05-03 03:33:46 PDT
(In reply to comment #28) > (From update of attachment 200387 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=200387&action=review > > Looks pretty good. A couple of comments. > > > Source/WebCore/rendering/RenderTableSection.cpp:279 > > + Vector<RenderTableCell*> rowspanCells; > > This should be rowSpanCells (capitalize the S). > > I imagine this is empty or small most of the time, so maybe give it a small inline capacity, e.g., > 3-4 rowSpan cells are very common so I used 5 for inline capacity. > Vector<RenderTableCell*, 2> rowSpanCells; > > > Source/WebCore/rendering/RenderTableSection.cpp:346 > > + if (rowspanCells.size() > 0) { > > We should pull all this code into a helper function rather than making calcRowLogicalHeight so much bigger and just call the helper function if rowspanCells is non-empty. > > if (!rowSpanCells.isEmpty()) > callHelperFunction(rowSpanCells); > I put all this code in new function 'distributeRowSpanHeightToRows()' and did changes as per your comment.
Dave Hyatt
Comment 32 2013-05-10 13:24:42 PDT
Comment on attachment 200405 [details] Patch r=me with some trepidation. Please be prepared for regressions if/when they do occur.
WebKit Commit Bot
Comment 33 2013-05-10 13:34:37 PDT
Comment on attachment 200405 [details] Patch Rejecting attachment 200405 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-03', 'apply-attachment', '--no-update', '--non-interactive', 200405, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: g file LayoutTests/platform/qt/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt patching file LayoutTests/platform/qt/tables/mozilla_expected_failures/bugs/bug6933-expected.txt patching file LayoutTests/tables/mozilla/core/bloomberg-expected.txt patching file LayoutTests/tables/mozilla_expected_failures/bugs/bug23847-expected.txt Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'David Hyatt']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.appspot.com/results/339371
WebKit Commit Bot
Comment 34 2013-05-12 22:05:06 PDT
Comment on attachment 200405 [details] Patch Rejecting attachment 200405 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'apply-attachment', '--no-update', '--non-interactive', 200405, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: g file LayoutTests/platform/qt/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt patching file LayoutTests/platform/qt/tables/mozilla_expected_failures/bugs/bug6933-expected.txt patching file LayoutTests/tables/mozilla/core/bloomberg-expected.txt patching file LayoutTests/tables/mozilla_expected_failures/bugs/bug23847-expected.txt Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'David Hyatt']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.appspot.com/results/464150
Suchit Agrawal
Comment 35 2013-05-13 00:21:30 PDT
Suchit Agrawal
Comment 36 2013-05-13 00:27:10 PDT
Suchit Agrawal
Comment 37 2013-05-13 00:31:31 PDT
Comment on attachment 201537 [details] Patch This patch is already reviewed by David Hyatt and it is just rebaseline again.
WebKit Commit Bot
Comment 38 2013-05-13 11:16:20 PDT
Comment on attachment 201537 [details] Patch Clearing flags on attachment: 201537 Committed r150023: <http://trac.webkit.org/changeset/150023>
WebKit Commit Bot
Comment 39 2013-05-13 11:16:27 PDT
All reviewed patches have been landed. Closing bug.
David Kilzer (:ddkilzer)
Comment 40 2013-05-14 12:42:52 PDT
(In reply to comment #38) > (From update of attachment 201537 [details]) > Clearing flags on attachment: 201537 > > Committed r150023: <http://trac.webkit.org/changeset/150023> This caused a regression: Bug 116118: REGRESSION (r150023): Table cells on buildbot waterfall page are squashed
David Kilzer (:ddkilzer)
Comment 41 2013-05-14 12:46:56 PDT
(In reply to comment #40) > (In reply to comment #38) > > (From update of attachment 201537 [details] [details]) > > Clearing flags on attachment: 201537 > > > > Committed r150023: <http://trac.webkit.org/changeset/150023> > > This caused a regression: > > Bug 116118: REGRESSION (r150023): Table cells on buildbot waterfall page are squashed r150023 also causes crashes on some buildbot pages (happened on an internal Safari buildbot page): Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.WebCore 0x000000010ccf6e82 WebCore::RenderTableSection::distributeRowSpanHeightToRows(WTF::Vector<WebCore::RenderTableCell*, 5ul, WTF::CrashOnOverflow>&) + 2402 1 com.apple.WebCore 0x000000010c280dab WebCore::RenderTableSection::calcRowLogicalHeight() + 1755 2 com.apple.WebCore 0x000000010c27c9eb WebCore::RenderTable::layout() + 747 3 com.apple.WebCore 0x000000010cc31733 WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 723 4 com.apple.WebCore 0x000000010cc2d8cb WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 747 5 com.apple.WebCore 0x000000010cc2cd61 WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1041 6 com.apple.WebCore 0x000000010c1f9bf4 WebCore::RenderBlock::layout() + 52 7 com.apple.WebCore 0x000000010cc31733 WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 723 8 com.apple.WebCore 0x000000010cc2d8cb WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 747 9 com.apple.WebCore 0x000000010cc2cd61 WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1041 10 com.apple.WebCore 0x000000010c1f9bf4 WebCore::RenderBlock::layout() + 52 11 com.apple.WebCore 0x000000010cc31733 WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 723 12 com.apple.WebCore 0x000000010cc2d8cb WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 747 13 com.apple.WebCore 0x000000010cc2cd61 WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1041 14 com.apple.WebCore 0x000000010c1f9bf4 WebCore::RenderBlock::layout() + 52 15 com.apple.WebCore 0x000000010cc31733 WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 723 16 com.apple.WebCore 0x000000010cc2d8cb WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 747 17 com.apple.WebCore 0x000000010cc2cd61 WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1041 18 com.apple.WebCore 0x000000010c1f9bf4 WebCore::RenderBlock::layout() + 52 19 com.apple.WebCore 0x000000010c1f9b32 WebCore::RenderView::layout() + 1186 20 com.apple.WebCore 0x000000010c1f8e25 WebCore::FrameView::layout(bool) + 1765 21 com.apple.WebCore 0x000000010c1eee4e WebCore::Document::implicitClose() + 750 22 com.apple.WebCore 0x000000010c1eeae1 WebCore::FrameLoader::checkCompleted() + 337 23 com.apple.WebCore 0x000000010c63ee52 WebCore::CachedResourceLoader::loadDone(WebCore::CachedResource*) + 66 24 com.apple.WebCore 0x000000010cdc2462 WebCore::SubresourceLoader::releaseResources() + 82 25 com.apple.WebCore 0x000000010c2506dd WebCore::SubresourceLoader::didFinishLoading(double) + 189 […]
WebKit Commit Bot
Comment 42 2013-05-14 12:53:44 PDT
Re-opened since this is blocked by bug 116120
Suchit Agrawal
Comment 43 2013-05-30 06:24:22 PDT
Suchit Agrawal
Comment 44 2013-05-30 06:34:04 PDT
(In reply to comment #43) > Created an attachment (id=203348) [details] > Patch Fix regression issues and tested. There was problem in rearranging rowSpan cells and small modification in calculating row height.
Suchit Agrawal
Comment 45 2013-05-30 06:39:48 PDT
(In reply to comment #44) > (In reply to comment #43) > > Created an attachment (id=203348) [details] [details] > > Patch > > Fix regression issues and tested. There was problem in rearranging rowSpan cells and small modification in calculating row height. Also divided a big function (distributeRowSpanHeightToRows) into small-small functions : distributeRowSpanHeightToRows() findEffectiveColsBetweenRows() numberOfRowSpanCellsInRow() updateRowsPosWithChangedHeight() getRowsHeightInRowSpan() distributeRowSpanHeightToRows()
Build Bot
Comment 46 2013-05-30 06:53:40 PDT
Comment on attachment 203348 [details] Patch Attachment 203348 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/684165 New failing tests: fast/dom/location-new-window-no-crash.html
Build Bot
Comment 47 2013-05-30 06:53:45 PDT
Created attachment 203350 [details] Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-15 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.3
Suchit Agrawal
Comment 48 2013-09-27 01:37:43 PDT
I have divided this patch in small-small test case and landed in blink. First patch gives many regression and following next patches fix all the regressions. I want to land those patched here also. If it is OK then I can start putting one by one patch.
Brady Eidson
Comment 49 2016-05-24 21:38:41 PDT
Comment on attachment 203348 [details] Patch r- to clear stale patches from the review queue
Ahmad Saleem
Comment 50 2022-07-26 10:38:54 PDT
Created attachment 461225 [details] Safari 15.5 differs from other browsers I am able to reproduce this bug in Safari 15.6 on macOS 12.5 using test case from Comment 0 converted into following JSFiddle: Link - https://jsfiddle.net/u1kg9s8n/show As can be seen from the attached screenshot, Safari 15.6 on macOS 12.5 differs from other browsers (Chrome Canary 106 and Firefox Nightly 104). Just wanted to update latest testing results. Thanks!
Radar WebKit Bug Importer
Comment 51 2022-07-26 19:45:45 PDT
Note You need to log in before you can comment on or make changes to this bug.