| OLD | NEW |
| 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 Loading... |
| 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 |
| 34 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) | 45 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) |
| 35 { | 46 { |
| 36 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); | 47 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); |
| 37 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) | 48 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) |
| 38 paintLayer(context, paintingInfo, paintFlags); | 49 paintLayer(context, paintingInfo, paintFlags); |
| 39 } | 50 } |
| 40 | 51 |
| 41 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* layoutObject) | 52 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* layoutObject) |
| 42 { | 53 { |
| 43 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; | 54 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; |
| 44 } | 55 } |
| 45 | 56 |
| 46 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep
recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 57 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep
recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 47 { | 58 { |
| 48 // https://code.google.com/p/chromium/issues/detail?id=343772 | 59 // https://code.google.com/p/chromium/issues/detail?id=343772 |
| 49 DisableCompositingQueryAsserts disabler; | 60 DisableCompositingQueryAsserts disabler; |
| 50 | 61 |
| 51 if (m_paintLayer.compositingState() != NotComposited) { | 62 if (m_paintLayer.compositingState() != NotComposited) { |
| 52 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer
s) { | 63 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer
s) { |
| 53 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th
at's for printing and drag-image. | 64 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th
at's for printing and drag-image. |
| 54 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? | 65 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? |
| 55 paintFlags |= PaintLayerUncachedClipRects; | 66 paintFlags |= PaintLayerUncachedClipRects; |
| 56 } | 67 } |
| 57 } | 68 } |
| 58 | 69 |
| 59 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. | 70 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. |
| 60 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) | 71 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) |
| 61 return; | 72 return; |
| 62 | 73 |
| 74 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
| 75 return; |
| 76 |
| 63 // If this layer is totally invisible then there is nothing to paint. | 77 // If this layer is totally invisible then there is nothing to paint. |
| 64 if (!m_paintLayer.layoutObject()->opacity()) | 78 if (!m_paintLayer.layoutObject()->opacity()) |
| 65 return; | 79 return; |
| 66 | 80 |
| 67 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 81 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
| 68 paintFlags |= PaintLayerHaveTransparency; | 82 paintFlags |= PaintLayerHaveTransparency; |
| 69 | 83 |
| 70 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); | 84 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); |
| 71 | 85 |
| 72 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. | 86 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 602 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 589 return; | 603 return; |
| 590 | 604 |
| 591 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 605 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 592 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 606 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 593 | 607 |
| 594 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 608 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 595 } | 609 } |
| 596 | 610 |
| 597 } // namespace blink | 611 } // namespace blink |
| OLD | NEW |