Bug 202991 - [LFC][TFC] Add support for colgroup/col
Summary: [LFC][TFC] Add support for colgroup/col
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-15 09:30 PDT by zalan
Modified: 2019-10-15 10:31 PDT (History)
6 users (show)

See Also:


Attachments
Patch (6.94 KB, patch)
2019-10-15 09:38 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2019-10-15 09:30:35 PDT
<col>'s width attribute can drive the preferred width of the table column (trac uses this)
Comment 1 Radar WebKit Bug Importer 2019-10-15 09:30:59 PDT
<rdar://problem/56294715>
Comment 2 zalan 2019-10-15 09:38:58 PDT
Created attachment 380994 [details]
Patch
Comment 3 Antti Koivisto 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.
Comment 4 zalan 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
Comment 5 zalan 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).
Comment 6 Antti Koivisto 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!
Comment 7 zalan 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!
Comment 8 WebKit Commit Bot 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>
Comment 9 WebKit Commit Bot 2019-10-15 10:31:44 PDT
All reviewed patches have been landed.  Closing bug.