| 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/ClipPathOperation.h" | 9 #include "core/layout/ClipPathOperation.h" |
| 10 #include "core/layout/LayoutBlock.h" | 10 #include "core/layout/LayoutBlock.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 PaintLayerFragments layerFragments; | 330 PaintLayerFragments layerFragments; |
| 331 if (shouldPaintContent || shouldPaintSelfOutline || isPaintingOverlayScrollb
ars) { | 331 if (shouldPaintContent || shouldPaintSelfOutline || isPaintingOverlayScrollb
ars) { |
| 332 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment. | 332 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment. |
| 333 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; | 333 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; |
| 334 // TODO(trchen): We haven't decided how to handle visual fragmentation w
ith SPv2. | 334 // TODO(trchen): We haven't decided how to handle visual fragmentation w
ith SPv2. |
| 335 // Related thread https://groups.google.com/a/chromium.org/forum/#!topic
/graphics-dev/81XuWFf-mxM | 335 // Related thread https://groups.google.com/a/chromium.org/forum/#!topic
/graphics-dev/81XuWFf-mxM |
| 336 if (fragmentPolicy == ForceSingleFragment || RuntimeEnabledFeatures::sli
mmingPaintV2Enabled()) | 336 if (fragmentPolicy == ForceSingleFragment || RuntimeEnabledFeatures::sli
mmingPaintV2Enabled()) |
| 337 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments,
localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore
OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su
bPixelAccumulation); | 337 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments,
localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore
OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su
bPixelAccumulation); |
| 338 else | 338 else |
| 339 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root
Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize,
respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 339 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root
Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize,
respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 340 |
| 341 // TODO(trchen): Needs to adjust cull rect between transform spaces. htt
ps://crbug.com/593596 |
| 342 // Disables layer culling for SPv2 for now because the space of the cull
rect doesn't match |
| 343 // the space we paint in. Clipping will still be done by clip nodes, so
this won't cause |
| 344 // rendering issues, only performance. |
| 345 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 346 layerFragments[0].backgroundRect = LayoutRect(LayoutRect::infiniteIn
tRect()); |
| 347 layerFragments[0].foregroundRect = LayoutRect(LayoutRect::infiniteIn
tRect()); |
| 348 } |
| 349 |
| 340 if (shouldPaintContent) { | 350 if (shouldPaintContent) { |
| 341 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi
lar optimization for slimming paint v2. | 351 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi
lar optimization for slimming paint v2. |
| 342 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra
gments, localPaintingInfo, paintFlags, offsetFromRoot); | 352 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra
gments, localPaintingInfo, paintFlags, offsetFromRoot); |
| 343 if (!shouldPaintContent) | 353 if (!shouldPaintContent) |
| 344 result = MayBeClippedByPaintDirtyRect; | 354 result = MayBeClippedByPaintDirtyRect; |
| 345 } | 355 } |
| 346 } | 356 } |
| 347 | 357 |
| 348 bool selectionOnly = localPaintingInfo.getGlobalPaintFlags() & GlobalPaintSe
lectionOnly; | 358 bool selectionOnly = localPaintingInfo.getGlobalPaintFlags() & GlobalPaintSe
lectionOnly; |
| 349 | 359 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintFlags); | 417 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintFlags); |
| 408 } | 418 } |
| 409 | 419 |
| 410 if (subsequenceRecorder) | 420 if (subsequenceRecorder) |
| 411 m_paintLayer.setPreviousPaintResult(result); | 421 m_paintLayer.setPreviousPaintResult(result); |
| 412 return result; | 422 return result; |
| 413 } | 423 } |
| 414 | 424 |
| 415 bool PaintLayerPainter::needsToClip(const PaintLayerPaintingInfo& localPaintingI
nfo, const ClipRect& clipRect) | 425 bool PaintLayerPainter::needsToClip(const PaintLayerPaintingInfo& localPaintingI
nfo, const ClipRect& clipRect) |
| 416 { | 426 { |
| 427 // Clipping will be applied by property nodes directly for SPv2. |
| 428 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 429 return false; |
| 430 |
| 417 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa
dius(); | 431 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa
dius(); |
| 418 } | 432 } |
| 419 | 433 |
| 420 bool PaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(PaintLayerFragmen
ts& fragments, const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags
localPaintFlags, const LayoutPoint& offsetFromRoot) | 434 bool PaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(PaintLayerFragmen
ts& fragments, const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags
localPaintFlags, const LayoutPoint& offsetFromRoot) |
| 421 { | 435 { |
| 422 if (m_paintLayer.enclosingPaginationLayer()) | 436 if (m_paintLayer.enclosingPaginationLayer()) |
| 423 return true; // The fragments created have already been found to interse
ct with the damage rect. | 437 return true; // The fragments created have already been found to interse
ct with the damage rect. |
| 424 | 438 |
| 425 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint
LayerPaintingOverflowContents)) | 439 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint
LayerPaintingOverflowContents)) |
| 426 return true; | 440 return true; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 808 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 795 return; | 809 return; |
| 796 | 810 |
| 797 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 811 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
| 798 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 812 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 799 | 813 |
| 800 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 814 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 801 } | 815 } |
| 802 | 816 |
| 803 } // namespace blink | 817 } // namespace blink |
| OLD | NEW |