Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 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 if (ComputedStyleBase::DiffNeedsFullLayout(*this, other)) | 
| 669 return true; | 637 return true; | 
| 
 
shend
2017/06/14 00:33:35
nit: Could just be "return ComputedStyleBase..."
 
nainar
2017/06/14 05:11:18
Done
 
 | |
| 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; | 638 return false; | 
| 700 } | 639 } | 
| 701 | 640 | 
| 702 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( | 641 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( | 
| 703 const ComputedStyle& other) const { | 642 const ComputedStyle& other) const { | 
| 704 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 643 if (ComputedStyleBase::DiffNeedsPaintInvalidationSubtree(*this, other)) | 
| 
 
shend
2017/06/14 00:33:35
nit: same here.
 
nainar
2017/06/14 05:11:18
Done
 
 | |
| 705 if (rare_non_inherited_data_->effective_blend_mode_ != | 644 return true; | 
| 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; | 645 return false; | 
| 719 } | 646 } | 
| 720 | 647 | 
| 721 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 648 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 
| 722 const ComputedStyle& other) const { | 649 const ComputedStyle& other) const { | 
| 723 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) | 650 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) | 
| 724 return true; | 651 return true; | 
| 725 | 652 | 
| 726 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || | 653 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || | 
| 727 *background_data_ != *other.background_data_) | 654 *background_data_ != *other.background_data_) | 
| 728 return true; | 655 return true; | 
| 729 | 656 | 
| 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_) { | 657 if (rare_non_inherited_data_->paint_images_) { | 
| 760 for (const auto& image : *rare_non_inherited_data_->paint_images_) { | 658 for (const auto& image : *rare_non_inherited_data_->paint_images_) { | 
| 761 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 659 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 
| 762 return true; | 660 return true; | 
| 763 } | 661 } | 
| 764 } | 662 } | 
| 765 | 663 | 
| 766 return false; | 664 return false; | 
| 767 } | 665 } | 
| 768 | 666 | 
| (...skipping 27 matching lines...) Expand all Loading... | |
| 796 } | 694 } | 
| 797 } | 695 } | 
| 798 | 696 | 
| 799 return false; | 697 return false; | 
| 800 } | 698 } | 
| 801 | 699 | 
| 802 // This doesn't include conditions needing layout or overflow recomputation | 700 // This doesn't include conditions needing layout or overflow recomputation | 
| 803 // which implies visual rect update. | 701 // which implies visual rect update. | 
| 804 bool ComputedStyle::DiffNeedsVisualRectUpdate( | 702 bool ComputedStyle::DiffNeedsVisualRectUpdate( | 
| 805 const ComputedStyle& other) const { | 703 const ComputedStyle& other) const { | 
| 806 // Visual rect is empty if visibility is hidden. | 704 // Visual rect is empty if visibility is hidden. Also need to update visual | 
| 705 // rect of the resizer. | |
| 807 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) | 706 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) | 
| 
 
shend
2017/06/14 00:33:34
nit: Same here.
 
nainar
2017/06/14 05:11:18
Done
 
 | |
| 808 return true; | 707 return true; | 
| 809 | |
| 810 // Need to update visual rect of the resizer. | |
| 811 if (Resize() != other.Resize()) | |
| 812 return true; | |
| 813 | |
| 814 return false; | 708 return false; | 
| 815 } | 709 } | 
| 816 | 710 | 
| 817 void ComputedStyle::UpdatePropertySpecificDifferences( | 711 void ComputedStyle::UpdatePropertySpecificDifferences( | 
| 818 const ComputedStyle& other, | 712 const ComputedStyle& other, | 
| 819 StyleDifference& diff) const { | 713 StyleDifference& diff) const { | 
| 820 if (box_data_->z_index_ != other.box_data_->z_index_ || | 714 if (ComputedStyleBase::UpdatePropertySpecificDifferencesZIndex(*this, other)) | 
| 821 IsStackingContext() != other.IsStackingContext()) | |
| 822 diff.SetZIndexChanged(); | 715 diff.SetZIndexChanged(); | 
| 823 | 716 | 
| 824 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 717 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 | 718 // 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 | 719 // while hasTransform() differs, as it checks a number of conditions aside | 
| 827 // from just the matrix, including but not limited to animation state. | 720 // from just the matrix, including but not limited to animation state. | 
| 828 if (HasTransform() != other.HasTransform() || | 721 if (HasTransform() != other.HasTransform() || | 
| 829 !TransformDataEquivalent(other) || | 722 !TransformDataEquivalent(other) || | 
| 830 rare_non_inherited_data_->perspective_ != | 723 rare_non_inherited_data_->perspective_ != | 
| 831 other.rare_non_inherited_data_->perspective_ || | 724 other.rare_non_inherited_data_->perspective_ || | 
| 832 rare_non_inherited_data_->perspective_origin_ != | 725 rare_non_inherited_data_->perspective_origin_ != | 
| 833 other.rare_non_inherited_data_->perspective_origin_) | 726 other.rare_non_inherited_data_->perspective_origin_) | 
| 834 diff.SetTransformChanged(); | 727 diff.SetTransformChanged(); | 
| 835 } | 728 } | 
| 836 | 729 | 
| 837 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 730 if (ComputedStyleBase::UpdatePropertySpecificDifferencesOpacity(*this, other)) | 
| 838 if (rare_non_inherited_data_->opacity_ != | 731 diff.SetOpacityChanged(); | 
| 839 other.rare_non_inherited_data_->opacity_) | |
| 840 diff.SetOpacityChanged(); | |
| 841 } | |
| 842 | 732 | 
| 843 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 733 if (ComputedStyleBase::UpdatePropertySpecificDifferencesFilter(*this, other)) | 
| 844 if ((rare_non_inherited_data_->filter_ != | 734 diff.SetFilterChanged(); | 
| 845 other.rare_non_inherited_data_->filter_) || | |
| 846 !ReflectionDataEquivalent(other)) | |
| 847 diff.SetFilterChanged(); | |
| 848 } | |
| 849 | 735 | 
| 850 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 736 if (ComputedStyleBase:: | 
| 851 if (!BoxShadowDataEquivalent(other) || | 737 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(); | 738 diff.SetNeedsRecomputeOverflow(); | 
| 859 | 739 | 
| 860 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 740 if (ComputedStyleBase::UpdatePropertySpecificDifferencesBackdropFilter(*this, | 
| 861 if (rare_non_inherited_data_->backdrop_filter_ != | 741 other)) | 
| 862 other.rare_non_inherited_data_->backdrop_filter_) | 742 diff.SetBackdropFilterChanged(); | 
| 863 diff.SetBackdropFilterChanged(); | |
| 864 } | |
| 865 | 743 | 
| 866 if (!diff.NeedsFullPaintInvalidation()) { | 744 if (!diff.NeedsFullPaintInvalidation()) { | 
| 867 if ((inherited_data_->color_ != other.inherited_data_->color_ || | 745 if ((inherited_data_->color_ != other.inherited_data_->color_ || | 
| 868 inherited_data_->visited_link_color_ != | 746 inherited_data_->visited_link_color_ != | 
| 869 other.inherited_data_->visited_link_color_ || | 747 other.inherited_data_->visited_link_color_ || | 
| 870 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || | 748 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || | 
| 871 visual_data_->text_decoration_ != | 749 visual_data_->text_decoration_ != | 
| 872 other.visual_data_->text_decoration_) || | 750 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:: | 751 ComputedStyleBase:: | 
| 883 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, | 752 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, | 
| 884 other)) { | 753 other)) { | 
| 885 diff.SetTextDecorationOrColorChanged(); | 754 diff.SetTextDecorationOrColorChanged(); | 
| 886 } | 755 } | 
| 887 } | 756 } | 
| 888 | 757 | 
| 889 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 758 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 
| 890 bool other_has_clip = | 759 bool other_has_clip = | 
| 891 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; | 760 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) | 2244 if (value < 0) | 
| 2376 fvalue -= 0.5f; | 2245 fvalue -= 0.5f; | 
| 2377 else | 2246 else | 
| 2378 fvalue += 0.5f; | 2247 fvalue += 0.5f; | 
| 2379 } | 2248 } | 
| 2380 | 2249 | 
| 2381 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2250 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 
| 2382 } | 2251 } | 
| 2383 | 2252 | 
| 2384 } // namespace blink | 2253 } // namespace blink | 
| OLD | NEW |