How does a plugin resize it's window

▼魔方 西西 提交于 2019-12-10 16:51:42

问题


When I load a pdf with the following html the pdf plugin seems to resize it's windows to accommodate the complete length of the pdf file. I'm wondering how the plugin does that?


<!DOCTYPE html>
<html>
<head>
<title>Test html object tag</title>
<style type = "text/css">
    html
    {
        height: 100%;
    }

    body
    {
        margin: 0;
        padding: 0;
        height: 100%;
    }

    .my_style
    {
        width: 100%;
        min-height: 100%;
    }
</style>
</head>

<body>
    <div class="my_style">
        <object class = "my_style" data="data/test.pdf" type="application/pdf"></object>
    </div>

</body>
</html>

As far as I understand it the size of a window that is provided to a plugin is defined in the html object tag.

Thanks, Christian


回答1:


This is pure speculation, since I don't have the source to said plugin, but if I were trying to solve this issue I would simply get a reference to the object tag of my plugin and set the width and height.

Haven't tested this code, but something along these lines should probably work:

FB::DOM::ElementPtr elem(m_host->getDOMElement());
elem->setWidth(640);
elem->setHeight(480);

Obviously wherever you do that you need access to the BrowerHostPtr (m_host).



来源:https://stackoverflow.com/questions/11084694/how-does-a-plugin-resize-its-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!