mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
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.
This commit is contained in:
parent
5327758b9b
commit
7ed3995725
2 changed files with 37 additions and 36 deletions
|
@ -221,41 +221,9 @@ impl PseudoElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For most (but not all) anon-boxes, we inherit all values from the
|
/// To be removed.
|
||||||
/// 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...
|
|
||||||
pub fn inherits_all(&self) -> bool {
|
pub fn inherits_all(&self) -> bool {
|
||||||
match *self {
|
false
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Covert non-canonical pseudo-element to canonical one, and keep a
|
/// 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
|
ServoInlineBlockWrapper
|
||||||
},
|
},
|
||||||
"-servo-input-absolute" => {
|
"-servo-inline-absolute" => {
|
||||||
if !self.in_user_agent_stylesheet() {
|
if !self.in_user_agent_stylesheet() {
|
||||||
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
|
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,33 @@ svg > * {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For most (but not all) anon-boxes, we inherit all values from the
|
||||||
|
* parent.
|
||||||
|
*
|
||||||
|
* Anonymous table flows shouldn't inherit their parents properties in order
|
||||||
|
* to avoid doubling up styles such as transformations. Same for text and such.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* FIXME(emilio): inheriting all is a very strong hammer, and it's likely
|
||||||
|
* broken for stuff like table backgrounds and such. Gecko explicitly inherits
|
||||||
|
* what it wants, which seems a bit better off-hand.
|
||||||
|
*/
|
||||||
|
*|*::-servo-anonymous-table,
|
||||||
|
*|*::-servo-anonymous-table-wrapper,
|
||||||
|
*|*::-servo-table-wrapper,
|
||||||
|
*|*::-servo-anonymous-block,
|
||||||
|
*|*::-servo-inline-block-wrapper,
|
||||||
|
*|*::-servo-inline-absolute {
|
||||||
|
all: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
/* style for text node. */
|
/* style for text node. */
|
||||||
*|*::-servo-text {
|
*|*::-servo-text {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -239,10 +266,16 @@ svg > * {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The outer fragment wrapper of an inline absolute hypothetical fragment. */
|
/* The outer fragment wrapper of an inline absolute hypothetical fragment.
|
||||||
|
*
|
||||||
|
* FIXME(emilio): This was disabled because of a typo in the CSS parser,
|
||||||
|
* re-enable or figure out why it's not needed.
|
||||||
|
|
||||||
*|*::-servo-inline-absolute {
|
*|*::-servo-inline-absolute {
|
||||||
clip: auto;
|
clip: auto;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue