Permalink
Browse files

If a containing block element in small, then the ClickToFlash view wi…

…ll not be visible, even though -[NSView visibleRect] and the DOMNode's computed style says it should be visible. Fix for https://rentzsch.lighthouseapp.com/projects/24342/tickets/690-flash-does-not-load-when-expected
  • Loading branch information...
1 parent 10ff0e0 commit 2223e832c38a4bc55f2491a20360e674e374b9c4 @lapcat lapcat committed with Jun 11, 2010
Showing with 12 additions and 4 deletions.
  1. +1 −0 Plugin/Plugin.h
  2. +11 −4 Plugin/Plugin.m
View
@@ -60,6 +60,7 @@ THE SOFTWARE.
NSURLConnection *connections[2];
unsigned expectedResponses;
NSTimer *_delayingTimer;
+ NSRect _drawnRect;
}
+ (NSView *)plugInViewWithArguments:(NSDictionary *)arguments;
View
@@ -123,6 +123,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
_embeddedYouTubeView = NO;
_youTubeAutoPlay = NO;
_delayingTimer = nil;
+ _drawnRect = NSZeroRect;
defaultWhitelist = [NSArray arrayWithObjects: @"com.apple.frontrow",
@"com.apple.dashboard.client",
@"com.apple.ScreenSaver.Engine",
@@ -565,7 +566,10 @@ - (void) _addApplicationWhitelistArrayToPrefsFile
- (void) drawRect:(NSRect)rect
{
if(!_isLoadingFromWhitelist)
+ {
+ _drawnRect = NSUnionRect( _drawnRect, rect );
[self _drawBackground];
+ }
}
- (BOOL) _gearVisible
@@ -659,10 +663,13 @@ - (BOOL) _isOptionPressed
- (BOOL) isConsideredInvisible
{
- int height = (int)([[self webView] frame].size.height);
- int width = (int)([[self webView] frame].size.width);
-
- if ( (height <= maxInvisibleDimension) && (width <= maxInvisibleDimension) )
+ int height = NSHeight( _drawnRect );
+ int width = NSWidth( _drawnRect );
+ if ( height > 0 && height <= maxInvisibleDimension )
+ {
+ return YES;
+ }
+ if ( width > 0 && width <= maxInvisibleDimension )
{
return YES;
}

0 comments on commit 2223e83

Please sign in to comment.