Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resize Windowless plugin

12 views
Skip to first unread message

thec...@gmail.com

unread,
May 14, 2013, 8:03:44 AM5/14/13
to
Hi,

Does anyone know if it is possible to resize a windowless plugin from within the plugin? By calling some browser functions .

-Christian

Benjamin Smedberg

unread,
May 14, 2013, 9:25:31 AM5/14/13
to thec...@gmail.com, dev-tech...@lists.mozilla.org
On 5/14/2013 8:03 AM, thec...@gmail.com wrote:
> Hi,
>
> Does anyone know if it is possible to resize a windowless plugin from within the plugin? By calling some browser functions .
Plugins are like most other DOM elements in this regard. The intrinsic
size is determined using the width="" and height="" attributes on the
<object> or <embed>, but that can be overridden using CSS. You can use
normal DOM scripting (via NPRuntime) to change the size using
element.style.width, for example.

--BDS

thec...@gmail.com

unread,
May 14, 2013, 9:35:52 AM5/14/13
to
On Tuesday, May 14, 2013 3:25:31 PM UTC+2, Benjamin Smedberg wrote:
I have been searching for some samples of how to use NPRuntime however I can't find any. Are you aware of some samples?

/Christian

Kevin DeKorte

unread,
May 14, 2013, 9:47:02 AM5/14/13
to dev-tech...@lists.mozilla.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/14/2013 07:35 AM, thec...@gmail.com wrote:
> I have been searching for some samples of how to use NPRuntime
> however I can't find any. Are you aware of some samples?

Christian,

I've done things like this to run javascript from the plugin...

void postDOMEvent(NPP mInstance, const gchar * id, const gchar * event)
{
gchar *jscript;

jscript =
g_strdup_printf("javascript:obj_gmp=document.getElementById('%s');"
"e_gmp=document.createEvent('Events');"
"e_gmp.initEvent('%s',true,true);"
"obj_gmp.dispatchEvent(e_gmp);",
id, event);
NPN_GetURL(mInstance, jscript, NULL);
g_free(jscript);
}


Kevin

- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGSQFYACgkQ6w2kMH0L1dG0kQCdHgn7I7XGu/4Cb8XP9KUaWmXa
U+AAnjnRJkHA146Ze7aGms1L+juZsfnB
=NVK9
-----END PGP SIGNATURE-----

thec...@gmail.com

unread,
May 14, 2013, 9:58:35 AM5/14/13
to
I have found that you can do:

NPString str = { 0 };
str.UTF8Characters = "document.getElementById('pluginId').style.height = '30px'";
str.UTF8Length = strlen(str.UTF8Characters);

NPObject window;
mpBrowserFunctions->getvalue(npp, NPNVWindowNPObject, &window);

NPVariant result;
if(mpBrowserFunctions->evaluate(npp, &window, &str, &result))
mpBrowserFunctions->releasevariantvalue(&result);
0 new messages