mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1768983 - Add prim flag for checkerboarding backgrounds r=gfx-reviewers,lsalzman
Although not needed right now (checkerboarding backgrounds get a slice anyway due to being a different scroll root), this will be important for the upcoming work to make backdrop filter roots implicit. This allows WR to know when slicing up a content slice if the prim is relevant to the backdrop root. Differential Revision: https://phabricator.services.mozilla.com/D146145
This commit is contained in:
parent
5a63863b53
commit
cebe610723
@ -27,7 +27,7 @@ namespace layers {
|
||||
|
||||
void WebRenderBackgroundData::AddWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder) {
|
||||
aBuilder.PushRect(mBounds, mBounds, true, true, mColor);
|
||||
aBuilder.PushRect(mBounds, mBounds, true, true, false, mColor);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1187,13 +1187,14 @@ wr::WrSpatialId DisplayListBuilder::DefineScrollLayer(
|
||||
void DisplayListBuilder::PushRect(const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible,
|
||||
bool aForceAntiAliasing,
|
||||
bool aForceAntiAliasing, bool aIsCheckerboard,
|
||||
const wr::ColorF& aColor) {
|
||||
wr::LayoutRect clip = MergeClipLeaf(aClip);
|
||||
WRDL_LOG("PushRect b=%s cl=%s c=%s\n", mWrState, ToString(aBounds).c_str(),
|
||||
ToString(clip).c_str(), ToString(aColor).c_str());
|
||||
wr_dp_push_rect(mWrState, aBounds, clip, aIsBackfaceVisible,
|
||||
aForceAntiAliasing, &mCurrentSpaceAndClipChain, aColor);
|
||||
aForceAntiAliasing, aIsCheckerboard,
|
||||
&mCurrentSpaceAndClipChain, aColor);
|
||||
}
|
||||
|
||||
void DisplayListBuilder::PushRoundedRect(const wr::LayoutRect& aBounds,
|
||||
|
@ -481,7 +481,7 @@ class DisplayListBuilder final {
|
||||
|
||||
void PushRect(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, bool aForceAntiAliasing,
|
||||
const wr::ColorF& aColor);
|
||||
bool aIsCheckerboard, const wr::ColorF& aColor);
|
||||
void PushRectWithAnimation(const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible, const wr::ColorF& aColor,
|
||||
|
@ -2873,6 +2873,7 @@ pub extern "C" fn wr_dp_push_rect(
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
force_antialiasing: bool,
|
||||
is_checkerboard: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
color: ColorF,
|
||||
) {
|
||||
@ -2882,6 +2883,9 @@ pub extern "C" fn wr_dp_push_rect(
|
||||
if force_antialiasing {
|
||||
prim_info.flags |= PrimitiveFlags::ANTIALISED;
|
||||
}
|
||||
if is_checkerboard {
|
||||
prim_info.flags |= PrimitiveFlags::CHECKERBOARD_BACKGROUND;
|
||||
}
|
||||
|
||||
state.frame_builder.dl_builder.push_rect(&prim_info, rect, color);
|
||||
}
|
||||
|
@ -1334,6 +1334,10 @@ impl<'a> SceneBuilder<'a> {
|
||||
color: info.color.into(),
|
||||
},
|
||||
);
|
||||
|
||||
if info.common.flags.contains(PrimitiveFlags::CHECKERBOARD_BACKGROUND) {
|
||||
self.add_tile_cache_barrier_if_needed(SliceFlags::empty());
|
||||
}
|
||||
}
|
||||
DisplayItem::HitTest(ref info) => {
|
||||
profile_scope!("hit_test");
|
||||
|
@ -54,6 +54,8 @@ bitflags! {
|
||||
const SUPPORTS_EXTERNAL_COMPOSITOR_SURFACE = 1 << 4;
|
||||
/// This flags disables snapping and forces anti-aliasing even if the primitive is axis-aligned.
|
||||
const ANTIALISED = 1 << 5;
|
||||
/// If true, this primitive is used as a background for checkerboarding
|
||||
const CHECKERBOARD_BACKGROUND = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5368,8 +5368,11 @@ void PresShell::AddCanvasBackgroundColorItem(
|
||||
nsLayoutUtils::UsesAsyncScrolling(aFrame) && NS_GET_A(bgcolor) == 255;
|
||||
|
||||
if (!addedScrollingBackgroundColor || forceUnscrolledItem) {
|
||||
nsDisplayItem* item = MakeDisplayItem<nsDisplaySolidColor>(
|
||||
nsDisplaySolidColor* item = MakeDisplayItem<nsDisplaySolidColor>(
|
||||
aBuilder, aFrame, aBounds, bgcolor);
|
||||
if (addedScrollingBackgroundColor) {
|
||||
item->SetIsCheckerboardBackground();
|
||||
}
|
||||
AddDisplayItemToBottom(aBuilder, aList, item);
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ class TextDrawTarget : public DrawTarget {
|
||||
const DeviceColor& aColor) {
|
||||
auto rect = wr::ToLayoutRect(aRect);
|
||||
auto color = wr::ToColorF(aColor);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, false, color);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, false, false, color);
|
||||
}
|
||||
|
||||
// This function is basically designed to slide into the decoration drawing
|
||||
@ -459,7 +459,7 @@ class TextDrawTarget : public DrawTarget {
|
||||
auto rect = wr::ToLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto color =
|
||||
wr::ToColorF(static_cast<const ColorPattern&>(aPattern).mColor);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, false, color);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, false, false, color);
|
||||
}
|
||||
|
||||
void StrokeRect(const Rect& aRect, const Pattern& aPattern,
|
||||
|
@ -355,7 +355,7 @@ bool nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(
|
||||
LayoutDeviceRect::FromAppUnits(bgClipRect, appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect r = wr::ToLayoutRect(rect);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
return true;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ bool nsDisplaySelectionOverlay::CreateWebRenderCommands(
|
||||
wr::LayoutRect bounds = wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
nsRect(ToReferenceFrame(), Frame()->GetSize()),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel()));
|
||||
aBuilder.PushRect(bounds, bounds, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(bounds, bounds, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(ComputeColor()));
|
||||
return true;
|
||||
}
|
||||
|
@ -2793,7 +2793,7 @@ bool nsDisplaySolidColor::CreateWebRenderCommands(
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
|
||||
mBounds, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect r = wr::ToLayoutRect(bounds);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false, mIsCheckerboardBackground,
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
|
||||
return true;
|
||||
@ -2831,7 +2831,7 @@ bool nsDisplaySolidColorRegion::CreateWebRenderCommands(
|
||||
LayoutDeviceRect layerRects = LayoutDeviceRect::FromAppUnits(
|
||||
rect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect r = wr::ToLayoutRect(layerRects);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
}
|
||||
|
||||
@ -3864,7 +3864,7 @@ bool nsDisplayBackgroundColor::CreateWebRenderCommands(
|
||||
wr::ToColorF(ToDeviceColor(color)), &prop);
|
||||
} else {
|
||||
aBuilder.StartGroup(this);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(ToDeviceColor(color)));
|
||||
aBuilder.FinishGroup();
|
||||
}
|
||||
@ -4186,11 +4186,11 @@ bool nsDisplayCaret::CreateWebRenderCommands(
|
||||
wr::LayoutRect hook = wr::ToLayoutRect(devHookRect);
|
||||
|
||||
// Note, WR will pixel snap anything that is layout aligned.
|
||||
aBuilder.PushRect(caret, caret, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(caret, caret, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(color));
|
||||
|
||||
if (!devHookRect.IsEmpty()) {
|
||||
aBuilder.PushRect(hook, hook, !BackfaceIsHidden(), false,
|
||||
aBuilder.PushRect(hook, hook, !BackfaceIsHidden(), false, false,
|
||||
wr::ToColorF(color));
|
||||
}
|
||||
return true;
|
||||
|
@ -3977,7 +3977,9 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase {
|
||||
nsDisplaySolidColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aBounds, nscolor aColor,
|
||||
bool aCanBeReused = true)
|
||||
: nsDisplaySolidColorBase(aBuilder, aFrame, aColor), mBounds(aBounds) {
|
||||
: nsDisplaySolidColorBase(aBuilder, aFrame, aColor),
|
||||
mBounds(aBounds),
|
||||
mIsCheckerboardBackground(false) {
|
||||
NS_ASSERTION(NS_GET_A(aColor) > 0,
|
||||
"Don't create invisible nsDisplaySolidColors!");
|
||||
MOZ_COUNT_CTOR(nsDisplaySolidColor);
|
||||
@ -3993,6 +3995,7 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase {
|
||||
nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override;
|
||||
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
void WriteDebugInfo(std::stringstream& aStream) override;
|
||||
void SetIsCheckerboardBackground() { mIsCheckerboardBackground = true; }
|
||||
bool CreateWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
@ -4010,6 +4013,7 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase {
|
||||
|
||||
private:
|
||||
nsRect mBounds;
|
||||
bool mIsCheckerboardBackground;
|
||||
Maybe<int32_t> mOverrideZIndex;
|
||||
};
|
||||
|
||||
|
@ -853,7 +853,8 @@ bool SVGGeometryFrame::CreateWebRenderCommands(
|
||||
((float)NS_GET_R(c)) / 255.0f, ((float)NS_GET_G(c)) / 255.0f,
|
||||
((float)NS_GET_B(c)) / 255.0f, ((float)NS_GET_A(c)) / 255.0f * opacity};
|
||||
|
||||
aBuilder.PushRect(wrRect, wrRect, !aItem->BackfaceIsHidden(), true, color);
|
||||
aBuilder.PushRect(wrRect, wrRect, !aItem->BackfaceIsHidden(), true, false,
|
||||
color);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -6853,7 +6853,8 @@ static void CreateWRCommandsForBeveledBorder(
|
||||
aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBackfaceIsVisible, false);
|
||||
|
||||
aBuilder.PushRect(r, r, aBorderParams.mBackfaceIsVisible, false, color);
|
||||
aBuilder.PushRect(r, r, aBorderParams.mBackfaceIsVisible, false, false,
|
||||
color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ void nsDisplaySliderMarks::PaintMarks(nsDisplayListBuilder* aDisplayListBuilder,
|
||||
dRect.Inflate(increasePixelsX, increasePixelsY);
|
||||
wr::LayoutRect layoutRect = wr::ToLayoutRect(dRect);
|
||||
aBuilder->PushRect(layoutRect, layoutRect, BackfaceIsHidden(), false,
|
||||
wr::ToColorF(fillColor));
|
||||
false, wr::ToColorF(fillColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
[root-canvas-001.xht]
|
||||
fuzzy:
|
||||
if (os == "win"): maxDifference=91-93;totalPixels=2250-2300
|
@ -20,7 +20,7 @@ void ThemeDrawing::FillRect(WebRenderBackendData& aWrData,
|
||||
const sRGBColor& aColor) {
|
||||
const bool kBackfaceIsVisible = true;
|
||||
auto dest = wr::ToLayoutRect(aRect);
|
||||
aWrData.mBuilder.PushRect(dest, dest, kBackfaceIsVisible, false,
|
||||
aWrData.mBuilder.PushRect(dest, dest, kBackfaceIsVisible, false, false,
|
||||
wr::ToColorF(ToDeviceColor(aColor)));
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void ThemeDrawing::PaintRoundedRectWithRadius(
|
||||
}();
|
||||
if (radius == 0.0f) {
|
||||
aWrData.mBuilder.PushRect(backgroundRect, clip, kBackfaceIsVisible, false,
|
||||
backgroundColor);
|
||||
false, backgroundColor);
|
||||
} else {
|
||||
// NOTE(emilio): This follows DisplayListBuilder::PushRoundedRect and
|
||||
// draws the rounded fill as an extra thick rounded border instead of a
|
||||
|
Loading…
Reference in New Issue
Block a user