I think this is the only change necessary to make block and inline boxes consistent. But I'm finding it hard to test due to other bugs (#1696, #1697, #1698).
* Expand the apply() and apply_cached() templates. Their two invocations each were different enough that this improves readability IMO.
* Create computed::Context from inherited and cascaded values rather than computed value, as much as possible.
* Centralize this creation rather than making it per-property, making 'needed_for_context' not needed anymore.
* Pass a context to cascade_with_cached_declarations() rather than duplicate the creation code.
@pcwalton r? Does this hurt the optimization introduced in 0fa0940ce9?
This is mostly about nicer-looking code. The only thing that was wrong ([`apply_cached(priority)` instead of `apply_cached(needed_for_context)`](https://github.com/mozilla/servo/pull/1644#discussion_r9772133)) could be fixed with a much shorted diff.
* Expand the apply() and apply_cached() templates.
Their two invocations each were different enough
that this improves readability IMO.
* Create computed::Context from inherited and cascaded values
rather than computed value, as much as possible.
* Centralize this creation rather than making it per-property,
making 'needed_for_context' not needed anymore.
* Pass a context to cascade_with_cached_declarations() rather than
duplicate the creation code.
... to characterdata
All other node's parent type names reflect the actual type of the parent. This change extends that convention to the indicated nodes.
closes#1594
This series of patches implements style struct sharing as found in existing browser engines, as well as a bunch of related important optimizations. With them, we are faster than Blink, WebKit, and Gecko on the rainbow page for style recalc in sequential mode by at least 15%. Parallel gains are mixed—the rainbow page turns out to be a degenerate sequential case for the LRU cache used to track candidates for style sharing and so there is no improvement. For cases in which the cache is not hit, such as `perf-rainbow-hard.html`, we are around 25% slower than Blink sequentially, but have very large parallel wins so that we are around 2x faster at style recalc. (Note that parallel flow tree construction will improve this further.)
This patch series also fixes, as near as I can tell, some bugs related to ordering of properties that other properties depend on in selector matching.
r? @larsbergstrom
feedback? @SimonSapin (for selector matching changes)
feedback? @bzbarsky (for style sharing heuristics)
This roughly implements the same cache found in Blink. 50% improvement
on the rainbow page, but at the cost of reducing parallel gains down to
nothing. I added a new page, `perf-rainbow-hard.html`, which disables
the optimizations in both Blink and Servo.