Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp

Issue 2128193004: Update FilterEffect colorspace on color-interpolation-filters changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" 22 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
23 23
24 #include "core/SVGNames.h" 24 #include "core/SVGNames.h"
25 #include "core/layout/svg/LayoutSVGResourceContainer.h" 25 #include "core/layout/svg/LayoutSVGResourceContainer.h"
26 #include "core/layout/svg/LayoutSVGResourceFilterPrimitive.h" 26 #include "core/layout/svg/LayoutSVGResourceFilterPrimitive.h"
27 #include "core/svg/SVGLength.h" 27 #include "core/svg/SVGLength.h"
28 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
28 #include "platform/graphics/filters/FilterEffect.h" 29 #include "platform/graphics/filters/FilterEffect.h"
29 30
30 namespace blink { 31 namespace blink {
31 32
32 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document) 33 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
33 : SVGElement(tagName, document) 34 : SVGElement(tagName, document)
34 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width))) 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width)))
35 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height))) 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height)))
36 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width))) 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width)))
37 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(SVGLengthMode::Height))) 38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(SVGLengthMode::Height)))
(...skipping 17 matching lines...) Expand all
55 DEFINE_TRACE(SVGFilterPrimitiveStandardAttributes) 56 DEFINE_TRACE(SVGFilterPrimitiveStandardAttributes)
56 { 57 {
57 visitor->trace(m_x); 58 visitor->trace(m_x);
58 visitor->trace(m_y); 59 visitor->trace(m_y);
59 visitor->trace(m_width); 60 visitor->trace(m_width);
60 visitor->trace(m_height); 61 visitor->trace(m_height);
61 visitor->trace(m_result); 62 visitor->trace(m_result);
62 SVGElement::trace(visitor); 63 SVGElement::trace(visitor);
63 } 64 }
64 65
65 bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect *, const QualifiedName&) 66 bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect * effect, const QualifiedName& attrName)
66 { 67 {
67 // When all filters support this method, it will be changed to a pure virtua l method. 68 DCHECK(attrName == SVGNames::color_interpolation_filtersAttr);
68 ASSERT_NOT_REACHED(); 69 DCHECK(layoutObject());
69 return false; 70 EColorInterpolation colorInterpolation = layoutObject()->styleRef().svgStyle ().colorInterpolationFilters();
71 ColorSpace resolvedColorSpace = SVGFilterBuilder::resolveColorSpace(colorInt erpolation);
72 if (resolvedColorSpace == effect->operatingColorSpace())
73 return false;
74 effect->setOperatingColorSpace(resolvedColorSpace);
75 return true;
70 } 76 }
71 77
72 void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedNa me& attrName) 78 void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedNa me& attrName)
73 { 79 {
74 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr 80 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
75 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr 81 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr
76 || attrName == SVGNames::resultAttr) { 82 || attrName == SVGNames::resultAttr) {
77 SVGElement::InvalidationGuard invalidationGuard(this); 83 SVGElement::InvalidationGuard invalidationGuard(this);
78 invalidate(); 84 invalidate();
79 return; 85 return;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return; 146 return;
141 147
142 LayoutObject* layoutObject = parent->layoutObject(); 148 LayoutObject* layoutObject = parent->layoutObject();
143 if (!layoutObject || !layoutObject->isSVGResourceFilterPrimitive()) 149 if (!layoutObject || !layoutObject->isSVGResourceFilterPrimitive())
144 return; 150 return;
145 151
146 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(layou tObject, false); 152 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(layou tObject, false);
147 } 153 }
148 154
149 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698