Commit 9cf92a4f authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by John Sullivan.

        - WebCore part of <rdar://problem/6008409> Need a way to disable updates in offscreen views

        Added a setting, updatesWhenOffscreen(), which controls whether an
        offscreen web view gets marked as needing update when its contents
        change (the existing behavior) or not (a new behavior), in which case it
        will be marked as needing update just before it goes on screen. The
        existing behavior (updating while offscreen) remains the default.

        * WebCore.base.exp: Added Settings::setUpdatesWhenOffscreen().
        * page/FrameView.cpp:
        (WebCore::FrameView::shouldUpdateWhenOffscreen): Added. Returns the
        value from settings.
        * page/FrameView.h:
        * page/Settings.cpp:
        (WebCore::Settings::setUpdatesWhenOffscreen): Added.
        * page/Settings.h:
        (WebCore::Settings::updatesWhenOffscreen): Added.
        * platform/ScrollView.h:
        * platform/mac/ScrollViewMac.mm:
        (WebCore::ScrollView::updateContents): Added code to return early and
        not call -setNeedsDisplayInRect: if the view is not in a visible window
        and the setting is not to update when offscreen.

WebKit/mac:

        Reviewed by John Sullivan.

        - WebKit part of <rdar://problem/6008409> Need a way to disable updates in offscreen views

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView addWindowObservers]): Added code to observe when the
        window goes onscreen.
        (-[WebHTMLView removeWindowObservers]): Added.
        (-[WebHTMLView windowWillOrderOnScreen:]): Added. If the view is set to
        not update when offscreen, calls -setNeedsDisplay: just before it comes
        onscreen.
        * WebView/WebPreferenceKeysPrivate.h: Added preference key.
        * WebView/WebPreferences.m:
        (+[WebPreferences initialize]): Made updates when offscreen on by
        default.
        (-[WebPreferences updatesWhenOffscreen]): Added.
        (-[WebPreferences setUpdatesWhenOffscreen:]): Added.
        * WebView/WebPreferencesPrivate.h:
        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]): Added code to update the
        updatesWhenOffscreen setting in WebCore.

WebKitLibraries:

        Reviewed by John Sullivan.

        - WebKitSystemInterface part of <rdar://problem/6008409> Need a way to disable updates in offscreen views

        * WebKitSystemInterface.h: Added WKWindowWillOrderOnScreenNotification.
        * libWebKitSystemInterfaceLeopard.a: Updated.
        * libWebKitSystemInterfaceTiger.a: Updated.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1749d209
2008-07-08 Dan Bernstein <mitz@apple.com>
Reviewed by John Sullivan.
- WebCore part of <rdar://problem/6008409> Need a way to disable updates in offscreen views
Added a setting, updatesWhenOffscreen(), which controls whether an
offscreen web view gets marked as needing update when its contents
change (the existing behavior) or not (a new behavior), in which case it
will be marked as needing update just before it goes on screen. The
existing behavior (updating while offscreen) remains the default.
* WebCore.base.exp: Added Settings::setUpdatesWhenOffscreen().
* page/FrameView.cpp:
(WebCore::FrameView::shouldUpdateWhenOffscreen): Added. Returns the
value from settings.
* page/FrameView.h:
* page/Settings.cpp:
(WebCore::Settings::setUpdatesWhenOffscreen): Added.
* page/Settings.h:
(WebCore::Settings::updatesWhenOffscreen): Added.
* platform/ScrollView.h:
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::updateContents): Added code to return early and
not call -setNeedsDisplayInRect: if the view is not in a visible window
and the setting is not to update when offscreen.
2008-07-08 Simon Hausmann <hausmann@webkit.org>
Fix the build with enabled SVG filters.
......@@ -573,6 +573,7 @@ __ZN7WebCore8Settings22setSansSerifFontFamilyERKNS_12AtomicStringE
__ZN7WebCore8Settings22setShowsURLsInToolTipsEb
__ZN7WebCore8Settings23setDefaultFixedFontSizeEi
__ZN7WebCore8Settings23setEditableLinkBehaviorENS_20EditableLinkBehaviorE
__ZN7WebCore8Settings23setUpdatesWhenOffscreenEb
__ZN7WebCore8Settings24setTextAreasAreResizableEb
__ZN7WebCore8Settings25setDeveloperExtrasEnabledEb
__ZN7WebCore8Settings25setMinimumLogicalFontSizeEi
......
......@@ -44,6 +44,7 @@
#include "RenderPartObject.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "Settings.h"
namespace WebCore {
......@@ -688,6 +689,13 @@ void FrameView::restoreScrollbar()
suppressScrollbars(false);
}
bool FrameView::shouldUpdateWhenOffscreen() const
{
if (Settings* settings = frame()->settings())
return settings->updatesWhenOffscreen();
return true;
}
void FrameView::scrollRectIntoViewRecursively(const IntRect& r)
{
if (frame()->prohibitsScrolling())
......
......@@ -75,6 +75,8 @@ public:
virtual void setHScrollbarMode(ScrollbarMode);
virtual void setScrollbarsMode(ScrollbarMode);
virtual bool shouldUpdateWhenOffscreen() const;
void layout(bool allowSubtree = true);
bool didFirstLayout() const;
void layoutTimerFired(Timer<FrameView>*);
......
......@@ -356,5 +356,10 @@ void Settings::setOfflineWebApplicationCacheEnabled(bool enabled)
m_offlineWebApplicationCacheEnabled = enabled;
}
void Settings::setUpdatesWhenOffscreen(bool updates)
{
m_updatesWhenOffscreen = updates;
}
} // namespace WebCore
......@@ -165,6 +165,9 @@ namespace WebCore {
void setOfflineWebApplicationCacheEnabled(bool);
bool offlineWebApplicationCacheEnabled() const { return m_offlineWebApplicationCacheEnabled; }
void setUpdatesWhenOffscreen(bool);
bool updatesWhenOffscreen() const { return m_updatesWhenOffscreen; }
private:
Page* m_page;
......@@ -209,6 +212,7 @@ namespace WebCore {
bool m_inApplicationChromeMode : 1;
bool m_offlineWebApplicationCacheEnabled : 1;
bool m_rangeMutationDisabledForOldAppleMail : 1;
bool m_updatesWhenOffscreen : 1;
};
} // namespace WebCore
......
......@@ -103,6 +103,7 @@ namespace WebCore {
void setStaticBackground(bool);
bool inWindow() const;
virtual bool shouldUpdateWhenOffscreen() const = 0;
// For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
PlatformScrollbar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
......
......@@ -232,6 +232,8 @@ void ScrollView::updateContents(const IntRect& rect, bool now)
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSView *view = documentView();
if (!now && ![[view window] isVisible] && !shouldUpdateWhenOffscreen())
return;
NSRect visibleRect = visibleContentRect();
......
2008-07-08 Dan Bernstein <mitz@apple.com>
Reviewed by John Sullivan.
- WebKit part of <rdar://problem/6008409> Need a way to disable updates in offscreen views
* WebView/WebHTMLView.mm:
(-[WebHTMLView addWindowObservers]): Added code to observe when the
window goes onscreen.
(-[WebHTMLView removeWindowObservers]): Added.
(-[WebHTMLView windowWillOrderOnScreen:]): Added. If the view is set to
not update when offscreen, calls -setNeedsDisplay: just before it comes
onscreen.
* WebView/WebPreferenceKeysPrivate.h: Added preference key.
* WebView/WebPreferences.m:
(+[WebPreferences initialize]): Made updates when offscreen on by
default.
(-[WebPreferences updatesWhenOffscreen]): Added.
(-[WebPreferences setUpdatesWhenOffscreen:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]): Added code to update the
updatesWhenOffscreen setting in WebCore.
2008-07-07 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
......
......@@ -178,9 +178,8 @@ extern "C" {
// Need to declare these attribute names because AppKit exports them but does not make them available in API or SPI headers.
extern NSString *NSMarkedClauseSegmentAttributeName;
extern NSString *NSTextInputReplacementRangeAttributeName;
extern NSString *NSMarkedClauseSegmentAttributeName;
extern NSString *NSTextInputReplacementRangeAttributeName;
}
@interface NSView (WebNSViewDetails)
......@@ -2624,6 +2623,8 @@ WEBCORE_COMMAND(yankAndSelect)
name:NSWindowDidResignKeyNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:)
name:NSWindowWillCloseNotification object:window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillOrderOnScreen:)
name:WKWindowWillOrderOnScreenNotification() object:window];
}
}
......@@ -2637,6 +2638,8 @@ WEBCORE_COMMAND(yankAndSelect)
name:NSWindowDidResignKeyNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowWillCloseNotification object:window];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:WKWindowWillOrderOnScreenNotification() object:window];
}
}
......@@ -3031,6 +3034,12 @@ static void _updateFocusedAndActiveStateTimerCallback(CFRunLoopTimerRef timer, v
[[self _pluginController] destroyAllPlugins];
}
- (void)windowWillOrderOnScreen:(NSNotification *)notification
{
if (![[[self _webView] preferences] updatesWhenOffscreen])
[self setNeedsDisplay:YES];
}
- (void)scrollWheel:(NSEvent *)event
{
[self retain];
......
......@@ -68,6 +68,7 @@
#define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey"
#define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown"
#define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled"
#define WebKitUpdatesWhenOffscreenPreferenceKey @"WebKitUpdatesWhenOffscreen"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
......
......@@ -334,6 +334,7 @@ + (void)initialize
[NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitUpdatesWhenOffscreenPreferenceKey,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
......@@ -777,6 +778,16 @@ - (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag
[self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
}
- (BOOL)updatesWhenOffscreen
{
return [self _boolValueForKey:WebKitUpdatesWhenOffscreenPreferenceKey];
}
- (void)setUpdatesWhenOffscreen:(BOOL)flag
{
[self _setBoolValue:flag forKey:WebKitUpdatesWhenOffscreenPreferenceKey];
}
- (BOOL)respectStandardStyleKeyEquivalents
{
return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
......
......@@ -74,6 +74,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)offlineWebApplicationCacheEnabled;
- (void)setOfflineWebApplicationCacheEnabled:(BOOL)offlineWebApplicationCacheEnabled;
- (BOOL)updatesWhenOffscreen;
- (void)setUpdatesWhenOffscreen:(BOOL)updatesWhenOffscreen;
// zero means do AutoScale
- (float)PDFScaleFactor;
- (void)setPDFScaleFactor:(float)scale;
......
......@@ -1024,6 +1024,7 @@ static bool debugWidget = true;
settings->setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]);
settings->disableRangeMutationForOldAppleMail(WKAppVersionCheckLessThan(@"com.apple.mail", -1, 4.0));
settings->setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]);
settings->setUpdatesWhenOffscreen([preferences updatesWhenOffscreen]);
}
static inline IMP getMethod(id o, SEL s)
......
2008-07-08 Dan Bernstein <mitz@apple.com>
Reviewed by John Sullivan.
- WebKitSystemInterface part of <rdar://problem/6008409> Need a way to disable updates in offscreen views
* WebKitSystemInterface.h: Added WKWindowWillOrderOnScreenNotification.
* libWebKitSystemInterfaceLeopard.a: Updated.
* libWebKitSystemInterfaceTiger.a: Updated.
2008-07-01 Steve Falkenburg <sfalken@apple.com>
Bump version numbers.
......
......@@ -58,6 +58,7 @@ void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shou
unsigned WKGetNSAutoreleasePoolCount(void);
NSString *WKMouseMovedNotification(void);
NSString *WKWindowWillOrderOnScreenNotification(void);
void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
CFTypeID WKGetAXTextMarkerTypeID(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment