зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477366 - Only support SVG filters with a single input with WebRender. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D17088 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
371c7f7819
Коммит
b6afde59b9
|
@ -9347,12 +9347,13 @@ bool nsDisplayFilters::CreateWebRenderCSSFilters(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool nsDisplayFilters::CanCreateWebRenderCommands(nsDisplayListBuilder* aBuilder) {
|
||||
bool nsDisplayFilters::CanCreateWebRenderCommands(
|
||||
nsDisplayListBuilder* aBuilder) {
|
||||
nsTArray<mozilla::wr::FilterOp> wrFilters;
|
||||
Maybe<nsRect> filterClip;
|
||||
if (!CreateWebRenderCSSFilters(wrFilters) &&
|
||||
!nsSVGIntegrationUtils::BuildWebRenderFilters(
|
||||
mFrame, wrFilters, filterClip)) {
|
||||
!nsSVGIntegrationUtils::BuildWebRenderFilters(mFrame, wrFilters,
|
||||
filterClip)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -130,8 +130,26 @@ bool nsFilterInstance::BuildWebRenderFilters(nsIFrame* aFilteredFrame,
|
|||
// case.
|
||||
// We can lift this restriction once we have added support for primitive
|
||||
// subregions to WebRender's filters.
|
||||
for (uint32_t i = 0; i < instance.mFilterDescription.mPrimitives.Length();
|
||||
i++) {
|
||||
const auto& primitive = instance.mFilterDescription.mPrimitives[i];
|
||||
|
||||
// WebRender only supports filters with one input.
|
||||
if (primitive.NumberOfInputs() != 1) {
|
||||
return false;
|
||||
}
|
||||
// The first primitive must have the source graphic as the input, all
|
||||
// other primitives must have the prior primitive as the input, otherwise
|
||||
// it's not supported by WebRender.
|
||||
if (i == 0) {
|
||||
if (primitive.InputPrimitiveIndex(0) !=
|
||||
FilterPrimitiveDescription::kPrimitiveIndexSourceGraphic) {
|
||||
return false;
|
||||
}
|
||||
} else if (primitive.InputPrimitiveIndex(0) != int32_t(i - 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& primitive : instance.mFilterDescription.mPrimitives) {
|
||||
bool primIsSrgb = primitive.OutputColorSpace() == gfx::ColorSpace::SRGB;
|
||||
if (srgb && !primIsSrgb) {
|
||||
aWrFilters.AppendElement(wr::FilterOp::SrgbToLinear());
|
||||
|
|
Загрузка…
Ссылка в новой задаче