From d227fc870c7a697500a3c900c31baf05fb9a8524 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 18 Aug 2009 15:36:45 +0100 Subject: Merge WebKit r47420 --- WebCore/svg/SVGColor.cpp | 4 ++-- WebCore/svg/SVGColor.h | 4 ++-- WebCore/svg/SVGDocument.h | 10 +++++----- WebCore/svg/SVGElementInstance.cpp | 5 +---- WebCore/svg/SVGElementInstance.h | 22 ++++++++++------------ WebCore/svg/SVGUseElement.cpp | 14 +++++++------- WebCore/svg/graphics/SVGResourceMasker.cpp | 6 +++--- 7 files changed, 30 insertions(+), 35 deletions(-) (limited to 'WebCore/svg') diff --git a/WebCore/svg/SVGColor.cpp b/WebCore/svg/SVGColor.cpp index f939ef0..d819ebf 100644 --- a/WebCore/svg/SVGColor.cpp +++ b/WebCore/svg/SVGColor.cpp @@ -62,9 +62,9 @@ unsigned short SVGColor::colorType() const return m_colorType; } -RGBColor* SVGColor::rgbColor() const +PassRefPtr SVGColor::rgbColor() const { - return RGBColor::create(m_color.rgb()).releaseRef(); + return RGBColor::create(m_color.rgb()); } void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec) diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h index 5dfb694..406166b 100644 --- a/WebCore/svg/SVGColor.h +++ b/WebCore/svg/SVGColor.h @@ -57,8 +57,8 @@ namespace WebCore { // 'SVGColor' functions unsigned short colorType() const; - RGBColor* rgbColor() const; - + PassRefPtr rgbColor() const; + static Color colorFromRGBColorString(const String&); void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); } diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h index 02e3649..c7006f9 100644 --- a/WebCore/svg/SVGDocument.h +++ b/WebCore/svg/SVGDocument.h @@ -35,13 +35,11 @@ namespace WebCore { public: static PassRefPtr create(Frame* frame) { - return new SVGDocument(frame); + return adoptRef(new SVGDocument(frame)); } virtual ~SVGDocument(); - virtual bool isSVGDocument() const { return true; } - SVGSVGElement* rootElement() const; void dispatchZoomEvent(float prevScale, float newScale); @@ -52,11 +50,13 @@ namespace WebCore { void startPan(const FloatPoint& start); void updatePan(const FloatPoint& pos) const; - virtual bool childShouldCreateRenderer(Node*) const; - private: SVGDocument(Frame*); + virtual bool isSVGDocument() const { return true; } + + virtual bool childShouldCreateRenderer(Node*) const; + FloatPoint m_translate; }; diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp index 01555fc..3a82067 100644 --- a/WebCore/svg/SVGElementInstance.cpp +++ b/WebCore/svg/SVGElementInstance.cpp @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann - This file is part of the KDE project - 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 @@ -25,7 +23,6 @@ #include "SVGElementInstance.h" #include "ContainerNodeAlgorithms.h" -#include "Document.h" #include "Event.h" #include "EventException.h" #include "EventListener.h" @@ -46,7 +43,7 @@ namespace WebCore { static WTF::RefCountedLeakCounter instanceCounter("WebCoreSVGElementInstance"); #endif -SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, SVGElement* originalElement) +SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, PassRefPtr originalElement) : m_needsUpdate(false) , m_useElement(useElement) , m_element(originalElement) diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h index c477718..048c66c 100644 --- a/WebCore/svg/SVGElementInstance.h +++ b/WebCore/svg/SVGElementInstance.h @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann - This file is part of the KDE project - 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 @@ -27,9 +25,6 @@ #include "SVGElement.h" #include "TreeShared.h" -#include -#include - namespace WebCore { namespace Private { @@ -37,8 +32,6 @@ namespace WebCore { void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); }; - class EventListener; - class Frame; class SVGUseElement; class SVGElementInstanceList; @@ -46,7 +39,11 @@ namespace WebCore { class SVGElementInstance : public TreeShared, public EventTarget { public: - SVGElementInstance(SVGUseElement*, SVGElement* originalElement); + static PassRefPtr create(SVGUseElement* useElement, PassRefPtr originalElement) + { + return adoptRef(new SVGElementInstance(useElement, originalElement)); + } + virtual ~SVGElementInstance(); bool needsUpdate() const { return m_needsUpdate; } @@ -54,9 +51,6 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const; - virtual Node* toNode() { return shadowTreeElement(); } - virtual SVGElementInstance* toSVGElementInstance() { return this; } - virtual void addEventListener(const AtomicString& eventType, PassRefPtr, bool useCapture); virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); virtual bool dispatchEvent(PassRefPtr, ExceptionCode&); @@ -167,6 +161,11 @@ namespace WebCore { private: friend class SVGUseElement; + SVGElementInstance(SVGUseElement*, PassRefPtr originalElement); + + virtual Node* toNode() { return shadowTreeElement(); } + virtual SVGElementInstance* toSVGElementInstance() { return this; } + void appendChild(PassRefPtr child); void setShadowTreeElement(SVGElement*); void forgetWrapper(); @@ -191,7 +190,6 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - private: bool m_needsUpdate : 1; SVGUseElement* m_useElement; diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index b73a692..9cb3024 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -324,7 +324,7 @@ void SVGUseElement::buildPendingResource() // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object // is the SVGRectElement that corresponds to the referenced 'rect' element. - m_targetElementInstance = new SVGElementInstance(this, target); + m_targetElementInstance = SVGElementInstance::create(this, target); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; @@ -474,17 +474,17 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta continue; // Create SVGElementInstance object, for both container/non-container nodes. - SVGElementInstance* instancePtr = new SVGElementInstance(this, element); - targetInstance->appendChild(instancePtr); + RefPtr instancePtr = SVGElementInstance::create(this, element); + targetInstance->appendChild(instancePtr.get()); // Enter recursion, appending new instance tree nodes to the "instance" object. if (element->hasChildNodes()) - buildInstanceTree(element, instancePtr, foundProblem); + buildInstanceTree(element, instancePtr.get(), foundProblem); // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced // object, the instance tree will contain recursive expansion of the indirect references to form a complete tree. if (element->hasTagName(SVGNames::useTag)) - handleDeepUseReferencing(static_cast(element), instancePtr, foundProblem); + handleDeepUseReferencing(static_cast(element), instancePtr.get(), foundProblem); } // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced @@ -524,11 +524,11 @@ void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInsta } // Create an instance object, even if we're dealing with a cycle - SVGElementInstance* newInstance = new SVGElementInstance(this, target); + RefPtr newInstance = SVGElementInstance::create(this, target); targetInstance->appendChild(newInstance); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children - buildInstanceTree(target, newInstance, foundProblem); + buildInstanceTree(target, newInstance.get(), foundProblem); } void SVGUseElement::alterShadowTreeForSVGTag(SVGElement* target) diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp index d6c401b..97467c1 100644 --- a/WebCore/svg/graphics/SVGResourceMasker.cpp +++ b/WebCore/svg/graphics/SVGResourceMasker.cpp @@ -76,8 +76,8 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou if (!luminancedImage) return; - PassRefPtr srcPixelArray(m_mask->getImageData(intImageRect)->data()); - PassRefPtr destImageData(luminancedImage->getImageData(intImageRect)); + PassRefPtr srcPixelArray(m_mask->getUnmultipliedImageData(intImageRect)->data()); + PassRefPtr destImageData(luminancedImage->getUnmultipliedImageData(intImageRect)); for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset++) { unsigned pixelByteOffset = pixelOffset * 4; @@ -93,7 +93,7 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou destImageData->data()->set(pixelByteOffset + 3, luma); } - luminancedImage->putImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); + luminancedImage->putUnmultipliedImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); context->clipToImageBuffer(m_maskRect, luminancedImage.get()); } -- cgit v1.1