OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 // invalidation. | 542 // invalidation. |
543 // Should move cases into DiffNeedsFullLayout() if | 543 // Should move cases into DiffNeedsFullLayout() if |
544 // - don't need paint invalidation at all; | 544 // - don't need paint invalidation at all; |
545 // - or the layoutObject knows how to exactly invalidate paints caused by the | 545 // - or the layoutObject knows how to exactly invalidate paints caused by the |
546 // layout change instead of forced full paint invalidation. | 546 // layout change instead of forced full paint invalidation. |
547 | 547 |
548 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(*this, other)) | 548 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(*this, other)) |
549 return true; | 549 return true; |
550 | 550 |
551 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 551 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
552 if (rare_non_inherited_data_->appearance_ != | |
553 other.rare_non_inherited_data_->appearance_ || | |
554 rare_non_inherited_data_->margin_before_collapse_ != | |
555 other.rare_non_inherited_data_->margin_before_collapse_ || | |
556 rare_non_inherited_data_->margin_after_collapse_ != | |
557 other.rare_non_inherited_data_->margin_after_collapse_ || | |
558 rare_non_inherited_data_->line_clamp_ != | |
559 other.rare_non_inherited_data_->line_clamp_ || | |
560 rare_non_inherited_data_->text_overflow_ != | |
561 other.rare_non_inherited_data_->text_overflow_ || | |
562 rare_non_inherited_data_->shape_margin_ != | |
563 other.rare_non_inherited_data_->shape_margin_ || | |
564 rare_non_inherited_data_->order_ != | |
565 other.rare_non_inherited_data_->order_ || | |
566 HasFilters() != other.HasFilters()) | |
567 return true; | |
568 | |
569 if (rare_non_inherited_data_->grid_data_.Get() != | 552 if (rare_non_inherited_data_->grid_data_.Get() != |
570 other.rare_non_inherited_data_->grid_data_.Get() && | 553 other.rare_non_inherited_data_->grid_data_.Get() && |
571 *rare_non_inherited_data_->grid_data_.Get() != | 554 *rare_non_inherited_data_->grid_data_.Get() != |
572 *other.rare_non_inherited_data_->grid_data_.Get()) | 555 *other.rare_non_inherited_data_->grid_data_.Get()) |
573 return true; | 556 return true; |
574 | 557 |
575 if (rare_non_inherited_data_->grid_item_data_.Get() != | 558 if (rare_non_inherited_data_->grid_item_data_.Get() != |
576 other.rare_non_inherited_data_->grid_item_data_.Get() && | 559 other.rare_non_inherited_data_->grid_item_data_.Get() && |
577 *rare_non_inherited_data_->grid_item_data_.Get() != | 560 *rare_non_inherited_data_->grid_item_data_.Get() != |
578 *other.rare_non_inherited_data_->grid_item_data_.Get()) | 561 *other.rare_non_inherited_data_->grid_item_data_.Get()) |
(...skipping 21 matching lines...) Expand all Loading... | |
600 | 583 |
601 // If the counter directives change, trigger a relayout to re-calculate | 584 // If the counter directives change, trigger a relayout to re-calculate |
602 // counter values and rebuild the counter node tree. | 585 // counter values and rebuild the counter node tree. |
603 const CounterDirectiveMap* map_a = | 586 const CounterDirectiveMap* map_a = |
604 rare_non_inherited_data_->counter_directives_.get(); | 587 rare_non_inherited_data_->counter_directives_.get(); |
605 const CounterDirectiveMap* map_b = | 588 const CounterDirectiveMap* map_b = |
606 other.rare_non_inherited_data_->counter_directives_.get(); | 589 other.rare_non_inherited_data_->counter_directives_.get(); |
607 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) | 590 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) |
608 return true; | 591 return true; |
609 | 592 |
610 // We only need do layout for opacity changes if adding or losing opacity | 593 // We only need do layout for opacity changes if adding or losing opacity |
nainar
2017/06/13 07:55:42
Would generate this but what about the comment?
shend
2017/06/13 08:15:53
Add to JSON :)
nainar
2017/06/14 00:29:51
Moved to predicate function and generating test fo
| |
611 // could trigger a change | 594 // could trigger a change |
612 // in us being a stacking context. | 595 // in us being a stacking context. |
613 if (IsStackingContext() != other.IsStackingContext() && | 596 if (IsStackingContext() != other.IsStackingContext() && |
614 HasOpacity() != other.HasOpacity()) { | 597 HasOpacity() != other.HasOpacity()) { |
615 // FIXME: We would like to use SimplifiedLayout here, but we can't quite | 598 // FIXME: We would like to use SimplifiedLayout here, but we can't quite |
616 // do that yet. We need to make sure SimplifiedLayout can operate | 599 // do that yet. We need to make sure SimplifiedLayout can operate |
617 // correctly on LayoutInlines (we will need to add a | 600 // correctly on LayoutInlines (we will need to add a |
618 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | 601 // selfNeedsSimplifiedLayout bit in order to not get confused and taint |
619 // every line). In addition we need to solve the floating object issue | 602 // every line). In addition we need to solve the floating object issue |
620 // when layers come and go. Right now a full layout is necessary to keep | 603 // when layers come and go. Right now a full layout is necessary to keep |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 | 645 |
663 // Movement of non-static-positioned object is special cased in | 646 // Movement of non-static-positioned object is special cased in |
664 // ComputedStyle::VisualInvalidationDiff(). | 647 // ComputedStyle::VisualInvalidationDiff(). |
665 | 648 |
666 return false; | 649 return false; |
667 } | 650 } |
668 | 651 |
669 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { | 652 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { |
670 if (ComputedStyleBase::DiffNeedsFullLayout(*this, other)) | 653 if (ComputedStyleBase::DiffNeedsFullLayout(*this, other)) |
671 return true; | 654 return true; |
672 | |
673 if (box_data_.Get() != other.box_data_.Get()) { | |
674 if (box_data_->vertical_align_length_ != | |
675 other.box_data_->vertical_align_length_) | |
676 return true; | |
677 } | |
678 | |
679 if (VerticalAlign() != other.VerticalAlign() || | |
680 GetPosition() != other.GetPosition()) | |
681 return true; | |
682 | |
683 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | |
684 if (rare_non_inherited_data_->align_content_ != | |
685 other.rare_non_inherited_data_->align_content_ || | |
686 rare_non_inherited_data_->align_items_ != | |
687 other.rare_non_inherited_data_->align_items_ || | |
688 rare_non_inherited_data_->align_self_ != | |
689 other.rare_non_inherited_data_->align_self_ || | |
690 rare_non_inherited_data_->justify_content_ != | |
691 other.rare_non_inherited_data_->justify_content_ || | |
692 rare_non_inherited_data_->justify_items_ != | |
693 other.rare_non_inherited_data_->justify_items_ || | |
694 rare_non_inherited_data_->justify_self_ != | |
695 other.rare_non_inherited_data_->justify_self_ || | |
696 rare_non_inherited_data_->contain_ != | |
697 other.rare_non_inherited_data_->contain_) | |
698 return true; | |
699 } | |
700 | |
701 return false; | 655 return false; |
702 } | 656 } |
703 | 657 |
704 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( | 658 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( |
705 const ComputedStyle& other) const { | 659 const ComputedStyle& other) const { |
706 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 660 if (ComputedStyleBase::DiffNeedsPaintInvalidationSubtree(*this, other)) |
707 if (rare_non_inherited_data_->effective_blend_mode_ != | 661 return true; |
708 other.rare_non_inherited_data_->effective_blend_mode_ || | |
709 rare_non_inherited_data_->isolation_ != | |
710 other.rare_non_inherited_data_->isolation_) | |
711 return true; | |
712 | |
713 if (rare_non_inherited_data_->mask_ != | |
714 other.rare_non_inherited_data_->mask_ || | |
715 rare_non_inherited_data_->mask_box_image_ != | |
716 other.rare_non_inherited_data_->mask_box_image_) | |
717 return true; | |
718 } | |
719 | |
720 return false; | 662 return false; |
721 } | 663 } |
722 | 664 |
723 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 665 bool ComputedStyle::DiffNeedsPaintInvalidationObject( |
724 const ComputedStyle& other) const { | 666 const ComputedStyle& other) const { |
725 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) | 667 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) |
726 return true; | 668 return true; |
727 | 669 |
728 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || | 670 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || |
729 *background_data_ != *other.background_data_) | 671 *background_data_ != *other.background_data_) |
730 return true; | 672 return true; |
731 | 673 |
732 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | |
733 if (rare_non_inherited_data_->user_drag_ != | |
734 other.rare_non_inherited_data_->user_drag_ || | |
735 rare_non_inherited_data_->object_fit_ != | |
736 other.rare_non_inherited_data_->object_fit_ || | |
737 rare_non_inherited_data_->object_position_ != | |
738 other.rare_non_inherited_data_->object_position_ || | |
739 !BoxShadowDataEquivalent(other) || !ShapeOutsideDataEquivalent(other) || | |
740 !ClipPathDataEquivalent(other) || | |
741 !rare_non_inherited_data_->outline_.VisuallyEqual( | |
742 other.rare_non_inherited_data_->outline_) || | |
743 (VisitedLinkBorderLeftColor() != other.VisitedLinkBorderLeftColor() && | |
744 BorderLeftWidth()) || | |
745 (VisitedLinkBorderRightColor() != other.VisitedLinkBorderRightColor() && | |
746 BorderRightWidth()) || | |
747 (VisitedLinkBorderBottomColor() != | |
748 other.VisitedLinkBorderBottomColor() && | |
749 BorderBottomWidth()) || | |
750 (VisitedLinkBorderTopColor() != other.VisitedLinkBorderTopColor() && | |
751 BorderTopWidth()) || | |
752 (VisitedLinkOutlineColor() != other.VisitedLinkOutlineColor() && | |
753 OutlineWidth()) || | |
754 (VisitedLinkBackgroundColor() != other.VisitedLinkBackgroundColor())) | |
755 return true; | |
756 } | |
757 | |
758 if (Resize() != other.Resize()) | |
759 return true; | |
760 | |
761 if (rare_non_inherited_data_->paint_images_) { | 674 if (rare_non_inherited_data_->paint_images_) { |
762 for (const auto& image : *rare_non_inherited_data_->paint_images_) { | 675 for (const auto& image : *rare_non_inherited_data_->paint_images_) { |
763 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 676 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) |
764 return true; | 677 return true; |
765 } | 678 } |
766 } | 679 } |
767 | 680 |
768 return false; | 681 return false; |
769 } | 682 } |
770 | 683 |
(...skipping 27 matching lines...) Expand all Loading... | |
798 } | 711 } |
799 } | 712 } |
800 | 713 |
801 return false; | 714 return false; |
802 } | 715 } |
803 | 716 |
804 // This doesn't include conditions needing layout or overflow recomputation | 717 // This doesn't include conditions needing layout or overflow recomputation |
805 // which implies visual rect update. | 718 // which implies visual rect update. |
806 bool ComputedStyle::DiffNeedsVisualRectUpdate( | 719 bool ComputedStyle::DiffNeedsVisualRectUpdate( |
807 const ComputedStyle& other) const { | 720 const ComputedStyle& other) const { |
808 // Visual rect is empty if visibility is hidden. | 721 // Visual rect is empty if visibility is hidden. Also need to update visual |
722 // rect of the resizer. | |
809 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) | 723 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) |
810 return true; | 724 return true; |
811 | |
812 // Need to update visual rect of the resizer. | |
813 if (Resize() != other.Resize()) | |
814 return true; | |
815 | |
816 return false; | 725 return false; |
817 } | 726 } |
818 | 727 |
819 void ComputedStyle::UpdatePropertySpecificDifferences( | 728 void ComputedStyle::UpdatePropertySpecificDifferences( |
820 const ComputedStyle& other, | 729 const ComputedStyle& other, |
821 StyleDifference& diff) const { | 730 StyleDifference& diff) const { |
822 if (box_data_->z_index_ != other.box_data_->z_index_ || | 731 if (ComputedStyleBase::UpdatePropertySpecificDifferencesZIndex(*this, other)) |
823 IsStackingContext() != other.IsStackingContext()) | |
824 diff.SetZIndexChanged(); | 732 diff.SetZIndexChanged(); |
825 | 733 |
826 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 734 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
827 // It's possible for the old and new style transform data to be equivalent | 735 // It's possible for the old and new style transform data to be equivalent |
828 // while hasTransform() differs, as it checks a number of conditions aside | 736 // while hasTransform() differs, as it checks a number of conditions aside |
829 // from just the matrix, including but not limited to animation state. | 737 // from just the matrix, including but not limited to animation state. |
830 if (HasTransform() != other.HasTransform() || | 738 if (HasTransform() != other.HasTransform() || |
831 !TransformDataEquivalent(other) || | 739 !TransformDataEquivalent(other) || |
832 rare_non_inherited_data_->perspective_ != | 740 rare_non_inherited_data_->perspective_ != |
833 other.rare_non_inherited_data_->perspective_ || | 741 other.rare_non_inherited_data_->perspective_ || |
834 rare_non_inherited_data_->perspective_origin_ != | 742 rare_non_inherited_data_->perspective_origin_ != |
835 other.rare_non_inherited_data_->perspective_origin_) | 743 other.rare_non_inherited_data_->perspective_origin_) |
836 diff.SetTransformChanged(); | 744 diff.SetTransformChanged(); |
837 } | 745 } |
838 | 746 |
839 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 747 if (ComputedStyleBase::UpdatePropertySpecificDifferencesOpacity(*this, other)) |
840 if (rare_non_inherited_data_->opacity_ != | 748 diff.SetOpacityChanged(); |
841 other.rare_non_inherited_data_->opacity_) | |
842 diff.SetOpacityChanged(); | |
843 } | |
844 | 749 |
845 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 750 if (ComputedStyleBase::UpdatePropertySpecificDifferencesFilter(*this, other)) |
846 if ((rare_non_inherited_data_->filter_ != | 751 diff.SetFilterChanged(); |
847 other.rare_non_inherited_data_->filter_) || | |
848 !ReflectionDataEquivalent(other)) | |
849 diff.SetFilterChanged(); | |
850 } | |
851 | 752 |
852 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 753 if (ComputedStyleBase:: |
853 if (!BoxShadowDataEquivalent(other) || | 754 UpdatePropertySpecificDifferencesNeedsRecomputeOverflow(*this, other)) |
854 !rare_non_inherited_data_->outline_.VisuallyEqual( | |
855 other.rare_non_inherited_data_->outline_)) | |
856 diff.SetNeedsRecomputeOverflow(); | |
857 } | |
858 | |
859 if (!BorderVisualOverflowEqual(other)) | |
860 diff.SetNeedsRecomputeOverflow(); | 755 diff.SetNeedsRecomputeOverflow(); |
861 | 756 |
862 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 757 if (ComputedStyleBase::UpdatePropertySpecificDifferencesBackdropFilter(*this, |
863 if (rare_non_inherited_data_->backdrop_filter_ != | 758 other)) |
864 other.rare_non_inherited_data_->backdrop_filter_) | 759 diff.SetBackdropFilterChanged(); |
865 diff.SetBackdropFilterChanged(); | |
866 } | |
867 | 760 |
868 if (!diff.NeedsFullPaintInvalidation()) { | 761 if (!diff.NeedsFullPaintInvalidation()) { |
869 if ((inherited_data_->color_ != other.inherited_data_->color_ || | 762 if ((inherited_data_->color_ != other.inherited_data_->color_ || |
870 inherited_data_->visited_link_color_ != | 763 inherited_data_->visited_link_color_ != |
871 other.inherited_data_->visited_link_color_ || | 764 other.inherited_data_->visited_link_color_ || |
872 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || | 765 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || |
873 visual_data_->text_decoration_ != | 766 visual_data_->text_decoration_ != |
874 other.visual_data_->text_decoration_) || | 767 other.visual_data_->text_decoration_) || |
875 (rare_non_inherited_data_.Get() != | |
876 other.rare_non_inherited_data_.Get() && | |
877 (rare_non_inherited_data_->text_decoration_style_ != | |
878 other.rare_non_inherited_data_->text_decoration_style_ || | |
879 rare_non_inherited_data_->text_decoration_color_ != | |
880 other.rare_non_inherited_data_->text_decoration_color_ || | |
881 rare_non_inherited_data_->visited_link_text_decoration_color_ != | |
882 other.rare_non_inherited_data_ | |
883 ->visited_link_text_decoration_color_)) || | |
884 ComputedStyleBase:: | 768 ComputedStyleBase:: |
885 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, | 769 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, |
886 other)) { | 770 other)) { |
887 diff.SetTextDecorationOrColorChanged(); | 771 diff.SetTextDecorationOrColorChanged(); |
888 } | 772 } |
889 } | 773 } |
890 | 774 |
891 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 775 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; |
nainar
2017/06/13 07:55:42
Doing this in a separate CL. Question should I mov
shend
2017/06/13 08:15:53
Make predicate and generate diff :)
nainar
2017/06/14 00:29:51
Will do this in a separate CL - since its on Visua
| |
892 bool other_has_clip = | 776 bool other_has_clip = |
893 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; | 777 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; |
894 if (has_clip != other_has_clip || | 778 if (has_clip != other_has_clip || |
895 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) | 779 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) |
896 diff.SetCSSClipChanged(); | 780 diff.SetCSSClipChanged(); |
897 } | 781 } |
898 | 782 |
899 void ComputedStyle::AddPaintImage(StyleImage* image) { | 783 void ComputedStyle::AddPaintImage(StyleImage* image) { |
900 if (!rare_non_inherited_data_.Access()->paint_images_) { | 784 if (!rare_non_inherited_data_.Access()->paint_images_) { |
901 rare_non_inherited_data_.Access()->paint_images_ = | 785 rare_non_inherited_data_.Access()->paint_images_ = |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2347 if (value < 0) | 2231 if (value < 0) |
2348 fvalue -= 0.5f; | 2232 fvalue -= 0.5f; |
2349 else | 2233 else |
2350 fvalue += 0.5f; | 2234 fvalue += 0.5f; |
2351 } | 2235 } |
2352 | 2236 |
2353 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2237 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2354 } | 2238 } |
2355 | 2239 |
2356 } // namespace blink | 2240 } // namespace blink |
OLD | NEW |