зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1822436 - Remove `offset` from WR border-image implementation r=gfx-reviewers,lsalzman
It's not needed, as Gecko incorporates it in to the border-image rect. Differential Revision: https://phabricator.services.mozilla.com/D172636
This commit is contained in:
Родитель
d8e0ce0cc0
Коммит
30496845a0
|
@ -1392,36 +1392,33 @@ void DisplayListBuilder::PushBorderGradient(
|
|||
const int32_t aWidth, const int32_t aHeight, bool aFill,
|
||||
const wr::DeviceIntSideOffsets& aSlice, const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint, const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode, const wr::LayoutSideOffsets& aOutset) {
|
||||
wr_dp_push_border_gradient(mWrState, aBounds, MergeClipLeaf(aClip),
|
||||
aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
|
||||
aWidths, aWidth, aHeight, aFill, aSlice,
|
||||
aStartPoint, aEndPoint, aStops.Elements(),
|
||||
aStops.Length(), aExtendMode, aOutset);
|
||||
wr::ExtendMode aExtendMode) {
|
||||
wr_dp_push_border_gradient(
|
||||
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
|
||||
&mCurrentSpaceAndClipChain, aWidths, aWidth, aHeight, aFill, aSlice,
|
||||
aStartPoint, aEndPoint, aStops.Elements(), aStops.Length(), aExtendMode);
|
||||
}
|
||||
|
||||
void DisplayListBuilder::PushBorderRadialGradient(
|
||||
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::LayoutSideOffsets& aWidths, bool aFill,
|
||||
const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSideOffsets& aOutset) {
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode) {
|
||||
wr_dp_push_border_radial_gradient(
|
||||
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
|
||||
&mCurrentSpaceAndClipChain, aWidths, aFill, aCenter, aRadius,
|
||||
aStops.Elements(), aStops.Length(), aExtendMode, aOutset);
|
||||
aStops.Elements(), aStops.Length(), aExtendMode);
|
||||
}
|
||||
|
||||
void DisplayListBuilder::PushBorderConicGradient(
|
||||
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::LayoutSideOffsets& aWidths, bool aFill,
|
||||
const wr::LayoutPoint& aCenter, const float aAngle,
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSideOffsets& aOutset) {
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode) {
|
||||
wr_dp_push_border_conic_gradient(
|
||||
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
|
||||
&mCurrentSpaceAndClipChain, aWidths, aFill, aCenter, aAngle,
|
||||
aStops.Elements(), aStops.Length(), aExtendMode, aOutset);
|
||||
aStops.Elements(), aStops.Length(), aExtendMode);
|
||||
}
|
||||
|
||||
void DisplayListBuilder::PushText(const wr::LayoutRect& aBounds,
|
||||
|
|
|
@ -585,22 +585,19 @@ class DisplayListBuilder final {
|
|||
const wr::LayoutPoint& aStartPoint,
|
||||
const wr::LayoutPoint& aEndPoint,
|
||||
const nsTArray<wr::GradientStop>& aStops,
|
||||
wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSideOffsets& aOutset);
|
||||
wr::ExtendMode aExtendMode);
|
||||
|
||||
void PushBorderRadialGradient(
|
||||
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::LayoutSideOffsets& aWidths, bool aFill,
|
||||
const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius,
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSideOffsets& aOutset);
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode);
|
||||
|
||||
void PushBorderConicGradient(
|
||||
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::LayoutSideOffsets& aWidths, bool aFill,
|
||||
const wr::LayoutPoint& aCenter, const float aAngle,
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
|
||||
const wr::LayoutSideOffsets& aOutset);
|
||||
const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode);
|
||||
|
||||
void PushText(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::ColorF& aColor,
|
||||
|
|
|
@ -3404,7 +3404,6 @@ pub struct WrBorderImage {
|
|||
height: i32,
|
||||
fill: bool,
|
||||
slice: DeviceIntSideOffsets,
|
||||
outset: LayoutSideOffsets,
|
||||
repeat_horizontal: RepeatMode,
|
||||
repeat_vertical: RepeatMode,
|
||||
}
|
||||
|
@ -3425,7 +3424,6 @@ pub extern "C" fn wr_dp_push_border_image(
|
|||
height: params.height,
|
||||
slice: params.slice,
|
||||
fill: params.fill,
|
||||
outset: params.outset,
|
||||
repeat_horizontal: params.repeat_horizontal,
|
||||
repeat_vertical: params.repeat_vertical,
|
||||
});
|
||||
|
@ -3461,7 +3459,6 @@ pub extern "C" fn wr_dp_push_border_gradient(
|
|||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: ExtendMode,
|
||||
outset: LayoutSideOffsets,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
|
@ -3479,7 +3476,6 @@ pub extern "C" fn wr_dp_push_border_gradient(
|
|||
height,
|
||||
slice,
|
||||
fill,
|
||||
outset,
|
||||
repeat_horizontal: RepeatMode::Stretch,
|
||||
repeat_vertical: RepeatMode::Stretch,
|
||||
});
|
||||
|
@ -3513,7 +3509,6 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(
|
|||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: ExtendMode,
|
||||
outset: LayoutSideOffsets,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
|
@ -3538,7 +3533,6 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(
|
|||
height: rect.height() as i32,
|
||||
slice,
|
||||
fill,
|
||||
outset,
|
||||
repeat_horizontal: RepeatMode::Stretch,
|
||||
repeat_vertical: RepeatMode::Stretch,
|
||||
});
|
||||
|
@ -3572,7 +3566,6 @@ pub extern "C" fn wr_dp_push_border_conic_gradient(
|
|||
stops: *const GradientStop,
|
||||
stops_count: usize,
|
||||
extend_mode: ExtendMode,
|
||||
outset: LayoutSideOffsets,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
|
@ -3597,7 +3590,6 @@ pub extern "C" fn wr_dp_push_border_conic_gradient(
|
|||
height: rect.height() as i32,
|
||||
slice,
|
||||
fill,
|
||||
outset,
|
||||
repeat_horizontal: RepeatMode::Stretch,
|
||||
repeat_vertical: RepeatMode::Stretch,
|
||||
});
|
||||
|
|
|
@ -1305,17 +1305,6 @@ impl NinePatchDescriptor {
|
|||
) -> Vec<BrushSegment> {
|
||||
let rect = LayoutRect::from_size(size);
|
||||
|
||||
// Calculate the modified rect as specific by border-image-outset
|
||||
let origin = LayoutPoint::new(
|
||||
rect.min.x - self.outset.left,
|
||||
rect.min.y - self.outset.top,
|
||||
);
|
||||
let size = LayoutSize::new(
|
||||
rect.width() + self.outset.left + self.outset.right,
|
||||
rect.height() + self.outset.top + self.outset.bottom,
|
||||
);
|
||||
let rect = LayoutRect::from_origin_and_size(origin, size);
|
||||
|
||||
// Calculate the local texel coords of the slices.
|
||||
let px0 = 0.0;
|
||||
let px1 = self.slice.left as f32 / self.width as f32;
|
||||
|
|
|
@ -902,7 +902,6 @@ pub struct NinePatchDescriptor {
|
|||
pub fill: bool,
|
||||
pub repeat_horizontal: RepeatMode,
|
||||
pub repeat_vertical: RepeatMode,
|
||||
pub outset: SideOffsetsKey,
|
||||
pub widths: SideOffsetsKey,
|
||||
}
|
||||
|
||||
|
|
|
@ -3093,7 +3093,6 @@ impl<'a> SceneBuilder<'a> {
|
|||
fill: border.fill,
|
||||
repeat_horizontal: border.repeat_horizontal,
|
||||
repeat_vertical: border.repeat_vertical,
|
||||
outset: border.outset.into(),
|
||||
widths: border_item.widths.into(),
|
||||
};
|
||||
|
||||
|
|
|
@ -525,10 +525,6 @@ pub struct NinePatchBorder {
|
|||
/// Determines what happens if the vertical side parts of the 9-part
|
||||
/// image have a different size than the vertical parts of the border.
|
||||
pub repeat_vertical: RepeatMode,
|
||||
|
||||
/// The outset for the border.
|
||||
/// TODO(mrobinson): This should be removed and handled by the client.
|
||||
pub outset: LayoutSideOffsets, // TODO: what unit is this in?
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize, PeekPoke)]
|
||||
|
|
|
@ -9,4 +9,3 @@ root:
|
|||
end: [ 200, 0 ]
|
||||
stops: [ 0.0, red, 0.177, red, 0.177, yellow, 0.50, yellow, 0.50, red ]
|
||||
slice: [ 50 ]
|
||||
outset: 0
|
||||
|
|
|
@ -11,4 +11,3 @@ root:
|
|||
start: [ 25, 0 ]
|
||||
end: [ 25, 50 ]
|
||||
stops: [ 0.0, red, 1.0, green ]
|
||||
outset: [ 0, 0, 0, 0 ]
|
||||
|
|
|
@ -12,7 +12,6 @@ root:
|
|||
image-width: 32
|
||||
image-height: 32
|
||||
slice: [ 3, 0, 1, 36 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
|
|
@ -12,7 +12,6 @@ root:
|
|||
image-width: 32
|
||||
image-height: 32
|
||||
slice: [ 3, 0, 1, 36 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
|
|
@ -12,7 +12,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32, 0, 32, 0 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
- type: border
|
||||
|
@ -23,7 +22,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 0, 32, 0, 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
- type: border
|
||||
|
@ -34,7 +32,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32, 0, 0, 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
- type: border
|
||||
|
@ -45,6 +42,5 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 0, 32, 32, 0 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
|
|
|
@ -12,7 +12,6 @@ root:
|
|||
image-width: 100
|
||||
image-height: 50
|
||||
slice: [ 20, 40 ]
|
||||
outset: 0
|
||||
repeat-vertical: repeat
|
||||
repeat-horizontal: repeat
|
||||
fill: true
|
||||
|
@ -25,7 +24,6 @@ root:
|
|||
image-width: 100
|
||||
image-height: 50
|
||||
slice: [ 20, 40 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: repeat
|
||||
fill: true
|
||||
|
@ -37,7 +35,6 @@ root:
|
|||
image-width: 100
|
||||
image-height: 50
|
||||
slice: [ 20, 40 ]
|
||||
outset: 0
|
||||
repeat-vertical: repeat
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
@ -49,7 +46,6 @@ root:
|
|||
image-width: 100
|
||||
image-height: 50
|
||||
slice: [ 20, 40 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
|
|
@ -12,7 +12,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: repeat
|
||||
repeat-horizontal: repeat
|
||||
fill: true
|
||||
|
@ -24,7 +23,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: repeat
|
||||
fill: true
|
||||
|
@ -36,7 +34,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: repeat
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
@ -48,7 +45,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: stretch
|
||||
fill: true
|
||||
|
|
|
@ -13,7 +13,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
# The pattern has to be stretched to fit.
|
||||
|
@ -25,7 +24,6 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
# The pattern has to be shrunk to fit.
|
||||
|
@ -37,6 +35,5 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: round
|
||||
repeat-horizontal: round
|
||||
|
|
|
@ -12,6 +12,5 @@ root:
|
|||
image-width: 96
|
||||
image-height: 96
|
||||
slice: [ 32 ]
|
||||
outset: 0
|
||||
repeat-vertical: stretch
|
||||
repeat-horizontal: stretch
|
||||
|
|
|
@ -9,4 +9,3 @@ root:
|
|||
radius: [ 200, 200 ]
|
||||
stops: [ 0.0, red, 0.5, red, 0.5, green ]
|
||||
slice: [ 50 ]
|
||||
outset: 0
|
||||
|
|
|
@ -11,4 +11,3 @@ root:
|
|||
center: [ 25, 25 ]
|
||||
radius: [ 50, 50 ]
|
||||
stops: [ 0.0, red, 1.0, green ]
|
||||
outset: [ 0, 0, 0, 0 ]
|
||||
|
|
|
@ -1082,10 +1082,6 @@ impl YamlFrameReader {
|
|||
vec![widths.top as u32, widths.left as u32, widths.bottom as u32, widths.right as u32]
|
||||
};
|
||||
|
||||
let outset = item["outset"]
|
||||
.as_vec_f32()
|
||||
.expect("border must have outset");
|
||||
let outset = broadcast(&outset, 4);
|
||||
let repeat_horizontal = match item["repeat-horizontal"]
|
||||
.as_str()
|
||||
.unwrap_or("stretch")
|
||||
|
@ -1136,7 +1132,6 @@ impl YamlFrameReader {
|
|||
fill,
|
||||
repeat_horizontal,
|
||||
repeat_vertical,
|
||||
outset: SideOffsets2D::new(outset[0], outset[1], outset[2], outset[3]),
|
||||
}))
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -3587,17 +3587,11 @@ ImgDrawResult nsCSSBorderImageRenderer::CreateWebRenderCommands(
|
|||
|
||||
float widths[4];
|
||||
float slice[4];
|
||||
float outset[4];
|
||||
const int32_t appUnitsPerDevPixel =
|
||||
aForFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
for (const auto i : mozilla::AllPhysicalSides()) {
|
||||
slice[i] = (float)(mSlice.Side(i)) / appUnitsPerDevPixel;
|
||||
widths[i] = (float)(mWidths.Side(i)) / appUnitsPerDevPixel;
|
||||
|
||||
// The outset is already taken into account by the adjustments to mArea
|
||||
// in our constructor. We use mArea as our dest rect so we can just supply
|
||||
// zero outsets to WebRender.
|
||||
outset[i] = 0.0f;
|
||||
}
|
||||
|
||||
LayoutDeviceRect destRect =
|
||||
|
@ -3688,7 +3682,6 @@ ImgDrawResult nsCSSBorderImageRenderer::CreateWebRenderCommands(
|
|||
mImageSize.height / appUnitsPerDevPixel,
|
||||
mFill,
|
||||
wr::ToDeviceIntSideOffsets(slice[0], slice[1], slice[2], slice[3]),
|
||||
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2], outset[3]),
|
||||
wr::ToRepeatMode(mRepeatModeHorizontal),
|
||||
wr::ToRepeatMode(mRepeatModeVertical)};
|
||||
|
||||
|
@ -3724,26 +3717,20 @@ ImgDrawResult nsCSSBorderImageRenderer::CreateWebRenderCommands(
|
|||
(float)(mImageSize.height) / appUnitsPerDevPixel, mFill,
|
||||
wr::ToDeviceIntSideOffsets(slice[0], slice[1], slice[2], slice[3]),
|
||||
wr::ToLayoutPoint(startPoint), wr::ToLayoutPoint(endPoint), stops,
|
||||
extendMode,
|
||||
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
|
||||
outset[3]));
|
||||
extendMode);
|
||||
} else if (gradient.IsRadial()) {
|
||||
aBuilder.PushBorderRadialGradient(
|
||||
dest, clip, !aItem->BackfaceIsHidden(),
|
||||
wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
||||
mFill, wr::ToLayoutPoint(lineStart),
|
||||
wr::ToLayoutSize(gradientRadius), stops, extendMode,
|
||||
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
|
||||
outset[3]));
|
||||
wr::ToLayoutSize(gradientRadius), stops, extendMode);
|
||||
} else {
|
||||
MOZ_ASSERT(gradient.IsConic());
|
||||
aBuilder.PushBorderConicGradient(
|
||||
dest, clip, !aItem->BackfaceIsHidden(),
|
||||
wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
||||
mFill, wr::ToLayoutPoint(gradientCenter), gradientAngle, stops,
|
||||
extendMode,
|
||||
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
|
||||
outset[3]));
|
||||
extendMode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче