| 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/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/paint/ClipPathClipper.h" | 9 #include "core/paint/ClipPathClipper.h" |
| 10 #include "core/paint/FilterPainter.h" | 10 #include "core/paint/FilterPainter.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // These helpers output clip and compositing operations using a RAII pattern. | 364 // These helpers output clip and compositing operations using a RAII pattern. |
| 365 // Stack-allocated-varibles are destructed in the reverse order of | 365 // Stack-allocated-varibles are destructed in the reverse order of |
| 366 // construction, so they are nested properly. | 366 // construction, so they are nested properly. |
| 367 Optional<ClipPathClipper> clipPathClipper; | 367 Optional<ClipPathClipper> clipPathClipper; |
| 368 // Clip-path, like border radius, must not be applied to the contents of a | 368 // Clip-path, like border radius, must not be applied to the contents of a |
| 369 // composited-scrolling container. It must, however, still be applied to the | 369 // composited-scrolling container. It must, however, still be applied to the |
| 370 // mask layer, so that the compositor can properly mask the | 370 // mask layer, so that the compositor can properly mask the |
| 371 // scrolling contents and scrollbars. | 371 // scrolling contents and scrollbars. |
| 372 if (m_paintLayer.layoutObject()->hasClipPath() && | 372 if (m_paintLayer.layoutObject()->hasClipPath() && |
| 373 (!m_paintLayer.needsCompositedScrolling() || | 373 (!m_paintLayer.needsCompositedScrolling() || |
| 374 (paintFlags & (PaintLayerPaintingChildClippingMaskPhase | | 374 (paintFlags & |
| 375 PaintLayerPaintingAncestorClippingMaskPhase)))) { | 375 (PaintLayerPaintingChildClippingMaskPhase | |
| 376 PaintLayerPaintingAncestorClippingMaskPhase)))) { |
| 376 paintingInfo.ancestorHasClipPathClipping = true; | 377 paintingInfo.ancestorHasClipPathClipping = true; |
| 377 | 378 |
| 378 LayoutRect referenceBox(m_paintLayer.boxForClipPath()); | 379 LayoutRect referenceBox(m_paintLayer.boxForClipPath()); |
| 379 // Note that this isn't going to work correctly if crossing a column | 380 // Note that this isn't going to work correctly if crossing a column |
| 380 // boundary. The reference box should be determined per-fragment, and hence | 381 // boundary. The reference box should be determined per-fragment, and hence |
| 381 // this ought to be performed after fragmentation. | 382 // this ought to be performed after fragmentation. |
| 382 if (m_paintLayer.enclosingPaginationLayer()) | 383 if (m_paintLayer.enclosingPaginationLayer()) |
| 383 m_paintLayer.convertFromFlowThreadToVisualBoundingBoxInAncestor( | 384 m_paintLayer.convertFromFlowThreadToVisualBoundingBoxInAncestor( |
| 384 paintingInfo.rootLayer, referenceBox); | 385 paintingInfo.rootLayer, referenceBox); |
| 385 else | 386 else |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 if (shouldPaintOverlayScrollbars) | 573 if (shouldPaintOverlayScrollbars) |
| 573 paintOverflowControlsForFragments(layerFragments, context, | 574 paintOverflowControlsForFragments(layerFragments, context, |
| 574 localPaintingInfo, paintFlags); | 575 localPaintingInfo, paintFlags); |
| 575 } // FilterPainter block | 576 } // FilterPainter block |
| 576 | 577 |
| 577 bool shouldPaintMask = | 578 bool shouldPaintMask = |
| 578 (paintFlags & PaintLayerPaintingCompositingMaskPhase) && | 579 (paintFlags & PaintLayerPaintingCompositingMaskPhase) && |
| 579 shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && | 580 shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && |
| 580 !selectionOnly; | 581 !selectionOnly; |
| 581 bool shouldPaintClippingMask = | 582 bool shouldPaintClippingMask = |
| 582 (paintFlags & (PaintLayerPaintingChildClippingMaskPhase | | 583 (paintFlags & |
| 583 PaintLayerPaintingAncestorClippingMaskPhase)) && | 584 (PaintLayerPaintingChildClippingMaskPhase | |
| 585 PaintLayerPaintingAncestorClippingMaskPhase)) && |
| 584 shouldPaintContent && !selectionOnly; | 586 shouldPaintContent && !selectionOnly; |
| 585 | 587 |
| 586 if (shouldPaintMask) { | 588 if (shouldPaintMask) { |
| 587 paintMaskForFragments(layerFragments, context, localPaintingInfo, | 589 paintMaskForFragments(layerFragments, context, localPaintingInfo, |
| 588 paintFlags); | 590 paintFlags); |
| 589 } | 591 } |
| 590 | 592 |
| 591 if (shouldPaintClippingMask) { | 593 if (shouldPaintClippingMask) { |
| 592 // Paint the border radius mask for the fragments. | 594 // Paint the border radius mask for the fragments. |
| 593 paintChildClippingMaskForFragments(layerFragments, context, | 595 paintChildClippingMaskForFragments(layerFragments, context, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 808 |
| 807 // TODO(jbroman): Put the real transform origin here, instead of using a | 809 // TODO(jbroman): Put the real transform origin here, instead of using a |
| 808 // matrix with the origin baked in. | 810 // matrix with the origin baked in. |
| 809 FloatPoint3D transformOrigin; | 811 FloatPoint3D transformOrigin; |
| 810 Transform3DRecorder transform3DRecorder( | 812 Transform3DRecorder transform3DRecorder( |
| 811 context, *m_paintLayer.layoutObject(), | 813 context, *m_paintLayer.layoutObject(), |
| 812 DisplayItem::kTransform3DElementTransform, transform, transformOrigin); | 814 DisplayItem::kTransform3DElementTransform, transform, transformOrigin); |
| 813 | 815 |
| 814 // Now do a paint with the root layer shifted to be us. | 816 // Now do a paint with the root layer shifted to be us. |
| 815 PaintLayerPaintingInfo transformedPaintingInfo( | 817 PaintLayerPaintingInfo transformedPaintingInfo( |
| 816 &m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect( | 818 &m_paintLayer, |
| 817 paintingInfo.paintDirtyRect))), | 819 LayoutRect(enclosingIntRect( |
| 820 transform.inverse().mapRect(paintingInfo.paintDirtyRect))), |
| 818 paintingInfo.getGlobalPaintFlags(), adjustedSubPixelAccumulation); | 821 paintingInfo.getGlobalPaintFlags(), adjustedSubPixelAccumulation); |
| 819 transformedPaintingInfo.ancestorHasClipPathClipping = | 822 transformedPaintingInfo.ancestorHasClipPathClipping = |
| 820 paintingInfo.ancestorHasClipPathClipping; | 823 paintingInfo.ancestorHasClipPathClipping; |
| 821 | 824 |
| 822 // Remove skip root background flag when we're painting with a new root. | 825 // Remove skip root background flag when we're painting with a new root. |
| 823 if (&m_paintLayer != paintingInfo.rootLayer) | 826 if (&m_paintLayer != paintingInfo.rootLayer) |
| 824 paintFlags &= ~PaintLayerPaintingSkipRootBackground; | 827 paintFlags &= ~PaintLayerPaintingSkipRootBackground; |
| 825 | 828 |
| 826 return paintLayerContentsCompositingAllPhases( | 829 return paintLayerContentsCompositingAllPhases( |
| 827 context, transformedPaintingInfo, paintFlags, ForceSingleFragment); | 830 context, transformedPaintingInfo, paintFlags, ForceSingleFragment); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 context, layoutObject, PaintPhaseClippingMask)) | 1216 context, layoutObject, PaintPhaseClippingMask)) |
| 1214 return; | 1217 return; |
| 1215 | 1218 |
| 1216 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 1219 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
| 1217 LayoutObjectDrawingRecorder drawingRecorder( | 1220 LayoutObjectDrawingRecorder drawingRecorder( |
| 1218 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); | 1221 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); |
| 1219 context.fillRect(snappedClipRect, Color::black); | 1222 context.fillRect(snappedClipRect, Color::black); |
| 1220 } | 1223 } |
| 1221 | 1224 |
| 1222 } // namespace blink | 1225 } // namespace blink |
| OLD | NEW |