| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef ObjectPaintProperties_h | 5 #ifndef ObjectPaintProperties_h |
| 6 #define ObjectPaintProperties_h | 6 #define ObjectPaintProperties_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/geometry/LayoutPoint.h" | 9 #include "platform/geometry/LayoutPoint.h" |
| 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 const TransformPaintPropertyNode* scrollbarPaintOffset() const { | 90 const TransformPaintPropertyNode* scrollbarPaintOffset() const { |
| 91 return m_scrollbarPaintOffset.get(); | 91 return m_scrollbarPaintOffset.get(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Auxiliary scrolling information. Includes information such as the hierarchy | 94 // Auxiliary scrolling information. Includes information such as the hierarchy |
| 95 // of scrollable areas, the extent that can be scrolled, etc. The actual | 95 // of scrollable areas, the extent that can be scrolled, etc. The actual |
| 96 // scroll offset is stored in the transform tree (m_scrollTranslation). | 96 // scroll offset is stored in the transform tree (m_scrollTranslation). |
| 97 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); } | 97 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); } |
| 98 | 98 |
| 99 // The hierarchy of the effect subtree created by a LayoutObject as follows: |
| 100 // [ mask isolation ] |
| 101 // | Isolated group created by CSS mask. Masked contents go in here. |
| 102 // +-[ effect ] |
| 103 // | Isolated group for effects other than CSS mask. Including opacity |
| 104 // | and filters. |
| 105 // +-[ mask content ] |
| 106 // Isolated group for painting the mask itself. This node will have |
| 107 // SkBlendMode::kDstIn and shall paint last, i.e. after masked contents. |
| 108 const EffectPaintPropertyNode* maskIsolation() const { |
| 109 return m_maskIsolation.get(); |
| 110 } |
| 111 const EffectPaintPropertyNode* maskContent() const { |
| 112 return m_maskContent.get(); |
| 113 } |
| 99 const EffectPaintPropertyNode* effect() const { return m_effect.get(); } | 114 const EffectPaintPropertyNode* effect() const { return m_effect.get(); } |
| 100 | 115 |
| 101 // The hierarchy of the clip subtree created by a LayoutObject is as follows: | 116 // The hierarchy of the clip subtree created by a LayoutObject is as follows: |
| 102 // [ css clip ] | 117 // [ mask clip ] |
| 103 // [ css clip fixed position] | 118 // | Clip created by CSS mask. It serves two purposes: |
| 104 // [ inner border radius clip ] Clip created by a rounded border with overflow | 119 // | 1. Cull painting of the masked subtree. Because anything outside of |
| 105 // clip. This clip is not inset by scrollbars. | 120 // | the mask is never visible, it is pointless to paint them. |
| 106 // +--- [ overflow clip ] Clip created by overflow clip and is inset by | 121 // | 2. Raster clip of the masked subtree. Because the mask implemented |
| 107 // the scrollbars. | 122 // | as SkBlendMode::kDstIn, pixels outside of mask's bound will be |
| 123 // | intact when they shall be masked out. This clip ensures no pixels |
| 124 // | leak out. |
| 125 // +-[ css clip ] |
| 126 // | Clip created by CSS clip. CSS clip applies to all descendants, this |
| 127 // | node only applies to containing block descendants. For descendants |
| 128 // | not contained by this object, use [ css clip fixed position ]. |
| 129 // +-[ inner border radius clip] |
| 130 // | Clip created by a rounded border with overflow clip. This clip is |
| 131 // | not inset by scrollbars. |
| 132 // +-[ overflow clip ] |
| 133 // Clip created by overflow clip and is inset by the scrollbar. |
| 134 // [ css clip fixed position ] |
| 135 // Clip created by CSS clip. Only exists if the current clip includes |
| 136 // some clip that doesn't apply to our fixed position descendants. |
| 137 const ClipPaintPropertyNode* maskClip() const { return m_maskClip.get(); } |
| 108 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } | 138 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } |
| 109 const ClipPaintPropertyNode* cssClipFixedPosition() const { | 139 const ClipPaintPropertyNode* cssClipFixedPosition() const { |
| 110 return m_cssClipFixedPosition.get(); | 140 return m_cssClipFixedPosition.get(); |
| 111 } | 141 } |
| 112 const ClipPaintPropertyNode* innerBorderRadiusClip() const { | 142 const ClipPaintPropertyNode* innerBorderRadiusClip() const { |
| 113 return m_innerBorderRadiusClip.get(); | 143 return m_innerBorderRadiusClip.get(); |
| 114 } | 144 } |
| 115 const ClipPaintPropertyNode* overflowClip() const { | 145 const ClipPaintPropertyNode* overflowClip() const { |
| 116 return m_overflowClip.get(); | 146 return m_overflowClip.get(); |
| 117 } | 147 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 m_localBorderBoxProperties = nullptr; | 202 m_localBorderBoxProperties = nullptr; |
| 173 m_contentsProperties = nullptr; | 203 m_contentsProperties = nullptr; |
| 174 } | 204 } |
| 175 | 205 |
| 176 // The following clear* functions return true if the property tree structure | 206 // The following clear* functions return true if the property tree structure |
| 177 // changes (an existing node was deleted), and false otherwise. See the | 207 // changes (an existing node was deleted), and false otherwise. See the |
| 178 // class-level comment ("update & clear implementation note") for details | 208 // class-level comment ("update & clear implementation note") for details |
| 179 // about why this is needed for efficient updates. | 209 // about why this is needed for efficient updates. |
| 180 bool clearPaintOffsetTranslation() { return clear(m_paintOffsetTranslation); } | 210 bool clearPaintOffsetTranslation() { return clear(m_paintOffsetTranslation); } |
| 181 bool clearTransform() { return clear(m_transform); } | 211 bool clearTransform() { return clear(m_transform); } |
| 212 bool clearMaskIsolation() { return clear(m_maskIsolation); } |
| 213 bool clearMaskContent() { return clear(m_maskContent); } |
| 182 bool clearEffect() { return clear(m_effect); } | 214 bool clearEffect() { return clear(m_effect); } |
| 215 bool clearMaskClip() { return clear(m_maskClip); } |
| 183 bool clearCssClip() { return clear(m_cssClip); } | 216 bool clearCssClip() { return clear(m_cssClip); } |
| 184 bool clearCssClipFixedPosition() { return clear(m_cssClipFixedPosition); } | 217 bool clearCssClipFixedPosition() { return clear(m_cssClipFixedPosition); } |
| 185 bool clearInnerBorderRadiusClip() { return clear(m_innerBorderRadiusClip); } | 218 bool clearInnerBorderRadiusClip() { return clear(m_innerBorderRadiusClip); } |
| 186 bool clearOverflowClip() { return clear(m_overflowClip); } | 219 bool clearOverflowClip() { return clear(m_overflowClip); } |
| 187 bool clearPerspective() { return clear(m_perspective); } | 220 bool clearPerspective() { return clear(m_perspective); } |
| 188 bool clearSvgLocalToBorderBoxTransform() { | 221 bool clearSvgLocalToBorderBoxTransform() { |
| 189 return clear(m_svgLocalToBorderBoxTransform); | 222 return clear(m_svgLocalToBorderBoxTransform); |
| 190 } | 223 } |
| 191 bool clearScrollTranslation() { return clear(m_scrollTranslation); } | 224 bool clearScrollTranslation() { return clear(m_scrollTranslation); } |
| 192 bool clearScrollbarPaintOffset() { return clear(m_scrollbarPaintOffset); } | 225 bool clearScrollbarPaintOffset() { return clear(m_scrollbarPaintOffset); } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 257 } |
| 225 template <typename... Args> | 258 template <typename... Args> |
| 226 bool updateScrollbarPaintOffset(Args&&... args) { | 259 bool updateScrollbarPaintOffset(Args&&... args) { |
| 227 return update(m_scrollbarPaintOffset, std::forward<Args>(args)...); | 260 return update(m_scrollbarPaintOffset, std::forward<Args>(args)...); |
| 228 } | 261 } |
| 229 template <typename... Args> | 262 template <typename... Args> |
| 230 bool updateScroll(Args&&... args) { | 263 bool updateScroll(Args&&... args) { |
| 231 return update(m_scroll, std::forward<Args>(args)...); | 264 return update(m_scroll, std::forward<Args>(args)...); |
| 232 } | 265 } |
| 233 template <typename... Args> | 266 template <typename... Args> |
| 267 bool updateMaskIsolation(Args&&... args) { |
| 268 return update(m_maskIsolation, std::forward<Args>(args)...); |
| 269 } |
| 270 template <typename... Args> |
| 271 bool updateMaskContent(Args&&... args) { |
| 272 return update(m_maskContent, std::forward<Args>(args)...); |
| 273 } |
| 274 template <typename... Args> |
| 234 bool updateEffect(Args&&... args) { | 275 bool updateEffect(Args&&... args) { |
| 235 return update(m_effect, std::forward<Args>(args)...); | 276 return update(m_effect, std::forward<Args>(args)...); |
| 236 } | 277 } |
| 237 template <typename... Args> | 278 template <typename... Args> |
| 279 bool updateMaskClip(Args&&... args) { |
| 280 return update(m_maskClip, std::forward<Args>(args)...); |
| 281 } |
| 282 template <typename... Args> |
| 238 bool updateCssClip(Args&&... args) { | 283 bool updateCssClip(Args&&... args) { |
| 239 return update(m_cssClip, std::forward<Args>(args)...); | 284 return update(m_cssClip, std::forward<Args>(args)...); |
| 240 } | 285 } |
| 241 template <typename... Args> | 286 template <typename... Args> |
| 242 bool updateCssClipFixedPosition(Args&&... args) { | 287 bool updateCssClipFixedPosition(Args&&... args) { |
| 243 return update(m_cssClipFixedPosition, std::forward<Args>(args)...); | 288 return update(m_cssClipFixedPosition, std::forward<Args>(args)...); |
| 244 } | 289 } |
| 245 template <typename... Args> | 290 template <typename... Args> |
| 246 bool updateInnerBorderRadiusClip(Args&&... args) { | 291 bool updateInnerBorderRadiusClip(Args&&... args) { |
| 247 return update(m_innerBorderRadiusClip, std::forward<Args>(args)...); | 292 return update(m_innerBorderRadiusClip, std::forward<Args>(args)...); |
| 248 } | 293 } |
| 249 template <typename... Args> | 294 template <typename... Args> |
| 250 bool updateOverflowClip(Args&&... args) { | 295 bool updateOverflowClip(Args&&... args) { |
| 251 return update(m_overflowClip, std::forward<Args>(args)...); | 296 return update(m_overflowClip, std::forward<Args>(args)...); |
| 252 } | 297 } |
| 253 | 298 |
| 254 #if DCHECK_IS_ON() | 299 #if DCHECK_IS_ON() |
| 255 // Used by FindPropertiesNeedingUpdate.h for recording the current properties. | 300 // Used by FindPropertiesNeedingUpdate.h for recording the current properties. |
| 256 std::unique_ptr<ObjectPaintProperties> clone() const { | 301 std::unique_ptr<ObjectPaintProperties> clone() const { |
| 257 std::unique_ptr<ObjectPaintProperties> cloned = create(); | 302 std::unique_ptr<ObjectPaintProperties> cloned = create(); |
| 258 if (m_paintOffsetTranslation) | 303 if (m_paintOffsetTranslation) |
| 259 cloned->m_paintOffsetTranslation = m_paintOffsetTranslation->clone(); | 304 cloned->m_paintOffsetTranslation = m_paintOffsetTranslation->clone(); |
| 260 if (m_transform) | 305 if (m_transform) |
| 261 cloned->m_transform = m_transform->clone(); | 306 cloned->m_transform = m_transform->clone(); |
| 307 if (m_maskIsolation) |
| 308 cloned->m_maskIsolation = m_maskIsolation->clone(); |
| 309 if (m_maskContent) |
| 310 cloned->m_maskContent = m_maskContent->clone(); |
| 262 if (m_effect) | 311 if (m_effect) |
| 263 cloned->m_effect = m_effect->clone(); | 312 cloned->m_effect = m_effect->clone(); |
| 313 if (m_maskClip) |
| 314 cloned->m_maskClip = m_maskClip->clone(); |
| 264 if (m_cssClip) | 315 if (m_cssClip) |
| 265 cloned->m_cssClip = m_cssClip->clone(); | 316 cloned->m_cssClip = m_cssClip->clone(); |
| 266 if (m_cssClipFixedPosition) | 317 if (m_cssClipFixedPosition) |
| 267 cloned->m_cssClipFixedPosition = m_cssClipFixedPosition->clone(); | 318 cloned->m_cssClipFixedPosition = m_cssClipFixedPosition->clone(); |
| 268 if (m_innerBorderRadiusClip) | 319 if (m_innerBorderRadiusClip) |
| 269 cloned->m_innerBorderRadiusClip = m_innerBorderRadiusClip->clone(); | 320 cloned->m_innerBorderRadiusClip = m_innerBorderRadiusClip->clone(); |
| 270 if (m_overflowClip) | 321 if (m_overflowClip) |
| 271 cloned->m_overflowClip = m_overflowClip->clone(); | 322 cloned->m_overflowClip = m_overflowClip->clone(); |
| 272 if (m_perspective) | 323 if (m_perspective) |
| 273 cloned->m_perspective = m_perspective->clone(); | 324 cloned->m_perspective = m_perspective->clone(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 return false; | 365 return false; |
| 315 } | 366 } |
| 316 field = PaintPropertyNode::create(std::forward<Args>(args)...); | 367 field = PaintPropertyNode::create(std::forward<Args>(args)...); |
| 317 return true; | 368 return true; |
| 318 } | 369 } |
| 319 | 370 |
| 320 void updateContentsProperties() const; | 371 void updateContentsProperties() const; |
| 321 | 372 |
| 322 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; | 373 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; |
| 323 RefPtr<TransformPaintPropertyNode> m_transform; | 374 RefPtr<TransformPaintPropertyNode> m_transform; |
| 375 RefPtr<EffectPaintPropertyNode> m_maskIsolation; |
| 376 RefPtr<EffectPaintPropertyNode> m_maskContent; |
| 324 RefPtr<EffectPaintPropertyNode> m_effect; | 377 RefPtr<EffectPaintPropertyNode> m_effect; |
| 378 RefPtr<ClipPaintPropertyNode> m_maskClip; |
| 325 RefPtr<ClipPaintPropertyNode> m_cssClip; | 379 RefPtr<ClipPaintPropertyNode> m_cssClip; |
| 326 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; | 380 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; |
| 327 RefPtr<ClipPaintPropertyNode> m_innerBorderRadiusClip; | 381 RefPtr<ClipPaintPropertyNode> m_innerBorderRadiusClip; |
| 328 RefPtr<ClipPaintPropertyNode> m_overflowClip; | 382 RefPtr<ClipPaintPropertyNode> m_overflowClip; |
| 329 RefPtr<TransformPaintPropertyNode> m_perspective; | 383 RefPtr<TransformPaintPropertyNode> m_perspective; |
| 330 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. | 384 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. |
| 331 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; | 385 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; |
| 332 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 386 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 333 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 387 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
| 334 RefPtr<ScrollPaintPropertyNode> m_scroll; | 388 RefPtr<ScrollPaintPropertyNode> m_scroll; |
| 335 | 389 |
| 336 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties; | 390 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties; |
| 337 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties; | 391 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties; |
| 338 }; | 392 }; |
| 339 | 393 |
| 340 } // namespace blink | 394 } // namespace blink |
| 341 | 395 |
| 342 #endif // ObjectPaintProperties_h | 396 #endif // ObjectPaintProperties_h |
| OLD | NEW |