summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/svg
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebCore/svg
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/svg')
-rw-r--r--Source/WebCore/svg/PatternAttributes.h25
-rw-r--r--Source/WebCore/svg/SVGDocumentExtensions.h6
-rw-r--r--Source/WebCore/svg/SVGElementRareData.h3
-rw-r--r--Source/WebCore/svg/SVGFEImageElement.cpp1
-rw-r--r--Source/WebCore/svg/SVGFont.cpp1
-rw-r--r--Source/WebCore/svg/SVGFontData.h3
-rw-r--r--Source/WebCore/svg/SVGLocatable.cpp5
-rw-r--r--Source/WebCore/svg/SVGMatrix.h3
-rw-r--r--Source/WebCore/svg/SVGPathBlender.h4
-rw-r--r--Source/WebCore/svg/SVGPathByteStream.h3
-rw-r--r--Source/WebCore/svg/SVGPathConsumer.h5
-rw-r--r--Source/WebCore/svg/SVGPathParser.h4
-rw-r--r--Source/WebCore/svg/SVGPathSource.h4
-rw-r--r--Source/WebCore/svg/SVGPatternElement.cpp6
-rw-r--r--Source/WebCore/svg/SVGSVGElement.cpp9
-rw-r--r--Source/WebCore/svg/SVGStyledTransformableElement.cpp4
-rw-r--r--Source/WebCore/svg/SVGTextElement.cpp4
-rw-r--r--Source/WebCore/svg/SVGTransformList.cpp2
-rw-r--r--Source/WebCore/svg/SVGUseElement.cpp2
-rw-r--r--Source/WebCore/svg/SVGViewSpec.h4
-rw-r--r--Source/WebCore/svg/graphics/SVGImage.cpp3
21 files changed, 72 insertions, 29 deletions
diff --git a/Source/WebCore/svg/PatternAttributes.h b/Source/WebCore/svg/PatternAttributes.h
index 613ab94..28a29c4 100644
--- a/Source/WebCore/svg/PatternAttributes.h
+++ b/Source/WebCore/svg/PatternAttributes.h
@@ -22,6 +22,7 @@
#if ENABLE(SVG)
#include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
namespace WebCore {
@@ -33,6 +34,8 @@ struct PatternAttributes {
, m_y()
, m_width()
, m_height()
+ , m_viewBox()
+ , m_preserveAspectRatio()
, m_boundingBoxMode(true)
, m_boundingBoxModeContent(false)
, m_patternContentElement(0)
@@ -40,6 +43,8 @@ struct PatternAttributes {
, m_ySet(false)
, m_widthSet(false)
, m_heightSet(false)
+ , m_viewBoxSet(false)
+ , m_preserveAspectRatioSet(false)
, m_boundingBoxModeSet(false)
, m_boundingBoxModeContentSet(false)
, m_patternTransformSet(false)
@@ -51,6 +56,8 @@ struct PatternAttributes {
SVGLength y() const { return m_y; }
SVGLength width() const { return m_width; }
SVGLength height() const { return m_height; }
+ FloatRect viewBox() const { return m_viewBox; }
+ SVGPreserveAspectRatio preserveAspectRatio() const { return m_preserveAspectRatio; }
bool boundingBoxMode() const { return m_boundingBoxMode; }
bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
AffineTransform patternTransform() const { return m_patternTransform; }
@@ -79,6 +86,18 @@ struct PatternAttributes {
m_height = value;
m_heightSet = true;
}
+
+ void setViewBox(const FloatRect& value)
+ {
+ m_viewBox = value;
+ m_viewBoxSet = true;
+ }
+
+ void setPreserveAspectRatio(const SVGPreserveAspectRatio& value)
+ {
+ m_preserveAspectRatio = value;
+ m_preserveAspectRatioSet = true;
+ }
void setBoundingBoxMode(bool value)
{
@@ -108,6 +127,8 @@ struct PatternAttributes {
bool hasY() const { return m_ySet; }
bool hasWidth() const { return m_widthSet; }
bool hasHeight() const { return m_heightSet; }
+ bool hasViewBox() const { return m_viewBoxSet; }
+ bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; }
bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
bool hasPatternTransform() const { return m_patternTransformSet; }
@@ -119,6 +140,8 @@ private:
SVGLength m_y;
SVGLength m_width;
SVGLength m_height;
+ FloatRect m_viewBox;
+ SVGPreserveAspectRatio m_preserveAspectRatio;
bool m_boundingBoxMode;
bool m_boundingBoxModeContent;
AffineTransform m_patternTransform;
@@ -129,6 +152,8 @@ private:
bool m_ySet : 1;
bool m_widthSet : 1;
bool m_heightSet : 1;
+ bool m_viewBoxSet : 1;
+ bool m_preserveAspectRatioSet : 1;
bool m_boundingBoxModeSet : 1;
bool m_boundingBoxModeContentSet : 1;
bool m_patternTransformSet : 1;
diff --git a/Source/WebCore/svg/SVGDocumentExtensions.h b/Source/WebCore/svg/SVGDocumentExtensions.h
index a0cf2bb..0ed62a9 100644
--- a/Source/WebCore/svg/SVGDocumentExtensions.h
+++ b/Source/WebCore/svg/SVGDocumentExtensions.h
@@ -38,7 +38,8 @@ class SVGStyledElement;
class SVGSMILElement;
class SVGSVGElement;
-class SVGDocumentExtensions : public Noncopyable {
+class SVGDocumentExtensions {
+ WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions); WTF_MAKE_FAST_ALLOCATED;
public:
typedef HashSet<RefPtr<SVGStyledElement> > SVGPendingElements;
SVGDocumentExtensions(Document*);
@@ -68,9 +69,6 @@ private:
HashMap<AtomicString, SVGPendingElements*> m_pendingResources;
OwnPtr<SVGResourcesCache> m_resourcesCache;
- SVGDocumentExtensions(const SVGDocumentExtensions&);
- SVGDocumentExtensions& operator=(const SVGDocumentExtensions&);
-
public:
// This HashMap contains a list of pending resources. Pending resources, are such
// which are referenced by any object in the SVG document, but do NOT exist yet.
diff --git a/Source/WebCore/svg/SVGElementRareData.h b/Source/WebCore/svg/SVGElementRareData.h
index 4276c4a..3318dee 100644
--- a/Source/WebCore/svg/SVGElementRareData.h
+++ b/Source/WebCore/svg/SVGElementRareData.h
@@ -31,7 +31,8 @@ class SVGCursorElement;
class SVGElement;
class SVGElementInstance;
-class SVGElementRareData : public Noncopyable {
+class SVGElementRareData {
+ WTF_MAKE_NONCOPYABLE(SVGElementRareData); WTF_MAKE_FAST_ALLOCATED;
public:
SVGElementRareData()
: m_cursorElement(0)
diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp
index 04ea14c..0fd4763 100644
--- a/Source/WebCore/svg/SVGFEImageElement.cpp
+++ b/Source/WebCore/svg/SVGFEImageElement.cpp
@@ -29,6 +29,7 @@
#include "CachedResourceLoader.h"
#include "ColorSpace.h"
#include "Document.h"
+#include "Image.h"
#include "RenderObject.h"
#include "RenderSVGResource.h"
#include "SVGImageBufferTools.h"
diff --git a/Source/WebCore/svg/SVGFont.cpp b/Source/WebCore/svg/SVGFont.cpp
index dd99ac5..e5164c0 100644
--- a/Source/WebCore/svg/SVGFont.cpp
+++ b/Source/WebCore/svg/SVGFont.cpp
@@ -36,6 +36,7 @@
#include "SVGMissingGlyphElement.h"
#include "SVGNames.h"
#include "SimpleFontData.h"
+#include "TextRun.h"
#include "XMLNames.h"
using namespace WTF::Unicode;
diff --git a/Source/WebCore/svg/SVGFontData.h b/Source/WebCore/svg/SVGFontData.h
index e897a59..f202d26 100644
--- a/Source/WebCore/svg/SVGFontData.h
+++ b/Source/WebCore/svg/SVGFontData.h
@@ -25,7 +25,8 @@
namespace WebCore {
-class SVGFontData : public Noncopyable {
+class SVGFontData {
+ WTF_MAKE_NONCOPYABLE(SVGFontData); WTF_MAKE_FAST_ALLOCATED;
public:
SVGFontData(SVGFontFaceElement*);
virtual ~SVGFontData() { }
diff --git a/Source/WebCore/svg/SVGLocatable.cpp b/Source/WebCore/svg/SVGLocatable.cpp
index 43961d9..2a7c9be 100644
--- a/Source/WebCore/svg/SVGLocatable.cpp
+++ b/Source/WebCore/svg/SVGLocatable.cpp
@@ -91,7 +91,8 @@ AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mod
while (current && current->isSVGElement()) {
SVGElement* currentElement = static_cast<SVGElement*>(current);
if (currentElement->isStyled())
- ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm);
+ // note that this modifies the AffineTransform returned by localCoordinateSpaceTransform(mode) too.
+ ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm);
// For getCTM() computation, stop at the nearest viewport element
if (currentElement == stopAtElement)
@@ -113,7 +114,7 @@ AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, Exceptio
ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
return ctm;
}
- ctm *= targetCTM.inverse();
+ ctm = targetCTM.inverse() * ctm;
}
return ctm;
diff --git a/Source/WebCore/svg/SVGMatrix.h b/Source/WebCore/svg/SVGMatrix.h
index 807b703..077eb03 100644
--- a/Source/WebCore/svg/SVGMatrix.h
+++ b/Source/WebCore/svg/SVGMatrix.h
@@ -96,11 +96,10 @@ public:
return static_cast<SVGMatrix>(copy);
}
- // SVGMatrix::multiply needs to call SVGMatrix::multLeft.
SVGMatrix multiply(const SVGMatrix& other)
{
AffineTransform copy = *this;
- copy.multLeft(static_cast<const AffineTransform&>(other));
+ copy *= static_cast<const AffineTransform&>(other);
return static_cast<SVGMatrix>(copy);
}
diff --git a/Source/WebCore/svg/SVGPathBlender.h b/Source/WebCore/svg/SVGPathBlender.h
index c0ae7f3..8e43b94 100644
--- a/Source/WebCore/svg/SVGPathBlender.h
+++ b/Source/WebCore/svg/SVGPathBlender.h
@@ -23,11 +23,11 @@
#if ENABLE(SVG)
#include "SVGPathConsumer.h"
#include "SVGPathSource.h"
-#include <wtf/Noncopyable.h>
namespace WebCore {
-class SVGPathBlender : public Noncopyable {
+class SVGPathBlender {
+ WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED;
public:
SVGPathBlender();
diff --git a/Source/WebCore/svg/SVGPathByteStream.h b/Source/WebCore/svg/SVGPathByteStream.h
index b8882b6..a444ac0 100644
--- a/Source/WebCore/svg/SVGPathByteStream.h
+++ b/Source/WebCore/svg/SVGPathByteStream.h
@@ -43,7 +43,8 @@ typedef union {
unsigned char bytes[sizeof(unsigned short)];
} UnsignedShortByte;
-class SVGPathByteStream : public Noncopyable {
+class SVGPathByteStream {
+ WTF_MAKE_NONCOPYABLE(SVGPathByteStream); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<SVGPathByteStream> create()
{
diff --git a/Source/WebCore/svg/SVGPathConsumer.h b/Source/WebCore/svg/SVGPathConsumer.h
index b7c5e73..af3f79b 100644
--- a/Source/WebCore/svg/SVGPathConsumer.h
+++ b/Source/WebCore/svg/SVGPathConsumer.h
@@ -26,6 +26,7 @@
#if ENABLE(SVG)
#include "FloatPoint.h"
+#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
@@ -40,8 +41,10 @@ enum PathParsingMode {
UnalteredParsing
};
-class SVGPathConsumer : public Noncopyable {
+class SVGPathConsumer {
+ WTF_MAKE_NONCOPYABLE(SVGPathConsumer); WTF_MAKE_FAST_ALLOCATED;
public:
+ SVGPathConsumer() { }
virtual void incrementPathSegmentCount() = 0;
virtual bool continueConsuming() = 0;
virtual void cleanup() = 0;
diff --git a/Source/WebCore/svg/SVGPathParser.h b/Source/WebCore/svg/SVGPathParser.h
index 7679a95..096131c 100644
--- a/Source/WebCore/svg/SVGPathParser.h
+++ b/Source/WebCore/svg/SVGPathParser.h
@@ -29,12 +29,12 @@
#include "SVGPathConsumer.h"
#include "SVGPathSeg.h"
#include "SVGPathSource.h"
-#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
-class SVGPathParser : public Noncopyable {
+class SVGPathParser {
+ WTF_MAKE_NONCOPYABLE(SVGPathParser); WTF_MAKE_FAST_ALLOCATED;
public:
SVGPathParser();
diff --git a/Source/WebCore/svg/SVGPathSource.h b/Source/WebCore/svg/SVGPathSource.h
index d1a6149..77bf9fa 100644
--- a/Source/WebCore/svg/SVGPathSource.h
+++ b/Source/WebCore/svg/SVGPathSource.h
@@ -25,8 +25,10 @@
namespace WebCore {
-class SVGPathSource : public Noncopyable {
+class SVGPathSource {
+ WTF_MAKE_NONCOPYABLE(SVGPathSource); WTF_MAKE_FAST_ALLOCATED;
public:
+ SVGPathSource() { }
virtual ~SVGPathSource() { }
virtual bool hasMoreData() const = 0;
diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp
index 29723e7..60dfeaf 100644
--- a/Source/WebCore/svg/SVGPatternElement.cpp
+++ b/Source/WebCore/svg/SVGPatternElement.cpp
@@ -228,6 +228,12 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAttr))
attributes.setHeight(current->height());
+ if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr))
+ attributes.setViewBox(current->viewBox());
+
+ if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNames::preserveAspectRatioAttr))
+ attributes.setPreserveAspectRatio(current->preserveAspectRatio());
+
if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::patternUnitsAttr))
attributes.setBoundingBoxMode(current->patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp
index 7e04f5d..483e45f 100644
--- a/Source/WebCore/svg/SVGSVGElement.cpp
+++ b/Source/WebCore/svg/SVGSVGElement.cpp
@@ -502,7 +502,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc
}
}
- return transform.multLeft(viewBoxTransform);
+ return transform.multiply(viewBoxTransform);
}
RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*)
@@ -587,12 +587,11 @@ AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie
viewBoxRect = viewBox();
AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(viewBoxRect, preserveAspectRatio(), viewWidth, viewHeight);
+
if (useCurrentView() && currentView()) {
AffineTransform transform;
- if (!currentView()->transform().concatenate(transform))
- return ctm;
-
- return transform * ctm;
+ if (currentView()->transform().concatenate(transform))
+ ctm *= transform;
}
return ctm;
diff --git a/Source/WebCore/svg/SVGStyledTransformableElement.cpp b/Source/WebCore/svg/SVGStyledTransformableElement.cpp
index 2334943..15528e0 100644
--- a/Source/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/Source/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -56,7 +56,9 @@ AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const
{
AffineTransform matrix;
transform().concatenate(matrix);
- return m_supplementalTransform ? *m_supplementalTransform * matrix : matrix;
+ if (m_supplementalTransform)
+ matrix *= *m_supplementalTransform;
+ return matrix;
}
AffineTransform* SVGStyledTransformableElement::supplementalTransform()
diff --git a/Source/WebCore/svg/SVGTextElement.cpp b/Source/WebCore/svg/SVGTextElement.cpp
index 7229824..b6094c9 100644
--- a/Source/WebCore/svg/SVGTextElement.cpp
+++ b/Source/WebCore/svg/SVGTextElement.cpp
@@ -89,7 +89,9 @@ AffineTransform SVGTextElement::animatedLocalTransform() const
{
AffineTransform matrix;
transform().concatenate(matrix);
- return m_supplementalTransform ? *m_supplementalTransform * matrix : matrix;
+ if (m_supplementalTransform)
+ matrix *= *m_supplementalTransform;
+ return matrix;
}
AffineTransform* SVGTextElement::supplementalTransform()
diff --git a/Source/WebCore/svg/SVGTransformList.cpp b/Source/WebCore/svg/SVGTransformList.cpp
index 52bfc85..1800b1e 100644
--- a/Source/WebCore/svg/SVGTransformList.cpp
+++ b/Source/WebCore/svg/SVGTransformList.cpp
@@ -56,7 +56,7 @@ bool SVGTransformList::concatenate(AffineTransform& result) const
return false;
for (unsigned i = 0; i < size; ++i)
- result = at(i).matrix() * result;
+ result *= at(i).matrix();
return true;
}
diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp
index 589a560..9f43f82 100644
--- a/Source/WebCore/svg/SVGUseElement.cpp
+++ b/Source/WebCore/svg/SVGUseElement.cpp
@@ -330,7 +330,7 @@ void SVGUseElement::updateContainerOffsets()
void SVGUseElement::recalcStyle(StyleChange change)
{
// Eventually mark shadow root element needing style recalc
- if (needsStyleRecalc() && m_targetElementInstance && !m_updatesBlocked) {
+ if ((change >= Inherit || needsStyleRecalc() || childNeedsStyleRecalc()) && m_targetElementInstance && !m_updatesBlocked) {
if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement())
shadowRoot->setNeedsStyleRecalc();
}
diff --git a/Source/WebCore/svg/SVGViewSpec.h b/Source/WebCore/svg/SVGViewSpec.h
index 686cec3..cd10ca4 100644
--- a/Source/WebCore/svg/SVGViewSpec.h
+++ b/Source/WebCore/svg/SVGViewSpec.h
@@ -32,8 +32,8 @@ namespace WebCore {
class SVGElement;
class SVGViewSpec : public SVGFitToViewBox,
- public SVGZoomAndPan,
- public Noncopyable {
+ public SVGZoomAndPan {
+ WTF_MAKE_NONCOPYABLE(SVGViewSpec);
public:
SVGViewSpec(SVGElement*);
diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp
index 97f86be..fc2fd08 100644
--- a/Source/WebCore/svg/graphics/SVGImage.cpp
+++ b/Source/WebCore/svg/graphics/SVGImage.cpp
@@ -55,7 +55,8 @@
namespace WebCore {
-class SVGImageChromeClient : public EmptyChromeClient, public Noncopyable {
+class SVGImageChromeClient : public EmptyChromeClient {
+ WTF_MAKE_NONCOPYABLE(SVGImageChromeClient); WTF_MAKE_FAST_ALLOCATED;
public:
SVGImageChromeClient(SVGImage* image)
: m_image(image)