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 uplayout: Rewrite anonymous table code, simplify and fix table intrinsic width calculation, and improve safety of flexbox code. #13870
Conversation
highfive
commented
Oct 21, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Oct 21, 2016
|
@bors-servo: try |
|
|
|
|
|
r? @mbrubeck All I'd complain about is spec-related :) |
|
Just a first pass with a few comments. The style parts look good to me. The layout parts make sense to me, though I'd have to do a lot of spec-reading to ensure it's correct. |
| @@ -19,7 +19,7 @@ | |||
| #table | |||
| { | |||
| border-right: 10px solid blue; | |||
| display: inline-table; | |||
| display: block; | |||
This comment has been minimized.
This comment has been minimized.
| </html> |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 21, 2016
Member
I think all the newline changes inside tests/wpt should also be reverted.
| fun(PseudoElement::ServoAnonymousTableWrapper); | ||
| fun(PseudoElement::ServoAnonymousTable); | ||
| fun(PseudoElement::ServoAnonymousTableRow); | ||
| fun(PseudoElement::ServoAnonymousTableCell); |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 21, 2016
Member
Probably worth creating a file like gecko's pseudo_element_helper.rs to alleviate this and avoid the duplication (it didn't matter much when they were four pseudos, but...). Also we can specialize a few functions easily. In any case, not your business for this PR, I'll file an issue about it :)
| @@ -13,6 +13,7 @@ use selectors::parser::{AttrSelector, ParserContext, SelectorImpl}; | |||
| use std::fmt; | |||
| use string_cache::{Atom, Namespace}; | |||
|
|
|||
| /// NB: If you add to this list, be sure to update `each_pseudo_element` too. | |||
This comment has been minimized.
This comment has been minimized.
emilio
Oct 21, 2016
Member
I'm pretty sure I wrote this exact comment when I introduced each_pseudo_element, where did it go? Sorry it bited you :/
| @@ -252,19 +253,29 @@ impl Stylist { | |||
|
|
|||
| /// Computes the style for a given "precomputed" pseudo-element, taking the | |||
| /// universal rules and applying them. | |||
| /// | |||
| /// If `inherit_all` is true, then all properties are inherited from the parent; otherwise, | |||
| /// non-inherited properties are reset to their initial values. | |||
This comment has been minimized.
This comment has been minimized.
emilio
Oct 21, 2016
Member
A comment saying that this is used for anonymous flows would be helpful IMO.
| let table_style = node.style(self.style_context()); | ||
| let wrapper_style = self.style_context() | ||
| .stylist | ||
| .precomputed_values_for_pseudo(&PseudoElement::ServoTableWrapper, |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 21, 2016
Member
This pattern is becoming increasingly common, maybe add a helper for it in SharedStyleContext? Can be left as a followup, but please fill it if you decide to do so.
This comment has been minimized.
This comment has been minimized.
pcwalton
Oct 24, 2016
Author
Contributor
Added a helper to Stylist (as not all the places that call precomputed_values_for_pseudo have a handle to the style context).
|
Some test results that weren't auto-linked above:
|
|
I've investigated the failures.
I propose:
Thoughts? |
|
As long as you mean "mark as failing" rather than "ignore". |
|
What's the benefit of marking a test we believe to be invalid as failing instead of ignoring it? Its success depends on the details of the font on the platform. |
| } | ||
|
|
||
| (FlowClass::Flex, FlowClass::Block) | | ||
| (FlowClass::Flex, FlowClass::Flex) => { |
This comment has been minimized.
This comment has been minimized.
stshine
Oct 24, 2016
Contributor
According to https://drafts.csswg.org/css-flexbox/#flex-items children of a flex container are blockified, and anonymous text is the only kind of elements that needs to be wrapped in a anonymous block.
This comment has been minimized.
This comment has been minimized.
pcwalton
Oct 24, 2016
•
Author
Contributor
Flex is OK here because display: flex creates a block-level flex container box.
This comment has been minimized.
This comment has been minimized.
stshine
Oct 24, 2016
Contributor
Oh, I mean IMO the wrapper block should only be needed for FlowClass::Inline since other children are guaranteed to be block-like.
| parent, | ||
| &[], | ||
| SpecificFragmentInfo::Generic, | ||
| BlockFlow::from_fragment) |
This comment has been minimized.
This comment has been minimized.
stshine
Oct 24, 2016
Contributor
I wonder if this is still necessary since all situation with a flex container return true in try_to_add_child().
This comment has been minimized.
This comment has been minimized.
| ServoAnonymousTable, | ||
| ServoAnonymousTableRow, | ||
| ServoAnonymousTableCell, | ||
| ServoAnonymousFlexBlock, |
This comment has been minimized.
This comment has been minimized.
stshine
Oct 24, 2016
Contributor
Anonymous blocks in flexbox are just general blocks (yes, in servo and gecko inline elements are wrapped in an InlineFlow rather than a anonymous block), thus I suggest to call this ServoAnonymousBlock since it can be used in other places.
392ab81
to
2e00b85
2e00b85
to
ee3aebd
non-inheritable ones. This works like the `modify_style_for_*` functions and will allow us to easily migrate from them to real cascading.
appropriately in the UA stylesheet.
flows' block sizes. This ensures that we never collapse margins for flex flows.
cascade takes care of it.
The base `Flow` implementation returns the incorrect value.
anonymous text child of `<input>`.
This is more straightforward when anonymous table object generation is involved.
account.
511362f
to
ba005a9
|
Both issues should be fixed now. |
|
@bors-servo r+ |
|
|
layout: Rewrite anonymous table code, simplify and fix table intrinsic width calculation, and improve safety of flexbox code. Closes #13782. <!-- 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/13870) <!-- Reviewable:end -->
|
|
pcwalton commentedOct 21, 2016
•
edited by larsbergstrom
Closes #13782.
This change is