Auto merge of #20752 - pyfisch:backgrounds42, r=emilio

Fix crash in DL building

Fix one crash and some style changes.

This HTML crashed servo before. Key parts are `background-clip: content-box` and `direction: rtl`

```html
<!DOCTYPE html>
<html>
    <style>
        #span1 {
            background-clip: content-box;
        }
        #span2
        {
            direction: rtl;
        }
    </style>
    <span id="span1">Filler Text <span id="span2">txeT relliF</span></span>
</html>
```
Should I add this as a test? And where do I put this "does-it-crash?" test?

I find always passing rectangles by value a lot easier as it avoids many references and dereferences and I assume that the compiler will always use the faster one either way. If you don't like the change feel free to only merge the first commit.

<!-- 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/20752)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-05-19 11:02:01 -04:00 committed by GitHub
commit ea214e9bc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 220 additions and 191 deletions

View file

@ -711,7 +711,7 @@ fn handle_overlapping_radii(size: LayoutSize, radii: BorderRadius) -> BorderRadi
}
pub fn build_border_radius(
abs_bounds: &Rect<Au>,
abs_bounds: Rect<Au>,
border_style: &style_structs::Border,
) -> BorderRadius {
// TODO(cgaebel): Support border radii even in the case of multiple border widths.
@ -811,10 +811,7 @@ pub fn build_image_border_details(
}
}
fn calculate_border_image_outset_side(
outset: LengthOrNumber,
border_width: Au,
) -> Au {
fn calculate_border_image_outset_side(outset: LengthOrNumber, border_width: Au) -> Au {
match outset {
Either::First(length) => length.into(),
Either::Second(factor) => border_width.scale_by(factor),