Bug 1405399 - Update due to API change in WR cset 75216e5. r?Gankro
MozReview-Commit-ID: GM8qA0MKaHv
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -1074,28 +1074,28 @@ DisplayListBuilder::PushLine(const wr::L
rect.size.height = aLine.end - aLine.start;
}
PushRect(rect, aClip, aLine.color);
*/
}
void
-DisplayListBuilder::PushTextShadow(const wr::LayoutRect& aRect,
- const wr::LayoutRect& aClip,
- bool aIsBackfaceVisible,
- const wr::TextShadow& aShadow)
+DisplayListBuilder::PushShadow(const wr::LayoutRect& aRect,
+ const wr::LayoutRect& aClip,
+ bool aIsBackfaceVisible,
+ const wr::Shadow& aShadow)
{
- wr_dp_push_text_shadow(mWrState, aRect, aClip, aIsBackfaceVisible, aShadow);
+ wr_dp_push_shadow(mWrState, aRect, aClip, aIsBackfaceVisible, aShadow);
}
void
-DisplayListBuilder::PopTextShadow()
+DisplayListBuilder::PopShadow()
{
- wr_dp_pop_text_shadow(mWrState);
+ wr_dp_pop_shadow(mWrState);
}
void
DisplayListBuilder::PushBoxShadow(const wr::LayoutRect& aRect,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::LayoutRect& aBoxBounds,
const wr::LayoutVector2D& aOffset,
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -361,22 +361,22 @@ public:
wr::FontInstanceKey aFontKey,
Range<const wr::GlyphInstance> aGlyphBuffer,
const wr::GlyphOptions* aGlyphOptions = nullptr);
void PushLine(const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::Line& aLine);
- void PushTextShadow(const wr::LayoutRect& aBounds,
+ void PushShadow(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
- const wr::TextShadow& aShadow);
+ const wr::Shadow& aShadow);
- void PopTextShadow();
+ void PopShadow();
void PushBoxShadow(const wr::LayoutRect& aRect,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::LayoutRect& aBoxBounds,
const wr::LayoutVector2D& aOffset,
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1423,33 +1423,33 @@ pub extern "C" fn wr_dp_push_text(state:
.push_text(&prim_info,
&glyph_slice,
font_key,
color,
unsafe { glyph_options.as_ref().cloned() });
}
#[no_mangle]
-pub extern "C" fn wr_dp_push_text_shadow(state: &mut WrState,
- bounds: LayoutRect,
- clip: LayoutRect,
- is_backface_visible: bool,
- shadow: TextShadow) {
+pub extern "C" fn wr_dp_push_shadow(state: &mut WrState,
+ bounds: LayoutRect,
+ clip: LayoutRect,
+ is_backface_visible: bool,
+ shadow: Shadow) {
debug_assert!(unsafe { is_in_main_thread() });
let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into());
prim_info.is_backface_visible = is_backface_visible;
- state.frame_builder.dl_builder.push_text_shadow(&prim_info, shadow.into());
+ state.frame_builder.dl_builder.push_shadow(&prim_info, shadow.into());
}
#[no_mangle]
-pub extern "C" fn wr_dp_pop_text_shadow(state: &mut WrState) {
+pub extern "C" fn wr_dp_pop_shadow(state: &mut WrState) {
debug_assert!(unsafe { is_in_main_thread() });
- state.frame_builder.dl_builder.pop_text_shadow();
+ state.frame_builder.dl_builder.pop_shadow();
}
#[no_mangle]
pub extern "C" fn wr_dp_push_line(state: &mut WrState,
clip: LayoutRect,
is_backface_visible: bool,
baseline: f32,
start: f32,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -541,16 +541,28 @@ struct TypedVector2D_f32__LayerPixel {
y == aOther.y;
}
};
typedef TypedVector2D_f32__LayerPixel LayerVector2D;
typedef LayerVector2D LayoutVector2D;
+struct Shadow {
+ LayoutVector2D offset;
+ ColorF color;
+ float blur_radius;
+
+ bool operator==(const Shadow& aOther) const {
+ return offset == aOther.offset &&
+ color == aOther.color &&
+ blur_radius == aOther.blur_radius;
+ }
+};
+
struct WrFilterOp {
WrFilterOpType filter_type;
float argument;
bool operator==(const WrFilterOp& aOther) const {
return filter_type == aOther.filter_type &&
argument == aOther.argument;
}
@@ -583,28 +595,16 @@ struct GlyphInstance {
struct GlyphOptions {
FontRenderMode render_mode;
bool operator==(const GlyphOptions& aOther) const {
return render_mode == aOther.render_mode;
}
};
-struct TextShadow {
- LayoutVector2D offset;
- ColorF color;
- float blur_radius;
-
- bool operator==(const TextShadow& aOther) const {
- return offset == aOther.offset &&
- color == aOther.color &&
- blur_radius == aOther.blur_radius;
- }
-};
-
typedef YuvColorSpace WrYuvColorSpace;
struct ByteSlice {
const uint8_t *buffer;
size_t len;
bool operator==(const ByteSlice& aOther) const {
return buffer == aOther.buffer &&
@@ -884,21 +884,21 @@ WR_INLINE
void wr_dp_pop_clip_and_scroll_info(WrState *aState)
WR_FUNC;
WR_INLINE
void wr_dp_pop_scroll_layer(WrState *aState)
WR_FUNC;
WR_INLINE
-void wr_dp_pop_stacking_context(WrState *aState)
+void wr_dp_pop_shadow(WrState *aState)
WR_FUNC;
WR_INLINE
-void wr_dp_pop_text_shadow(WrState *aState)
+void wr_dp_pop_stacking_context(WrState *aState)
WR_FUNC;
WR_INLINE
void wr_dp_push_border(WrState *aState,
LayoutRect aRect,
LayoutRect aClip,
bool aIsBackfaceVisible,
BorderWidths aWidths,
@@ -1049,16 +1049,24 @@ void wr_dp_push_rect(WrState *aState,
WR_FUNC;
WR_INLINE
void wr_dp_push_scroll_layer(WrState *aState,
uint64_t aScrollId)
WR_FUNC;
WR_INLINE
+void wr_dp_push_shadow(WrState *aState,
+ LayoutRect aBounds,
+ LayoutRect aClip,
+ bool aIsBackfaceVisible,
+ Shadow aShadow)
+WR_FUNC;
+
+WR_INLINE
void wr_dp_push_stacking_context(WrState *aState,
LayoutRect aBounds,
uint64_t aAnimationId,
const float *aOpacity,
const LayoutTransform *aTransform,
TransformStyle aTransformStyle,
const LayoutTransform *aPerspective,
MixBlendMode aMixBlendMode,
@@ -1074,24 +1082,16 @@ void wr_dp_push_text(WrState *aState,
bool aIsBackfaceVisible,
ColorF aColor,
WrFontInstanceKey aFontKey,
const GlyphInstance *aGlyphs,
uint32_t aGlyphCount,
const GlyphOptions *aGlyphOptions)
WR_FUNC;
-WR_INLINE
-void wr_dp_push_text_shadow(WrState *aState,
- LayoutRect aBounds,
- LayoutRect aClip,
- bool aIsBackfaceVisible,
- TextShadow aShadow)
-WR_FUNC;
-
// Push a 2 planar NV12 image.
WR_INLINE
void wr_dp_push_yuv_NV12_image(WrState *aState,
LayoutRect aBounds,
LayoutRect aClip,
bool aIsBackfaceVisible,
WrImageKey aImageKey0,
WrImageKey aImageKey1,
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6177,17 +6177,17 @@ nsLayoutUtils::PaintTextShadow(const nsI
nscolor shadowColor;
if (shadowDetails->mHasColor)
shadowColor = shadowDetails->mColor;
else
shadowColor = aForegroundColor;
// Webrender just needs the shadow details
if (auto* textDrawer = aContext->GetTextDrawer()) {
- wr::TextShadow wrShadow;
+ wr::Shadow wrShadow;
wrShadow.offset = {
presCtx->AppUnitsToFloatDevPixels(shadowDetails->mXOffset),
presCtx->AppUnitsToFloatDevPixels(shadowDetails->mYOffset)
};
wrShadow.blur_radius = presCtx->AppUnitsToFloatDevPixels(shadowDetails->mRadius);
wrShadow.color = wr::ToColorF(ToDeviceColor(shadowColor));
--- a/layout/generic/TextDrawTarget.h
+++ b/layout/generic/TextDrawTarget.h
@@ -44,17 +44,17 @@ struct SelectionFragment {
//
// Would be broken up into 5 SelectedTextRunFragments
//
// ["Hello ", "there", " my name ", "is Mega", "man"]
//
// For almost all nsTextFrames, there will be only one SelectedTextRunFragment.
struct SelectedTextRunFragment {
Maybe<SelectionFragment> selection;
- nsTArray<wr::TextShadow> shadows;
+ nsTArray<wr::Shadow> shadows;
nsTArray<TextRunFragment> text;
nsTArray<wr::Line> beforeDecorations;
nsTArray<wr::Line> afterDecorations;
};
// This class is fake DrawTarget, used to intercept text draw calls, while
// also collecting up the other aspects of text natively.
//
@@ -158,17 +158,17 @@ public:
nsTArray<Glyph>& glyphs = fragment->glyphs;
size_t oldLength = glyphs.Length();
glyphs.SetLength(oldLength + aBuffer.mNumGlyphs);
PodCopy(glyphs.Elements() + oldLength, aBuffer.mGlyphs, aBuffer.mNumGlyphs);
}
void
- AppendShadow(const wr::TextShadow& aShadow) {
+ AppendShadow(const wr::Shadow& aShadow) {
mCurrentPart->shadows.AppendElement(aShadow);
}
void
SetSelectionRect(const LayoutDeviceRect& aRect, const Color& aColor)
{
SelectionFragment frag;
frag.rect = wr::ToLayoutRect(aRect);
@@ -333,18 +333,18 @@ public:
auto selection = part.selection.value();
aBuilder.PushRect(selection.rect, wrClipRect, backfaceVisible, selection.color);
}
}
for (auto& part : GetParts()) {
// WR takes the shadows in CSS-order (reverse of rendering order),
// because the drawing of a shadow actually occurs when it's popped.
- for (const wr::TextShadow& shadow : part.shadows) {
- aBuilder.PushTextShadow(wrBoundsRect, wrClipRect, backfaceVisible, shadow);
+ for (const wr::Shadow& shadow : part.shadows) {
+ aBuilder.PushShadow(wrBoundsRect, wrClipRect, backfaceVisible, shadow);
}
for (const wr::Line& decoration : part.beforeDecorations) {
aBuilder.PushLine(wrClipRect, backfaceVisible, decoration);
}
for (const mozilla::layout::TextRunFragment& text : part.text) {
aManager->WrBridge()->PushGlyphs(aBuilder, text.glyphs, text.font,
@@ -352,17 +352,17 @@ public:
backfaceVisible);
}
for (const wr::Line& decoration : part.afterDecorations) {
aBuilder.PushLine(wrClipRect, backfaceVisible, decoration);
}
for (size_t i = 0; i < part.shadows.Length(); ++i) {
- aBuilder.PopTextShadow();
+ aBuilder.PopShadow();
}
}
}
private:
// The part of the text we're currently drawing (glyphs, underlines, etc.)
Phase mCurrentlyDrawing;
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -6430,17 +6430,17 @@ nsTextFrame::PaintOneShadow(const PaintS
if (!shadowContext)
return;
nscolor shadowColor = aShadowDetails->mHasColor ? aShadowDetails->mColor
: aParams.foregroundColor;
auto* textDrawer = aParams.context->GetTextDrawer();
if (textDrawer) {
- wr::TextShadow wrShadow;
+ wr::Shadow wrShadow;
wrShadow.offset = {
PresContext()->AppUnitsToFloatDevPixels(aShadowDetails->mXOffset),
PresContext()->AppUnitsToFloatDevPixels(aShadowDetails->mYOffset)
};
wrShadow.blur_radius = PresContext()->AppUnitsToFloatDevPixels(aShadowDetails->mRadius);
wrShadow.color = wr::ToColorF(ToDeviceColor(shadowColor));