Diff
Modified: trunk/Source/WebCore/ChangeLog (96785 => 96786)
--- trunk/Source/WebCore/ChangeLog 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/ChangeLog 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1,3 +1,41 @@
+2011-10-03 Andy Estes <[email protected]>
+
+ Add the option to suppress rendering until the document's load event fires.
+ https://bugs.webkit.org/show_bug.cgi?id=69298
+
+ Reviewed by Simon Fraser.
+
+ Add a WebCore setting that suppresses painting and compositing layer
+ updates until the document's load event fires. This masks the effects
+ of incremental rendering (for clients that opt in) by ensuring that all
+ sub-resources have loaded and a full layout has taken place before
+ painting the document for the first time.
+
+ No tests currently possible. Testing this would require the ability for
+ DRT to dump state while resources are loading, which it doesn't
+ currently do.
+
+ * dom/Document.cpp:
+ (WebCore::Document::implicitClose): If rendering was previously
+ suppressed, force a repaint and compositing layer update.
+ (WebCore::Document::visualUpdatesAllowed): Add a helper method to
+ determine if the document is in a state where rendering is allowed.
+ * dom/Document.h:
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ * page/Settings.h:
+ (WebCore::Settings::setSuppressIncrementalRendering):
+ (WebCore::Settings::suppressIncrementalRendering):
+ * rendering/RenderLayer.cpp:
+ (WebCore::shouldSuppressPaintingLayer): Encapsulate the FOUC and
+ painting suppression checks into a single helper function for
+ readability's sake.
+ (WebCore::RenderLayer::paintLayer):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateCompositingLayers): If we should
+ suppress compositing layer updates and the load event has yet to fire,
+ return early.
+
2011-10-05 Yuta Kitamura <[email protected]>
WebSocket: Add extensions attribute
Modified: trunk/Source/WebCore/dom/Document.cpp (96785 => 96786)
--- trunk/Source/WebCore/dom/Document.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -2231,6 +2231,14 @@
view()->layout();
}
+ // If painting and compositing layer updates were suppressed pending the load event, do these actions now.
+ if (renderer() && settings() && settings()->suppressIncrementalRendering()) {
+#if USE(ACCELERATED_COMPOSITING)
+ view()->updateCompositingLayers();
+#endif
+ renderer()->repaint();
+ }
+
#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
if (f && renderObject && this == topDocument() && AXObjectCache::accessibilityEnabled()) {
// The AX cache may have been cleared at this point, but we need to make sure it contains an
@@ -5163,6 +5171,13 @@
mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
}
+bool Document::visualUpdatesAllowed() const
+{
+ return !settings()
+ || !settings()->suppressIncrementalRendering()
+ || loadEventFinished();
+}
+
DocumentLoader* Document::loader() const
{
if (!m_frame)
Modified: trunk/Source/WebCore/dom/Document.h (96785 => 96786)
--- trunk/Source/WebCore/dom/Document.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/dom/Document.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1097,6 +1097,8 @@
void didAddWheelEventHandler();
void didRemoveWheelEventHandler();
+ bool visualUpdatesAllowed() const;
+
protected:
Document(Frame*, const KURL&, bool isXHTML, bool isHTML);
Modified: trunk/Source/WebCore/page/Settings.cpp (96785 => 96786)
--- trunk/Source/WebCore/page/Settings.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/page/Settings.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -216,6 +216,7 @@
, m_mediaPlaybackRequiresUserGesture(false)
, m_mediaPlaybackAllowsInline(true)
, m_passwordEchoEnabled(false)
+ , m_suppressIncrementalRendering(false)
, m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
, m_zoomAnimatorScale(1)
, m_zoomAnimatorPosX(0)
Modified: trunk/Source/WebCore/page/Settings.h (96785 => 96786)
--- trunk/Source/WebCore/page/Settings.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/page/Settings.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -462,6 +462,9 @@
void setPasswordEchoEnabled(bool flag) { m_passwordEchoEnabled = flag; }
bool passwordEchoEnabled() const { return m_passwordEchoEnabled; }
+ void setSuppressIncrementalRendering(bool flag) { m_suppressIncrementalRendering = flag; }
+ bool suppressIncrementalRendering() const { return m_suppressIncrementalRendering; }
+
void setPasswordEchoDurationInSeconds(double durationInSeconds) { m_passwordEchoDurationInSeconds = durationInSeconds; }
double passwordEchoDurationInSeconds() const { return m_passwordEchoDurationInSeconds; }
@@ -594,6 +597,7 @@
bool m_mediaPlaybackRequiresUserGesture : 1;
bool m_mediaPlaybackAllowsInline : 1;
bool m_passwordEchoEnabled : 1;
+ bool m_suppressIncrementalRendering : 1;
Timer<Settings> m_loadsImagesAutomaticallyTimer;
void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (96785 => 96786)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -2623,7 +2623,23 @@
return paintingReflection && !layer->has3DTransform();
}
#endif
+
+static inline bool shouldSuppressPaintingLayer(RenderLayer* layer)
+{
+ // Avoid painting descendants of the root layer when stylesheets haven't loaded. This eliminates FOUC.
+ // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
+ // will do a full repaint().
+ if (layer->renderer()->document()->didLayoutWithPendingStylesheets() && !layer->renderer()->isRenderView() && !layer->renderer()->isRoot())
+ return true;
+ // Avoid painting all layers if the document is in a state where visual updates aren't allowed.
+ // A full repaint will occur in Document::implicitClose() if painting is suppressed here.
+ if (!layer->renderer()->document()->visualUpdatesAllowed())
+ return true;
+
+ return false;
+}
+
void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior,
RenderObject* paintingRoot, RenderRegion* region, OverlapTestRequestMap* overlapTestRequests,
@@ -2642,10 +2658,7 @@
}
#endif
- // Avoid painting layers when stylesheets haven't loaded. This eliminates FOUC.
- // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
- // will do a full repaint().
- if (renderer()->document()->didLayoutWithPendingStylesheets() && !renderer()->isRenderView() && !renderer()->isRoot())
+ if (shouldSuppressPaintingLayer(this))
return;
// If this layer is totally invisible then there is nothing to paint.
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (96785 => 96786)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -244,6 +244,10 @@
void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)
{
m_updateCompositingLayersTimer.stop();
+
+ // Compositing layers will be updated in Document::implicitClose() if suppressed here.
+ if (!m_renderView->document()->visualUpdatesAllowed())
+ return;
if (m_forceCompositingMode && !m_compositing)
enableCompositingMode(true);
Modified: trunk/Source/WebKit/mac/ChangeLog (96785 => 96786)
--- trunk/Source/WebKit/mac/ChangeLog 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1,3 +1,21 @@
+2011-10-03 Andy Estes <[email protected]>
+
+ Add an option to suppress rendering until the document's load event fires.
+ https://bugs.webkit.org/show_bug.cgi?id=69298
+
+ Reviewed by Simon Fraser.
+
+ Add a new private WebPreference.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences setSuppressRenderingWhileInitiallyLoading:]):
+ (-[WebPreferences suppressRenderingWhileInitiallyLoading]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2011-10-05 Jer Noble <[email protected]>
Enable WEB_AUDIO by default in the WebKit/mac port.
Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (96785 => 96786)
--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -125,6 +125,7 @@
#define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey"
#define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior"
#define WebKitUsePreHTML5ParserQuirksKey @"WebKitUsePreHTML5ParserQuirks"
+#define WebKitSuppressIncrementalRenderingKey @"WebKitSuppressIncrementalRendering"
// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
// to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (96785 => 96786)
--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2011-10-06 04:18:03 UTC (rev 96786)
@@ -385,6 +385,7 @@
[NSNumber numberWithBool:NO], WebKitMediaPlaybackRequiresUserGesturePreferenceKey,
[NSNumber numberWithBool:YES], WebKitMediaPlaybackAllowsInlinePreferenceKey,
[NSNumber numberWithBool:NO], WebKitWebAudioEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitSuppressIncrementalRenderingKey,
[NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
[NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
@@ -1552,6 +1553,16 @@
[self _setStringValue: family forKey: WebKitPictographFontPreferenceKey];
}
+- (void)setSuppressIncrementalRendering:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitSuppressIncrementalRenderingKey];
+}
+
+- (BOOL)suppressIncrementalRendering
+{
+ return [self _boolValueForKey:WebKitSuppressIncrementalRenderingKey];
+}
+
@end
@implementation WebPreferences (WebInternal)
Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (96785 => 96786)
--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -265,4 +265,7 @@
- (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag;
- (BOOL)isHixie76WebSocketProtocolEnabled;
+- (void)setSuppressIncrementalRendering:(BOOL)flag;
+- (BOOL)suppressIncrementalRendering;
+
@end
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (96785 => 96786)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1475,6 +1475,7 @@
#endif
settings->setMediaPlaybackRequiresUserGesture([preferences mediaPlaybackRequiresUserGesture]);
settings->setMediaPlaybackAllowsInline([preferences mediaPlaybackAllowsInline]);
+ settings->setSuppressIncrementalRendering([preferences suppressIncrementalRendering]);
// Application Cache Preferences are stored on the global cache storage manager, not in Settings.
[WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]];
Modified: trunk/Source/WebKit2/ChangeLog (96785 => 96786)
--- trunk/Source/WebKit2/ChangeLog 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1,3 +1,20 @@
+2011-10-03 Andy Estes <[email protected]>
+
+ Add an option to suppress rendering until the document's load event fires.
+ https://bugs.webkit.org/show_bug.cgi?id=69298
+
+ Reviewed by Simon Fraser.
+
+ Add a new WKPreference.
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetSuppressRenderingWhileInitiallyLoading):
+ (WKPreferencesGetSuppressRenderingWhileInitiallyLoading):
+ * UIProcess/API/C/WKPreferences.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
2011-10-05 Simon Fraser <[email protected]>
r96770 broke binary compatibility with Safari
Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (96785 => 96786)
--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -95,6 +95,7 @@
macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false) \
macro(WebAudioEnabled, webAudioEnabled, Bool, bool, false) \
macro(ApplicationChromeModeEnabled, applicationChromeMode, Bool, bool, false) \
+ macro(SuppressIncrementalRendering, suppressIncrementalRendering, Bool, bool, false) \
\
#define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (96785 => 96786)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -641,3 +641,13 @@
{
return toImpl(preferencesRef)->applicationChromeMode();
}
+
+void WKPreferencesSetSuppressIncrementalRendering(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setSuppressIncrementalRendering(enabled);
+}
+
+bool WKPreferencesGetSuppressIncrementalRendering(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->suppressIncrementalRendering();
+}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h (96785 => 96786)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h 2011-10-06 04:18:03 UTC (rev 96786)
@@ -168,6 +168,10 @@
// Defaults to false
WK_EXPORT void WKPreferencesSetWebAudioEnabled(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetWebAudioEnabled(WKPreferencesRef preferencesRef);
+
+// Defaults to false
+WK_EXPORT void WKPreferencesSetSuppressIncrementalRendering(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetSuppressIncrementalRendering(WKPreferencesRef preferencesRef);
#ifdef __cplusplus
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (96785 => 96786)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-06 03:37:38 UTC (rev 96785)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-06 04:18:03 UTC (rev 96786)
@@ -1699,8 +1699,9 @@
settings->setWebAudioEnabled(store.getBoolValueForKey(WebPreferencesKey::webAudioEnabledKey()));
#endif
- settings->setApplicationChromeMode(store.getBoolValueForKey(WebPreferencesKey::applicationChromeModeKey()));
-
+ settings->setApplicationChromeMode(store.getBoolValueForKey(WebPreferencesKey::applicationChromeModeKey()));
+ settings->setSuppressIncrementalRendering(store.getBoolValueForKey(WebPreferencesKey::suppressIncrementalRenderingKey()));
+
platformPreferencesDidChange(store);
}