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/FilterEffectRenderer.h" | 10 #include "core/layout/FilterEffectRenderer.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 return; | 192 return; |
193 | 193 |
194 // Ensure our lists are up-to-date. | 194 // Ensure our lists are up-to-date. |
195 m_renderLayer.stackingNode()->updateLayerListsIfNeeded(); | 195 m_renderLayer.stackingNode()->updateLayerListsIfNeeded(); |
196 | 196 |
197 LayoutPoint offsetFromRoot; | 197 LayoutPoint offsetFromRoot; |
198 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 198 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
199 | 199 |
200 if (m_renderLayer.compositingState() == PaintsIntoOwnBacking) | 200 if (m_renderLayer.compositingState() == PaintsIntoOwnBacking) |
201 offsetFromRoot.move(m_renderLayer.subpixelAccumulation()); | 201 offsetFromRoot.move(m_renderLayer.subpixelAccumulation()); |
| 202 else |
| 203 offsetFromRoot.move(paintingInfo.subPixelAccumulation); |
202 | 204 |
203 LayoutRect rootRelativeBounds; | 205 LayoutRect rootRelativeBounds; |
204 bool rootRelativeBoundsComputed = false; | 206 bool rootRelativeBoundsComputed = false; |
205 | 207 |
206 // These helpers output clip and compositing operations using a RAII pattern
. Stack-allocated-varibles are destructed in the reverse order of construction, | 208 // These helpers output clip and compositing operations using a RAII pattern
. Stack-allocated-varibles are destructed in the reverse order of construction, |
207 // so they are nested properly. | 209 // so they are nested properly. |
208 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela
tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); | 210 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela
tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); |
209 | 211 |
210 OwnPtr<LayerClipRecorder> clipRecorder; | 212 OwnPtr<LayerClipRecorder> clipRecorder; |
211 OwnPtr<CompositingRecorder> compositingRecorder; | 213 OwnPtr<CompositingRecorder> compositingRecorder; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate
dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 443 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate
dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
442 { | 444 { |
443 DisableCompositingQueryAsserts disabler; | 445 DisableCompositingQueryAsserts disabler; |
444 | 446 |
445 return m_renderLayer.compositingState() == NotComposited | 447 return m_renderLayer.compositingState() == NotComposited |
446 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) | 448 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) |
447 || ((paintFlags & PaintLayerPaintingReflection) && !m_renderLayer.has3DT
ransform()) | 449 || ((paintFlags & PaintLayerPaintingReflection) && !m_renderLayer.has3DT
ransform()) |
448 || paintForFixedRootBackground(&m_renderLayer, paintFlags); | 450 || paintForFixedRootBackground(&m_renderLayer, paintFlags); |
449 } | 451 } |
450 | 452 |
451 static inline LayoutSize subPixelAccumulationIfNeeded(const LayoutSize& subPixel
Accumulation, CompositingState compositingState) | |
452 { | |
453 // Only apply the sub-pixel accumulation if we don't paint into our own back
ing layer, otherwise the position | |
454 // of the renderer already includes any sub-pixel offset. | |
455 if (compositingState == PaintsIntoOwnBacking) | |
456 return LayoutSize(); | |
457 return subPixelAccumulation; | |
458 } | |
459 | |
460 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec
atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca
tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) | 453 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec
atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca
tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) |
461 { | 454 { |
462 bool needsScope = layerFragments.size() > 1; | 455 bool needsScope = layerFragments.size() > 1; |
463 for (auto& fragment : layerFragments) { | 456 for (auto& fragment : layerFragments) { |
464 OwnPtr<ScopeRecorder> scopeRecorder; | 457 OwnPtr<ScopeRecorder> scopeRecorder; |
465 if (needsScope) | 458 if (needsScope) |
466 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_renderLayer.
layoutObject())); | 459 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_renderLayer.
layoutObject())); |
467 | 460 |
468 OwnPtr<LayerClipRecorder> clipRecorder; | 461 OwnPtr<LayerClipRecorder> clipRecorder; |
469 | 462 |
470 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 463 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
471 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_renderLay
er.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRe
ct, &localPaintingInfo, fragment.paginationOffset, paintFlags)); | 464 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_renderLay
er.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRe
ct, &localPaintingInfo, fragment.paginationOffset, paintFlags)); |
472 } | 465 } |
473 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_renderLayer.s
crollableArea()) | 466 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_renderLayer.s
crollableArea()) |
474 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.layout
BoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulat
ion, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroun
dRect.rect()), true); | 467 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.layout
BoxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); |
475 } | 468 } |
476 } | 469 } |
477 | 470 |
478 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere
r, LayoutBox* ancestorColumnsRenderer) | 471 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere
r, LayoutBox* ancestorColumnsRenderer) |
479 { | 472 { |
480 LayoutView* view = renderer->view(); | 473 LayoutView* view = renderer->view(); |
481 LayoutBoxModelObject* prevBlock = renderer; | 474 LayoutBoxModelObject* prevBlock = renderer; |
482 LayoutBlock* containingBlock; | 475 LayoutBlock* containingBlock; |
483 for (containingBlock = renderer->containingBlock(); | 476 for (containingBlock = renderer->containingBlock(); |
484 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; | 477 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 break; | 619 break; |
627 default: | 620 default: |
628 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; | 621 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; |
629 break; | 622 break; |
630 } | 623 } |
631 | 624 |
632 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_renderLayer.l
ayoutObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, pai
ntFlags, clippingRule)); | 625 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_renderLayer.l
ayoutObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, pai
ntFlags, clippingRule)); |
633 } | 626 } |
634 | 627 |
635 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->layoutObject())
; | 628 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->layoutObject())
; |
636 m_renderLayer.layoutObject()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.layoutBoxLocation() + subPixelAccumulationIfNeeded(pa
intingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 629 m_renderLayer.layoutObject()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.layoutBoxLocation())); |
637 } | 630 } |
638 | 631 |
639 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa
intLayerFragments& layerFragments, GraphicsContext* context, | 632 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa
intLayerFragments& layerFragments, GraphicsContext* context, |
640 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain
tingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 633 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain
tingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
641 LayoutObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 634 LayoutObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
642 { | 635 { |
643 bool needsScope = layerFragments.size() > 1; | 636 bool needsScope = layerFragments.size() > 1; |
644 for (auto& fragment: layerFragments) { | 637 for (auto& fragment: layerFragments) { |
645 OwnPtr<ScopeRecorder> scopeRecorder; | 638 OwnPtr<ScopeRecorder> scopeRecorder; |
646 if (needsScope) | 639 if (needsScope) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 724 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
732 return; | 725 return; |
733 | 726 |
734 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enc
losingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); | 727 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enc
losingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); |
735 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 728 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
736 | 729 |
737 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 730 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
738 } | 731 } |
739 | 732 |
740 } // namespace blink | 733 } // namespace blink |
OLD | NEW |