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


C++ FocusCandidate::isNull方法代码示例

本文整理汇总了C++中FocusCandidate::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ FocusCandidate::isNull方法的具体用法?C++ FocusCandidate::isNull怎么用?C++ FocusCandidate::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FocusCandidate的用法示例。


在下文中一共展示了FocusCandidate::isNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: findFocusableNodeInDirection

void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode,
                                                   FocusDirection direction, KeyboardEvent* event,
                                                   FocusCandidate& closestFocusCandidate,
                                                   const FocusCandidate& candidateParent)
{
    ASSERT(outer);
    ASSERT(candidateParent.isNull()
        || candidateParent.node->hasTagName(frameTag)
        || candidateParent.node->hasTagName(iframeTag));

    // Walk all the child nodes and update closestFocusCandidate if we find a nearer node.
    Node* candidate = outer;
    while (candidate) {
        // Inner documents case.

        if (candidate->isFrameOwnerElement())
            deepFindFocusableNodeInDirection(candidate, focusedNode, direction, event, closestFocusCandidate);
        else if (candidate != focusedNode && candidate->isKeyboardFocusable(event)) {
            FocusCandidate currentFocusCandidate(candidate);

            // Get distance and alignment from current candidate.
            distanceDataForNode(direction, focusedNode, currentFocusCandidate);

            // Bail out if distance is maximum.
            if (currentFocusCandidate.distance == maxDistance()) {
                candidate = candidate->traverseNextNode(outer->parent());
                continue;
            }

            // If candidateParent is not null, it means that we are in a recursive call
            // from deepFineFocusableNodeInDirection (i.e. processing an element in an iframe),
            // and holds the distance and alignment data of the iframe element itself.
            if (!candidateParent.isNull()) {
                currentFocusCandidate.parentAlignment = candidateParent.alignment;
                currentFocusCandidate.parentDistance = candidateParent.distance;
            }

            updateFocusCandidateIfCloser(focusedNode, currentFocusCandidate, closestFocusCandidate);
        }

        candidate = candidate->traverseNextNode(outer->parent());
    }
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:43,代码来源:FocusController.cpp

示例2: areElementsOnSameLine

bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCandidate& secondCandidate)
{
    if (firstCandidate.isNull() || secondCandidate.isNull())
        return false;

    if (!firstCandidate.visibleNode->renderer() || !secondCandidate.visibleNode->renderer())
        return false;

    if (!firstCandidate.rect.intersects(secondCandidate.rect))
        return false;

    if (firstCandidate.focusableNode->hasTagName(HTMLNames::areaTag) || secondCandidate.focusableNode->hasTagName(HTMLNames::areaTag))
        return false;

    if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCandidate.visibleNode->renderer()->isRenderInline())
        return false;

    if (firstCandidate.visibleNode->renderer()->containingBlock() != secondCandidate.visibleNode->renderer()->containingBlock())
        return false;

    return true;
}
开发者ID:studiomobile,项目名称:webcore,代码行数:22,代码来源:SpatialNavigation.cpp

示例3: updateFocusCandidateInSameContainer

static void updateFocusCandidateInSameContainer(const FocusCandidate& candidate, FocusCandidate& closest)
{
    if (closest.isNull()) {
        closest = candidate;
        return;
    }

    if (candidate.alignment == closest.alignment) {
        if (candidate.distance < closest.distance)
            closest = candidate;
        return;
    }

    if (candidate.alignment > closest.alignment)
        closest = candidate;
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:16,代码来源:FocusController.cpp

示例4: updateFocusCandidateIfCloser

// FIXME: Make this method more modular, and simpler to understand and maintain.
static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate& candidate, FocusCandidate& closest)
{
    bool sameDocument = candidate.document() == closest.document();
    if (sameDocument) {
        if (closest.alignment > candidate.alignment
         || (closest.parentAlignment && candidate.alignment > closest.parentAlignment))
            return;
    } else if (closest.alignment > candidate.alignment
            && (closest.parentAlignment && candidate.alignment > closest.parentAlignment))
        return;

    if (candidate.alignment != None
     || (closest.parentAlignment >= candidate.alignment
     && closest.document() == candidate.document())) {

        // If we are now in an higher precedent case, lets reset the current closest's
        // distance so we force it to be bigger than any result we will get from
        // spatialDistance().
        if (closest.alignment < candidate.alignment
         && closest.parentAlignment < candidate.alignment)
            closest.distance = maxDistance();
    }

    // Bail out if candidate's distance is larger than that of the closest candidate.
    if (candidate.distance >= closest.distance)
        return;

    if (closest.isNull()) {
        closest = candidate;
        return;
    }

    // If the focused node and the candadate are in the same document and current
    // closest candidate is not in an {i}frame that is preferable to get focused ...
    if (focusedNode->document() == candidate.document()
        && candidate.distance < closest.parentDistance)
        closest = candidate;
    else if (focusedNode->document() != candidate.document()) {
        // If the focusedNode is in an inner document and candidate is in a
        // different document, we only consider to change focus if there is not
        // another already good focusable candidate in the same document as focusedNode.
        if (!((isInRootDocument(candidate.node) && !isInRootDocument(focusedNode))
            && focusedNode->document() == closest.document()))
            closest = candidate;
    }
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:47,代码来源:FocusController.cpp

示例5: findFocusableNodeInDirection

void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode,
                                                   FocusDirection direction, KeyboardEvent* event,
                                                   FocusCandidate& closest, const FocusCandidate& candidateParent)
#endif
{
#if PLATFORM(WKC)
    CRASH_IF_STACK_OVERFLOW(WKC_STACK_MARGIN_DEFAULT);
#endif
    ASSERT(outer);
    ASSERT(candidateParent.isNull()
        || candidateParent.node->isFrameOwnerElement()
        || isScrollableContainerNode(candidateParent.node));

    // Walk all the child nodes and update closest if we find a nearer node.
    Node* node = outer;
    while (node) {

        // Inner documents case.
        if (node->isFrameOwnerElement()) {
            deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest, specificRect);
        // Scrollable block elements (e.g. <div>, etc) case.
        } else if (isScrollableContainerNode(node) && !node->renderer()->isTextArea()) {
            deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest, specificRect);
            node = node->traverseNextSibling();
            continue;

#if PLATFORM(WKC)
        } else if (node != focusedNode && node->isFocusable() && isNodeInSpecificRect(node, specificRect)) {
#else
        } else if (node != focusedNode && node->isKeyboardFocusable(event)) {
#endif
            FocusCandidate candidate(node);

            // There are two ways to identify we are in a recursive call from deepFindFocusableNodeInDirection
            // (i.e. processing an element in an iframe, frame or a scrollable block element):

            // 1) If candidateParent is not null, and it holds the distance and alignment data of the
            // parent container element itself;
            // 2) Parent of outer is <frame> or <iframe>;
            // 3) Parent is any other scrollable block element.
            if (!candidateParent.isNull()) {
                candidate.parentAlignment = candidateParent.alignment;
                candidate.parentDistance = candidateParent.distance;
                candidate.enclosingScrollableBox = candidateParent.node;

            } else if (!isInRootDocument(outer)) {
#if PLATFORM(WKC)
                if (outer->parent() && outer->parent()->isDocumentNode()) {
                    Document* document = static_cast<Document*>(outer->parent());
                    candidate.enclosingScrollableBox = static_cast<Node*>(document->ownerElement());
                }
#else
                if (Document* document = static_cast<Document*>(outer->parent()))
                    candidate.enclosingScrollableBox = static_cast<Node*>(document->ownerElement());
#endif

            } else if (isScrollableContainerNode(outer->parent()))
                candidate.enclosingScrollableBox = outer->parent();

            // Get distance and alignment from current candidate.
            distanceDataForNode(direction, focusedNode, candidate);

            // Bail out if distance is maximum.
            if (candidate.distance == maxDistance()) {
                node = node->traverseNextNode(outer->parent());
                continue;
            }

            updateFocusCandidateIfCloser(focusedNode, candidate, closest);
        }

        node = node->traverseNextNode(outer->parent());
    }
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:74,代码来源:FocusController.cpp


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