当前位置: 首页>>代码示例>>C++>>正文


C++ SVGElementInstance::correspondingElement方法代码示例

本文整理汇总了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;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例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;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:46,代码来源:JSSVGElementInstance.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:38,代码来源:


注:本文中的SVGElementInstance::correspondingElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。