+2006-10-20 Rob Buis <buis@kde.org>
+
+ Reviewed by Mitz.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11217
+ Cleanup svg coding style
+
+ Cleanup coding style in svg clipping and painting classes.
+
+ * ksvg2/svg/SVGClipPathElement.cpp:
+ (WebCore::SVGClipPathElement::parseMappedAttribute):
+ (WebCore::SVGClipPathElement::canvasResource):
+ * ksvg2/svg/SVGClipPathElement.h:
+ * ksvg2/svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::SVGMarkerElement):
+ (WebCore::SVGMarkerElement::parseMappedAttribute):
+ (WebCore::SVGMarkerElement::setOrientToAngle):
+ (WebCore::SVGMarkerElement::canvasResource):
+ * ksvg2/svg/SVGMarkerElement.h:
+ (WebCore::SVGMarkerElement::rendererIsNeeded):
+ * ksvg2/svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::SVGMaskElement):
+ (WebCore::SVGMaskElement::parseMappedAttribute):
+ (WebCore::SVGMaskElement::drawMaskerContent):
+ (WebCore::SVGMaskElement::canvasResource):
+ * ksvg2/svg/SVGMaskElement.h:
+ (WebCore::SVGMaskElement::rendererIsNeeded):
+ * ksvg2/svg/SVGPaint.cpp:
+ (WebCore::SVGPaint::setPaint):
+ (WebCore::SVGPaint::cssText):
+ * ksvg2/svg/SVGPaint.h:
+
2006-10-20 David Hyatt <hyatt@apple.com>
Make sure to do the code that checks the repeatInterval before the timer has been
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
#ifdef SVG_SUPPORT
#include "SVGClipPathElement.h"
-#include "Attr.h"
#include "Document.h"
+#include "KRenderingDevice.h"
#include "RenderView.h"
#include "SVGHelper.h"
-#include "SVGNames.h"
#include "SVGMatrix.h"
-#include "SVGRenderStyle.h"
-#include "cssstyleselector.h"
+#include "SVGNames.h"
#include "SVGUnitTypes.h"
-#include <kcanvas/device/KRenderingDevice.h>
+#include "cssstyleselector.h"
-using namespace WebCore;
+namespace WebCore {
-SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document *doc)
+SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document* doc)
: SVGStyledTransformableElement(tagName, doc)
, SVGTests()
, SVGLangSpace()
ANIMATED_PROPERTY_DEFINITIONS(SVGClipPathElement, int, Enumeration, enumeration, ClipPathUnits, clipPathUnits, SVGNames::clipPathUnitsAttr.localName(), m_clipPathUnits)
-void SVGClipPathElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGClipPathElement::parseMappedAttribute(MappedAttribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::clipPathUnitsAttr) {
}
}
-KCanvasClipper *SVGClipPathElement::canvasResource()
+KCanvasClipper* SVGClipPathElement::canvasResource()
{
if (!view())
return 0;
if (!m_clipper)
- m_clipper = static_cast<KCanvasClipper *>(renderingDevice()->createResource(RS_CLIPPER));
+ m_clipper = static_cast<KCanvasClipper*>(renderingDevice()->createResource(RS_CLIPPER));
else
m_clipper->resetClipData();
bool bbox = clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
- RenderStyle *clipPathStyle = styleForRenderer(parent()->renderer()); // FIXME: Manual style resolution is a hack
- for (Node *n = firstChild(); n != 0; n = n->nextSibling()) {
- SVGElement *e = svg_dynamic_cast(n);
+ RenderStyle* clipPathStyle = styleForRenderer(parent()->renderer()); // FIXME: Manual style resolution is a hack
+ for (Node* n = firstChild(); n; n = n->nextSibling()) {
+ SVGElement* e = svg_dynamic_cast(n);
if (e && e->isStyled()) {
- SVGStyledElement *styled = static_cast<SVGStyledElement *>(e);
- RenderStyle *pathStyle = document()->styleSelector()->styleForElement(styled, clipPathStyle);
+ SVGStyledElement* styled = static_cast<SVGStyledElement*>(e);
+ RenderStyle* pathStyle = document()->styleSelector()->styleForElement(styled, clipPathStyle);
Path pathData = styled->toPathData();
if (e->isStyledTransformable())
- pathData.transform(static_cast<SVGStyledTransformableElement *>(e)->localMatrix()->matrix());
+ pathData.transform(static_cast<SVGStyledTransformableElement*>(e)->localMatrix()->matrix());
if (!pathData.isEmpty())
m_clipper->addClipData(pathData, pathStyle->svgStyle()->clipRule(), bbox);
pathStyle->deref(view()->renderArena());
return m_clipper;
}
+}
+
// vim:ts=4:noet
#endif // SVG_SUPPORT
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
#define KSVG_SVGClipPathElementImpl_H
#ifdef SVG_SUPPORT
-#include "SVGTests.h"
+#include "KCanvasClipper.h"
+#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
-#include "SVGExternalResourcesRequired.h"
-
-#include "KCanvasClipper.h"
+#include "SVGTests.h"
namespace WebCore
{
class SVGClipPathElement : public SVGStyledTransformableElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired
{
public:
SVGClipPathElement(const QualifiedName&, Document*);
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual KCanvasClipper *canvasResource();
+ virtual KCanvasClipper* canvasResource();
// 'SVGClipPathElement' functions
- virtual void parseMappedAttribute(MappedAttribute *attr);
+ virtual void parseMappedAttribute(MappedAttribute*);
protected:
virtual const SVGElement* contextElement() const { return this; }
ANIMATED_PROPERTY_DECLARATIONS(SVGClipPathElement, int, int, ClipPathUnits, clipPathUnits)
- KCanvasClipper *m_clipper;
+ KCanvasClipper* m_clipper;
};
} // namespace WebCore
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
#ifdef SVG_SUPPORT
#include "SVGMarkerElement.h"
-#include "Attr.h"
#include "KRenderingDevice.h"
#include "PlatformString.h"
#include "RenderSVGContainer.h"
#include "SVGNames.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGSVGElement.h"
-#include "ksvg.h"
namespace WebCore {
-SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document *doc)
+SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* doc)
: SVGStyledElement(tagName, doc)
, SVGLangSpace()
, SVGExternalResourcesRequired()
delete m_marker;
}
-void SVGMarkerElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::markerUnitsAttr) {
setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO);
}
-void SVGMarkerElement::setOrientToAngle(SVGAngle *angle)
+void SVGMarkerElement::setOrientToAngle(SVGAngle* angle)
{
setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE);
setOrientAngleBaseValue(angle);
}
-KCanvasMarker *SVGMarkerElement::canvasResource()
+KCanvasMarker* SVGMarkerElement::canvasResource()
{
- if(!m_marker)
+ if (!m_marker)
m_marker = static_cast<KCanvasMarker*>(renderingDevice()->createResource(RS_MARKER));
m_marker->setMarker(static_cast<RenderSVGContainer*>(renderer()));
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
class SVGAngle;
class SVGLength;
class SVGMarkerElement : public SVGStyledElement,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGFitToViewBox
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGFitToViewBox
{
public:
enum SVGMarkerUnitsType {
// 'SVGMarkerElement' functions
void setOrientToAuto();
- void setOrientToAngle(SVGAngle *angle);
+ void setOrientToAngle(SVGAngle*);
- virtual void parseMappedAttribute(MappedAttribute *attr);
+ virtual void parseMappedAttribute(MappedAttribute*);
- virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
- virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
- virtual KCanvasMarker *canvasResource();
+ virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual KCanvasMarker* canvasResource();
protected:
virtual const SVGElement* contextElement() const { return this; }
ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, int, int, OrientType, orientType)
ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGAngle*, RefPtr<SVGAngle>, OrientAngle, orientAngle)
- KCanvasMarker *m_marker;
+ KCanvasMarker* m_marker;
};
} // namespace WebCore
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
2005 Alexander Kellett <lypanov@kde.org>
This file is part of the KDE project
#include "SVGMaskElement.h"
#include "GraphicsContext.h"
-#include "RenderSVGContainer.h"
#include "KCanvasImage.h"
#include "KRenderingDevice.h"
-#include "SVGLength.h"
+#include "RenderSVGContainer.h"
#include "SVGHelper.h"
+#include "SVGLength.h"
#include "SVGNames.h"
-#include "SVGRenderStyle.h"
#include "cssstyleselector.h"
-#include "ksvg.h"
-#include "Attr.h"
#include <wtf/OwnPtr.h>
#include <math.h>
namespace WebCore {
-SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document *doc)
+SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* doc)
: SVGStyledLocatableElement(tagName, doc)
, SVGURIReference()
, SVGTests()
SVGStyledLocatableElement::childrenChanged();
}
-void SVGMaskElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGMaskElement::parseMappedAttribute(MappedAttribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::xAttr)
}
}
-KCanvasImage *SVGMaskElement::drawMaskerContent()
+KCanvasImage* SVGMaskElement::drawMaskerContent()
{
- KRenderingDevice *device = renderingDevice();
+ KRenderingDevice* device = renderingDevice();
if (!device->currentContext()) // FIXME: hack for now until Image::lockFocus exists
return 0;
if (!renderer())
return 0;
- KCanvasImage *maskImage = static_cast<KCanvasImage *>(device->createResource(RS_IMAGE));
+ KCanvasImage* maskImage = static_cast<KCanvasImage*>(device->createResource(RS_IMAGE));
IntSize size = IntSize(lroundf(width()->value()), lroundf(height()->value()));
maskImage->init(size);
- KRenderingDeviceContext *patternContext = device->contextForImage(maskImage);
+ KRenderingDeviceContext* patternContext = device->contextForImage(maskImage);
device->pushContext(patternContext);
OwnPtr<GraphicsContext> context(patternContext->createGraphicsContext());
- RenderSVGContainer *maskContainer = static_cast<RenderSVGContainer *>(renderer());
+ RenderSVGContainer* maskContainer = static_cast<RenderSVGContainer*>(renderer());
RenderObject::PaintInfo info(context.get(), IntRect(), PaintPhaseForeground, 0, 0, 0);
maskContainer->setDrawsContents(true);
maskContainer->paint(info, 0, 0);
return maskContainer;
}
-KCanvasMasker *SVGMaskElement::canvasResource()
+KCanvasMasker* SVGMaskElement::canvasResource()
{
if (!m_masker) {
- m_masker = static_cast<KCanvasMasker *>(renderingDevice()->createResource(RS_MASKER));
+ m_masker = static_cast<KCanvasMasker*>(renderingDevice()->createResource(RS_MASKER));
m_dirty = true;
}
if (m_dirty) {
- KCanvasImage *newMaskImage = drawMaskerContent();
+ KCanvasImage* newMaskImage = drawMaskerContent();
m_masker->setMask(newMaskImage);
m_dirty = (newMaskImage != 0);
}
#define SVGMaskElement_H
#ifdef SVG_SUPPORT
-#include "SVGTests.h"
+#include "KCanvasMasker.h"
+#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
-#include "SVGURIReference.h"
#include "SVGStyledLocatableElement.h"
-#include "SVGExternalResourcesRequired.h"
-
-#include "KCanvasMasker.h"
+#include "SVGTests.h"
+#include "SVGURIReference.h"
namespace WebCore
{
class Attribute;
class SVGLength;
class SVGMaskElement : public SVGStyledLocatableElement,
- public SVGURIReference,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired
+ public SVGURIReference,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired
{
public:
SVGMaskElement(const QualifiedName&, Document*);
// 'SVGMaskElement' functions
virtual void childrenChanged();
- virtual void attributeChanged(Attribute* attr, bool preserveDecls);
- virtual void parseMappedAttribute(MappedAttribute *attr);
+ virtual void attributeChanged(Attribute*, bool preserveDecls);
+ virtual void parseMappedAttribute(MappedAttribute*);
- virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
- virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
- virtual KCanvasMasker *canvasResource();
+ virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual KCanvasMasker* canvasResource();
protected:
- KCanvasImage *drawMaskerContent();
+ KCanvasImage* drawMaskerContent();
ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
virtual const SVGElement* contextElement() const { return this; }
private:
- KCanvasMasker *m_masker;
+ KCanvasMasker* m_masker;
bool m_dirty;
};
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
#include "config.h"
#ifdef SVG_SUPPORT
-#include "ksvg.h"
#include "SVGPaint.h"
namespace WebCore {
{
m_paintType = paintType;
- if(m_paintType == SVG_PAINTTYPE_URI)
+ if (m_paintType == SVG_PAINTTYPE_URI)
setUri(uri);
- else if(m_paintType == SVG_PAINTTYPE_RGBCOLOR)
+ else if (m_paintType == SVG_PAINTTYPE_RGBCOLOR)
setRGBColor(rgbPaint);
}
String SVGPaint::cssText() const
{
- if(m_paintType == SVG_PAINTTYPE_NONE)
+ if (m_paintType == SVG_PAINTTYPE_NONE)
return "none";
- else if(m_paintType == SVG_PAINTTYPE_CURRENTCOLOR)
+ else if (m_paintType == SVG_PAINTTYPE_CURRENTCOLOR)
return "currentColor";
- else if(m_paintType == SVG_PAINTTYPE_URI)
+ else if (m_paintType == SVG_PAINTTYPE_URI)
return "url(" + m_uri + ")";
return SVGColor::cssText();
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ 2004, 2005, 2006 Rob Buis <buis@kde.org>
Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
This file is part of the KDE project
#define KSVG_SVGPaintImpl_H
#ifdef SVG_SUPPORT
-#include "ksvg.h"
-#include <SVGColor.h>
+#include "SVGColor.h"
namespace WebCore {