本文整理汇总了C++中HTMLFrameOwnerElement::setContentFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFrameOwnerElement::setContentFrame方法的具体用法?C++ HTMLFrameOwnerElement::setContentFrame怎么用?C++ HTMLFrameOwnerElement::setContentFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFrameOwnerElement
的用法示例。
在下文中一共展示了HTMLFrameOwnerElement::setContentFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: swap
bool WebFrame::swap(WebFrame* frame)
{
using std::swap;
RefPtrWillBeRawPtr<Frame> oldFrame = toCoreFrame(this);
// All child frames must be detached first.
oldFrame->detachChildren();
// If the frame has been detached during detaching its children, return
// immediately.
// FIXME: There is no unit test for this condition, so one needs to be
// written.
if (!oldFrame->host())
return false;
if (m_parent) {
if (m_parent->m_firstChild == this)
m_parent->m_firstChild = frame;
if (m_parent->m_lastChild == this)
m_parent->m_lastChild = frame;
swap(m_parent, frame->m_parent);
}
if (m_previousSibling) {
m_previousSibling->m_nextSibling = frame;
swap(m_previousSibling, frame->m_previousSibling);
}
if (m_nextSibling) {
m_nextSibling->m_previousSibling = frame;
swap(m_nextSibling, frame->m_nextSibling);
}
if (m_opener) {
m_opener->m_openedFrameTracker->remove(this);
m_opener->m_openedFrameTracker->add(frame);
swap(m_opener, frame->m_opener);
}
if (!m_openedFrameTracker->isEmpty()) {
m_openedFrameTracker->updateOpener(frame);
frame->m_openedFrameTracker.reset(m_openedFrameTracker.release());
}
// Finally, clone the state of the current Frame into one matching
// the type of the passed in WebFrame.
// FIXME: This is a bit clunky; this results in pointless decrements and
// increments of connected subframes.
FrameOwner* owner = oldFrame->owner();
oldFrame->disconnectOwnerElement();
if (Frame* newFrame = toCoreFrame(frame)) {
ASSERT(owner == newFrame->owner());
if (owner->isLocal()) {
HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(owner);
ownerElement->setContentFrame(*newFrame);
if (newFrame->isLocalFrame())
ownerElement->setWidget(toLocalFrame(newFrame)->view());
}
} else if (frame->isWebLocalFrame()) {
toWebLocalFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name(), nullAtom);
} else {
toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name());
}
return true;
}