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
style: Stop using PseudoElement::inherits_all. #21946
Merged
+37
−42
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
style: Stop using PseudoElement::inherits_all.
This was done that way just because Servo didn't support the `all` property at the time. We should do it this way and optimize it if it's slow. Though I suspect that most of stuff doesn't actually need to be inherited, my patch at bug 1498943 should make it much faster than what it would otherwise be.
- Loading branch information
emilio
committed
Oct 15, 2018
commit 7ed3995725919e02f729a6f5ae83ff7bfba0366b
Unverified
This user has not uploaded their public key yet.
GPG key ID: 056B727BB9C1027C
Learn about signing commits
| @@ -221,41 +221,9 @@ impl PseudoElement { | ||
| } | ||
| } | ||
|
|
||
| /// For most (but not all) anon-boxes, we inherit all values from the | ||
| /// parent, this is the hook in the style system to allow this. | ||
| /// | ||
| /// FIXME(emilio): It's likely that this is broken in a variety of | ||
| /// situations, and what it really wants is just inherit some reset | ||
| /// properties... Also, I guess it just could do all: inherit on the | ||
| /// stylesheet, though chances are that'd be kinda slow if we don't cache | ||
| /// them... | ||
| /// To be removed. | ||
emilio
Author
Member
|
||
| pub fn inherits_all(&self) -> bool { | ||
| match *self { | ||
| PseudoElement::After | | ||
| PseudoElement::Before | | ||
| PseudoElement::Selection | | ||
| PseudoElement::DetailsContent | | ||
| PseudoElement::DetailsSummary | | ||
| // Anonymous table flows shouldn't inherit their parents properties in order | ||
| // to avoid doubling up styles such as transformations. | ||
| PseudoElement::ServoAnonymousTableCell | | ||
| PseudoElement::ServoAnonymousTableRow | | ||
| PseudoElement::ServoText | | ||
| PseudoElement::ServoInputText => false, | ||
|
|
||
| // For tables, we do want style to inherit, because TableWrapper is | ||
| // responsible for handling clipping and scrolling, while Table is | ||
| // responsible for creating stacking contexts. | ||
| // | ||
| // StackingContextCollectionFlags makes sure this is processed | ||
| // properly. | ||
| PseudoElement::ServoAnonymousTable | | ||
| PseudoElement::ServoAnonymousTableWrapper | | ||
| PseudoElement::ServoTableWrapper | | ||
| PseudoElement::ServoAnonymousBlock | | ||
| PseudoElement::ServoInlineBlockWrapper | | ||
| PseudoElement::ServoInlineAbsolute => true, | ||
| } | ||
| false | ||
| } | ||
|
|
||
| /// Covert non-canonical pseudo-element to canonical one, and keep a | ||
| @@ -585,7 +553,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { | ||
| } | ||
| ServoInlineBlockWrapper | ||
| }, | ||
| "-servo-input-absolute" => { | ||
| "-servo-inline-absolute" => { | ||
| if !self.in_user_agent_stylesheet() { | ||
| return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone()))) | ||
| } | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Why do we keep it then?