当前位置: 首页>>代码示例>>C++>>正文


C++ LocalFrame::init方法代码示例

本文整理汇总了C++中LocalFrame::init方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalFrame::init方法的具体用法?C++ LocalFrame::init怎么用?C++ LocalFrame::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocalFrame的用法示例。


在下文中一共展示了LocalFrame::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initializePage

bool WebPagePopupImpl::initializePage() {
  Page::PageClients pageClients;
  fillWithEmptyClients(pageClients);
  m_chromeClient = PagePopupChromeClient::create(this);
  pageClients.chromeClient = m_chromeClient.get();

  Settings& mainSettings = m_webView->page()->settings();
  m_page = Page::create(pageClients);
  m_page->settings().setScriptEnabled(true);
  m_page->settings().setAllowScriptsToCloseWindows(true);
  m_page->settings().setDeviceSupportsTouch(mainSettings.deviceSupportsTouch());
  m_page->settings().setMinimumFontSize(mainSettings.minimumFontSize());
  m_page->settings().setMinimumLogicalFontSize(
      mainSettings.minimumLogicalFontSize());
  // FIXME: Should we support enabling a11y while a popup is shown?
  m_page->settings().setAccessibilityEnabled(
      mainSettings.accessibilityEnabled());
  m_page->settings().setScrollAnimatorEnabled(
      mainSettings.scrollAnimatorEnabled());

  provideContextFeaturesTo(*m_page, WTF::makeUnique<PagePopupFeaturesClient>());
  DEFINE_STATIC_LOCAL(FrameLoaderClient, emptyFrameLoaderClient,
                      (EmptyFrameLoaderClient::create()));
  LocalFrame* frame =
      LocalFrame::create(&emptyFrameLoaderClient, &m_page->frameHost(), 0);
  frame->setPagePopupOwner(m_popupClient->ownerElement());
  frame->setView(FrameView::create(*frame));
  frame->init();
  frame->view()->setParentVisible(true);
  frame->view()->setSelfVisible(true);
  frame->view()->setTransparent(false);
  if (AXObjectCache* cache =
          m_popupClient->ownerElement().document().existingAXObjectCache())
    cache->childrenChanged(&m_popupClient->ownerElement());

  DCHECK(frame->domWindow());
  PagePopupSupplement::install(*frame, *this, m_popupClient);
  DCHECK_EQ(m_popupClient->ownerElement().document().existingAXObjectCache(),
            frame->document()->existingAXObjectCache());

  RefPtr<SharedBuffer> data = SharedBuffer::create();
  m_popupClient->writeDocument(data.get());
  frame->loader().load(FrameLoadRequest(
      0, blankURL(), SubstituteData(data, "text/html", "UTF-8", KURL(),
                                    ForceSynchronousLoad)));
  frame->setPageZoomFactor(m_popupClient->zoomFactor());
  return true;
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例2: overlayPage

Page* InspectorOverlay::overlayPage() {
  if (m_overlayPage)
    return m_overlayPage.get();

  ScriptForbiddenScope::AllowUserAgentScript allowScript;

  DEFINE_STATIC_LOCAL(FrameLoaderClient, dummyFrameLoaderClient,
                      (EmptyFrameLoaderClient::create()));
  Page::PageClients pageClients;
  fillWithEmptyClients(pageClients);
  DCHECK(!m_overlayChromeClient);
  m_overlayChromeClient = InspectorOverlayChromeClient::create(
      m_frameImpl->frame()->host()->chromeClient(), *this);
  pageClients.chromeClient = m_overlayChromeClient.get();
  m_overlayPage = Page::create(pageClients);

  Settings& settings = m_frameImpl->frame()->host()->settings();
  Settings& overlaySettings = m_overlayPage->settings();

  overlaySettings.genericFontFamilySettings().updateStandard(
      settings.genericFontFamilySettings().standard());
  overlaySettings.genericFontFamilySettings().updateSerif(
      settings.genericFontFamilySettings().serif());
  overlaySettings.genericFontFamilySettings().updateSansSerif(
      settings.genericFontFamilySettings().sansSerif());
  overlaySettings.genericFontFamilySettings().updateCursive(
      settings.genericFontFamilySettings().cursive());
  overlaySettings.genericFontFamilySettings().updateFantasy(
      settings.genericFontFamilySettings().fantasy());
  overlaySettings.genericFontFamilySettings().updatePictograph(
      settings.genericFontFamilySettings().pictograph());
  overlaySettings.setMinimumFontSize(settings.minimumFontSize());
  overlaySettings.setMinimumLogicalFontSize(settings.minimumLogicalFontSize());
  overlaySettings.setScriptEnabled(true);
  overlaySettings.setPluginsEnabled(false);
  overlaySettings.setLoadsImagesAutomatically(true);
  // FIXME: http://crbug.com/363843. Inspector should probably create its
  // own graphics layers and attach them to the tree rather than going
  // through some non-composited paint function.
  overlaySettings.setAcceleratedCompositingEnabled(false);

  LocalFrame* frame = LocalFrame::create(&dummyFrameLoaderClient,
                                         &m_overlayPage->frameHost(), 0);
  frame->setView(FrameView::create(*frame));
  frame->init();
  FrameLoader& loader = frame->loader();
  frame->view()->setCanHaveScrollbars(false);
  frame->view()->setTransparent(true);

  const WebData& overlayPageHTMLResource =
      Platform::current()->loadResource("InspectorOverlayPage.html");
  RefPtr<SharedBuffer> data = SharedBuffer::create(
      overlayPageHTMLResource.data(), overlayPageHTMLResource.size());
  loader.load(FrameLoadRequest(
      0, blankURL(), SubstituteData(data, "text/html", "UTF-8", KURL(),
                                    ForceSynchronousLoad)));
  v8::Isolate* isolate = toIsolate(frame);
  ScriptState* scriptState = ScriptState::forMainWorld(frame);
  DCHECK(scriptState);
  ScriptState::Scope scope(scriptState);
  v8::Local<v8::Object> global = scriptState->context()->Global();
  v8::Local<v8::Value> overlayHostObj =
      toV8(m_overlayHost.get(), global, isolate);
  DCHECK(!overlayHostObj.IsEmpty());
  global
      ->Set(scriptState->context(),
            v8AtomicString(isolate, "InspectorOverlayHost"), overlayHostObj)
      .ToChecked();

#if OS(WIN)
  evaluateInOverlay("setPlatform", "windows");
#elif OS(MACOSX)
  evaluateInOverlay("setPlatform", "mac");
#elif OS(POSIX)
  evaluateInOverlay("setPlatform", "linux");
#endif

  return m_overlayPage.get();
}
开发者ID:,项目名称:,代码行数:79,代码来源:


注:本文中的LocalFrame::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。