本文整理汇总了C++中SVGElementInstance::correspondingElement方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGElementInstance::correspondingElement方法的具体用法?C++ SVGElementInstance::correspondingElement怎么用?C++ SVGElementInstance::correspondingElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGElementInstance
的用法示例。
在下文中一共展示了SVGElementInstance::correspondingElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasCycleUseReferencing
bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget)
{
ASSERT(referencedDocument());
Element* targetElement = SVGURIReference::targetElementFromIRIString(use->href(), *referencedDocument());
newTarget = 0;
if (targetElement && targetElement->isSVGElement())
newTarget = toSVGElement(targetElement);
if (!newTarget)
return false;
// Shortcut for self-references
if (newTarget == this)
return true;
AtomicString targetId = newTarget->getIdAttribute();
SVGElementInstance* instance = targetInstance->parentNode();
while (instance) {
SVGElement* element = instance->correspondingElement();
if (element->hasID() && element->getIdAttribute() == targetId && &element->document() == &newTarget->document())
return true;
instance = instance->parentNode();
}
return false;
}
示例2: getValueProperty
JSValue* JSSVGElementInstance::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case CorrespondingElementAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->correspondingElement()));
}
case CorrespondingUseElementAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->correspondingUseElement()));
}
case ParentNodeAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->parentNode()));
}
case ChildNodesAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->childNodes()));
}
case FirstChildAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->firstChild()));
}
case LastChildAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->lastChild()));
}
case PreviousSiblingAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->previousSibling()));
}
case NextSiblingAttrNum: {
SVGElementInstance* imp = static_cast<SVGElementInstance*>(impl());
return toJS(exec, WTF::getPtr(imp->nextSibling()));
}
}
return 0;
}
示例3: handleDeepUseReferencing
void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, bool& foundProblem)
{
String id = SVGURIReference::getTarget(use->href());
Element* targetElement = document()->getElementById(id);
SVGElement* target = 0;
if (targetElement && targetElement->isSVGElement())
target = static_cast<SVGElement*>(targetElement);
if (!target)
return;
// Cycle detection first!
foundProblem = (target == this);
// Shortcut for self-references
if (foundProblem)
return;
SVGElementInstance* instance = targetInstance->parentNode();
while (instance) {
SVGElement* element = instance->correspondingElement();
if (element->getIDAttribute() == id) {
foundProblem = true;
return;
}
instance = instance->parentNode();
}
// Create an instance object, even if we're dealing with a cycle
RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, target);
SVGElementInstance* newInstancePtr = newInstance.get();
targetInstance->appendChild(newInstance.release());
// Eventually enter recursion to build SVGElementInstance objects for the sub-tree children
buildInstanceTree(target, newInstancePtr, foundProblem);
}