Bug 1341083: Implement dynamic restyling for display: contents. r=heycam

MozReview-Commit-ID: KimTU2j4V4p
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-02-21 11:25:11 +01:00
parent 524ba6a442
commit 6875c65d37
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 111 additions and 18 deletions

View file

@ -313,10 +313,25 @@ impl Stylist {
flags.insert(INHERIT_ALL)
}
// NOTE(emilio): We skip calculating the proper layout parent style
// here.
//
// It'd be fine to assert that this isn't called with a parent style
// where display contents is in effect, but in practice this is hard to
// do for stuff like :-moz-fieldset-content with a
// <fieldset style="display: contents">. That is, the computed value of
// display for the fieldset is "contents", even though it's not the used
// value, so we don't need to adjust in a different way anyway.
//
// In practice, I don't think any anonymous content can be a direct
// descendant of a display: contents element where display: contents is
// the actual used value, and the computed value of it would need
// blockification.
let computed =
properties::cascade(self.device.au_viewport_size(),
&rule_node,
parent.map(|p| &**p),
parent.map(|p| &**p),
default,
None,
Box::new(StdoutErrorReporter),
@ -389,10 +404,15 @@ impl Stylist {
self.rule_tree.insert_ordered_rules(
declarations.into_iter().map(|a| (a.source, a.level)));
// Read the comment on `precomputed_values_for_pseudo` to see why it's
// difficult to assert that display: contents nodes never arrive here
// (tl;dr: It doesn't apply for replaced elements and such, but the
// computed value is still "contents").
let computed =
properties::cascade(self.device.au_viewport_size(),
&rule_node,
Some(&**parent),
Some(&**parent),
default,
None,
Box::new(StdoutErrorReporter),