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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2886133003: Only call paint property-requiring subroutines if there are actually properties. (Closed)
Patch Set: Merge branch 'master' into paintpropertiesoptimized Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // to change during animations if the animation passes through the 310 // to change during animations if the animation passes through the
311 // identity matrix. 311 // identity matrix.
312 return object.IsSVGChild() && 312 return object.IsSVGChild() &&
313 !object.LocalToSVGParentTransform().IsIdentity(); 313 !object.LocalToSVGParentTransform().IsIdentity();
314 } 314 }
315 315
316 // SVG does not use the general transform update of |updateTransform|, instead 316 // SVG does not use the general transform update of |updateTransform|, instead
317 // creating a transform node for SVG-specific transforms without 3D. 317 // creating a transform node for SVG-specific transforms without 3D.
318 void PaintPropertyTreeBuilder::UpdateTransformForNonRootSVG( 318 void PaintPropertyTreeBuilder::UpdateTransformForNonRootSVG(
319 const LayoutObject& object, 319 const LayoutObject& object,
320 ObjectPaintProperties& properties,
320 PaintPropertyTreeBuilderFragmentContext& context, 321 PaintPropertyTreeBuilderFragmentContext& context,
321 bool& force_subtree_update) { 322 bool& force_subtree_update) {
322 DCHECK(object.IsSVGChild()); 323 DCHECK(object.IsSVGChild());
323 // SVG does not use paint offset internally, except for SVGForeignObject which 324 // SVG does not use paint offset internally, except for SVGForeignObject which
324 // has different SVG and HTML coordinate spaces. 325 // has different SVG and HTML coordinate spaces.
325 DCHECK(object.IsSVGForeignObject() || 326 DCHECK(object.IsSVGForeignObject() ||
326 context.current.paint_offset == LayoutPoint()); 327 context.current.paint_offset == LayoutPoint());
327 328
328 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 329 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
329 AffineTransform transform = object.LocalToSVGParentTransform(); 330 AffineTransform transform = object.LocalToSVGParentTransform();
330 if (NeedsTransformForNonRootSVG(object)) { 331 if (NeedsTransformForNonRootSVG(object)) {
331 // The origin is included in the local transform, so leave origin empty. 332 // The origin is included in the local transform, so leave origin empty.
332 auto& properties = *object.GetMutableForPainting().PaintProperties();
333 force_subtree_update |= properties.UpdateTransform( 333 force_subtree_update |= properties.UpdateTransform(
334 context.current.transform, TransformationMatrix(transform), 334 context.current.transform, TransformationMatrix(transform),
335 FloatPoint3D()); 335 FloatPoint3D());
336 } else { 336 } else {
337 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 337 force_subtree_update |= properties.ClearTransform();
338 force_subtree_update |= properties->ClearTransform();
339 } 338 }
340 } 339 }
341 340
342 if (object.PaintProperties() && object.PaintProperties()->Transform()) { 341 if (properties.Transform()) {
343 context.current.transform = object.PaintProperties()->Transform(); 342 context.current.transform = properties.Transform();
344 context.current.should_flatten_inherited_transform = false; 343 context.current.should_flatten_inherited_transform = false;
345 context.current.rendering_context_id = 0; 344 context.current.rendering_context_id = 0;
346 } 345 }
347 } 346 }
348 347
349 static CompositingReasons CompositingReasonsForTransform(const LayoutBox& box) { 348 static CompositingReasons CompositingReasonsForTransform(const LayoutBox& box) {
350 const ComputedStyle& style = box.StyleRef(); 349 const ComputedStyle& style = box.StyleRef();
351 CompositingReasons compositing_reasons = kCompositingReasonNone; 350 CompositingReasons compositing_reasons = kCompositingReasonNone;
352 if (CompositingReasonFinder::RequiresCompositingForTransform(box)) 351 if (CompositingReasonFinder::RequiresCompositingForTransform(box))
353 compositing_reasons |= kCompositingReason3DTransform; 352 compositing_reasons |= kCompositingReason3DTransform;
(...skipping 30 matching lines...) Expand all
384 static bool NeedsTransform(const LayoutObject& object) { 383 static bool NeedsTransform(const LayoutObject& object) {
385 if (!object.IsBox()) 384 if (!object.IsBox())
386 return false; 385 return false;
387 return object.StyleRef().HasTransform() || object.StyleRef().Preserves3D() || 386 return object.StyleRef().HasTransform() || object.StyleRef().Preserves3D() ||
388 CompositingReasonsForTransform(ToLayoutBox(object)) != 387 CompositingReasonsForTransform(ToLayoutBox(object)) !=
389 kCompositingReasonNone; 388 kCompositingReasonNone;
390 } 389 }
391 390
392 void PaintPropertyTreeBuilder::UpdateTransform( 391 void PaintPropertyTreeBuilder::UpdateTransform(
393 const LayoutObject& object, 392 const LayoutObject& object,
393 ObjectPaintProperties& properties,
394 PaintPropertyTreeBuilderFragmentContext& context, 394 PaintPropertyTreeBuilderFragmentContext& context,
395 bool& force_subtree_update) { 395 bool& force_subtree_update) {
396 if (object.IsSVGChild()) { 396 if (object.IsSVGChild()) {
397 UpdateTransformForNonRootSVG(object, context, force_subtree_update); 397 UpdateTransformForNonRootSVG(object, properties, context,
398 force_subtree_update);
398 return; 399 return;
399 } 400 }
400 401
401 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 402 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
402 const ComputedStyle& style = object.StyleRef(); 403 const ComputedStyle& style = object.StyleRef();
403
404 // A transform node is allocated for transforms, preserves-3d and any 404 // A transform node is allocated for transforms, preserves-3d and any
405 // direct compositing reason. The latter is required because this is the 405 // direct compositing reason. The latter is required because this is the
406 // only way to represent compositing both an element and its stacking 406 // only way to represent compositing both an element and its stacking
407 // descendants. 407 // descendants.
408 if (NeedsTransform(object)) { 408 if (NeedsTransform(object)) {
409 auto& box = ToLayoutBox(object); 409 auto& box = ToLayoutBox(object);
410 410
411 CompositingReasons compositing_reasons = 411 CompositingReasons compositing_reasons =
412 CompositingReasonsForTransform(box); 412 CompositingReasonsForTransform(box);
413 413
(...skipping 11 matching lines...) Expand all
425 if (style.Preserves3D() && !rendering_context_id) 425 if (style.Preserves3D() && !rendering_context_id)
426 rendering_context_id = PtrHash<const LayoutObject>::GetHash(&object); 426 rendering_context_id = PtrHash<const LayoutObject>::GetHash(&object);
427 427
428 auto& properties = *object.GetMutableForPainting().PaintProperties(); 428 auto& properties = *object.GetMutableForPainting().PaintProperties();
429 force_subtree_update |= properties.UpdateTransform( 429 force_subtree_update |= properties.UpdateTransform(
430 context.current.transform, matrix, TransformOrigin(box), 430 context.current.transform, matrix, TransformOrigin(box),
431 context.current.should_flatten_inherited_transform, 431 context.current.should_flatten_inherited_transform,
432 rendering_context_id, compositing_reasons, 432 rendering_context_id, compositing_reasons,
433 properties.GetCompositorElementId()); 433 properties.GetCompositorElementId());
434 } else { 434 } else {
435 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 435 force_subtree_update |= properties.ClearTransform();
436 force_subtree_update |= properties->ClearTransform();
437 } 436 }
438 } 437 }
439 438
440 const auto* properties = object.PaintProperties(); 439 if (properties.Transform()) {
441 if (properties && properties->Transform()) { 440 context.current.transform = properties.Transform();
442 context.current.transform = properties->Transform();
443 if (object.StyleRef().Preserves3D()) { 441 if (object.StyleRef().Preserves3D()) {
444 context.current.rendering_context_id = 442 context.current.rendering_context_id =
445 properties->Transform()->RenderingContextId(); 443 properties.Transform()->RenderingContextId();
446 context.current.should_flatten_inherited_transform = false; 444 context.current.should_flatten_inherited_transform = false;
447 } else { 445 } else {
448 context.current.rendering_context_id = 0; 446 context.current.rendering_context_id = 0;
449 context.current.should_flatten_inherited_transform = true; 447 context.current.should_flatten_inherited_transform = true;
450 } 448 }
451 } 449 }
452 } 450 }
453 451
454 static bool ComputeMaskParameters(IntRect& mask_clip, 452 static bool ComputeMaskParameters(IntRect& mask_clip,
455 ColorFilter& mask_color_filter, 453 ColorFilter& mask_color_filter,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 536 }
539 537
540 if (object.StyleRef().HasMask()) 538 if (object.StyleRef().HasMask())
541 return true; 539 return true;
542 540
543 return false; 541 return false;
544 } 542 }
545 543
546 void PaintPropertyTreeBuilder::UpdateEffect( 544 void PaintPropertyTreeBuilder::UpdateEffect(
547 const LayoutObject& object, 545 const LayoutObject& object,
546 ObjectPaintProperties& properties,
548 PaintPropertyTreeBuilderFragmentContext& context, 547 PaintPropertyTreeBuilderFragmentContext& context,
549 bool& force_subtree_update) { 548 bool& force_subtree_update) {
550 const ComputedStyle& style = object.StyleRef(); 549 const ComputedStyle& style = object.StyleRef();
551 550
552 // TODO(trchen): Can't omit effect node if we have 3D children. 551 // TODO(trchen): Can't omit effect node if we have 3D children.
553 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 552 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
554 const ClipPaintPropertyNode* output_clip = 553 const ClipPaintPropertyNode* output_clip =
555 context.input_clip_of_current_effect; 554 context.input_clip_of_current_effect;
556 555
557 if (NeedsEffect(object)) { 556 if (NeedsEffect(object)) {
558 auto& properties = *object.GetMutableForPainting().PaintProperties();
559 557
560 // We may begin to composite our subtree prior to an animation starts, 558 // We may begin to composite our subtree prior to an animation starts,
561 // but a compositor element ID is only needed when an animation is 559 // but a compositor element ID is only needed when an animation is
562 // current. 560 // current.
563 CompositingReasons compositing_reasons = kCompositingReasonNone; 561 CompositingReasons compositing_reasons = kCompositingReasonNone;
564 if (CompositingReasonFinder::RequiresCompositingForOpacityAnimation( 562 if (CompositingReasonFinder::RequiresCompositingForOpacityAnimation(
565 style)) { 563 style)) {
566 compositing_reasons = kCompositingReasonActiveAnimation; 564 compositing_reasons = kCompositingReasonActiveAnimation;
567 } 565 }
568 566
569 IntRect mask_clip; 567 IntRect mask_clip;
570 ColorFilter mask_color_filter; 568 ColorFilter mask_color_filter;
571 bool has_mask = ComputeMaskParameters( 569 bool has_mask = ComputeMaskParameters(
572 mask_clip, mask_color_filter, object, context.current.paint_offset); 570 mask_clip, mask_color_filter, object, context.current.paint_offset);
573 if (has_mask) { 571 if (has_mask) {
574 force_subtree_update |= properties.UpdateMaskClip( 572 force_subtree_update |= properties.UpdateMaskClip(
575 context.current.clip, context.current.transform, 573 context.current.clip, context.current.transform,
576 FloatRoundedRect(mask_clip)); 574 FloatRoundedRect(mask_clip));
577 output_clip = properties.MaskClip(); 575 output_clip = properties.MaskClip();
578 576
579 // TODO(crbug.com/683425): PaintArtifactCompositor does not handle 577 // TODO(crbug.com/683425): PaintArtifactCompositor does not handle
580 // grouping (i.e. descendant-dependent compositing reason) properly 578 // grouping (i.e. descendant-dependent compositing reason) properly
581 // yet. This forces masked subtree always create a layer for now. 579 // yet. This forces masked subtree always create a layer for now.
582 compositing_reasons |= kCompositingReasonIsolateCompositedDescendants; 580 compositing_reasons |= kCompositingReasonIsolateCompositedDescendants;
583 } else { 581 } else {
584 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 582 force_subtree_update |= properties.ClearMaskClip();
585 force_subtree_update |= properties->ClearMaskClip();
586 } 583 }
587 584
588 SkBlendMode blend_mode = 585 SkBlendMode blend_mode =
589 object.IsBlendingAllowed() 586 object.IsBlendingAllowed()
590 ? WebCoreCompositeToSkiaComposite(kCompositeSourceOver, 587 ? WebCoreCompositeToSkiaComposite(kCompositeSourceOver,
591 style.BlendMode()) 588 style.BlendMode())
592 : SkBlendMode::kSrcOver; 589 : SkBlendMode::kSrcOver;
593 590
594 DCHECK(!style.HasCurrentOpacityAnimation() || 591 DCHECK(!style.HasCurrentOpacityAnimation() ||
595 compositing_reasons != kCompositingReasonNone); 592 compositing_reasons != kCompositingReasonNone);
(...skipping 10 matching lines...) Expand all
606 // otherwise. 603 // otherwise.
607 force_subtree_update |= properties.UpdateMask( 604 force_subtree_update |= properties.UpdateMask(
608 properties.Effect(), context.current.transform, output_clip, 605 properties.Effect(), context.current.transform, output_clip,
609 mask_color_filter, CompositorFilterOperations(), 1.f, 606 mask_color_filter, CompositorFilterOperations(), 1.f,
610 SkBlendMode::kDstIn, kCompositingReasonSquashingDisallowed, 607 SkBlendMode::kDstIn, kCompositingReasonSquashingDisallowed,
611 CompositorElementId()); 608 CompositorElementId());
612 } else { 609 } else {
613 force_subtree_update |= properties.ClearMask(); 610 force_subtree_update |= properties.ClearMask();
614 } 611 }
615 } else { 612 } else {
616 if (auto* properties = object.GetMutableForPainting().PaintProperties()) { 613 auto* properties = object.GetMutableForPainting().PaintProperties();
617 force_subtree_update |= properties->ClearEffect(); 614 force_subtree_update |= properties->ClearEffect();
618 force_subtree_update |= properties->ClearMask(); 615 force_subtree_update |= properties->ClearMask();
619 force_subtree_update |= properties->ClearMaskClip(); 616 force_subtree_update |= properties->ClearMaskClip();
620 }
621 } 617 }
622 } 618 }
623 619
624 const auto* properties = object.PaintProperties(); 620 if (properties.Effect()) {
625 if (properties && properties->Effect()) { 621 context.current_effect = properties.Effect();
626 context.current_effect = properties->Effect(); 622 if (properties.MaskClip()) {
627 if (properties->MaskClip()) {
628 context.input_clip_of_current_effect = context.current.clip = 623 context.input_clip_of_current_effect = context.current.clip =
629 context.absolute_position.clip = context.fixed_position.clip = 624 context.absolute_position.clip = context.fixed_position.clip =
630 properties->MaskClip(); 625 properties.MaskClip();
631 } 626 }
632 } 627 }
633 } 628 }
634 629
635 static bool NeedsFilter(const LayoutObject& object) { 630 static bool NeedsFilter(const LayoutObject& object) {
636 // TODO(trchen): SVG caches filters in SVGResources. Implement it. 631 // TODO(trchen): SVG caches filters in SVGResources. Implement it.
637 return object.IsBoxModelObject() && ToLayoutBoxModelObject(object).Layer() && 632 return object.IsBoxModelObject() && ToLayoutBoxModelObject(object).Layer() &&
638 (object.StyleRef().HasFilter() || object.HasReflection()); 633 (object.StyleRef().HasFilter() || object.HasReflection());
639 } 634 }
640 635
641 void PaintPropertyTreeBuilder::UpdateFilter( 636 void PaintPropertyTreeBuilder::UpdateFilter(
642 const LayoutObject& object, 637 const LayoutObject& object,
638 ObjectPaintProperties& properties,
643 PaintPropertyTreeBuilderFragmentContext& context, 639 PaintPropertyTreeBuilderFragmentContext& context,
644 bool& force_subtree_update) { 640 bool& force_subtree_update) {
645 const ComputedStyle& style = object.StyleRef(); 641 const ComputedStyle& style = object.StyleRef();
646 642
647 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 643 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
648 if (NeedsFilter(object)) { 644 if (NeedsFilter(object)) {
649 CompositorFilterOperations filter = 645 CompositorFilterOperations filter =
650 ToLayoutBoxModelObject(object) 646 ToLayoutBoxModelObject(object)
651 .Layer() 647 .Layer()
652 ->CreateCompositorFilterOperationsForFilter(style); 648 ->CreateCompositorFilterOperationsForFilter(style);
(...skipping 25 matching lines...) Expand all
678 // We may begin to composite our subtree prior to an animation starts, 674 // We may begin to composite our subtree prior to an animation starts,
679 // but a compositor element ID is only needed when an animation is 675 // but a compositor element ID is only needed when an animation is
680 // current. 676 // current.
681 CompositingReasons compositing_reasons = 677 CompositingReasons compositing_reasons =
682 CompositingReasonFinder::RequiresCompositingForFilterAnimation(style) 678 CompositingReasonFinder::RequiresCompositingForFilterAnimation(style)
683 ? kCompositingReasonActiveAnimation 679 ? kCompositingReasonActiveAnimation
684 : kCompositingReasonNone; 680 : kCompositingReasonNone;
685 DCHECK(!style.HasCurrentFilterAnimation() || 681 DCHECK(!style.HasCurrentFilterAnimation() ||
686 compositing_reasons != kCompositingReasonNone); 682 compositing_reasons != kCompositingReasonNone);
687 683
688 auto& properties = *object.GetMutableForPainting().PaintProperties();
689 force_subtree_update |= properties.UpdateFilter( 684 force_subtree_update |= properties.UpdateFilter(
690 context.current_effect, context.current.transform, output_clip, 685 context.current_effect, context.current.transform, output_clip,
691 kColorFilterNone, std::move(filter), 1.f, SkBlendMode::kSrcOver, 686 kColorFilterNone, std::move(filter), 1.f, SkBlendMode::kSrcOver,
692 compositing_reasons, properties.GetCompositorElementId()); 687 compositing_reasons, properties.GetCompositorElementId());
693 } else { 688 } else {
694 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 689 force_subtree_update |= properties.ClearFilter();
695 force_subtree_update |= properties->ClearFilter();
696 } 690 }
697 } 691 }
698 692
699 const auto* properties = object.PaintProperties(); 693 if (properties.Filter()) {
700 if (properties && properties->Filter()) { 694 context.current_effect = properties.Filter();
701 context.current_effect = properties->Filter();
702 // TODO(trchen): Change input clip to expansion hint once implemented. 695 // TODO(trchen): Change input clip to expansion hint once implemented.
703 const ClipPaintPropertyNode* input_clip = 696 const ClipPaintPropertyNode* input_clip = properties.Filter()->OutputClip();
704 properties->Filter()->OutputClip();
705 context.input_clip_of_current_effect = context.current.clip = 697 context.input_clip_of_current_effect = context.current.clip =
706 context.absolute_position.clip = context.fixed_position.clip = 698 context.absolute_position.clip = context.fixed_position.clip =
707 input_clip; 699 input_clip;
708 } 700 }
709 } 701 }
710 702
711 static bool NeedsCssClip(const LayoutObject& object) { 703 static bool NeedsCssClip(const LayoutObject& object) {
712 return object.HasClip(); 704 return object.HasClip();
713 } 705 }
714 706
715 void PaintPropertyTreeBuilder::UpdateCssClip( 707 void PaintPropertyTreeBuilder::UpdateCssClip(
716 const LayoutObject& object, 708 const LayoutObject& object,
709 ObjectPaintProperties& properties,
717 PaintPropertyTreeBuilderFragmentContext& context, 710 PaintPropertyTreeBuilderFragmentContext& context,
718 bool& force_subtree_update) { 711 bool& force_subtree_update) {
719 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 712 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
720 if (NeedsCssClip(object)) { 713 if (NeedsCssClip(object)) {
721 // Create clip node for descendants that are not fixed position. 714 // Create clip node for descendants that are not fixed position.
722 // We don't have to setup context.absolutePosition.clip here because this 715 // We don't have to setup context.absolutePosition.clip here because this
723 // object must be a container for absolute position descendants, and will 716 // object must be a container for absolute position descendants, and will
724 // copy from in-flow context later at updateOutOfFlowContext() step. 717 // copy from in-flow context later at updateOutOfFlowContext() step.
725 DCHECK(object.CanContainAbsolutePositionObjects()); 718 DCHECK(object.CanContainAbsolutePositionObjects());
726 LayoutRect clip_rect = 719 LayoutRect clip_rect =
727 ToLayoutBox(object).ClipRect(context.current.paint_offset); 720 ToLayoutBox(object).ClipRect(context.current.paint_offset);
728 auto& properties = *object.GetMutableForPainting().PaintProperties();
729 force_subtree_update |= properties.UpdateCssClip( 721 force_subtree_update |= properties.UpdateCssClip(
730 context.current.clip, context.current.transform, 722 context.current.clip, context.current.transform,
731 FloatRoundedRect(FloatRect(clip_rect))); 723 FloatRoundedRect(FloatRect(clip_rect)));
732 } else { 724 } else {
733 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 725 force_subtree_update |= properties.ClearCssClip();
734 force_subtree_update |= properties->ClearCssClip();
735 } 726 }
736 } 727 }
737 728
738 const auto* properties = object.PaintProperties(); 729 if (properties.CssClip())
739 if (properties && properties->CssClip()) 730 context.current.clip = properties.CssClip();
740 context.current.clip = properties->CssClip();
741 } 731 }
742 732
743 void PaintPropertyTreeBuilder::UpdateLocalBorderBoxContext( 733 void PaintPropertyTreeBuilder::UpdateLocalBorderBoxContext(
744 const LayoutObject& object, 734 const LayoutObject& object,
745 PaintPropertyTreeBuilderFragmentContext& context, 735 PaintPropertyTreeBuilderFragmentContext& context,
746 bool& force_subtree_update) { 736 bool& force_subtree_update) {
747 if (!object.NeedsPaintPropertyUpdate() && !force_subtree_update) 737 if (!object.NeedsPaintPropertyUpdate() && !force_subtree_update)
748 return; 738 return;
749 739
750 // We only need to cache the local border box properties for layered objects. 740 // We only need to cache the local border box properties for layered objects.
(...skipping 14 matching lines...) Expand all
765 if (area->HorizontalScrollbar() || area->VerticalScrollbar()) 755 if (area->HorizontalScrollbar() || area->VerticalScrollbar())
766 return true; 756 return true;
767 } 757 }
768 } 758 }
769 return false; 759 return false;
770 } 760 }
771 761
772 // TODO(trchen): Remove this once we bake the paint offset into frameRect. 762 // TODO(trchen): Remove this once we bake the paint offset into frameRect.
773 void PaintPropertyTreeBuilder::UpdateScrollbarPaintOffset( 763 void PaintPropertyTreeBuilder::UpdateScrollbarPaintOffset(
774 const LayoutObject& object, 764 const LayoutObject& object,
765 ObjectPaintProperties& properties,
775 PaintPropertyTreeBuilderFragmentContext& context, 766 PaintPropertyTreeBuilderFragmentContext& context,
776 bool& force_subtree_update) { 767 bool& force_subtree_update) {
777 if (!object.NeedsPaintPropertyUpdate() && !force_subtree_update) 768 if (!object.NeedsPaintPropertyUpdate() && !force_subtree_update)
778 return; 769 return;
779 770
780 if (NeedsScrollbarPaintOffset(object)) { 771 if (NeedsScrollbarPaintOffset(object)) {
781 IntPoint rounded_paint_offset = 772 IntPoint rounded_paint_offset =
782 RoundedIntPoint(context.current.paint_offset); 773 RoundedIntPoint(context.current.paint_offset);
783 auto paint_offset = TransformationMatrix().Translate( 774 auto paint_offset = TransformationMatrix().Translate(
784 rounded_paint_offset.X(), rounded_paint_offset.Y()); 775 rounded_paint_offset.X(), rounded_paint_offset.Y());
785 auto& properties = *object.GetMutableForPainting().PaintProperties();
786 force_subtree_update |= properties.UpdateScrollbarPaintOffset( 776 force_subtree_update |= properties.UpdateScrollbarPaintOffset(
787 context.current.transform, paint_offset, FloatPoint3D()); 777 context.current.transform, paint_offset, FloatPoint3D());
788 } else { 778 } else {
789 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 779 force_subtree_update |= properties.ClearScrollbarPaintOffset();
790 force_subtree_update |= properties->ClearScrollbarPaintOffset();
791 } 780 }
792 } 781 }
793 782
794 static bool NeedsOverflowClip(const LayoutObject& object) { 783 static bool NeedsOverflowClip(const LayoutObject& object) {
795 return object.IsBox() && ToLayoutBox(object).ShouldClipOverflow(); 784 return object.IsBox() && ToLayoutBox(object).ShouldClipOverflow();
796 } 785 }
797 786
798 void PaintPropertyTreeBuilder::UpdateOverflowClip( 787 void PaintPropertyTreeBuilder::UpdateOverflowClip(
799 const LayoutObject& object, 788 const LayoutObject& object,
789 ObjectPaintProperties& properties,
800 PaintPropertyTreeBuilderFragmentContext& context, 790 PaintPropertyTreeBuilderFragmentContext& context,
801 bool& force_subtree_update) { 791 bool& force_subtree_update) {
802 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 792 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
803 if (NeedsOverflowClip(object)) { 793 if (NeedsOverflowClip(object)) {
804 const LayoutBox& box = ToLayoutBox(object); 794 const LayoutBox& box = ToLayoutBox(object);
805 LayoutRect clip_rect; 795 LayoutRect clip_rect;
806 clip_rect = 796 clip_rect =
807 LayoutRect(box.OverflowClipRect(context.current.paint_offset)); 797 LayoutRect(box.OverflowClipRect(context.current.paint_offset));
808 798
809 auto& properties = *object.GetMutableForPainting().PaintProperties();
810 const auto* current_clip = context.current.clip; 799 const auto* current_clip = context.current.clip;
811 if (box.StyleRef().HasBorderRadius()) { 800 if (box.StyleRef().HasBorderRadius()) {
812 auto inner_border = box.StyleRef().GetRoundedInnerBorderFor( 801 auto inner_border = box.StyleRef().GetRoundedInnerBorderFor(
813 LayoutRect(context.current.paint_offset, box.Size())); 802 LayoutRect(context.current.paint_offset, box.Size()));
814 force_subtree_update |= properties.UpdateInnerBorderRadiusClip( 803 force_subtree_update |= properties.UpdateInnerBorderRadiusClip(
815 context.current.clip, context.current.transform, inner_border); 804 context.current.clip, context.current.transform, inner_border);
816 current_clip = properties.InnerBorderRadiusClip(); 805 current_clip = properties.InnerBorderRadiusClip();
817 } else { 806 } else {
818 force_subtree_update |= properties.ClearInnerBorderRadiusClip(); 807 force_subtree_update |= properties.ClearInnerBorderRadiusClip();
819 } 808 }
820 809
821 force_subtree_update |= 810 force_subtree_update |=
822 properties.UpdateOverflowClip(current_clip, context.current.transform, 811 properties.UpdateOverflowClip(current_clip, context.current.transform,
823 FloatRoundedRect(FloatRect(clip_rect))); 812 FloatRoundedRect(FloatRect(clip_rect)));
824 } else { 813 } else {
825 if (auto* properties = object.GetMutableForPainting().PaintProperties()) { 814 force_subtree_update |= properties.ClearInnerBorderRadiusClip();
826 force_subtree_update |= properties->ClearInnerBorderRadiusClip(); 815 force_subtree_update |= properties.ClearOverflowClip();
827 force_subtree_update |= properties->ClearOverflowClip();
828 }
829 return; 816 return;
830 } 817 }
831 } 818 }
832 819
833 const auto* properties = object.PaintProperties(); 820 if (properties.OverflowClip())
834 if (properties && properties->OverflowClip()) 821 context.current.clip = properties.OverflowClip();
835 context.current.clip = properties->OverflowClip();
836 } 822 }
837 823
838 static FloatPoint PerspectiveOrigin(const LayoutBox& box) { 824 static FloatPoint PerspectiveOrigin(const LayoutBox& box) {
839 const ComputedStyle& style = box.StyleRef(); 825 const ComputedStyle& style = box.StyleRef();
840 // Perspective origin has no effect without perspective. 826 // Perspective origin has no effect without perspective.
841 DCHECK(style.HasPerspective()); 827 DCHECK(style.HasPerspective());
842 FloatSize border_box_size(box.Size()); 828 FloatSize border_box_size(box.Size());
843 return FloatPoint( 829 return FloatPoint(
844 FloatValueForLength(style.PerspectiveOriginX(), border_box_size.Width()), 830 FloatValueForLength(style.PerspectiveOriginX(), border_box_size.Width()),
845 FloatValueForLength(style.PerspectiveOriginY(), 831 FloatValueForLength(style.PerspectiveOriginY(),
846 border_box_size.Height())); 832 border_box_size.Height()));
847 } 833 }
848 834
849 static bool NeedsPerspective(const LayoutObject& object) { 835 static bool NeedsPerspective(const LayoutObject& object) {
850 return object.IsBox() && object.StyleRef().HasPerspective(); 836 return object.IsBox() && object.StyleRef().HasPerspective();
851 } 837 }
852 838
853 void PaintPropertyTreeBuilder::UpdatePerspective( 839 void PaintPropertyTreeBuilder::UpdatePerspective(
854 const LayoutObject& object, 840 const LayoutObject& object,
841 ObjectPaintProperties& properties,
855 PaintPropertyTreeBuilderFragmentContext& context, 842 PaintPropertyTreeBuilderFragmentContext& context,
856 bool& force_subtree_update) { 843 bool& force_subtree_update) {
857 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 844 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
858 if (NeedsPerspective(object)) { 845 if (NeedsPerspective(object)) {
859 const ComputedStyle& style = object.StyleRef(); 846 const ComputedStyle& style = object.StyleRef();
860 // The perspective node must not flatten (else nothing will get 847 // The perspective node must not flatten (else nothing will get
861 // perspective), but it should still extend the rendering context as 848 // perspective), but it should still extend the rendering context as
862 // most transform nodes do. 849 // most transform nodes do.
863 TransformationMatrix matrix = 850 TransformationMatrix matrix =
864 TransformationMatrix().ApplyPerspective(style.Perspective()); 851 TransformationMatrix().ApplyPerspective(style.Perspective());
865 FloatPoint3D origin = PerspectiveOrigin(ToLayoutBox(object)) + 852 FloatPoint3D origin = PerspectiveOrigin(ToLayoutBox(object)) +
866 ToLayoutSize(context.current.paint_offset); 853 ToLayoutSize(context.current.paint_offset);
867 auto& properties = *object.GetMutableForPainting().PaintProperties();
868 force_subtree_update |= properties.UpdatePerspective( 854 force_subtree_update |= properties.UpdatePerspective(
869 context.current.transform, matrix, origin, 855 context.current.transform, matrix, origin,
870 context.current.should_flatten_inherited_transform, 856 context.current.should_flatten_inherited_transform,
871 context.current.rendering_context_id); 857 context.current.rendering_context_id);
872 } else { 858 } else {
873 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 859 force_subtree_update |= properties.ClearPerspective();
874 force_subtree_update |= properties->ClearPerspective();
875 } 860 }
876 } 861 }
877 862
878 const auto* properties = object.PaintProperties(); 863 if (properties.Perspective()) {
879 if (properties && properties->Perspective()) { 864 context.current.transform = properties.Perspective();
880 context.current.transform = properties->Perspective();
881 context.current.should_flatten_inherited_transform = false; 865 context.current.should_flatten_inherited_transform = false;
882 } 866 }
883 } 867 }
884 868
885 static bool NeedsSVGLocalToBorderBoxTransform(const LayoutObject& object) { 869 static bool NeedsSVGLocalToBorderBoxTransform(const LayoutObject& object) {
886 return object.IsSVGRoot(); 870 return object.IsSVGRoot();
887 } 871 }
888 872
889 void PaintPropertyTreeBuilder::UpdateSvgLocalToBorderBoxTransform( 873 void PaintPropertyTreeBuilder::UpdateSvgLocalToBorderBoxTransform(
890 const LayoutObject& object, 874 const LayoutObject& object,
875 ObjectPaintProperties& properties,
891 PaintPropertyTreeBuilderFragmentContext& context, 876 PaintPropertyTreeBuilderFragmentContext& context,
892 bool& force_subtree_update) { 877 bool& force_subtree_update) {
893 if (!object.IsSVGRoot()) 878 if (!object.IsSVGRoot())
894 return; 879 return;
895 880
896 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 881 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
897 AffineTransform transform_to_border_box = 882 AffineTransform transform_to_border_box =
898 SVGRootPainter(ToLayoutSVGRoot(object)) 883 SVGRootPainter(ToLayoutSVGRoot(object))
899 .TransformToPixelSnappedBorderBox(context.current.paint_offset); 884 .TransformToPixelSnappedBorderBox(context.current.paint_offset);
900 if (!transform_to_border_box.IsIdentity() && 885 if (!transform_to_border_box.IsIdentity() &&
901 NeedsSVGLocalToBorderBoxTransform(object)) { 886 NeedsSVGLocalToBorderBoxTransform(object)) {
902 auto& properties = *object.GetMutableForPainting().PaintProperties();
903 force_subtree_update |= properties.UpdateSvgLocalToBorderBoxTransform( 887 force_subtree_update |= properties.UpdateSvgLocalToBorderBoxTransform(
904 context.current.transform, transform_to_border_box, FloatPoint3D()); 888 context.current.transform, transform_to_border_box, FloatPoint3D());
905 } else { 889 } else {
906 if (auto* properties = object.GetMutableForPainting().PaintProperties()) { 890 force_subtree_update |= properties.ClearSvgLocalToBorderBoxTransform();
907 force_subtree_update |= properties->ClearSvgLocalToBorderBoxTransform();
908 }
909 } 891 }
910 } 892 }
911 893
912 const auto* properties = object.PaintProperties(); 894 if (properties.SvgLocalToBorderBoxTransform()) {
913 if (properties && properties->SvgLocalToBorderBoxTransform()) { 895 context.current.transform = properties.SvgLocalToBorderBoxTransform();
914 context.current.transform = properties->SvgLocalToBorderBoxTransform();
915 context.current.should_flatten_inherited_transform = false; 896 context.current.should_flatten_inherited_transform = false;
916 context.current.rendering_context_id = 0; 897 context.current.rendering_context_id = 0;
917 } 898 }
918 // The paint offset is included in |transformToBorderBox| so SVG does not need 899 // The paint offset is included in |transformToBorderBox| so SVG does not need
919 // to handle paint offset internally. 900 // to handle paint offset internally.
920 context.current.paint_offset = LayoutPoint(); 901 context.current.paint_offset = LayoutPoint();
921 } 902 }
922 903
923 static MainThreadScrollingReasons GetMainThreadScrollingReasons( 904 static MainThreadScrollingReasons GetMainThreadScrollingReasons(
924 const LayoutObject& object, 905 const LayoutObject& object,
(...skipping 14 matching lines...) Expand all
939 auto* scrollable_area = box.GetScrollableArea(); 920 auto* scrollable_area = box.GetScrollableArea();
940 IntSize scroll_offset = box.ScrolledContentOffset(); 921 IntSize scroll_offset = box.ScrolledContentOffset();
941 if (!scroll_offset.IsZero() || scrollable_area->ScrollsOverflow()) 922 if (!scroll_offset.IsZero() || scrollable_area->ScrollsOverflow())
942 return true; 923 return true;
943 } 924 }
944 return false; 925 return false;
945 } 926 }
946 927
947 void PaintPropertyTreeBuilder::UpdateScrollAndScrollTranslation( 928 void PaintPropertyTreeBuilder::UpdateScrollAndScrollTranslation(
948 const LayoutObject& object, 929 const LayoutObject& object,
930 ObjectPaintProperties& properties,
949 PaintPropertyTreeBuilderFragmentContext& context, 931 PaintPropertyTreeBuilderFragmentContext& context,
950 bool& force_subtree_update) { 932 bool& force_subtree_update) {
951 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) { 933 if (object.NeedsPaintPropertyUpdate() || force_subtree_update) {
952 if (NeedsScrollTranslation(object)) { 934 if (NeedsScrollTranslation(object)) {
953 const LayoutBox& box = ToLayoutBox(object); 935 const LayoutBox& box = ToLayoutBox(object);
954 auto* scrollable_area = box.GetScrollableArea(); 936 auto* scrollable_area = box.GetScrollableArea();
955 IntSize scroll_offset = box.ScrolledContentOffset(); 937 IntSize scroll_offset = box.ScrolledContentOffset();
956 auto& properties = *object.GetMutableForPainting().PaintProperties();
957 938
958 IntSize scroll_clip = scrollable_area->VisibleContentRect().Size(); 939 IntSize scroll_clip = scrollable_area->VisibleContentRect().Size();
959 IntSize scroll_bounds = scrollable_area->ContentsSize(); 940 IntSize scroll_bounds = scrollable_area->ContentsSize();
960 bool user_scrollable_horizontal = 941 bool user_scrollable_horizontal =
961 scrollable_area->UserInputScrollable(kHorizontalScrollbar); 942 scrollable_area->UserInputScrollable(kHorizontalScrollbar);
962 bool user_scrollable_vertical = 943 bool user_scrollable_vertical =
963 scrollable_area->UserInputScrollable(kVerticalScrollbar); 944 scrollable_area->UserInputScrollable(kVerticalScrollbar);
964 945
965 auto ancestor_reasons = 946 auto ancestor_reasons =
966 context.current.scroll->GetMainThreadScrollingReasons(); 947 context.current.scroll->GetMainThreadScrollingReasons();
(...skipping 11 matching lines...) Expand all
978 -scroll_offset.Width(), -scroll_offset.Height()); 959 -scroll_offset.Width(), -scroll_offset.Height());
979 force_subtree_update |= properties.UpdateScrollTranslation( 960 force_subtree_update |= properties.UpdateScrollTranslation(
980 context.current.transform, matrix, FloatPoint3D(), 961 context.current.transform, matrix, FloatPoint3D(),
981 context.current.should_flatten_inherited_transform, 962 context.current.should_flatten_inherited_transform,
982 context.current.rendering_context_id, kCompositingReasonNone, 963 context.current.rendering_context_id, kCompositingReasonNone,
983 properties.GetCompositorElementId(), context.current.scroll, 964 properties.GetCompositorElementId(), context.current.scroll,
984 scroll_clip, scroll_bounds, user_scrollable_horizontal, 965 scroll_clip, scroll_bounds, user_scrollable_horizontal,
985 user_scrollable_vertical, reasons, scrollable_area); 966 user_scrollable_vertical, reasons, scrollable_area);
986 } else { 967 } else {
987 // Ensure pre-existing properties are cleared. 968 // Ensure pre-existing properties are cleared.
988 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 969 force_subtree_update |= properties.ClearScrollTranslation();
989 force_subtree_update |= properties->ClearScrollTranslation();
990 } 970 }
991 } 971 }
992 972
993 if (object.PaintProperties() && 973 if (properties.ScrollTranslation()) {
994 object.PaintProperties()->ScrollTranslation()) { 974 context.current.transform = properties.ScrollTranslation();
995 context.current.transform = object.PaintProperties()->ScrollTranslation();
996 context.current.scroll = context.current.transform->ScrollNode(); 975 context.current.scroll = context.current.transform->ScrollNode();
997 context.current.should_flatten_inherited_transform = false; 976 context.current.should_flatten_inherited_transform = false;
998 } 977 }
999 } 978 }
1000 979
1001 static bool NeedsCssClipFixedPosition(const LayoutObject& object) { 980 static bool NeedsCssClipFixedPosition(const LayoutObject& object) {
1002 return !object.IsLayoutView() && !object.CanContainFixedPositionObjects() && 981 return !object.IsLayoutView() && !object.CanContainFixedPositionObjects() &&
1003 NeedsCssClip(object); 982 NeedsCssClip(object);
1004 } 983 }
1005 984
1006 void PaintPropertyTreeBuilder::UpdateOutOfFlowContext( 985 void PaintPropertyTreeBuilder::UpdateOutOfFlowContext(
1007 const LayoutObject& object, 986 const LayoutObject& object,
1008 PaintPropertyTreeBuilderFragmentContext& context, 987 PaintPropertyTreeBuilderFragmentContext& context,
1009 bool& force_subtree_update) { 988 bool& force_subtree_update) {
989 if (!object.IsBoxModelObject() && !object.PaintProperties())
990 return;
991
1010 if (object.IsLayoutBlock()) 992 if (object.IsLayoutBlock())
1011 context.paint_offset_for_float = context.current.paint_offset; 993 context.paint_offset_for_float = context.current.paint_offset;
1012 994
1013 if (object.CanContainAbsolutePositionObjects()) 995 if (object.CanContainAbsolutePositionObjects())
1014 context.absolute_position = context.current; 996 context.absolute_position = context.current;
1015 997
1016 if (object.IsLayoutView()) { 998 if (object.IsLayoutView()) {
1017 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 999 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
1018 const auto* initial_fixed_transform = context.fixed_position.transform; 1000 const auto* initial_fixed_transform = context.fixed_position.transform;
1019 const auto* initial_fixed_scroll = context.fixed_position.scroll; 1001 const auto* initial_fixed_scroll = context.fixed_position.scroll;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 void PaintPropertyTreeBuilder::UpdatePaintProperties( 1164 void PaintPropertyTreeBuilder::UpdatePaintProperties(
1183 const LayoutObject& object, 1165 const LayoutObject& object,
1184 PaintPropertyTreeBuilderContext& full_context) { 1166 PaintPropertyTreeBuilderContext& full_context) {
1185 bool needs_paint_properties = 1167 bool needs_paint_properties =
1186 NeedsPaintOffsetTranslation(object) || NeedsTransform(object) || 1168 NeedsPaintOffsetTranslation(object) || NeedsTransform(object) ||
1187 NeedsEffect(object) || NeedsTransformForNonRootSVG(object) || 1169 NeedsEffect(object) || NeedsTransformForNonRootSVG(object) ||
1188 NeedsFilter(object) || NeedsCssClip(object) || 1170 NeedsFilter(object) || NeedsCssClip(object) ||
1189 NeedsScrollbarPaintOffset(object) || NeedsOverflowClip(object) || 1171 NeedsScrollbarPaintOffset(object) || NeedsOverflowClip(object) ||
1190 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) || 1172 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) ||
1191 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object); 1173 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object);
1192
1193 bool had_paint_properties = object.PaintProperties(); 1174 bool had_paint_properties = object.PaintProperties();
1194 1175
1195 if (needs_paint_properties && !had_paint_properties) { 1176 if (needs_paint_properties && !had_paint_properties) {
1196 ObjectPaintProperties& paint_properties = 1177 ObjectPaintProperties& paint_properties =
1197 object.GetMutableForPainting().EnsurePaintProperties(); 1178 object.GetMutableForPainting().EnsurePaintProperties();
1198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1179 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1199 paint_properties.SetCompositorElementId( 1180 paint_properties.SetCompositorElementId(
1200 CreateDomNodeBasedCompositorElementId(object)); 1181 CreateDomNodeBasedCompositorElementId(object));
1201 } 1182 }
1202 } else if (!needs_paint_properties && had_paint_properties) { 1183 } else if (!needs_paint_properties && had_paint_properties) {
(...skipping 11 matching lines...) Expand all
1214 const LayoutObject& object, 1195 const LayoutObject& object,
1215 PaintPropertyTreeBuilderContext& full_context) { 1196 PaintPropertyTreeBuilderContext& full_context) {
1216 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; 1197 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0];
1217 if (object.IsSVGHiddenContainer()) { 1198 if (object.IsSVGHiddenContainer()) {
1218 // SVG resources are painted within one or more other locations in the 1199 // SVG resources are painted within one or more other locations in the
1219 // SVG during paint, and hence have their own independent paint property 1200 // SVG during paint, and hence have their own independent paint property
1220 // trees, paint offset, etc. 1201 // trees, paint offset, etc.
1221 context = PaintPropertyTreeBuilderFragmentContext(); 1202 context = PaintPropertyTreeBuilderFragmentContext();
1222 } 1203 }
1223 1204
1224 bool object_type_might_need_paint_properties = 1205 if (ObjectTypeMightNeedPaintProperties(object))
1225 ObjectTypeMightNeedPaintProperties(object);
1226
1227 if (object_type_might_need_paint_properties)
1228 UpdatePaintProperties(object, full_context); 1206 UpdatePaintProperties(object, full_context);
1229 1207
1230 bool is_actually_needed = false; 1208 bool is_actually_needed = false;
1231 #if DCHECK_IS_ON() 1209 #if DCHECK_IS_ON()
1232 is_actually_needed = full_context.is_actually_needed; 1210 is_actually_needed = full_context.is_actually_needed;
1233 #endif 1211 #endif
1234 1212
1235 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset 1213 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
1236 // can change without needsPaintPropertyUpdate. 1214 // can change without needsPaintPropertyUpdate.
1237 UpdateForObjectLocationAndSize( 1215 UpdateForObjectLocationAndSize(
1238 object, full_context.container_for_absolute_position, is_actually_needed, 1216 object, full_context.container_for_absolute_position, is_actually_needed,
1239 context, full_context.force_subtree_update); 1217 context, full_context.force_subtree_update);
1240 1218
1241 #if DCHECK_IS_ON() 1219 #if DCHECK_IS_ON()
1242 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( 1220 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope(
1243 object, full_context.force_subtree_update); 1221 object, full_context.force_subtree_update);
1244 #endif 1222 #endif
1245 1223
1246 if (object_type_might_need_paint_properties) { 1224 if (object.PaintProperties()) {
1247 UpdateTransform(object, context, full_context.force_subtree_update); 1225 ObjectPaintProperties* properties =
1248 UpdateCssClip(object, context, full_context.force_subtree_update); 1226 object.GetMutableForPainting().PaintProperties();
1227 UpdateTransform(object, *properties, context,
1228 full_context.force_subtree_update);
1229 UpdateCssClip(object, *properties, context,
1230 full_context.force_subtree_update);
1249 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1231 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1250 UpdateEffect(object, context, full_context.force_subtree_update); 1232 UpdateEffect(object, *properties, context,
1251 UpdateFilter(object, context, full_context.force_subtree_update); 1233 full_context.force_subtree_update);
1234 UpdateFilter(object, *properties, context,
1235 full_context.force_subtree_update);
1252 } 1236 }
1253 UpdateLocalBorderBoxContext(object, context, 1237 }
1254 full_context.force_subtree_update); 1238 UpdateLocalBorderBoxContext(object, context,
1239 full_context.force_subtree_update);
1240 if (object.PaintProperties()) {
1241 ObjectPaintProperties* properties =
1242 object.GetMutableForPainting().PaintProperties();
1255 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1243 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1256 UpdateScrollbarPaintOffset(object, context, 1244 UpdateScrollbarPaintOffset(object, *properties, context,
1257 full_context.force_subtree_update); 1245 full_context.force_subtree_update);
1258 } 1246 }
1259 } 1247 }
1260 } 1248 }
1261 1249
1262 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren( 1250 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren(
1263 const LayoutObject& object, 1251 const LayoutObject& object,
1264 PaintPropertyTreeBuilderContext& context) { 1252 PaintPropertyTreeBuilderContext& context) {
1265 if (!ObjectTypeMightNeedPaintProperties(object)) 1253 if (!ObjectTypeMightNeedPaintProperties(object))
1266 return; 1254 return;
1267 1255
1268 for (auto& fragment_context : context.fragments) { 1256 for (auto& fragment_context : context.fragments) {
1269 #if DCHECK_IS_ON() 1257 #if DCHECK_IS_ON()
1270 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( 1258 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope(
1271 object, context.force_subtree_update); 1259 object, context.force_subtree_update);
1272 #endif 1260 #endif
1273 UpdateOverflowClip(object, fragment_context, context.force_subtree_update); 1261
1274 UpdatePerspective(object, fragment_context, context.force_subtree_update); 1262 if (object.PaintProperties()) {
1275 UpdateSvgLocalToBorderBoxTransform(object, fragment_context, 1263 ObjectPaintProperties* properties =
1264 object.GetMutableForPainting().PaintProperties();
1265 UpdateOverflowClip(object, *properties, fragment_context,
1266 context.force_subtree_update);
1267 UpdatePerspective(object, *properties, fragment_context,
1268 context.force_subtree_update);
1269 UpdateSvgLocalToBorderBoxTransform(object, *properties, fragment_context,
1270 context.force_subtree_update);
1271 UpdateScrollAndScrollTranslation(object, *properties, fragment_context,
1276 context.force_subtree_update); 1272 context.force_subtree_update);
1277 UpdateScrollAndScrollTranslation(object, fragment_context, 1273 }
1278 context.force_subtree_update); 1274
1279 UpdateOutOfFlowContext(object, fragment_context, 1275 UpdateOutOfFlowContext(object, fragment_context,
1280 context.force_subtree_update); 1276 context.force_subtree_update);
1281 1277
1282 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); 1278 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate();
1283 } 1279 }
1284 1280
1285 if (object.CanContainAbsolutePositionObjects()) 1281 if (object.CanContainAbsolutePositionObjects())
1286 context.container_for_absolute_position = &object; 1282 context.container_for_absolute_position = &object;
1287 } 1283 }
1288 1284
1289 } // namespace blink 1285 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698