void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
{
    ASSERT_ARG(plugins, plugins.isEmpty());

    getPluginInfo(page, plugins);

#if PLATFORM(MAC)
    if (auto* document = page.mainFrame().document()) {
        if (auto* securityOrigin = document->securityOrigin()) {
            if (securityOrigin->isLocal())
                return;
        }
    }

    for (int32_t i = plugins.size() - 1; i >= 0; --i) {
        auto& info = plugins.at(i);

        // Allow built-in plugins. Also tentatively allow plugins that the client might later selectively permit.
        if (info.isApplicationPlugin || info.clientLoadPolicy == WebCore::PluginLoadClientPolicyAsk)
            continue;

        if (info.clientLoadPolicy == WebCore::PluginLoadClientPolicyBlock)
            plugins.remove(i);
    }
#endif
}
void* WKAccessibilityRootObject(WKBundlePageRef pageRef)
{
#if HAVE(ACCESSIBILITY)
    if (!pageRef)
        return 0;

    WebCore::Page* page = toImpl(pageRef)->corePage();
    if (!page)
        return 0;

    WebCore::Frame& core = page->mainFrame();
    if (!core.document())
        return 0;

    WebCore::AXObjectCache::enableAccessibility();

    WebCore::AccessibilityObject* root = core.document()->axObjectCache()->rootObject();
    if (!root)
        return 0;

    return root->wrapper();
#else
    UNUSED_PARAM(pageRef);
    return 0;
#endif
}
Exemple #3
0
static void invalidateView(Evas_Object* webView)
{
    Evas_Coord width, height;
    Evas_Object* mainFrame = ewk_view_frame_main_get(webView);
    if (mainFrame && ewk_frame_contents_size_get(mainFrame, &width, &height)) {
        WebCore::Page* page = EWKPrivate::corePage(webView);
        if (page)
            page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height));
    }
}
Exemple #4
0
// Modifies the top of the graphics layer tree to add layers needed to support
// the inner/outer viewport fixed-position model for pinch zoom. When finished,
// the tree will look like this (with * denoting added layers):
//
// *innerViewportContainerLayer (fixed pos container)
//  +- *pageScaleLayer
//  |   +- *innerViewportScrollLayer
//  |       +-- overflowControlsHostLayer (root layer)
//  |           +-- rootTransformLayer (optional)
//  |               +-- outerViewportContainerLayer (fixed pos container) [frame container layer in RenderLayerCompositor]
//  |               |   +-- outerViewportScrollLayer [frame scroll layer in RenderLayerCompositor]
//  |               |       +-- content layers ...
//  |               +-- horizontal ScrollbarLayer (non-overlay)
//  |               +-- verticalScrollbarLayer (non-overlay)
//  |               +-- scroll corner (non-overlay)
//  +- *horizontalScrollbarLayer (overlay)
//  +- *verticalScrollbarLayer (overlay)
//
void PinchViewports::setOverflowControlsHostLayer(GraphicsLayer* layer)
{
    if (layer) {
        ASSERT(!m_innerViewportScrollLayer->children().size());
        m_innerViewportScrollLayer->addChild(layer);
    } else {
        m_innerViewportScrollLayer->removeAllChildren();
        return;
    }

    WebCore::Page* page = m_owner->page();
    if (!page)
        return;

    // We only need to disable the existing (outer viewport) scrollbars
    // if the existing ones are already overlay.
    // FIXME: If we knew in advance before the overflowControlsHostLayer goes
    // away, we would re-enable the drawing of these scrollbars.
    if (GraphicsLayer* scrollbar = m_owner->compositor()->layerForHorizontalScrollbar())
        scrollbar->setDrawsContent(!page->mainFrame()->view()->hasOverlayScrollbars());
    if (GraphicsLayer* scrollbar = m_owner->compositor()->layerForVerticalScrollbar())
        scrollbar->setDrawsContent(!page->mainFrame()->view()->hasOverlayScrollbars());
}
void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
    populatePluginCache(page);

    if (page.mainFrame().loader().subframeLoader().allowPlugins()) {
        plugins = m_cachedPlugins;
        return;
    }

    plugins = m_cachedApplicationPlugins;
#else
    UNUSED_PARAM(page);
    UNUSED_PARAM(plugins);
#endif // ENABLE(NETSCAPE_PLUGIN_API)
}
Exemple #6
0
void DumpRenderTreeSupportEfl::dumpConfigurationForViewport(Evas_Object* ewkView, int deviceDPI, const WebCore::IntSize& deviceSize, const WebCore::IntSize& availableSize)
{
    WebCore::Page* page = EWKPrivate::corePage(ewkView);

    if (!page)
        return;
    WebCore::ViewportArguments arguments = page->mainFrame()->document()->viewportArguments();
    WebCore::ViewportAttributes attributes = computeViewportAttributes(arguments,
            /* default layout width for non-mobile pages */ 980,
            deviceSize.width(), deviceSize.height(),
            deviceDPI,
            availableSize);
    restrictMinimumScaleFactorToViewportSize(attributes, availableSize);
    restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
    fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attributes.layoutSize.width(), attributes.layoutSize.height(), attributes.initialScale, attributes.minimumScale, attributes.maximumScale, attributes.userScalable);
}
void WebPluginInfoProvider::populatePluginCache(const WebCore::Page& page)
{
    if (!m_pluginCacheIsPopulated) {
        HangDetectionDisabler hangDetectionDisabler;

        if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPlugins(m_shouldRefreshPlugins), Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins, m_cachedApplicationPlugins), 0))
            return;

        m_shouldRefreshPlugins = false;
        m_pluginCacheIsPopulated = true;
    }

#if PLATFORM(MAC)
    String pageHost = page.mainFrame().loader().documentLoader()->responseURL().host();
    for (auto& info : m_cachedPlugins) {
        if (auto clientPolicy = pluginLoadClientPolicyForHost(pageHost, info))
            info.clientLoadPolicy = *clientPolicy;
    }
#else
    UNUSED_PARAM(page);
#endif // not PLATFORM(MAC)
}