summaryrefslogtreecommitdiffstats
path: root/WebCore/svg
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-18 15:36:45 +0100
committerBen Murdoch <benm@google.com>2009-08-18 19:20:06 +0100
commitd227fc870c7a697500a3c900c31baf05fb9a8524 (patch)
treea3fa109aa5bf52fef562ac49d97a2f723889cc71 /WebCore/svg
parentf2c627513266faa73f7669058d98c60769fb3524 (diff)
downloadexternal_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.zip
external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.gz
external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.bz2
Merge WebKit r47420
Diffstat (limited to 'WebCore/svg')
-rw-r--r--WebCore/svg/SVGColor.cpp4
-rw-r--r--WebCore/svg/SVGColor.h4
-rw-r--r--WebCore/svg/SVGDocument.h10
-rw-r--r--WebCore/svg/SVGElementInstance.cpp5
-rw-r--r--WebCore/svg/SVGElementInstance.h22
-rw-r--r--WebCore/svg/SVGUseElement.cpp14
-rw-r--r--WebCore/svg/graphics/SVGResourceMasker.cpp6
7 files changed, 30 insertions, 35 deletions
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<RGBColor> 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> 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<SVGDocument> 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 <zimmermann@kde.org>
- 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<SVGElement> 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 <zimmermann@kde.org>
- 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 <wtf/RefPtr.h>
-#include <wtf/PassRefPtr.h>
-
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<SVGElementInstance>,
public EventTarget {
public:
- SVGElementInstance(SVGUseElement*, SVGElement* originalElement);
+ static PassRefPtr<SVGElementInstance> create(SVGUseElement* useElement, PassRefPtr<SVGElement> 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<EventListener>, bool useCapture);
virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
@@ -167,6 +161,11 @@ namespace WebCore {
private:
friend class SVGUseElement;
+ SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement);
+
+ virtual Node* toNode() { return shadowTreeElement(); }
+ virtual SVGElementInstance* toSVGElementInstance() { return this; }
+
void appendChild(PassRefPtr<SVGElementInstance> 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<SVGElementInstance> 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<SVGUseElement*>(element), instancePtr, foundProblem);
+ handleDeepUseReferencing(static_cast<SVGUseElement*>(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<SVGElementInstance> 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<CanvasPixelArray> srcPixelArray(m_mask->getImageData(intImageRect)->data());
- PassRefPtr<ImageData> destImageData(luminancedImage->getImageData(intImageRect));
+ PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getUnmultipliedImageData(intImageRect)->data());
+ PassRefPtr<ImageData> 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());
}