/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
void nsFrameIterator::Last() {
nsIFrame* result;
nsIFrame* parent = GetCurrent(); // If the current frame is a popup, don't move farther up the tree. // Otherwise, get the nearest root frame or popup. if (mSkipPopupChecks || !parent->IsMenuPopupFrame()) { while (!IsRootFrame(parent) && (result = GetParentFrameNotPopup(parent))) {
parent = result;
}
}
while ((result = GetLastChild(parent))) {
parent = result;
}
SetCurrent(parent); if (!parent) {
SetOffEdge(1);
}
}
void nsFrameIterator::Next() { // recursive-oid method to get next frame
nsIFrame* result = nullptr;
nsIFrame* parent = GetCurrent(); if (!parent) {
parent = GetLast();
}
if (mType == Type::Leaf) { // Drill down to first leaf while ((result = GetFirstChild(parent))) {
parent = result;
}
} elseif (mType == Type::PreOrder) {
result = GetFirstChild(parent); if (result) {
parent = result;
}
}
if (parent != GetCurrent()) {
result = parent;
} else { while (parent) {
result = GetNextSibling(parent); if (result) { if (mType != Type::PreOrder) {
parent = result; while ((result = GetFirstChild(parent))) {
parent = result;
}
result = parent;
} break;
}
result = GetParentFrameNotPopup(parent); if (!result || IsRootFrame(result) ||
(mLockScroll && result->IsScrollContainerFrame())) {
result = nullptr; break;
} if (mType == Type::PostOrder) { break;
}
parent = result;
}
}
SetCurrent(result); if (!result) {
SetOffEdge(1);
SetLast(parent);
}
}
void nsFrameIterator::Prev() { // recursive-oid method to get prev frame
nsIFrame* result = nullptr;
nsIFrame* parent = GetCurrent(); if (!parent) {
parent = GetLast();
}
if (mType == Type::Leaf) { // Drill down to last leaf while ((result = GetLastChild(parent))) {
parent = result;
}
} elseif (mType == Type::PostOrder) {
result = GetLastChild(parent); if (result) {
parent = result;
}
}
if (parent != GetCurrent()) {
result = parent;
} else { while (parent) {
result = GetPrevSibling(parent); if (result) { if (mType != Type::PostOrder) {
parent = result; while ((result = GetLastChild(parent))) {
parent = result;
}
result = parent;
} break;
}
result = GetParentFrameNotPopup(parent); if (!result || IsRootFrame(result) ||
(mLockScroll && result->IsScrollContainerFrame())) {
result = nullptr; break;
} if (mType == Type::PreOrder) { break;
}
parent = result;
}
}
SetCurrent(result); if (!result) {
SetOffEdge(-1);
SetLast(parent);
}
}
nsIFrame* nsFrameIterator::GetParentFrame(nsIFrame* aFrame) { if (mFollowOOFs) {
aFrame = GetPlaceholderFrame(aFrame);
} if (aFrame == mLimiter) { return nullptr;
} if (aFrame) { return aFrame->GetParent();
}
return nullptr;
}
nsIFrame* nsFrameIterator::GetParentFrameNotPopup(nsIFrame* aFrame) { if (mFollowOOFs) {
aFrame = GetPlaceholderFrame(aFrame);
} if (aFrame == mLimiter) { return nullptr;
} if (aFrame) {
nsIFrame* parent = aFrame->GetParent(); if (!IsPopupFrame(parent)) { return parent;
}
}
return nullptr;
}
nsIFrame* nsFrameIterator::GetFirstChild(nsIFrame* aFrame) {
nsIFrame* result = GetFirstChildInner(aFrame); if (mLockScroll && result && result->IsScrollContainerFrame()) { return nullptr;
} if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result);
if (IsPopupFrame(result) || IsInvokerOpenPopoverFrame(result)) {
result = GetNextSibling(result);
}
}
return result;
}
nsIFrame* nsFrameIterator::GetLastChild(nsIFrame* aFrame) {
nsIFrame* result = GetLastChildInner(aFrame); if (mLockScroll && result && result->IsScrollContainerFrame()) { return nullptr;
} if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result);
if (IsPopupFrame(result) || IsInvokerOpenPopoverFrame(result)) {
result = GetPrevSibling(result);
}
}
return result;
}
nsIFrame* nsFrameIterator::GetNextSibling(nsIFrame* aFrame) {
nsIFrame* result = nullptr; if (mFollowOOFs) {
aFrame = GetPlaceholderFrame(aFrame);
} if (aFrame == mLimiter) { return nullptr;
} if (aFrame) {
result = GetNextSiblingInner(aFrame); if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result); if (IsPopupFrame(result) || IsInvokerOpenPopoverFrame(result)) {
result = GetNextSibling(result);
}
}
}
return result;
}
nsIFrame* nsFrameIterator::GetPrevSibling(nsIFrame* aFrame) {
nsIFrame* result = nullptr; if (mFollowOOFs) {
aFrame = GetPlaceholderFrame(aFrame);
} if (aFrame == mLimiter) { return nullptr;
} if (aFrame) {
result = GetPrevSiblingInner(aFrame); if (result && mFollowOOFs) {
result = nsPlaceholderFrame::GetRealFrameFor(result); if (IsPopupFrame(result) || IsInvokerOpenPopoverFrame(result)) {
result = GetPrevSibling(result);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.