Auto merge of #12680 - Manishearth:basic-shape, r=SimonSapin

style: Add support for parsing and serialization of <basic-shape>s

Still WIP: I still need to use this somewhere and make serialization minimal. I'm not sure if I should do either in this PR.
The only other browser that handles basic shapes doesn't serialize correctly either (https://bugzilla.mozilla.org/show_bug.cgi?id=1290864), so that's not something we need to get done now.

As far as using this somewhere, I have the following options:

 - Merge this now, work on using it in stylo in a followup.
 - Just write extensive unit tests for parsing/serialization for now (stylo in a followup)
 - Use this for clip-path in stylo only (which I intend to do anyway, just not sure if I should do it in this PR)
 - Use this for clip-path in Servo (I'd rather not do this; this would be a huge change requiring a lot more layout knowledge than I currently have)

Thoughts? Review? @SimonSapin @bholley

<!-- 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/12680)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-05 06:27:24 -05:00 committed by GitHub
commit 0fc0db67c6
16 changed files with 1188 additions and 181 deletions

View file

@ -1042,17 +1042,18 @@ fn static_assert() {
}
pub fn clone_background_position(&self) -> longhands::background_position::computed_value::T {
use values::computed::position::Position;
let position = &self.gecko.mImage.mLayers.mFirstElement.mPosition;
longhands::background_position::computed_value::T {
longhands::background_position::computed_value::T(Position {
horizontal: position.mXPosition.into(),
vertical: position.mYPosition.into(),
}
})
}
pub fn set_background_position(&mut self, v: longhands::background_position::computed_value::T) {
let position = &mut self.gecko.mImage.mLayers.mFirstElement.mPosition;
position.mXPosition = v.horizontal.into();
position.mYPosition = v.vertical.into();
position.mXPosition = v.0.horizontal.into();
position.mYPosition = v.0.vertical.into();
self.gecko.mImage.mPositionXCount = 1;
self.gecko.mImage.mPositionYCount = 1;
}