| Index: Source/core/svg/SVGDocumentExtensions.cpp
|
| diff --git a/Source/core/svg/SVGDocumentExtensions.cpp b/Source/core/svg/SVGDocumentExtensions.cpp
|
| index 9593866a5897dfe10268fdcbadfc44d77d359056..c0cc4bf9b9f4e243e6598e82422110b6c84a113b 100644
|
| --- a/Source/core/svg/SVGDocumentExtensions.cpp
|
| +++ b/Source/core/svg/SVGDocumentExtensions.cpp
|
| @@ -24,10 +24,12 @@
|
|
|
| #include "XLinkNames.h"
|
| #include "core/dom/Document.h"
|
| +#include "core/rendering/RenderView.h"
|
| #include "core/rendering/svg/SVGResourcesCache.h"
|
| -#include "core/svg/SVGElement.h"
|
| #include "core/svg/SVGFontFaceElement.h"
|
| #include "core/svg/SVGSVGElement.h"
|
| +#include "core/svg/SVGViewSpec.h"
|
| +#include "core/svg/SVGZoomAndPan.h"
|
| #include "core/svg/animation/SMILTimeContainer.h"
|
| #include "wtf/TemporaryChange.h"
|
| #include "wtf/text/AtomicString.h"
|
| @@ -435,4 +437,42 @@ void SVGDocumentExtensions::removePendingSVGFontFaceElementsForRemoval()
|
|
|
| #endif
|
|
|
| +bool SVGDocumentExtensions::zoomAndPanEnabled() const
|
| +{
|
| + if (SVGSVGElement* svg = rootElement(*m_document)) {
|
| + if (svg->useCurrentView()) {
|
| + if (svg->currentView())
|
| + return svg->currentView()->zoomAndPan() == SVGZoomAndPanMagnify;
|
| + } else {
|
| + return svg->zoomAndPan() == SVGZoomAndPanMagnify;
|
| + }
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| +void SVGDocumentExtensions::startPan(const FloatPoint& start)
|
| +{
|
| + if (SVGSVGElement* svg = rootElement(*m_document))
|
| + m_translate = FloatPoint(start.x() - svg->currentTranslate().x(), start.y() - svg->currentTranslate().y());
|
| +}
|
| +
|
| +void SVGDocumentExtensions::updatePan(const FloatPoint& pos) const
|
| +{
|
| + if (SVGSVGElement* svg = rootElement(*m_document))
|
| + svg->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
|
| +}
|
| +
|
| +SVGSVGElement* SVGDocumentExtensions::rootElement(const Document& document)
|
| +{
|
| + Element* elem = document.documentElement();
|
| + return isSVGSVGElement(elem) ? toSVGSVGElement(elem) : 0;
|
| +}
|
| +
|
| +SVGSVGElement* SVGDocumentExtensions::rootElement() const
|
| +{
|
| + ASSERT(m_document);
|
| + return rootElement(*m_document);
|
| +}
|
| +
|
| }
|
|
|