OLD | NEW |
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 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #include "core/layout/svg/LayoutSVGResourceFilter.h" | 24 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
25 | 25 |
| 26 #include "core/svg/SVGFilterElement.h" |
26 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" | 27 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" |
| 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
27 | 29 |
28 namespace blink { | 30 namespace blink { |
29 | 31 |
30 DEFINE_TRACE(FilterData) | 32 DEFINE_TRACE(FilterData) |
31 { | 33 { |
32 visitor->trace(filter); | 34 visitor->trace(lastEffect); |
33 visitor->trace(nodeMap); | 35 visitor->trace(nodeMap); |
34 } | 36 } |
35 | 37 |
36 void FilterData::dispose() | 38 void FilterData::dispose() |
37 { | 39 { |
38 nodeMap = nullptr; | 40 nodeMap = nullptr; |
39 filter = nullptr; | 41 lastEffect = nullptr; |
40 } | 42 } |
41 | 43 |
42 LayoutSVGResourceFilter::LayoutSVGResourceFilter(SVGFilterElement* node) | 44 LayoutSVGResourceFilter::LayoutSVGResourceFilter(SVGFilterElement* node) |
43 : LayoutSVGResourceContainer(node) | 45 : LayoutSVGResourceContainer(node) |
44 { | 46 { |
45 } | 47 } |
46 | 48 |
47 LayoutSVGResourceFilter::~LayoutSVGResourceFilter() | 49 LayoutSVGResourceFilter::~LayoutSVGResourceFilter() |
48 { | 50 { |
49 } | 51 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 93 } |
92 | 94 |
93 FloatRect LayoutSVGResourceFilter::resourceBoundingBox(const LayoutObject* objec
t) | 95 FloatRect LayoutSVGResourceFilter::resourceBoundingBox(const LayoutObject* objec
t) |
94 { | 96 { |
95 if (SVGFilterElement* element = toSVGFilterElement(this->element())) | 97 if (SVGFilterElement* element = toSVGFilterElement(this->element())) |
96 return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, ele
ment->filterUnits()->currentValue()->enumValue(), object->objectBoundingBox()); | 98 return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, ele
ment->filterUnits()->currentValue()->enumValue(), object->objectBoundingBox()); |
97 | 99 |
98 return FloatRect(); | 100 return FloatRect(); |
99 } | 101 } |
100 | 102 |
| 103 SVGUnitTypes::SVGUnitType LayoutSVGResourceFilter::filterUnits() const |
| 104 { |
| 105 return toSVGFilterElement(element())->filterUnits()->currentValue()->enumVal
ue(); |
| 106 } |
| 107 |
| 108 SVGUnitTypes::SVGUnitType LayoutSVGResourceFilter::primitiveUnits() const |
| 109 { |
| 110 return toSVGFilterElement(element())->primitiveUnits()->currentValue()->enum
Value(); |
| 111 } |
| 112 |
101 void LayoutSVGResourceFilter::primitiveAttributeChanged(LayoutObject* object, co
nst QualifiedName& attribute) | 113 void LayoutSVGResourceFilter::primitiveAttributeChanged(LayoutObject* object, co
nst QualifiedName& attribute) |
102 { | 114 { |
103 SVGFilterPrimitiveStandardAttributes* primitive = static_cast<SVGFilterPrimi
tiveStandardAttributes*>(object->node()); | 115 SVGFilterPrimitiveStandardAttributes* primitive = static_cast<SVGFilterPrimi
tiveStandardAttributes*>(object->node()); |
104 | 116 |
105 for (auto& filter : m_filter) { | 117 for (auto& filter : m_filter) { |
106 FilterData* filterData = filter.value.get(); | 118 FilterData* filterData = filter.value.get(); |
107 if (filterData->m_state != FilterData::ReadyToPaint) | 119 if (filterData->m_state != FilterData::ReadyToPaint) |
108 continue; | 120 continue; |
109 | 121 |
110 SVGFilterGraphNodeMap* nodeMap = filterData->nodeMap.get(); | 122 SVGFilterGraphNodeMap* nodeMap = filterData->nodeMap.get(); |
111 FilterEffect* effect = nodeMap->effectByRenderer(object); | 123 FilterEffect* effect = nodeMap->effectByRenderer(object); |
112 if (!effect) | 124 if (!effect) |
113 continue; | 125 continue; |
114 // Since all effects shares the same attribute value, all | 126 // Since all effects shares the same attribute value, all |
115 // or none of them will be changed. | 127 // or none of them will be changed. |
116 if (!primitive->setFilterEffectAttribute(effect, attribute)) | 128 if (!primitive->setFilterEffectAttribute(effect, attribute)) |
117 return; | 129 return; |
118 nodeMap->invalidateDependentEffects(effect); | 130 nodeMap->invalidateDependentEffects(effect); |
119 | 131 |
120 // Issue paint invalidations for the image on the screen. | 132 // Issue paint invalidations for the image on the screen. |
121 markClientForInvalidation(filter.key, PaintInvalidation); | 133 markClientForInvalidation(filter.key, PaintInvalidation); |
122 } | 134 } |
123 markAllResourceClientsForInvalidation(); | 135 markAllResourceClientsForInvalidation(); |
124 } | 136 } |
125 | 137 |
126 } // namespace blink | 138 } // namespace blink |
OLD | NEW |