Auto merge of #14848 - bzbarsky:initial-styles, r=bholley

Stop using global initial styles for stylo; the initial styles need to be per-document

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1298588

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests on the servo side because behavior is unchanged.  Gecko-side tests probably exist.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14848)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-04 21:01:38 -08:00 committed by GitHub
commit 143dfc879e
20 changed files with 287 additions and 152 deletions

View file

@ -8,6 +8,7 @@ use euclid::size::Size2D;
use media_queries::CSSErrorReporterTest;
use std::f32::consts::PI;
use style::parser::ParserContext;
use style::properties::ComputedValues;
use style::stylesheets::Origin;
use style::values::computed;
use style::values::computed::{Angle, Context, ToComputedValue};
@ -43,7 +44,14 @@ fn test_linear_gradient() {
// Note that Angle(PI) is correct for top-to-bottom rendering, whereas Angle(0) would render bottom-to-top.
// ref: https://developer.mozilla.org/en-US/docs/Web/CSS/angle
let container = Size2D::new(Au::default(), Au::default());
let specified_context = Context::initial(container, true);
let initial_style = ComputedValues::initial_values();
let specified_context = Context {
is_root_element: true,
viewport_size: container,
inherited_style: initial_style,
style: initial_style.clone(),
font_metrics_provider: None,
};
assert_eq!(specified::AngleOrCorner::None.to_computed_value(&specified_context),
computed::AngleOrCorner::Angle(Angle(PI)));
}