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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerPainter.cpp

Issue 1297803002: Remove FOUC avoidance from BlockPainter and DeprecatedPaintLayerPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove extra assert. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/DeprecatedPaintLayerPainter.h" 6 #include "core/paint/DeprecatedPaintLayerPainter.h"
7 7
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/LayoutBlock.h" 10 #include "core/layout/LayoutBlock.h"
(...skipping 13 matching lines...) Expand all
24 #include "core/paint/Transform3DRecorder.h" 24 #include "core/paint/Transform3DRecorder.h"
25 #include "platform/graphics/GraphicsLayer.h" 25 #include "platform/graphics/GraphicsLayer.h"
26 #include "platform/graphics/paint/ClipPathRecorder.h" 26 #include "platform/graphics/paint/ClipPathRecorder.h"
27 #include "platform/graphics/paint/ClipRecorder.h" 27 #include "platform/graphics/paint/ClipRecorder.h"
28 #include "platform/graphics/paint/CompositingDisplayItem.h" 28 #include "platform/graphics/paint/CompositingDisplayItem.h"
29 #include "platform/graphics/paint/Transform3DDisplayItem.h" 29 #include "platform/graphics/paint/Transform3DDisplayItem.h"
30 #include "wtf/Optional.h" 30 #include "wtf/Optional.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer)
35 {
36 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC.
37 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
38 // will do a full paintInvalidationForWholeLayoutObject().
39 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && ! layer->isRootLayer() && !layer->layoutObject()->isDocumentElement())
40 return true;
41
42 return false;
43 }
44
45 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR oot, PaintLayerFlags paintFlags) 34 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR oot, PaintLayerFlags paintFlags)
46 { 35 {
47 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); 36 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
48 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) 37 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags))
49 paintLayer(context, paintingInfo, paintFlags); 38 paintLayer(context, paintingInfo, paintFlags);
50 } 39 }
51 40
52 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) 41 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject)
53 { 42 {
54 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; 43 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip;
55 } 44 }
56 45
57 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 46 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
58 { 47 {
59 // https://code.google.com/p/chromium/issues/detail?id=343772 48 // https://code.google.com/p/chromium/issues/detail?id=343772
60 DisableCompositingQueryAsserts disabler; 49 DisableCompositingQueryAsserts disabler;
61 50
62 if (m_paintLayer.compositingState() != NotComposited) { 51 if (m_paintLayer.compositingState() != NotComposited) {
63 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer s) { 52 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer s) {
64 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th at's for printing and drag-image. 53 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th at's for printing and drag-image.
65 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call? 54 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
66 paintFlags |= PaintLayerUncachedClipRects; 55 paintFlags |= PaintLayerUncachedClipRects;
67 } 56 }
68 } 57 }
69 58
70 // Non self-painting leaf layers don't need to be painted as their layoutObj ect() should properly paint itself. 59 // Non self-painting leaf layers don't need to be painted as their layoutObj ect() should properly paint itself.
71 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) 60 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant())
72 return; 61 return;
73 62
74 if (shouldSuppressPaintingLayer(&m_paintLayer))
75 return;
76
77 // If this layer is totally invisible then there is nothing to paint. 63 // If this layer is totally invisible then there is nothing to paint.
78 if (!m_paintLayer.layoutObject()->opacity()) 64 if (!m_paintLayer.layoutObject()->opacity())
79 return; 65 return;
80 66
81 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) 67 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags()))
82 paintFlags |= PaintLayerHaveTransparency; 68 paintFlags |= PaintLayerHaveTransparency;
83 69
84 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); 70 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject());
85 71
86 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. 72 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice.
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 588 if (!m_paintLayer.containsDirtyOverlayScrollbars())
603 return; 589 return;
604 590
605 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); 591 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot);
606 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 592 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
607 593
608 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 594 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
609 } 595 }
610 596
611 } // namespace blink 597 } // namespace blink
OLDNEW
« 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