本文整理汇总了C++中webcore::Frame::tree方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::tree方法的具体用法?C++ Frame::tree怎么用?C++ Frame::tree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Frame
的用法示例。
在下文中一共展示了Frame::tree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printFrames
static void printFrames(const WebCore::Frame& frame, const WebCore::Frame* targetFrame, int indent)
{
if (&frame == targetFrame) {
printf("--> ");
printIndent(indent - 1);
} else
printIndent(indent);
WebCore::FrameView* view = frame.view();
printf("Frame %p %dx%d\n", &frame, view ? view->width() : 0, view ? view->height() : 0);
printIndent(indent);
printf(" ownerElement=%p\n", frame.ownerElement());
printIndent(indent);
printf(" frameView=%p (needs layout %d)\n", view, view ? view->needsLayout() : false);
printIndent(indent);
printf(" renderView=%p\n", view ? view->renderView() : nullptr);
printIndent(indent);
printf(" ownerRenderer=%p\n", frame.ownerRenderer());
printIndent(indent);
printf(" document=%p (needs style recalc %d)\n", frame.document(), frame.document() ? frame.document()->childNeedsStyleRecalc() : false);
printIndent(indent);
printf(" uri=%s\n", frame.document()->documentURI().utf8().data());
for (WebCore::Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
printFrames(*child, targetFrame, indent + 1);
}
示例2: ASSERT
PassRefPtr<Frame> FrameLoaderClientEfl::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool /*allowsScrolling*/, int /*marginWidth*/, int /*marginHeight*/)
{
ASSERT(m_frame);
ASSERT(m_view);
Evas_Object* subFrame = ewk_frame_child_add(m_frame, name, ownerElement);
if (!subFrame)
return 0;
WebCore::Frame* coreSubFrame = EWKPrivate::coreFrame(subFrame);
ASSERT(coreSubFrame);
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
if (!coreSubFrame->page()) {
evas_object_del(subFrame);
return 0;
}
evas_object_smart_callback_call(m_view, "frame,created", subFrame);
EWKPrivate::coreFrame(m_frame)->loader().loadURLIntoChildFrame(url, referrer, coreSubFrame);
// The frame's onload handler may have removed it from the document.
// See fast/dom/null-page-show-modal-dialog-crash.html for an example.
if (!coreSubFrame->tree().parent()) {
evas_object_del(subFrame);
return 0;
}
ewk_view_frame_rect_changed(m_view);
return coreSubFrame;
}
示例3: ClickElementsByIdOrClass
bool ViewNavigationDelegate::ClickElementsByIdOrClass(const char* idOrClassName)
{
EAW_ASSERT(idOrClassName);
if(!idOrClassName || !idOrClassName[0])
return false;
IOverlayInputClient* pOverlayInputClient = mView->GetOverlayInputClient();
if(pOverlayInputClient)
pOverlayInputClient->OnFocusChangeEvent(false);
bool elementClicked = false;
WebCore::Frame* pFrame = mView->GetFrame();
while(pFrame)
{
WebCore::Document* document = pFrame->document();
EAW_ASSERT(document);
ClickElementsByIdOrClassDelegate delegate(idOrClassName, true);
DOMWalker<ClickElementsByIdOrClassDelegate> walker(document, delegate);
elementClicked = delegate.GetReturnValue();
if(elementClicked)
break;
pFrame = pFrame->tree()->traverseNext();
}
return elementClicked;
}
示例4: JumpToId
bool ViewNavigationDelegate::JumpToId(const char* jumpToId)
{
WebCore::Frame* pFrame = mView->GetFrame();
// Search for the desired element in all the frames
while(pFrame)
{
WebCore::Document* document = pFrame->document();
EAW_ASSERT(document);
if (document)
{
JumpToElementWithIdDelegate delegate1(mView, jumpToId);
DOMWalker<JumpToElementWithIdDelegate> walker(document, delegate1);
WebCore::Element* element = delegate1.FoundElement();
if (element)
{
return true;
}
}
pFrame = pFrame->tree()->traverseNext();
}
return false;
}
示例5: traverseNext
WebFrame* WebFrame::traverseNext(bool wrap) const
{
WebCore::Frame* frame = toWebCoreFrame(this);
if (!frame)
return 0;
return fromFrame(frame->tree().traverseNextWithWrap(wrap));
}
示例6: retrieveCachedResource
// SAMSUNG CHANGE : CopyImage >>
// Copy Image Issue on Nested Frame
CachedResource *retrieveCachedResource(Frame* frame, String imageUrl)
{
if (NULL == frame || imageUrl.isEmpty())
return NULL;
FrameTree *frameTree = frame->tree();
if (!frameTree)
return frame->document()->cachedResourceLoader()->cachedResource(imageUrl);
WebCore::Frame *childFrame = frameTree->firstChild();
Document *childFrameDocument = NULL;
CachedResource* cachedResource = NULL;
while (childFrame)
{
childFrameDocument = childFrame->document();
if (childFrameDocument)
{
cachedResource = childFrameDocument->cachedResourceLoader()->cachedResource(imageUrl);
if (cachedResource)
break;
}
cachedResource = retrieveCachedResource(childFrame, imageUrl);
if (cachedResource)
break;
childFrame = childFrame->tree()->nextSibling();
}
if (cachedResource)
return cachedResource;
else
return frame->document()->cachedResourceLoader()->cachedResource(imageUrl);
}
开发者ID:johnwpoliver,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:34,代码来源:PasteBoardAndroid.cpp
示例7: findChildByName
WebFrame* WebFrame::findChildByName(const WebString& name) const
{
WebCore::Frame* frame = toWebCoreFrame(this);
if (!frame)
return 0;
// FIXME: It's not clear this should ever be called to find a remote frame.
// Perhaps just disallow that completely?
return fromFrame(frame->tree().child(name));
}
示例8: frameParent
WebCore::Frame* DumpRenderTreeSupportEfl::frameParent(const Evas_Object* ewkFrame)
{
WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
if (!frame)
return 0;
return frame->tree()->parent();
}
示例9: printFrames
static void printFrames(const WebCore::Frame& frame, const WebCore::Frame* targetFrame, int indent)
{
if (&frame == targetFrame) {
printf("--> ");
printIndent(indent - 1);
} else
printIndent(indent);
WebCore::FrameView* view = frame.view();
printf("Frame %p %dx%d\n", &frame, view ? view->width() : 0, view ? view->height() : 0);
printIndent(indent);
printf(" ownerElement=%p\n", frame.ownerElement());
printIndent(indent);
printf(" frameView=%p\n", view);
printIndent(indent);
printf(" document=%p\n", frame.document());
printIndent(indent);
printf(" uri=%s\n\n", frame.document()->documentURI().utf8().data());
for (WebCore::Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
printFrames(*child, targetFrame, indent + 1);
}
示例10: dumpFramesAsText
String DumpRenderTree::dumpFramesAsText(WebCore::Frame* frame)
{
String s;
WebCore::Element* documentElement = frame->document()->documentElement();
if (!documentElement)
return s.utf8().data();
if (frame->tree()->parent())
s = String::format("\n--------\nFrame: '%s'\n--------\n", frame->tree()->uniqueName().string().utf8().data());
s = s + documentElement->innerText() + "\n";
if (gTestRunner->dumpChildFramesAsText()) {
WebCore::FrameTree* tree = frame->tree();
for (WebCore::Frame* child = tree->firstChild(); child; child = child->tree()->nextSibling())
s = s + dumpFramesAsText(child);
}
return s;
}
示例11: ClickElementById
bool ViewNavigationDelegate::ClickElementById(const char* id)
{
EAW_ASSERT(id);
if(!id || !id[0])
return false;
IOverlayInputClient* pOverlayInputClient = mView->GetOverlayInputClient();
if(pOverlayInputClient)
pOverlayInputClient->OnFocusChangeEvent(false);
bool elementClicked = false;
WebCore::Frame* pFrame = mView->GetFrame();
while(pFrame)
{
WebCore::Document* document = pFrame->document();
EAW_ASSERT(document);
if (document)
{
WebCore::Element* element = document->getElementById(id);
if (element && element->isHTMLElement())
{
WebCore::HTMLElement* htmlElement = (WebCore::HTMLElement*)element;
htmlElement->click();
elementClicked = true;
}
}
if(elementClicked)
break;
pFrame = pFrame->tree()->traverseNext();
}
return elementClicked;
}
示例12: frameChildren
Eina_List* DumpRenderTreeSupportEfl::frameChildren(const Evas_Object* ewkFrame)
{
WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
if (!frame)
return 0;
Eina_List* childFrames = 0;
for (unsigned index = 0; index < frame->tree()->childCount(); index++) {
WebCore::Frame *childFrame = frame->tree()->child(index);
WebCore::FrameLoaderClientEfl *client = static_cast<WebCore::FrameLoaderClientEfl*>(childFrame->loader()->client());
if (!client)
continue;
childFrames = eina_list_append(childFrames, client->webFrame());
}
return childFrames;
}
示例13: WebHistoryClose
static void WebHistoryClose(JNIEnv* env, jobject obj, jint frame)
{
LOG_ASSERT(frame, "Close needs a valid Frame pointer!");
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
WebCore::BackForwardList* list = pFrame->page()->backForwardList();
RefPtr<WebCore::HistoryItem> current = list->currentItem();
// Remove each item instead of using close(). close() is intended to be used
// right before the list is deleted.
WebCore::HistoryItemVector& entries = list->entries();
int size = entries.size();
for (int i = size - 1; i >= 0; --i)
list->removeItem(entries[i].get());
// Add the current item back to the list.
if (current) {
current->setBridge(0);
// addItem will update the children to match the newly created bridge
list->addItem(current);
/*
* The Grand Prix site uses anchor navigations to change the display.
* WebKit tries to be smart and not load child frames that have the
* same history urls during an anchor navigation. This means that the
* current history item stored in the child frame's loader does not
* match the item found in the history tree. If we remove all the
* entries in the back/foward list, we have to restore the entire tree
* or else a HistoryItem might have a deleted parent.
*
* In order to restore the history tree correctly, we have to look up
* all the frames first and then look up the history item. We do this
* because the history item in the tree may be null at this point.
* Unfortunately, a HistoryItem can only search its immediately
* children so we do a breadth-first rebuild of the tree.
*/
// Keep a small list of child frames to traverse.
WTF::Vector<WebCore::Frame*> frameQueue;
// Fix the top-level item.
pFrame->loader()->history()->setCurrentItem(current.get());
WebCore::Frame* child = pFrame->tree()->firstChild();
// Remember the parent history item so we can search for a child item.
RefPtr<WebCore::HistoryItem> parent = current;
while (child) {
// Use the old history item since the current one may have a
// deleted parent.
WebCore::HistoryItem* item = parent->childItemWithTarget(child->tree()->name());
child->loader()->history()->setCurrentItem(item);
// Append the first child to the queue if it exists. If there is no
// item, then we do not need to traverse the children since there
// will be no parent history item.
WebCore::Frame* firstChild;
if (item && (firstChild = child->tree()->firstChild()))
frameQueue.append(firstChild);
child = child->tree()->nextSibling();
// If we don't have a sibling for this frame and the queue isn't
// empty, use the next entry in the queue.
if (!child && !frameQueue.isEmpty()) {
child = frameQueue.at(0);
frameQueue.remove(0);
// Figure out the parent history item used when searching for
// the history item to use.
parent = child->tree()->parent()->loader()->history()->currentItem();
}
}
}
}
示例14: JumpToNearestElement
//.........这里部分代码省略.........
float currentRadialDistance = FLT_MAX; // A high value to start with so that the max distance between any two elements in the surface is under it.
WebCore::Node* currentBestNode = NULL;
while(pFrame)
{
WebCore::Document* document = pFrame->document();
EAW_ASSERT(document);
if(document)
{
WebCore::FrameView* pFrameView = document->view();
WebCore::IntPoint scrollOffset;
if(pFrameView)
{
scrollOffset.setX(pFrameView->scrollOffset().width());
scrollOffset.setY(pFrameView->scrollOffset().height());
}
// We figure out the start position(It is center of the currently hovered element almost all the time but can be slightly different
// due to scroll sometimes).
mCentreX = lastX + scrollOffset.x();
mCentreY = lastY + scrollOffset.y();
DocumentNavigator navigator(mView, document, direction, WebCore::IntPoint(mCentreX, mCentreY), mBestNodeX, mBestNodeY, mBestNodeWidth, mBestNodeHeight, mJumpNavigationParams.mNavigationTheta, mJumpNavigationParams.mStrictAxesCheck, currentRadialDistance);
navigator.FindBestNode(document);
if(navigator.GetBestNode())
{
currentBestNode = navigator.GetBestNode();
currentRadialDistance = navigator.GetBestNodeRadialDistance();
}
}
pFrame = pFrame->tree()->traverseNext();
}
bool foundSomething = false;
if (currentBestNode) //We found the node to navigate. Move the cursor and we are done.
{
foundSomething = true;
MoveMouseCursorToNode(currentBestNode, false);
}
else if(scrollIfElementNotFound)// Node is not found.
{
// Based on the intended direction of movement, scroll so that some newer elements are visible.
int cursorPosBeforeScrollX, cursorPosBeforeScrollY;
mView->GetCursorPosition(cursorPosBeforeScrollX, cursorPosBeforeScrollY);
switch(direction)
{
case EA::WebKit::JumpDown:
{
ScrollOnJump(true, -120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
case EA::WebKit::JumpUp:
{
ScrollOnJump(true, 120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
case EA::WebKit::JumpRight:
{
ScrollOnJump(false, -120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
示例15: result
static char*
_dumpFramesAsText(LayoutTestController* controller, WebCore::Frame* in_core_frame, bool is_main_frame)
{
WTF::String result("");
// Add header for all but the main frame.
WebCore::FrameView* view = in_core_frame->view();
if (view && view->layoutPending())
view->layout();
WebCore::Element* document_element = in_core_frame->document()->documentElement();
WTF::String inner_text = document_element->innerText();
if (!is_main_frame) {
WTF::String frame_name(in_core_frame->tree().name());
result.append("\n--------\nFrame: '");
result.append(frame_name);
result.append("'\n--------\n");
}
result.append(inner_text);
result.append("\n");
if (controller->dumpChildFramesAsText()) {
for (WebCore::Frame* child = in_core_frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
char* tmp = _dumpFramesAsText(controller, child, false);
result.append(tmp);
free(tmp);
}
}
return strdup(result.utf8().data());
}