Auto merge of #9929 - servo:cascade, r=pcwalton

Refactor the cascade

Converting the specified value of some properties into a computed value depends on the value of other properties. For example, the `em` unit of any length depends on the `font-size` property.

Previously, we would do a first pass over applicable declarations to build up a `values::computed::Context` struct with a number of fields for each such piece of data from other properties.

This simplies the struct by instead having it contain the set of computed values (for a given element) that is being populated and classify properties into "early" and "other", such that the only dependencies can be from "other" to "early". We iterate applicable_declarations twice, first cascading "early" properties then "other". Unfortunately, it’s not easy to check that this classification is correct.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9929)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-19 08:08:56 +05:30
commit 2d6283c64b
5 changed files with 232 additions and 381 deletions

View file

@ -1,10 +1,12 @@
<!DOCTYPE html>
<html style="font-size: 7px">
<title>font-size (issues #1435, #3417)</title>
<link rel=match href=font_size_ref.html>
<style>p { margin: .5em }</style>
<body style="font-size: 20px">
<p style="font-size: 24pt">24pt is 32px.
<p style="font-size: 2em">2em is 40px.
<p style="font-size: 2rem">2rem is 14px.
<p style="font-size: 200%">200% is 40px.
<p style="font-size: smaller">smaller is 17px.
<p style="font-size: larger">larger is 24px.

View file

@ -4,6 +4,7 @@
<body>
<p style="font-size: 32px">24pt is 32px.
<p style="font-size: 40px">2em is 40px.
<p style="font-size: 14px">2rem is 14px.
<p style="font-size: 40px">200% is 40px.
<p style="font-size: 17px">smaller is 17px.
<p style="font-size: 24px">larger is 24px.