Bug 1491395. Replace BorderWidths with LayoutSideOffsets. on a CLOSED TREE

--HG--
extra : source : 432d22af68c825eebd86482c714b3cffcba408c7
extra : amend_source : e38a2ed15ae4a93613244726fbfad2d196876ad8
This commit is contained in:
Jeff Muizelaar 2018-09-18 09:01:36 -04:00
parent 5c975145e9
commit 14d863897b
8 changed files with 36 additions and 48 deletions

View File

@ -1181,7 +1181,7 @@ void
DisplayListBuilder::PushBorder(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const Range<const wr::BorderSide>& aSides,
const wr::BorderRadius& aRadius)
{
@ -1197,7 +1197,7 @@ void
DisplayListBuilder::PushBorderImage(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
wr::ImageKey aImage,
const uint32_t aWidth,
const uint32_t aHeight,
@ -1215,7 +1215,7 @@ void
DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const uint32_t aWidth,
const uint32_t aHeight,
const wr::SideOffsets2D<uint32_t>& aSlice,
@ -1236,7 +1236,7 @@ void
DisplayListBuilder::PushBorderRadialGradient(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const wr::LayoutPoint& aCenter,
const wr::LayoutSize& aRadius,
const nsTArray<wr::GradientStop>& aStops,

View File

@ -422,14 +422,14 @@ public:
void PushBorder(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const Range<const wr::BorderSide>& aSides,
const wr::BorderRadius& aRadius);
void PushBorderImage(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
wr::ImageKey aImage,
const uint32_t aWidth,
const uint32_t aHeight,
@ -441,7 +441,7 @@ public:
void PushBorderGradient(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const uint32_t aWidth,
const uint32_t aHeight,
const wr::SideOffsets2D<uint32_t>& aSlice,
@ -454,7 +454,7 @@ public:
void PushBorderRadialGradient(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::BorderWidths& aWidths,
const wr::LayoutSideOffsets& aWidths,
const wr::LayoutPoint& aCenter,
const wr::LayoutSize& aRadius,
const nsTArray<wr::GradientStop>& aStops,

View File

@ -486,9 +486,9 @@ static inline wr::BorderRadius ToBorderRadius(const mozilla::LayoutDeviceSize& t
return br;
}
static inline wr::BorderWidths ToBorderWidths(float top, float right, float bottom, float left)
static inline wr::LayoutSideOffsets ToBorderWidths(float top, float right, float bottom, float left)
{
wr::BorderWidths bw;
wr::LayoutSideOffsets bw;
bw.top = top;
bw.right = right;
bw.bottom = bottom;

View File

@ -2158,7 +2158,7 @@ pub extern "C" fn wr_dp_push_border(state: &mut WrState,
rect: LayoutRect,
clip: LayoutRect,
is_backface_visible: bool,
widths: BorderWidths,
widths: LayoutSideOffsets,
top: BorderSide,
right: BorderSide,
bottom: BorderSide,
@ -2188,7 +2188,7 @@ pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
rect: LayoutRect,
clip: LayoutRect,
is_backface_visible: bool,
widths: BorderWidths,
widths: LayoutSideOffsets,
image: WrImageKey,
width: u32,
height: u32,
@ -2219,7 +2219,7 @@ pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
rect: LayoutRect,
clip: LayoutRect,
is_backface_visible: bool,
widths: BorderWidths,
widths: LayoutSideOffsets,
width: u32,
height: u32,
slice: SideOffsets2D<u32>,
@ -2265,7 +2265,7 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
rect: LayoutRect,
clip: LayoutRect,
is_backface_visible: bool,
widths: BorderWidths,
widths: LayoutSideOffsets,
center: LayoutPoint,
radius: LayoutSize,
stops: *const GradientStop,

View File

@ -659,20 +659,23 @@ struct TypedVector2D {
using LayoutVector2D = TypedVector2D<float, LayoutPixel>;
struct BorderWidths {
float left;
float top;
float right;
float bottom;
template<typename T, typename U>
struct TypedSideOffsets2D {
T top;
T right;
T bottom;
T left;
bool operator==(const BorderWidths& aOther) const {
return left == aOther.left &&
top == aOther.top &&
bool operator==(const TypedSideOffsets2D& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom;
bottom == aOther.bottom &&
left == aOther.left;
}
};
using LayoutSideOffsets = TypedSideOffsets2D<float, LayoutPixel>;
// Represents RGBA screen colors with floating point numbers.
//
// All components must be between 0.0 and 1.0.
@ -701,21 +704,6 @@ struct BorderSide {
}
};
template<typename T, typename U>
struct TypedSideOffsets2D {
T top;
T right;
T bottom;
T left;
bool operator==(const TypedSideOffsets2D& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
// The default side offset type with no unit.
template<typename T>
using SideOffsets2D = TypedSideOffsets2D<T, UnknownUnit>;
@ -1241,7 +1229,7 @@ void wr_dp_push_border(WrState *aState,
LayoutRect aRect,
LayoutRect aClip,
bool aIsBackfaceVisible,
BorderWidths aWidths,
LayoutSideOffsets aWidths,
BorderSide aTop,
BorderSide aRight,
BorderSide aBottom,
@ -1254,7 +1242,7 @@ void wr_dp_push_border_gradient(WrState *aState,
LayoutRect aRect,
LayoutRect aClip,
bool aIsBackfaceVisible,
BorderWidths aWidths,
LayoutSideOffsets aWidths,
uint32_t aWidth,
uint32_t aHeight,
SideOffsets2D<uint32_t> aSlice,
@ -1271,7 +1259,7 @@ void wr_dp_push_border_image(WrState *aState,
LayoutRect aRect,
LayoutRect aClip,
bool aIsBackfaceVisible,
BorderWidths aWidths,
LayoutSideOffsets aWidths,
WrImageKey aImage,
uint32_t aWidth,
uint32_t aHeight,
@ -1286,7 +1274,7 @@ void wr_dp_push_border_radial_gradient(WrState *aState,
LayoutRect aRect,
LayoutRect aClip,
bool aIsBackfaceVisible,
BorderWidths aWidths,
LayoutSideOffsets aWidths,
LayoutPoint aCenter,
LayoutSize aRadius,
const GradientStop *aStops,

View File

@ -448,7 +448,7 @@ public:
MOZ_RELEASE_ASSERT(aPattern.GetType() == PatternType::COLOR &&
aStrokeOptions.mDashLength == 0);
wr::BorderWidths widths = {
wr::LayoutSideOffsets widths = {
aStrokeOptions.mLineWidth,
aStrokeOptions.mLineWidth,
aStrokeOptions.mLineWidth,

View File

@ -7554,7 +7554,7 @@ BCBlockDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
// All border style is set to none except left side. So setting the widths of
// each side to width of rect is fine.
wr::BorderWidths borderWidths = wr::ToBorderWidths(roundedRect.size.width,
wr::LayoutSideOffsets borderWidths = wr::ToBorderWidths(roundedRect.size.width,
roundedRect.size.width,
roundedRect.size.width,
roundedRect.size.width);
@ -7841,7 +7841,7 @@ BCInlineDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
// All border style is set to none except top side. So setting the widths of
// each side to height of rect is fine.
wr::BorderWidths borderWidths = wr::ToBorderWidths(roundedRect.size.height,
wr::LayoutSideOffsets borderWidths = wr::ToBorderWidths(roundedRect.size.height,
roundedRect.size.height,
roundedRect.size.height,
roundedRect.size.height);
@ -8086,7 +8086,7 @@ nsTableFrame::CreateWebRenderCommandsForBCBorders(wr::DisplayListBuilder& aBuild
LayoutDeviceRect allBorderRect;
wr::BorderSide wrSide[4];
wr::BorderWidths wrWidths;
wr::LayoutSideOffsets wrWidths;
wr::BorderRadius borderRadii = wr::EmptyBorderRadius();
bool backfaceIsVisible = false;
NS_FOR_CSS_SIDES(side) {

View File

@ -3942,7 +3942,7 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
wr::BorderRadius borderRadius = wr::EmptyBorderRadius();
float borderWidth = presContext->CSSPixelsToDevPixels(1.0f);
wr::BorderWidths borderWidths =
wr::LayoutSideOffsets borderWidths =
wr::ToBorderWidths(borderWidth, borderWidth, borderWidth, borderWidth);
mozilla::Range<const wr::BorderSide> wrsides(side, 4);
@ -3965,7 +3965,7 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
wr::BorderRadius borderRadius = wr::EmptyBorderRadius();
float borderWidth = presContext->CSSPixelsToDevPixels(1.0f);
wr::BorderWidths borderWidths =
wr::LayoutSideOffsets borderWidths =
wr::ToBorderWidths(borderWidth, borderWidth, borderWidth, borderWidth);
mozilla::Range<const wr::BorderSide> wrsides(side, 4);