hust-marx / firebreath

Automatically exported from code.google.com/p/firebreath
0 stars 0 forks source link

InvalidateWindow() not working in PluginWindowMacCocoa #74

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've noticed the InvalidateWindow() function in PluginWindowMacCocoa isn't 
achieving the desired effect
(forcing a redraw).

I wasn't able to get the results I needed until I implemented an identically 
named function in PluginWindowMacCocoaCG which overrode
the base class' function. And I changed the source to be the following
(changing the coordinates for the NPRect):

void PluginWindowMacCocoaCG::InvalidateWindow() {
        NPRect rect = { 0, 0, m_height, m_width };
        m_npHost->InvalidateRect(&rect);

}

After that it works like a charm. Not sure if this is just a needed
fix/addition or if I'm doing something horribly wrong/dangerous but I
thought I'd pass it along. 

Original issue reported on code.google.com by schnap...@gmail.com on 24 Sep 2010 at 4:51

GoogleCodeExporter commented 9 years ago
My only comment on this is that the NPRect will almost definitely be wrong when 
you embed your plugin in an actual web page. Top & left are set to 0, 0 which 
only works when your plugin is situated at the top left of the page.

Good catch though, it looks like the NPRect is wrong in PluginWindowMacCocoa, 
I'll get on it once I get a chance.

Original comment by amack...@gmail.com on 24 Sep 2010 at 5:42

GoogleCodeExporter commented 9 years ago
Well, the testing harness I'm developing with has a bunch of stuff at the top 
of the page, then the plugin, so it *appears* to work even when the plugin is 
not at top-left of the page. But I haven't tested it thoroughly. I'll let you 
know if I find more info.

Original comment by schnap...@gmail.com on 24 Sep 2010 at 10:12

GoogleCodeExporter commented 9 years ago
NPN_InvalidateRect takes plugin coordinates:
"invalidRect - The area to invalidate, specified in a coordinate system that 
originates at the top left of the plug-in."
https://developer.mozilla.org/en/NPN_InvalidateRect

Original comment by georg.fritzsche on 24 Sep 2010 at 11:11

GoogleCodeExporter commented 9 years ago

Original comment by amack...@gmail.com on 27 Sep 2010 at 5:44

GoogleCodeExporter commented 9 years ago
Okay, well it seems like the code checked into dev actually does work. If you 
call InvalidateWindow() it does force a redraw event (at least it does on 
Firefox). 

One potential problem could be that PluginWindowMacCocoa doesn't intercept the 
Cocoa event and a fire a RefreshEvent, you must intercept the CocoaEvent 
manually to catch the Cocoa DrawEvent.

Which browser are you observing the bug in? 

Original comment by amack...@gmail.com on 27 Sep 2010 at 10:50

GoogleCodeExporter commented 9 years ago
Hehe, well it looks like on further investigation Georg and Schnapple right! 
It's plugin coordinates, so a rect at 0,0 is correct. I've pushed the changes 
to stable.

Sorry for the confusion!

Original comment by amack...@gmail.com on 28 Sep 2010 at 12:12

GoogleCodeExporter commented 9 years ago

Original comment by amack...@gmail.com on 28 Sep 2010 at 12:14