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


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

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


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

示例1: update

void PageOverlay::update() {
  if (!m_frameImpl->frameWidget()->isAcceleratedCompositingActive())
    return;

  LocalFrame* frame = m_frameImpl->frame();
  if (!frame)
    return;

  if (!m_layer) {
    m_layer = GraphicsLayer::create(this);
    m_layer->setDrawsContent(true);

    if (WebDevToolsAgentImpl* devTools = m_frameImpl->devToolsAgentImpl())
      devTools->willAddPageOverlay(m_layer.get());

    // This is required for contents of overlay to stay in sync with the page
    // while scrolling.
    WebLayer* platformLayer = m_layer->platformLayer();
    platformLayer->addMainThreadScrollingReasons(
        MainThreadScrollingReason::kPageOverlay);
    if (frame->isMainFrame()) {
      frame->host()->visualViewport().containerLayer()->addChild(m_layer.get());
    } else {
      toWebFrameWidgetImpl(m_frameImpl->frameWidget())
          ->rootGraphicsLayer()
          ->addChild(m_layer.get());
    }
  }

  FloatSize size(frame->host()->visualViewport().size());
  if (size != m_layer->size())
    m_layer->setSize(size);

  m_layer->setNeedsDisplay();
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: unmuteMetrics

void MainThreadDebugger::unmuteMetrics(int contextGroupId) {
  LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
  if (frame && frame->host()) {
    frame->host()->useCounter().unmuteForInspector();
    frame->host()->deprecation().unmuteForInspector();
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:7,代码来源:MainThreadDebugger.cpp

示例3: scheduleUpdate

void InspectorOverlay::scheduleUpdate() {
  if (isEmpty()) {
    if (m_pageOverlay)
      m_pageOverlay.reset();
    return;
  }
  m_needsUpdate = true;
  FrameView* view = m_frameImpl->frameView();
  LocalFrame* frame = m_frameImpl->frame();
  if (view && frame)
    frame->host()->chromeClient().scheduleAnimation(view);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: consoleAPIMessage

void MainThreadDebugger::consoleAPIMessage(
    int contextGroupId,
    v8_inspector::V8ConsoleAPIType type,
    const v8_inspector::StringView& message,
    const v8_inspector::StringView& url,
    unsigned lineNumber,
    unsigned columnNumber,
    v8_inspector::V8StackTrace* stackTrace) {
  LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
  if (!frame)
    return;
  if (type == v8_inspector::V8ConsoleAPIType::kClear && frame->host())
    frame->host()->consoleMessageStorage().clear();
  // TODO(dgozman): we can save a copy of message and url here by making
  // FrameConsole work with StringView.
  std::unique_ptr<SourceLocation> location =
      SourceLocation::create(toCoreString(url), lineNumber, columnNumber,
                             stackTrace ? stackTrace->clone() : nullptr, 0);
  frame->console().reportMessageToClient(ConsoleAPIMessageSource,
                                         consoleAPITypeToMessageLevel(type),
                                         toCoreString(message), location.get());
}
开发者ID:mirror,项目名称:chromium,代码行数:22,代码来源:MainThreadDebugger.cpp

示例5: callingDOMWindow

AtomicString V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
{
    v8::Handle<v8::Function> lookupNamespaceURIFunc;
    v8::Handle<v8::String> lookupNamespaceURIName = v8AtomicString(m_isolate, "lookupNamespaceURI");

    // Check if the resolver has a function property named lookupNamespaceURI.
    if (m_resolver->Has(lookupNamespaceURIName)) {
        v8::Handle<v8::Value> lookupNamespaceURI = m_resolver->Get(lookupNamespaceURIName);
        if (lookupNamespaceURI->IsFunction())
            lookupNamespaceURIFunc = v8::Handle<v8::Function>::Cast(lookupNamespaceURI);
    }

    if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
        LocalFrame* frame = callingDOMWindow(m_isolate)->frame();
        if (frame && frame->host())
            frame->host()->console().addMessage(JSMessageSource, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.");
        return nullAtom;
    }

    // Catch exceptions from calling the namespace resolver.
    v8::TryCatch tryCatch;
    tryCatch.SetVerbose(true); // Print exceptions to console.

    const int argc = 1;
    v8::Handle<v8::Value> argv[argc] = { v8String(m_isolate, prefix) };
    v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc;

    v8::Handle<v8::Value> retval = ScriptController::callFunction(callingExecutionContext(m_isolate), function, m_resolver, argc, argv, m_isolate);

    // Eat exceptions from namespace resolver and return an empty string. This will most likely cause NamespaceError.
    if (tryCatch.HasCaught())
        return nullAtom;

    V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, returnString, retval, nullAtom);
    return returnString;
}
开发者ID:Mihiri,项目名称:blink,代码行数:36,代码来源:V8CustomXPathNSResolver.cpp

示例6: tryCatch

AtomicString V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix) {
  v8::Isolate* isolate = m_scriptState->isolate();
  v8::Local<v8::Function> lookupNamespaceURIFunc;
  v8::Local<v8::String> lookupNamespaceURIName =
      v8AtomicString(isolate, "lookupNamespaceURI");

  // Check if the resolver has a function property named lookupNamespaceURI.
  v8::Local<v8::Value> lookupNamespaceURI;
  if (m_resolver->Get(m_scriptState->context(), lookupNamespaceURIName)
          .ToLocal(&lookupNamespaceURI) &&
      lookupNamespaceURI->IsFunction())
    lookupNamespaceURIFunc = v8::Local<v8::Function>::Cast(lookupNamespaceURI);

  if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
    LocalFrame* frame =
        toLocalDOMWindow(toDOMWindow(m_scriptState->context()))->frame();
    if (frame && frame->host())
      frame->console().addMessage(ConsoleMessage::create(
          JSMessageSource, ErrorMessageLevel,
          "XPathNSResolver does not have a lookupNamespaceURI method."));
    return nullAtom;
  }

  // Catch exceptions from calling the namespace resolver.
  v8::TryCatch tryCatch(isolate);
  tryCatch.SetVerbose(true);  // Print exceptions to console.

  const int argc = 1;
  v8::Local<v8::Value> argv[argc] = {v8String(isolate, prefix)};
  v8::Local<v8::Function> function =
      lookupNamespaceURIFunc.IsEmpty()
          ? v8::Local<v8::Function>::Cast(m_resolver)
          : lookupNamespaceURIFunc;

  v8::Local<v8::Value> retval;
  // Eat exceptions from namespace resolver and return an empty string. This
  // will most likely cause NamespaceError.
  if (!V8ScriptRunner::callFunction(
           function, toExecutionContext(m_scriptState->context()), m_resolver,
           argc, argv, isolate)
           .ToLocal(&retval))
    return nullAtom;

  TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, returnString,
                   retval, nullAtom);
  return returnString;
}
开发者ID:mirror,项目名称:chromium,代码行数:47,代码来源:V8CustomXPathNSResolver.cpp

示例7: rebuildOverlayPage

void InspectorOverlay::rebuildOverlayPage() {
  FrameView* view = m_frameImpl->frameView();
  LocalFrame* frame = m_frameImpl->frame();
  if (!view || !frame)
    return;

  IntRect visibleRectInDocument =
      view->getScrollableArea()->visibleContentRect();
  IntSize viewportSize = frame->host()->visualViewport().size();
  overlayMainFrame()->view()->resize(viewportSize);
  overlayPage()->frameHost().visualViewport().setSize(viewportSize);
  overlayMainFrame()->setPageZoomFactor(windowToViewportScale());

  reset(viewportSize, visibleRectInDocument.location());

  if (m_showReloadingBlanket) {
    evaluateInOverlay("showReloadingBlanket", "");
    return;
  }
  drawNodeHighlight();
  drawQuadHighlight();
  drawPausedInDebuggerMessage();
  drawViewSize();
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例8: windowToViewportScale

float InspectorOverlay::windowToViewportScale() const {
  LocalFrame* frame = m_frameImpl->frame();
  if (!frame)
    return 1.0f;
  return frame->host()->chromeClient().windowToViewportScalar(1.0f);
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例9: showContextMenu

void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultMenu)
{
    // Displaying the context menu in this function is a big hack as we don't
    // have context, i.e. whether this is being invoked via a script or in
    // response to user input (Mouse event WM_RBUTTONDOWN,
    // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked
    // in response to the above input events before popping up the context menu.
    if (!m_webView->contextMenuAllowed())
        return;

    HitTestResult r = m_webView->page()->contextMenuController().hitTestResult();
    LocalFrame* selectedFrame = r.innerNodeFrame();

    WebContextMenuData data;
    IntPoint mousePoint = selectedFrame->view()->contentsToWindow(r.roundedPointInInnerNodeFrame());

    // FIXME(bokan): crbug.com/371902 - We shouldn't be making these scale
    // related coordinate transformatios in an ad hoc way.
    PinchViewport& pinchViewport = selectedFrame->host()->pinchViewport();
    mousePoint -= flooredIntSize(pinchViewport.visibleRect().location());
    mousePoint.scale(m_webView->pageScaleFactor(), m_webView->pageScaleFactor());
    data.mousePosition = mousePoint;

    // Compute edit flags.
    data.editFlags = WebContextMenuData::CanDoNone;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canUndo())
        data.editFlags |= WebContextMenuData::CanUndo;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canRedo())
        data.editFlags |= WebContextMenuData::CanRedo;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCut())
        data.editFlags |= WebContextMenuData::CanCut;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCopy())
        data.editFlags |= WebContextMenuData::CanCopy;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canPaste())
        data.editFlags |= WebContextMenuData::CanPaste;
    if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete())
        data.editFlags |= WebContextMenuData::CanDelete;
    // We can always select all...
    data.editFlags |= WebContextMenuData::CanSelectAll;
    data.editFlags |= WebContextMenuData::CanTranslate;

    // Links, Images, Media tags, and Image/Media-Links take preference over
    // all else.
    data.linkURL = r.absoluteLinkURL();

    if (isHTMLCanvasElement(r.innerNonSharedNode())) {
        data.mediaType = WebContextMenuData::MediaTypeCanvas;
    } else if (!r.absoluteImageURL().isEmpty()) {
        data.srcURL = r.absoluteImageURL();
        data.mediaType = WebContextMenuData::MediaTypeImage;
        data.mediaFlags |= WebContextMenuData::MediaCanPrint;
    } else if (!r.absoluteMediaURL().isEmpty()) {
        data.srcURL = r.absoluteMediaURL();

        // We know that if absoluteMediaURL() is not empty, then this
        // is a media element.
        HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNonSharedNode());
        if (isHTMLVideoElement(*mediaElement))
            data.mediaType = WebContextMenuData::MediaTypeVideo;
        else if (isHTMLAudioElement(*mediaElement))
            data.mediaType = WebContextMenuData::MediaTypeAudio;

        if (mediaElement->error())
            data.mediaFlags |= WebContextMenuData::MediaInError;
        if (mediaElement->paused())
            data.mediaFlags |= WebContextMenuData::MediaPaused;
        if (mediaElement->muted())
            data.mediaFlags |= WebContextMenuData::MediaMuted;
        if (mediaElement->loop())
            data.mediaFlags |= WebContextMenuData::MediaLoop;
        if (mediaElement->supportsSave())
            data.mediaFlags |= WebContextMenuData::MediaCanSave;
        if (mediaElement->hasAudio())
            data.mediaFlags |= WebContextMenuData::MediaHasAudio;
        // Media controls can be toggled only for video player. If we toggle
        // controls for audio then the player disappears, and there is no way to
        // return it back. Don't set this bit for fullscreen video, since
        // toggling is ignored in that case.
        if (mediaElement->hasVideo() && !mediaElement->isFullscreen())
            data.mediaFlags |= WebContextMenuData::MediaCanToggleControls;
        if (mediaElement->controls())
            data.mediaFlags |= WebContextMenuData::MediaControls;
    } else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElement(*r.innerNonSharedNode())) {
        RenderObject* object = r.innerNonSharedNode()->renderer();
        if (object && object->isWidget()) {
            Widget* widget = toRenderWidget(object)->widget();
            if (widget && widget->isPluginContainer()) {
                data.mediaType = WebContextMenuData::MediaTypePlugin;
                WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget);
                WebString text = plugin->plugin()->selectionAsText();
                if (!text.isEmpty()) {
                    data.selectedText = text;
                    data.editFlags |= WebContextMenuData::CanCopy;
                }
                data.editFlags &= ~WebContextMenuData::CanTranslate;
                data.linkURL = plugin->plugin()->linkAtPosition(data.mousePosition);
                if (plugin->plugin()->supportsPaginatedPrint())
                    data.mediaFlags |= WebContextMenuData::MediaCanPrint;

                HTMLPlugInElement* pluginElement = toHTMLPlugInElement(r.innerNonSharedNode());
//.........这里部分代码省略.........
开发者ID:ewilligers,项目名称:blink,代码行数:101,代码来源:ContextMenuClientImpl.cpp


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