Bug 110515 - Clean up computePreferredLogicalWidths functions in TableLayout subclasses
Summary: Clean up computePreferredLogicalWidths functions in TableLayout subclasses
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ojan Vafai
URL:
Keywords:
Depends on:
Blocks: 110520
  Show dependency treegraph
 
Reported: 2013-02-21 14:57 PST by Ojan Vafai
Modified: 2013-02-22 11:38 PST (History)
9 users (show)

See Also:


Attachments
Patch (5.72 KB, patch)
2013-02-21 15:00 PST, Ojan Vafai
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ojan Vafai 2013-02-21 14:57:54 PST
Clean up computePreferredLogicalWidths functions in TableLayout subclasses
Comment 1 Ojan Vafai 2013-02-21 15:00:41 PST
Created attachment 189606 [details]
Patch
Comment 2 Tony Chang 2013-02-21 15:36:48 PST
Does this work with bug 109462?  Maybe Julien should review this patch :)
Comment 3 Ojan Vafai 2013-02-21 15:39:19 PST
(In reply to comment #2)
> Does this work with bug 109462?  Maybe Julien should review this patch :)

As best I can tell, the two patches are totally orthogonal.
Comment 4 Ojan Vafai 2013-02-21 15:39:44 PST
Also, this patch does not cause any change in behavior. It's just moving code around.
Comment 5 Tony Chang 2013-02-21 17:00:06 PST
Comment on attachment 189606 [details]
Patch

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

> Source/WebCore/rendering/AutoTableLayout.cpp:261
> -    Length tableLogicalWidth = m_table->style()->logicalWidth();
> -    if (tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive()) {
> -        minWidth = max<int>(minWidth, tableLogicalWidth.value());
> -        maxWidth = minWidth;
> -    } else if (!remainingPercent && maxNonPercent) {
> -        // if there was no remaining percent, maxWidth is invalid
> +    // if there was no remaining percent, maxWidth is invalid
> +    if (!remainingPercent && maxNonPercent)
>          maxWidth = tableMaxWidth;
> -    }
> +
> +    Length tableLogicalWidth = m_table->style()->logicalWidth();
> +    if (tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive())
> +        minWidth = maxWidth = max<int>(minWidth, tableLogicalWidth.value());

I would revert this section of the patch.  It doesn't seem equally readable and it's slower.

> Source/WebCore/rendering/FixedTableLayout.cpp:82
> +    // FIXME: we might want to wait until we have all of the first row before computing for the first time.

Nit: Capitalize the first letter of the sentence.
Comment 6 Ojan Vafai 2013-02-21 19:13:45 PST
Committed r143683: <http://trac.webkit.org/changeset/143683>
Comment 7 Julien Chaffraix 2013-02-21 20:51:08 PST
Comment on attachment 189606 [details]
Patch

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

The change is good, sorry for the delay.

(In reply to comment #3)
> (In reply to comment #2)
> > Does this work with bug 109462?  Maybe Julien should review this patch :)
> 
> As best I can tell, the two patches are totally orthogonal.

They are indeed. However you make the assumption that r130774 which cause bug 109462 is there to cover your back and properly apply min-width / max-width to the result of computePreferredLogicalWidths thus making it difficult to revert the change.

> Source/WebCore/rendering/FixedTableLayout.cpp:182
> +    minWidth = maxWidth = calcWidthArray() + bordersPaddingAndSpacing;

WebKit style is one assignment per line (though I couldn't find an entry in our coding style). That would make this line a lot more readable IMO.

> Source/WebCore/rendering/FixedTableLayout.cpp:186
> +        minWidth = maxWidth = max<int>(minWidth, tableLogicalWidth.value() - bordersPaddingAndSpacing);

Ditto.
Comment 8 Ojan Vafai 2013-02-22 11:38:56 PST
(In reply to comment #7)
> > Source/WebCore/rendering/FixedTableLayout.cpp:182
> > +    minWidth = maxWidth = calcWidthArray() + bordersPaddingAndSpacing;
> 
> WebKit style is one assignment per line (though I couldn't find an entry in our coding style). That would make this line a lot more readable IMO.

Discussed this on bug 110520.