Skip to content
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

Merged
merged 1 commit into from Jan 23, 2017
Merged

Conversation

gpoesia
Copy link
Contributor

@gpoesia gpoesia commented Oct 10, 2016

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).



This change is Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 10, 2016
@stshine
Copy link
Contributor

stshine commented Oct 10, 2016

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 0a58c02 with merge fdaa83b...

bors-servo pushed a commit that referenced this pull request Oct 10, 2016
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 -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Oct 11, 2016
@highfive
Copy link

  ▶ FAIL [expected PASS] /_mozilla/css/absolute_table.html
  └   → /_mozilla/css/absolute_table.html ea33457f5a0be954e631e2bfebd8e73d5ea50566
/_mozilla/css/absolute_table_ref.html a040509b94135f47321dc6bacea999e81134f506
Testing ea33457f5a0be954e631e2bfebd8e73d5ea50566 == a040509b94135f47321dc6bacea999e81134f506

  ▶ FAIL [expected PASS] /_mozilla/css/table_center_a.html
  └   → /_mozilla/css/table_center_a.html 6b896b0d738a5413787db958265d6ff974922287
/_mozilla/css/table_center_ref.html 640c1955fd195c4c5b10fde093c74a5ab578720e
Testing 6b896b0d738a5413787db958265d6ff974922287 == 640c1955fd195c4c5b10fde093c74a5ab578720e

@gpoesia
Copy link
Contributor Author

gpoesia commented Oct 11, 2016

It seems there are more cases to handle, the tests are indeed broken. I'll take a look.

@cbrewster
Copy link
Contributor

r? @pcwalton

@highfive highfive assigned pcwalton and unassigned cbrewster Oct 12, 2016
@jdm
Copy link
Member

jdm commented Oct 25, 2016

@gpoesia Is it worth having someone else review the changes yet, or would you like to fix the failing tests first?

@emilio
Copy link
Member

emilio commented Oct 25, 2016

Note that a lot of the table code is being rewritten in #13870.

@pcwalton
Copy link
Contributor

I think it'd be best to rebase this on top of #13870. I'll do that if you'd like.

@gpoesia
Copy link
Contributor Author

gpoesia commented Oct 31, 2016

@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.

@jdm
Copy link
Member

jdm commented Oct 31, 2016

Correct!

@jdm jdm added S-needs-rebase There are merge conflict errors. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 31, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Dec 19, 2016
@gpoesia
Copy link
Contributor Author

gpoesia commented Dec 19, 2016

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.
@gpoesia
Copy link
Contributor Author

gpoesia commented Dec 31, 2016

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 {
Copy link
Member

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.

Copy link
Member

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.

@emilio
Copy link
Member

emilio commented Dec 31, 2016

r? @mbrubeck

@highfive highfive assigned mbrubeck and unassigned pcwalton Dec 31, 2016
@jdm
Copy link
Member

jdm commented Jan 19, 2017

@mbrubeck Review ping!

@KiChjang KiChjang removed the S-needs-rebase There are merge conflict errors. label Jan 19, 2017
@mbrubeck
Copy link
Contributor

@bors-servo r+

  • Thanks, and sorry for the delay!

@bors-servo
Copy link
Contributor

📌 Commit d7a9c3f has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 23, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit d7a9c3f with merge b0f9119...

bors-servo pushed a commit that referenced this pull request Jan 23, 2017
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 -->
@bors-servo
Copy link
Contributor

@bors-servo bors-servo merged commit d7a9c3f into servo:master Jan 23, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wikipedia page wrong layout
10 participants