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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 // invalidation. | 540 // invalidation. |
541 // Should move cases into DiffNeedsFullLayout() if | 541 // Should move cases into DiffNeedsFullLayout() if |
542 // - don't need paint invalidation at all; | 542 // - don't need paint invalidation at all; |
543 // - or the layoutObject knows how to exactly invalidate paints caused by the | 543 // - or the layoutObject knows how to exactly invalidate paints caused by the |
544 // layout change instead of forced full paint invalidation. | 544 // layout change instead of forced full paint invalidation. |
545 | 545 |
546 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(*this, other)) | 546 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(*this, other)) |
547 return true; | 547 return true; |
548 | 548 |
549 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 549 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
550 if (rare_non_inherited_data_->appearance_ != | |
551 other.rare_non_inherited_data_->appearance_ || | |
552 rare_non_inherited_data_->margin_before_collapse_ != | |
553 other.rare_non_inherited_data_->margin_before_collapse_ || | |
554 rare_non_inherited_data_->margin_after_collapse_ != | |
555 other.rare_non_inherited_data_->margin_after_collapse_ || | |
556 rare_non_inherited_data_->line_clamp_ != | |
557 other.rare_non_inherited_data_->line_clamp_ || | |
558 rare_non_inherited_data_->text_overflow_ != | |
559 other.rare_non_inherited_data_->text_overflow_ || | |
560 rare_non_inherited_data_->shape_margin_ != | |
561 other.rare_non_inherited_data_->shape_margin_ || | |
562 rare_non_inherited_data_->order_ != | |
563 other.rare_non_inherited_data_->order_ || | |
564 HasFilters() != other.HasFilters()) | |
565 return true; | |
566 | |
567 if (rare_non_inherited_data_->grid_data_.Get() != | 550 if (rare_non_inherited_data_->grid_data_.Get() != |
568 other.rare_non_inherited_data_->grid_data_.Get() && | 551 other.rare_non_inherited_data_->grid_data_.Get() && |
569 *rare_non_inherited_data_->grid_data_.Get() != | 552 *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 return true; | 554 return true; |
572 | 555 |
573 if (rare_non_inherited_data_->grid_item_data_.Get() != | 556 if (rare_non_inherited_data_->grid_item_data_.Get() != |
574 other.rare_non_inherited_data_->grid_item_data_.Get() && | 557 other.rare_non_inherited_data_->grid_item_data_.Get() && |
575 *rare_non_inherited_data_->grid_item_data_.Get() != | 558 *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()) |
(...skipping 20 matching lines...) Expand all Loading... |
597 return true; | 580 return true; |
598 | 581 |
599 // If the counter directives change, trigger a relayout to re-calculate | 582 // If the counter directives change, trigger a relayout to re-calculate |
600 // counter values and rebuild the counter node tree. | 583 // counter values and rebuild the counter node tree. |
601 const CounterDirectiveMap* map_a = | 584 const CounterDirectiveMap* map_a = |
602 rare_non_inherited_data_->counter_directives_.get(); | 585 rare_non_inherited_data_->counter_directives_.get(); |
603 const CounterDirectiveMap* map_b = | 586 const CounterDirectiveMap* map_b = |
604 other.rare_non_inherited_data_->counter_directives_.get(); | 587 other.rare_non_inherited_data_->counter_directives_.get(); |
605 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) | 588 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) |
606 return true; | 589 return true; |
607 | |
608 // We only need do layout for opacity changes if adding or losing opacity | |
609 // could trigger a change | |
610 // in us being a stacking context. | |
611 if (IsStackingContext() != other.IsStackingContext() && | |
612 HasOpacity() != other.HasOpacity()) { | |
613 // FIXME: We would like to use SimplifiedLayout here, but we can't quite | |
614 // do that yet. We need to make sure SimplifiedLayout can operate | |
615 // correctly on LayoutInlines (we will need to add a | |
616 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | |
617 // every line). In addition we need to solve the floating object issue | |
618 // when layers come and go. Right now a full layout is necessary to keep | |
619 // floating object lists sane. | |
620 return true; | |
621 } | |
622 } | 590 } |
623 | 591 |
624 if (IsDisplayTableType(Display())) { | 592 if (IsDisplayTableType(Display())) { |
625 if (ComputedStyleBase:: | 593 if (ComputedStyleBase:: |
626 DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType(*this, | 594 DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType(*this, |
627 other)) | 595 other)) |
628 return true; | 596 return true; |
629 | 597 |
630 // In the collapsing border model, 'hidden' suppresses other borders, while | 598 // In the collapsing border model, 'hidden' suppresses other borders, while |
631 // 'none' does not, so these style differences can be width differences. | 599 // 'none' does not, so these style differences can be width differences. |
(...skipping 26 matching lines...) Expand all Loading... |
658 (other.Visibility() == EVisibility::kCollapse)) | 626 (other.Visibility() == EVisibility::kCollapse)) |
659 return true; | 627 return true; |
660 | 628 |
661 // Movement of non-static-positioned object is special cased in | 629 // Movement of non-static-positioned object is special cased in |
662 // ComputedStyle::VisualInvalidationDiff(). | 630 // ComputedStyle::VisualInvalidationDiff(). |
663 | 631 |
664 return false; | 632 return false; |
665 } | 633 } |
666 | 634 |
667 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { | 635 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { |
668 if (ComputedStyleBase::DiffNeedsFullLayout(*this, other)) | 636 return ComputedStyleBase::DiffNeedsFullLayout(*this, other); |
669 return true; | |
670 | |
671 if (box_data_.Get() != other.box_data_.Get()) { | |
672 if (box_data_->vertical_align_length_ != | |
673 other.box_data_->vertical_align_length_) | |
674 return true; | |
675 } | |
676 | |
677 if (VerticalAlign() != other.VerticalAlign() || | |
678 GetPosition() != other.GetPosition()) | |
679 return true; | |
680 | |
681 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | |
682 if (rare_non_inherited_data_->align_content_ != | |
683 other.rare_non_inherited_data_->align_content_ || | |
684 rare_non_inherited_data_->align_items_ != | |
685 other.rare_non_inherited_data_->align_items_ || | |
686 rare_non_inherited_data_->align_self_ != | |
687 other.rare_non_inherited_data_->align_self_ || | |
688 rare_non_inherited_data_->justify_content_ != | |
689 other.rare_non_inherited_data_->justify_content_ || | |
690 rare_non_inherited_data_->justify_items_ != | |
691 other.rare_non_inherited_data_->justify_items_ || | |
692 rare_non_inherited_data_->justify_self_ != | |
693 other.rare_non_inherited_data_->justify_self_ || | |
694 rare_non_inherited_data_->contain_ != | |
695 other.rare_non_inherited_data_->contain_) | |
696 return true; | |
697 } | |
698 | |
699 return false; | |
700 } | 637 } |
701 | 638 |
702 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( | 639 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( |
703 const ComputedStyle& other) const { | 640 const ComputedStyle& other) const { |
704 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 641 return ComputedStyleBase::DiffNeedsPaintInvalidationSubtree(*this, other); |
705 if (rare_non_inherited_data_->effective_blend_mode_ != | |
706 other.rare_non_inherited_data_->effective_blend_mode_ || | |
707 rare_non_inherited_data_->isolation_ != | |
708 other.rare_non_inherited_data_->isolation_) | |
709 return true; | |
710 | |
711 if (rare_non_inherited_data_->mask_ != | |
712 other.rare_non_inherited_data_->mask_ || | |
713 rare_non_inherited_data_->mask_box_image_ != | |
714 other.rare_non_inherited_data_->mask_box_image_) | |
715 return true; | |
716 } | |
717 | |
718 return false; | |
719 } | 642 } |
720 | 643 |
721 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 644 bool ComputedStyle::DiffNeedsPaintInvalidationObject( |
722 const ComputedStyle& other) const { | 645 const ComputedStyle& other) const { |
723 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) | 646 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) |
724 return true; | 647 return true; |
725 | 648 |
726 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || | 649 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || |
727 *background_data_ != *other.background_data_) | 650 *background_data_ != *other.background_data_) |
728 return true; | 651 return true; |
729 | 652 |
730 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | |
731 if (rare_non_inherited_data_->user_drag_ != | |
732 other.rare_non_inherited_data_->user_drag_ || | |
733 rare_non_inherited_data_->object_fit_ != | |
734 other.rare_non_inherited_data_->object_fit_ || | |
735 rare_non_inherited_data_->object_position_ != | |
736 other.rare_non_inherited_data_->object_position_ || | |
737 !BoxShadowDataEquivalent(other) || !ShapeOutsideDataEquivalent(other) || | |
738 !ClipPathDataEquivalent(other) || | |
739 !rare_non_inherited_data_->outline_.VisuallyEqual( | |
740 other.rare_non_inherited_data_->outline_) || | |
741 (VisitedLinkBorderLeftColor() != other.VisitedLinkBorderLeftColor() && | |
742 BorderLeftWidth()) || | |
743 (VisitedLinkBorderRightColor() != other.VisitedLinkBorderRightColor() && | |
744 BorderRightWidth()) || | |
745 (VisitedLinkBorderBottomColor() != | |
746 other.VisitedLinkBorderBottomColor() && | |
747 BorderBottomWidth()) || | |
748 (VisitedLinkBorderTopColor() != other.VisitedLinkBorderTopColor() && | |
749 BorderTopWidth()) || | |
750 (VisitedLinkOutlineColor() != other.VisitedLinkOutlineColor() && | |
751 OutlineWidth()) || | |
752 (VisitedLinkBackgroundColor() != other.VisitedLinkBackgroundColor())) | |
753 return true; | |
754 } | |
755 | |
756 if (Resize() != other.Resize()) | |
757 return true; | |
758 | |
759 if (rare_non_inherited_data_->paint_images_) { | 653 if (rare_non_inherited_data_->paint_images_) { |
760 for (const auto& image : *rare_non_inherited_data_->paint_images_) { | 654 for (const auto& image : *rare_non_inherited_data_->paint_images_) { |
761 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 655 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) |
762 return true; | 656 return true; |
763 } | 657 } |
764 } | 658 } |
765 | 659 |
766 return false; | 660 return false; |
767 } | 661 } |
768 | 662 |
(...skipping 27 matching lines...) Expand all Loading... |
796 } | 690 } |
797 } | 691 } |
798 | 692 |
799 return false; | 693 return false; |
800 } | 694 } |
801 | 695 |
802 // This doesn't include conditions needing layout or overflow recomputation | 696 // This doesn't include conditions needing layout or overflow recomputation |
803 // which implies visual rect update. | 697 // which implies visual rect update. |
804 bool ComputedStyle::DiffNeedsVisualRectUpdate( | 698 bool ComputedStyle::DiffNeedsVisualRectUpdate( |
805 const ComputedStyle& other) const { | 699 const ComputedStyle& other) const { |
806 // Visual rect is empty if visibility is hidden. | 700 // Visual rect is empty if visibility is hidden. Also need to update visual |
807 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) | 701 // rect of the resizer. |
808 return true; | 702 return ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other); |
809 | |
810 // Need to update visual rect of the resizer. | |
811 if (Resize() != other.Resize()) | |
812 return true; | |
813 | |
814 return false; | |
815 } | 703 } |
816 | 704 |
817 void ComputedStyle::UpdatePropertySpecificDifferences( | 705 void ComputedStyle::UpdatePropertySpecificDifferences( |
818 const ComputedStyle& other, | 706 const ComputedStyle& other, |
819 StyleDifference& diff) const { | 707 StyleDifference& diff) const { |
820 if (box_data_->z_index_ != other.box_data_->z_index_ || | 708 if (ComputedStyleBase::UpdatePropertySpecificDifferencesZIndex(*this, other)) |
821 IsStackingContext() != other.IsStackingContext()) | |
822 diff.SetZIndexChanged(); | 709 diff.SetZIndexChanged(); |
823 | 710 |
824 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 711 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
825 // It's possible for the old and new style transform data to be equivalent | 712 // It's possible for the old and new style transform data to be equivalent |
826 // while hasTransform() differs, as it checks a number of conditions aside | 713 // while hasTransform() differs, as it checks a number of conditions aside |
827 // from just the matrix, including but not limited to animation state. | 714 // from just the matrix, including but not limited to animation state. |
828 if (HasTransform() != other.HasTransform() || | 715 if (HasTransform() != other.HasTransform() || |
829 !TransformDataEquivalent(other) || | 716 !TransformDataEquivalent(other) || |
830 rare_non_inherited_data_->perspective_ != | 717 rare_non_inherited_data_->perspective_ != |
831 other.rare_non_inherited_data_->perspective_ || | 718 other.rare_non_inherited_data_->perspective_ || |
832 rare_non_inherited_data_->perspective_origin_ != | 719 rare_non_inherited_data_->perspective_origin_ != |
833 other.rare_non_inherited_data_->perspective_origin_) | 720 other.rare_non_inherited_data_->perspective_origin_) |
834 diff.SetTransformChanged(); | 721 diff.SetTransformChanged(); |
835 } | 722 } |
836 | 723 |
837 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 724 if (ComputedStyleBase::UpdatePropertySpecificDifferencesOpacity(*this, other)) |
838 if (rare_non_inherited_data_->opacity_ != | 725 diff.SetOpacityChanged(); |
839 other.rare_non_inherited_data_->opacity_) | |
840 diff.SetOpacityChanged(); | |
841 } | |
842 | 726 |
843 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 727 if (ComputedStyleBase::UpdatePropertySpecificDifferencesFilter(*this, other)) |
844 if ((rare_non_inherited_data_->filter_ != | 728 diff.SetFilterChanged(); |
845 other.rare_non_inherited_data_->filter_) || | |
846 !ReflectionDataEquivalent(other)) | |
847 diff.SetFilterChanged(); | |
848 } | |
849 | 729 |
850 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 730 if (ComputedStyleBase:: |
851 if (!BoxShadowDataEquivalent(other) || | 731 UpdatePropertySpecificDifferencesNeedsRecomputeOverflow(*this, other)) |
852 !rare_non_inherited_data_->outline_.VisuallyEqual( | |
853 other.rare_non_inherited_data_->outline_)) | |
854 diff.SetNeedsRecomputeOverflow(); | |
855 } | |
856 | |
857 if (!BorderVisualOverflowEqual(other)) | |
858 diff.SetNeedsRecomputeOverflow(); | 732 diff.SetNeedsRecomputeOverflow(); |
859 | 733 |
860 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 734 if (ComputedStyleBase::UpdatePropertySpecificDifferencesBackdropFilter(*this, |
861 if (rare_non_inherited_data_->backdrop_filter_ != | 735 other)) |
862 other.rare_non_inherited_data_->backdrop_filter_) | 736 diff.SetBackdropFilterChanged(); |
863 diff.SetBackdropFilterChanged(); | |
864 } | |
865 | 737 |
866 if (!diff.NeedsFullPaintInvalidation()) { | 738 if (!diff.NeedsFullPaintInvalidation()) { |
867 if ((inherited_data_->color_ != other.inherited_data_->color_ || | 739 if ((inherited_data_->color_ != other.inherited_data_->color_ || |
868 inherited_data_->visited_link_color_ != | 740 inherited_data_->visited_link_color_ != |
869 other.inherited_data_->visited_link_color_ || | 741 other.inherited_data_->visited_link_color_ || |
870 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || | 742 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || |
871 visual_data_->text_decoration_ != | 743 visual_data_->text_decoration_ != |
872 other.visual_data_->text_decoration_) || | 744 other.visual_data_->text_decoration_) || |
873 (rare_non_inherited_data_.Get() != | |
874 other.rare_non_inherited_data_.Get() && | |
875 (rare_non_inherited_data_->text_decoration_style_ != | |
876 other.rare_non_inherited_data_->text_decoration_style_ || | |
877 rare_non_inherited_data_->text_decoration_color_ != | |
878 other.rare_non_inherited_data_->text_decoration_color_ || | |
879 rare_non_inherited_data_->visited_link_text_decoration_color_ != | |
880 other.rare_non_inherited_data_ | |
881 ->visited_link_text_decoration_color_)) || | |
882 ComputedStyleBase:: | 745 ComputedStyleBase:: |
883 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, | 746 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, |
884 other)) { | 747 other)) { |
885 diff.SetTextDecorationOrColorChanged(); | 748 diff.SetTextDecorationOrColorChanged(); |
886 } | 749 } |
887 } | 750 } |
888 | 751 |
889 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 752 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; |
890 bool other_has_clip = | 753 bool other_has_clip = |
891 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; | 754 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 if (value < 0) | 2238 if (value < 0) |
2376 fvalue -= 0.5f; | 2239 fvalue -= 0.5f; |
2377 else | 2240 else |
2378 fvalue += 0.5f; | 2241 fvalue += 0.5f; |
2379 } | 2242 } |
2380 | 2243 |
2381 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2244 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2382 } | 2245 } |
2383 | 2246 |
2384 } // namespace blink | 2247 } // namespace blink |
OLD | NEW |