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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/DeprecatedPaintLayerPainter.h" | 6 #include "core/paint/DeprecatedPaintLayerPainter.h" |
7 | 7 |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 { | 53 { |
54 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; | 54 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO
verflowClip : RespectOverflowClip; |
55 } | 55 } |
56 | 56 |
57 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep
recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 57 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep
recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
58 { | 58 { |
59 // https://code.google.com/p/chromium/issues/detail?id=343772 | 59 // https://code.google.com/p/chromium/issues/detail?id=343772 |
60 DisableCompositingQueryAsserts disabler; | 60 DisableCompositingQueryAsserts disabler; |
61 | 61 |
62 if (m_paintLayer.compositingState() != NotComposited) { | 62 if (m_paintLayer.compositingState() != NotComposited) { |
63 if (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)
{ | 63 if (gGlobalPaintFlags & GlobalPaintFlattenCompositingLayers) { |
64 // FIXME: ok, but what about PaintBehaviorFlattenCompositingLayers?
That's for printing. | 64 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th
at's for printing and drag image. |
65 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? | 65 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? |
66 paintFlags |= PaintLayerUncachedClipRects; | 66 paintFlags |= PaintLayerUncachedClipRects; |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. | 70 // Non self-painting leaf layers don't need to be painted as their layoutObj
ect() should properly paint itself. |
71 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) | 71 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye
rDescendant()) |
72 return; | 72 return; |
73 | 73 |
74 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 74 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; | 235 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; |
236 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli
p(paintFlags, m_paintLayer.layoutObject()); | 236 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli
p(paintFlags, m_paintLayer.layoutObject()); |
237 if (fragmentPolicy == ForceSingleFragment) | 237 if (fragmentPolicy == ForceSingleFragment) |
238 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments,
localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore
OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su
bPixelAccumulation); | 238 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments,
localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore
OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su
bPixelAccumulation); |
239 else | 239 else |
240 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root
Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize,
respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 240 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root
Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize,
respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
241 if (shouldPaintContent) | 241 if (shouldPaintContent) |
242 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra
gments, localPaintingInfo, paintFlags, offsetFromRoot); | 242 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra
gments, localPaintingInfo, paintFlags, offsetFromRoot); |
243 } | 243 } |
244 | 244 |
245 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectio
nOnly; | 245 bool selectionOnly = gGlobalPaintFlags & GlobalPaintSelectionOnly; |
246 // If this layer's layoutObject is a child of the paintingRoot, we paint unc
onditionally, which | 246 // If this layer's layoutObject is a child of the paintingRoot, we paint unc
onditionally, which |
247 // is done by passing a nil paintingRoot down to our layoutObject (as if no
paintingRoot was ever set). | 247 // is done by passing a nil paintingRoot down to our layoutObject (as if no
paintingRoot was ever set). |
248 // Else, our layout tree may or may not contain the painting root, so we pas
s that root along | 248 // Else, our layout tree may or may not contain the painting root, so we pas
s that root along |
249 // so it will be tested against as we descend through the layoutObjects. | 249 // so it will be tested against as we descend through the layoutObjects. |
250 LayoutObject* paintingRootForLayoutObject = 0; | 250 LayoutObject* paintingRootForLayoutObject = 0; |
251 if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescen
dantOf(localPaintingInfo.paintingRoot)) | 251 if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescen
dantOf(localPaintingInfo.paintingRoot)) |
252 paintingRootForLayoutObject = localPaintingInfo.paintingRoot; | 252 paintingRootForLayoutObject = localPaintingInfo.paintingRoot; |
253 | 253 |
254 { // Begin block for the lifetime of any filter. | 254 { // Begin block for the lifetime of any filter. |
255 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layer
Fragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPainti
ngInfo, paintFlags, | 255 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layer
Fragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPainti
ngInfo, paintFlags, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint
LayerFlags paintFlags) | 447 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint
LayerFlags paintFlags) |
448 { | 448 { |
449 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye
rPaintingRootBackgroundOnly); | 449 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye
rPaintingRootBackgroundOnly); |
450 } | 450 } |
451 | 451 |
452 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate
dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 452 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate
dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
453 { | 453 { |
454 DisableCompositingQueryAsserts disabler; | 454 DisableCompositingQueryAsserts disabler; |
455 | 455 |
456 return m_paintLayer.compositingState() == NotComposited | 456 return m_paintLayer.compositingState() == NotComposited |
457 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) | 457 || gGlobalPaintFlags & GlobalPaintFlattenCompositingLayers |
458 || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr
ansform()) | 458 || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr
ansform()) |
459 || paintForFixedRootBackground(&m_paintLayer, paintFlags); | 459 || paintForFixedRootBackground(&m_paintLayer, paintFlags); |
460 } | 460 } |
461 | 461 |
462 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec
atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca
tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) | 462 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec
atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca
tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) |
463 { | 463 { |
464 bool needsScope = layerFragments.size() > 1; | 464 bool needsScope = layerFragments.size() > 1; |
465 for (auto& fragment : layerFragments) { | 465 for (auto& fragment : layerFragments) { |
466 Optional<ScopeRecorder> scopeRecorder; | 466 Optional<ScopeRecorder> scopeRecorder; |
467 if (needsScope) | 467 if (needsScope) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 608 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
609 return; | 609 return; |
610 | 610 |
611 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); | 611 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); |
612 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 612 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
613 | 613 |
614 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 614 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
615 } | 615 } |
616 | 616 |
617 } // namespace blink | 617 } // namespace blink |
OLD | NEW |