mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add new FrameTest.* unit tests and fix discovered CefFrame-related bugs.
- Allow empty |name| argument to CefBrowser::GetFrame. This will return the main frame. - Modify CefBrowser::GetFrame to search both assigned and unique frame names. - Calling CefFrame::IsFocused on the main frame should return true when there are no other frames. - Fix CefBrowser::GetFrameIdentifiers and GetFrameNames to return correct values in the renderer process (issue #1236). - Delete NavigationTest.FrameNameIdent which is now obsoleted by the new FrameTests. git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2062@1843 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -26,6 +26,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "third_party/WebKit/public/web/WebViewClient.h"
|
||||
|
||||
#include "third_party/WebKit/Source/core/dom/Node.h"
|
||||
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
|
||||
#include "third_party/WebKit/Source/web/WebViewImpl.h"
|
||||
MSVC_POP_WARNING();
|
||||
#undef LOG
|
||||
@@ -94,4 +95,30 @@ int64 GetIdentifier(blink::WebFrame* frame) {
|
||||
return kInvalidFrameId;
|
||||
}
|
||||
|
||||
// Based on WebViewImpl::findFrameByName and FrameTree::find.
|
||||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||
blink::WebFrame* relative_to_frame) {
|
||||
WebCore::Frame* start_frame = toWebLocalFrameImpl(relative_to_frame)->frame();
|
||||
if (!start_frame)
|
||||
return NULL;
|
||||
|
||||
const AtomicString& atomic_name = unique_name;
|
||||
WebCore::Frame* found_frame = NULL;
|
||||
|
||||
// Search the subtree starting with |start_frame|.
|
||||
for (WebCore::Frame* frame = start_frame;
|
||||
frame;
|
||||
frame = frame->tree().traverseNext(start_frame)) {
|
||||
if (frame->tree().uniqueName() == atomic_name) {
|
||||
found_frame = frame;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_frame && found_frame->isLocalFrame())
|
||||
return blink::WebLocalFrameImpl::fromFrame(toLocalFrame(found_frame));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // webkit_glue
|
||||
|
Reference in New Issue
Block a user