RESOLVED FIXED 202991
[LFC][TFC] Add support for colgroup/col
https://bugs.webkit.org/show_bug.cgi?id=202991
Summary [LFC][TFC] Add support for colgroup/col
zalan
Reported 2019-10-15 09:30:35 PDT
<col>'s width attribute can drive the preferred width of the table column (trac uses this)
Attachments
Patch (6.94 KB, patch)
2019-10-15 09:38 PDT, zalan
no flags
Radar WebKit Bug Importer
Comment 1 2019-10-15 09:30:59 PDT
zalan
Comment 2 2019-10-15 09:38:58 PDT
Antti Koivisto
Comment 3 2019-10-15 09:42:48 PDT
Comment on attachment 380994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380994&action=review > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:182 > + const Box* colgroup = nullptr; > + // Table caption is an optional element; if used, it is always the first child of a <table>. > + if (firstChild->isTableCaption()) > + tableCaption = firstChild; > + // The <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. > + auto* colgroupCandidate = firstChild; > + if (tableCaption) > + colgroupCandidate = tableCaption->nextSibling(); > + if (colgroupCandidate->isTableColumnGroup()) > + colgroup = colgroupCandidate; You might want to factor finding captions and colgroups into functions.
zalan
Comment 4 2019-10-15 09:46:53 PDT
(In reply to Antti Koivisto from comment #3) > Comment on attachment 380994 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=380994&action=review > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:182 > > + const Box* colgroup = nullptr; > > + // Table caption is an optional element; if used, it is always the first child of a <table>. > > + if (firstChild->isTableCaption()) > > + tableCaption = firstChild; > > + // The <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. > > + auto* colgroupCandidate = firstChild; > > + if (tableCaption) > > + colgroupCandidate = tableCaption->nextSibling(); > > + if (colgroupCandidate->isTableColumnGroup()) > > + colgroup = colgroupCandidate; > > You might want to factor finding captions and colgroups into functions. good idea
zalan
Comment 5 2019-10-15 09:57:53 PDT
(In reply to zalan from comment #4) > (In reply to Antti Koivisto from comment #3) > > Comment on attachment 380994 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=380994&action=review > > > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:182 > > > + const Box* colgroup = nullptr; > > > + // Table caption is an optional element; if used, it is always the first child of a <table>. > > > + if (firstChild->isTableCaption()) > > > + tableCaption = firstChild; > > > + // The <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. > > > + auto* colgroupCandidate = firstChild; > > > + if (tableCaption) > > > + colgroupCandidate = tableCaption->nextSibling(); > > > + if (colgroupCandidate->isTableColumnGroup()) > > > + colgroup = colgroupCandidate; > > > > You might want to factor finding captions and colgroups into functions. > > good idea Though, as a second thought, this is the only time when we need traverse the layout tree in the table code (layout uses the grid and not the tree).
Antti Koivisto
Comment 6 2019-10-15 10:01:50 PDT
Comment on attachment 380994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380994&action=review >>>> Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:182 >>>> + colgroup = colgroupCandidate; >>> >>> You might want to factor finding captions and colgroups into functions. >> >> good idea > > Though, as a second thought, this is the only time when we need traverse the layout tree in the table code (layout uses the grid and not the tree). Lambdas!
zalan
Comment 7 2019-10-15 10:04:59 PDT
(In reply to Antti Koivisto from comment #6) > Comment on attachment 380994 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=380994&action=review > > >>>> Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:182 > >>>> + colgroup = colgroupCandidate; > >>> > >>> You might want to factor finding captions and colgroups into functions. > >> > >> good idea > > > > Though, as a second thought, this is the only time when we need traverse the layout tree in the table code (layout uses the grid and not the tree). > > Lambdas! I love lambdas!
WebKit Commit Bot
Comment 8 2019-10-15 10:31:43 PDT
Comment on attachment 380994 [details] Patch Clearing flags on attachment: 380994 Committed r251147: <https://trac.webkit.org/changeset/251147>
WebKit Commit Bot
Comment 9 2019-10-15 10:31:44 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.