Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp |
| index fe15b73088be99170e7c2d132b9826f235e06247..4f18bcacea9cab893f929f41bf5309691b806964 100644 |
| --- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp |
| +++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp |
| @@ -25,7 +25,7 @@ |
| #include "core/layout/svg/LayoutSVGResourceMarker.h" |
| #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
| -#include "core/style/SVGComputedStyle.h" |
| +#include "core/style/ComputedStyle.h" |
| #include "core/svg/SVGFilterElement.h" |
| #include "core/svg/SVGGradientElement.h" |
| #include "core/svg/SVGPatternElement.h" |
| @@ -203,7 +203,7 @@ static inline SVGResources& ensureResources(OwnPtr<SVGResources>& resources) |
| return *resources.get(); |
| } |
| -PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const SVGComputedStyle& style) |
| +PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const ComputedStyle& computedStyle) |
| { |
| ASSERT(object); |
| @@ -220,6 +220,8 @@ PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object |
| TreeScope& treeScope = element->treeScope(); |
| SVGDocumentExtensions& extensions = element->document().accessSVGExtensions(); |
| + const SVGComputedStyle& style = computedStyle.svgStyle(); |
| + |
| OwnPtr<SVGResources> resources; |
| if (clipperFilterMaskerTags().contains(tagName)) { |
| if (style.hasClipper()) { |
| @@ -228,10 +230,17 @@ PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object |
| registerPendingResource(extensions, id, element); |
| } |
| - if (style.hasFilter()) { |
| - AtomicString id = style.filterResource(); |
| - if (!ensureResources(resources).setFilter(getLayoutSVGResourceById<LayoutSVGResourceFilter>(treeScope, id))) |
| - registerPendingResource(extensions, id, element); |
| + if (computedStyle.hasFilter() && !object->isSVGRoot()) { |
| + const FilterOperations& filterOperations = computedStyle.filter(); |
| + if (filterOperations.size() == 1) { |
|
pdr.
2016/06/15 09:50:32
Why do we only use the first filter op instead of
fs
2016/06/15 11:02:43
Because we only want to support the same "subset"
|
| + const FilterOperation& filterOperation = *filterOperations.at(0); |
| + if (filterOperation.type() == FilterOperation::REFERENCE) { |
| + const auto& referenceFilterOperation = toReferenceFilterOperation(filterOperation); |
| + AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(referenceFilterOperation.url(), treeScope); |
| + if (!ensureResources(resources).setFilter(getLayoutSVGResourceById<LayoutSVGResourceFilter>(treeScope, id))) |
| + registerPendingResource(extensions, id, element); |
| + } |
| + } |
| } |
| if (style.hasMasker()) { |