Auto merge of #7896 - pcwalton:box-shadow-border-radii, r=mbrubeck

layout: Add a field in the display list for simple border radii on box shadows.

Only supported in WebRender (with my upcoming PR) for now.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7896)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-06 15:46:56 -06:00
commit 5eb1c04e78
2 changed files with 12 additions and 0 deletions

View file

@ -1198,6 +1198,11 @@ pub struct BoxShadowDisplayItem {
/// The spread radius of this shadow. /// The spread radius of this shadow.
pub spread_radius: Au, pub spread_radius: Au,
/// The border radius of this shadow.
///
/// TODO(pcwalton): Elliptical radii; different radii for each corner.
pub border_radius: Au,
/// How we should clip the result. /// How we should clip the result.
pub clip_mode: BoxShadowClipMode, pub clip_mode: BoxShadowClipMode,
} }

View file

@ -668,6 +668,8 @@ impl FragmentDisplayListBuilding for Fragment {
box_shadow.offset_y)), box_shadow.offset_y)),
box_shadow.blur_radius, box_shadow.blur_radius,
box_shadow.spread_radius); box_shadow.spread_radius);
// TODO(pcwalton): Multiple border radii; elliptical border radii.
list.push(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem { list.push(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem {
base: BaseDisplayItem::new(bounds, base: BaseDisplayItem::new(bounds,
DisplayItemMetadata::new(self.node, DisplayItemMetadata::new(self.node,
@ -679,6 +681,9 @@ impl FragmentDisplayListBuilding for Fragment {
offset: Point2D::new(box_shadow.offset_x, box_shadow.offset_y), offset: Point2D::new(box_shadow.offset_x, box_shadow.offset_y),
blur_radius: box_shadow.blur_radius, blur_radius: box_shadow.blur_radius,
spread_radius: box_shadow.spread_radius, spread_radius: box_shadow.spread_radius,
border_radius: model::specified_border_radius(style.get_border()
.border_top_left_radius,
absolute_bounds.size.width).width,
clip_mode: if box_shadow.inset { clip_mode: if box_shadow.inset {
BoxShadowClipMode::Inset BoxShadowClipMode::Inset
} else { } else {
@ -1503,6 +1508,7 @@ impl FragmentDisplayListBuilding for Fragment {
offset: ZERO_POINT, offset: ZERO_POINT,
blur_radius: blur_radius, blur_radius: blur_radius,
spread_radius: Au(0), spread_radius: Au(0),
border_radius: Au(0),
clip_mode: BoxShadowClipMode::None, clip_mode: BoxShadowClipMode::None,
})) }))
} }
@ -2034,3 +2040,4 @@ pub enum StackingContextCreationMode {
OuterScrollWrapper, OuterScrollWrapper,
InnerScrollWrapper, InnerScrollWrapper,
} }