本文整理汇总了C++中HTMLPlugInElement::document方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLPlugInElement::document方法的具体用法?C++ HTMLPlugInElement::document怎么用?C++ HTMLPlugInElement::document使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPlugInElement
的用法示例。
在下文中一共展示了HTMLPlugInElement::document方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showContextMenu
//.........这里部分代码省略.........
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());
data.srcURL = pluginElement->document().completeURL(pluginElement->url());
data.mediaFlags |= WebContextMenuData::MediaCanSave;
// Add context menu commands that are supported by the plugin.
if (plugin->plugin()->canRotateView())
data.mediaFlags |= WebContextMenuData::MediaCanRotate;
}
}
}
// An image can to be null for many reasons, like being blocked, no image
// data received from server yet.
data.hasImageContents =
(data.mediaType == WebContextMenuData::MediaTypeImage)
&& r.image() && !(r.image()->isNull());
// If it's not a link, an image, a media element, or an image/media link,
// show a selection menu or a more generic page menu.
if (selectedFrame->document()->loader())
data.frameEncoding = selectedFrame->document()->encodingName();
// Send the frame and page URLs in any case.
data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
if (selectedFrame != m_webView->mainFrameImpl()->frame()) {
data.frameURL = urlFromFrame(selectedFrame);
RefPtr<HistoryItem> historyItem = selectedFrame->loader().currentItem();
if (historyItem)
data.frameHistoryItem = WebHistoryItem(historyItem);
}
if (r.isSelected()) {
if (!isHTMLInputElement(*r.innerNonSharedNode()) || !toHTMLInputElement(r.innerNonSharedNode())->isPasswordField())
data.selectedText = selectedFrame->selectedText().stripWhiteSpace();
示例2: npObjectInvokeDefaultHandler
void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
HTMLPlugInElement* imp = V8HTMLObjectElement::toNative(args.Holder());
UseCounter::count(&imp->document(), UseCounter::HTMLObjectElementLegacyCall);
npObjectInvokeDefaultHandler(args);
}