24 #include "wtf/Platform.h" 61 SVGElement::~SVGElement()
65 bool SVGElement::isSupported(StringImpl* feature, StringImpl* version)
const 67 return DOMImplementation::hasFeature(feature, version);
71 String SVGElement::attrid()
const 73 return getAttribute(
idAttr);
79 setAttribute(
idAttr, value);
83 String SVGElement::xmlbase()
const 85 return getAttribute(ATTR_XML_BASE);
90 setAttribute(ATTR_XML_BASE, value);
93 SVGSVGElement* SVGElement::ownerSVGElement()
const 95 Node* n = isShadowNode() ?
const_cast<SVGElement*
>(
this)->shadowParentNode() : parentNode();
98 return static_cast<SVGSVGElement*>(n);
100 n = n->isShadowNode() ? n->shadowParentNode() : n->
parentNode();
106 SVGElement* SVGElement::viewportElement()
const 121 void SVGElement::addSVGEventListener(
const EventImpl::EventId& eventType,
const Attribute* attr)
123 kDebug() <<
"add listener for: " << EventName::fromId(eventType).toString() << endl;
124 Element::setHTMLEventListener(EventName::fromId(eventType), document()->accessSVGExtensions()->
125 createSVGEventListener(attr->localName().string(), attr->value(),
this));
128 void SVGElement::parseMappedAttribute(MappedAttribute* attr)
131 if (attr->id() == ATTR_ONLOAD)
132 addSVGEventListener(EventImpl::LOAD_EVENT, attr);
133 else if (attr->id() == ATTR_ONCLICK)
134 addSVGEventListener(EventImpl::CLICK_EVENT, attr);
152 if (attr->id() == ATTR_ID) {
154 document()->incDOMTreeVersion(DocumentImpl::TV_IDNameHref);
156 StyledElement::parseAttribute(attr);
159 bool SVGElement::haveLoadedRequiredResources()
161 Node* child = firstChild();
163 if (child->isSVGElement() && !
static_cast<SVGElement*
>(child)->haveLoadedRequiredResources())
170 static bool hasLoadListener(SVGElement* node)
172 Node* currentNode = node;
173 while (currentNode && currentNode->isElementNode()) {
178 if ((*it).useCapture || (*it).eventName.id() == EventImpl::LOAD_EVENT)
190 void SVGElement::sendSVGLoadEventIfPossible(
bool sendParentLoadEvents)
192 kDebug() <<
"send svg load event" << endl;
193 RefPtr<SVGElement> currentTarget =
this;
194 kDebug() << currentTarget << currentTarget->haveLoadedRequiredResources() << endl;
195 while (currentTarget && currentTarget->haveLoadedRequiredResources()) {
197 if (sendParentLoadEvents)
198 parent = currentTarget->parentNode();
199 kDebug() << hasLoadListener(currentTarget.get()) << endl;
200 if (hasLoadListener(currentTarget.get())) {
205 dispatchHTMLEvent(EventImpl::LOAD_EVENT,
false,
false);
207 currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>();
211 void SVGElement::finishParsingChildren()
215 sendSVGLoadEventIfPossible();
218 bool SVGElement::childShouldCreateRenderer(
Node* child)
const 220 if (child->isSVGElement())
221 return static_cast<SVGElement*>(child)->isValid();
225 void SVGElement::insertedIntoDocument()
227 StyledElement::insertedIntoDocument();
246 static Node* shadowTreeParentElementForShadowTreeElement(
Node* node)
261 kDebug() <<
"dispatch event" << endl;
287 void SVGElement::attributeChanged(Attribute* attr,
bool preserveDecls)
293 StyledElement::attributeChanged(attr, preserveDecls);
294 svgAttributeChanged(attr->name());
298 void SVGElement::addCSSProperty(Attribute* attr,
int id,
const String& value)
301 kDebug() <<
"called with: " <<
id <<
" " << value << endl;
303 if (!m_hasCombinedStyle) createNonCSSDecl();
304 nonCSSStyleDecls()->setProperty(
id, value,
false);
308 void SVGElement::addCSSProperty(Attribute* attr,
int id,
int value)
311 kDebug() <<
"called with: " <<
id <<
" " << value << endl;
313 if (!m_hasCombinedStyle) createNonCSSDecl();
314 nonCSSStyleDecls()->setProperty(
id, value,
false);
321 #endif // ENABLE(SVG) The Node interface is the primary datatype for the entire Document Object Model.
DOM::QualifiedName svgTag
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
PrefixName prefixId() const
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Node parentNode() const
The parent of this node.
The Document interface represents the entire HTML or XML document.
unsigned short ExceptionCode
This library provides a full-featured HTML parser and widget.
Introduced in DOM Level 2.
Node nextSibling() const
The node immediately following this node.
QStringList list(const QString &fileClass)