mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1337291
- Part2. Pass border style to webrender. r=mattwoodrow
This commit is contained in:
parent
b782e91daf
commit
ca5a5c5ca8
@ -54,10 +54,10 @@ WebRenderBorderLayer::RenderLayer()
|
||||
FrameMetrics::NULL_SCROLL_ID));
|
||||
WrBridge()->AddWebRenderCommand(
|
||||
OpDPPushBorder(wr::ToWrRect(rect), wr::ToWrRect(clip),
|
||||
wr::ToWrBorderSide(mWidths[0], mColors[0]),
|
||||
wr::ToWrBorderSide(mWidths[1], mColors[1]),
|
||||
wr::ToWrBorderSide(mWidths[2], mColors[2]),
|
||||
wr::ToWrBorderSide(mWidths[3], mColors[3]),
|
||||
wr::ToWrBorderSide(mWidths[0], mColors[0], mBorderStyles[0]),
|
||||
wr::ToWrBorderSide(mWidths[1], mColors[1], mBorderStyles[1]),
|
||||
wr::ToWrBorderSide(mWidths[2], mColors[2], mBorderStyles[2]),
|
||||
wr::ToWrBorderSide(mWidths[3], mColors[3], mBorderStyles[3]),
|
||||
wr::ToWrBorderRadius(mCorners[0], mCorners[1], mCorners[3], mCorners[2])));
|
||||
WrBridge()->AddWebRenderCommand(OpDPPopStackingContext());
|
||||
}
|
||||
|
@ -78,12 +78,41 @@ static inline WrColor ToWrColor(const gfx::Color& color)
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline WrBorderSide ToWrBorderSide(const LayerCoord width, const gfx::Color& color)
|
||||
static inline WrBorderStyle ToWrBorderStyle(const uint8_t& style)
|
||||
{
|
||||
switch (style) {
|
||||
case NS_STYLE_BORDER_STYLE_NONE:
|
||||
return WrBorderStyle::None;
|
||||
case NS_STYLE_BORDER_STYLE_SOLID:
|
||||
return WrBorderStyle::Solid;
|
||||
case NS_STYLE_BORDER_STYLE_DOUBLE:
|
||||
return WrBorderStyle::Double;
|
||||
case NS_STYLE_BORDER_STYLE_DOTTED:
|
||||
return WrBorderStyle::Dotted;
|
||||
case NS_STYLE_BORDER_STYLE_DASHED:
|
||||
return WrBorderStyle::Dashed;
|
||||
case NS_STYLE_BORDER_STYLE_HIDDEN:
|
||||
return WrBorderStyle::Hidden;
|
||||
case NS_STYLE_BORDER_STYLE_GROOVE:
|
||||
return WrBorderStyle::Groove;
|
||||
case NS_STYLE_BORDER_STYLE_RIDGE:
|
||||
return WrBorderStyle::Ridge;
|
||||
case NS_STYLE_BORDER_STYLE_INSET:
|
||||
return WrBorderStyle::Inset;
|
||||
case NS_STYLE_BORDER_STYLE_OUTSET:
|
||||
return WrBorderStyle::Outset;
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
return WrBorderStyle::None;
|
||||
}
|
||||
|
||||
static inline WrBorderSide ToWrBorderSide(const LayerCoord width, const gfx::Color& color, const uint8_t& style)
|
||||
{
|
||||
WrBorderSide bs;
|
||||
bs.width = width;
|
||||
bs.color = ToWrColor(color);
|
||||
bs.style = WrBorderStyle::Solid;
|
||||
bs.style = ToWrBorderStyle(style);
|
||||
return bs;
|
||||
}
|
||||
|
||||
|
@ -4413,6 +4413,25 @@ nsDisplayBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
LayersBackend backend = aManager->GetBackendType();
|
||||
if (backend == layers::LayersBackend::LAYERS_WR) {
|
||||
bool hasCompositeColors;
|
||||
br->AllBordersSolid(&hasCompositeColors);
|
||||
if (hasCompositeColors) {
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
mColors[i] = ToDeviceColor(br->mBorderColors[i]);
|
||||
mWidths[i] = br->mBorderWidths[i];
|
||||
mBorderStyles[i] = br->mBorderStyles[i];
|
||||
}
|
||||
|
||||
mRect = ViewAs<LayerPixel>(br->mOuterRect);
|
||||
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
bool hasCompositeColors;
|
||||
if (!br->AllBordersSolid(&hasCompositeColors) || hasCompositeColors) {
|
||||
return LAYER_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user