| 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" |
| 11 #include "core/layout/LayoutFrame.h" |
| 11 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
| 12 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 13 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 13 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
| 14 #include "core/paint/CompositingRecorder.h" | 15 #include "core/paint/CompositingRecorder.h" |
| 15 #include "core/paint/DeprecatedPaintLayer.h" | 16 #include "core/paint/DeprecatedPaintLayer.h" |
| 16 #include "core/paint/FilterPainter.h" | 17 #include "core/paint/FilterPainter.h" |
| 17 #include "core/paint/LayerClipRecorder.h" | 18 #include "core/paint/LayerClipRecorder.h" |
| 18 #include "core/paint/LayerFixedPositionRecorder.h" | 19 #include "core/paint/LayerFixedPositionRecorder.h" |
| 19 #include "core/paint/PaintInfo.h" | 20 #include "core/paint/PaintInfo.h" |
| 20 #include "core/paint/SVGClipPainter.h" | 21 #include "core/paint/SVGClipPainter.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 { | 38 { |
| 38 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. | 39 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. |
| 39 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 40 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
| 40 // will do a full paintInvalidationForWholeLayoutObject(). | 41 // will do a full paintInvalidationForWholeLayoutObject(). |
| 41 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && !
layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) | 42 if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && !
layer->isRootLayer() && !layer->layoutObject()->isDocumentElement()) |
| 42 return true; | 43 return true; |
| 43 | 44 |
| 44 return false; | 45 return false; |
| 45 } | 46 } |
| 46 | 47 |
| 48 static bool isThrottledFrameView(const LayoutObject* layoutObject) |
| 49 { |
| 50 if (!layoutObject->isLayoutPart()) |
| 51 return false; |
| 52 const LayoutPart* part = toLayoutPart(layoutObject); |
| 53 if (!part->widget() || !part->widget()->isFrameView()) |
| 54 return false; |
| 55 const FrameView* frameView = toFrameView(part->widget()); |
| 56 return frameView->shouldThrottleRenderingPipeline(); |
| 57 } |
| 58 |
| 47 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) | 59 void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRe
ct& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingR
oot, PaintLayerFlags paintFlags) |
| 48 { | 60 { |
| 49 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); | 61 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); |
| 50 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) | 62 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) |
| 51 paintLayer(context, paintingInfo, paintFlags); | 63 paintLayer(context, paintingInfo, paintFlags); |
| 52 } | 64 } |
| 53 | 65 |
| 54 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* layoutObject) | 66 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* layoutObject) |
| 55 { | 67 { |
| 56 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; | 68 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 // Non self-painting layers without self-painting descendants don't need to
be painted as their | 91 // Non self-painting layers without self-painting descendants don't need to
be painted as their |
| 80 // layoutObject() should properly paint itself. | 92 // layoutObject() should properly paint itself. |
| 81 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) { | 93 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) { |
| 82 ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimming
PaintV2Enabled()); | 94 ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimming
PaintV2Enabled()); |
| 83 return FullyPainted; | 95 return FullyPainted; |
| 84 } | 96 } |
| 85 | 97 |
| 86 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 98 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
| 87 return FullyPainted; | 99 return FullyPainted; |
| 88 | 100 |
| 101 // TODO(skyostil): Unify this early-out logic with subsequence caching. |
| 102 if (isThrottledFrameView(m_paintLayer.layoutObject())) |
| 103 return FullyPainted; |
| 104 |
| 89 // If this layer is totally invisible then there is nothing to paint. | 105 // If this layer is totally invisible then there is nothing to paint. |
| 90 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) | 106 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()-
>hasBackdropFilter()) |
| 91 return FullyPainted; | 107 return FullyPainted; |
| 92 | 108 |
| 93 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 109 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
| 94 paintFlags |= PaintLayerHaveTransparency; | 110 paintFlags |= PaintLayerHaveTransparency; |
| 95 | 111 |
| 96 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); | 112 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay
outObject()); |
| 97 | 113 |
| 98 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. | 114 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th
e transform twice. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 244 |
| 229 if (!isPaintingOverlayScrollbars | 245 if (!isPaintingOverlayScrollbars |
| 230 && !(paintingInfoArg.globalPaintFlags() & GlobalPaintFlattenCompositingL
ayers) | 246 && !(paintingInfoArg.globalPaintFlags() & GlobalPaintFlattenCompositingL
ayers) |
| 231 && !(paintFlags & PaintLayerPaintingReflection) | 247 && !(paintFlags & PaintLayerPaintingReflection) |
| 232 && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) { | 248 && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) { |
| 233 if (!scrollOffsetAccumulationChanged && !m_paintLayer.needsRepaint() &&
SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer)) | 249 if (!scrollOffsetAccumulationChanged && !m_paintLayer.needsRepaint() &&
SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer)) |
| 234 return result; | 250 return result; |
| 235 subsequenceRecorder.emplace(*context, m_paintLayer); | 251 subsequenceRecorder.emplace(*context, m_paintLayer); |
| 236 } | 252 } |
| 237 | 253 |
| 254 // TODO(skyostil): Unify this early-out logic with subsequence caching. |
| 255 if (isThrottledFrameView(m_paintLayer.layoutObject())) |
| 256 return FullyPainted; |
| 257 |
| 238 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; | 258 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; |
| 239 | 259 |
| 240 // Ensure our lists are up-to-date. | 260 // Ensure our lists are up-to-date. |
| 241 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 261 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
| 242 | 262 |
| 243 LayoutPoint offsetFromRoot; | 263 LayoutPoint offsetFromRoot; |
| 244 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 264 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
| 245 | 265 |
| 246 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 266 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 247 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | 267 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 698 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 679 return; | 699 return; |
| 680 | 700 |
| 681 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 701 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 682 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 702 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 683 | 703 |
| 684 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 704 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 685 } | 705 } |
| 686 | 706 |
| 687 } // namespace blink | 707 } // namespace blink |
| OLD | NEW |