REOPENED99861
RenderTableCol::computePreferredLogicalWidths should never be called
https://bugs.webkit.org/show_bug.cgi?id=99861
Summary RenderTableCol::computePreferredLogicalWidths should never be called
Julien Chaffraix
Reported 2012-10-19 11:59:16 PDT
<col> and <colgroup> don't really have the concept of preferred logical widths as they have no content. We use their styling information to size the cell's logical width. There are several (forceful) calls to RenderTableCol::computePreferredLogicalWidths in the code because we need to propagate any preferred logical widths dirtying to the table but that's just artificial. Forwarding any layout hint to the table would remove some clunky code inside table. Patch forthcoming.
Attachments
Proposed change: Enforced that RenderTableCol::computePreferredLogicalWidths is never called, forward any layout hint to the table and clean-up AutoTableLayout.cpp. (12.84 KB, patch)
2012-10-19 12:13 PDT, Julien Chaffraix
no flags
Updated patch: also changed layout(). Added a test for a case the previous patch broke. (20.98 KB, patch)
2012-10-22 12:05 PDT, Julien Chaffraix
no flags
Patch for landing (20.93 KB, patch)
2012-10-22 15:02 PDT, Julien Chaffraix
no flags
Updated change: removed ASSERT_NOT_REACHED() from layout() as simplified normal flow layout hit it. (21.13 KB, patch)
2012-10-25 09:53 PDT, Julien Chaffraix
no flags
Patch for landing (23.03 KB, patch)
2012-10-26 03:29 PDT, Julien Chaffraix
no flags
Updated patch: Removed the layout() change as we need to clear up the review flag or trip on some ASSERT. (20.98 KB, patch)
2012-10-31 10:08 PDT, Julien Chaffraix
no flags
Julien Chaffraix
Comment 1 2012-10-19 12:13:26 PDT
Created attachment 169670 [details] Proposed change: Enforced that RenderTableCol::computePreferredLogicalWidths is never called, forward any layout hint to the table and clean-up AutoTableLayout.cpp.
WebKit Review Bot
Comment 2 2012-10-20 02:01:07 PDT
Comment on attachment 169670 [details] Proposed change: Enforced that RenderTableCol::computePreferredLogicalWidths is never called, forward any layout hint to the table and clean-up AutoTableLayout.cpp. Attachment 169670 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14456848 New failing tests: fast/table/border-collapsing/cached-change-colgroup-border-width.html
Julien Chaffraix
Comment 3 2012-10-22 08:23:40 PDT
(In reply to comment #2) > (From update of attachment 169670 [details]) > Attachment 169670 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/14456848 > > New failing tests: > fast/table/border-collapsing/cached-change-colgroup-border-width.html The pixel difference is a regression. We are now repainting the whole table instead of just the colgroup. This is due to LayoutRepainter picking up the layout cue.
Julien Chaffraix
Comment 4 2012-10-22 11:31:17 PDT
While fiddling around, I found out that we also call layout() on our table col / colgroup. We should be consistent between the 2 methods so we should also patch layout().
Julien Chaffraix
Comment 5 2012-10-22 12:05:45 PDT
Created attachment 169952 [details] Updated patch: also changed layout(). Added a test for a case the previous patch broke.
Ojan Vafai
Comment 6 2012-10-22 12:10:51 PDT
Comment on attachment 169952 [details] Updated patch: also changed layout(). Added a test for a case the previous patch broke. View in context: https://bugs.webkit.org/attachment.cgi?id=169952&action=review > Source/WebCore/rendering/RenderTable.cpp:381 > + // We ignore table col / colgroup in this iteration as they are used to size the cell's widths during auto / fixed table layout. s/as they are/as they are only/ ? > Source/WebCore/rendering/RenderTableCol.cpp:136 > + // Also we don't clear any flags, which may never mark the table. Don't understand this sentence. Please clarify.
Julien Chaffraix
Comment 7 2012-10-22 13:53:37 PDT
Comment on attachment 169952 [details] Updated patch: also changed layout(). Added a test for a case the previous patch broke. View in context: https://bugs.webkit.org/attachment.cgi?id=169952&action=review >> Source/WebCore/rendering/RenderTable.cpp:381 >> + // We ignore table col / colgroup in this iteration as they are used to size the cell's widths during auto / fixed table layout. > > s/as they are/as they are only/ ? Sure. >> Source/WebCore/rendering/RenderTableCol.cpp:136 >> + // Also we don't clear any flags, which may never mark the table. > > Don't understand this sentence. Please clarify. Will change it to: // Also we don't clear the needs layout / preferred logical widths dirty flags so the marking logic may never reach the table. I hope this is clearer.
Ojan Vafai
Comment 8 2012-10-22 14:00:33 PDT
Comment on attachment 169952 [details] Updated patch: also changed layout(). Added a test for a case the previous patch broke. View in context: https://bugs.webkit.org/attachment.cgi?id=169952&action=review >>> Source/WebCore/rendering/RenderTableCol.cpp:136 >>> + // Also we don't clear any flags, which may never mark the table. >> >> Don't understand this sentence. Please clarify. > > Will change it to: > > // Also we don't clear the needs layout / preferred logical widths dirty flags so the marking logic may never reach the table. > > I hope this is clearer. I still don't see what this says that the above comment doesn't. Not a big deal.
Julien Chaffraix
Comment 9 2012-10-22 14:43:33 PDT
Comment on attachment 169952 [details] Updated patch: also changed layout(). Added a test for a case the previous patch broke. View in context: https://bugs.webkit.org/attachment.cgi?id=169952&action=review >>>> Source/WebCore/rendering/RenderTableCol.cpp:136 >>>> + // Also we don't clear any flags, which may never mark the table. >>> >>> Don't understand this sentence. Please clarify. >> >> Will change it to: >> >> // Also we don't clear the needs layout / preferred logical widths dirty flags so the marking logic may never reach the table. >> >> I hope this is clearer. > > I still don't see what this says that the above comment doesn't. Not a big deal. OK, let's remove it then.
Julien Chaffraix
Comment 10 2012-10-22 15:02:26 PDT
Created attachment 169995 [details] Patch for landing
WebKit Review Bot
Comment 11 2012-10-22 15:40:30 PDT
Comment on attachment 169995 [details] Patch for landing Clearing flags on attachment: 169995 Committed r132149: <http://trac.webkit.org/changeset/132149>
WebKit Review Bot
Comment 12 2012-10-22 15:40:35 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 13 2012-10-23 02:45:18 PDT
Re-opened since this is blocked by bug 100098
Julien Chaffraix
Comment 14 2012-10-25 09:53:09 PDT
Created attachment 170678 [details] Updated change: removed ASSERT_NOT_REACHED() from layout() as simplified normal flow layout hit it.
Ojan Vafai
Comment 15 2012-10-25 10:17:39 PDT
Comment on attachment 170678 [details] Updated change: removed ASSERT_NOT_REACHED() from layout() as simplified normal flow layout hit it. View in context: https://bugs.webkit.org/attachment.cgi?id=170678&action=review Would be nice if you could add a targetted test for the simplified layout case as well. I realize the inspector tests hit that code accidentally, but it'd be nice to cover it explicitly. Not a big deal. > LayoutTests/fast/table/col-span-change-relayout.html:41 > + { > + var col = document.getElementById('column'); > + var oldCellWidth = getComputedStyle(document.getElementById('table')).width; > + col.setAttribute("span", "1"); > + var newCellWidth = getComputedStyle(document.getElementById('table')).width; > + > + log("Table width was " + oldCellWidth); > + log("Table width is " + newCellWidth); > + if (oldCellWidth != newCellWidth) > + log("PASSED: Table changed width"); > + else > + log("FAILED: Table did not change width"); > + } FWIW, you could make this a check-layout.js change. function changeColSpan() { document.getElementById('table').setAttribute('data-expected-width', 300); checkLayout('table'); document.getElementById('table').setAttribute('data-expected-width', 200); checkLayout('table'); } I find that easier to read, also, I prefer for it to say the exact width's expected. These shouldn't be platform dependent in anyway, so we should be able to make this test stricter.
Julien Chaffraix
Comment 16 2012-10-26 03:28:30 PDT
Comment on attachment 170678 [details] Updated change: removed ASSERT_NOT_REACHED() from layout() as simplified normal flow layout hit it. View in context: https://bugs.webkit.org/attachment.cgi?id=170678&action=review > Would be nice if you could add a targetted test for the simplified layout case as well. I realize the inspector tests hit that code accidentally, but it'd be nice to cover it explicitly. Not a big deal. Totally agree, added a test to cover that. >> LayoutTests/fast/table/col-span-change-relayout.html:41 >> + } > > FWIW, you could make this a check-layout.js change. > > function changeColSpan() > { > document.getElementById('table').setAttribute('data-expected-width', 300); > checkLayout('table'); > document.getElementById('table').setAttribute('data-expected-width', 200); > checkLayout('table'); > } > > I find that easier to read, also, I prefer for it to say the exact width's expected. These shouldn't be platform dependent in anyway, so we should be able to make this test stricter. Done.
Julien Chaffraix
Comment 17 2012-10-26 03:29:00 PDT
Created attachment 170871 [details] Patch for landing
WebKit Review Bot
Comment 18 2012-10-26 04:14:02 PDT
Comment on attachment 170871 [details] Patch for landing Clearing flags on attachment: 170871 Committed r132612: <http://trac.webkit.org/changeset/132612>
WebKit Review Bot
Comment 19 2012-10-26 04:14:07 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 20 2012-10-26 06:07:07 PDT
Re-opened since this is blocked by bug 100512
Julien Chaffraix
Comment 21 2012-10-31 09:55:56 PDT
Not doing a fake layout pass would trigger an ASSERT on one test. This means that the layout() part of the change is not that great (we could still keep the current behavior in debug but that feels bad). Will post an - hopefully - final patch without the layout() part of the change. It will be landed tomorrow if the EWS are fine and no one objects.
Julien Chaffraix
Comment 22 2012-10-31 10:08:47 PDT
Created attachment 171677 [details] Updated patch: Removed the layout() change as we need to clear up the review flag or trip on some ASSERT.
Julien Chaffraix
Comment 23 2013-01-22 18:02:38 PST
Comment on attachment 171677 [details] Updated patch: Removed the layout() change as we need to clear up the review flag or trip on some ASSERT. Ojan landed a change that goes in the same direction for RenderTableCol::computePreferredLogicalWidths in bug 106931.
Ahmad Saleem
Comment 24 2022-08-18 09:57:14 PDT
Is this still required? Because Comment 23 mentioned that another bug was able to tackle same issue as this bug and this one landed in Comment 19 but cause regressions (from Comment 20). Appreciate if someone can mark this bug accordingly. Thanks!
Note You need to log in before you can comment on or make changes to this bug.