Changeset 13030 in webkit


Ignore:
Timestamp:
Feb 27, 2006 5:17:05 PM (18 years ago)
Author:
tomernic
Message:

Reviewed by Adele.

<rdar://problem/4222043> Safari should reduce null events sent to invisible plugins

  • Plugins/WebBaseNetscapePluginView.h:
  • Plugins/WebBaseNetscapePluginView.m: (-[WebBaseNetscapePluginView restartNullEvents]): Check to see if the plugin view is completely obscured (scrolled out of view, for example). If it is obscured and it wasn't before, or the other way around, then restart the null event timer so it can fire at the appropriate rate. (-[WebBaseNetscapePluginView viewHasMoved:]): If a plugin is obscured, send it null events as if it were in an inactive window.
Location:
trunk/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r12997 r13030  
     12006-02-27  Tim Omernick  <timo@apple.com>
     2
     3        Reviewed by Adele.
     4
     5        <rdar://problem/4222043> Safari should reduce null events sent to invisible plugins
     6
     7        * Plugins/WebBaseNetscapePluginView.h:
     8        * Plugins/WebBaseNetscapePluginView.m:
     9        (-[WebBaseNetscapePluginView restartNullEvents]):
     10        Check to see if the plugin view is completely obscured (scrolled out of view, for example).  If it is
     11        obscured and it wasn't before, or the other way around, then restart the null event timer so it can
     12        fire at the appropriate rate.
     13        (-[WebBaseNetscapePluginView viewHasMoved:]):
     14        If a plugin is obscured, send it null events as if it were in an inactive window.
     15
    1162006-02-26  Mitz Pettel  <opendarwin.org@mitzpettel.com>
    217
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.h

    r11962 r13030  
    6161    BOOL currentEventIsUserGesture;
    6262    BOOL isTransparent;
     63    BOOL isCompletelyObscured;
    6364   
    6465    int32 specifiedHeight;
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.m

    r12898 r13030  
    531531    ASSERT([self window]);
    532532   
    533     if (nullEventTimer) {
     533    if (nullEventTimer)
    534534        [self stopNullEvents];
    535     }
    536    
    537     if ([[self window] isMiniaturized]) {
     535   
     536    if ([[self window] isMiniaturized])
    538537        return;
    539     }
    540538
    541539    NSTimeInterval interval;
     
    543541    // Send null events less frequently when the actual window is not key.  Also, allow the DB
    544542    // to override this behavior and send full speed events to non key windows.
    545     if ([[self window] isKeyWindow] || [[self webView] _dashboardBehavior:WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns]) {
     543    // If the plugin is completely obscured (scrolled out of view, for example), then we will
     544    // send null events at a reduced rate.
     545    if (!isCompletelyObscured && ([[self window] isKeyWindow] || [[self webView] _dashboardBehavior:WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns]))
    546546        interval = NullEventIntervalActive;
    547     } else {
     547    else
    548548        interval = NullEventIntervalNotActive;
    549     }
    550549   
    551550    nullEventTimer = [[NSTimer scheduledTimerWithTimeInterval:interval
     
    13381337    [self updateAndSetWindow];
    13391338    [self resetTrackingRect];
     1339   
     1340    // Check to see if the plugin view is completely obscured (scrolled out of view, for example).
     1341    // For performance reasons, we send null events at a lower rate to plugins which are obscured.
     1342    BOOL oldIsObscured = isCompletelyObscured;
     1343    isCompletelyObscured = NSEqualSizes([self visibleRect].size, NSZeroSize);
     1344    if (isCompletelyObscured != oldIsObscured)
     1345        [self restartNullEvents];
    13401346}
    13411347
Note: See TracChangeset for help on using the changeset viewer.