diff options
author | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
---|---|---|
committer | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
commit | 5f1ab04193ad0130ca8204aadaceae083aca9881 (patch) | |
tree | 5a92cd389e2cfe7fb67197ce14b38469462379f8 /WebCore/svg | |
parent | 194315e5a908cc8ed67d597010544803eef1ac59 (diff) | |
download | external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2 |
Get WebKit r44544.
Diffstat (limited to 'WebCore/svg')
185 files changed, 1085 insertions, 1279 deletions
diff --git a/WebCore/svg/Filter.cpp b/WebCore/svg/Filter.cpp deleted file mode 100644 index 24a9fb8..0000000 --- a/WebCore/svg/Filter.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "Filter.h" - -namespace WebCore { - -Filter::Filter(FilterEffect* effect) - : m_effect(effect) -{ -} - -PassRefPtr<Filter> Filter::create(FilterEffect* effect) -{ - return adoptRef(new Filter(effect)); -} - -} //namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/Filter.h b/WebCore/svg/Filter.h deleted file mode 100644 index f3a110e..0000000 --- a/WebCore/svg/Filter.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef Filter_h -#define Filter_h - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - - class Filter : public RefCounted<Filter> { - public: - static PassRefPtr<Filter> create(FilterEffect*); - - private: - Filter(FilterEffect* effect); - - RefPtr<FilterEffect> m_effect; - }; - -} //namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) -#endif diff --git a/WebCore/svg/FilterEffect.cpp b/WebCore/svg/FilterEffect.cpp deleted file mode 100644 index 24c187c..0000000 --- a/WebCore/svg/FilterEffect.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) Alex Mathews <possessedpenguinbob@gmail.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - -FilterEffect::FilterEffect() -{ -} - -FilterEffect::~FilterEffect() -{ -} - -TextStream& FilterEffect::externalRepresentation(TextStream& ts) const -{ - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/FilterEffect.h b/WebCore/svg/FilterEffect.h deleted file mode 100644 index 8f53ae1..0000000 --- a/WebCore/svg/FilterEffect.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef FilterEffect_h -#define FilterEffect_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "TextStream.h" - -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - - class FilterEffect : public RefCounted<FilterEffect> { - public: - virtual ~FilterEffect(); - - virtual void apply() = 0; - virtual void dump() = 0; - - virtual TextStream& externalRepresentation(TextStream&) const; - protected: - FilterEffect(); - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // FilterEffect_h diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp index c7e055c..6fd0274 100644 --- a/WebCore/svg/SVGAElement.cpp +++ b/WebCore/svg/SVGAElement.cpp @@ -34,13 +34,14 @@ #include "Frame.h" #include "FrameLoader.h" #include "KeyboardEvent.h" +#include "MappedAttribute.h" #include "MouseEvent.h" #include "PlatformMouseEvent.h" -#include "RenderSVGTransformableContainer.h" #include "RenderSVGInline.h" +#include "RenderSVGTransformableContainer.h" #include "ResourceRequest.h" -#include "SVGSMILElement.h" #include "SVGNames.h" +#include "SVGSMILElement.h" #include "XLinkNames.h" namespace WebCore { @@ -92,7 +93,7 @@ void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) setIsLink(!href().isNull()); if (wasLink != isLink()) - setChanged(); + setNeedsStyleRecalc(); } } diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp index 861f353..44bf5fb 100644 --- a/WebCore/svg/SVGAnimateMotionElement.cpp +++ b/WebCore/svg/SVGAnimateMotionElement.cpp @@ -22,9 +22,11 @@ */ #include "config.h" + #if ENABLE(SVG) && ENABLE(SVG_ANIMATION) #include "SVGAnimateMotionElement.h" +#include "MappedAttribute.h" #include "RenderObject.h" #include "SVGElementInstance.h" #include "SVGMPathElement.h" diff --git a/WebCore/svg/SVGAnimateTransformElement.cpp b/WebCore/svg/SVGAnimateTransformElement.cpp index 99e4c42..3ebba06 100644 --- a/WebCore/svg/SVGAnimateTransformElement.cpp +++ b/WebCore/svg/SVGAnimateTransformElement.cpp @@ -23,10 +23,11 @@ */ #include "config.h" + #if ENABLE(SVG) && ENABLE(SVG_ANIMATION) #include "SVGAnimateTransformElement.h" -#include "TransformationMatrix.h" +#include "MappedAttribute.h" #include "RenderObject.h" #include "SVGAngle.h" #include "SVGElementInstance.h" @@ -37,7 +38,7 @@ #include "SVGTransform.h" #include "SVGTransformList.h" #include "SVGUseElement.h" - +#include "TransformationMatrix.h" #include <math.h> #include <wtf/MathExtras.h> diff --git a/WebCore/svg/SVGAnimatedProperty.h b/WebCore/svg/SVGAnimatedProperty.h index e7439a4..725711d 100644 --- a/WebCore/svg/SVGAnimatedProperty.h +++ b/WebCore/svg/SVGAnimatedProperty.h @@ -430,7 +430,7 @@ namespace WebCore { { AtomicString value(SVGAnimatedTypeValue<DecoratedType>::toString(baseValue)); - NamedAttrMap* namedAttrMap = ownerElement->attributes(false); + NamedNodeMap* namedAttrMap = ownerElement->attributes(false); Attribute* old = namedAttrMap->getAttributeItem(attributeName); if (old && value.isNull()) namedAttrMap->removeAttribute(old->name()); diff --git a/WebCore/svg/SVGAnimationElement.cpp b/WebCore/svg/SVGAnimationElement.cpp index 649b74d..b817ad8 100644 --- a/WebCore/svg/SVGAnimationElement.cpp +++ b/WebCore/svg/SVGAnimationElement.cpp @@ -23,6 +23,7 @@ */ #include "config.h" + #if ENABLE(SVG_ANIMATION) #include "SVGAnimationElement.h" @@ -34,6 +35,7 @@ #include "EventListener.h" #include "FloatConversion.h" #include "HTMLNames.h" +#include "MappedAttribute.h" #include "SVGElementInstance.h" #include "SVGNames.h" #include "SVGURIReference.h" @@ -321,7 +323,7 @@ void SVGAnimationElement::setTargetAttributeAnimatedValue(const String& value) shadowTreeElement->style()->setProperty(attributeName, value, "", ec); else shadowTreeElement->setAttribute(attributeName, value, ec); - (*it)->correspondingUseElement()->setChanged(); + (*it)->correspondingUseElement()->setNeedsStyleRecalc(); } } diff --git a/WebCore/svg/SVGCircleElement.cpp b/WebCore/svg/SVGCircleElement.cpp index 8817506..0c48f51 100644 --- a/WebCore/svg/SVGCircleElement.cpp +++ b/WebCore/svg/SVGCircleElement.cpp @@ -26,6 +26,7 @@ #include "SVGCircleElement.h" #include "FloatPoint.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGLength.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp index a41bb45..691e4d5 100644 --- a/WebCore/svg/SVGClipPathElement.cpp +++ b/WebCore/svg/SVGClipPathElement.cpp @@ -27,6 +27,7 @@ #include "CSSStyleSelector.h" #include "Document.h" +#include "MappedAttribute.h" #include "SVGNames.h" #include "SVGTransformList.h" #include "SVGUnitTypes.h" diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/WebCore/svg/SVGComponentTransferFunctionElement.cpp index f2be038..e479fae 100644 --- a/WebCore/svg/SVGComponentTransferFunctionElement.cpp +++ b/WebCore/svg/SVGComponentTransferFunctionElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGComponentTransferFunctionElement.h" +#include "MappedAttribute.h" #include "SVGFEComponentTransferElement.h" #include "SVGNames.h" #include "SVGNumberList.h" diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.h b/WebCore/svg/SVGComponentTransferFunctionElement.h index 5e20e37f..82d57b4 100644 --- a/WebCore/svg/SVGComponentTransferFunctionElement.h +++ b/WebCore/svg/SVGComponentTransferFunctionElement.h @@ -23,7 +23,7 @@ #ifndef SVGComponentTransferFunctionElement_h #define SVGComponentTransferFunctionElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGElement.h" #include "SVGNumberList.h" #include "FEComponentTransfer.h" @@ -53,5 +53,5 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.idl b/WebCore/svg/SVGComponentTransferFunctionElement.idl index a479aa2..0868175 100644 --- a/WebCore/svg/SVGComponentTransferFunctionElement.idl +++ b/WebCore/svg/SVGComponentTransferFunctionElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGComponentTransferFunctionElement : SVGElement { + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGComponentTransferFunctionElement : SVGElement { // Component Transfer Types const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp index 8ff9735..12e9e5d 100644 --- a/WebCore/svg/SVGCursorElement.cpp +++ b/WebCore/svg/SVGCursorElement.cpp @@ -27,8 +27,9 @@ #include "Attr.h" #include "Document.h" -#include "SVGNames.h" +#include "MappedAttribute.h" #include "SVGLength.h" +#include "SVGNames.h" namespace WebCore { @@ -91,7 +92,7 @@ void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) HashSet<SVGElement*>::const_iterator end = m_clients.end(); for (; it != end; ++it) - (*it)->setChanged(); + (*it)->setNeedsStyleRecalc(); } } diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index 7f54dd0..3a7d3d4 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -33,7 +33,7 @@ #include "EventNames.h" #include "FrameView.h" #include "HTMLNames.h" -#include "PlatformString.h" +#include "MappedAttribute.h" #include "RegisteredEventListener.h" #include "RenderObject.h" #include "SVGCursorElement.h" @@ -44,6 +44,7 @@ #include "SVGSVGElement.h" #include "SVGURIReference.h" #include "SVGUseElement.h" +#include "ScriptEventListener.h" #include "XMLNames.h" namespace WebCore { @@ -150,25 +151,25 @@ void SVGElement::parseMappedAttribute(MappedAttribute* attr) { // standard events if (attr->name() == onloadAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().loadEvent, attr); + setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onclickAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().clickEvent, attr); + setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onmousedownAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().mousedownEvent, attr); + setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onmousemoveAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().mousemoveEvent, attr); + setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onmouseoutAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().mouseoutEvent, attr); + setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onmouseoverAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().mouseoverEvent, attr); + setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, attr)); else if (attr->name() == onmouseupAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().mouseupEvent, attr); + setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, attr)); else if (attr->name() == SVGNames::onfocusinAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().DOMFocusInEvent, attr); + setAttributeEventListener(eventNames().DOMFocusInEvent, createAttributeEventListener(this, attr)); else if (attr->name() == SVGNames::onfocusoutAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().DOMFocusOutEvent, attr); + setAttributeEventListener(eventNames().DOMFocusOutEvent, createAttributeEventListener(this, attr)); else if (attr->name() == SVGNames::onactivateAttr) - setInlineEventListenerForTypeAndAttribute(eventNames().DOMActivateEvent, attr); + setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, attr)); else StyledElement::parseMappedAttribute(attr); } diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp index b5fa984..7cc1798 100644 --- a/WebCore/svg/SVGElementInstance.cpp +++ b/WebCore/svg/SVGElementInstance.cpp @@ -130,7 +130,7 @@ void SVGElementInstance::setNeedsUpdate(bool value) m_needsUpdate = value; if (m_needsUpdate) - correspondingUseElement()->setChanged(); + correspondingUseElement()->setNeedsStyleRecalc(); } ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const @@ -174,402 +174,402 @@ bool SVGElementInstance::dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec) EventListener* SVGElementInstance::onabort() const { - return correspondingElement()->inlineEventListenerForType(eventNames().abortEvent); + return correspondingElement()->getAttributeEventListener(eventNames().abortEvent); } void SVGElementInstance::setOnabort(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().abortEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().abortEvent, eventListener); } EventListener* SVGElementInstance::onblur() const { - return correspondingElement()->inlineEventListenerForType(eventNames().blurEvent); + return correspondingElement()->getAttributeEventListener(eventNames().blurEvent); } void SVGElementInstance::setOnblur(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().blurEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().blurEvent, eventListener); } EventListener* SVGElementInstance::onchange() const { - return correspondingElement()->inlineEventListenerForType(eventNames().changeEvent); + return correspondingElement()->getAttributeEventListener(eventNames().changeEvent); } void SVGElementInstance::setOnchange(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().changeEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().changeEvent, eventListener); } EventListener* SVGElementInstance::onclick() const { - return correspondingElement()->inlineEventListenerForType(eventNames().clickEvent); + return correspondingElement()->getAttributeEventListener(eventNames().clickEvent); } void SVGElementInstance::setOnclick(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().clickEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().clickEvent, eventListener); } EventListener* SVGElementInstance::oncontextmenu() const { - return correspondingElement()->inlineEventListenerForType(eventNames().contextmenuEvent); + return correspondingElement()->getAttributeEventListener(eventNames().contextmenuEvent); } void SVGElementInstance::setOncontextmenu(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().contextmenuEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().contextmenuEvent, eventListener); } EventListener* SVGElementInstance::ondblclick() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dblclickEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dblclickEvent); } void SVGElementInstance::setOndblclick(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dblclickEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dblclickEvent, eventListener); } EventListener* SVGElementInstance::onerror() const { - return correspondingElement()->inlineEventListenerForType(eventNames().errorEvent); + return correspondingElement()->getAttributeEventListener(eventNames().errorEvent); } void SVGElementInstance::setOnerror(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().errorEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().errorEvent, eventListener); } EventListener* SVGElementInstance::onfocus() const { - return correspondingElement()->inlineEventListenerForType(eventNames().focusEvent); + return correspondingElement()->getAttributeEventListener(eventNames().focusEvent); } void SVGElementInstance::setOnfocus(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().focusEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().focusEvent, eventListener); } EventListener* SVGElementInstance::oninput() const { - return correspondingElement()->inlineEventListenerForType(eventNames().inputEvent); + return correspondingElement()->getAttributeEventListener(eventNames().inputEvent); } void SVGElementInstance::setOninput(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().inputEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().inputEvent, eventListener); } EventListener* SVGElementInstance::onkeydown() const { - return correspondingElement()->inlineEventListenerForType(eventNames().keydownEvent); + return correspondingElement()->getAttributeEventListener(eventNames().keydownEvent); } void SVGElementInstance::setOnkeydown(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().keydownEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().keydownEvent, eventListener); } EventListener* SVGElementInstance::onkeypress() const { - return correspondingElement()->inlineEventListenerForType(eventNames().keypressEvent); + return correspondingElement()->getAttributeEventListener(eventNames().keypressEvent); } void SVGElementInstance::setOnkeypress(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().keypressEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().keypressEvent, eventListener); } EventListener* SVGElementInstance::onkeyup() const { - return correspondingElement()->inlineEventListenerForType(eventNames().keyupEvent); + return correspondingElement()->getAttributeEventListener(eventNames().keyupEvent); } void SVGElementInstance::setOnkeyup(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().keyupEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().keyupEvent, eventListener); } EventListener* SVGElementInstance::onload() const { - return correspondingElement()->inlineEventListenerForType(eventNames().loadEvent); + return correspondingElement()->getAttributeEventListener(eventNames().loadEvent); } void SVGElementInstance::setOnload(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().loadEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().loadEvent, eventListener); } EventListener* SVGElementInstance::onmousedown() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mousedownEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mousedownEvent); } void SVGElementInstance::setOnmousedown(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mousedownEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mousedownEvent, eventListener); } EventListener* SVGElementInstance::onmousemove() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mousemoveEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mousemoveEvent); } void SVGElementInstance::setOnmousemove(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mousemoveEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mousemoveEvent, eventListener); } EventListener* SVGElementInstance::onmouseout() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mouseoutEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mouseoutEvent); } void SVGElementInstance::setOnmouseout(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mouseoutEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mouseoutEvent, eventListener); } EventListener* SVGElementInstance::onmouseover() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mouseoverEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mouseoverEvent); } void SVGElementInstance::setOnmouseover(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mouseoverEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mouseoverEvent, eventListener); } EventListener* SVGElementInstance::onmouseup() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mouseupEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mouseupEvent); } void SVGElementInstance::setOnmouseup(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mouseupEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mouseupEvent, eventListener); } EventListener* SVGElementInstance::onmousewheel() const { - return correspondingElement()->inlineEventListenerForType(eventNames().mousewheelEvent); + return correspondingElement()->getAttributeEventListener(eventNames().mousewheelEvent); } void SVGElementInstance::setOnmousewheel(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().mousewheelEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().mousewheelEvent, eventListener); } EventListener* SVGElementInstance::onbeforecut() const { - return correspondingElement()->inlineEventListenerForType(eventNames().beforecutEvent); + return correspondingElement()->getAttributeEventListener(eventNames().beforecutEvent); } void SVGElementInstance::setOnbeforecut(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().beforecutEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().beforecutEvent, eventListener); } EventListener* SVGElementInstance::oncut() const { - return correspondingElement()->inlineEventListenerForType(eventNames().cutEvent); + return correspondingElement()->getAttributeEventListener(eventNames().cutEvent); } void SVGElementInstance::setOncut(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().cutEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().cutEvent, eventListener); } EventListener* SVGElementInstance::onbeforecopy() const { - return correspondingElement()->inlineEventListenerForType(eventNames().beforecopyEvent); + return correspondingElement()->getAttributeEventListener(eventNames().beforecopyEvent); } void SVGElementInstance::setOnbeforecopy(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().beforecopyEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().beforecopyEvent, eventListener); } EventListener* SVGElementInstance::oncopy() const { - return correspondingElement()->inlineEventListenerForType(eventNames().copyEvent); + return correspondingElement()->getAttributeEventListener(eventNames().copyEvent); } void SVGElementInstance::setOncopy(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().copyEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().copyEvent, eventListener); } EventListener* SVGElementInstance::onbeforepaste() const { - return correspondingElement()->inlineEventListenerForType(eventNames().beforepasteEvent); + return correspondingElement()->getAttributeEventListener(eventNames().beforepasteEvent); } void SVGElementInstance::setOnbeforepaste(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().beforepasteEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().beforepasteEvent, eventListener); } EventListener* SVGElementInstance::onpaste() const { - return correspondingElement()->inlineEventListenerForType(eventNames().pasteEvent); + return correspondingElement()->getAttributeEventListener(eventNames().pasteEvent); } void SVGElementInstance::setOnpaste(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().pasteEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().pasteEvent, eventListener); } EventListener* SVGElementInstance::ondragenter() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragenterEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragenterEvent); } void SVGElementInstance::setOndragenter(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragenterEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragenterEvent, eventListener); } EventListener* SVGElementInstance::ondragover() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragoverEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragoverEvent); } void SVGElementInstance::setOndragover(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragoverEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragoverEvent, eventListener); } EventListener* SVGElementInstance::ondragleave() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragleaveEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragleaveEvent); } void SVGElementInstance::setOndragleave(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragleaveEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragleaveEvent, eventListener); } EventListener* SVGElementInstance::ondrop() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dropEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dropEvent); } void SVGElementInstance::setOndrop(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dropEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dropEvent, eventListener); } EventListener* SVGElementInstance::ondragstart() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragstartEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragstartEvent); } void SVGElementInstance::setOndragstart(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragstartEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragstartEvent, eventListener); } EventListener* SVGElementInstance::ondrag() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragEvent); } void SVGElementInstance::setOndrag(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragEvent, eventListener); } EventListener* SVGElementInstance::ondragend() const { - return correspondingElement()->inlineEventListenerForType(eventNames().dragendEvent); + return correspondingElement()->getAttributeEventListener(eventNames().dragendEvent); } void SVGElementInstance::setOndragend(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().dragendEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().dragendEvent, eventListener); } EventListener* SVGElementInstance::onreset() const { - return correspondingElement()->inlineEventListenerForType(eventNames().resetEvent); + return correspondingElement()->getAttributeEventListener(eventNames().resetEvent); } void SVGElementInstance::setOnreset(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().resetEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().resetEvent, eventListener); } EventListener* SVGElementInstance::onresize() const { - return correspondingElement()->inlineEventListenerForType(eventNames().resizeEvent); + return correspondingElement()->getAttributeEventListener(eventNames().resizeEvent); } void SVGElementInstance::setOnresize(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().resizeEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().resizeEvent, eventListener); } EventListener* SVGElementInstance::onscroll() const { - return correspondingElement()->inlineEventListenerForType(eventNames().scrollEvent); + return correspondingElement()->getAttributeEventListener(eventNames().scrollEvent); } void SVGElementInstance::setOnscroll(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().scrollEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().scrollEvent, eventListener); } EventListener* SVGElementInstance::onsearch() const { - return correspondingElement()->inlineEventListenerForType(eventNames().searchEvent); + return correspondingElement()->getAttributeEventListener(eventNames().searchEvent); } void SVGElementInstance::setOnsearch(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().searchEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().searchEvent, eventListener); } EventListener* SVGElementInstance::onselect() const { - return correspondingElement()->inlineEventListenerForType(eventNames().selectEvent); + return correspondingElement()->getAttributeEventListener(eventNames().selectEvent); } void SVGElementInstance::setOnselect(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().selectEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().selectEvent, eventListener); } EventListener* SVGElementInstance::onselectstart() const { - return correspondingElement()->inlineEventListenerForType(eventNames().selectstartEvent); + return correspondingElement()->getAttributeEventListener(eventNames().selectstartEvent); } void SVGElementInstance::setOnselectstart(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().selectstartEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().selectstartEvent, eventListener); } EventListener* SVGElementInstance::onsubmit() const { - return correspondingElement()->inlineEventListenerForType(eventNames().submitEvent); + return correspondingElement()->getAttributeEventListener(eventNames().submitEvent); } void SVGElementInstance::setOnsubmit(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().submitEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().submitEvent, eventListener); } EventListener* SVGElementInstance::onunload() const { - return correspondingElement()->inlineEventListenerForType(eventNames().unloadEvent); + return correspondingElement()->getAttributeEventListener(eventNames().unloadEvent); } void SVGElementInstance::setOnunload(PassRefPtr<EventListener> eventListener) { - correspondingElement()->setInlineEventListenerForType(eventNames().unloadEvent, eventListener); + correspondingElement()->setAttributeEventListener(eventNames().unloadEvent, eventListener); } } diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h index f5c6ca9..7c56792 100644 --- a/WebCore/svg/SVGElementInstance.h +++ b/WebCore/svg/SVGElementInstance.h @@ -61,6 +61,7 @@ namespace WebCore { virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + const RegisteredEventListenerVector& eventListeners() const { return correspondingElement()->eventListeners(); } SVGElement* correspondingElement() const { return m_element.get(); } SVGUseElement* correspondingUseElement() const { return m_useElement; } diff --git a/WebCore/svg/SVGElementInstance.idl b/WebCore/svg/SVGElementInstance.idl index 92da5a6..3d88178 100644 --- a/WebCore/svg/SVGElementInstance.idl +++ b/WebCore/svg/SVGElementInstance.idl @@ -28,13 +28,13 @@ module svg { interface [ Conditional=SVG, - ObjCCustomInternalImpl, CustomListeners, + CustomMarkFunction, CustomPushEventHandlerScope, GenerateToJS, GenerateNativeConverter ] SVGElementInstance -#if defined(LANGUAGE_OBJECTIVE_C) +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C : Object, EventTarget #endif /* defined(LANGUAGE_OBJECTIVE_C) */ { @@ -48,47 +48,47 @@ module svg { readonly attribute SVGElementInstance nextSibling; // EventTarget -#if !defined(LANGUAGE_OBJECTIVE_C) - attribute [DontEnum, ProtectedListener] EventListener onabort; - attribute [DontEnum, ProtectedListener] EventListener onblur; - attribute [DontEnum, ProtectedListener] EventListener onchange; - attribute [DontEnum, ProtectedListener] EventListener onclick; - attribute [DontEnum, ProtectedListener] EventListener oncontextmenu; - attribute [DontEnum, ProtectedListener] EventListener ondblclick; - attribute [DontEnum, ProtectedListener] EventListener onerror; - attribute [DontEnum, ProtectedListener] EventListener onfocus; - attribute [DontEnum, ProtectedListener] EventListener oninput; - attribute [DontEnum, ProtectedListener] EventListener onkeydown; - attribute [DontEnum, ProtectedListener] EventListener onkeypress; - attribute [DontEnum, ProtectedListener] EventListener onkeyup; - attribute [DontEnum, ProtectedListener] EventListener onload; - attribute [DontEnum, ProtectedListener] EventListener onmousedown; - attribute [DontEnum, ProtectedListener] EventListener onmousemove; - attribute [DontEnum, ProtectedListener] EventListener onmouseout; - attribute [DontEnum, ProtectedListener] EventListener onmouseover; - attribute [DontEnum, ProtectedListener] EventListener onmouseup; - attribute [DontEnum, ProtectedListener] EventListener onmousewheel; - attribute [DontEnum, ProtectedListener] EventListener onbeforecut; - attribute [DontEnum, ProtectedListener] EventListener oncut; - attribute [DontEnum, ProtectedListener] EventListener onbeforecopy; - attribute [DontEnum, ProtectedListener] EventListener oncopy; - attribute [DontEnum, ProtectedListener] EventListener onbeforepaste; - attribute [DontEnum, ProtectedListener] EventListener onpaste; - attribute [DontEnum, ProtectedListener] EventListener ondragenter; - attribute [DontEnum, ProtectedListener] EventListener ondragover; - attribute [DontEnum, ProtectedListener] EventListener ondragleave; - attribute [DontEnum, ProtectedListener] EventListener ondrop; - attribute [DontEnum, ProtectedListener] EventListener ondragstart; - attribute [DontEnum, ProtectedListener] EventListener ondrag; - attribute [DontEnum, ProtectedListener] EventListener ondragend; - attribute [DontEnum, ProtectedListener] EventListener onreset; - attribute [DontEnum, ProtectedListener] EventListener onresize; - attribute [DontEnum, ProtectedListener] EventListener onscroll; - attribute [DontEnum, ProtectedListener] EventListener onsearch; - attribute [DontEnum, ProtectedListener] EventListener onselect; - attribute [DontEnum, ProtectedListener] EventListener onselectstart; - attribute [DontEnum, ProtectedListener] EventListener onsubmit; - attribute [DontEnum, ProtectedListener] EventListener onunload; +#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C + attribute [DontEnum] EventListener onabort; + attribute [DontEnum] EventListener onblur; + attribute [DontEnum] EventListener onchange; + attribute [DontEnum] EventListener onclick; + attribute [DontEnum] EventListener oncontextmenu; + attribute [DontEnum] EventListener ondblclick; + attribute [DontEnum] EventListener onerror; + attribute [DontEnum] EventListener onfocus; + attribute [DontEnum] EventListener oninput; + attribute [DontEnum] EventListener onkeydown; + attribute [DontEnum] EventListener onkeypress; + attribute [DontEnum] EventListener onkeyup; + attribute [DontEnum] EventListener onload; + attribute [DontEnum] EventListener onmousedown; + attribute [DontEnum] EventListener onmousemove; + attribute [DontEnum] EventListener onmouseout; + attribute [DontEnum] EventListener onmouseover; + attribute [DontEnum] EventListener onmouseup; + attribute [DontEnum] EventListener onmousewheel; + attribute [DontEnum] EventListener onbeforecut; + attribute [DontEnum] EventListener oncut; + attribute [DontEnum] EventListener onbeforecopy; + attribute [DontEnum] EventListener oncopy; + attribute [DontEnum] EventListener onbeforepaste; + attribute [DontEnum] EventListener onpaste; + attribute [DontEnum] EventListener ondragenter; + attribute [DontEnum] EventListener ondragover; + attribute [DontEnum] EventListener ondragleave; + attribute [DontEnum] EventListener ondrop; + attribute [DontEnum] EventListener ondragstart; + attribute [DontEnum] EventListener ondrag; + attribute [DontEnum] EventListener ondragend; + attribute [DontEnum] EventListener onreset; + attribute [DontEnum] EventListener onresize; + attribute [DontEnum] EventListener onscroll; + attribute [DontEnum] EventListener onsearch; + attribute [DontEnum] EventListener onselect; + attribute [DontEnum] EventListener onselectstart; + attribute [DontEnum] EventListener onsubmit; + attribute [DontEnum] EventListener onunload; [Custom] void addEventListener(in DOMString type, in EventListener listener, diff --git a/WebCore/svg/SVGEllipseElement.cpp b/WebCore/svg/SVGEllipseElement.cpp index a07a9a7..6d56ff8 100644 --- a/WebCore/svg/SVGEllipseElement.cpp +++ b/WebCore/svg/SVGEllipseElement.cpp @@ -26,6 +26,7 @@ #include "SVGEllipseElement.h" #include "FloatPoint.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGLength.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGException.idl b/WebCore/svg/SVGException.idl index b7e97c7..233f653 100644 --- a/WebCore/svg/SVGException.idl +++ b/WebCore/svg/SVGException.idl @@ -29,7 +29,7 @@ module svg { readonly attribute DOMString name; readonly attribute DOMString message; -#if defined(LANGUAGE_JAVASCRIPT) +#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format [DontEnum] DOMString toString(); #endif diff --git a/WebCore/svg/SVGExternalResourcesRequired.cpp b/WebCore/svg/SVGExternalResourcesRequired.cpp index d087f64..640f92e 100644 --- a/WebCore/svg/SVGExternalResourcesRequired.cpp +++ b/WebCore/svg/SVGExternalResourcesRequired.cpp @@ -26,8 +26,9 @@ #include "SVGExternalResourcesRequired.h" #include "Attr.h" -#include "SVGNames.h" +#include "MappedAttribute.h" #include "SVGElement.h" +#include "SVGNames.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp index 3c8557e..f78412c 100644 --- a/WebCore/svg/SVGFEBlendElement.cpp +++ b/WebCore/svg/SVGFEBlendElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEBlendElement.h" +#include "MappedAttribute.h" #include "SVGResourceFilter.h" namespace WebCore { @@ -34,7 +35,6 @@ SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document* doc , m_in1(this, SVGNames::inAttr) , m_in2(this, SVGNames::in2Attr) , m_mode(this, SVGNames::modeAttr, FEBLEND_MODE_NORMAL) - , m_filterEffect(0) { } @@ -64,21 +64,16 @@ void SVGFEBlendElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEBlendElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFEBlendElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEBlendElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); - FilterEffect* input2 = builder->getEffectById(in2()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); + FilterEffect* input2 = filterResource->builder()->getEffectById(in2()); if(!input1 || !input2) return false; - builder->add(result(), FEBlend::create(input1, input2, static_cast<BlendModeType> (mode()))); + RefPtr<FilterEffect> effect = FEBlend::create(input1, input2, static_cast<BlendModeType>(mode())); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEBlendElement.h b/WebCore/svg/SVGFEBlendElement.h index a85d174..70e5e06 100644 --- a/WebCore/svg/SVGFEBlendElement.h +++ b/WebCore/svg/SVGFEBlendElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEBlendElement_h #define SVGFEBlendElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FEBlend.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -36,15 +36,12 @@ namespace WebCore virtual ~SVGFEBlendElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEBlendElement, SVGNames::feBlendTagString, SVGNames::inAttrString, String, In1, in1) ANIMATED_PROPERTY_DECLARATIONS(SVGFEBlendElement, SVGNames::feBlendTagString, SVGNames::in2AttrString, String, In2, in2) ANIMATED_PROPERTY_DECLARATIONS(SVGFEBlendElement, SVGNames::feBlendTagString, SVGNames::modeAttrString, int, Mode, mode) - - mutable RefPtr<FEBlend> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEBlendElement.idl b/WebCore/svg/SVGFEBlendElement.idl index b45b57f..4c1a18b 100644 --- a/WebCore/svg/SVGFEBlendElement.idl +++ b/WebCore/svg/SVGFEBlendElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGFEBlendElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEBlendElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Blend Mode Types const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp index c3a8f01..660f000 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.cpp +++ b/WebCore/svg/SVGFEColorMatrixElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEColorMatrixElement.h" +#include "MappedAttribute.h" #include "SVGNames.h" #include "SVGNumberList.h" #include "SVGResourceFilter.h" @@ -36,7 +37,6 @@ SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, D , m_in1(this, SVGNames::inAttr) , m_type(this, SVGNames::typeAttr, FECOLORMATRIX_TYPE_UNKNOWN) , m_values(this, SVGNames::valuesAttr, SVGNumberList::create(SVGNames::valuesAttr)) - , m_filterEffect(0) { } @@ -65,15 +65,9 @@ void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEColorMatrixElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFEColorMatrixElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEColorMatrixElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; @@ -86,7 +80,8 @@ bool SVGFEColorMatrixElement::build(FilterBuilder* builder) for (unsigned int i = 0;i < nr;i++) _values.append(numbers->getItem(i, ec)); - builder->add(result(), FEColorMatrix::create(input1, static_cast<ColorMatrixType> (type()), _values)); + RefPtr<FilterEffect> effect = FEColorMatrix::create(input1, static_cast<ColorMatrixType>(type()), _values); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEColorMatrixElement.h b/WebCore/svg/SVGFEColorMatrixElement.h index f39db86..5b7a9ae 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.h +++ b/WebCore/svg/SVGFEColorMatrixElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEColorMatrixElement_h #define SVGFEColorMatrixElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FEColorMatrix.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGNumberList.h" @@ -36,15 +36,12 @@ namespace WebCore { virtual ~SVGFEColorMatrixElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEColorMatrixElement, SVGNames::feColorMatrixTagString, SVGNames::inAttrString, String, In1, in1) ANIMATED_PROPERTY_DECLARATIONS(SVGFEColorMatrixElement, SVGNames::feColorMatrixTagString, SVGNames::typeAttrString, int, Type, type) ANIMATED_PROPERTY_DECLARATIONS(SVGFEColorMatrixElement, SVGNames::feColorMatrixTagString, SVGNames::valuesAttrString, SVGNumberList, Values, values) - - mutable RefPtr<FEColorMatrix> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEColorMatrixElement.idl b/WebCore/svg/SVGFEColorMatrixElement.idl index ae0e293..c116fe7 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.idl +++ b/WebCore/svg/SVGFEColorMatrixElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGFEColorMatrixElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEColorMatrixElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Color Matrix Types const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp index e1be6ae..cad60dc 100644 --- a/WebCore/svg/SVGFEComponentTransferElement.cpp +++ b/WebCore/svg/SVGFEComponentTransferElement.cpp @@ -22,16 +22,17 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEComponentTransferElement.h" #include "Attr.h" +#include "MappedAttribute.h" +#include "SVGFEFuncAElement.h" +#include "SVGFEFuncBElement.h" +#include "SVGFEFuncGElement.h" +#include "SVGFEFuncRElement.h" #include "SVGNames.h" #include "SVGRenderStyle.h" -#include "SVGFEFuncRElement.h" -#include "SVGFEFuncGElement.h" -#include "SVGFEFuncBElement.h" -#include "SVGFEFuncAElement.h" #include "SVGResourceFilter.h" namespace WebCore { @@ -39,7 +40,6 @@ namespace WebCore { SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document* doc) : SVGFilterPrimitiveStandardAttributes(tagName, doc) , m_in1(this, SVGNames::inAttr) - , m_filterEffect(0) { } @@ -56,15 +56,9 @@ void SVGFEComponentTransferElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEComponentTransferElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEComponentTransferElement::build(FilterBuilder* builder) +bool SVGFEComponentTransferElement::build(SVGResourceFilter* filterResource) { - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; @@ -85,7 +79,8 @@ bool SVGFEComponentTransferElement::build(FilterBuilder* builder) alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction(); } - builder->add(result(), FEComponentTransfer::create(input1, red, green, blue, alpha)); + RefPtr<FilterEffect> effect = FEComponentTransfer::create(input1, red, green, blue, alpha); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEComponentTransferElement.h b/WebCore/svg/SVGFEComponentTransferElement.h index e80ea94..21c95d2 100644 --- a/WebCore/svg/SVGFEComponentTransferElement.h +++ b/WebCore/svg/SVGFEComponentTransferElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEComponentTransferElement_h #define SVGFEComponentTransferElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFilterPrimitiveStandardAttributes.h" #include "FEComponentTransfer.h" @@ -35,13 +35,10 @@ namespace WebCore { virtual ~SVGFEComponentTransferElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEComponentTransferElement, SVGNames::feComponentTransferTagString, SVGNames::inAttrString, String, In1, in1) - - mutable RefPtr<FEComponentTransfer> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEComponentTransferElement.idl b/WebCore/svg/SVGFEComponentTransferElement.idl index 783c9b7..7ec0741 100644 --- a/WebCore/svg/SVGFEComponentTransferElement.idl +++ b/WebCore/svg/SVGFEComponentTransferElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEComponentTransferElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEComponentTransferElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; }; diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp index f2fc4dc..2205243 100644 --- a/WebCore/svg/SVGFECompositeElement.cpp +++ b/WebCore/svg/SVGFECompositeElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFECompositeElement.h" +#include "MappedAttribute.h" #include "SVGNames.h" #include "SVGResourceFilter.h" @@ -39,7 +40,6 @@ SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Docum , m_k2(this, SVGNames::k2Attr) , m_k3(this, SVGNames::k3Attr) , m_k4(this, SVGNames::k4Attr) - , m_filterEffect(0) { } @@ -80,23 +80,17 @@ void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFECompositeElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFECompositeElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFECompositeElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); - FilterEffect* input2 = builder->getEffectById(in2()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); + FilterEffect* input2 = filterResource->builder()->getEffectById(in2()); if(!input1 || !input2) return false; - RefPtr<FilterEffect> addedEffect = FEComposite::create(input1, input2, static_cast<CompositeOperationType> (_operator()), + RefPtr<FilterEffect> effect = FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()), k1(), k2(), k3(), k4()); - builder->add(result(), addedEffect.release()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFECompositeElement.h b/WebCore/svg/SVGFECompositeElement.h index 89ad7df..fc97169 100644 --- a/WebCore/svg/SVGFECompositeElement.h +++ b/WebCore/svg/SVGFECompositeElement.h @@ -23,7 +23,7 @@ #ifndef SVGFECompositeElement_h #define SVGFECompositeElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FEComposite.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -35,8 +35,7 @@ namespace WebCore { virtual ~SVGFECompositeElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, SVGNames::feCompositeTagString, SVGNames::inAttrString, String, In1, in1) @@ -46,8 +45,6 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, SVGNames::feCompositeTagString, SVGNames::k2AttrString, float, K2, k2) ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, SVGNames::feCompositeTagString, SVGNames::k3AttrString, float, K3, k3) ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, SVGNames::feCompositeTagString, SVGNames::k4AttrString, float, K4, k4) - - mutable RefPtr<FEComposite> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFECompositeElement.idl b/WebCore/svg/SVGFECompositeElement.idl index 01821e8..97a13fc 100644 --- a/WebCore/svg/SVGFECompositeElement.idl +++ b/WebCore/svg/SVGFECompositeElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGFECompositeElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFECompositeElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Composite Operators const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp index 87fa33a..00ff55a 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp +++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp @@ -19,17 +19,18 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDiffuseLightingElement.h" #include "Attr.h" +#include "MappedAttribute.h" #include "RenderObject.h" #include "SVGColor.h" +#include "SVGFEDiffuseLighting.h" #include "SVGFELightElement.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGRenderStyle.h" -#include "SVGFEDiffuseLighting.h" #include "SVGResourceFilter.h" namespace WebCore { @@ -44,7 +45,6 @@ SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& ta , m_surfaceScale(this, SVGNames::surfaceScaleAttr, 1.0f) , m_kernelUnitLengthX(this, SVGNames::kernelUnitLengthAttr) , m_kernelUnitLengthY(this, SVGNames::kernelUnitLengthAttr) - , m_filterEffect(0) { } @@ -71,15 +71,9 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEDiffuseLightingElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEDiffuseLightingElement::build(FilterBuilder* builder) +bool SVGFEDiffuseLightingElement::build(SVGResourceFilter* filterResource) { - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; @@ -87,9 +81,9 @@ bool SVGFEDiffuseLightingElement::build(FilterBuilder* builder) RefPtr<RenderStyle> filterStyle = styleForRenderer(); Color color = filterStyle->svgStyle()->lightingColor(); - RefPtr<FilterEffect> addedEffect = FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(), + RefPtr<FilterEffect> effect = FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), findLights()); - builder->add(result(), addedEffect.release()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.h b/WebCore/svg/SVGFEDiffuseLightingElement.h index 70c6777..fcb5eee 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.h +++ b/WebCore/svg/SVGFEDiffuseLightingElement.h @@ -22,7 +22,7 @@ #ifndef SVGFEDiffuseLightingElement_h #define SVGFEDiffuseLightingElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -40,8 +40,7 @@ namespace WebCore { virtual ~SVGFEDiffuseLightingElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEDiffuseLightingElement, SVGNames::feDiffuseLightingTagString, SVGNames::inAttrString, String, In1, in1) @@ -51,8 +50,6 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFEDiffuseLightingElement, SVGNames::feDiffuseLightingTagString, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY) LightSource* findLights() const; - - mutable RefPtr<FEDiffuseLighting> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.idl b/WebCore/svg/SVGFEDiffuseLightingElement.idl index ca54f8b..c48a4f1 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.idl +++ b/WebCore/svg/SVGFEDiffuseLightingElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEDiffuseLightingElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEDiffuseLightingElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber surfaceScale; diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp index 3b6dfbf..8ac668c 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.cpp +++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp @@ -17,12 +17,12 @@ Boston, MA 02110-1301, USA. */ - #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDisplacementMapElement.h" +#include "MappedAttribute.h" #include "SVGResourceFilter.h" namespace WebCore { @@ -34,7 +34,6 @@ SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& ta , m_xChannelSelector(this, SVGNames::xChannelSelectorAttr, CHANNEL_A) , m_yChannelSelector(this, SVGNames::yChannelSelectorAttr, CHANNEL_A) , m_scale(this, SVGNames::scaleAttr) - , m_filterEffect(0) { } @@ -73,24 +72,18 @@ void SVGFEDisplacementMapElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEDisplacementMapElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEDisplacementMapElement::build(FilterBuilder* builder) +bool SVGFEDisplacementMapElement::build(SVGResourceFilter* filterResource) { - FilterEffect* input1 = builder->getEffectById(in1()); - FilterEffect* input2 = builder->getEffectById(in2()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); + FilterEffect* input2 = filterResource->builder()->getEffectById(in2()); if(!input1 || !input2) return false; - RefPtr<FilterEffect> addedEffect = FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType> (xChannelSelector()), - static_cast<ChannelSelectorType> (yChannelSelector()), scale()); - builder->add(result(), addedEffect.release()); + RefPtr<FilterEffect> effect = FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType>(xChannelSelector()), + static_cast<ChannelSelectorType>(yChannelSelector()), scale()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEDisplacementMapElement.h b/WebCore/svg/SVGFEDisplacementMapElement.h index 21b93f4..48e6930 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.h +++ b/WebCore/svg/SVGFEDisplacementMapElement.h @@ -20,7 +20,7 @@ #ifndef SVGFEDisplacementMapElement_h #define SVGFEDisplacementMapElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDisplacementMap.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -34,8 +34,7 @@ namespace WebCore { static ChannelSelectorType stringToChannel(const String&); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEDisplacementMapElement, SVGNames::feDisplacementMapTagString, SVGNames::inAttrString, String, In1, in1) @@ -43,8 +42,6 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFEDisplacementMapElement, SVGNames::feDisplacementMapTagString, SVGNames::xChannelSelectorAttrString, int, XChannelSelector, xChannelSelector) ANIMATED_PROPERTY_DECLARATIONS(SVGFEDisplacementMapElement, SVGNames::feDisplacementMapTagString, SVGNames::yChannelSelectorAttrString, int, YChannelSelector, yChannelSelector) ANIMATED_PROPERTY_DECLARATIONS(SVGFEDisplacementMapElement, SVGNames::feDisplacementMapTagString, SVGNames::scaleAttrString, float, Scale, scale) - - mutable RefPtr<FEDisplacementMap> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEDisplacementMapElement.idl b/WebCore/svg/SVGFEDisplacementMapElement.idl index d819794..4fde219 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.idl +++ b/WebCore/svg/SVGFEDisplacementMapElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGFEDisplacementMapElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEDisplacementMapElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Channel Selectors const unsigned short SVG_CHANNEL_UNKNOWN = 0; diff --git a/WebCore/svg/SVGFEDistantLightElement.cpp b/WebCore/svg/SVGFEDistantLightElement.cpp index e9ec48d..35c487b 100644 --- a/WebCore/svg/SVGFEDistantLightElement.cpp +++ b/WebCore/svg/SVGFEDistantLightElement.cpp @@ -19,7 +19,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDistantLightElement.h" #include "SVGDistantLightSource.h" diff --git a/WebCore/svg/SVGFEDistantLightElement.h b/WebCore/svg/SVGFEDistantLightElement.h index e43282f..e340549 100644 --- a/WebCore/svg/SVGFEDistantLightElement.h +++ b/WebCore/svg/SVGFEDistantLightElement.h @@ -20,7 +20,7 @@ #ifndef SVGFEDistantLightElement_h #define SVGFEDistantLightElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEDistantLightElement.idl b/WebCore/svg/SVGFEDistantLightElement.idl index 8bd6067..16e7467 100644 --- a/WebCore/svg/SVGFEDistantLightElement.idl +++ b/WebCore/svg/SVGFEDistantLightElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEDistantLightElement : SVGElement { + interface [Conditional=SVG&FILTERS] SVGFEDistantLightElement : SVGElement { readonly attribute SVGAnimatedNumber azimuth; readonly attribute SVGAnimatedNumber elevation; }; diff --git a/WebCore/svg/SVGFEFloodElement.cpp b/WebCore/svg/SVGFEFloodElement.cpp index 98e7d6f..e12b4e1 100644 --- a/WebCore/svg/SVGFEFloodElement.cpp +++ b/WebCore/svg/SVGFEFloodElement.cpp @@ -22,13 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFloodElement.h" -#include "Attr.h" -#include "Document.h" +#include "MappedAttribute.h" #include "RenderStyle.h" -#include "SVGNames.h" #include "SVGRenderStyle.h" #include "SVGResourceFilter.h" @@ -36,7 +34,7 @@ namespace WebCore { SVGFEFloodElement::SVGFEFloodElement(const QualifiedName& tagName, Document* doc) : SVGFilterPrimitiveStandardAttributes(tagName, doc) - , m_filterEffect(0) + , m_in1(this, SVGNames::inAttr) { } @@ -46,23 +44,27 @@ SVGFEFloodElement::~SVGFEFloodElement() void SVGFEFloodElement::parseMappedAttribute(MappedAttribute* attr) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + const String& value = attr->value(); + if (attr->name() == SVGNames::inAttr) + setIn1BaseValue(value); + else + SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEFloodElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFEFloodElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} + FilterEffect* input = filterResource->builder()->getEffectById(in1()); + + if(!input) + return false; -bool SVGFEFloodElement::build(FilterBuilder* builder) -{ RefPtr<RenderStyle> filterStyle = styleForRenderer(); Color color = filterStyle->svgStyle()->floodColor(); float opacity = filterStyle->svgStyle()->floodOpacity(); - builder->add(result(), FEFlood::create(color, opacity)); + RefPtr<FilterEffect> effect = FEFlood::create(input, color, opacity); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEFloodElement.h b/WebCore/svg/SVGFEFloodElement.h index 046f418..4a4cffc 100644 --- a/WebCore/svg/SVGFEFloodElement.h +++ b/WebCore/svg/SVGFEFloodElement.h @@ -23,9 +23,9 @@ #ifndef SVGFEFloodElement_h #define SVGFEFloodElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFilterPrimitiveStandardAttributes.h" +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFlood.h" +#include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -36,11 +36,10 @@ namespace WebCore virtual ~SVGFEFloodElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: - mutable RefPtr<FEFlood> m_filterEffect; + ANIMATED_PROPERTY_DECLARATIONS(SVGFEFloodElement, SVGNames::feFloodTagString, SVGNames::inAttrString, String, In1, in1) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEFloodElement.idl b/WebCore/svg/SVGFEFloodElement.idl index d2356bf..814bbdf 100644 --- a/WebCore/svg/SVGFEFloodElement.idl +++ b/WebCore/svg/SVGFEFloodElement.idl @@ -25,8 +25,10 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEFloodElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEFloodElement : SVGElement, SVGFilterPrimitiveStandardAttributes { - }; + readonly attribute SVGAnimatedString in1; + + }; } diff --git a/WebCore/svg/SVGFEFuncAElement.cpp b/WebCore/svg/SVGFEFuncAElement.cpp index 595e2e6..41118fe 100644 --- a/WebCore/svg/SVGFEFuncAElement.cpp +++ b/WebCore/svg/SVGFEFuncAElement.cpp @@ -22,7 +22,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFuncAElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEFuncAElement.h b/WebCore/svg/SVGFEFuncAElement.h index 3fd6816..2c24039 100644 --- a/WebCore/svg/SVGFEFuncAElement.h +++ b/WebCore/svg/SVGFEFuncAElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEFuncAElement_h #define SVGFEFuncAElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGComponentTransferFunctionElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEFuncAElement.idl b/WebCore/svg/SVGFEFuncAElement.idl index 7675f7d..8901551 100644 --- a/WebCore/svg/SVGFEFuncAElement.idl +++ b/WebCore/svg/SVGFEFuncAElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEFuncAElement : SVGComponentTransferFunctionElement { + interface [Conditional=SVG&FILTERS] SVGFEFuncAElement : SVGComponentTransferFunctionElement { }; } diff --git a/WebCore/svg/SVGFEFuncBElement.cpp b/WebCore/svg/SVGFEFuncBElement.cpp index de6cb88..190b23a 100644 --- a/WebCore/svg/SVGFEFuncBElement.cpp +++ b/WebCore/svg/SVGFEFuncBElement.cpp @@ -22,7 +22,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFuncBElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEFuncBElement.h b/WebCore/svg/SVGFEFuncBElement.h index 2dd9615..1eb0889 100644 --- a/WebCore/svg/SVGFEFuncBElement.h +++ b/WebCore/svg/SVGFEFuncBElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEFuncBElement_h #define SVGFEFuncBElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGComponentTransferFunctionElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEFuncBElement.idl b/WebCore/svg/SVGFEFuncBElement.idl index 7717f6a..fada028 100644 --- a/WebCore/svg/SVGFEFuncBElement.idl +++ b/WebCore/svg/SVGFEFuncBElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEFuncBElement : SVGComponentTransferFunctionElement { + interface [Conditional=SVG&FILTERS] SVGFEFuncBElement : SVGComponentTransferFunctionElement { }; } diff --git a/WebCore/svg/SVGFEFuncGElement.cpp b/WebCore/svg/SVGFEFuncGElement.cpp index 958f547..d5e5625 100644 --- a/WebCore/svg/SVGFEFuncGElement.cpp +++ b/WebCore/svg/SVGFEFuncGElement.cpp @@ -22,7 +22,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFuncGElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEFuncGElement.h b/WebCore/svg/SVGFEFuncGElement.h index 8f1c368..973360e 100644 --- a/WebCore/svg/SVGFEFuncGElement.h +++ b/WebCore/svg/SVGFEFuncGElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEFuncGElement_h #define SVGFEFuncGElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGComponentTransferFunctionElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEFuncGElement.idl b/WebCore/svg/SVGFEFuncGElement.idl index 1ec24fa..33fc9a0 100644 --- a/WebCore/svg/SVGFEFuncGElement.idl +++ b/WebCore/svg/SVGFEFuncGElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEFuncGElement : SVGComponentTransferFunctionElement { + interface [Conditional=SVG&FILTERS] SVGFEFuncGElement : SVGComponentTransferFunctionElement { }; } diff --git a/WebCore/svg/SVGFEFuncRElement.cpp b/WebCore/svg/SVGFEFuncRElement.cpp index e376781..e3d7ee4 100644 --- a/WebCore/svg/SVGFEFuncRElement.cpp +++ b/WebCore/svg/SVGFEFuncRElement.cpp @@ -22,7 +22,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFuncRElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEFuncRElement.h b/WebCore/svg/SVGFEFuncRElement.h index 4921488..3553954 100644 --- a/WebCore/svg/SVGFEFuncRElement.h +++ b/WebCore/svg/SVGFEFuncRElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEFuncRElement_h #define SVGFEFuncRElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGComponentTransferFunctionElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEFuncRElement.idl b/WebCore/svg/SVGFEFuncRElement.idl index 0a6ac30..e9b8e26 100644 --- a/WebCore/svg/SVGFEFuncRElement.idl +++ b/WebCore/svg/SVGFEFuncRElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEFuncRElement : SVGComponentTransferFunctionElement { + interface [Conditional=SVG&FILTERS] SVGFEFuncRElement : SVGComponentTransferFunctionElement { }; } diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp index 4fbabe3..be3554f 100644 --- a/WebCore/svg/SVGFEGaussianBlurElement.cpp +++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEGaussianBlurElement.h" +#include "MappedAttribute.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGResourceFilter.h" @@ -39,7 +40,6 @@ SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, , m_in1(this, SVGNames::inAttr) , m_stdDeviationX(this, SVGNames::stdDeviationAttr) , m_stdDeviationY(this, SVGNames::stdDeviationAttr) - , m_filterEffect(0) { } @@ -47,8 +47,9 @@ SVGFEGaussianBlurElement::~SVGFEGaussianBlurElement() { } -void SVGFEGaussianBlurElement::setStdDeviation(float stdDeviationX, float stdDeviationY) +void SVGFEGaussianBlurElement::setStdDeviation(float, float) { + // FIXME: Needs an implementation. } void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute* attr) @@ -66,20 +67,15 @@ void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEGaussianBlurElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFEGaussianBlurElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEGaussianBlurElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; - builder->add(result(), FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY())); + RefPtr<FilterEffect> effect = FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEGaussianBlurElement.h b/WebCore/svg/SVGFEGaussianBlurElement.h index 9e1c15c..187c212 100644 --- a/WebCore/svg/SVGFEGaussianBlurElement.h +++ b/WebCore/svg/SVGFEGaussianBlurElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEGaussianBlurElement_h #define SVGFEGaussianBlurElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEGaussianBlur.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -40,15 +40,12 @@ namespace WebCore { void setStdDeviation(float stdDeviationX, float stdDeviationY); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEGaussianBlurElement, SVGNames::feGaussianBlurTagString, SVGNames::inAttrString, String, In1, in1) ANIMATED_PROPERTY_DECLARATIONS(SVGFEGaussianBlurElement, SVGNames::feGaussianBlurTagString, SVGStdDeviationXAttrIdentifier, float, StdDeviationX, stdDeviationX) ANIMATED_PROPERTY_DECLARATIONS(SVGFEGaussianBlurElement, SVGNames::feGaussianBlurTagString, SVGStdDeviationYAttrIdentifier, float, StdDeviationY, stdDeviationY) - - mutable RefPtr<FEGaussianBlur> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEGaussianBlurElement.idl b/WebCore/svg/SVGFEGaussianBlurElement.idl index 7dc7526..efa09b8 100644 --- a/WebCore/svg/SVGFEGaussianBlurElement.idl +++ b/WebCore/svg/SVGFEGaussianBlurElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEGaussianBlurElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEGaussianBlurElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber stdDeviationX; diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp index 3ceb560..ae69e0d 100644 --- a/WebCore/svg/SVGFEImageElement.cpp +++ b/WebCore/svg/SVGFEImageElement.cpp @@ -22,13 +22,14 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEImageElement.h" #include "Attr.h" #include "CachedImage.h" #include "DocLoader.h" #include "Document.h" +#include "MappedAttribute.h" #include "SVGLength.h" #include "SVGNames.h" #include "SVGPreserveAspectRatio.h" @@ -42,8 +43,6 @@ SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document* doc , SVGLangSpace() , SVGExternalResourcesRequired() , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) - , m_cachedImage(0) - , m_filterEffect(0) { } @@ -81,24 +80,17 @@ void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr) } } -void SVGFEImageElement::notifyFinished(CachedResource* finishedObj) +void SVGFEImageElement::notifyFinished(CachedResource*) { - if (finishedObj == m_cachedImage && m_filterEffect) - m_filterEffect->setCachedImage(m_cachedImage.get()); } -SVGFilterEffect* SVGFEImageElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEImageElement::build(FilterBuilder* builder) +bool SVGFEImageElement::build(SVGResourceFilter* filterResource) { if(!m_cachedImage) return false; - builder->add(result(), FEImage::create(m_cachedImage.get())); + RefPtr<FilterEffect> effect = FEImage::create(m_cachedImage.get()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEImageElement.h b/WebCore/svg/SVGFEImageElement.h index 98d5941..67f3bd5 100644 --- a/WebCore/svg/SVGFEImageElement.h +++ b/WebCore/svg/SVGFEImageElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEImageElement_h #define SVGFEImageElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "CachedResourceHandle.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGURIReference.h" @@ -47,17 +47,15 @@ namespace WebCore { virtual void notifyFinished(CachedResource*); virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); protected: - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; virtual const SVGElement* contextElement() const { return this; } private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGNames::feImageTagString, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) CachedResourceHandle<CachedImage> m_cachedImage; - mutable RefPtr<FEImage> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEImageElement.idl b/WebCore/svg/SVGFEImageElement.idl index c9ee669..23b9c86 100644 --- a/WebCore/svg/SVGFEImageElement.idl +++ b/WebCore/svg/SVGFEImageElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEImageElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEImageElement : SVGElement, SVGURIReference, SVGLangSpace, SVGExternalResourcesRequired, diff --git a/WebCore/svg/SVGFELightElement.cpp b/WebCore/svg/SVGFELightElement.cpp index 73c088f..bb954eb 100644 --- a/WebCore/svg/SVGFELightElement.cpp +++ b/WebCore/svg/SVGFELightElement.cpp @@ -21,8 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" + +#include "MappedAttribute.h" #include "SVGNames.h" namespace WebCore { diff --git a/WebCore/svg/SVGFELightElement.h b/WebCore/svg/SVGFELightElement.h index 5c4a785..a66ccf5 100644 --- a/WebCore/svg/SVGFELightElement.h +++ b/WebCore/svg/SVGFELightElement.h @@ -22,7 +22,7 @@ #ifndef SVGFELightElement_h #define SVGFELightElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGElement.h" #include "SVGLightSource.h" @@ -56,5 +56,5 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif diff --git a/WebCore/svg/SVGFEMergeElement.cpp b/WebCore/svg/SVGFEMergeElement.cpp index 5ccf403..0640066 100644 --- a/WebCore/svg/SVGFEMergeElement.cpp +++ b/WebCore/svg/SVGFEMergeElement.cpp @@ -22,7 +22,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMergeElement.h" #include "SVGFEMergeNodeElement.h" @@ -32,7 +32,6 @@ namespace WebCore { SVGFEMergeElement::SVGFEMergeElement(const QualifiedName& tagName, Document* doc) : SVGFilterPrimitiveStandardAttributes(tagName, doc) - , m_filterEffect(0) { } @@ -40,18 +39,12 @@ SVGFEMergeElement::~SVGFEMergeElement() { } -SVGFilterEffect* SVGFEMergeElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEMergeElement::build(FilterBuilder* builder) +bool SVGFEMergeElement::build(SVGResourceFilter* filterResource) { Vector<FilterEffect*> mergeInputs; for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { if (n->hasTagName(SVGNames::feMergeNodeTag)) { - FilterEffect* mergeEffect = builder->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1()); + FilterEffect* mergeEffect = filterResource->builder()->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1()); mergeInputs.append(mergeEffect); } } @@ -59,7 +52,8 @@ bool SVGFEMergeElement::build(FilterBuilder* builder) if(mergeInputs.isEmpty()) return false; - builder->add(result(), FEMerge::create(mergeInputs)); + RefPtr<FilterEffect> effect = FEMerge::create(mergeInputs); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEMergeElement.h b/WebCore/svg/SVGFEMergeElement.h index 6449286..e63ed04 100644 --- a/WebCore/svg/SVGFEMergeElement.h +++ b/WebCore/svg/SVGFEMergeElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEMergeElement_h #define SVGFEMergeElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMerge.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -34,11 +34,7 @@ namespace WebCore { SVGFEMergeElement(const QualifiedName&, Document*); virtual ~SVGFEMergeElement(); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); - - private: - mutable RefPtr<FEMerge> m_filterEffect; + virtual bool build(SVGResourceFilter*); }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEMergeElement.idl b/WebCore/svg/SVGFEMergeElement.idl index 6cec2fc..0b03845 100644 --- a/WebCore/svg/SVGFEMergeElement.idl +++ b/WebCore/svg/SVGFEMergeElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEMergeElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEMergeElement : SVGElement, SVGFilterPrimitiveStandardAttributes { }; diff --git a/WebCore/svg/SVGFEMergeNodeElement.cpp b/WebCore/svg/SVGFEMergeNodeElement.cpp index e68f4d7..ae08706 100644 --- a/WebCore/svg/SVGFEMergeNodeElement.cpp +++ b/WebCore/svg/SVGFEMergeNodeElement.cpp @@ -22,9 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMergeNodeElement.h" +#include "MappedAttribute.h" + namespace WebCore { SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document* doc) diff --git a/WebCore/svg/SVGFEMergeNodeElement.h b/WebCore/svg/SVGFEMergeNodeElement.h index c1abd2f..e2af642 100644 --- a/WebCore/svg/SVGFEMergeNodeElement.h +++ b/WebCore/svg/SVGFEMergeNodeElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEMergeNodeElement_h #define SVGFEMergeNodeElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGFEMergeNodeElement.idl b/WebCore/svg/SVGFEMergeNodeElement.idl index f385755..4bddcb2 100644 --- a/WebCore/svg/SVGFEMergeNodeElement.idl +++ b/WebCore/svg/SVGFEMergeNodeElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEMergeNodeElement : SVGElement { + interface [Conditional=SVG&FILTERS] SVGFEMergeNodeElement : SVGElement { readonly attribute SVGAnimatedString in1; }; diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp index 4fa572f..c7e4e77 100644 --- a/WebCore/svg/SVGFEOffsetElement.cpp +++ b/WebCore/svg/SVGFEOffsetElement.cpp @@ -22,10 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEOffsetElement.h" #include "Attr.h" +#include "MappedAttribute.h" #include "SVGResourceFilter.h" namespace WebCore { @@ -35,7 +36,6 @@ SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document* d , m_in1(this, SVGNames::inAttr) , m_dx(this, SVGNames::dxAttr) , m_dy(this, SVGNames::dyAttr) - , m_filterEffect(0) { } @@ -56,20 +56,15 @@ void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFEOffsetElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFEOffsetElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFEOffsetElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; - builder->add(result(), FEOffset::create(input1, dx(), dy())); + RefPtr<FilterEffect> effect = FEOffset::create(input1, dx(), dy()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFEOffsetElement.h b/WebCore/svg/SVGFEOffsetElement.h index 2d1b0ba..1471abe 100644 --- a/WebCore/svg/SVGFEOffsetElement.h +++ b/WebCore/svg/SVGFEOffsetElement.h @@ -23,7 +23,7 @@ #ifndef SVGFEOffsetElement_h #define SVGFEOffsetElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGFEOffset.h" @@ -35,15 +35,12 @@ namespace WebCore { virtual ~SVGFEOffsetElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEOffsetElement, SVGNames::feOffsetTagString, SVGNames::inAttrString, String, In1, in1) ANIMATED_PROPERTY_DECLARATIONS(SVGFEOffsetElement, SVGNames::feOffsetTagString, SVGNames::dxAttrString, float, Dx, dx) ANIMATED_PROPERTY_DECLARATIONS(SVGFEOffsetElement, SVGNames::feOffsetTagString, SVGNames::dyAttrString, float, Dy, dy) - - mutable RefPtr<FEOffset> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEOffsetElement.idl b/WebCore/svg/SVGFEOffsetElement.idl index a62d8da..ba3ee4e 100644 --- a/WebCore/svg/SVGFEOffsetElement.idl +++ b/WebCore/svg/SVGFEOffsetElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEOffsetElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFEOffsetElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber dx; diff --git a/WebCore/svg/SVGFEPointLightElement.cpp b/WebCore/svg/SVGFEPointLightElement.cpp index f30f6db..088f878 100644 --- a/WebCore/svg/SVGFEPointLightElement.cpp +++ b/WebCore/svg/SVGFEPointLightElement.cpp @@ -19,7 +19,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEPointLightElement.h" #include "SVGPointLightSource.h" diff --git a/WebCore/svg/SVGFEPointLightElement.h b/WebCore/svg/SVGFEPointLightElement.h index 5b72e09..edb9f9d 100644 --- a/WebCore/svg/SVGFEPointLightElement.h +++ b/WebCore/svg/SVGFEPointLightElement.h @@ -20,7 +20,7 @@ #ifndef SVGFEPointLightElement_h #define SVGFEPointLightElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFEPointLightElement.idl b/WebCore/svg/SVGFEPointLightElement.idl index 12dbe2f..f5ad94c 100644 --- a/WebCore/svg/SVGFEPointLightElement.idl +++ b/WebCore/svg/SVGFEPointLightElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFEPointLightElement : SVGElement { + interface [Conditional=SVG&FILTERS] SVGFEPointLightElement : SVGElement { readonly attribute SVGAnimatedNumber x; readonly attribute SVGAnimatedNumber y; readonly attribute SVGAnimatedNumber z; diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp index c7b7410..36dd453 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.cpp +++ b/WebCore/svg/SVGFESpecularLightingElement.cpp @@ -21,13 +21,14 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFESpecularLightingElement.h" +#include "MappedAttribute.h" #include "RenderObject.h" #include "SVGColor.h" -#include "SVGNames.h" #include "SVGFELightElement.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGResourceFilter.h" @@ -41,7 +42,6 @@ SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& , m_surfaceScale(this, SVGNames::surfaceScaleAttr, 1.0f) , m_kernelUnitLengthX(this, SVGNames::kernelUnitLengthAttr) , m_kernelUnitLengthY(this, SVGNames::kernelUnitLengthAttr) - , m_filterEffect(0) { } @@ -70,12 +70,6 @@ void SVGFESpecularLightingElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFESpecularLightingElement::filterEffect(SVGResourceFilter* filter) const -{ - ASSERT_NOT_REACHED(); - return 0; -} - LightSource* SVGFESpecularLightingElement::findLights() const { LightSource* light = 0; @@ -92,9 +86,9 @@ LightSource* SVGFESpecularLightingElement::findLights() const return light; } -bool SVGFESpecularLightingElement::build(FilterBuilder* builder) +bool SVGFESpecularLightingElement::build(SVGResourceFilter* filterResource) { - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; @@ -103,9 +97,9 @@ bool SVGFESpecularLightingElement::build(FilterBuilder* builder) Color color = filterStyle->svgStyle()->lightingColor(); - RefPtr<FilterEffect> addedEffect = FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(), + RefPtr<FilterEffect> effect = FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights()); - builder->add(result(), addedEffect.release()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFESpecularLightingElement.h b/WebCore/svg/SVGFESpecularLightingElement.h index d76cb43..8ef490a 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.h +++ b/WebCore/svg/SVGFESpecularLightingElement.h @@ -22,7 +22,7 @@ #ifndef SVGFESpecularLightingElement_h #define SVGFESpecularLightingElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFESpecularLighting.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -39,8 +39,7 @@ namespace WebCore { virtual ~SVGFESpecularLightingElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFESpecularLightingElement, SVGNames::feSpecularLightingTagString, SVGNames::inAttrString, String, In1, in1) @@ -49,8 +48,6 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFESpecularLightingElement, SVGNames::feSpecularLightingTagString, SVGNames::surfaceScaleAttrString, float, SurfaceScale, surfaceScale) ANIMATED_PROPERTY_DECLARATIONS(SVGFESpecularLightingElement, SVGNames::feSpecularLightingTagString, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX) ANIMATED_PROPERTY_DECLARATIONS(SVGFESpecularLightingElement, SVGNames::feSpecularLightingTagString, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY) - - mutable RefPtr<FESpecularLighting> m_filterEffect; LightSource* findLights() const; }; diff --git a/WebCore/svg/SVGFESpecularLightingElement.idl b/WebCore/svg/SVGFESpecularLightingElement.idl index d79a70e..5fce7fa 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.idl +++ b/WebCore/svg/SVGFESpecularLightingElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFESpecularLightingElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFESpecularLightingElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber surfaceScale; diff --git a/WebCore/svg/SVGFESpotLightElement.cpp b/WebCore/svg/SVGFESpotLightElement.cpp index 5add579..980a3bb 100644 --- a/WebCore/svg/SVGFESpotLightElement.cpp +++ b/WebCore/svg/SVGFESpotLightElement.cpp @@ -19,7 +19,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFESpotLightElement.h" #include "SVGSpotLightSource.h" diff --git a/WebCore/svg/SVGFESpotLightElement.h b/WebCore/svg/SVGFESpotLightElement.h index 2989b14..629e51a 100644 --- a/WebCore/svg/SVGFESpotLightElement.h +++ b/WebCore/svg/SVGFESpotLightElement.h @@ -20,7 +20,7 @@ #ifndef SVGFESpotLightElement_h #define SVGFESpotLightElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" namespace WebCore diff --git a/WebCore/svg/SVGFESpotLightElement.idl b/WebCore/svg/SVGFESpotLightElement.idl index 339d545..5a41202 100644 --- a/WebCore/svg/SVGFESpotLightElement.idl +++ b/WebCore/svg/SVGFESpotLightElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFESpotLightElement : SVGElement { + interface [Conditional=SVG&FILTERS] SVGFESpotLightElement : SVGElement { readonly attribute SVGAnimatedNumber x; readonly attribute SVGAnimatedNumber y; readonly attribute SVGAnimatedNumber z; diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp index bf90c33..d5828eb 100644 --- a/WebCore/svg/SVGFETileElement.cpp +++ b/WebCore/svg/SVGFETileElement.cpp @@ -22,10 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETileElement.h" #include "Attr.h" +#include "MappedAttribute.h" #include "SVGRenderStyle.h" #include "SVGResourceFilter.h" @@ -34,7 +35,6 @@ namespace WebCore { SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document* doc) : SVGFilterPrimitiveStandardAttributes(tagName, doc) , m_in1(this, SVGNames::inAttr) - , m_filterEffect(0) { } @@ -51,20 +51,15 @@ void SVGFETileElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFETileElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFETileElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFETileElement::build(FilterBuilder* builder) -{ - FilterEffect* input1 = builder->getEffectById(in1()); + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if(!input1) return false; - builder->add(result(), FETile::create(input1)); + RefPtr<FilterEffect> effect = FETile::create(input1); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFETileElement.h b/WebCore/svg/SVGFETileElement.h index ba68115..b4fc0c5 100644 --- a/WebCore/svg/SVGFETileElement.h +++ b/WebCore/svg/SVGFETileElement.h @@ -23,7 +23,7 @@ #ifndef SVGFETileElement_h #define SVGFETileElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGFETile.h" @@ -35,13 +35,10 @@ namespace WebCore { virtual ~SVGFETileElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFETileElement, SVGNames::feTileTagString, SVGNames::inAttrString, String, In1, in1) - - mutable RefPtr<FETile> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFETileElement.idl b/WebCore/svg/SVGFETileElement.idl index 68bfcc5..4a59a05 100644 --- a/WebCore/svg/SVGFETileElement.idl +++ b/WebCore/svg/SVGFETileElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFETileElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFETileElement : SVGElement, SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedString in1; }; diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp index f51d835..b296e00 100644 --- a/WebCore/svg/SVGFETurbulenceElement.cpp +++ b/WebCore/svg/SVGFETurbulenceElement.cpp @@ -22,9 +22,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETurbulenceElement.h" +#include "MappedAttribute.h" #include "SVGParserUtilities.h" #include "SVGResourceFilter.h" @@ -41,7 +42,6 @@ SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Doc , m_seed(this, SVGNames::seedAttr) , m_stitchTiles(this, SVGNames::stitchTilesAttr, SVG_STITCHTYPE_NOSTITCH) , m_type(this, SVGNames::typeAttr, FETURBULENCE_TYPE_TURBULENCE) - , m_filterEffect(0) { } @@ -76,17 +76,11 @@ void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute* attr) SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); } -SVGFilterEffect* SVGFETurbulenceElement::filterEffect(SVGResourceFilter* filter) const +bool SVGFETurbulenceElement::build(SVGResourceFilter* filterResource) { - ASSERT_NOT_REACHED(); - return 0; -} - -bool SVGFETurbulenceElement::build(FilterBuilder* builder) -{ - RefPtr<FilterEffect> addedEffect = FETurbulence::create(static_cast<TurbulanceType> (type()), baseFrequencyX(), + RefPtr<FilterEffect> effect = FETurbulence::create(static_cast<TurbulanceType>(type()), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); - builder->add(result(), addedEffect.release()); + filterResource->addFilterEffect(this, effect.release()); return true; } diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h index bae2d9b..3c95da8 100644 --- a/WebCore/svg/SVGFETurbulenceElement.h +++ b/WebCore/svg/SVGFETurbulenceElement.h @@ -23,7 +23,7 @@ #ifndef SVGFETurbulenceElement_h #define SVGFETurbulenceElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETurbulence.h" #include "SVGFilterPrimitiveStandardAttributes.h" @@ -44,8 +44,7 @@ namespace WebCore { virtual ~SVGFETurbulenceElement(); virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const; - bool build(FilterBuilder*); + virtual bool build(SVGResourceFilter*); private: ANIMATED_PROPERTY_DECLARATIONS(SVGFETurbulenceElement, SVGNames::feTurbulenceTagString, SVGBaseFrequencyXIdentifier, float, BaseFrequencyX, baseFrequencyX) @@ -54,8 +53,6 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFETurbulenceElement, SVGNames::feTurbulenceTagString, SVGNames::seedAttrString, float, Seed, seed) ANIMATED_PROPERTY_DECLARATIONS(SVGFETurbulenceElement, SVGNames::feTurbulenceTagString, SVGNames::stitchTilesAttrString, int, StitchTiles, stitchTiles) ANIMATED_PROPERTY_DECLARATIONS(SVGFETurbulenceElement, SVGNames::feTurbulenceTagString, SVGNames::typeAttrString, int, Type, type) - - mutable RefPtr<FETurbulence> m_filterEffect; }; } // namespace WebCore diff --git a/WebCore/svg/SVGFETurbulenceElement.idl b/WebCore/svg/SVGFETurbulenceElement.idl index 79fc63f..9cec66c 100644 --- a/WebCore/svg/SVGFETurbulenceElement.idl +++ b/WebCore/svg/SVGFETurbulenceElement.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS, GenerateConstructor] SVGFETurbulenceElement : SVGElement, + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFETurbulenceElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Turbulence Types const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp index 774232f..7703b6f 100644 --- a/WebCore/svg/SVGFilterElement.cpp +++ b/WebCore/svg/SVGFilterElement.cpp @@ -23,14 +23,17 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFilterElement.h" #include "Attr.h" -#include "SVGResourceFilter.h" +#include "SVGFilterBuilder.h" +#include "MappedAttribute.h" +#include "PlatformString.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGLength.h" #include "SVGNames.h" +#include "SVGResourceFilter.h" #include "SVGUnitTypes.h" namespace WebCore { @@ -130,19 +133,18 @@ SVGResource* SVGFilterElement::canvasResource() bool primitiveBBoxMode = primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; m_filter->setEffectBoundingBoxMode(primitiveBBoxMode); - // TODO : use switch/case instead? - m_filter->clearEffects(); + m_filter->builder()->clearEffects(); for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { SVGElement* element = 0; - if (n->isSVGElement()) + if (n->isSVGElement()) { element = static_cast<SVGElement*>(n); - if (element && element->isFilterEffect()) { - SVGFilterPrimitiveStandardAttributes* filterAttributes = static_cast<SVGFilterPrimitiveStandardAttributes*>(element); - SVGFilterEffect* filterEffect = filterAttributes->filterEffect(m_filter.get()); - if (!filterEffect) - continue; - - m_filter->addFilterEffect(filterEffect); + if (element->isFilterEffect()) { + SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element); + if (!effectElement->build(m_filter.get())) { + m_filter->builder()->clearEffects(); + break; + } + } } } diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h index c907b9c..541ec14 100644 --- a/WebCore/svg/SVGFilterElement.h +++ b/WebCore/svg/SVGFilterElement.h @@ -24,7 +24,7 @@ #ifndef SVGFilterElement_h #define SVGFilterElement_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGResourceFilter.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" diff --git a/WebCore/svg/SVGFilterElement.idl b/WebCore/svg/SVGFilterElement.idl index 9d1e15a..10b4f5e 100644 --- a/WebCore/svg/SVGFilterElement.idl +++ b/WebCore/svg/SVGFilterElement.idl @@ -26,7 +26,7 @@ module svg { - interface [Conditional=SVG&SVG_FILTERS] SVGFilterElement : SVGElement, + interface [Conditional=SVG&FILTERS] SVGFilterElement : SVGElement, SVGURIReference, SVGLangSpace, SVGExternalResourcesRequired, diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index eab7bdd..13116a5 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -22,11 +22,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGFilterElement.h" -#include "SVGFilterEffect.h" +#include "FilterEffect.h" +#include "MappedAttribute.h" #include "SVGLength.h" #include "SVGNames.h" #include "SVGStyledElement.h" @@ -69,17 +69,17 @@ void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute* return SVGStyledElement::parseMappedAttribute(attr); } -void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGFilterEffect* filterEffect) const +void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilter* resourceFilter, FilterEffect* filterEffect) const { ASSERT(filterEffect); if (!filterEffect) return; - ASSERT(filterEffect->filter()); + ASSERT(resourceFilter); float _x, _y, _width, _height; - if (filterEffect->filter()->effectBoundingBoxMode()) { + if (resourceFilter->effectBoundingBoxMode()) { _x = x().valueAsPercentage(); _y = y().valueAsPercentage(); _width = width().valueAsPercentage(); @@ -120,7 +120,6 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGFilterEffect } filterEffect->setSubRegion(FloatRect(_x, _y, _width, _height)); - filterEffect->setResult(result()); } } diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index bbdeb00..fa82f6a 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -23,15 +23,15 @@ #ifndef SVGFilterPrimitiveStandardAttributes_h #define SVGFilterPrimitiveStandardAttributes_h -#if ENABLE(SVG) -#include "FilterBuilder.h" +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGFilterBuilder.h" +#include "SVGResourceFilter.h" #include "SVGStyledElement.h" namespace WebCore { extern char SVGFilterPrimitiveStandardAttributesIdentifier[]; - class SVGFilterEffect; class SVGResourceFilter; class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement { @@ -42,13 +42,14 @@ namespace WebCore { virtual bool isFilterEffect() const { return true; } virtual void parseMappedAttribute(MappedAttribute*); - virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const = 0; + virtual bool build(SVGResourceFilter*) = 0; virtual bool rendererIsNeeded(RenderStyle*) { return false; } protected: + friend class SVGResourceFilter; + void setStandardAttributes(SVGResourceFilter*, FilterEffect*) const; virtual const SVGElement* contextElement() const { return this; } - void setStandardAttributes(SVGFilterEffect*) const; private: ANIMATED_PROPERTY_DECLARATIONS(SVGFilterPrimitiveStandardAttributes, SVGFilterPrimitiveStandardAttributesIdentifier, SVGNames::xAttrString, SVGLength, X, x) diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp index 13e4c03..847038c 100644 --- a/WebCore/svg/SVGFitToViewBox.cpp +++ b/WebCore/svg/SVGFitToViewBox.cpp @@ -25,13 +25,14 @@ #if ENABLE(SVG) #include "SVGFitToViewBox.h" -#include "TransformationMatrix.h" #include "Document.h" #include "FloatRect.h" +#include "MappedAttribute.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGPreserveAspectRatio.h" #include "StringImpl.h" +#include "TransformationMatrix.h" namespace WebCore { diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp index 9b36f87..7e3cec0 100644 --- a/WebCore/svg/SVGFont.cpp +++ b/WebCore/svg/SVGFont.cpp @@ -533,6 +533,9 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, context->beginPath(); context->addPath(identifier.pathData); + // FIXME: setup() tries to get objectBoundingBox() from run.referencingRenderObject() + // which is wrong. We need to change setup() to take a bounding box instead, or pass + // a RenderObject which would return the bounding box for identifier.pathData if (activePaintServer->setup(context, run.referencingRenderObject(), targetType)) { // Spec: Any properties specified on a text elements which represents a length, such as the // 'stroke-width' property, might produce surprising results since the length value will be diff --git a/WebCore/svg/SVGFontFaceElement.cpp b/WebCore/svg/SVGFontFaceElement.cpp index 973e890..1e5a0fe 100644 --- a/WebCore/svg/SVGFontFaceElement.cpp +++ b/WebCore/svg/SVGFontFaceElement.cpp @@ -23,6 +23,7 @@ #if ENABLE(SVG_FONTS) #include "SVGFontFaceElement.h" + #include "CString.h" #include "CSSFontFaceRule.h" #include "CSSFontFaceSrcValue.h" @@ -35,12 +36,12 @@ #include "CSSValueList.h" #include "Document.h" #include "Font.h" +#include "MappedAttribute.h" #include "SVGDefinitionSrcElement.h" #include "SVGFontElement.h" #include "SVGFontFaceSrcElement.h" #include "SVGGlyphElement.h" #include "SVGNames.h" - #include <math.h> namespace WebCore { diff --git a/WebCore/svg/SVGFontFaceUriElement.cpp b/WebCore/svg/SVGFontFaceUriElement.cpp index 3509691..096f0c2 100644 --- a/WebCore/svg/SVGFontFaceUriElement.cpp +++ b/WebCore/svg/SVGFontFaceUriElement.cpp @@ -27,6 +27,7 @@ #include "CachedFont.h" #include "DocLoader.h" #include "Document.h" +#include "MappedAttribute.h" #include "SVGFontFaceElement.h" #include "SVGNames.h" #include "XLinkNames.h" diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp index 342a6f0..5cfca8a 100644 --- a/WebCore/svg/SVGForeignObjectElement.cpp +++ b/WebCore/svg/SVGForeignObjectElement.cpp @@ -26,10 +26,10 @@ #include "SVGForeignObjectElement.h" #include "CSSPropertyNames.h" +#include "MappedAttribute.h" #include "RenderForeignObject.h" -#include "SVGNames.h" #include "SVGLength.h" - +#include "SVGNames.h" #include <wtf/Assertions.h> namespace WebCore { @@ -113,7 +113,7 @@ static inline void addCSSPropertyAndNotifyAttributeMap(StyledElement* element, c attrs->declRemoved(); } - element->setChanged(); + element->setNeedsStyleRecalc(); element->addCSSProperty(mappedAttr, cssProperty, value); if (CSSMappedAttributeDeclaration* decl = mappedAttr->decl()) { diff --git a/WebCore/svg/SVGGlyphElement.cpp b/WebCore/svg/SVGGlyphElement.cpp index ebf5dd0..7be0181 100644 --- a/WebCore/svg/SVGGlyphElement.cpp +++ b/WebCore/svg/SVGGlyphElement.cpp @@ -24,9 +24,10 @@ #if ENABLE(SVG_FONTS) #include "SVGGlyphElement.h" +#include "MappedAttribute.h" +#include "SVGFontData.h" #include "SVGFontElement.h" #include "SVGFontFaceElement.h" -#include "SVGFontData.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SimpleFontData.h" diff --git a/WebCore/svg/SVGGlyphElement.h b/WebCore/svg/SVGGlyphElement.h index 62ae263..0662097 100644 --- a/WebCore/svg/SVGGlyphElement.h +++ b/WebCore/svg/SVGGlyphElement.h @@ -31,7 +31,7 @@ namespace WebCore { class AtomicString; - struct SVGFontData; + class SVGFontData; // Describe a SVG <glyph> element struct SVGGlyphIdentifier { diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp index e4e3213..8034286 100644 --- a/WebCore/svg/SVGGradientElement.cpp +++ b/WebCore/svg/SVGGradientElement.cpp @@ -26,6 +26,7 @@ #include "SVGGradientElement.h" #include "CSSStyleSelector.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "RenderSVGHiddenContainer.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGHKernElement.h b/WebCore/svg/SVGHKernElement.h index 6fda779..32772bd 100644 --- a/WebCore/svg/SVGHKernElement.h +++ b/WebCore/svg/SVGHKernElement.h @@ -31,7 +31,7 @@ namespace WebCore { class AtomicString; - struct SVGFontData; + class SVGFontData; // Describe an SVG <hkern> element struct SVGHorizontalKerningPair { diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp index c827c89..9aff93d 100644 --- a/WebCore/svg/SVGImageElement.cpp +++ b/WebCore/svg/SVGImageElement.cpp @@ -27,6 +27,7 @@ #include "SVGImageElement.h" #include "CSSPropertyNames.h" +#include "MappedAttribute.h" #include "RenderSVGImage.h" #include "SVGDocument.h" #include "SVGLength.h" diff --git a/WebCore/svg/SVGImageLoader.cpp b/WebCore/svg/SVGImageLoader.cpp index 4b15acb..9333f75 100644 --- a/WebCore/svg/SVGImageLoader.cpp +++ b/WebCore/svg/SVGImageLoader.cpp @@ -43,7 +43,7 @@ SVGImageLoader::~SVGImageLoader() void SVGImageLoader::dispatchLoadEvent() { if (image()->errorOccurred()) - element()->dispatchEventForType(eventNames().errorEvent, false, false); + element()->dispatchEvent(eventNames().errorEvent, false, false); else { SVGImageElement* imageElement = static_cast<SVGImageElement*>(element()); if (imageElement->externalResourcesRequiredBaseValue()) diff --git a/WebCore/svg/SVGLangSpace.cpp b/WebCore/svg/SVGLangSpace.cpp index 099934d..d49e09a 100644 --- a/WebCore/svg/SVGLangSpace.cpp +++ b/WebCore/svg/SVGLangSpace.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGLangSpace.h" +#include "MappedAttribute.h" #include "SVGElement.h" #include "XMLNames.h" #include <wtf/StdLibExtras.h> diff --git a/WebCore/svg/SVGLineElement.cpp b/WebCore/svg/SVGLineElement.cpp index 12f54e3..17c110c 100644 --- a/WebCore/svg/SVGLineElement.cpp +++ b/WebCore/svg/SVGLineElement.cpp @@ -26,6 +26,7 @@ #include "SVGLineElement.h" #include "FloatPoint.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGLength.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp index d2d1798..9927a50 100644 --- a/WebCore/svg/SVGLinearGradientElement.cpp +++ b/WebCore/svg/SVGLinearGradientElement.cpp @@ -28,6 +28,7 @@ #include "Document.h" #include "FloatPoint.h" #include "LinearGradientAttributes.h" +#include "MappedAttribute.h" #include "SVGLength.h" #include "SVGNames.h" #include "SVGPaintServerLinearGradient.h" diff --git a/WebCore/svg/SVGList.h b/WebCore/svg/SVGList.h index d4f7641..5381598 100644 --- a/WebCore/svg/SVGList.h +++ b/WebCore/svg/SVGList.h @@ -96,7 +96,11 @@ namespace WebCore { Item insertItemBefore(Item newItem, unsigned int index, ExceptionCode&) { - m_vector.insert(index, newItem); + if (index < m_vector.size()) { + m_vector.insert(index, newItem); + } else { + m_vector.append(newItem); + } return newItem; } diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp index 002bf28..00acc2a 100644 --- a/WebCore/svg/SVGLocatable.cpp +++ b/WebCore/svg/SVGLocatable.cpp @@ -1,8 +1,7 @@ /* Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - - This file is part of the KDE project + Copyright (C) 2009 Google, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -40,69 +39,52 @@ SVGLocatable::~SVGLocatable() { } -SVGElement* SVGLocatable::nearestViewportElement(const SVGElement* e) +static bool isViewportElement(Node* node) { - Node* n = e->parentNode(); - while (n && !n->isDocumentNode()) { - if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::symbolTag) || - n->hasTagName(SVGNames::imageTag)) - return static_cast<SVGElement*>(n); + return (node->hasTagName(SVGNames::svgTag) + || node->hasTagName(SVGNames::symbolTag) #if ENABLE(SVG_FOREIGN_OBJECT) - if (n->hasTagName(SVGNames::foreignObjectTag)) - return static_cast<SVGElement*>(n); + || node->hasTagName(SVGNames::foreignObjectTag) #endif + || node->hasTagName(SVGNames::imageTag)); +} - n = n->parentNode(); +SVGElement* SVGLocatable::nearestViewportElement(const SVGElement* element) +{ + ASSERT(element); + for (Node* n = element->parentNode(); n && !n->isDocumentNode(); n = n->parentNode()) { + if (isViewportElement(n)) + return static_cast<SVGElement*>(n); } return 0; } -SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* e) +SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* element) { - // FIXME : likely this will be always the <svg> farthest away. - // If we have a different implementation of documentElement(), one - // that give the documentElement() of the svg fragment, it could be - // used instead. This depends on cdf demands though(Rob.) + ASSERT(element); SVGElement* farthest = 0; - Node* n = e->parentNode(); - while (n && !n->isDocumentNode()) { - if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::symbolTag) || - n->hasTagName(SVGNames::imageTag)) - farthest = static_cast<SVGElement*>(n); -#if ENABLE(SVG_FOREIGN_OBJECT) - if (n->hasTagName(SVGNames::foreignObjectTag)) + for (Node* n = element->parentNode(); n && !n->isDocumentNode(); n = n->parentNode()) { + if (isViewportElement(n)) farthest = static_cast<SVGElement*>(n); -#endif - - n = n->parentNode(); } - return farthest; } -// Spec: -// http://www.w3.org/TR/2005/WD-SVGMobile12-20050413/svgudom.html#svg::SVGLocatable -FloatRect SVGLocatable::getBBox(const SVGElement* e) +FloatRect SVGLocatable::getBBox(const SVGElement* element) { - FloatRect bboxRect; + element->document()->updateLayoutIgnorePendingStylesheets(); - e->document()->updateLayoutIgnorePendingStylesheets(); + // FIXME: Eventually we should support getBBox for detached elements. + if (!element->renderer()) + return FloatRect(); - if (e && e->renderer()) { - // Need this to make sure we have render object dimensions. - // See bug 11686. - bboxRect = e->renderer()->relativeBBox(false); - } - - return bboxRect; + return element->renderer()->objectBoundingBox(); } TransformationMatrix SVGLocatable::getCTM(const SVGElement* element) { - if (!element) - return TransformationMatrix(); - + ASSERT(element); TransformationMatrix ctm; Node* parent = element->parentNode(); @@ -119,9 +101,7 @@ TransformationMatrix SVGLocatable::getCTM(const SVGElement* element) TransformationMatrix SVGLocatable::getScreenCTM(const SVGElement* element) { - if (!element) - return TransformationMatrix(); - + ASSERT(element); TransformationMatrix ctm; Node* parent = element->parentNode(); diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp index a89c478..5580993 100644 --- a/WebCore/svg/SVGMarkerElement.cpp +++ b/WebCore/svg/SVGMarkerElement.cpp @@ -23,6 +23,7 @@ #if ENABLE(SVG) #include "SVGMarkerElement.h" +#include "MappedAttribute.h" #include "PlatformString.h" #include "RenderSVGViewportContainer.h" #include "SVGAngle.h" diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp index 9f9ae34..59a5e01 100644 --- a/WebCore/svg/SVGMaskElement.cpp +++ b/WebCore/svg/SVGMaskElement.cpp @@ -29,6 +29,7 @@ #include "CSSStyleSelector.h" #include "GraphicsContext.h" #include "ImageBuffer.h" +#include "MappedAttribute.h" #include "RenderSVGContainer.h" #include "SVGLength.h" #include "SVGNames.h" @@ -124,7 +125,7 @@ void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, N m_masker->invalidate(); } -auto_ptr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetRect, FloatRect& maskDestRect) const +PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetRect, FloatRect& maskDestRect) const { // Determine specified mask size float xValue; @@ -145,7 +146,7 @@ auto_ptr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetR } IntSize imageSize(lroundf(widthValue), lroundf(heightValue)); - clampImageBufferSizeToViewport(document()->renderer(), imageSize); + clampImageBufferSizeToViewport(document()->view(), imageSize); if (imageSize.width() < static_cast<int>(widthValue)) widthValue = imageSize.width(); @@ -153,9 +154,9 @@ auto_ptr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetR if (imageSize.height() < static_cast<int>(heightValue)) heightValue = imageSize.height(); - auto_ptr<ImageBuffer> maskImage = ImageBuffer::create(imageSize, false); - if (!maskImage.get()) - return maskImage; + OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(imageSize, false); + if (!maskImage) + return 0; maskDestRect = FloatRect(xValue, yValue, widthValue, heightValue); if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) @@ -192,7 +193,7 @@ auto_ptr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetR maskImageContext->restore(); maskImageContext->restore(); - return maskImage; + return maskImage.release(); } RenderObject* SVGMaskElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h index 4bcf82f..f2b7ae5 100644 --- a/WebCore/svg/SVGMaskElement.h +++ b/WebCore/svg/SVGMaskElement.h @@ -29,6 +29,7 @@ #include "SVGStyledLocatableElement.h" #include "SVGTests.h" #include "SVGURIReference.h" +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -51,7 +52,7 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual SVGResource* canvasResource(); - std::auto_ptr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const; + PassOwnPtr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const; protected: virtual const SVGElement* contextElement() const { return this; } diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp index bdd60e5..172cac1 100644 --- a/WebCore/svg/SVGPathElement.cpp +++ b/WebCore/svg/SVGPathElement.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGPathElement.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGNames.h" #include "SVGParserUtilities.h" diff --git a/WebCore/svg/SVGPathSeg.idl b/WebCore/svg/SVGPathSeg.idl index 3076750..597b01d 100644 --- a/WebCore/svg/SVGPathSeg.idl +++ b/WebCore/svg/SVGPathSeg.idl @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,7 @@ module svg { - interface [Conditional=SVG, GenerateConstructor, ObjCCustomInternalImpl] SVGPathSeg { + interface [Conditional=SVG, GenerateConstructor, Polymorphic] SVGPathSeg { // Path Segment Types const unsigned short PATHSEG_UNKNOWN = 0; const unsigned short PATHSEG_CLOSEPATH = 1; diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp index 5d21b94..cfae425 100644 --- a/WebCore/svg/SVGPatternElement.cpp +++ b/WebCore/svg/SVGPatternElement.cpp @@ -25,26 +25,26 @@ #if ENABLE(SVG) #include "SVGPatternElement.h" -#include "TransformationMatrix.h" #include "Document.h" #include "FloatConversion.h" #include "GraphicsContext.h" #include "ImageBuffer.h" +#include "MappedAttribute.h" #include "PatternAttributes.h" #include "RenderSVGContainer.h" #include "SVGLength.h" #include "SVGNames.h" #include "SVGPaintServerPattern.h" #include "SVGRenderSupport.h" -#include "SVGStyledTransformableElement.h" #include "SVGSVGElement.h" +#include "SVGStyledTransformableElement.h" #include "SVGTransformList.h" #include "SVGTransformable.h" #include "SVGUnitTypes.h" - +#include "TransformationMatrix.h" #include <math.h> -#include <wtf/OwnPtr.h> #include <wtf/MathExtras.h> +#include <wtf/OwnPtr.h> using namespace std; @@ -177,7 +177,7 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const patternBoundaries.setHeight(targetRect.height()); IntSize patternSize(patternBoundaries.width(), patternBoundaries.height()); - clampImageBufferSizeToViewport(document()->renderer(), patternSize); + clampImageBufferSizeToViewport(document()->view(), patternSize); if (patternSize.width() < static_cast<int>(patternBoundaries.width())) patternBoundaries.setWidth(patternSize.width()); @@ -191,7 +191,7 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const for (Node* n = attributes.patternContentElement()->firstChild(); n; n = n->nextSibling()) { if (!n->isSVGElement() || !static_cast<SVGElement*>(n)->isStyledTransformable() || !n->renderer()) continue; - patternContentBoundaries.unite(n->renderer()->relativeBBox(true)); + patternContentBoundaries.unite(n->renderer()->repaintRectInLocalCoordinates()); } } @@ -212,11 +212,11 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const } IntSize imageSize(lroundf(patternBoundariesIncludingOverflow.width()), lroundf(patternBoundariesIncludingOverflow.height())); - clampImageBufferSizeToViewport(document()->renderer(), imageSize); + clampImageBufferSizeToViewport(document()->view(), imageSize); - auto_ptr<ImageBuffer> patternImage = ImageBuffer::create(imageSize, false); + OwnPtr<ImageBuffer> patternImage = ImageBuffer::create(imageSize, false); - if (!patternImage.get()) + if (!patternImage) return; GraphicsContext* context = patternImage->context(); @@ -251,7 +251,7 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const m_resource->setPatternTransform(attributes.patternTransform()); m_resource->setPatternBoundaries(patternBoundaries); - m_resource->setTile(patternImage); + m_resource->setTile(patternImage.release()); } RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp index 3d15a43..db39c52 100644 --- a/WebCore/svg/SVGPolyElement.cpp +++ b/WebCore/svg/SVGPolyElement.cpp @@ -27,6 +27,7 @@ #include "Document.h" #include "FloatPoint.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGAnimatedProperty.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp index abc11fb..23a8579 100644 --- a/WebCore/svg/SVGRadialGradientElement.cpp +++ b/WebCore/svg/SVGRadialGradientElement.cpp @@ -27,6 +27,7 @@ #include "FloatConversion.h" #include "FloatPoint.h" +#include "MappedAttribute.h" #include "RadialGradientAttributes.h" #include "RenderObject.h" #include "SVGLength.h" diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp index 367e12e..bfb6205 100644 --- a/WebCore/svg/SVGRectElement.cpp +++ b/WebCore/svg/SVGRectElement.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGRectElement.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGLength.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp index e66a16e..fcecd8c 100644 --- a/WebCore/svg/SVGSVGElement.cpp +++ b/WebCore/svg/SVGSVGElement.cpp @@ -24,7 +24,6 @@ #if ENABLE(SVG) #include "SVGSVGElement.h" -#include "TransformationMatrix.h" #include "CSSHelper.h" #include "CSSPropertyNames.h" #include "Document.h" @@ -34,8 +33,10 @@ #include "FloatRect.h" #include "Frame.h" #include "HTMLNames.h" -#include "RenderSVGViewportContainer.h" +#include "MappedAttribute.h" #include "RenderSVGRoot.h" +#include "RenderSVGViewportContainer.h" +#include "SMILTimeContainer.h" #include "SVGAngle.h" #include "SVGLength.h" #include "SVGNames.h" @@ -45,8 +46,9 @@ #include "SVGViewElement.h" #include "SVGViewSpec.h" #include "SVGZoomEvent.h" +#include "ScriptEventListener.h" #include "SelectionController.h" -#include "SMILTimeContainer.h" +#include "TransformationMatrix.h" #include <wtf/StdLibExtras.h> namespace WebCore { @@ -220,13 +222,13 @@ void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr) // Only handle events if we're the outermost <svg> element if (attr->name() == onunloadAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().unloadEvent, attr); + document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onresizeAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().resizeEvent, attr); + document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onscrollAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().scrollEvent, attr); + document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == SVGNames::onzoomAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().zoomEvent, attr); + document()->setWindowAttributeEventListener(eventNames().zoomEvent, createAttributeEventListener(document()->frame(), attr)); else setListener = false; @@ -235,9 +237,9 @@ void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr) } if (attr->name() == onabortAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().abortEvent, attr); + document()->setWindowAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onerrorAttr) - document()->setWindowInlineEventListenerForTypeAndAttribute(eventNames().errorEvent, attr); + document()->setWindowAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength(LengthModeWidth, attr->value())); else if (attr->name() == SVGNames::yAttr) @@ -268,15 +270,34 @@ void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr) } } +// This hack will not handle the case where we're setting a width/height +// on a root <svg> via svg.width.baseValue = when it has none. +static void updateCSSForAttribute(SVGSVGElement* element, const QualifiedName& attrName, CSSPropertyID property, const SVGLength& value) +{ + Attribute* attribute = element->attributes(false)->getAttributeItem(attrName); + if (!attribute || !attribute->isMappedAttribute()) + return; + element->addCSSProperty(static_cast<MappedAttribute*>(attribute), property, value.valueAsString()); +} + void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); + // FIXME: Ugly, ugly hack to around that parseMappedAttribute is not called + // when svg.width.baseValue = 100 is evaluated. + // Thus the CSS length value for width is not updated, and width() calcWidth() + // calculations on RenderSVGRoot will be wrong. + // https://bugs.webkit.org/show_bug.cgi?id=25387 + if (attrName == SVGNames::widthAttr) + updateCSSForAttribute(this, attrName, CSSPropertyWidth, widthBaseValue()); + else if (attrName == SVGNames::heightAttr) + updateCSSForAttribute(this, attrName, CSSPropertyHeight, heightBaseValue()); + if (!renderer()) return; if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || - attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || SVGTests::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || @@ -398,14 +419,14 @@ TransformationMatrix SVGSVGElement::getCTM() const TransformationMatrix SVGSVGElement::getScreenCTM() const { document()->updateLayoutIgnorePendingStylesheets(); - FloatPoint rootLocation; + FloatPoint rootLocation; if (RenderObject* renderer = this->renderer()) { if (isOutermostSVG()) { // FIXME: This doesn't work correctly with CSS transforms. FloatPoint point; if (renderer->parent()) - point = renderer->localToAbsolute(point, true); + point = renderer->localToAbsolute(point, false, true); rootLocation.move(point.x(), point.y()); } else rootLocation.move(x().value(this), y().value(this)); @@ -477,6 +498,10 @@ bool SVGSVGElement::hasRelativeValues() const bool SVGSVGElement::isOutermostSVG() const { + // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc. + if (!parentNode()) + return true; + // This is true whenever this is the outermost SVG, even if there are HTML elements outside it return !parentNode()->isSVGElement(); } diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp index 1b7f4d9..2ecf912 100644 --- a/WebCore/svg/SVGScriptElement.cpp +++ b/WebCore/svg/SVGScriptElement.cpp @@ -27,6 +27,7 @@ #include "Document.h" #include "EventNames.h" +#include "MappedAttribute.h" #include "SVGNames.h" namespace WebCore { @@ -173,6 +174,11 @@ String SVGScriptElement::languageAttributeValue() const return String(); } +String SVGScriptElement::forAttributeValue() const +{ + return String(); +} + void SVGScriptElement::dispatchLoadEvent() { bool externalResourcesRequired = externalResourcesRequiredBaseValue(); @@ -203,7 +209,7 @@ void SVGScriptElement::dispatchLoadEvent() void SVGScriptElement::dispatchErrorEvent() { - dispatchEventForType(eventNames().errorEvent, true, false); + dispatchEvent(eventNames().errorEvent, true, false); } } diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h index 090cd2d..f2efc8e 100644 --- a/WebCore/svg/SVGScriptElement.h +++ b/WebCore/svg/SVGScriptElement.h @@ -57,6 +57,8 @@ namespace WebCore { virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; + virtual bool shouldExecuteAsJavaScript() const { return false; } + protected: virtual const SVGElement* contextElement() const { return this; } virtual bool haveLoadedRequiredResources(); @@ -65,6 +67,7 @@ namespace WebCore { virtual String charsetAttributeValue() const; virtual String typeAttributeValue() const; virtual String languageAttributeValue() const; + virtual String forAttributeValue() const; virtual void dispatchLoadEvent(); virtual void dispatchErrorEvent(); diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp index 4747824..51582d7 100644 --- a/WebCore/svg/SVGStopElement.cpp +++ b/WebCore/svg/SVGStopElement.cpp @@ -26,6 +26,7 @@ #include "SVGStopElement.h" #include "Document.h" +#include "MappedAttribute.h" #include "RenderSVGGradientStop.h" #include "SVGGradientElement.h" #include "SVGNames.h" @@ -51,7 +52,7 @@ void SVGStopElement::parseMappedAttribute(MappedAttribute* attr) else setOffsetBaseValue(value.toFloat()); - setChanged(); + setNeedsStyleRecalc(); } else SVGStyledElement::parseMappedAttribute(attr); } diff --git a/WebCore/svg/SVGStyleElement.cpp b/WebCore/svg/SVGStyleElement.cpp index 2f59680..72f70e6 100644 --- a/WebCore/svg/SVGStyleElement.cpp +++ b/WebCore/svg/SVGStyleElement.cpp @@ -22,6 +22,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "SVGStyleElement.h" @@ -29,6 +30,7 @@ #include "Document.h" #include "ExceptionCode.h" #include "HTMLNames.h" +#include "MappedAttribute.h" #include "XMLNames.h" #include <wtf/StdLibExtras.h> diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 76303a9..98b6459 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -19,6 +19,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "SVGStyledElement.h" @@ -28,11 +29,12 @@ #include "CString.h" #include "Document.h" #include "HTMLNames.h" +#include "MappedAttribute.h" #include "PlatformString.h" +#include "RenderObject.h" #include "SVGElement.h" #include "SVGElementInstance.h" #include "SVGNames.h" -#include "RenderObject.h" #include "SVGRenderStyle.h" #include "SVGResource.h" #include "SVGSVGElement.h" @@ -165,7 +167,7 @@ void SVGStyledElement::parseMappedAttribute(MappedAttribute* attr) int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName); if (propId > 0) { addCSSProperty(attr, propId, attr->value()); - setChanged(); + setNeedsStyleRecalc(); return; } @@ -240,6 +242,9 @@ PassRefPtr<RenderStyle> SVGStyledElement::resolveStyle(RenderStyle* parentStyle) PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& name) { + if (!mappedAttributes()) + return 0; + Attribute* attr = mappedAttributes()->getAttributeItem(QualifiedName(nullAtom, name, nullAtom)); if (!attr || !attr->isMappedAttribute() || !attr->style()) return 0; diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp index 901ab0f..b7cf979 100644 --- a/WebCore/svg/SVGStyledTransformableElement.cpp +++ b/WebCore/svg/SVGStyledTransformableElement.cpp @@ -26,11 +26,12 @@ #include "SVGStyledTransformableElement.h" #include "Attr.h" +#include "MappedAttribute.h" #include "RenderPath.h" #include "SVGDocument.h" -#include "TransformationMatrix.h" #include "SVGStyledElement.h" #include "SVGTransformList.h" +#include "TransformationMatrix.h" namespace WebCore { diff --git a/WebCore/svg/SVGTests.cpp b/WebCore/svg/SVGTests.cpp index 06a81f2..258c12c 100644 --- a/WebCore/svg/SVGTests.cpp +++ b/WebCore/svg/SVGTests.cpp @@ -25,6 +25,7 @@ #include "DOMImplementation.h" #include "Language.h" +#include "MappedAttribute.h" #include "SVGElement.h" #include "SVGNames.h" #include "SVGStringList.h" diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp index 8b34c2c..067f35f 100644 --- a/WebCore/svg/SVGTextContentElement.cpp +++ b/WebCore/svg/SVGTextContentElement.cpp @@ -29,14 +29,15 @@ #include "FloatPoint.h" #include "FloatRect.h" #include "Frame.h" +#include "MappedAttribute.h" #include "Position.h" #include "RenderSVGText.h" -#include "SelectionController.h" #include "SVGCharacterLayoutInfo.h" -#include "SVGRootInlineBox.h" -#include "SVGLength.h" #include "SVGInlineTextBox.h" +#include "SVGLength.h" #include "SVGNames.h" +#include "SVGRootInlineBox.h" +#include "SelectionController.h" #include "XMLNames.h" #include <wtf/StdLibExtras.h> @@ -370,7 +371,7 @@ static inline SVGInlineTextBoxQueryWalker executeTextQuery(const SVGTextContentE return walkerCallback; } -long SVGTextContentElement::getNumberOfChars() const +unsigned SVGTextContentElement::getNumberOfChars() const { document()->updateLayoutIgnorePendingStylesheets(); @@ -384,12 +385,12 @@ float SVGTextContentElement::getComputedTextLength() const return executeTextQuery(this, SVGInlineTextBoxQueryWalker::TextLength).floatResult(); } -float SVGTextContentElement::getSubStringLength(long charnum, long nchars, ExceptionCode& ec) const +float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec) const { document()->updateLayoutIgnorePendingStylesheets(); - long numberOfChars = getNumberOfChars(); - if (charnum < 0 || nchars < 0 || charnum >= numberOfChars) { + unsigned numberOfChars = getNumberOfChars(); + if (charnum >= numberOfChars) { ec = INDEX_SIZE_ERR; return 0.0f; } @@ -397,11 +398,11 @@ float SVGTextContentElement::getSubStringLength(long charnum, long nchars, Excep return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult(); } -FloatPoint SVGTextContentElement::getStartPositionOfChar(long charnum, ExceptionCode& ec) const +FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec) const { document()->updateLayoutIgnorePendingStylesheets(); - if (charnum < 0 || charnum > getNumberOfChars()) { + if (charnum > getNumberOfChars()) { ec = INDEX_SIZE_ERR; return FloatPoint(); } @@ -409,11 +410,11 @@ FloatPoint SVGTextContentElement::getStartPositionOfChar(long charnum, Exception return executeTextQuery(this, SVGInlineTextBoxQueryWalker::StartPosition, charnum).pointResult(); } -FloatPoint SVGTextContentElement::getEndPositionOfChar(long charnum, ExceptionCode& ec) const +FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec) const { document()->updateLayoutIgnorePendingStylesheets(); - if (charnum < 0 || charnum > getNumberOfChars()) { + if (charnum > getNumberOfChars()) { ec = INDEX_SIZE_ERR; return FloatPoint(); } @@ -421,11 +422,11 @@ FloatPoint SVGTextContentElement::getEndPositionOfChar(long charnum, ExceptionCo return executeTextQuery(this, SVGInlineTextBoxQueryWalker::EndPosition, charnum).pointResult(); } -FloatRect SVGTextContentElement::getExtentOfChar(long charnum, ExceptionCode& ec) const +FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec) const { document()->updateLayoutIgnorePendingStylesheets(); - if (charnum < 0 || charnum > getNumberOfChars()) { + if (charnum > getNumberOfChars()) { ec = INDEX_SIZE_ERR; return FloatRect(); } @@ -433,11 +434,11 @@ FloatRect SVGTextContentElement::getExtentOfChar(long charnum, ExceptionCode& ec return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Extent, charnum).rectResult(); } -float SVGTextContentElement::getRotationOfChar(long charnum, ExceptionCode& ec) const +float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec) const { document()->updateLayoutIgnorePendingStylesheets(); - if (charnum < 0 || charnum > getNumberOfChars()) { + if (charnum > getNumberOfChars()) { ec = INDEX_SIZE_ERR; return 0.0f; } @@ -445,17 +446,17 @@ float SVGTextContentElement::getRotationOfChar(long charnum, ExceptionCode& ec) return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Rotation, charnum).floatResult(); } -long SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const +int SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const { document()->updateLayoutIgnorePendingStylesheets(); return executeTextQuery(this, SVGInlineTextBoxQueryWalker::CharacterNumberAtPosition, 0.0f, 0.0f, point).longResult(); } -void SVGTextContentElement::selectSubString(long charnum, long nchars, ExceptionCode& ec) const +void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec) const { - long numberOfChars = getNumberOfChars(); - if (charnum < 0 || nchars < 0 || charnum >= numberOfChars) { + unsigned numberOfChars = getNumberOfChars(); + if (charnum >= numberOfChars) { ec = INDEX_SIZE_ERR; return; } @@ -472,12 +473,12 @@ void SVGTextContentElement::selectSubString(long charnum, long nchars, Exception // Find selection start VisiblePosition start(const_cast<SVGTextContentElement*>(this), 0, SEL_DEFAULT_AFFINITY); - for (long i = 0; i < charnum; ++i) + for (unsigned i = 0; i < charnum; ++i) start = start.next(); // Find selection end VisiblePosition end(start); - for (long i = 0; i < nchars; ++i) + for (unsigned i = 0; i < nchars; ++i) end = end.next(); controller->setSelection(VisibleSelection(start, end)); diff --git a/WebCore/svg/SVGTextContentElement.h b/WebCore/svg/SVGTextContentElement.h index d6b9d93..9933b2c 100644 --- a/WebCore/svg/SVGTextContentElement.h +++ b/WebCore/svg/SVGTextContentElement.h @@ -52,15 +52,15 @@ namespace WebCore { virtual bool isValid() const { return SVGTests::isValid(); } virtual bool isTextContent() const { return true; } - long getNumberOfChars() const; + unsigned getNumberOfChars() const; float getComputedTextLength() const; - float getSubStringLength(long charnum, long nchars, ExceptionCode&) const; - FloatPoint getStartPositionOfChar(long charnum, ExceptionCode&) const; - FloatPoint getEndPositionOfChar(long charnum, ExceptionCode&) const; - FloatRect getExtentOfChar(long charnum, ExceptionCode&) const; - float getRotationOfChar(long charnum, ExceptionCode&) const; - long getCharNumAtPosition(const FloatPoint&) const; - void selectSubString(long charnum, long nchars, ExceptionCode&) const; + float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&) const; + FloatPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&) const; + FloatPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&) const; + FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&) const; + float getRotationOfChar(unsigned charnum, ExceptionCode&) const; + int getCharNumAtPosition(const FloatPoint&) const; + void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const; virtual void parseMappedAttribute(MappedAttribute*); diff --git a/WebCore/svg/SVGTextContentElement.idl b/WebCore/svg/SVGTextContentElement.idl index e4e0163..394b398 100644 --- a/WebCore/svg/SVGTextContentElement.idl +++ b/WebCore/svg/SVGTextContentElement.idl @@ -40,20 +40,20 @@ module svg { long getNumberOfChars(); float getComputedTextLength(); - float getSubStringLength(in unsigned long offset, - in unsigned long length) + float getSubStringLength(in [IsIndex] unsigned long offset, + in [IsIndex] unsigned long length) raises(DOMException); - SVGPoint getStartPositionOfChar(in unsigned long offset) + SVGPoint getStartPositionOfChar(in [IsIndex] unsigned long offset) raises(DOMException); - SVGPoint getEndPositionOfChar(in unsigned long offset) + SVGPoint getEndPositionOfChar(in [IsIndex] unsigned long offset) raises(DOMException); - SVGRect getExtentOfChar(in unsigned long offset) + SVGRect getExtentOfChar(in [IsIndex] unsigned long offset) raises(DOMException); - float getRotationOfChar(in unsigned long offset) + float getRotationOfChar(in [IsIndex] unsigned long offset) raises(DOMException); long getCharNumAtPosition(in SVGPoint point); - void selectSubString(in unsigned long offset, - in unsigned long length) + void selectSubString(in [IsIndex] unsigned long offset, + in [IsIndex] unsigned long length) raises(DOMException); }; diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp index b2ee798..b8c7331 100644 --- a/WebCore/svg/SVGTextElement.cpp +++ b/WebCore/svg/SVGTextElement.cpp @@ -25,13 +25,14 @@ #if ENABLE(SVG) #include "SVGTextElement.h" -#include "TransformationMatrix.h" #include "FloatRect.h" +#include "MappedAttribute.h" #include "RenderSVGText.h" #include "SVGLengthList.h" #include "SVGRenderStyle.h" #include "SVGTSpanElement.h" #include "SVGTransformList.h" +#include "TransformationMatrix.h" namespace WebCore { diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp index f7f974b..0d8560a 100644 --- a/WebCore/svg/SVGTextPathElement.cpp +++ b/WebCore/svg/SVGTextPathElement.cpp @@ -24,14 +24,14 @@ #if ENABLE(SVG) #include "SVGTextPathElement.h" -#include "TransformationMatrix.h" #include "FloatRect.h" +#include "MappedAttribute.h" #include "RenderSVGTextPath.h" #include "SVGLengthList.h" #include "SVGPathElement.h" #include "SVGRenderStyle.h" -#include "SVGTextPathElement.h" #include "SVGTransformList.h" +#include "TransformationMatrix.h" namespace WebCore { diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp index e9ceaa1..32d9dc0 100644 --- a/WebCore/svg/SVGTextPositioningElement.cpp +++ b/WebCore/svg/SVGTextPositioningElement.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGTextPositioningElement.h" +#include "MappedAttribute.h" #include "SVGLengthList.h" #include "SVGNames.h" #include "SVGNumberList.h" diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp index d18e49a..8871229 100644 --- a/WebCore/svg/SVGURIReference.cpp +++ b/WebCore/svg/SVGURIReference.cpp @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include "SVGURIReference.h" +#include "MappedAttribute.h" + namespace WebCore { char SVGURIReferenceIdentifier[] = "SVGURIReference"; diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index 4ae0f5c..b73a692 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -22,12 +22,6 @@ #include "config.h" -// Dump SVGElementInstance object tree - useful to debug instanceRoot problems -// #define DUMP_INSTANCE_TREE - -// Dump the deep-expanded shadow tree (where the renderes are built from) -// #define DUMP_SHADOW_TREE - #if ENABLE(SVG) #include "SVGUseElement.h" @@ -37,6 +31,7 @@ #include "Event.h" #include "EventListener.h" #include "HTMLNames.h" +#include "MappedAttribute.h" #include "NodeRenderStyle.h" #include "RegisteredEventListener.h" #include "RenderSVGTransformableContainer.h" @@ -51,6 +46,12 @@ #include "XLinkNames.h" #include "XMLSerializer.h" +// Dump SVGElementInstance object tree - useful to debug instanceRoot problems +// #define DUMP_INSTANCE_TREE + +// Dump the deep-expanded shadow tree (where the renderers are built from) +// #define DUMP_SHADOW_TREE + namespace WebCore { SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* doc) @@ -138,7 +139,7 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) buildPendingResource(); if (m_shadowTreeRootElement) - m_shadowTreeRootElement->setChanged(); + m_shadowTreeRootElement->setNeedsStyleRecalc(); } } @@ -152,7 +153,7 @@ void SVGUseElement::childrenChanged(bool changedByParser, Node* beforeChange, No buildPendingResource(); if (m_shadowTreeRootElement) - m_shadowTreeRootElement->setChanged(); + m_shadowTreeRootElement->setNeedsStyleRecalc(); } static bool shadowTreeContainsChangedNodes(SVGElementInstance* target) @@ -169,11 +170,11 @@ static bool shadowTreeContainsChangedNodes(SVGElementInstance* target) void SVGUseElement::recalcStyle(StyleChange change) { - if (attached() && changed() && shadowTreeContainsChangedNodes(m_targetElementInstance.get())) { + if (attached() && needsStyleRecalc() && shadowTreeContainsChangedNodes(m_targetElementInstance.get())) { buildPendingResource(); if (m_shadowTreeRootElement) - m_shadowTreeRootElement->setChanged(); + m_shadowTreeRootElement->setNeedsStyleRecalc(); } SVGStyledElement::recalcStyle(change); @@ -186,7 +187,7 @@ void SVGUseElement::recalcStyle(StyleChange change) // Mimic Element::recalcStyle(). The main difference is that we don't call attach() on the // shadow tree root element, but call attachShadowTree() here. Calling attach() will crash // as the shadow tree root element has no (direct) parent node. Yes, shadow trees are tricky. - if (change >= Inherit || m_shadowTreeRootElement->changed()) { + if (change >= Inherit || m_shadowTreeRootElement->needsStyleRecalc()) { RefPtr<RenderStyle> newStyle = document()->styleSelector()->styleForElement(m_shadowTreeRootElement.get()); StyleChange ch = Node::diff(m_shadowTreeRootElement->renderStyle(), newStyle.get()); if (ch == Detach) { @@ -195,8 +196,8 @@ void SVGUseElement::recalcStyle(StyleChange change) attachShadowTree(); // attach recalulates the style for all children. No need to do it twice. - m_shadowTreeRootElement->setChanged(NoStyleChange); - m_shadowTreeRootElement->setHasChangedChild(false); + m_shadowTreeRootElement->setNeedsStyleRecalc(NoStyleChange); + m_shadowTreeRootElement->setChildNeedsStyleRecalc(false); return; } } @@ -835,7 +836,11 @@ SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element, S { ASSERT(element); ASSERT(instance); - ASSERT(instance->shadowTreeElement()); + + // We're dispatching a mutation event during shadow tree construction + // this instance hasn't yet been associated to a shadowTree element. + if (!instance->shadowTreeElement()) + return 0; if (element == instance->shadowTreeElement()) return instance; diff --git a/WebCore/svg/SVGViewElement.cpp b/WebCore/svg/SVGViewElement.cpp index cb16b62..61cb397 100644 --- a/WebCore/svg/SVGViewElement.cpp +++ b/WebCore/svg/SVGViewElement.cpp @@ -26,6 +26,7 @@ #include "SVGViewElement.h" #include "Attr.h" +#include "MappedAttribute.h" #include "PlatformString.h" #include "SVGFitToViewBox.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGViewSpec.idl b/WebCore/svg/SVGViewSpec.idl index 46d4c8e..24d18f8 100644 --- a/WebCore/svg/SVGViewSpec.idl +++ b/WebCore/svg/SVGViewSpec.idl @@ -25,7 +25,7 @@ module svg { - interface [Conditional=SVG, ObjCCustomInternalImpl] SVGViewSpec : SVGZoomAndPan, SVGFitToViewBox + interface [Conditional=SVG] SVGViewSpec : SVGZoomAndPan, SVGFitToViewBox { readonly attribute SVGTransformList transform; readonly attribute SVGElement viewTarget; diff --git a/WebCore/svg/animation/SMILTime.h b/WebCore/svg/animation/SMILTime.h index 5196030..ebbd765 100644 --- a/WebCore/svg/animation/SMILTime.h +++ b/WebCore/svg/animation/SMILTime.h @@ -62,8 +62,6 @@ namespace WebCore { inline bool operator>=(const SMILTime& a, const SMILTime& b) { return a.value() > b.value() || operator==(a, b); } inline bool operator<=(const SMILTime& a, const SMILTime& b) { return a.value() < b.value() || operator==(a, b); } - inline SMILTime max(const SMILTime& a, const SMILTime& b) { return std::max(a.value(), b.value()); } - inline SMILTime min(const SMILTime& a, const SMILTime& b) { return std::min(a.value(), b.value()); } SMILTime operator+(const SMILTime&, const SMILTime&); SMILTime operator-(const SMILTime&, const SMILTime&); // So multiplying times does not make too much sense but SMIL defines it for duration * repeatCount diff --git a/WebCore/svg/animation/SMILTimeContainer.cpp b/WebCore/svg/animation/SMILTimeContainer.cpp index 48a2706..a37e481 100644 --- a/WebCore/svg/animation/SMILTimeContainer.cpp +++ b/WebCore/svg/animation/SMILTimeContainer.cpp @@ -276,7 +276,7 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed) startTimer(earliersFireTime, animationFrameDelay); - Document::updateDocumentsRendering(); + Document::updateStyleForAllDocuments(); } #endif diff --git a/WebCore/svg/animation/SVGSMILElement.cpp b/WebCore/svg/animation/SVGSMILElement.cpp index a2e2b0e..63a0d82 100644 --- a/WebCore/svg/animation/SVGSMILElement.cpp +++ b/WebCore/svg/animation/SVGSMILElement.cpp @@ -24,6 +24,7 @@ */ #include "config.h" + #if ENABLE(SVG_ANIMATION) #include "SVGSMILElement.h" @@ -34,11 +35,12 @@ #include "FloatConversion.h" #include "FrameView.h" #include "HTMLNames.h" +#include "MappedAttribute.h" +#include "SMILTimeContainer.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGSVGElement.h" #include "SVGURIReference.h" -#include "SMILTimeContainer.h" #include "XLinkNames.h" #include <math.h> #include <wtf/MathExtras.h> diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp index 067f645..2157144 100644 --- a/WebCore/svg/graphics/SVGImage.cpp +++ b/WebCore/svg/graphics/SVGImage.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Eric Seidel (eric@webkit.org) - * Copyright (C) 2008 Apple, Inc. All rights reserved. + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,8 +35,9 @@ #include "FrameLoader.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLFormElement.h" +#include "ImageBuffer.h" #include "ImageObserver.h" -#include "NotImplemented.h" #include "Page.h" #include "RenderView.h" #include "ResourceError.h" @@ -46,6 +47,9 @@ #include "SVGSVGElement.h" #include "Settings.h" +// Moving this #include above FrameLoader.h causes the Windows build to fail due to warnings about +// alignment in Timer<FrameLoader>. It seems that the definition of EmptyFrameLoaderClient is what +// causes this (removing that definition fixes the warnings), but it isn't clear why. #include "EmptyClients.h" namespace WebCore { @@ -76,36 +80,33 @@ private: SVGImage::SVGImage(ImageObserver* observer) : Image(observer) - , m_document(0) - , m_chromeClient(0) - , m_page(0) - , m_frame(0) - , m_frameView(0) { } SVGImage::~SVGImage() { - if (m_frame) - m_frame->loader()->frameDetached(); // Break both the loader and view references to the frame + if (m_page) { + m_page->mainFrame()->loader()->frameDetached(); // Break both the loader and view references to the frame + + // Clear explicitly because we want to delete the page before the ChromeClient. + // FIXME: I believe that's already guaranteed by C++ object destruction rules, + // so this may matter only for the assertion below. + m_page.clear(); + } - // Clear these manually so we can safely delete the ChromeClient afterwards - m_frameView.clear(); - m_frame.clear(); - m_page.clear(); - // Verify that page teardown destroyed the Chrome ASSERT(!m_chromeClient->image()); } void SVGImage::setContainerSize(const IntSize& containerSize) { - if (containerSize.width() <= 0 || containerSize.height() <= 0) + if (containerSize.isEmpty()) return; - if (!m_frame) + if (!m_page) return; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); + Frame* frame = m_page->mainFrame(); + SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); if (!rootElement) return; @@ -114,9 +115,10 @@ void SVGImage::setContainerSize(const IntSize& containerSize) bool SVGImage::usesContainerSize() const { - if (!m_frame) + if (!m_page) return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); + Frame* frame = m_page->mainFrame(); + SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); if (!rootElement) return false; @@ -125,10 +127,10 @@ bool SVGImage::usesContainerSize() const IntSize SVGImage::size() const { - if (!m_frame) + if (!m_page) return IntSize(); - - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); + Frame* frame = m_page->mainFrame(); + SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); if (!rootElement) return IntSize(); @@ -151,9 +153,9 @@ IntSize SVGImage::size() const bool SVGImage::hasRelativeWidth() const { - if (!m_frame) + if (!m_page) return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); + SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); if (!rootElement) return false; @@ -162,9 +164,9 @@ bool SVGImage::hasRelativeWidth() const bool SVGImage::hasRelativeHeight() const { - if (!m_frame) + if (!m_page) return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); + SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); if (!rootElement) return false; @@ -173,22 +175,24 @@ bool SVGImage::hasRelativeHeight() const void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) { - if (!m_frame) + if (!m_page) return; - + + FrameView* view = m_page->mainFrame()->view(); + context->save(); context->setCompositeOperation(compositeOp); context->clip(enclosingIntRect(dstRect)); if (compositeOp != CompositeSourceOver) - context->beginTransparencyLayer(1.0f); + context->beginTransparencyLayer(1); context->translate(dstRect.location().x(), dstRect.location().y()); - context->scale(FloatSize(dstRect.width()/srcRect.width(), dstRect.height()/srcRect.height())); + context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); - m_frame->view()->resize(size()); + view->resize(size()); - if (m_frame->view()->needsLayout()) - m_frame->view()->layout(); - m_frame->view()->paint(context, enclosingIntRect(srcRect)); + if (view->needsLayout()) + view->layout(); + view->paint(context, enclosingIntRect(srcRect)); if (compositeOp != CompositeSourceOver) context->endTransparencyLayer(); @@ -205,20 +209,22 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame() // frame cache, or better yet, not use a cache for tiled drawing at all, instead // having a tiled drawing callback (hopefully non-virtual). if (!m_frameCache) { - m_frameCache.set(ImageBuffer::create(size(), false).release()); + if (!m_page) + return 0; + m_frameCache = ImageBuffer::create(size(), false); if (!m_frameCache) // failed to allocate image return 0; - renderSubtreeToImage(m_frameCache.get(), m_frame->contentRenderer()); + renderSubtreeToImage(m_frameCache.get(), m_page->mainFrame()->contentRenderer()); } return m_frameCache->image()->nativeImageForCurrentFrame(); } bool SVGImage::dataChanged(bool allDataReceived) { - int length = m_data->size(); - if (!length) // if this was an empty image + // Don't do anything if is an empty image. + if (!m_data->size()) return true; - + if (allDataReceived) { static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient; static EditorClient* dummyEditorClient = new EmptyEditorClient; @@ -228,28 +234,29 @@ bool SVGImage::dataChanged(bool allDataReceived) m_chromeClient.set(new SVGImageChromeClient(this)); - // FIXME: If this SVG ends up loading itself, we'll leak this Frame (and associated DOM & render trees). - // The Cache code does not know about CachedImages holding Frames and won't know to break the cycle. + // FIXME: If this SVG ends up loading itself, we might leak the world. + // THe comment said that the Cache code does not know about CachedImages + // holding Frames and won't know to break the cycle. But m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient)); m_page->settings()->setJavaScriptEnabled(false); m_page->settings()->setPluginsEnabled(false); - m_frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); - m_frameView = new FrameView(m_frame.get()); - m_frameView->deref(); // FIXME: FrameView starts with a refcount of 1 - m_frame->setView(m_frameView.get()); - m_frame->init(); + RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); + frame->setView(FrameView::create(frame.get())); + frame->init(); ResourceRequest fakeRequest(KURL("")); - m_frame->loader()->load(fakeRequest, false); // Make sure the DocumentLoader is created - m_frame->loader()->cancelContentPolicyCheck(); // cancel any policy checks - m_frame->loader()->commitProvisionalLoad(0); - m_frame->loader()->setResponseMIMEType("image/svg+xml"); - m_frame->loader()->begin(KURL()); // create the empty document - m_frame->loader()->write(m_data->data(), m_data->size()); - m_frame->loader()->end(); - m_frameView->setTransparent(true); // SVG Images are transparent. + FrameLoader* loader = frame->loader(); + loader->load(fakeRequest, false); // Make sure the DocumentLoader is created + loader->cancelContentPolicyCheck(); // cancel any policy checks + loader->commitProvisionalLoad(0); + loader->setResponseMIMEType("image/svg+xml"); + loader->begin(KURL()); // create the empty document + loader->write(m_data->data(), m_data->size()); + loader->end(); + frame->view()->setTransparent(true); // SVG Images are transparent. } - return m_frameView; + + return m_page; } } diff --git a/WebCore/svg/graphics/SVGImage.h b/WebCore/svg/graphics/SVGImage.h index 062c0a2..2cea91a 100644 --- a/WebCore/svg/graphics/SVGImage.h +++ b/WebCore/svg/graphics/SVGImage.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Eric Seidel (eric@webkit.org) + * Copyright (C) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,15 +30,10 @@ #if ENABLE(SVG) #include "Image.h" -#include "ImageBuffer.h" -#include "IntSize.h" -#include <wtf/OwnPtr.h> namespace WebCore { - - class SVGDocument; - class Frame; - class FrameView; + + class ImageBuffer; class Page; class SVGImageChromeClient; @@ -72,12 +68,8 @@ namespace WebCore { virtual NativeImagePtr nativeImageForCurrentFrame(); - SVGDocument* m_document; OwnPtr<SVGImageChromeClient> m_chromeClient; OwnPtr<Page> m_page; - RefPtr<Frame> m_frame; - RefPtr<FrameView> m_frameView; - IntSize m_minSize; OwnPtr<ImageBuffer> m_frameCache; }; } diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp index eb0d80b..9ba224e 100644 --- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp +++ b/WebCore/svg/graphics/SVGPaintServerGradient.cpp @@ -34,6 +34,7 @@ #include "GraphicsContext.h" #include "ImageBuffer.h" #include "RenderObject.h" +#include "RenderView.h" #include "SVGGradientElement.h" #include "SVGPaintServerLinearGradient.h" #include "SVGPaintServerRadialGradient.h" @@ -130,15 +131,15 @@ static inline bool createMaskAndSwapContextForTextGradient( GraphicsContext*& context, GraphicsContext*& savedContext, OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object) { - FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->relativeBBox(false); + FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox(); IntRect maskRect = enclosingIntRect(object->absoluteTransform().mapRect(maskBBox)); IntSize maskSize(maskRect.width(), maskRect.height()); - clampImageBufferSizeToViewport(object->document()->renderer(), maskSize); + clampImageBufferSizeToViewport(object->view()->frameView(), maskSize); - auto_ptr<ImageBuffer> maskImage = ImageBuffer::create(maskSize, false); + OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskSize, false); - if (!maskImage.get()) + if (!maskImage) return false; GraphicsContext* maskImageContext = maskImage->context(); @@ -159,14 +160,14 @@ static inline TransformationMatrix clipToTextMask(GraphicsContext* context, OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object, const SVGPaintServerGradient* gradientServer) { - FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->relativeBBox(false); + FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox(); // Fixup transformations to be able to clip to mask TransformationMatrix transform = object->absoluteTransform(); FloatRect textBoundary = transform.mapRect(maskBBox); IntSize maskSize(lroundf(textBoundary.width()), lroundf(textBoundary.height())); - clampImageBufferSizeToViewport(object->document()->renderer(), maskSize); + clampImageBufferSizeToViewport(object->view()->frameView(), maskSize); textBoundary.setSize(textBoundary.size().shrunkTo(maskSize)); // Clip current context to mask image (gradient) @@ -227,7 +228,7 @@ bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject #else if (boundingBoxMode()) { #endif - FloatRect bbox = object->relativeBBox(false); + FloatRect bbox = object->objectBoundingBox(); // Don't use gradients for 1d objects like horizontal/vertical // lines or rectangles without width or height. if (bbox.width() == 0 || bbox.height() == 0) { @@ -258,7 +259,7 @@ void SVGPaintServerGradient::teardown(GraphicsContext*& context, const RenderObj m_gradient->setGradientSpaceTransform(matrix); context->setFillGradient(m_gradient); - FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->relativeBBox(false); + FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox(); context->fillRect(maskBBox); diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.cpp b/WebCore/svg/graphics/SVGPaintServerPattern.cpp index a2ac5df..74ea27a 100644 --- a/WebCore/svg/graphics/SVGPaintServerPattern.cpp +++ b/WebCore/svg/graphics/SVGPaintServerPattern.cpp @@ -68,9 +68,9 @@ ImageBuffer* SVGPaintServerPattern::tile() const return m_tile.get(); } -void SVGPaintServerPattern::setTile(auto_ptr<ImageBuffer> tile) +void SVGPaintServerPattern::setTile(PassOwnPtr<ImageBuffer> tile) { - m_tile.set(tile.release()); + m_tile = tile; } TransformationMatrix SVGPaintServerPattern::patternTransform() const @@ -97,12 +97,7 @@ TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const { - FloatRect targetRect; - if (isPaintingText) { - IntRect textBoundary = const_cast<RenderObject*>(object)->absoluteBoundingBoxRect(); - targetRect = object->absoluteTransform().inverse().mapRect(textBoundary); - } else - targetRect = object->relativeBBox(false); + FloatRect targetRect = object->objectBoundingBox(); const SVGRenderStyle* style = object->style()->svgStyle(); bool isFilled = (type & ApplyToFillTargetType) && style->hasFill(); @@ -123,7 +118,7 @@ bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* // Draw the first cell of the pattern manually to support overflow="visible" on all platforms. int tileWidth = static_cast<int>(patternBoundaries().width() + 0.5f); int tileHeight = static_cast<int>(patternBoundaries().height() + 0.5f); - std::auto_ptr<ImageBuffer> tileImage = ImageBuffer::create(IntSize(tileWidth, tileHeight), false); + OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(IntSize(tileWidth, tileHeight), false); GraphicsContext* tileImageContext = tileImage->context(); diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.h b/WebCore/svg/graphics/SVGPaintServerPattern.h index 48acd51..253e012 100644 --- a/WebCore/svg/graphics/SVGPaintServerPattern.h +++ b/WebCore/svg/graphics/SVGPaintServerPattern.h @@ -36,6 +36,7 @@ #include <memory> #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -56,7 +57,7 @@ namespace WebCore { FloatRect patternBoundaries() const; ImageBuffer* tile() const; - void setTile(std::auto_ptr<ImageBuffer>); + void setTile(PassOwnPtr<ImageBuffer>); TransformationMatrix patternTransform() const; void setPatternTransform(const TransformationMatrix&); diff --git a/WebCore/svg/graphics/SVGResourceFilter.cpp b/WebCore/svg/graphics/SVGResourceFilter.cpp index 8fb2dfa..6c1dccb 100644 --- a/WebCore/svg/graphics/SVGResourceFilter.cpp +++ b/WebCore/svg/graphics/SVGResourceFilter.cpp @@ -2,6 +2,7 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -21,64 +22,97 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGResourceFilter.h" +#include "FilterEffect.h" +#include "GraphicsContext.h" +#include "ImageBuffer.h" +#include "PlatformString.h" +#include "SVGFilter.h" +#include "SVGFilterBuilder.h" #include "SVGRenderTreeAsText.h" -#include "SVGFilterEffect.h" +#include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { SVGResourceFilter::SVGResourceFilter() - : m_platformData(createPlatformData()) - , m_filterBBoxMode(false) + : m_filterBBoxMode(false) , m_effectBBoxMode(false) , m_xBBoxMode(false) , m_yBBoxMode(false) + , m_savedContext(0) + , m_sourceGraphicBuffer(0) { + m_filterBuilder.set(new SVGFilterBuilder()); } -void SVGResourceFilter::clearEffects() +void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect) { - m_effects.clear(); + effectAttributes->setStandardAttributes(this, effect.get()); + builder()->add(effectAttributes->result(), effect); } -void SVGResourceFilter::addFilterEffect(SVGFilterEffect* effect) +FloatRect SVGResourceFilter::filterBBoxForItemBBox(const FloatRect& itemBBox) const { - ASSERT(effect); + FloatRect filterBBox = filterRect(); - if (effect) { - ASSERT(effect->filter() == this); - m_effects.append(effect); - } + if (filterBoundingBoxMode()) + filterBBox = FloatRect(itemBBox.x() + filterBBox.x() * itemBBox.width(), + itemBBox.y() + filterBBox.y() * itemBBox.height(), + filterBBox.width() * itemBBox.width(), + filterBBox.height() * itemBBox.height()); + + return filterBBox; } -FloatRect SVGResourceFilter::filterBBoxForItemBBox(const FloatRect& itemBBox) const +void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const FloatRect& itemRect) { - FloatRect filterBBox = filterRect(); + // Draw the content of the current element and it's childs to a imageBuffer to get the SourceGraphic. + // The size of the SourceGraphic must match the size of the element, the filter is aplied to. + IntSize bufferSize = IntSize(itemRect.width(), itemRect.height()); + OwnPtr<ImageBuffer> sourceGraphic(ImageBuffer::create(bufferSize, false)); + + if (!sourceGraphic.get()) + return; + + GraphicsContext* sourceGraphicContext = sourceGraphic->context(); + sourceGraphicContext->translate(-itemRect.x(), -itemRect.y()); + sourceGraphicContext->clearRect(FloatRect(0, 0, itemRect.width(), itemRect.height())); + m_sourceGraphicBuffer.set(sourceGraphic.release()); + m_savedContext = context; + + context = sourceGraphicContext; +} - float xOffset = 0.0f; - float yOffset = 0.0f; +void SVGResourceFilter::applyFilter(GraphicsContext*& context, const FloatRect& itemRect) +{ + if (!m_savedContext) + return; - if (!effectBoundingBoxMode()) { - xOffset = itemBBox.x(); - yOffset = itemBBox.y(); - } + FloatRect filterRect = filterBBoxForItemBBox(itemRect); - if (filterBoundingBoxMode()) { - filterBBox = FloatRect(xOffset + filterBBox.x() * itemBBox.width(), - yOffset + filterBBox.y() * itemBBox.height(), - filterBBox.width() * itemBBox.width(), - filterBBox.height() * itemBBox.height()); - } else { - if (xBoundingBoxMode()) - filterBBox.setX(xOffset + filterBBox.x()); + setFilterBoundingBox(filterRect); + setItemBoundingBox(itemRect); + + context = m_savedContext; + m_savedContext = 0; - if (yBoundingBoxMode()) - filterBBox.setY(yOffset + filterBBox.y()); + FilterEffect* lastEffect = m_filterBuilder->lastEffect(); + + if (lastEffect && !filterRect.isEmpty()) { + RefPtr<Filter> filter = SVGFilter::create(m_itemBBox, m_filterBBox, m_effectBBoxMode, m_filterBBoxMode); + filter->setSourceImage(m_sourceGraphicBuffer->image()); + lastEffect->apply(filter.get()); + + context->clip(filterRect); + + if (lastEffect->resultImage()) + context->drawImage(lastEffect->resultImage()->image(), + lastEffect->subRegion()); } - return filterBBox; + m_sourceGraphicBuffer.clear(); } TextStream& SVGResourceFilter::externalRepresentation(TextStream& ts) const @@ -102,8 +136,6 @@ TextStream& SVGResourceFilter::externalRepresentation(TextStream& ts) const ts << " [bounding box mode=" << filterBoundingBoxMode() << "]"; if (effectBoundingBoxMode()) // default is false ts << " [effect bounding box mode=" << effectBoundingBoxMode() << "]"; - if (m_effects.size() > 0) - ts << " [effects=" << m_effects << "]"; return ts; } diff --git a/WebCore/svg/graphics/SVGResourceFilter.h b/WebCore/svg/graphics/SVGResourceFilter.h index 646c732..d081b6b 100644 --- a/WebCore/svg/graphics/SVGResourceFilter.h +++ b/WebCore/svg/graphics/SVGResourceFilter.h @@ -2,6 +2,7 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -22,23 +23,25 @@ #ifndef SVGResourceFilter_h #define SVGResourceFilter_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGResource.h" -#include "SVGFilterEffect.h" +#include "Image.h" +#include "ImageBuffer.h" #include "FloatRect.h" +#include "SVGFilterPrimitiveStandardAttributes.h" #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> namespace WebCore { +class Filter; +class FilterEffect; class GraphicsContext; -class SVGFilterEffect; - -class SVGResourceFilterPlatformData { -public: - virtual ~SVGResourceFilterPlatformData() {} -}; +class SVGFilterBuilder; +class SVGFilterPrimitiveStandardAttributes; class SVGResourceFilter : public SVGResource { public: @@ -61,24 +64,24 @@ public: FloatRect filterRect() const { return m_filterRect; } void setFilterRect(const FloatRect& rect) { m_filterRect = rect; } - FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const; + FloatRect filterBoundingBox() { return m_filterBBox; } + void setFilterBoundingBox(const FloatRect& rect) { m_filterBBox = rect; } + + FloatRect itemBoundingBox() { return m_itemBBox; } + void setItemBoundingBox(const FloatRect& rect) { m_itemBBox = rect; } - void clearEffects(); - void addFilterEffect(SVGFilterEffect*); + FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const; virtual TextStream& externalRepresentation(TextStream&) const; - // To be implemented in platform specific code. - void prepareFilter(GraphicsContext*&, const FloatRect& bbox); - void applyFilter(GraphicsContext*&, const FloatRect& bbox); - - SVGResourceFilterPlatformData* platformData() { return m_platformData.get(); } - const Vector<SVGFilterEffect*>& effects() { return m_effects; } + void prepareFilter(GraphicsContext*&, const FloatRect&); + void applyFilter(GraphicsContext*&, const FloatRect&); + + void addFilterEffect(SVGFilterPrimitiveStandardAttributes*, PassRefPtr<FilterEffect>); + + SVGFilterBuilder* builder() { return m_filterBuilder.get(); } private: - SVGResourceFilterPlatformData* createPlatformData(); - - OwnPtr<SVGResourceFilterPlatformData> m_platformData; bool m_filterBBoxMode : 1; bool m_effectBBoxMode : 1; @@ -87,7 +90,13 @@ private: bool m_yBBoxMode : 1; FloatRect m_filterRect; - Vector<SVGFilterEffect*> m_effects; + + FloatRect m_filterBBox; + FloatRect m_itemBBox; + + OwnPtr<SVGFilterBuilder> m_filterBuilder; + GraphicsContext* m_savedContext; + OwnPtr<ImageBuffer> m_sourceGraphicBuffer; }; SVGResourceFilter* getFilterById(Document*, const AtomicString&); diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp index 8642e1e..3c21350 100644 --- a/WebCore/svg/graphics/SVGResourceMasker.cpp +++ b/WebCore/svg/graphics/SVGResourceMasker.cpp @@ -63,7 +63,7 @@ void SVGResourceMasker::invalidate() void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& boundingBox) { if (!m_mask) - m_mask.set(m_ownerElement->drawMaskerContent(boundingBox, m_maskRect).release()); + m_mask = m_ownerElement->drawMaskerContent(boundingBox, m_maskRect); if (!m_mask) return; @@ -72,8 +72,8 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou IntRect intImageRect(0, 0, imageSize.width(), imageSize.height()); // Create new ImageBuffer to apply luminance - auto_ptr<ImageBuffer> luminancedImage(ImageBuffer::create(imageSize, false)); - if (!luminancedImage.get()) + OwnPtr<ImageBuffer> luminancedImage = ImageBuffer::create(imageSize, false); + if (!luminancedImage) return; PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getImageData(intImageRect)->data()); diff --git a/WebCore/svg/graphics/filters/SVGDistantLightSource.h b/WebCore/svg/graphics/filters/SVGDistantLightSource.h index 25c2045..07ac16c 100644 --- a/WebCore/svg/graphics/filters/SVGDistantLightSource.h +++ b/WebCore/svg/graphics/filters/SVGDistantLightSource.h @@ -23,7 +23,7 @@ #ifndef SVGDistantLightSource_h #define SVGDistantLightSource_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGLightSource.h" namespace WebCore { @@ -48,6 +48,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGDistantLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp index 4b82e5a..5197215 100644 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp +++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp @@ -21,8 +21,9 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEConvolveMatrix.h" +#include "Filter.h" #include "SVGRenderTreeAsText.h" namespace WebCore { @@ -133,7 +134,7 @@ void FEConvolveMatrix::setPreserveAlpha(bool preserveAlpha) m_preserveAlpha = preserveAlpha; } -void FEConvolveMatrix::apply() +void FEConvolveMatrix::apply(Filter*) { } @@ -174,4 +175,4 @@ TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts) const }; // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h index c3eea2b..9b3b33f 100644 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h +++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h @@ -22,11 +22,11 @@ #ifndef SVGFEConvolveMatrix_h #define SVGFEConvolveMatrix_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" #include "FloatPoint.h" #include "FloatSize.h" - +#include "Filter.h" #include <wtf/Vector.h> namespace WebCore { @@ -68,8 +68,8 @@ namespace WebCore { bool preserveAlpha() const; void setPreserveAlpha(bool); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -90,6 +90,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEConvolveMatrix_h diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp index 6399c5e..c536478 100644 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp +++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp @@ -21,10 +21,11 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGLightSource.h" #include "SVGFEDiffuseLighting.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -112,7 +113,7 @@ void FEDiffuseLighting::setLightSource(LightSource* lightSource) m_lightSource = lightSource; } -void FEDiffuseLighting::apply() +void FEDiffuseLighting::apply(Filter*) { } @@ -132,4 +133,4 @@ TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h index a817ce2..f4b4dad 100644 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h +++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h @@ -22,9 +22,10 @@ #ifndef SVGFEDiffuseLighting_h #define SVGFEDiffuseLighting_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "Color.h" #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -54,8 +55,8 @@ namespace WebCore { const LightSource* lightSource() const; void setLightSource(LightSource*); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -73,6 +74,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEDiffuseLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp index f7996e3..abb57ee 100644 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp +++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDisplacementMap.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -74,7 +75,7 @@ void FEDisplacementMap::setScale(float scale) m_scale = scale; } -void FEDisplacementMap::apply() +void FEDisplacementMap::apply(Filter*) { } @@ -113,4 +114,4 @@ TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h index 0218d57..1fd6db9 100644 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h +++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h @@ -22,9 +22,10 @@ #ifndef SVGFEDisplacementMap_h #define SVGFEDisplacementMap_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "PlatformString.h" #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -50,8 +51,8 @@ namespace WebCore { float scale() const; void setScale(float scale); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -67,6 +68,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEDisplacementMap_h diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/svg/graphics/filters/SVGFEFlood.cpp index 3d52f63..9bdb8ca 100644 --- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp +++ b/WebCore/svg/graphics/filters/SVGFEFlood.cpp @@ -21,22 +21,24 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEFlood.h" +#include "Filter.h" #include "SVGRenderTreeAsText.h" namespace WebCore { -FEFlood::FEFlood(const Color& floodColor, const float& floodOpacity) +FEFlood::FEFlood(FilterEffect* in, const Color& floodColor, const float& floodOpacity) : FilterEffect() + , m_in(in) , m_floodColor(floodColor) , m_floodOpacity(floodOpacity) { } -PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float& floodOpacity) +PassRefPtr<FEFlood> FEFlood::create(FilterEffect* in, const Color& floodColor, const float& floodOpacity) { - return adoptRef(new FEFlood(floodColor, floodOpacity)); + return adoptRef(new FEFlood(in, floodColor, floodOpacity)); } Color FEFlood::floodColor() const @@ -59,7 +61,7 @@ void FEFlood::setFloodOpacity(float floodOpacity) m_floodOpacity = floodOpacity; } -void FEFlood::apply() +void FEFlood::apply(Filter*) { } @@ -78,4 +80,4 @@ TextStream& FEFlood::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.h b/WebCore/svg/graphics/filters/SVGFEFlood.h index 0558774..21985db 100644 --- a/WebCore/svg/graphics/filters/SVGFEFlood.h +++ b/WebCore/svg/graphics/filters/SVGFEFlood.h @@ -22,15 +22,16 @@ #ifndef SVGFEFlood_h #define SVGFEFlood_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "Color.h" +#include "Filter.h" #include "FilterEffect.h" namespace WebCore { class FEFlood : public FilterEffect { public: - static PassRefPtr<FEFlood> create(const Color&, const float&); + static PassRefPtr<FEFlood> create(FilterEffect*, const Color&, const float&); Color floodColor() const; void setFloodColor(const Color &); @@ -38,19 +39,20 @@ namespace WebCore { float floodOpacity() const; void setFloodOpacity(float); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: - FEFlood(const Color&, const float&); + FEFlood(FilterEffect*, const Color&, const float&); + RefPtr<FilterEffect> m_in; Color m_floodColor; float m_floodOpacity; }; } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEFlood_h diff --git a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp index 4e64c58..601c39e 100644 --- a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp +++ b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEGaussianBlur.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -60,7 +61,7 @@ void FEGaussianBlur::setStdDeviationY(float y) m_y = y; } -void FEGaussianBlur::apply() +void FEGaussianBlur::apply(Filter*) { } @@ -78,4 +79,4 @@ TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h index 33ad0c7..a377f89 100644 --- a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h +++ b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h @@ -22,8 +22,9 @@ #ifndef SVGFEGaussianBlur_h #define SVGFEGaussianBlur_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -37,8 +38,8 @@ namespace WebCore { float stdDeviationY() const; void setStdDeviationY(float); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -51,6 +52,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEGaussianBlur_h diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp index 2bf83be..a01ad3b 100644 --- a/WebCore/svg/graphics/filters/SVGFEImage.cpp +++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEImage.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -63,7 +64,7 @@ void FEImage::setCachedImage(CachedImage* image) m_cachedImage->addClient(this); } -void FEImage::apply() +void FEImage::apply(Filter*) { } @@ -81,4 +82,4 @@ TextStream& FEImage::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEImage.h b/WebCore/svg/graphics/filters/SVGFEImage.h index fcf413f..3fdc26a 100644 --- a/WebCore/svg/graphics/filters/SVGFEImage.h +++ b/WebCore/svg/graphics/filters/SVGFEImage.h @@ -22,11 +22,12 @@ #ifndef SVGFEImage_h #define SVGFEImage_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "CachedImage.h" #include "CachedResourceClient.h" #include "CachedResourceHandle.h" #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -41,8 +42,8 @@ namespace WebCore { CachedImage* cachedImage() const; void setCachedImage(CachedImage*); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -53,6 +54,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEImage_h diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp index 8ce15a7..7f12c4c 100644 --- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp +++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMerge.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -48,7 +49,7 @@ void FEMerge::setMergeInputs(const Vector<FilterEffect*>& mergeInputs) m_mergeInputs = mergeInputs; } -void FEMerge::apply() +void FEMerge::apply(Filter*) { } @@ -75,4 +76,4 @@ TextStream& FEMerge::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/svg/graphics/filters/SVGFEMerge.h index 6415c9f..e41e554 100644 --- a/WebCore/svg/graphics/filters/SVGFEMerge.h +++ b/WebCore/svg/graphics/filters/SVGFEMerge.h @@ -22,9 +22,9 @@ #ifndef SVGFEMerge_h #define SVGFEMerge_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" - +#include "Filter.h" #include <wtf/Vector.h> namespace WebCore { @@ -36,8 +36,8 @@ namespace WebCore { const Vector<FilterEffect*>& mergeInputs() const; void setMergeInputs(const Vector<FilterEffect*>& mergeInputs); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -48,6 +48,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEMerge_h diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp index 7838a8c..3767734 100644 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp +++ b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMorphology.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -71,7 +72,7 @@ void FEMorphology::setRadiusY(float radiusY) m_radiusY = radiusY; } -void FEMorphology::apply() +void FEMorphology::apply(Filter*) { } @@ -104,4 +105,4 @@ TextStream& FEMorphology::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h index 98ab633..1db8bc4 100644 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.h +++ b/WebCore/svg/graphics/filters/SVGFEMorphology.h @@ -22,8 +22,9 @@ #ifndef SVGFEMorphology_h #define SVGFEMorphology_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -45,8 +46,8 @@ namespace WebCore { float radiusY() const; void setRadiusY(float); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -60,6 +61,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEMorphology_h diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp index c2a0fc9..63775fb 100644 --- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp +++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEOffset.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -60,7 +61,7 @@ void FEOffset::setDy(float dy) m_dy = dy; } -void FEOffset::apply() +void FEOffset::apply(Filter*) { } @@ -78,4 +79,4 @@ TextStream& FEOffset::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/svg/graphics/filters/SVGFEOffset.h index 86128da..93bdde9 100644 --- a/WebCore/svg/graphics/filters/SVGFEOffset.h +++ b/WebCore/svg/graphics/filters/SVGFEOffset.h @@ -22,8 +22,9 @@ #ifndef SVGFEOffset_h #define SVGFEOffset_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -37,8 +38,8 @@ namespace WebCore { float dy() const; void setDy(float); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -51,6 +52,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFEOffset_h diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp index e3446ed..eb0c280 100644 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp +++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFESpecularLighting.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -124,7 +125,7 @@ void FESpecularLighting::setLightSource(LightSource* lightSource) m_lightSource = lightSource; } -void FESpecularLighting::apply() +void FESpecularLighting::apply(Filter*) { } @@ -144,4 +145,4 @@ TextStream& FESpecularLighting::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h index e1c1930..4efff93 100644 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h +++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h @@ -22,10 +22,11 @@ #ifndef SVGFESpecularLighting_h #define SVGFESpecularLighting_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "Color.h" -#include "SVGLightSource.h" #include "FilterEffect.h" +#include "SVGLightSource.h" +#include "Filter.h" namespace WebCore { @@ -56,8 +57,8 @@ namespace WebCore { const LightSource* lightSource() const; void setLightSource(LightSource*); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -76,6 +77,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFESpecularLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp index 773a5cd..fecd105 100644 --- a/WebCore/svg/graphics/filters/SVGFETile.cpp +++ b/WebCore/svg/graphics/filters/SVGFETile.cpp @@ -19,9 +19,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETile.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -36,7 +37,7 @@ PassRefPtr<FETile> FETile::create(FilterEffect* in) return adoptRef(new FETile(in)); } -void FETile::apply() +void FETile::apply(Filter*) { } @@ -53,5 +54,5 @@ TextStream& FETile::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/svg/graphics/filters/SVGFETile.h index 986f6fd..f1e8d1a 100644 --- a/WebCore/svg/graphics/filters/SVGFETile.h +++ b/WebCore/svg/graphics/filters/SVGFETile.h @@ -22,8 +22,9 @@ #ifndef SVGFETile_h #define SVGFETile_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -31,8 +32,8 @@ namespace WebCore { public: static PassRefPtr<FETile> create(FilterEffect*); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -43,6 +44,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFETile_h diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp index 9731c49..542c576 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp @@ -21,9 +21,10 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETurbulence.h" #include "SVGRenderTreeAsText.h" +#include "Filter.h" namespace WebCore { @@ -105,7 +106,7 @@ void FETurbulence::setStitchTiles(bool stitch) m_stitchTiles = stitch; } -void FETurbulence::apply() +void FETurbulence::apply(Filter*) { } @@ -142,4 +143,4 @@ TextStream& FETurbulence::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/svg/graphics/filters/SVGFETurbulence.h index 6977460..e7f40f6 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.h +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.h @@ -22,8 +22,9 @@ #ifndef SVGFETurbulence_h #define SVGFETurbulence_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FilterEffect.h" +#include "Filter.h" namespace WebCore { @@ -56,8 +57,8 @@ namespace WebCore { bool stitchTiles() const; void setStitchTiles(bool); - virtual void apply(); - virtual void dump(); + void apply(Filter*); + void dump(); TextStream& externalRepresentation(TextStream& ts) const; private: @@ -74,6 +75,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGFETurbulence_h diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp new file mode 100644 index 0000000..71c00eb --- /dev/null +++ b/WebCore/svg/graphics/filters/SVGFilter.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * aint with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGFilter.h" + +namespace WebCore { + +SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode) + : Filter() + , m_itemBox(itemBox) + , m_filterRect(filterRect) + , m_effectBBoxMode(effectBBoxMode) + , m_filterBBoxMode(filterBBoxMode) +{ +} + +void SVGFilter::calculateEffectSubRegion(FilterEffect*) +{ +} + +PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode) +{ + return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode, filterBBoxMode)); +} + +} // namespace WebCore + +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFilter.h b/WebCore/svg/graphics/filters/SVGFilter.h new file mode 100644 index 0000000..95b3414 --- /dev/null +++ b/WebCore/svg/graphics/filters/SVGFilter.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * aint with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef SVGFilter_h +#define SVGFilter_h + +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "Filter.h" +#include "FilterEffect.h" +#include "FloatRect.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + + class SVGFilter : public Filter { + public: + static PassRefPtr<SVGFilter> create(const FloatRect&, const FloatRect&, bool, bool); + + void calculateEffectSubRegion(FilterEffect*); + + private: + SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool itemBBoxMode, bool filterBBoxMode); + + FloatRect m_itemBox; + FloatRect m_filterRect; + bool m_effectBBoxMode; + bool m_filterBBoxMode; + }; + +} // namespace WebCore + +#endif // ENABLE(SVG) && ENABLE(FILTERS) + +#endif // SVGFilter_h diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp new file mode 100644 index 0000000..67668d6 --- /dev/null +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp @@ -0,0 +1,79 @@ + +/* + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * aint with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGFilterBuilder.h" + +#include "FilterEffect.h" +#include "PlatformString.h" +#include "SourceAlpha.h" +#include "SourceGraphic.h" + +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +SVGFilterBuilder::SVGFilterBuilder() +{ + m_builtinEffects.add(SourceGraphic::effectName(), SourceGraphic::create()); + m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create()); +} + +void SVGFilterBuilder::add(const AtomicString& id, RefPtr<FilterEffect> effect) +{ + if (id.isEmpty()) { + m_lastEffect = effect.get(); + return; + } + + if (m_builtinEffects.contains(id)) + return; + + m_lastEffect = effect.get(); + m_namedEffects.set(id, m_lastEffect); +} + +FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const +{ + if (id.isEmpty()) { + if (m_lastEffect) + return m_lastEffect.get(); + + return m_builtinEffects.get(SourceGraphic::effectName()).get(); + } + + if (m_builtinEffects.contains(id)) + return m_builtinEffects.get(id).get(); + + return m_namedEffects.get(id).get(); +} + +void SVGFilterBuilder::clearEffects() +{ + m_lastEffect = 0; + m_namedEffects.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/FilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h index 630537c..55844c9 100644 --- a/WebCore/svg/FilterBuilder.h +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h @@ -17,35 +17,40 @@ Boston, MA 02110-1301, USA. */ -#ifndef FilterBuilder_h -#define FilterBuilder_h +#ifndef SVGFilterBuilder_h +#define SVGFilterBuilder_h #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "PlatformString.h" +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "AtomicStringHash.h" #include "FilterEffect.h" -#include "Filter.h" +#include "PlatformString.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> namespace WebCore { - class FilterBuilder : public RefCounted<FilterBuilder> { + class SVGFilterBuilder : public RefCounted<SVGFilterBuilder> { public: - void add(const String& id, PassRefPtr<FilterEffect> effect) { m_namedEffects.set(id.impl(), effect); } - FilterEffect* getEffectById(const String& id) const { return m_namedEffects.get(id.impl()).get(); } - - PassRefPtr<Filter> filter() const { return m_filter; } - + SVGFilterBuilder(); + + void add(const AtomicString& id, RefPtr<FilterEffect> effect); + + FilterEffect* getEffectById(const AtomicString& id) const; + FilterEffect* lastEffect() const { return m_lastEffect.get(); } + + void clearEffects(); + private: - HashMap<StringImpl*, RefPtr<FilterEffect> > m_namedEffects; - - RefPtr<Filter> m_filter; + HashMap<AtomicString, RefPtr<FilterEffect> > m_builtinEffects; + HashMap<AtomicString, RefPtr<FilterEffect> > m_namedEffects; + + RefPtr<FilterEffect> m_lastEffect; }; } //namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif diff --git a/WebCore/svg/graphics/filters/SVGFilterEffect.cpp b/WebCore/svg/graphics/filters/SVGFilterEffect.cpp deleted file mode 100644 index f8e246f..0000000 --- a/WebCore/svg/graphics/filters/SVGFilterEffect.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFilterEffect.h" - -#include "SVGRenderTreeAsText.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGFilterEffect::SVGFilterEffect(SVGResourceFilter* filter) - : m_filter(filter) - , m_xBBoxMode(false) - , m_yBBoxMode(false) - , m_widthBBoxMode(false) - , m_heightBBoxMode(false) -{ -} - -FloatRect SVGFilterEffect::primitiveBBoxForFilterBBox(const FloatRect& filterBBox, const FloatRect& itemBBox) const -{ - FloatRect subRegionBBox = subRegion(); - FloatRect useBBox = filterBBox; - - ASSERT(m_filter); - if (!m_filter) - return FloatRect(); - - if (m_filter->effectBoundingBoxMode()) { - if (!m_filter->filterBoundingBoxMode()) - useBBox = itemBBox; - - subRegionBBox = FloatRect(useBBox.x() + subRegionBBox.x() * useBBox.width(), - useBBox.y() + subRegionBBox.y() * useBBox.height(), - subRegionBBox.width() * useBBox.width(), - subRegionBBox.height() * useBBox.height()); - } else { - if (xBoundingBoxMode()) - subRegionBBox.setX(useBBox.x() + subRegionBBox.x() * useBBox.width()); - - if (yBoundingBoxMode()) - subRegionBBox.setY(useBBox.y() + subRegionBBox.y() * useBBox.height()); - - if (widthBoundingBoxMode()) - subRegionBBox.setWidth(subRegionBBox.width() * useBBox.width()); - - if (heightBoundingBoxMode()) - subRegionBBox.setHeight(subRegionBBox.height() * useBBox.height()); - } - - return subRegionBBox; -} - -FloatRect SVGFilterEffect::subRegion() const -{ - return m_subRegion; -} - -void SVGFilterEffect::setSubRegion(const FloatRect& subRegion) -{ - m_subRegion = subRegion; -} - -String SVGFilterEffect::in() const -{ - return m_in; -} - -void SVGFilterEffect::setIn(const String& in) -{ - m_in = in; -} - -String SVGFilterEffect::result() const -{ - return m_result; -} - -void SVGFilterEffect::setResult(const String& result) -{ - m_result = result; -} - -SVGResourceFilter* SVGFilterEffect::filter() const -{ - return m_filter; -} - -void SVGFilterEffect::setFilter(SVGResourceFilter* filter) -{ - m_filter = filter; -} - -TextStream& SVGFilterEffect::externalRepresentation(TextStream& ts) const -{ - if (!in().isEmpty()) - ts << "[in=\"" << in() << "\"]"; - if (!result().isEmpty()) - ts << " [result=\"" << result() << "\"]"; - if (!subRegion().isEmpty()) - ts << " [subregion=\"" << subRegion() << "\"]"; - return ts; -} - -TextStream& operator<<(TextStream& ts, const SVGFilterEffect& e) -{ - return e.externalRepresentation(ts); -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFilterEffect.h b/WebCore/svg/graphics/filters/SVGFilterEffect.h deleted file mode 100644 index d497f8b..0000000 --- a/WebCore/svg/graphics/filters/SVGFilterEffect.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFilterEffect_h -#define SVGFilterEffect_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FloatRect.h" -#include "PlatformString.h" - -#if PLATFORM(CI) -#ifdef __OBJC__ -@class CIFilter; -#else -class CIFilter; -#endif -#endif - -namespace WebCore { - -class SVGResourceFilter; -class TextStream; - -class SVGFilterEffect : public RefCounted<SVGFilterEffect> { -public: - SVGFilterEffect(SVGResourceFilter*); - virtual ~SVGFilterEffect() { } - - bool xBoundingBoxMode() const { return m_xBBoxMode; } - void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; } - - bool yBoundingBoxMode() const { return m_yBBoxMode; } - void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; } - - bool widthBoundingBoxMode() const { return m_widthBBoxMode; } - void setWidthBoundingBoxMode(bool bboxMode) { m_widthBBoxMode = bboxMode; } - - bool heightBoundingBoxMode() const { return m_heightBBoxMode; } - void setHeightBoundingBoxMode(bool bboxMode) { m_heightBBoxMode = bboxMode; } - - FloatRect primitiveBBoxForFilterBBox(const FloatRect& filterBBox, const FloatRect& itemBBox) const; - - FloatRect subRegion() const; - void setSubRegion(const FloatRect&); - - String in() const; - void setIn(const String&); - - String result() const; - void setResult(const String&); - - SVGResourceFilter* filter() const; - void setFilter(SVGResourceFilter*); - - virtual TextStream& externalRepresentation(TextStream&) const; - -#if PLATFORM(CI) - virtual CIFilter* getCIFilter(const FloatRect& bbox) const; -#endif - -private: - SVGResourceFilter* m_filter; - - bool m_xBBoxMode : 1; - bool m_yBBoxMode : 1; - bool m_widthBBoxMode : 1; - bool m_heightBBoxMode : 1; - - FloatRect m_subRegion; - - String m_in; - String m_result; -}; - -TextStream& operator<<(TextStream&, const SVGFilterEffect&); - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFilterEffect_h diff --git a/WebCore/svg/graphics/filters/SVGLightSource.cpp b/WebCore/svg/graphics/filters/SVGLightSource.cpp index 77611ca..9176b4c 100644 --- a/WebCore/svg/graphics/filters/SVGLightSource.cpp +++ b/WebCore/svg/graphics/filters/SVGLightSource.cpp @@ -21,7 +21,7 @@ #include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGPointLightSource.h" #include "SVGRenderTreeAsText.h" #include "SVGSpotLightSource.h" @@ -62,4 +62,4 @@ TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGLightSource.h b/WebCore/svg/graphics/filters/SVGLightSource.h index 779e147..22b43c8 100644 --- a/WebCore/svg/graphics/filters/SVGLightSource.h +++ b/WebCore/svg/graphics/filters/SVGLightSource.h @@ -23,7 +23,7 @@ #ifndef SVGLightSource_h #define SVGLightSource_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include <wtf/RefCounted.h> namespace WebCore { @@ -53,6 +53,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGPointLightSource.h b/WebCore/svg/graphics/filters/SVGPointLightSource.h index 099a165..772e278 100644 --- a/WebCore/svg/graphics/filters/SVGPointLightSource.h +++ b/WebCore/svg/graphics/filters/SVGPointLightSource.h @@ -23,7 +23,7 @@ #ifndef SVGPointLightSource_h #define SVGPointLightSource_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FloatPoint3D.h" #include "SVGLightSource.h" @@ -46,6 +46,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGPointLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGSpotLightSource.h b/WebCore/svg/graphics/filters/SVGSpotLightSource.h index a4aa1fb..9a787fb 100644 --- a/WebCore/svg/graphics/filters/SVGSpotLightSource.h +++ b/WebCore/svg/graphics/filters/SVGSpotLightSource.h @@ -23,7 +23,7 @@ #ifndef SVGSpotLightSource_h #define SVGSpotLightSource_h -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) +#if ENABLE(SVG) && ENABLE(FILTERS) #include "FloatPoint3D.h" #include "SVGLightSource.h" @@ -57,6 +57,6 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif // SVGSpotLightSource_h diff --git a/WebCore/svg/svgtags.in b/WebCore/svg/svgtags.in index fe19f3d..6ac430d 100644 --- a/WebCore/svg/svgtags.in +++ b/WebCore/svg/svgtags.in @@ -30,7 +30,7 @@ definition_src defs desc ellipse -#if ENABLE_SVG_FILTERS +#if ENABLE_FILTERS feBlend feColorMatrix feComponentTransfer |