| 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 "core/paint/PaintLayerPainter.h" |    5 #include "core/paint/PaintLayerPainter.h" | 
|    6  |    6  | 
|    7 #include "core/frame/LocalFrame.h" |    7 #include "core/frame/LocalFrame.h" | 
|    8 #include "core/layout/LayoutInline.h" |    8 #include "core/layout/LayoutInline.h" | 
|    9 #include "core/layout/LayoutView.h" |    9 #include "core/layout/LayoutView.h" | 
|   10 #include "core/paint/ClipPathClipper.h" |   10 #include "core/paint/ClipPathClipper.h" | 
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  196     // foreground phase. Since scrolled contents are moved by paint invalidation
      in this |  196     // foreground phase. Since scrolled contents are moved by paint invalidation
      in this | 
|  197     // case, the outline won't get 'dragged along'. |  197     // case, the outline won't get 'dragged along'. | 
|  198     bool shouldPaintSelfOutline = isSelfPaintingLayer && !isPaintingOverlayScrol
     lbars |  198     bool shouldPaintSelfOutline = isSelfPaintingLayer && !isPaintingOverlayScrol
     lbars | 
|  199         && ((isPaintingScrollingContent && isPaintingCompositedBackground) |  199         && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 
|  200             || (!isPaintingScrollingContent && isPaintingCompositedForeground)) |  200             || (!isPaintingScrollingContent && isPaintingCompositedForeground)) | 
|  201         && m_paintLayer.layoutObject()->styleRef().hasOutline(); |  201         && m_paintLayer.layoutObject()->styleRef().hasOutline(); | 
|  202     bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting
     Layer && !isPaintingOverlayScrollbars; |  202     bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting
     Layer && !isPaintingOverlayScrollbars; | 
|  203  |  203  | 
|  204     PaintResult result = FullyPainted; |  204     PaintResult result = FullyPainted; | 
|  205  |  205  | 
|  206     if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou
     tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) |  206     if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou
     tObject()->isLayoutView()) | 
|  207         return result; |  207         return result; | 
|  208  |  208  | 
|  209     if (m_paintLayer.layoutObject()->view()->frame() && m_paintLayer.layoutObjec
     t()->view()->frame()->shouldThrottleRendering()) |  209     if (m_paintLayer.layoutObject()->view()->frame() && m_paintLayer.layoutObjec
     t()->view()->frame()->shouldThrottleRendering()) | 
|  210         return result; |  210         return result; | 
|  211  |  211  | 
|  212     // Ensure our lists are up to date. |  212     // Ensure our lists are up to date. | 
|  213     m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |  213     m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 
|  214  |  214  | 
|  215     LayoutSize subpixelAccumulation = m_paintLayer.compositingState() == PaintsI
     ntoOwnBacking ? m_paintLayer.subpixelAccumulation() : paintingInfoArg.subPixelAc
     cumulation; |  215     LayoutSize subpixelAccumulation = m_paintLayer.compositingState() == PaintsI
     ntoOwnBacking ? m_paintLayer.subpixelAccumulation() : paintingInfoArg.subPixelAc
     cumulation; | 
|  216     ShouldRespectOverflowClipType respectOverflowClip = shouldRespectOverflowCli
     p(paintFlags, m_paintLayer.layoutObject()); |  216     ShouldRespectOverflowClipType respectOverflowClip = shouldRespectOverflowCli
     p(paintFlags, m_paintLayer.layoutObject()); | 
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  557                 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou
     tBox()->scrolledContentOffset(); |  557                 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou
     tBox()->scrolledContentOffset(); | 
|  558         } |  558         } | 
|  559  |  559  | 
|  560         if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == M
     ayBeClippedByPaintDirtyRect) |  560         if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == M
     ayBeClippedByPaintDirtyRect) | 
|  561             result = MayBeClippedByPaintDirtyRect; |  561             result = MayBeClippedByPaintDirtyRect; | 
|  562     } |  562     } | 
|  563  |  563  | 
|  564     return result; |  564     return result; | 
|  565 } |  565 } | 
|  566  |  566  | 
|  567 // FIXME: inline this. |  | 
|  568 static bool paintForFixedRootBackground(const PaintLayer* layer, PaintLayerFlags
      paintFlags) |  | 
|  569 { |  | 
|  570     return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye
     rPaintingRootBackgroundOnly); |  | 
|  571 } |  | 
|  572  |  | 
|  573 bool PaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPaintFlags gl
     obalPaintFlags, PaintLayerFlags paintFlags) |  567 bool PaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPaintFlags gl
     obalPaintFlags, PaintLayerFlags paintFlags) | 
|  574 { |  568 { | 
|  575     DisableCompositingQueryAsserts disabler; |  569     DisableCompositingQueryAsserts disabler; | 
|  576  |  570  | 
|  577     return m_paintLayer.compositingState() == NotComposited |  571     return m_paintLayer.compositingState() == NotComposited | 
|  578         || (globalPaintFlags & GlobalPaintFlattenCompositingLayers) |  572         || (globalPaintFlags & GlobalPaintFlattenCompositingLayers) | 
|  579         || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr
     ansform()) |  573         || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr
     ansform()); | 
|  580         || paintForFixedRootBackground(&m_paintLayer, paintFlags); |  | 
|  581 } |  574 } | 
|  582  |  575  | 
|  583 void PaintLayerPainter::paintOverflowControlsForFragments(const PaintLayerFragme
     nts& layerFragments, GraphicsContext& context, const PaintLayerPaintingInfo& loc
     alPaintingInfo, PaintLayerFlags paintFlags) |  576 void PaintLayerPainter::paintOverflowControlsForFragments(const PaintLayerFragme
     nts& layerFragments, GraphicsContext& context, const PaintLayerPaintingInfo& loc
     alPaintingInfo, PaintLayerFlags paintFlags) | 
|  584 { |  577 { | 
|  585     PaintLayerScrollableArea* scrollableArea = m_paintLayer.getScrollableArea(); |  578     PaintLayerScrollableArea* scrollableArea = m_paintLayer.getScrollableArea(); | 
|  586     if (!scrollableArea) |  579     if (!scrollableArea) | 
|  587         return; |  580         return; | 
|  588  |  581  | 
|  589     Optional<DisplayItemCacheSkipper> cacheSkipper; |  582     Optional<DisplayItemCacheSkipper> cacheSkipper; | 
|  590     if (layerFragments.size() > 1) |  583     if (layerFragments.size() > 1) | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  670         cacheSkipper.emplace(context); |  663         cacheSkipper.emplace(context); | 
|  671  |  664  | 
|  672     for (auto& fragment : layerFragments) |  665     for (auto& fragment : layerFragments) | 
|  673         paintFragmentWithPhase(PaintPhaseSelfBlockBackgroundOnly, fragment, cont
     ext, fragment.backgroundRect, localPaintingInfo, paintFlags, HasNotClipped); |  666         paintFragmentWithPhase(PaintPhaseSelfBlockBackgroundOnly, fragment, cont
     ext, fragment.backgroundRect, localPaintingInfo, paintFlags, HasNotClipped); | 
|  674 } |  667 } | 
|  675  |  668  | 
|  676 void PaintLayerPainter::paintForegroundForFragments(const PaintLayerFragments& l
     ayerFragments, |  669 void PaintLayerPainter::paintForegroundForFragments(const PaintLayerFragments& l
     ayerFragments, | 
|  677     GraphicsContext& context, const LayoutRect& transparencyPaintDirtyRect, |  670     GraphicsContext& context, const LayoutRect& transparencyPaintDirtyRect, | 
|  678     const PaintLayerPaintingInfo& localPaintingInfo, bool selectionOnly, PaintLa
     yerFlags paintFlags) |  671     const PaintLayerPaintingInfo& localPaintingInfo, bool selectionOnly, PaintLa
     yerFlags paintFlags) | 
|  679 { |  672 { | 
 |  673     DCHECK(!(paintFlags & PaintLayerPaintingRootBackgroundOnly)); | 
 |  674  | 
|  680     // Optimize clipping for the single fragment case. |  675     // Optimize clipping for the single fragment case. | 
|  681     bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
      == 1 && !layerFragments[0].foregroundRect.isEmpty(); |  676     bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
      == 1 && !layerFragments[0].foregroundRect.isEmpty(); | 
|  682     ClipState clipState = HasNotClipped; |  677     ClipState clipState = HasNotClipped; | 
|  683     Optional<LayerClipRecorder> clipRecorder; |  678     Optional<LayerClipRecorder> clipRecorder; | 
|  684     if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
     dRect)) { |  679     if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
     dRect)) { | 
|  685         clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
     :kClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, lay
     erFragments[0].paginationOffset, paintFlags); |  680         clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem:
     :kClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, lay
     erFragments[0].paginationOffset, paintFlags); | 
|  686         clipState = HasClipped; |  681         clipState = HasClipped; | 
|  687     } |  682     } | 
|  688  |  683  | 
|  689     // We have to loop through every fragment multiple times, since we have to i
     ssue paint invalidations in each specific phase in order for |  684     // We have to loop through every fragment multiple times, since we have to i
     ssue paint invalidations in each specific phase in order for | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  755     if (!m_paintLayer.containsDirtyOverlayScrollbars()) |  750     if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 
|  756         return; |  751         return; | 
|  757  |  752  | 
|  758     PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
     ct(damageRect)), paintFlags, LayoutSize()); |  753     PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
     ct(damageRect)), paintFlags, LayoutSize()); | 
|  759     paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |  754     paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 
|  760  |  755  | 
|  761     m_paintLayer.setContainsDirtyOverlayScrollbars(false); |  756     m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 
|  762 } |  757 } | 
|  763  |  758  | 
|  764 } // namespace blink |  759 } // namespace blink | 
| OLD | NEW |