KHTML
SVGLocatable.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "config.h"
00024 #include "wtf/Platform.h"
00025
00026 #if ENABLE(SVG)
00027
00028 #include "SVGLocatable.h"
00029
00030 #include "AffineTransform.h"
00031 #include "RenderPath.h"
00032 #include "SVGException.h"
00033 #include "SVGSVGElement.h"
00034
00035 namespace WebCore {
00036
00037 SVGLocatable::SVGLocatable()
00038 {
00039 }
00040
00041 SVGLocatable::~SVGLocatable()
00042 {
00043 }
00044
00045 SVGElement* SVGLocatable::nearestViewportElement(const SVGStyledElement* e)
00046 {
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 return 0;
00062 }
00063
00064 SVGElement* SVGLocatable::farthestViewportElement(const SVGStyledElement* e)
00065 {
00066
00067
00068
00069
00070 SVGElement* farthest = 0;
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 return farthest;
00085 }
00086
00087
00088
00089 FloatRect SVGLocatable::getBBox(const SVGStyledElement* e)
00090 {
00091 FloatRect bboxRect;
00092
00093
00094
00095
00096
00097
00098
00099
00100 return bboxRect;
00101 }
00102
00103 AffineTransform SVGLocatable::getCTM(const SVGElement* element)
00104 {
00105 if (!element)
00106 return AffineTransform();
00107
00108 AffineTransform ctm;
00109
00110 Node* parent = element->parentNode();
00111 if (parent && parent->isSVGElement()) {
00112 SVGElement* parentElement = static_cast<SVGElement*>(parent);
00113 if (parentElement && parentElement->isStyledLocatable()) {
00114 AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getCTM();
00115 ctm = parentCTM * ctm;
00116 }
00117 }
00118
00119 return ctm;
00120 }
00121
00122 AffineTransform SVGLocatable::getScreenCTM(const SVGElement* element)
00123 {
00124 if (!element)
00125 return AffineTransform();
00126
00127 AffineTransform ctm;
00128
00129 Node* parent = element->parentNode();
00130 if (parent && parent->isSVGElement()) {
00131 SVGElement* parentElement = static_cast<SVGElement*>(parent);
00132 if (parentElement && parentElement->isStyledLocatable()) {
00133 AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getScreenCTM();
00134 ctm = parentCTM * ctm;
00135 }
00136 }
00137
00138 return ctm;
00139 }
00140
00141 AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const
00142 {
00143 AffineTransform ctm = getCTM();
00144
00145 if (target && target->isStyledLocatable()) {
00146 AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM();
00147 if (!targetCTM.isInvertible()) {
00148
00149 return ctm;
00150 }
00151 ctm *= targetCTM.inverse();
00152 }
00153
00154 return ctm;
00155 }
00156
00157 }
00158
00159 #endif // ENABLE(SVG)
00160
00161