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/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/layout/LayoutBlock.h" | 9 #include "core/layout/LayoutBlock.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 { | 258 { |
259 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); | 259 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); |
260 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); | 260 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); |
261 | 261 |
262 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); | 262 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); |
263 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; | 263 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; |
264 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; | 264 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; |
265 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; | 265 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; |
266 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; | 266 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; |
267 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents; | 267 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents; |
268 bool isPaintingBackgroundOntoForeground = paintFlags & PaintLayerPaintingBac kgroundOntoForeground; | |
268 // Outline always needs to be painted even if we have no visible content. Al so, | 269 // Outline always needs to be painted even if we have no visible content. Al so, |
269 // the outline is painted in the background phase during composited scrollin g. | 270 // the outline is painted in the background phase during composited scrollin g. |
270 // If it were painted in the foreground phase, it would move with the scroll ed | 271 // If it were painted in the foreground phase, it would move with the scroll ed |
271 // content. When not composited scrolling, the outline is painted in the | 272 // content. When not composited scrolling, the outline is painted in the |
272 // foreground phase. Since scrolled contents are moved by paint invalidation in this | 273 // foreground phase. Since scrolled contents are moved by paint invalidation in this |
273 // case, the outline won't get 'dragged along'. | 274 // case, the outline won't get 'dragged along'. |
274 bool shouldPaintSelfOutline = isSelfPaintingLayer && !isPaintingOverlayScrol lbars | 275 bool shouldPaintSelfOutline = isSelfPaintingLayer && !isPaintingOverlayScrol lbars |
275 && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 276 && ((isPaintingScrollingContent && isPaintingCompositedBackground) |
276 || (!isPaintingScrollingContent && isPaintingCompositedForeground)) | 277 || (!isPaintingScrollingContent && isPaintingCompositedForeground)) |
277 && m_paintLayer.layoutObject()->styleRef().hasOutline(); | 278 && m_paintLayer.layoutObject()->styleRef().hasOutline(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 ASSERT(objectPaintProperties && objectPaintProperties->localBorderBo xProperties()); | 375 ASSERT(objectPaintProperties && objectPaintProperties->localBorderBo xProperties()); |
375 PaintChunkProperties properties(context.getPaintController().current PaintChunkProperties()); | 376 PaintChunkProperties properties(context.getPaintController().current PaintChunkProperties()); |
376 auto& localBorderBoxProperties = *objectPaintProperties->localBorder BoxProperties(); | 377 auto& localBorderBoxProperties = *objectPaintProperties->localBorder BoxProperties(); |
377 properties.transform = localBorderBoxProperties.propertyTreeState.tr ansform; | 378 properties.transform = localBorderBoxProperties.propertyTreeState.tr ansform; |
378 properties.clip = localBorderBoxProperties.propertyTreeState.clip; | 379 properties.clip = localBorderBoxProperties.propertyTreeState.clip; |
379 properties.effect = localBorderBoxProperties.propertyTreeState.effec t; | 380 properties.effect = localBorderBoxProperties.propertyTreeState.effec t; |
380 properties.backfaceHidden = m_paintLayer.layoutObject()->hasHiddenBa ckface(); | 381 properties.backfaceHidden = m_paintLayer.layoutObject()->hasHiddenBa ckface(); |
381 scopedPaintChunkProperties.emplace(context.getPaintController(), m_p aintLayer, properties); | 382 scopedPaintChunkProperties.emplace(context.getPaintController(), m_p aintLayer, properties); |
382 } | 383 } |
383 | 384 |
384 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; | 385 bool shouldPaintBackground = shouldPaintContent && !selectionOnly |
386 && ((isPaintingBackgroundOntoForeground && isPaintingCompositedForeg round) | |
387 || isPaintingCompositedBackground); | |
385 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); | 388 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); |
386 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; | 389 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; |
387 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; | 390 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; |
388 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 391 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
389 | 392 |
390 if (shouldPaintBackground) { | 393 if (shouldPaintBackground) { |
391 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, | 394 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, |
392 localPaintingInfo, paintFlags); | 395 localPaintingInfo, paintFlags); |
393 } | 396 } |
394 | 397 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem: :ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye rFragments[0].paginationOffset, paintFlags); | 742 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), DisplayItem: :ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, laye rFragments[0].paginationOffset, paintFlags); |
740 clipState = HasClipped; | 743 clipState = HasClipped; |
741 } | 744 } |
742 | 745 |
743 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for | 746 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for |
744 // interleaving of the fragments to work properly. | 747 // interleaving of the fragments to work properly. |
745 if (selectionOnly) { | 748 if (selectionOnly) { |
746 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments , context, localPaintingInfo, paintFlags, clipState); | 749 paintForegroundForFragmentsWithPhase(PaintPhaseSelection, layerFragments , context, localPaintingInfo, paintFlags, clipState); |
747 } else { | 750 } else { |
748 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseDescendantBlockBackgrounds()) | 751 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseDescendantBlockBackgrounds()) |
749 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr oundsOnly, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 752 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantBlockBackgr oundsOnly, layerFragments, context, localPaintingInfo, paintFlags & ~PaintLayerP aintingBackgroundOntoForeground, clipState); |
flackr
2016/08/03 15:33:13
I missed earlier that we don't descend into childr
chrishtr
2016/08/03 16:44:48
Rename to PaintLayerPaintingRootBackgroundOntoFore
flackr
2016/08/03 17:47:10
Done.
| |
750 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseFloat()) | 753 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseFloat()) |
751 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments , context, localPaintingInfo, paintFlags, clipState); | 754 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments , context, localPaintingInfo, paintFlags, clipState); |
752 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintFlags, clipState); | 755 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintFlags, clipState); |
753 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseDescendantOutlines()) | 756 if (!RuntimeEnabledFeatures::paintOptimizationsEnabled() || m_paintLayer .needsPaintPhaseDescendantOutlines()) |
754 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl y, layerFragments, context, localPaintingInfo, paintFlags, clipState); | 757 paintForegroundForFragmentsWithPhase(PaintPhaseDescendantOutlinesOnl y, layerFragments, context, localPaintingInfo, paintFlags, clipState); |
755 } | 758 } |
756 } | 759 } |
757 | 760 |
758 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, | 761 void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, |
759 const PaintLayerFragments& layerFragments, GraphicsContext& context, | 762 const PaintLayerFragments& layerFragments, GraphicsContext& context, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 812 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
810 return; | 813 return; |
811 | 814 |
812 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); | 815 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); |
813 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 816 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
814 | 817 |
815 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 818 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
816 } | 819 } |
817 | 820 |
818 } // namespace blink | 821 } // namespace blink |
OLD | NEW |