本文整理汇总了C++中WebFrame::dataSource方法的典型用法代码示例。如果您正苦于以下问题:C++ WebFrame::dataSource方法的具体用法?C++ WebFrame::dataSource怎么用?C++ WebFrame::dataSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebFrame
的用法示例。
在下文中一共展示了WebFrame::dataSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAddressBar
void WebViewHost::updateAddressBar(WebView* webView)
{
WebFrame* mainFrame = webView->mainFrame();
WebDataSource* dataSource = mainFrame->dataSource();
if (!dataSource)
dataSource = mainFrame->provisionalDataSource();
if (!dataSource)
return;
setAddressBarURL(dataSource->request().url());
}
示例2: registerMockedHttpURLLoad
TEST_F(WebFrameTest, IframeRedirect)
{
registerMockedHttpURLLoad("iframe_redirect.html");
registerMockedHttpURLLoad("visible_iframe.html");
WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
webkit_support::RunAllPendingMessages(); // Queue the iframe.
webkit_support::ServeAsynchronousMockedRequests(); // Load the iframe.
WebFrame* iframe = webView->findFrameByName(WebString::fromUTF8("ifr"));
ASSERT_TRUE(iframe);
WebDataSource* iframeDataSource = iframe->dataSource();
ASSERT_TRUE(iframeDataSource);
WebVector<WebURL> redirects;
iframeDataSource->redirectChain(redirects);
ASSERT_EQ(2U, redirects.size());
EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data()));
EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data()));
webView->close();
}
示例3: dump
void TestShell::dump()
{
WebScriptController::flushConsoleMessages();
// Dump the requested representation.
WebFrame* frame = m_webView->mainFrame();
if (!frame)
return;
bool shouldDumpAsText = m_layoutTestController->shouldDumpAsText();
bool shouldDumpAsAudio = m_layoutTestController->shouldDumpAsAudio();
bool shouldGeneratePixelResults = m_layoutTestController->shouldGeneratePixelResults();
bool shouldDumpAsPrinted = m_layoutTestController->isPrinting();
bool dumpedAnything = false;
if (shouldDumpAsAudio) {
m_printer->handleAudioHeader();
const WebKit::WebArrayBufferView& webArrayBufferView = m_layoutTestController->audioData();
printf("Content-Length: %d\n", webArrayBufferView.byteLength());
if (fwrite(webArrayBufferView.baseAddress(), 1, webArrayBufferView.byteLength(), stdout) != webArrayBufferView.byteLength())
FATAL("Short write to stdout, disk full?\n");
printf("\n");
m_printer->handleTestFooter(true);
fflush(stdout);
fflush(stderr);
return;
}
if (m_params.dumpTree) {
dumpedAnything = true;
m_printer->handleTextHeader();
// Text output: the test page can request different types of output
// which we handle here.
if (!shouldDumpAsText) {
// Plain text pages should be dumped as text
string mimeType = frame->dataSource()->response().mimeType().utf8();
if (mimeType == "text/plain") {
shouldDumpAsText = true;
shouldGeneratePixelResults = false;
}
}
if (shouldDumpAsText) {
bool recursive = m_layoutTestController->shouldDumpChildFramesAsText();
string dataUtf8 = shouldDumpAsPrinted ? dumpFramesAsPrintedText(frame, recursive) : dumpFramesAsText(frame, recursive);
if (fwrite(dataUtf8.c_str(), 1, dataUtf8.size(), stdout) != dataUtf8.size())
FATAL("Short write to stdout, disk full?\n");
} else {
WebFrame::RenderAsTextControls renderTextBehavior = WebFrame::RenderAsTextNormal;
if (shouldDumpAsPrinted)
renderTextBehavior |= WebFrame::RenderAsTextPrinting;
if (m_params.debugRenderTree)
renderTextBehavior |= WebFrame::RenderAsTextDebug;
printf("%s", frame->renderTreeAsText(renderTextBehavior).utf8().data());
bool recursive = m_layoutTestController->shouldDumpChildFrameScrollPositions();
dumpFrameScrollPosition(frame, recursive);
}
if (m_layoutTestController->shouldDumpBackForwardList())
printf("%s", dumpAllBackForwardLists().c_str());
}
if (dumpedAnything && m_params.printSeparators)
m_printer->handleTextFooter();
if (m_params.dumpPixels && shouldGeneratePixelResults) {
// Image output: we write the image data to the file given on the
// command line (for the dump pixels argument), and the MD5 sum to
// stdout.
dumpedAnything = true;
m_webView->layout();
if (m_layoutTestController->testRepaint()) {
WebSize viewSize = m_webView->size();
int width = viewSize.width;
int height = viewSize.height;
if (m_layoutTestController->sweepHorizontally()) {
for (WebRect column(0, 0, 1, height); column.x < width; column.x++)
m_webViewHost->paintRect(column);
} else {
for (WebRect line(0, 0, width, 1); line.y < height; line.y++)
m_webViewHost->paintRect(line);
}
} else if (m_layoutTestController->isPrinting())
m_webViewHost->paintPagesWithBoundaries();
else
m_webViewHost->paintInvalidatedRegion();
// See if we need to draw the selection bounds rect. Selection bounds
// rect is the rect enclosing the (possibly transformed) selection.
// The rect should be drawn after everything is laid out and painted.
if (m_layoutTestController->shouldDumpSelectionRect()) {
// If there is a selection rect - draw a red 1px border enclosing rect
WebRect wr = frame->selectionBoundsRect();
if (!wr.isEmpty()) {
// Render a red rectangle bounding selection rect
SkPaint paint;
paint.setColor(0xFFFF0000); // Fully opaque red
paint.setStyle(SkPaint::kStroke_Style);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setStrokeWidth(1.0f);
//.........这里部分代码省略.........