Commit 9aa46ffe authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Commit Bot

Check for a SVGResourceClient in NeedsFilter()

For some LayoutObjects that are "SVG children", we will not create and
associate a SVGResourceClient. Check for the presence of such an object
FragmentPaintPropertyTreeBuilder::UpdateFilter().

Bug: 109224, 1130986
Change-Id: Iab6e73b26a302282ecbe5235d671fbfe90753d62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424124Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#809520}
parent 2bf1a13b
...@@ -1301,7 +1301,8 @@ static bool NeedsFilter(const LayoutObject& object, ...@@ -1301,7 +1301,8 @@ static bool NeedsFilter(const LayoutObject& object,
if (object.IsBoxModelObject() && ToLayoutBoxModelObject(object).HasLayer()) { if (object.IsBoxModelObject() && ToLayoutBoxModelObject(object).HasLayer()) {
if (object.StyleRef().HasFilter() || object.HasReflection()) if (object.StyleRef().HasFilter() || object.HasReflection())
return true; return true;
} else if (object.IsSVGChild()) { } else if (object.IsSVGChild() && !object.IsText() &&
SVGResources::GetClient(object)) {
if (HasReferenceFilterOnly(object.StyleRef())) { if (HasReferenceFilterOnly(object.StyleRef())) {
// Filters don't apply to elements that are descendants of a <clipPath>. // Filters don't apply to elements that are descendants of a <clipPath>.
if (!full_context.has_svg_hidden_container_ancestor || if (!full_context.has_svg_hidden_container_ancestor ||
...@@ -1325,13 +1326,16 @@ static void UpdateFilterEffect(const LayoutObject& object, ...@@ -1325,13 +1326,16 @@ static void UpdateFilterEffect(const LayoutObject& object,
layer->ClearFilterOnEffectNodeDirty(); layer->ClearFilterOnEffectNodeDirty();
return; return;
} }
if (object.IsSVGChild()) { if (object.IsSVGChild() && !object.IsText()) {
SVGElementResourceClient* client = SVGResources::GetClient(object);
if (!client)
return;
if (!HasReferenceFilterOnly(object.StyleRef())) if (!HasReferenceFilterOnly(object.StyleRef()))
return; return;
// Try to use the cached filter. // Try to use the cached filter.
if (effect_node) if (effect_node)
filter = effect_node->Filter(); filter = effect_node->Filter();
SVGResources::GetClient(object)->UpdateFilterData(filter); client->UpdateFilterData(filter);
} }
} }
......
<!doctype html>
<title>Filter primitive (feFlood) with filter reference</title>
<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#FilterProperty">
<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#feFloodElement">
<link rel="match" href="reference/green-100x100.html">
<svg>
<filter id="f" x="0" y="0" width="1" height="1"
color-interpolation-filters="sRGB">
<feFlood flood-color="green" filter="url(#f)"/>
</filter>
<rect width="100" height="100" filter="url(#f)"/>
</svg>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment