本文整理汇总了C++中OwnPtrWillBeRawPtr::frameHost方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnPtrWillBeRawPtr::frameHost方法的具体用法?C++ OwnPtrWillBeRawPtr::frameHost怎么用?C++ OwnPtrWillBeRawPtr::frameHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnPtrWillBeRawPtr
的用法示例。
在下文中一共展示了OwnPtrWillBeRawPtr::frameHost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataChanged
bool SVGImage::dataChanged(bool allDataReceived)
{
TRACE_EVENT0("blink", "SVGImage::dataChanged");
// Don't do anything if is an empty image.
if (!data()->size())
return true;
if (allDataReceived) {
// SVGImage will fire events (and the default C++ handlers run) but doesn't
// actually allow script to run so it's fine to call into it. We allow this
// since it means an SVG data url can synchronously load like other image
// types.
EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFrameLoaderClient, (EmptyFrameLoaderClient::create()));
if (m_page) {
toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString::ConstructFromLiteral),
AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), ForceSynchronousLoad)));
return true;
}
Page::PageClients pageClients;
fillWithEmptyClients(pageClients);
m_chromeClient = SVGImageChromeClient::create(this);
pageClients.chromeClient = m_chromeClient.get();
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The Cache code does not know about ImageResources holding Frames and
// won't know to break the cycle.
// This will become an issue when SVGImage will be able to load other
// SVGImage objects, but we're safe now, because SVGImage can only be
// loaded by a top-level document.
OwnPtrWillBeRawPtr<Page> page;
{
TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage");
page = Page::create(pageClients);
page->settings().setScriptEnabled(false);
page->settings().setPluginsEnabled(false);
page->settings().setAcceleratedCompositingEnabled(false);
// Because this page is detached, it can't get default font settings
// from the embedder. Copy over font settings so we have sensible
// defaults. These settings are fixed and will not update if changed.
if (!Page::ordinaryPages().isEmpty()) {
Settings& defaultSettings = (*Page::ordinaryPages().begin())->settings();
page->settings().genericFontFamilySettings() = defaultSettings.genericFontFamilySettings();
page->settings().setMinimumFontSize(defaultSettings.minimumFontSize());
page->settings().setMinimumLogicalFontSize(defaultSettings.minimumLogicalFontSize());
page->settings().setDefaultFontSize(defaultSettings.defaultFontSize());
page->settings().setDefaultFixedFontSize(defaultSettings.defaultFixedFontSize());
}
}
RefPtrWillBeRawPtr<LocalFrame> frame = nullptr;
{
TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame");
frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->frameHost(), 0);
frame->setView(FrameView::create(frame.get()));
frame->init();
}
FrameLoader& loader = frame->loader();
loader.forceSandboxFlags(SandboxAll);
frame->view()->setScrollbarsSuppressed(true);
frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars.
frame->view()->setTransparent(true); // SVG Images are transparent.
m_page = page.release();
TRACE_EVENT0("blink", "SVGImage::dataChanged::load");
loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString::ConstructFromLiteral),
AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), ForceSynchronousLoad)));
// Set the intrinsic size before a container size is available.
m_intrinsicSize = containerSize();
}
return m_page;
}