New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix margin size calculation for TableWrapper #13681
Conversation
@bors-servo try |
Fix margin size calculation for TableWrapper <!-- Please describe your changes on the following line: --> Fixes margin size calculation for TableWrapper. The table's width was always reaching the inline size equation solver as a specified variable, which was causing the system to be overdetermined when there was a margin specified for the table, and this caused the overflow reported in #12748. The fix consists in letting the width be a free variable when it's not specified, so that the solver calculates it properly in the presence or absense of margins. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12748 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13681) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
|
It seems there are more cases to handle, the tests are indeed broken. I'll take a look. |
r? @pcwalton |
@gpoesia Is it worth having someone else review the changes yet, or would you like to fix the failing tests first? |
Note that a lot of the table code is being rewritten in #13870. |
I think it'd be best to rebase this on top of #13870. I'll do that if you'd like. |
@pcwalton Thank you, I think rebasing makes sense. By now that PR was already merged, right? I can just rebase on top of master then. I should be able to debug this this week. |
Correct! |
I've came back to this. After rebasing, the same situation persists: the test I added fails in master but not with this change; however, other related tests are broken. I'll look into these others. |
The preferred size of all columns was always being used before, but this caused problems when it does not fit along with margins.
I've identified some more cases and updated the PR description to address them. The 2 test failures were fixed. I believe it is ready for review. |
@@ -778,7 +778,13 @@ fn initial_computed_inline_size(block: &mut BlockFlow, | |||
containing_block_inline_size); | |||
match inline_size_from_style { | |||
MaybeAuto::Auto => { | |||
MaybeAuto::Specified(min(containing_block_inline_size, preferred_width_of_all_columns)) | |||
if preferred_width_of_all_columns + table_border_padding <= containing_block_inline_size { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the idea of the preferred width is that nothing should be greater than it.
That being said, table layout is hard, and I'm probably not the best person to review this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I know why this is correct now, whoops. Wasn't really inspired the day I wrote this.
r? @mbrubeck |
@mbrubeck Review ping! |
@bors-servo r+
|
📌 Commit d7a9c3f has been approved by |
Fix margin size calculation for TableWrapper <!-- Please describe your changes on the following line: --> Fixes inline size calculation for TableWrapper. The table's width was always reaching the inline size equation solver as a specified variable, which was causing the system to be overdetermined when there was a margin specified for the table, and this caused the overflow reported in #12748. The fix consists in handling three cases when the table's width is not specified: if the preferred size of all columns fits, it is returned; if the minimum size does not fit, it is returned instead (it will overflow), otherwise, it is returned as a free variable (that should be solved together with the margin to some value above the minimum width and below the preferred width). --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12748 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13681) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
Fixes inline size calculation for TableWrapper. The table's width was always reaching the inline size equation solver as a specified variable, which was causing the system to be overdetermined when there was a margin specified for the table, and this caused the overflow reported in #12748. The fix consists in handling three cases when the table's width is not specified: if the preferred size of all columns fits, it is returned; if the minimum size does not fit, it is returned instead (it will overflow), otherwise, it is returned as a free variable (that should be solved together with the margin to some value above the minimum width and below the preferred width).
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is