本文整理汇总了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());
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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());
}
}