| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Adobe Systems Inc. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Apple Inc. All rights reserved. | 4 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 Element* filter = document->getElementById(filterOperation->fragment()); | 128 Element* filter = document->getElementById(filterOperation->fragment()); |
| 129 | 129 |
| 130 if (!filter) { | 130 if (!filter) { |
| 131 // Although we did not find the referenced filter, it might exist later | 131 // Although we did not find the referenced filter, it might exist later |
| 132 // in the document | 132 // in the document |
| 133 document->accessSVGExtensions().addPendingResource(filterOperation->frag
ment(), toElement(renderer->node())); | 133 document->accessSVGExtensions().addPendingResource(filterOperation->frag
ment(), toElement(renderer->node())); |
| 134 return nullptr; | 134 return nullptr; |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (!filter->isSVGElement() || !filter->hasTagName(SVGNames::filterTag)) | 137 if (!isSVGFilterElement(*filter)) |
| 138 return nullptr; | 138 return nullptr; |
| 139 | 139 |
| 140 SVGFilterElement* filterElement = toSVGFilterElement(toSVGElement(filter)); | 140 SVGFilterElement& filterElement = toSVGFilterElement(*filter); |
| 141 | 141 |
| 142 // FIXME: Figure out what to do with SourceAlpha. Right now, we're | 142 // FIXME: Figure out what to do with SourceAlpha. Right now, we're |
| 143 // using the alpha of the original input layer, which is obviously | 143 // using the alpha of the original input layer, which is obviously |
| 144 // wrong. We should probably be extracting the alpha from the | 144 // wrong. We should probably be extracting the alpha from the |
| 145 // previousEffect, but this requires some more processing. | 145 // previousEffect, but this requires some more processing. |
| 146 // This may need a spec clarification. | 146 // This may need a spec clarification. |
| 147 RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect,
SourceAlpha::create(parentFilter)); | 147 RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect,
SourceAlpha::create(parentFilter)); |
| 148 | 148 |
| 149 ColorSpace filterColorSpace = ColorSpaceDeviceRGB; | 149 ColorSpace filterColorSpace = ColorSpaceDeviceRGB; |
| 150 bool useFilterColorSpace = getSVGElementColorSpace(filterElement, filterColo
rSpace); | 150 bool useFilterColorSpace = getSVGElementColorSpace(&filterElement, filterCol
orSpace); |
| 151 | 151 |
| 152 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement)
; element; element = Traversal<SVGElement>::nextSibling(*element)) { | 152 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement);
element; element = Traversal<SVGElement>::nextSibling(*element)) { |
| 153 if (!element->isFilterEffect()) | 153 if (!element->isFilterEffect()) |
| 154 continue; | 154 continue; |
| 155 | 155 |
| 156 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); | 156 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); |
| 157 | 157 |
| 158 RefPtr<FilterEffect> effect = effectElement->build(builder.get(), parent
Filter); | 158 RefPtr<FilterEffect> effect = effectElement->build(builder.get(), parent
Filter); |
| 159 if (!effect) | 159 if (!effect) |
| 160 continue; | 160 continue; |
| 161 | 161 |
| 162 effectElement->setStandardAttributes(effect.get()); | 162 effectElement->setStandardAttributes(effect.get()); |
| 163 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur
rentValue()->enumValue(), parentFilter->sourceImageRect())); | 163 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr
entValue()->enumValue(), parentFilter->sourceImageRect())); |
| 164 ColorSpace colorSpace = filterColorSpace; | 164 ColorSpace colorSpace = filterColorSpace; |
| 165 if (useFilterColorSpace || getSVGElementColorSpace(effectElement, colorS
pace)) | 165 if (useFilterColorSpace || getSVGElementColorSpace(effectElement, colorS
pace)) |
| 166 effect->setOperatingColorSpace(colorSpace); | 166 effect->setOperatingColorSpace(colorSpace); |
| 167 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); | 167 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); |
| 168 } | 168 } |
| 169 return builder->lastEffect(); | 169 return builder->lastEffect(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace WebCore | 172 } // namespace WebCore |
| OLD | NEW |