Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1295)

Unified Diff: Source/core/paint/DeprecatedPaintLayerPainter.cpp

Issue 1287113006: Revert of Remove FOUC avoidance from BlockPainter and DeprecatedPaintLayerPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayerPainter.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
index 0189a23964b97d5caf2de2047ca11dfb5cce392e..dd5c832349eff691dbe899aefe94b446eea0190b 100644
--- a/Source/core/paint/DeprecatedPaintLayerPainter.cpp
+++ b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
@@ -31,6 +31,17 @@
namespace blink {
+static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* 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 paintInvalidationForWholeLayoutObject().
+ if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && !layer->isRootLayer() && !layer->layoutObject()->isDocumentElement())
+ return true;
+
+ return false;
+}
+
void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRect& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, PaintLayerFlags paintFlags)
{
DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
@@ -58,6 +69,9 @@
// Non self-painting leaf layers don't need to be painted as their layoutObject() should properly paint itself.
if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant())
+ return;
+
+ if (shouldSuppressPaintingLayer(&m_paintLayer))
return;
// If this layer is totally invisible then there is nothing to paint.
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698