Chromium Code Reviews| 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 #include "core/paint/PaintPropertyTreeBuilder.h" | 5 #include "core/paint/PaintPropertyTreeBuilder.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/dom/DOMNodeIds.h" | 8 #include "core/dom/DOMNodeIds.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 ColorFilter mask_color_filter; | 576 ColorFilter mask_color_filter; |
| 577 bool has_mask = ComputeMaskParameters( | 577 bool has_mask = ComputeMaskParameters( |
| 578 mask_clip, mask_color_filter, object, context.current.paint_offset); | 578 mask_clip, mask_color_filter, object, context.current.paint_offset); |
| 579 if (has_mask) { | 579 if (has_mask) { |
| 580 force_subtree_update |= properties.UpdateMaskClip( | 580 force_subtree_update |= properties.UpdateMaskClip( |
| 581 context.current.clip, context.current.transform, | 581 context.current.clip, context.current.transform, |
| 582 FloatRoundedRect(mask_clip)); | 582 FloatRoundedRect(mask_clip)); |
| 583 output_clip = properties.MaskClip(); | 583 output_clip = properties.MaskClip(); |
| 584 | 584 |
| 585 // TODO(crbug.com/683425): PaintArtifactCompositor does not handle | 585 // TODO(crbug.com/683425): PaintArtifactCompositor does not handle |
| 586 // grouping (i.e. descendant-dependent compositing reason) properly | 586 // grouping (i.e. descendant-dependent compositing reason) properly yet. |
| 587 // yet. This forces masked subtree always create a layer for now. | 587 // This forces masked subtree always create a layer for now. |
| 588 compositing_reasons |= kCompositingReasonIsolateCompositedDescendants; | 588 compositing_reasons |= kCompositingReasonIsolateCompositedDescendants; |
|
trchen
2017/05/03 21:13:22
(Unrelated) I think this no longer applies. I shal
| |
| 589 } else { | 589 } else { |
| 590 if (auto* properties = object.GetMutableForPainting().PaintProperties()) | 590 if (auto* properties = object.GetMutableForPainting().PaintProperties()) |
| 591 force_subtree_update |= properties->ClearMaskClip(); | 591 force_subtree_update |= properties->ClearMaskClip(); |
| 592 | |
| 593 bool has_filter = object.IsBoxModelObject() && | |
| 594 object.StyleRef().HasFilter() && | |
| 595 ToLayoutBoxModelObject(object).Layer(); | |
| 596 if (!has_filter) { | |
| 597 // [fx-containment, step 1]: push clip of any contained content below | |
| 598 // the clip of an effect that commutes with clips. | |
| 599 // context.fixed_position.clip is the "highest" in the clip tree that | |
| 600 // such a contained clip could be. | |
| 601 output_clip = context.fixed_position.clip; | |
|
trchen
2017/05/03 21:13:22
fixed_position.clip is not necessarily shallower t
chrishtr
2017/05/03 21:20:59
It's required to implement fx-containment, step 1
| |
| 602 } | |
| 592 } | 603 } |
| 593 | 604 |
| 594 SkBlendMode blend_mode = | 605 SkBlendMode blend_mode = |
| 595 object.IsBlendingAllowed() | 606 object.IsBlendingAllowed() |
| 596 ? WebCoreCompositeToSkiaComposite(kCompositeSourceOver, | 607 ? WebCoreCompositeToSkiaComposite(kCompositeSourceOver, |
| 597 style.BlendMode()) | 608 style.BlendMode()) |
| 598 : SkBlendMode::kSrcOver; | 609 : SkBlendMode::kSrcOver; |
| 599 | 610 |
| 600 CompositorElementId compositor_element_id = | 611 CompositorElementId compositor_element_id = |
| 601 style.HasCurrentOpacityAnimation() | 612 style.HasCurrentOpacityAnimation() |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 force_subtree_update |= properties->ClearFilter(); | 721 force_subtree_update |= properties->ClearFilter(); |
| 711 } | 722 } |
| 712 } | 723 } |
| 713 | 724 |
| 714 const auto* properties = object.PaintProperties(); | 725 const auto* properties = object.PaintProperties(); |
| 715 if (properties && properties->Filter()) { | 726 if (properties && properties->Filter()) { |
| 716 context.current_effect = properties->Filter(); | 727 context.current_effect = properties->Filter(); |
| 717 // TODO(trchen): Change input clip to expansion hint once implemented. | 728 // TODO(trchen): Change input clip to expansion hint once implemented. |
| 718 const ClipPaintPropertyNode* input_clip = | 729 const ClipPaintPropertyNode* input_clip = |
| 719 properties->Filter()->OutputClip(); | 730 properties->Filter()->OutputClip(); |
| 731 // [fx-containment, step 1]: clips may not escape effects which | |
| 732 // move pixels. This only needs to happen if HasFilterThatMovesPixels(), | |
| 733 // but we do it for all filters to match SPv1 heuristics (see above). | |
| 720 context.input_clip_of_current_effect = context.current.clip = | 734 context.input_clip_of_current_effect = context.current.clip = |
| 721 context.absolute_position.clip = context.fixed_position.clip = | 735 context.absolute_position.clip = context.fixed_position.clip = |
| 722 input_clip; | 736 input_clip; |
| 723 } | 737 } |
| 724 } | 738 } |
| 725 | 739 |
| 726 static bool NeedsCssClip(const LayoutObject& object) { | 740 static bool NeedsCssClip(const LayoutObject& object) { |
| 727 return object.HasClip(); | 741 return object.HasClip(); |
| 728 } | 742 } |
| 729 | 743 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 context.force_subtree_update); | 1298 context.force_subtree_update); |
| 1285 | 1299 |
| 1286 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); | 1300 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); |
| 1287 } | 1301 } |
| 1288 | 1302 |
| 1289 if (object.CanContainAbsolutePositionObjects()) | 1303 if (object.CanContainAbsolutePositionObjects()) |
| 1290 context.container_for_absolute_position = &object; | 1304 context.container_for_absolute_position = &object; |
| 1291 } | 1305 } |
| 1292 | 1306 |
| 1293 } // namespace blink | 1307 } // namespace blink |
| OLD | NEW |