| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 geometryMapperOption = PaintLayer::UseGeometryMapper; | 443 geometryMapperOption = PaintLayer::UseGeometryMapper; |
| 444 | 444 |
| 445 // TODO(trchen): We haven't decided how to handle visual fragmentation with | 445 // TODO(trchen): We haven't decided how to handle visual fragmentation with |
| 446 // SPv2. Related thread | 446 // SPv2. Related thread |
| 447 // https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/81XuW
Ff-mxM | 447 // https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/81XuW
Ff-mxM |
| 448 if (fragmentPolicy == ForceSingleFragment || | 448 if (fragmentPolicy == ForceSingleFragment || |
| 449 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 449 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 450 paintLayerForFragments->appendSingleFragmentIgnoringPagination( | 450 paintLayerForFragments->appendSingleFragmentIgnoringPagination( |
| 451 layerFragments, localPaintingInfo.rootLayer, | 451 layerFragments, localPaintingInfo.rootLayer, |
| 452 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, | 452 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, |
| 453 IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, | 453 IgnorePlatformOverlayScrollbarSize, respectOverflowClip, |
| 454 localPaintingInfo.subPixelAccumulation); | 454 &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 455 } else if (isFixedPositionObjectInPagedMedia()) { | 455 } else if (isFixedPositionObjectInPagedMedia()) { |
| 456 PaintLayerFragments singleFragment; | 456 PaintLayerFragments singleFragment; |
| 457 paintLayerForFragments->appendSingleFragmentIgnoringPagination( | 457 paintLayerForFragments->appendSingleFragmentIgnoringPagination( |
| 458 singleFragment, localPaintingInfo.rootLayer, | 458 singleFragment, localPaintingInfo.rootLayer, |
| 459 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, | 459 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, |
| 460 IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, | 460 IgnorePlatformOverlayScrollbarSize, respectOverflowClip, |
| 461 localPaintingInfo.subPixelAccumulation); | 461 &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 462 repeatFixedPositionObjectInPages(singleFragment[0], paintingInfo, | 462 repeatFixedPositionObjectInPages(singleFragment[0], paintingInfo, |
| 463 layerFragments); | 463 layerFragments); |
| 464 } else { | 464 } else { |
| 465 paintLayerForFragments->collectFragments( | 465 paintLayerForFragments->collectFragments( |
| 466 layerFragments, localPaintingInfo.rootLayer, | 466 layerFragments, localPaintingInfo.rootLayer, |
| 467 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, | 467 localPaintingInfo.paintDirtyRect, cacheSlot, geometryMapperOption, |
| 468 IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, | 468 IgnorePlatformOverlayScrollbarSize, respectOverflowClip, |
| 469 localPaintingInfo.subPixelAccumulation); | 469 &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 470 } | 470 } |
| 471 | 471 |
| 472 if (paintFlags & PaintLayerPaintingAncestorClippingMaskPhase) { | 472 if (paintFlags & PaintLayerPaintingAncestorClippingMaskPhase) { |
| 473 // Fragment offsets have been computed in the clipping container's | 473 // Fragment offsets have been computed in the clipping container's |
| 474 // layer's coordinate system, but for the rest of painting we need | 474 // layer's coordinate system, but for the rest of painting we need |
| 475 // them in the layer coordinate. So move them and the foreground rect | 475 // them in the layer coordinate. So move them and the foreground rect |
| 476 // that is also in the clipper's space. | 476 // that is also in the clipper's space. |
| 477 LayoutSize negativeOffset(-offsetToClipper.x(), -offsetToClipper.y()); | 477 LayoutSize negativeOffset(-offsetToClipper.x(), -offsetToClipper.y()); |
| 478 for (auto& fragment : layerFragments) { | 478 for (auto& fragment : layerFragments) { |
| 479 fragment.foregroundRect.move(negativeOffset); | 479 fragment.foregroundRect.move(negativeOffset); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 LayoutRect transformedExtent = PaintLayer::transparencyClipBox( | 722 LayoutRect transformedExtent = PaintLayer::transparencyClipBox( |
| 723 &m_paintLayer, paginationLayer, PaintLayer::PaintingTransparencyClipBox, | 723 &m_paintLayer, paginationLayer, PaintLayer::PaintingTransparencyClipBox, |
| 724 PaintLayer::RootOfTransparencyClipBox, | 724 PaintLayer::RootOfTransparencyClipBox, |
| 725 paintingInfo.subPixelAccumulation, paintingInfo.getGlobalPaintFlags()); | 725 paintingInfo.subPixelAccumulation, paintingInfo.getGlobalPaintFlags()); |
| 726 | 726 |
| 727 // FIXME: we don't check if paginationLayer is within | 727 // FIXME: we don't check if paginationLayer is within |
| 728 // paintingInfo.rootLayer | 728 // paintingInfo.rootLayer |
| 729 // here. | 729 // here. |
| 730 paginationLayer->collectFragments( | 730 paginationLayer->collectFragments( |
| 731 layerFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, | 731 layerFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, |
| 732 cacheSlot, geometryMapperOption, IgnoreOverlayScrollbarSize, | 732 cacheSlot, geometryMapperOption, IgnorePlatformOverlayScrollbarSize, |
| 733 respectOverflowClip, nullptr, paintingInfo.subPixelAccumulation, | 733 respectOverflowClip, nullptr, paintingInfo.subPixelAccumulation, |
| 734 &transformedExtent); | 734 &transformedExtent); |
| 735 } | 735 } |
| 736 | 736 |
| 737 Optional<DisplayItemCacheSkipper> cacheSkipper; | 737 Optional<DisplayItemCacheSkipper> cacheSkipper; |
| 738 if (layerFragments.size() > 1) | 738 if (layerFragments.size() > 1) |
| 739 cacheSkipper.emplace(context); | 739 cacheSkipper.emplace(context); |
| 740 | 740 |
| 741 ClipRect ancestorBackgroundClipRect; | 741 ClipRect ancestorBackgroundClipRect; |
| 742 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 742 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 743 if (parentLayer) { | 743 if (parentLayer) { |
| 744 // Calculate the clip rectangle that the ancestors establish. | 744 // Calculate the clip rectangle that the ancestors establish. |
| 745 ClipRectsContext clipRectsContext( | 745 ClipRectsContext clipRectsContext( |
| 746 paintingInfo.rootLayer, | 746 paintingInfo.rootLayer, |
| 747 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects | 747 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects |
| 748 : PaintingClipRects, | 748 : PaintingClipRects, |
| 749 IgnoreOverlayScrollbarSize); | 749 IgnorePlatformOverlayScrollbarSize); |
| 750 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) == | 750 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) == |
| 751 IgnoreOverflowClip) | 751 IgnoreOverflowClip) |
| 752 clipRectsContext.setIgnoreOverflowClip(); | 752 clipRectsContext.setIgnoreOverflowClip(); |
| 753 m_paintLayer.clipper(geometryMapperOption) | 753 m_paintLayer.clipper(geometryMapperOption) |
| 754 .calculateBackgroundClipRect(clipRectsContext, | 754 .calculateBackgroundClipRect(clipRectsContext, |
| 755 ancestorBackgroundClipRect); | 755 ancestorBackgroundClipRect); |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 | 758 |
| 759 PaintResult result = FullyPainted; | 759 PaintResult result = FullyPainted; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 context, layoutObject, PaintPhaseClippingMask)) | 1205 context, layoutObject, PaintPhaseClippingMask)) |
| 1206 return; | 1206 return; |
| 1207 | 1207 |
| 1208 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 1208 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
| 1209 LayoutObjectDrawingRecorder drawingRecorder( | 1209 LayoutObjectDrawingRecorder drawingRecorder( |
| 1210 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); | 1210 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); |
| 1211 context.fillRect(snappedClipRect, Color::black); | 1211 context.fillRect(snappedClipRect, Color::black); |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 } // namespace blink | 1214 } // namespace blink |
| OLD | NEW |