OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/svg/SVGDocumentExtensions.h" | 23 #include "core/svg/SVGDocumentExtensions.h" |
24 | 24 |
25 #include "XLinkNames.h" | 25 #include "XLinkNames.h" |
26 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
27 #include "core/rendering/RenderView.h" | |
27 #include "core/rendering/svg/SVGResourcesCache.h" | 28 #include "core/rendering/svg/SVGResourcesCache.h" |
28 #include "core/svg/SVGElement.h" | |
29 #include "core/svg/SVGFontFaceElement.h" | 29 #include "core/svg/SVGFontFaceElement.h" |
30 #include "core/svg/SVGSVGElement.h" | 30 #include "core/svg/SVGSVGElement.h" |
31 #include "core/svg/SVGViewSpec.h" | |
32 #include "core/svg/SVGZoomAndPan.h" | |
31 #include "core/svg/animation/SMILTimeContainer.h" | 33 #include "core/svg/animation/SMILTimeContainer.h" |
32 #include "wtf/TemporaryChange.h" | 34 #include "wtf/TemporaryChange.h" |
33 #include "wtf/text/AtomicString.h" | 35 #include "wtf/text/AtomicString.h" |
34 | 36 |
35 namespace WebCore { | 37 namespace WebCore { |
36 | 38 |
37 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) | 39 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) |
38 : m_document(document) | 40 : m_document(document) |
39 , m_resourcesCache(adoptPtr(new SVGResourcesCache)) | 41 , m_resourcesCache(adoptPtr(new SVGResourcesCache)) |
40 #if !ASSERT_DISABLED | 42 #if !ASSERT_DISABLED |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 m_pendingSVGFontFaceElementsForRemoval.add(font); | 430 m_pendingSVGFontFaceElementsForRemoval.add(font); |
429 } | 431 } |
430 | 432 |
431 void SVGDocumentExtensions::removePendingSVGFontFaceElementsForRemoval() | 433 void SVGDocumentExtensions::removePendingSVGFontFaceElementsForRemoval() |
432 { | 434 { |
433 m_pendingSVGFontFaceElementsForRemoval.clear(); | 435 m_pendingSVGFontFaceElementsForRemoval.clear(); |
434 } | 436 } |
435 | 437 |
436 #endif | 438 #endif |
437 | 439 |
440 bool SVGDocumentExtensions::zoomAndPanEnabled() const | |
441 { | |
442 if (SVGSVGElement* svg = rootElement(*m_document)) { | |
443 if (svg->useCurrentView()) { | |
444 if (svg->currentView()) | |
445 return svg->currentView()->zoomAndPan() == SVGZoomAndPanMagnify; | |
446 } else { | |
447 return svg->zoomAndPan() == SVGZoomAndPanMagnify; | |
448 } | |
449 } | |
450 | |
451 return false; | |
438 } | 452 } |
453 | |
454 void SVGDocumentExtensions::startPan(const FloatPoint& start) | |
455 { | |
456 if (SVGSVGElement* svg = rootElement(*m_document)) | |
457 m_translate = FloatPoint(start.x() - svg->currentTranslate().x(), start. y() - svg->currentTranslate().y()); | |
458 } | |
459 | |
460 void SVGDocumentExtensions::updatePan(const FloatPoint& pos) const | |
461 { | |
462 if (SVGSVGElement* svg = rootElement(*m_document)) { | |
463 svg->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y())); | |
464 if (m_document->renderer()) | |
pdr.
2014/05/03 21:35:30
This repaint call can be removed.
| |
465 m_document->renderer()->repaint(); | |
466 } | |
467 } | |
468 | |
469 SVGSVGElement* SVGDocumentExtensions::rootElement(const Document& document) | |
pdr.
2014/05/03 21:35:30
Is the document argument necessary here? It is alw
| |
470 { | |
471 Element* elem = document.documentElement(); | |
472 return isSVGSVGElement(elem) ? toSVGSVGElement(elem) : 0; | |
473 } | |
474 | |
475 } | |
OLD | NEW |