Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2641173008: [SPv2] Add CSS mask support (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
index 74fefefb6a647bfc054f3798ad8fa35ded663260..d7d7cdb1ae7e1d8fa87a293786686914c7cb5244 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -493,9 +493,31 @@ PaintResult PaintLayerPainter::paintLayerContents(
}
}
+ Optional<ScopedPaintChunkProperties> contentScopedPaintChunkProperties;
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
+ !scopedPaintChunkProperties.has_value()) {
+ // If layoutObject() is a LayoutView and root layer scrolling is enabled,
+ // the LayoutView's paint properties will already have been applied at
+ // the top of this method, in scopedPaintChunkProperties.
+ DCHECK(!(RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+ m_paintLayer.layoutObject() &&
+ m_paintLayer.layoutObject()->isLayoutView()));
+ const auto* objectPaintProperties =
+ m_paintLayer.layoutObject()->paintProperties();
+ DCHECK(objectPaintProperties &&
+ objectPaintProperties->localBorderBoxProperties());
+ PaintChunkProperties properties(
+ context.getPaintController().currentPaintChunkProperties());
+ properties.propertyTreeState =
+ *objectPaintProperties->localBorderBoxProperties();
+ properties.backfaceHidden =
+ m_paintLayer.layoutObject()->hasHiddenBackface();
+ contentScopedPaintChunkProperties.emplace(context.getPaintController(),
+ m_paintLayer, properties);
+ }
+
bool selectionOnly =
localPaintingInfo.getGlobalPaintFlags() & GlobalPaintSelectionOnly;
-
{ // Begin block for the lifetime of any filter.
FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot,
layerFragments.isEmpty()
@@ -503,29 +525,6 @@ PaintResult PaintLayerPainter::paintLayerContents(
: layerFragments[0].backgroundRect,
localPaintingInfo, paintFlags);
- Optional<ScopedPaintChunkProperties> contentScopedPaintChunkProperties;
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
- !scopedPaintChunkProperties.has_value()) {
- // If layoutObject() is a LayoutView and root layer scrolling is enabled,
- // the LayoutView's paint properties will already have been applied at
- // the top of this method, in scopedPaintChunkProperties.
- DCHECK(!(RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
- m_paintLayer.layoutObject() &&
- m_paintLayer.layoutObject()->isLayoutView()));
- const auto* objectPaintProperties =
- m_paintLayer.layoutObject()->paintProperties();
- DCHECK(objectPaintProperties &&
- objectPaintProperties->localBorderBoxProperties());
- PaintChunkProperties properties(
- context.getPaintController().currentPaintChunkProperties());
- properties.propertyTreeState =
- *objectPaintProperties->localBorderBoxProperties();
- properties.backfaceHidden =
- m_paintLayer.layoutObject()->hasHiddenBackface();
- contentScopedPaintChunkProperties.emplace(context.getPaintController(),
- m_paintLayer, properties);
- }
-
bool isPaintingRootLayer = (&m_paintLayer) == paintingInfo.rootLayer;
bool shouldPaintBackground =
shouldPaintContent && !selectionOnly &&
@@ -584,9 +583,11 @@ PaintResult PaintLayerPainter::paintLayerContents(
PaintLayerPaintingAncestorClippingMaskPhase)) &&
shouldPaintContent && !selectionOnly;
- if (shouldPaintMask)
+ if (shouldPaintMask) {
paintMaskForFragments(layerFragments, context, localPaintingInfo,
paintFlags);
+ }
+
if (shouldPaintClippingMask) {
// Paint the border radius mask for the fragments.
paintChildClippingMaskForFragments(layerFragments, context,
@@ -1157,6 +1158,18 @@ void PaintLayerPainter::paintMaskForFragments(
if (layerFragments.size() > 1)
cacheSkipper.emplace(context);
+ Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties;
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ const auto* objectPaintProperties =
+ m_paintLayer.layoutObject()->paintProperties();
+ DCHECK(objectPaintProperties && objectPaintProperties->mask());
+ PaintChunkProperties properties(
+ context.getPaintController().currentPaintChunkProperties());
+ properties.propertyTreeState.setEffect(objectPaintProperties->mask());
+ scopedPaintChunkProperties.emplace(context.getPaintController(),
+ m_paintLayer, properties);
+ }
+
for (auto& fragment : layerFragments)
paintFragmentWithPhase(PaintPhaseMask, fragment, context,
fragment.backgroundRect, localPaintingInfo,
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698