summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 09:58:03 +0100
committerPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 09:58:03 +0100
commit879e2ea7d15510ec5f94d6d7a005b157b115f69f (patch)
tree73aedd0bffe7ab39387229a9417aa50cecbbf0aa /src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp
parent8fc2eec5b3282665f76f1e0313a03608bf4e7bc1 (diff)
parent80cd617b05ad3e647c87dc063d40cde0617344ca (diff)
Merge remote branch 'origin/4.6' into lighthouse
Conflicts: configure src/plugins/graphicssystems/graphicssystems.pro
Diffstat (limited to 'src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp
index 847038c0ca..c566a8f89e 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp
@@ -2,8 +2,6 @@
Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@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,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGFitToViewBox.h"
+#include "Attr.h"
#include "Document.h"
#include "FloatRect.h"
#include "MappedAttribute.h"
@@ -39,8 +38,6 @@ namespace WebCore {
char SVGFitToViewBoxIdentifier[] = "SVGFitToViewBox";
SVGFitToViewBox::SVGFitToViewBox()
- : m_viewBox(this, SVGNames::viewBoxAttr)
- , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())
{
}
@@ -48,9 +45,8 @@ SVGFitToViewBox::~SVGFitToViewBox()
{
}
-bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate)
+bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate)
{
- Document* doc = contextElement()->document();
String str(c, end - c);
skipOptionalSpaces(c, end);
@@ -81,24 +77,22 @@ bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x,
return true;
}
-TransformationMatrix SVGFitToViewBox::viewBoxToViewTransform(float viewWidth, float viewHeight) const
+TransformationMatrix SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBoxRect, SVGPreserveAspectRatio* preserveAspectRatio, float viewWidth, float viewHeight)
{
- FloatRect viewBoxRect = viewBox();
+ ASSERT(preserveAspectRatio);
if (!viewBoxRect.width() || !viewBoxRect.height())
return TransformationMatrix();
- return preserveAspectRatio()->getCTM(viewBoxRect.x(),
- viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(),
- 0, 0, viewWidth, viewHeight);
+ return preserveAspectRatio->getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 0, 0, viewWidth, viewHeight);
}
-bool SVGFitToViewBox::parseMappedAttribute(MappedAttribute* attr)
+bool SVGFitToViewBox::parseMappedAttribute(Document* document, MappedAttribute* attr)
{
if (attr->name() == SVGNames::viewBoxAttr) {
float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f;
const UChar* c = attr->value().characters();
const UChar* end = c + attr->value().length();
- if (parseViewBox(c, end, x, y, w, h))
+ if (parseViewBox(document, c, end, x, y, w, h))
setViewBoxBaseValue(FloatRect(x, y, w, h));
return true;
} else if (attr->name() == SVGNames::preserveAspectRatioAttr) {