Backed out changeset 82ff06193160 (bug 1822436) for wr wrench bustages. CLOSED TREE

This commit is contained in:
Marian-Vasile Laza 2023-03-15 22:34:35 +02:00
Родитель 07d5552a55
Коммит d9dcca62c0
20 изменённых файлов: 86 добавлений и 15 удалений

Просмотреть файл

@ -1392,33 +1392,36 @@ 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) {
wr_dp_push_border_gradient(
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aWidths, aWidth, aHeight, aFill, aSlice,
aStartPoint, aEndPoint, aStops.Elements(), aStops.Length(), aExtendMode);
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);
}
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 nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
const wr::LayoutSideOffsets& aOutset) {
wr_dp_push_border_radial_gradient(
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aWidths, aFill, aCenter, aRadius,
aStops.Elements(), aStops.Length(), aExtendMode);
aStops.Elements(), aStops.Length(), aExtendMode, aOutset);
}
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 nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
const wr::LayoutSideOffsets& aOutset) {
wr_dp_push_border_conic_gradient(
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aWidths, aFill, aCenter, aAngle,
aStops.Elements(), aStops.Length(), aExtendMode);
aStops.Elements(), aStops.Length(), aExtendMode, aOutset);
}
void DisplayListBuilder::PushText(const wr::LayoutRect& aBounds,

Просмотреть файл

@ -585,19 +585,22 @@ class DisplayListBuilder final {
const wr::LayoutPoint& aStartPoint,
const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::GradientStop>& aStops,
wr::ExtendMode aExtendMode);
wr::ExtendMode aExtendMode,
const wr::LayoutSideOffsets& aOutset);
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 nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
const wr::LayoutSideOffsets& aOutset);
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 nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode,
const wr::LayoutSideOffsets& aOutset);
void PushText(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
bool aIsBackfaceVisible, const wr::ColorF& aColor,

Просмотреть файл

@ -3404,6 +3404,7 @@ pub struct WrBorderImage {
height: i32,
fill: bool,
slice: DeviceIntSideOffsets,
outset: LayoutSideOffsets,
repeat_horizontal: RepeatMode,
repeat_vertical: RepeatMode,
}
@ -3424,6 +3425,7 @@ 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,
});
@ -3459,6 +3461,7 @@ 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() });
@ -3476,6 +3479,7 @@ pub extern "C" fn wr_dp_push_border_gradient(
height,
slice,
fill,
outset,
repeat_horizontal: RepeatMode::Stretch,
repeat_vertical: RepeatMode::Stretch,
});
@ -3509,6 +3513,7 @@ 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() });
@ -3533,6 +3538,7 @@ 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,
});
@ -3566,6 +3572,7 @@ 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() });
@ -3590,6 +3597,7 @@ 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,6 +1305,17 @@ 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,6 +902,7 @@ pub struct NinePatchDescriptor {
pub fill: bool,
pub repeat_horizontal: RepeatMode,
pub repeat_vertical: RepeatMode,
pub outset: SideOffsetsKey,
pub widths: SideOffsetsKey,
}

Просмотреть файл

@ -3093,6 +3093,7 @@ 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,6 +525,10 @@ 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,3 +9,4 @@ 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,3 +11,4 @@ root:
start: [ 25, 0 ]
end: [ 25, 50 ]
stops: [ 0.0, red, 1.0, green ]
outset: [ 0, 0, 0, 0 ]

Просмотреть файл

@ -12,6 +12,7 @@ root:
image-width: 32
image-height: 32
slice: [ 3, 0, 1, 36 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: stretch
fill: true

Просмотреть файл

@ -12,6 +12,7 @@ root:
image-width: 32
image-height: 32
slice: [ 3, 0, 1, 36 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: stretch
fill: true

Просмотреть файл

@ -12,6 +12,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32, 0, 32, 0 ]
outset: 0
repeat-vertical: round
repeat-horizontal: round
- type: border
@ -22,6 +23,7 @@ root:
image-width: 96
image-height: 96
slice: [ 0, 32, 0, 32 ]
outset: 0
repeat-vertical: round
repeat-horizontal: round
- type: border
@ -32,6 +34,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32, 0, 0, 32 ]
outset: 0
repeat-vertical: round
repeat-horizontal: round
- type: border
@ -42,5 +45,6 @@ root:
image-width: 96
image-height: 96
slice: [ 0, 32, 32, 0 ]
outset: 0
repeat-vertical: round
repeat-horizontal: round

Просмотреть файл

@ -12,6 +12,7 @@ root:
image-width: 100
image-height: 50
slice: [ 20, 40 ]
outset: 0
repeat-vertical: repeat
repeat-horizontal: repeat
fill: true
@ -24,6 +25,7 @@ root:
image-width: 100
image-height: 50
slice: [ 20, 40 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: repeat
fill: true
@ -35,6 +37,7 @@ root:
image-width: 100
image-height: 50
slice: [ 20, 40 ]
outset: 0
repeat-vertical: repeat
repeat-horizontal: stretch
fill: true
@ -46,6 +49,7 @@ root:
image-width: 100
image-height: 50
slice: [ 20, 40 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: stretch
fill: true

Просмотреть файл

@ -12,6 +12,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: repeat
repeat-horizontal: repeat
fill: true
@ -23,6 +24,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: repeat
fill: true
@ -34,6 +36,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: repeat
repeat-horizontal: stretch
fill: true
@ -45,6 +48,7 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: stretch
fill: true

Просмотреть файл

@ -13,6 +13,7 @@ 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.
@ -24,6 +25,7 @@ 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.
@ -35,5 +37,6 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: round
repeat-horizontal: round

Просмотреть файл

@ -12,5 +12,6 @@ root:
image-width: 96
image-height: 96
slice: [ 32 ]
outset: 0
repeat-vertical: stretch
repeat-horizontal: stretch

Просмотреть файл

@ -9,3 +9,4 @@ root:
radius: [ 200, 200 ]
stops: [ 0.0, red, 0.5, red, 0.5, green ]
slice: [ 50 ]
outset: 0

Просмотреть файл

@ -11,3 +11,4 @@ root:
center: [ 25, 25 ]
radius: [ 50, 50 ]
stops: [ 0.0, red, 1.0, green ]
outset: [ 0, 0, 0, 0 ]

Просмотреть файл

@ -1082,6 +1082,10 @@ 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")
@ -1132,6 +1136,7 @@ impl YamlFrameReader {
fill,
repeat_horizontal,
repeat_vertical,
outset: SideOffsets2D::new(outset[0], outset[1], outset[2], outset[3]),
}))
}
_ => {

Просмотреть файл

@ -3587,11 +3587,17 @@ 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 =
@ -3682,6 +3688,7 @@ 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)};
@ -3717,20 +3724,26 @@ 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);
extendMode,
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
outset[3]));
} 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::ToLayoutSize(gradientRadius), stops, extendMode,
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
outset[3]));
} 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);
extendMode,
wr::ToLayoutSideOffsets(outset[0], outset[1], outset[2],
outset[3]));
}
break;
}