Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement flexible box layout for row container #12330
Conversation
highfive
commented
Jul 8, 2016
|
There a several concerns for this pull request. One is that previously every method involves a vtable lookup, so I add a style field and clone the style of the flow to it, but I am not very sure what the price is. |
|
ping @pcwalton |
|
(tracking #12453) |
|
Review status: 0 of 1 files reviewed at latest revision, 2 unresolved discussions. components/layout/flex.rs, line 145 [r1] (raw file):
Will the style ever change after we clone it (e.g. by JavaScript)? Do we need to sync it up with the style side? components/layout/flex.rs, line 222 [r1] (raw file):
We could just Comments from Reviewable |
|
Disclaimer: I don't have the right to r+ yet, just providing some feedback. |
|
Review status: 0 of 1 files reviewed at latest revision, 3 unresolved discussions. components/layout/flex.rs, line 145 [r1] (raw file):
|
May I ask your general opinion about this pull request? If you think this pull request is acceptable, I will make other PRs that depend on this. |
| /// The 'order' property of this item. | ||
| pub order: i32, | ||
| /// Whether the main size has met its constraint. | ||
| pub is_freezed: bool, |
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| /// Return the outer main size of the item, including paddings and margins, | ||
| /// clamped by max and min size. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
stshine
Jul 19, 2016
Author
Contributor
All these methods exists as the result of refactoring the method of obtaining a line in flexbox. Both this and the adjustment issues remain here because I previously do margin and padding calculation in outer_main_size() . This point is quite valid, but 1. I am not sure if other components need this method, 2. This will make the style field unnecessary and make auto_margin_num() a function instead of a method. Maybe I should do this after more consideration, together with renaming the Mode enum to Direction and moving it to model.rs.
| pub fn outer_main_size(&self, mode: Mode) -> Au { | ||
| let ref fragment = self.flow.as_block().fragment; | ||
| let adjustment; | ||
| match mode { |
This comment has been minimized.
This comment has been minimized.
pcwalton
Jul 18, 2016
Contributor
nit: you can shorten this to let adjustment = match mode { ... } and then remove the adjustment =s below and the semicolons
| } | ||
| } | ||
|
|
||
| /// Represent a child in a flex container. Most fields here are used in |
This comment has been minimized.
This comment has been minimized.
|
Looks good, just had a few nits. Thanks! |
| let margin = self.style.logical_margin(); | ||
| (MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() + | ||
| MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero()) | ||
| } |
This comment has been minimized.
This comment has been minimized.
stshine
Jul 19, 2016
Author
Contributor
Here when the the box-sizing property is border-box, percentage padding included in main size is calculated to zero as a result of bubble_inline_sizes. Maybe I should recalculate them?
|
Issues addressed. Thanks! |
|
Does any other code use these methods? If it's for future patches, maybe we should merge this right before the one that uses it. |
|
@shinglyu told me for a big feature I should make separate commits and submit them in on PR. If so I will close other PRs, rename this PR, and push consequent commits for flexbox here. |
|
|
|
That sounds like a good plan. |
Extend fields of `FlexItem` struct with values that are necessary to resolve flexible lengths, and the 'order' property. Add other methods for size computing to make the code more modular.
|
|
|
@bors-servo try- clean retry r=pcwalton |
|
|
|
Implement flexible box layout for row container <!-- Please describe your changes on the following line: --> This pull requests implements basic flexible box layout for row container. It has implemented most basic flexbox features, including grow, shrink, multi-line, *reverse properties, and alignment under `justify-content`, `align-items`, `align-self`, `align-content`. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @pcwalton <!-- 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/12330) <!-- Reviewable:end -->
|
|
highfive
commented
Aug 3, 2016
|
|
@bors-servo r=pcwalton |
|
|
Implement flexible box layout for row container <!-- Please describe your changes on the following line: --> This pull requests implements basic flexible box layout for row container. It has implemented most basic flexbox features, including grow, shrink, multi-line, *reverse properties, and alignment under `justify-content`, `align-items`, `align-self`, `align-content`. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @pcwalton <!-- 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/12330) <!-- Reviewable:end -->
|
|
|
|
|
I feel satisfied and honored to be able to implement this for servo. Thank you @pcwalton again and thanks to everyone who helped! |
stshine commentedJul 8, 2016
•
edited
This pull requests implements basic flexible box layout for row container.
It has implemented most basic flexbox features, including grow, shrink, multi-line, *reverse properties, and alignment under
justify-content,align-items,align-self,align-content../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsr? @pcwalton
This change is