| 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags())); | 800 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags())); |
| 801 IntPoint roundedDelta = roundedIntPoint(delta); | 801 IntPoint roundedDelta = roundedIntPoint(delta); |
| 802 transform.translateRight(roundedDelta.x(), roundedDelta.y()); | 802 transform.translateRight(roundedDelta.x(), roundedDelta.y()); |
| 803 LayoutSize adjustedSubPixelAccumulation = | 803 LayoutSize adjustedSubPixelAccumulation = |
| 804 paintingInfo.subPixelAccumulation + (delta - roundedDelta); | 804 paintingInfo.subPixelAccumulation + (delta - roundedDelta); |
| 805 | 805 |
| 806 // TODO(jbroman): Put the real transform origin here, instead of using a | 806 // TODO(jbroman): Put the real transform origin here, instead of using a |
| 807 // matrix with the origin baked in. | 807 // matrix with the origin baked in. |
| 808 FloatPoint3D transformOrigin; | 808 FloatPoint3D transformOrigin; |
| 809 Transform3DRecorder transform3DRecorder( | 809 Transform3DRecorder transform3DRecorder( |
| 810 context, *m_paintLayer.layoutObject(), | 810 context, DisplayItem::kTransform3DElementTransform, transform, |
| 811 DisplayItem::kTransform3DElementTransform, transform, transformOrigin); | 811 transformOrigin, m_paintLayer.layoutObject()->visualRect(), |
| 812 m_paintLayer.layoutObject()->debugName(), |
| 813 m_paintLayer.layoutObject() |
| 814 ->paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
| 812 | 815 |
| 813 // 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. |
| 814 PaintLayerPaintingInfo transformedPaintingInfo( | 817 PaintLayerPaintingInfo transformedPaintingInfo( |
| 815 &m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect( | 818 &m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect( |
| 816 paintingInfo.paintDirtyRect))), | 819 paintingInfo.paintDirtyRect))), |
| 817 paintingInfo.getGlobalPaintFlags(), adjustedSubPixelAccumulation); | 820 paintingInfo.getGlobalPaintFlags(), adjustedSubPixelAccumulation); |
| 818 transformedPaintingInfo.ancestorHasClipPathClipping = | 821 transformedPaintingInfo.ancestorHasClipPathClipping = |
| 819 paintingInfo.ancestorHasClipPathClipping; | 822 paintingInfo.ancestorHasClipPathClipping; |
| 820 | 823 |
| 821 // Remove skip root background flag when we're painting with a new root. | 824 // Remove skip root background flag when we're painting with a new root. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), | 915 clipRecorder.emplace(context, *m_paintLayer.layoutObject(), |
| 913 DisplayItem::kClipLayerOverflowControls, | 916 DisplayItem::kClipLayerOverflowControls, |
| 914 fragment.backgroundRect, localPaintingInfo.rootLayer, | 917 fragment.backgroundRect, localPaintingInfo.rootLayer, |
| 915 fragment.paginationOffset, paintFlags); | 918 fragment.paginationOffset, paintFlags); |
| 916 } | 919 } |
| 917 | 920 |
| 918 Optional<ScrollRecorder> scrollRecorder; | 921 Optional<ScrollRecorder> scrollRecorder; |
| 919 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 922 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 920 !localPaintingInfo.scrollOffsetAccumulation.isZero()) { | 923 !localPaintingInfo.scrollOffsetAccumulation.isZero()) { |
| 921 cullRect.move(localPaintingInfo.scrollOffsetAccumulation); | 924 cullRect.move(localPaintingInfo.scrollOffsetAccumulation); |
| 922 scrollRecorder.emplace(context, *m_paintLayer.layoutObject(), | 925 scrollRecorder.emplace( |
| 923 DisplayItem::kScrollOverflowControls, | 926 context, DisplayItem::kScrollOverflowControls, |
| 924 localPaintingInfo.scrollOffsetAccumulation); | 927 localPaintingInfo.scrollOffsetAccumulation, |
| 928 m_paintLayer.layoutObject()->visualRect(), |
| 929 m_paintLayer.layoutObject()->debugName(), |
| 930 m_paintLayer.layoutObject() |
| 931 ->paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
| 925 } | 932 } |
| 926 | 933 |
| 927 // We pass IntPoint() as the paint offset here, because | 934 // We pass IntPoint() as the paint offset here, because |
| 928 // ScrollableArea::paintOverflowControls just ignores it and uses the | 935 // ScrollableArea::paintOverflowControls just ignores it and uses the |
| 929 // offset found in a previous pass. | 936 // offset found in a previous pass. |
| 930 CullRect snappedCullRect(pixelSnappedIntRect(cullRect)); | 937 CullRect snappedCullRect(pixelSnappedIntRect(cullRect)); |
| 931 ScrollableAreaPainter(*scrollableArea) | 938 ScrollableAreaPainter(*scrollableArea) |
| 932 .paintOverflowControls(context, IntPoint(), snappedCullRect, true); | 939 .paintOverflowControls(context, IntPoint(), snappedCullRect, true); |
| 933 } | 940 } |
| 934 } | 941 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 if (!paintingInfo.scrollOffsetAccumulation.isZero()) { | 1000 if (!paintingInfo.scrollOffsetAccumulation.isZero()) { |
| 994 // As a descendant of the root layer, m_paintLayer's painting is not | 1001 // As a descendant of the root layer, m_paintLayer's painting is not |
| 995 // controlled by the ScrollRecorders created by BlockPainter of the | 1002 // controlled by the ScrollRecorders created by BlockPainter of the |
| 996 // ancestor layers up to the root layer, so we need to issue | 1003 // ancestor layers up to the root layer, so we need to issue |
| 997 // ScrollRecorder for this layer seperately, with the scroll offset | 1004 // ScrollRecorder for this layer seperately, with the scroll offset |
| 998 // accumulated from the root layer to the parent of this layer, to get the | 1005 // accumulated from the root layer to the parent of this layer, to get the |
| 999 // same result as ScrollRecorder in BlockPainter. | 1006 // same result as ScrollRecorder in BlockPainter. |
| 1000 paintOffset += paintingInfo.scrollOffsetAccumulation; | 1007 paintOffset += paintingInfo.scrollOffsetAccumulation; |
| 1001 | 1008 |
| 1002 newCullRect.move(paintingInfo.scrollOffsetAccumulation); | 1009 newCullRect.move(paintingInfo.scrollOffsetAccumulation); |
| 1003 scrollRecorder.emplace(context, *m_paintLayer.layoutObject(), phase, | 1010 scrollRecorder.emplace( |
| 1004 paintingInfo.scrollOffsetAccumulation); | 1011 context, phase, paintingInfo.scrollOffsetAccumulation, |
| 1012 m_paintLayer.layoutObject()->visualRect(), |
| 1013 m_paintLayer.layoutObject()->debugName(), |
| 1014 m_paintLayer.layoutObject() |
| 1015 ->paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
| 1005 } | 1016 } |
| 1006 } | 1017 } |
| 1007 PaintInfo paintInfo(context, pixelSnappedIntRect(newCullRect), phase, | 1018 PaintInfo paintInfo(context, pixelSnappedIntRect(newCullRect), phase, |
| 1008 paintingInfo.getGlobalPaintFlags(), paintFlags, | 1019 paintingInfo.getGlobalPaintFlags(), paintFlags, |
| 1009 paintingInfo.rootLayer->layoutObject()); | 1020 paintingInfo.rootLayer->layoutObject()); |
| 1010 | 1021 |
| 1011 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); | 1022 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); |
| 1012 } | 1023 } |
| 1013 | 1024 |
| 1014 void PaintLayerPainter::paintBackgroundForFragments( | 1025 void PaintLayerPainter::paintBackgroundForFragments( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 context, layoutObject, PaintPhaseClippingMask)) | 1211 context, layoutObject, PaintPhaseClippingMask)) |
| 1201 return; | 1212 return; |
| 1202 | 1213 |
| 1203 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 1214 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
| 1204 LayoutObjectDrawingRecorder drawingRecorder( | 1215 LayoutObjectDrawingRecorder drawingRecorder( |
| 1205 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); | 1216 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); |
| 1206 context.fillRect(snappedClipRect, Color::black); | 1217 context.fillRect(snappedClipRect, Color::black); |
| 1207 } | 1218 } |
| 1208 | 1219 |
| 1209 } // namespace blink | 1220 } // namespace blink |
| OLD | NEW |