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

Unified Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 2641173008: [SPv2] Add CSS mask support (Closed)
Patch Set: Created 3 years, 11 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/ObjectPaintProperties.h
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
index 2ccf33bcf22d1e122551ed12defbf0806f4b1efb..d2dba1d3948500dd99b97cee3a5098dedbbdcab6 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -96,15 +96,45 @@ class CORE_EXPORT ObjectPaintProperties {
// scroll offset is stored in the transform tree (m_scrollTranslation).
const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); }
+ // The hierarchy of the effect subtree created by a LayoutObject as follows:
+ // [ mask isolation ]
+ // | Isolated group created by CSS mask. Masked contents go in here.
+ // +-[ effect ]
+ // | Isolated group for effects other than CSS mask. Including opacity
+ // | and filters.
+ // +-[ mask content ]
+ // Isolated group for painting the mask itself. This node will have
+ // SkBlendMode::kDstIn and shall paint last, i.e. after masked contents.
+ const EffectPaintPropertyNode* maskIsolation() const {
+ return m_maskIsolation.get();
+ }
+ const EffectPaintPropertyNode* maskContent() const {
+ return m_maskContent.get();
+ }
const EffectPaintPropertyNode* effect() const { return m_effect.get(); }
// The hierarchy of the clip subtree created by a LayoutObject is as follows:
- // [ css clip ]
- // [ css clip fixed position]
- // [ inner border radius clip ] Clip created by a rounded border with overflow
- // clip. This clip is not inset by scrollbars.
- // +--- [ overflow clip ] Clip created by overflow clip and is inset by
- // the scrollbars.
+ // [ mask clip ]
+ // | Clip created by CSS mask. It serves two purposes:
+ // | 1. Cull painting of the masked subtree. Because anything outside of
+ // | the mask is never visible, it is pointless to paint them.
+ // | 2. Raster clip of the masked subtree. Because the mask implemented
+ // | as SkBlendMode::kDstIn, pixels outside of mask's bound will be
+ // | intact when they shall be masked out. This clip ensures no pixels
+ // | leak out.
+ // +-[ css clip ]
+ // | Clip created by CSS clip. CSS clip applies to all descendants, this
+ // | node only applies to containing block descendants. For descendants
+ // | not contained by this object, use [ css clip fixed position ].
+ // +-[ inner border radius clip]
+ // | Clip created by a rounded border with overflow clip. This clip is
+ // | not inset by scrollbars.
+ // +-[ overflow clip ]
+ // Clip created by overflow clip and is inset by the scrollbar.
+ // [ css clip fixed position ]
+ // Clip created by CSS clip. Only exists if the current clip includes
+ // some clip that doesn't apply to our fixed position descendants.
+ const ClipPaintPropertyNode* maskClip() const { return m_maskClip.get(); }
const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); }
const ClipPaintPropertyNode* cssClipFixedPosition() const {
return m_cssClipFixedPosition.get();
@@ -179,7 +209,10 @@ class CORE_EXPORT ObjectPaintProperties {
// about why this is needed for efficient updates.
bool clearPaintOffsetTranslation() { return clear(m_paintOffsetTranslation); }
bool clearTransform() { return clear(m_transform); }
+ bool clearMaskIsolation() { return clear(m_maskIsolation); }
+ bool clearMaskContent() { return clear(m_maskContent); }
bool clearEffect() { return clear(m_effect); }
+ bool clearMaskClip() { return clear(m_maskClip); }
bool clearCssClip() { return clear(m_cssClip); }
bool clearCssClipFixedPosition() { return clear(m_cssClipFixedPosition); }
bool clearInnerBorderRadiusClip() { return clear(m_innerBorderRadiusClip); }
@@ -231,10 +264,22 @@ class CORE_EXPORT ObjectPaintProperties {
return update(m_scroll, std::forward<Args>(args)...);
}
template <typename... Args>
+ bool updateMaskIsolation(Args&&... args) {
+ return update(m_maskIsolation, std::forward<Args>(args)...);
+ }
+ template <typename... Args>
+ bool updateMaskContent(Args&&... args) {
+ return update(m_maskContent, std::forward<Args>(args)...);
+ }
+ template <typename... Args>
bool updateEffect(Args&&... args) {
return update(m_effect, std::forward<Args>(args)...);
}
template <typename... Args>
+ bool updateMaskClip(Args&&... args) {
+ return update(m_maskClip, std::forward<Args>(args)...);
+ }
+ template <typename... Args>
bool updateCssClip(Args&&... args) {
return update(m_cssClip, std::forward<Args>(args)...);
}
@@ -259,8 +304,14 @@ class CORE_EXPORT ObjectPaintProperties {
cloned->m_paintOffsetTranslation = m_paintOffsetTranslation->clone();
if (m_transform)
cloned->m_transform = m_transform->clone();
+ if (m_maskIsolation)
+ cloned->m_maskIsolation = m_maskIsolation->clone();
+ if (m_maskContent)
+ cloned->m_maskContent = m_maskContent->clone();
if (m_effect)
cloned->m_effect = m_effect->clone();
+ if (m_maskClip)
+ cloned->m_maskClip = m_maskClip->clone();
if (m_cssClip)
cloned->m_cssClip = m_cssClip->clone();
if (m_cssClipFixedPosition)
@@ -321,7 +372,10 @@ class CORE_EXPORT ObjectPaintProperties {
RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
RefPtr<TransformPaintPropertyNode> m_transform;
+ RefPtr<EffectPaintPropertyNode> m_maskIsolation;
+ RefPtr<EffectPaintPropertyNode> m_maskContent;
RefPtr<EffectPaintPropertyNode> m_effect;
+ RefPtr<ClipPaintPropertyNode> m_maskClip;
RefPtr<ClipPaintPropertyNode> m_cssClip;
RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
RefPtr<ClipPaintPropertyNode> m_innerBorderRadiusClip;

Powered by Google App Engine
This is Rietveld 408576698