Bug 80671 - Split the extra logical height distribution logic out of RenderTableSection::layoutRows
Summary: Split the extra logical height distribution logic out of RenderTableSection::...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tables (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-08 19:37 PST by Julien Chaffraix
Modified: 2012-03-09 14:58 PST (History)
4 users (show)

See Also:


Attachments
Proposed refactoring. (9.25 KB, patch)
2012-03-08 19:43 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff
Same change, nits removed. (9.36 KB, patch)
2012-03-09 12:09 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2012-03-08 19:37:49 PST
Currently it's this logic is inlined in the function which makes it longer than it should be.

Also the naming doesn't help understanding what is going on in the function at the moment.

Patch forthcoming.
Comment 1 Julien Chaffraix 2012-03-08 19:43:53 PST
Created attachment 130956 [details]
Proposed refactoring.
Comment 2 Adrienne Walker 2012-03-09 11:34:05 PST
Comment on attachment 130956 [details]
Proposed refactoring.

View in context: https://bugs.webkit.org/attachment.cgi?id=130956&action=review

In terms of correctness, this looks fine to me.

> Source/WebCore/rendering/RenderTableSection.cpp:475
> +    if (extraLogicalHeight > 0 && m_rowPos[totalRows]) {

nit: maybe make this an early out for extra clarity.

> Source/WebCore/rendering/RenderTableSection.cpp:479
> +        int tot = m_rowPos[totalRows];
> +        int add = 0;
> +        int prev = m_rowPos[0];

style nit: I realize you're just moving this code, but don't use abbreviations like "tot" and "prev".

> Source/WebCore/rendering/RenderTableSection.cpp:499
> +    if (m_rowPos[totalRows] || !nextSibling()) {

nit: maybe an early return here too.

> Source/WebCore/rendering/RenderTableSection.cpp:511
> +        remainingExtraLogicalHeight = distributeExtraLogicalHeightToPercentRows(remainingExtraLogicalHeight, totalPercent);
> +        remainingExtraLogicalHeight = distributeExtraLogicalHeightToAutoRows(remainingExtraLogicalHeight, autoRowsCount);

The previous code had checks for totalPercent == 0 and autoRowsCount == 0, which avoided a needless iteration through all of the rows.  Is that worth keeping?
Comment 3 Julien Chaffraix 2012-03-09 11:49:21 PST
Comment on attachment 130956 [details]
Proposed refactoring.

View in context: https://bugs.webkit.org/attachment.cgi?id=130956&action=review

>> Source/WebCore/rendering/RenderTableSection.cpp:511
>> +        remainingExtraLogicalHeight = distributeExtraLogicalHeightToAutoRows(remainingExtraLogicalHeight, autoRowsCount);
> 
> The previous code had checks for totalPercent == 0 and autoRowsCount == 0, which avoided a needless iteration through all of the rows.  Is that worth keeping?

Yes, autoRowsCount == 0 is handled inside distributeExtraLogicalHeightToAutoRows, however I forgot to keep the totalPercent check while cleaning the code. As a side note, a table usually doesn't have a lot of sections AFAICT but it's better not to slow down in case it does.
Comment 4 Julien Chaffraix 2012-03-09 12:09:18 PST
Created attachment 131069 [details]
Same change, nits removed.
Comment 5 Adrienne Walker 2012-03-09 12:10:54 PST
Comment on attachment 131069 [details]
Same change, nits removed.

Looks good to me!
Comment 6 WebKit Review Bot 2012-03-09 14:58:22 PST
Comment on attachment 131069 [details]
Same change, nits removed.

Clearing flags on attachment: 131069

Committed r110336: <http://trac.webkit.org/changeset/110336>
Comment 7 WebKit Review Bot 2012-03-09 14:58:26 PST
All reviewed patches have been landed.  Closing bug.