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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 other.OriginalDisplay() && // Not generated in ComputedStyleBase | 482 other.OriginalDisplay() && // Not generated in ComputedStyleBase |
| 483 VerticalAlign() == | 483 VerticalAlign() == |
| 484 other.VerticalAlign() && // Not generated in ComputedStyleBase | 484 other.VerticalAlign() && // Not generated in ComputedStyleBase |
| 485 box_ == other.box_ && | 485 box_ == other.box_ && |
| 486 visual_ == other.visual_ && background_ == other.background_ && | 486 visual_ == other.visual_ && background_ == other.background_ && |
| 487 surround_ == other.surround_ && | 487 surround_ == other.surround_ && |
| 488 rare_non_inherited_data_ == other.rare_non_inherited_data_ && | 488 rare_non_inherited_data_ == other.rare_non_inherited_data_ && |
| 489 svg_style_->NonInheritedEqual(*other.svg_style_); | 489 svg_style_->NonInheritedEqual(*other.svg_style_); |
| 490 } | 490 } |
| 491 | 491 |
| 492 // TODO(nainar): This fast path still remains. | |
| 492 bool ComputedStyle::InheritedDataShared(const ComputedStyle& other) const { | 493 bool ComputedStyle::InheritedDataShared(const ComputedStyle& other) const { |
| 493 // This is a fast check that only looks if the data structures are shared. | 494 // This is a fast check that only looks if the data structures are shared. |
| 494 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? | 495 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? |
| 495 return ComputedStyleBase::InheritedEqual(other) && | 496 return ComputedStyleBase::InheritedEqual(other) && |
| 496 style_inherited_data_.Get() == other.style_inherited_data_.Get() && | 497 style_inherited_data_.Get() == other.style_inherited_data_.Get() && |
| 497 svg_style_.Get() == other.svg_style_.Get() && | 498 svg_style_.Get() == other.svg_style_.Get() && |
| 498 rare_inherited_data_.Get() == other.rare_inherited_data_.Get(); | 499 rare_inherited_data_.Get() == other.rare_inherited_data_.Get(); |
| 499 } | 500 } |
| 500 | 501 |
| 501 static bool DependenceOnContentHeightHasChanged(const ComputedStyle& a, | 502 static bool DependenceOnContentHeightHasChanged(const ComputedStyle& a, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 573 |
| 573 return diff; | 574 return diff; |
| 574 } | 575 } |
| 575 | 576 |
| 576 bool ComputedStyle::ScrollAnchorDisablingPropertyChanged( | 577 bool ComputedStyle::ScrollAnchorDisablingPropertyChanged( |
| 577 const ComputedStyle& other, | 578 const ComputedStyle& other, |
| 578 const StyleDifference& diff) const { | 579 const StyleDifference& diff) const { |
| 579 if (GetPosition() != other.GetPosition()) | 580 if (GetPosition() != other.GetPosition()) |
| 580 return true; | 581 return true; |
| 581 | 582 |
| 582 if (box_.Get() != other.box_.Get()) { | 583 if (box_->Width() != other.box_->Width() || |
| 583 if (box_->Width() != other.box_->Width() || | 584 box_->MinWidth() != other.box_->MinWidth() || |
| 584 box_->MinWidth() != other.box_->MinWidth() || | 585 box_->MaxWidth() != other.box_->MaxWidth() || |
| 585 box_->MaxWidth() != other.box_->MaxWidth() || | 586 box_->Height() != other.box_->Height() || |
| 586 box_->Height() != other.box_->Height() || | 587 box_->MinHeight() != other.box_->MinHeight() || |
| 587 box_->MinHeight() != other.box_->MinHeight() || | 588 box_->MaxHeight() != other.box_->MaxHeight()) |
| 588 box_->MaxHeight() != other.box_->MaxHeight()) | 589 return true; |
| 589 return true; | |
| 590 } | |
| 591 | 590 |
| 592 if (surround_.Get() != other.surround_.Get()) { | 591 if (surround_->margin_ != other.surround_->margin_ || !OffsetEqual(other) || |
| 593 if (surround_->margin_ != other.surround_->margin_ || !OffsetEqual(other) || | 592 surround_->padding_ != other.surround_->padding_) |
| 594 surround_->padding_ != other.surround_->padding_) | 593 return true; |
| 595 return true; | |
| 596 } | |
| 597 | 594 |
| 598 if (diff.TransformChanged()) | 595 if (diff.TransformChanged()) |
| 599 return true; | 596 return true; |
| 600 | 597 |
| 601 return false; | 598 return false; |
| 602 } | 599 } |
| 603 | 600 |
| 604 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( | 601 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( |
| 605 const ComputedStyle& other) const { | 602 const ComputedStyle& other) const { |
| 606 // FIXME: Not all cases in this method need both full layout and paint | 603 // FIXME: Not all cases in this method need both full layout and paint |
| 607 // invalidation. | 604 // invalidation. |
| 608 // Should move cases into diffNeedsFullLayout() if | 605 // Should move cases into diffNeedsFullLayout() if |
| 609 // - don't need paint invalidation at all; | 606 // - don't need paint invalidation at all; |
| 610 // - or the layoutObject knows how to exactly invalidate paints caused by the | 607 // - or the layoutObject knows how to exactly invalidate paints caused by the |
| 611 // layout change instead of forced full paint invalidation. | 608 // layout change instead of forced full paint invalidation. |
| 612 | 609 |
| 613 if (surround_.Get() != other.surround_.Get()) { | 610 // If our border widths change, then we need to layout. Other changes to |
| 614 // If our border widths change, then we need to layout. Other changes to | 611 // borders only necessitate a paint invalidation. |
| 615 // borders only necessitate a paint invalidation. | 612 if (BorderLeftWidth() != other.BorderLeftWidth() || |
| 616 if (BorderLeftWidth() != other.BorderLeftWidth() || | 613 BorderTopWidth() != other.BorderTopWidth() || |
| 617 BorderTopWidth() != other.BorderTopWidth() || | 614 BorderBottomWidth() != other.BorderBottomWidth() || |
| 618 BorderBottomWidth() != other.BorderBottomWidth() || | 615 BorderRightWidth() != other.BorderRightWidth()) |
| 619 BorderRightWidth() != other.BorderRightWidth()) | 616 return true; |
| 620 return true; | |
| 621 | 617 |
| 622 if (surround_->padding_ != other.surround_->padding_) | 618 if (surround_->padding_ != other.surround_->padding_) |
| 623 return true; | 619 return true; |
| 620 | |
| 621 if (rare_non_inherited_data_->appearance_ != | |
| 622 other.rare_non_inherited_data_->appearance_ || | |
| 623 rare_non_inherited_data_->margin_before_collapse != | |
| 624 other.rare_non_inherited_data_->margin_before_collapse || | |
| 625 rare_non_inherited_data_->margin_after_collapse != | |
| 626 other.rare_non_inherited_data_->margin_after_collapse || | |
| 627 rare_non_inherited_data_->line_clamp != | |
| 628 other.rare_non_inherited_data_->line_clamp || | |
| 629 rare_non_inherited_data_->text_overflow != | |
| 630 other.rare_non_inherited_data_->text_overflow || | |
| 631 rare_non_inherited_data_->shape_margin_ != | |
| 632 other.rare_non_inherited_data_->shape_margin_ || | |
| 633 rare_non_inherited_data_->order_ != | |
| 634 other.rare_non_inherited_data_->order_ || | |
| 635 rare_non_inherited_data_->HasFilters() != | |
| 636 other.rare_non_inherited_data_->HasFilters()) | |
| 637 return true; | |
| 638 | |
| 639 if (rare_non_inherited_data_->grid_.Get() != | |
| 640 other.rare_non_inherited_data_->grid_.Get() && | |
| 641 *rare_non_inherited_data_->grid_.Get() != | |
| 642 *other.rare_non_inherited_data_->grid_.Get()) | |
| 643 return true; | |
| 644 | |
| 645 if (rare_non_inherited_data_->grid_item_.Get() != | |
| 646 other.rare_non_inherited_data_->grid_item_.Get() && | |
| 647 *rare_non_inherited_data_->grid_item_.Get() != | |
| 648 *other.rare_non_inherited_data_->grid_item_.Get()) | |
| 649 return true; | |
| 650 | |
| 651 if (rare_non_inherited_data_->deprecated_flexible_box_.Get() != | |
| 652 other.rare_non_inherited_data_->deprecated_flexible_box_.Get() && | |
| 653 *rare_non_inherited_data_->deprecated_flexible_box_.Get() != | |
| 654 *other.rare_non_inherited_data_->deprecated_flexible_box_.Get()) | |
| 655 return true; | |
| 656 | |
| 657 if (rare_non_inherited_data_->flexible_box_.Get() != | |
| 658 other.rare_non_inherited_data_->flexible_box_.Get() && | |
| 659 *rare_non_inherited_data_->flexible_box_.Get() != | |
| 660 *other.rare_non_inherited_data_->flexible_box_.Get()) | |
| 661 return true; | |
| 662 | |
| 663 if (rare_non_inherited_data_->multi_col_.Get() != | |
| 664 other.rare_non_inherited_data_->multi_col_.Get() && | |
| 665 *rare_non_inherited_data_->multi_col_.Get() != | |
| 666 *other.rare_non_inherited_data_->multi_col_.Get()) | |
| 667 return true; | |
| 668 | |
| 669 // If the counter directives change, trigger a relayout to re-calculate | |
| 670 // counter values and rebuild the counter node tree. | |
| 671 const CounterDirectiveMap* map_a = | |
| 672 rare_non_inherited_data_->counter_directives_.get(); | |
| 673 const CounterDirectiveMap* map_b = | |
| 674 other.rare_non_inherited_data_->counter_directives_.get(); | |
| 675 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) | |
| 676 return true; | |
| 677 | |
| 678 // We only need do layout for opacity changes if adding or losing opacity | |
| 679 // could trigger a change | |
| 680 // in us being a stacking context. | |
| 681 if (IsStackingContext() != other.IsStackingContext() && | |
| 682 rare_non_inherited_data_->HasOpacity() != | |
| 683 other.rare_non_inherited_data_->HasOpacity()) { | |
| 684 // FIXME: We would like to use SimplifiedLayout here, but we can't quite | |
| 685 // do that yet. We need to make sure SimplifiedLayout can operate | |
| 686 // correctly on LayoutInlines (we will need to add a | |
| 687 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | |
| 688 // every line). In addition we need to solve the floating object issue | |
| 689 // when layers come and go. Right now a full layout is necessary to keep | |
| 690 // floating object lists sane. | |
| 691 return true; | |
| 624 } | 692 } |
| 625 | 693 |
| 626 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 694 if (rare_inherited_data_->highlight != |
| 627 if (rare_non_inherited_data_->appearance_ != | 695 other.rare_inherited_data_->highlight || |
| 628 other.rare_non_inherited_data_->appearance_ || | 696 rare_inherited_data_->indent != other.rare_inherited_data_->indent || |
| 629 rare_non_inherited_data_->margin_before_collapse != | 697 rare_inherited_data_->text_align_last_ != |
| 630 other.rare_non_inherited_data_->margin_before_collapse || | 698 other.rare_inherited_data_->text_align_last_ || |
| 631 rare_non_inherited_data_->margin_after_collapse != | 699 rare_inherited_data_->text_indent_line_ != |
| 632 other.rare_non_inherited_data_->margin_after_collapse || | 700 other.rare_inherited_data_->text_indent_line_ || |
| 633 rare_non_inherited_data_->line_clamp != | 701 rare_inherited_data_->effective_zoom_ != |
| 634 other.rare_non_inherited_data_->line_clamp || | 702 other.rare_inherited_data_->effective_zoom_ || |
| 635 rare_non_inherited_data_->text_overflow != | 703 rare_inherited_data_->word_break != |
| 636 other.rare_non_inherited_data_->text_overflow || | 704 other.rare_inherited_data_->word_break || |
| 637 rare_non_inherited_data_->shape_margin_ != | 705 rare_inherited_data_->overflow_wrap != |
| 638 other.rare_non_inherited_data_->shape_margin_ || | 706 other.rare_inherited_data_->overflow_wrap || |
| 639 rare_non_inherited_data_->order_ != | 707 rare_inherited_data_->line_break != |
| 640 other.rare_non_inherited_data_->order_ || | 708 other.rare_inherited_data_->line_break || |
| 641 rare_non_inherited_data_->HasFilters() != | 709 rare_inherited_data_->text_security != |
| 642 other.rare_non_inherited_data_->HasFilters()) | 710 other.rare_inherited_data_->text_security || |
| 643 return true; | 711 rare_inherited_data_->hyphens != other.rare_inherited_data_->hyphens || |
| 712 rare_inherited_data_->hyphenation_limit_before != | |
| 713 other.rare_inherited_data_->hyphenation_limit_before || | |
| 714 rare_inherited_data_->hyphenation_limit_after != | |
| 715 other.rare_inherited_data_->hyphenation_limit_after || | |
| 716 rare_inherited_data_->hyphenation_string != | |
| 717 other.rare_inherited_data_->hyphenation_string || | |
| 718 rare_inherited_data_->respect_image_orientation_ != | |
| 719 other.rare_inherited_data_->respect_image_orientation_ || | |
| 720 rare_inherited_data_->ruby_position_ != | |
| 721 other.rare_inherited_data_->ruby_position_ || | |
| 722 rare_inherited_data_->text_emphasis_mark != | |
| 723 other.rare_inherited_data_->text_emphasis_mark || | |
| 724 rare_inherited_data_->text_emphasis_position != | |
| 725 other.rare_inherited_data_->text_emphasis_position || | |
| 726 rare_inherited_data_->text_emphasis_custom_mark != | |
| 727 other.rare_inherited_data_->text_emphasis_custom_mark || | |
| 728 rare_inherited_data_->text_justify_ != | |
| 729 other.rare_inherited_data_->text_justify_ || | |
| 730 rare_inherited_data_->text_orientation_ != | |
| 731 other.rare_inherited_data_->text_orientation_ || | |
| 732 rare_inherited_data_->text_combine_ != | |
| 733 other.rare_inherited_data_->text_combine_ || | |
| 734 rare_inherited_data_->tab_size_ != | |
| 735 other.rare_inherited_data_->tab_size_ || | |
| 736 rare_inherited_data_->text_size_adjust_ != | |
| 737 other.rare_inherited_data_->text_size_adjust_ || | |
| 738 rare_inherited_data_->list_style_image != | |
| 739 other.rare_inherited_data_->list_style_image || | |
| 740 rare_inherited_data_->line_height_step_ != | |
| 741 other.rare_inherited_data_->line_height_step_ || | |
| 742 rare_inherited_data_->text_stroke_width != | |
| 743 other.rare_inherited_data_->text_stroke_width) | |
| 744 return true; | |
| 644 | 745 |
| 645 if (rare_non_inherited_data_->grid_.Get() != | 746 if (!rare_inherited_data_->ShadowDataEquivalent( |
| 646 other.rare_non_inherited_data_->grid_.Get() && | 747 *other.rare_inherited_data_.Get())) |
| 647 *rare_non_inherited_data_->grid_.Get() != | 748 return true; |
| 648 *other.rare_non_inherited_data_->grid_.Get()) | |
| 649 return true; | |
| 650 | 749 |
| 651 if (rare_non_inherited_data_->grid_item_.Get() != | 750 if (!rare_inherited_data_->QuotesDataEquivalent( |
| 652 other.rare_non_inherited_data_->grid_item_.Get() && | 751 *other.rare_inherited_data_.Get())) |
| 653 *rare_non_inherited_data_->grid_item_.Get() != | 752 return true; |
| 654 *other.rare_non_inherited_data_->grid_item_.Get()) | |
| 655 return true; | |
| 656 | |
| 657 if (rare_non_inherited_data_->deprecated_flexible_box_.Get() != | |
| 658 other.rare_non_inherited_data_->deprecated_flexible_box_.Get() && | |
| 659 *rare_non_inherited_data_->deprecated_flexible_box_.Get() != | |
| 660 *other.rare_non_inherited_data_->deprecated_flexible_box_.Get()) | |
| 661 return true; | |
| 662 | |
| 663 if (rare_non_inherited_data_->flexible_box_.Get() != | |
| 664 other.rare_non_inherited_data_->flexible_box_.Get() && | |
| 665 *rare_non_inherited_data_->flexible_box_.Get() != | |
| 666 *other.rare_non_inherited_data_->flexible_box_.Get()) | |
| 667 return true; | |
| 668 | |
| 669 if (rare_non_inherited_data_->multi_col_.Get() != | |
| 670 other.rare_non_inherited_data_->multi_col_.Get() && | |
| 671 *rare_non_inherited_data_->multi_col_.Get() != | |
| 672 *other.rare_non_inherited_data_->multi_col_.Get()) | |
| 673 return true; | |
| 674 | |
| 675 // If the counter directives change, trigger a relayout to re-calculate | |
| 676 // counter values and rebuild the counter node tree. | |
| 677 const CounterDirectiveMap* map_a = | |
| 678 rare_non_inherited_data_->counter_directives_.get(); | |
| 679 const CounterDirectiveMap* map_b = | |
| 680 other.rare_non_inherited_data_->counter_directives_.get(); | |
| 681 if (!(map_a == map_b || (map_a && map_b && *map_a == *map_b))) | |
| 682 return true; | |
| 683 | |
| 684 // We only need do layout for opacity changes if adding or losing opacity | |
| 685 // could trigger a change | |
| 686 // in us being a stacking context. | |
| 687 if (IsStackingContext() != other.IsStackingContext() && | |
| 688 rare_non_inherited_data_->HasOpacity() != | |
| 689 other.rare_non_inherited_data_->HasOpacity()) { | |
| 690 // FIXME: We would like to use SimplifiedLayout here, but we can't quite | |
| 691 // do that yet. We need to make sure SimplifiedLayout can operate | |
| 692 // correctly on LayoutInlines (we will need to add a | |
| 693 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | |
| 694 // every line). In addition we need to solve the floating object issue | |
| 695 // when layers come and go. Right now a full layout is necessary to keep | |
| 696 // floating object lists sane. | |
| 697 return true; | |
| 698 } | |
| 699 } | |
| 700 | |
| 701 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { | |
| 702 if (rare_inherited_data_->highlight != | |
| 703 other.rare_inherited_data_->highlight || | |
| 704 rare_inherited_data_->indent != other.rare_inherited_data_->indent || | |
| 705 rare_inherited_data_->text_align_last_ != | |
| 706 other.rare_inherited_data_->text_align_last_ || | |
| 707 rare_inherited_data_->text_indent_line_ != | |
| 708 other.rare_inherited_data_->text_indent_line_ || | |
| 709 rare_inherited_data_->effective_zoom_ != | |
| 710 other.rare_inherited_data_->effective_zoom_ || | |
| 711 rare_inherited_data_->word_break != | |
| 712 other.rare_inherited_data_->word_break || | |
| 713 rare_inherited_data_->overflow_wrap != | |
| 714 other.rare_inherited_data_->overflow_wrap || | |
| 715 rare_inherited_data_->line_break != | |
| 716 other.rare_inherited_data_->line_break || | |
| 717 rare_inherited_data_->text_security != | |
| 718 other.rare_inherited_data_->text_security || | |
| 719 rare_inherited_data_->hyphens != other.rare_inherited_data_->hyphens || | |
| 720 rare_inherited_data_->hyphenation_limit_before != | |
| 721 other.rare_inherited_data_->hyphenation_limit_before || | |
| 722 rare_inherited_data_->hyphenation_limit_after != | |
| 723 other.rare_inherited_data_->hyphenation_limit_after || | |
| 724 rare_inherited_data_->hyphenation_string != | |
| 725 other.rare_inherited_data_->hyphenation_string || | |
| 726 rare_inherited_data_->respect_image_orientation_ != | |
| 727 other.rare_inherited_data_->respect_image_orientation_ || | |
| 728 rare_inherited_data_->ruby_position_ != | |
| 729 other.rare_inherited_data_->ruby_position_ || | |
| 730 rare_inherited_data_->text_emphasis_mark != | |
| 731 other.rare_inherited_data_->text_emphasis_mark || | |
| 732 rare_inherited_data_->text_emphasis_position != | |
| 733 other.rare_inherited_data_->text_emphasis_position || | |
| 734 rare_inherited_data_->text_emphasis_custom_mark != | |
| 735 other.rare_inherited_data_->text_emphasis_custom_mark || | |
| 736 rare_inherited_data_->text_justify_ != | |
| 737 other.rare_inherited_data_->text_justify_ || | |
| 738 rare_inherited_data_->text_orientation_ != | |
| 739 other.rare_inherited_data_->text_orientation_ || | |
| 740 rare_inherited_data_->text_combine_ != | |
| 741 other.rare_inherited_data_->text_combine_ || | |
| 742 rare_inherited_data_->tab_size_ != | |
| 743 other.rare_inherited_data_->tab_size_ || | |
| 744 rare_inherited_data_->text_size_adjust_ != | |
| 745 other.rare_inherited_data_->text_size_adjust_ || | |
| 746 rare_inherited_data_->list_style_image != | |
| 747 other.rare_inherited_data_->list_style_image || | |
| 748 rare_inherited_data_->line_height_step_ != | |
| 749 other.rare_inherited_data_->line_height_step_ || | |
| 750 rare_inherited_data_->text_stroke_width != | |
| 751 other.rare_inherited_data_->text_stroke_width) | |
| 752 return true; | |
| 753 | |
| 754 if (!rare_inherited_data_->ShadowDataEquivalent( | |
| 755 *other.rare_inherited_data_.Get())) | |
| 756 return true; | |
| 757 | |
| 758 if (!rare_inherited_data_->QuotesDataEquivalent( | |
| 759 *other.rare_inherited_data_.Get())) | |
| 760 return true; | |
| 761 } | |
| 762 | 753 |
| 763 if (style_inherited_data_->text_autosizing_multiplier != | 754 if (style_inherited_data_->text_autosizing_multiplier != |
| 764 other.style_inherited_data_->text_autosizing_multiplier) | 755 other.style_inherited_data_->text_autosizing_multiplier) |
| 765 return true; | 756 return true; |
| 766 | 757 |
| 767 if (style_inherited_data_->font.LoadingCustomFonts() != | 758 if (style_inherited_data_->font.LoadingCustomFonts() != |
| 768 other.style_inherited_data_->font.LoadingCustomFonts()) | 759 other.style_inherited_data_->font.LoadingCustomFonts()) |
| 769 return true; | 760 return true; |
| 770 | 761 |
| 771 if (style_inherited_data_.Get() != other.style_inherited_data_.Get()) { | 762 if (style_inherited_data_->line_height != |
| 772 if (style_inherited_data_->line_height != | 763 other.style_inherited_data_->line_height || |
| 773 other.style_inherited_data_->line_height || | 764 style_inherited_data_->font != other.style_inherited_data_->font || |
| 774 style_inherited_data_->font != other.style_inherited_data_->font || | 765 style_inherited_data_->horizontal_border_spacing != |
| 775 style_inherited_data_->horizontal_border_spacing != | 766 other.style_inherited_data_->horizontal_border_spacing || |
| 776 other.style_inherited_data_->horizontal_border_spacing || | 767 style_inherited_data_->vertical_border_spacing != |
| 777 style_inherited_data_->vertical_border_spacing != | 768 other.style_inherited_data_->vertical_border_spacing) |
| 778 other.style_inherited_data_->vertical_border_spacing) | 769 return true; |
| 779 return true; | |
| 780 } | |
| 781 | 770 |
| 782 if (BoxDirection() != other.BoxDirection() || | 771 if (BoxDirection() != other.BoxDirection() || |
| 783 RtlOrdering() != other.RtlOrdering() || | 772 RtlOrdering() != other.RtlOrdering() || |
| 784 GetTextAlign() != other.GetTextAlign() || | 773 GetTextAlign() != other.GetTextAlign() || |
| 785 TextTransform() != other.TextTransform() || | 774 TextTransform() != other.TextTransform() || |
| 786 Direction() != other.Direction() || WhiteSpace() != other.WhiteSpace() || | 775 Direction() != other.Direction() || WhiteSpace() != other.WhiteSpace() || |
| 787 GetWritingMode() != other.GetWritingMode()) | 776 GetWritingMode() != other.GetWritingMode()) |
| 788 return true; | 777 return true; |
| 789 | 778 |
| 790 if (OverflowX() != other.OverflowX() || OverflowY() != other.OverflowY() || | 779 if (OverflowX() != other.OverflowX() || OverflowY() != other.OverflowY() || |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 other.HasPseudoStyle(kPseudoIdScrollbar)) | 823 other.HasPseudoStyle(kPseudoIdScrollbar)) |
| 835 return true; | 824 return true; |
| 836 | 825 |
| 837 // Movement of non-static-positioned object is special cased in | 826 // Movement of non-static-positioned object is special cased in |
| 838 // ComputedStyle::visualInvalidationDiff(). | 827 // ComputedStyle::visualInvalidationDiff(). |
| 839 | 828 |
| 840 return false; | 829 return false; |
| 841 } | 830 } |
| 842 | 831 |
| 843 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { | 832 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { |
| 844 if (box_.Get() != other.box_.Get()) { | 833 if (box_->Width() != other.box_->Width() || |
| 845 if (box_->Width() != other.box_->Width() || | 834 box_->MinWidth() != other.box_->MinWidth() || |
| 846 box_->MinWidth() != other.box_->MinWidth() || | 835 box_->MaxWidth() != other.box_->MaxWidth() || |
| 847 box_->MaxWidth() != other.box_->MaxWidth() || | 836 box_->Height() != other.box_->Height() || |
| 848 box_->Height() != other.box_->Height() || | 837 box_->MinHeight() != other.box_->MinHeight() || |
| 849 box_->MinHeight() != other.box_->MinHeight() || | 838 box_->MaxHeight() != other.box_->MaxHeight()) |
| 850 box_->MaxHeight() != other.box_->MaxHeight()) | 839 return true; |
| 851 return true; | |
| 852 | 840 |
| 853 if (box_->VerticalAlign() != other.box_->VerticalAlign()) | 841 if (box_->VerticalAlign() != other.box_->VerticalAlign()) |
| 854 return true; | 842 return true; |
| 855 | 843 |
| 856 if (box_->BoxSizing() != other.box_->BoxSizing()) | 844 if (box_->BoxSizing() != other.box_->BoxSizing()) |
| 857 return true; | 845 return true; |
| 858 } | |
| 859 | 846 |
| 860 if (VerticalAlign() != other.VerticalAlign() || | 847 if (VerticalAlign() != other.VerticalAlign() || |
| 861 GetPosition() != other.GetPosition()) | 848 GetPosition() != other.GetPosition()) |
| 862 return true; | 849 return true; |
| 863 | 850 |
| 864 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 851 if (rare_non_inherited_data_->align_content_ != |
| 865 if (rare_non_inherited_data_->align_content_ != | 852 other.rare_non_inherited_data_->align_content_ || |
| 866 other.rare_non_inherited_data_->align_content_ || | 853 rare_non_inherited_data_->align_items_ != |
| 867 rare_non_inherited_data_->align_items_ != | 854 other.rare_non_inherited_data_->align_items_ || |
| 868 other.rare_non_inherited_data_->align_items_ || | 855 rare_non_inherited_data_->align_self_ != |
| 869 rare_non_inherited_data_->align_self_ != | 856 other.rare_non_inherited_data_->align_self_ || |
| 870 other.rare_non_inherited_data_->align_self_ || | 857 rare_non_inherited_data_->justify_content_ != |
| 871 rare_non_inherited_data_->justify_content_ != | 858 other.rare_non_inherited_data_->justify_content_ || |
| 872 other.rare_non_inherited_data_->justify_content_ || | 859 rare_non_inherited_data_->justify_items_ != |
| 873 rare_non_inherited_data_->justify_items_ != | 860 other.rare_non_inherited_data_->justify_items_ || |
| 874 other.rare_non_inherited_data_->justify_items_ || | 861 rare_non_inherited_data_->justify_self_ != |
| 875 rare_non_inherited_data_->justify_self_ != | 862 other.rare_non_inherited_data_->justify_self_ || |
| 876 other.rare_non_inherited_data_->justify_self_ || | 863 rare_non_inherited_data_->contain_ != |
| 877 rare_non_inherited_data_->contain_ != | 864 other.rare_non_inherited_data_->contain_) |
| 878 other.rare_non_inherited_data_->contain_) | 865 return true; |
| 879 return true; | |
| 880 } | |
| 881 | 866 |
| 882 return false; | 867 return false; |
| 883 } | 868 } |
| 884 | 869 |
| 885 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( | 870 bool ComputedStyle::DiffNeedsPaintInvalidationSubtree( |
| 886 const ComputedStyle& other) const { | 871 const ComputedStyle& other) const { |
| 887 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 872 if (rare_non_inherited_data_->effective_blend_mode_ != |
| 888 if (rare_non_inherited_data_->effective_blend_mode_ != | 873 other.rare_non_inherited_data_->effective_blend_mode_ || |
| 889 other.rare_non_inherited_data_->effective_blend_mode_ || | 874 rare_non_inherited_data_->isolation_ != |
| 890 rare_non_inherited_data_->isolation_ != | 875 other.rare_non_inherited_data_->isolation_) |
| 891 other.rare_non_inherited_data_->isolation_) | 876 return true; |
| 892 return true; | |
| 893 | 877 |
| 894 if (rare_non_inherited_data_->mask_ != | 878 if (rare_non_inherited_data_->mask_ != |
| 895 other.rare_non_inherited_data_->mask_ || | 879 other.rare_non_inherited_data_->mask_ || |
| 896 rare_non_inherited_data_->mask_box_image_ != | 880 rare_non_inherited_data_->mask_box_image_ != |
| 897 other.rare_non_inherited_data_->mask_box_image_) | 881 other.rare_non_inherited_data_->mask_box_image_) |
| 898 return true; | 882 return true; |
| 899 } | |
| 900 | 883 |
| 901 return false; | 884 return false; |
| 902 } | 885 } |
| 903 | 886 |
| 904 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 887 bool ComputedStyle::DiffNeedsPaintInvalidationObject( |
| 905 const ComputedStyle& other) const { | 888 const ComputedStyle& other) const { |
| 906 if (Visibility() != other.Visibility() || | 889 if (Visibility() != other.Visibility() || |
| 907 PrintColorAdjust() != other.PrintColorAdjust() || | 890 PrintColorAdjust() != other.PrintColorAdjust() || |
| 908 InsideLink() != other.InsideLink() || | 891 InsideLink() != other.InsideLink() || |
| 909 !surround_->border_.VisuallyEqual(other.surround_->border_) || | 892 !surround_->border_.VisuallyEqual(other.surround_->border_) || |
| 910 *background_ != *other.background_) | 893 (background_->Background() != other.background_->Background() && |
|
shend
2017/04/12 03:12:43
I think it's fine to keep this, since dereferencin
| |
| 894 background_->GetColor() != other.background_->GetColor())) | |
| 911 return true; | 895 return true; |
| 912 | 896 |
| 913 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { | 897 if (rare_inherited_data_->user_modify != |
| 914 if (rare_inherited_data_->user_modify != | 898 other.rare_inherited_data_->user_modify || |
| 915 other.rare_inherited_data_->user_modify || | 899 rare_inherited_data_->user_select != |
| 916 rare_inherited_data_->user_select != | 900 other.rare_inherited_data_->user_select || |
| 917 other.rare_inherited_data_->user_select || | 901 rare_inherited_data_->image_rendering_ != |
| 918 rare_inherited_data_->image_rendering_ != | 902 other.rare_inherited_data_->image_rendering_) |
| 919 other.rare_inherited_data_->image_rendering_) | 903 return true; |
| 920 return true; | |
| 921 } | |
| 922 | 904 |
| 923 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 905 if (rare_non_inherited_data_->user_drag != |
| 924 if (rare_non_inherited_data_->user_drag != | 906 other.rare_non_inherited_data_->user_drag || |
| 925 other.rare_non_inherited_data_->user_drag || | 907 rare_non_inherited_data_->object_fit_ != |
| 926 rare_non_inherited_data_->object_fit_ != | 908 other.rare_non_inherited_data_->object_fit_ || |
| 927 other.rare_non_inherited_data_->object_fit_ || | 909 rare_non_inherited_data_->object_position_ != |
| 928 rare_non_inherited_data_->object_position_ != | 910 other.rare_non_inherited_data_->object_position_ || |
| 929 other.rare_non_inherited_data_->object_position_ || | 911 !rare_non_inherited_data_->ShadowDataEquivalent( |
| 930 !rare_non_inherited_data_->ShadowDataEquivalent( | 912 *other.rare_non_inherited_data_.Get()) || |
| 931 *other.rare_non_inherited_data_.Get()) || | 913 !rare_non_inherited_data_->ShapeOutsideDataEquivalent( |
| 932 !rare_non_inherited_data_->ShapeOutsideDataEquivalent( | 914 *other.rare_non_inherited_data_.Get()) || |
| 933 *other.rare_non_inherited_data_.Get()) || | 915 !rare_non_inherited_data_->ClipPathDataEquivalent( |
| 934 !rare_non_inherited_data_->ClipPathDataEquivalent( | 916 *other.rare_non_inherited_data_.Get()) || |
| 935 *other.rare_non_inherited_data_.Get()) || | 917 !rare_non_inherited_data_->outline_.VisuallyEqual( |
| 936 !rare_non_inherited_data_->outline_.VisuallyEqual( | 918 other.rare_non_inherited_data_->outline_) || |
| 937 other.rare_non_inherited_data_->outline_) || | 919 (VisitedLinkBorderLeftColor() != other.VisitedLinkBorderLeftColor() && |
| 938 (VisitedLinkBorderLeftColor() != other.VisitedLinkBorderLeftColor() && | 920 BorderLeftWidth()) || |
| 939 BorderLeftWidth()) || | 921 (VisitedLinkBorderRightColor() != other.VisitedLinkBorderRightColor() && |
| 940 (VisitedLinkBorderRightColor() != other.VisitedLinkBorderRightColor() && | 922 BorderRightWidth()) || |
| 941 BorderRightWidth()) || | 923 (VisitedLinkBorderBottomColor() != other.VisitedLinkBorderBottomColor() && |
| 942 (VisitedLinkBorderBottomColor() != | 924 BorderBottomWidth()) || |
| 943 other.VisitedLinkBorderBottomColor() && | 925 (VisitedLinkBorderTopColor() != other.VisitedLinkBorderTopColor() && |
| 944 BorderBottomWidth()) || | 926 BorderTopWidth()) || |
| 945 (VisitedLinkBorderTopColor() != other.VisitedLinkBorderTopColor() && | 927 (VisitedLinkOutlineColor() != other.VisitedLinkOutlineColor() && |
| 946 BorderTopWidth()) || | 928 OutlineWidth()) || |
| 947 (VisitedLinkOutlineColor() != other.VisitedLinkOutlineColor() && | 929 (VisitedLinkBackgroundColor() != other.VisitedLinkBackgroundColor())) |
| 948 OutlineWidth()) || | 930 return true; |
| 949 (VisitedLinkBackgroundColor() != other.VisitedLinkBackgroundColor())) | |
| 950 return true; | |
| 951 } | |
| 952 | 931 |
| 953 if (Resize() != other.Resize()) | 932 if (Resize() != other.Resize()) |
| 954 return true; | 933 return true; |
| 955 | 934 |
| 956 if (rare_non_inherited_data_->paint_images_) { | 935 if (rare_non_inherited_data_->paint_images_) { |
| 957 for (const auto& image : *rare_non_inherited_data_->paint_images_) { | 936 for (const auto& image : *rare_non_inherited_data_->paint_images_) { |
| 958 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 937 if (DiffNeedsPaintInvalidationObjectForPaintImage(image, other)) |
| 959 return true; | 938 return true; |
| 960 } | 939 } |
| 961 } | 940 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1010 return false; | 989 return false; |
| 1011 } | 990 } |
| 1012 | 991 |
| 1013 void ComputedStyle::UpdatePropertySpecificDifferences( | 992 void ComputedStyle::UpdatePropertySpecificDifferences( |
| 1014 const ComputedStyle& other, | 993 const ComputedStyle& other, |
| 1015 StyleDifference& diff) const { | 994 StyleDifference& diff) const { |
| 1016 if (box_->ZIndex() != other.box_->ZIndex() || | 995 if (box_->ZIndex() != other.box_->ZIndex() || |
| 1017 IsStackingContext() != other.IsStackingContext()) | 996 IsStackingContext() != other.IsStackingContext()) |
| 1018 diff.SetZIndexChanged(); | 997 diff.SetZIndexChanged(); |
| 1019 | 998 |
| 1020 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 999 // It's possible for the old and new style transform data to be equivalent |
| 1021 // It's possible for the old and new style transform data to be equivalent | 1000 // while hasTransform() differs, as it checks a number of conditions aside |
| 1022 // while hasTransform() differs, as it checks a number of conditions aside | 1001 // from just the matrix, including but not limited to animation state. |
| 1023 // from just the matrix, including but not limited to animation state. | 1002 if (HasTransform() != other.HasTransform() || |
| 1024 if (HasTransform() != other.HasTransform() || | 1003 !TransformDataEquivalent(other) || |
| 1025 !TransformDataEquivalent(other) || | 1004 rare_non_inherited_data_->perspective_ != |
| 1026 rare_non_inherited_data_->perspective_ != | 1005 other.rare_non_inherited_data_->perspective_ || |
| 1027 other.rare_non_inherited_data_->perspective_ || | 1006 rare_non_inherited_data_->perspective_origin_ != |
| 1028 rare_non_inherited_data_->perspective_origin_ != | 1007 other.rare_non_inherited_data_->perspective_origin_) |
| 1029 other.rare_non_inherited_data_->perspective_origin_) | 1008 diff.SetTransformChanged(); |
| 1030 diff.SetTransformChanged(); | |
| 1031 | 1009 |
| 1032 if (rare_non_inherited_data_->opacity != | 1010 if (rare_non_inherited_data_->opacity != |
| 1033 other.rare_non_inherited_data_->opacity) | 1011 other.rare_non_inherited_data_->opacity) |
| 1034 diff.SetOpacityChanged(); | 1012 diff.SetOpacityChanged(); |
| 1035 | 1013 |
| 1036 if (rare_non_inherited_data_->filter_ != | 1014 if (rare_non_inherited_data_->filter_ != |
| 1037 other.rare_non_inherited_data_->filter_) | 1015 other.rare_non_inherited_data_->filter_) |
| 1038 diff.SetFilterChanged(); | 1016 diff.SetFilterChanged(); |
| 1039 | 1017 |
| 1040 if (!rare_non_inherited_data_->ShadowDataEquivalent( | 1018 if (!rare_non_inherited_data_->ShadowDataEquivalent( |
| 1041 *other.rare_non_inherited_data_.Get())) | 1019 *other.rare_non_inherited_data_.Get())) |
| 1042 diff.SetNeedsRecomputeOverflow(); | 1020 diff.SetNeedsRecomputeOverflow(); |
| 1043 | 1021 |
| 1044 if (rare_non_inherited_data_->backdrop_filter_ != | 1022 if (rare_non_inherited_data_->backdrop_filter_ != |
| 1045 other.rare_non_inherited_data_->backdrop_filter_) | 1023 other.rare_non_inherited_data_->backdrop_filter_) |
| 1046 diff.SetBackdropFilterChanged(); | 1024 diff.SetBackdropFilterChanged(); |
| 1047 | 1025 |
| 1048 if (!rare_non_inherited_data_->ReflectionDataEquivalent( | 1026 if (!rare_non_inherited_data_->ReflectionDataEquivalent( |
| 1049 *other.rare_non_inherited_data_.Get())) | 1027 *other.rare_non_inherited_data_.Get())) |
| 1050 diff.SetFilterChanged(); | 1028 diff.SetFilterChanged(); |
| 1051 | 1029 |
| 1052 if (!rare_non_inherited_data_->outline_.VisuallyEqual( | 1030 if (!rare_non_inherited_data_->outline_.VisuallyEqual( |
| 1053 other.rare_non_inherited_data_->outline_)) | 1031 other.rare_non_inherited_data_->outline_)) |
| 1054 diff.SetNeedsRecomputeOverflow(); | 1032 diff.SetNeedsRecomputeOverflow(); |
| 1055 } | |
| 1056 | 1033 |
| 1057 if (!surround_->border_.VisualOverflowEqual(other.surround_->border_)) | 1034 if (!surround_->border_.VisualOverflowEqual(other.surround_->border_)) |
| 1058 diff.SetNeedsRecomputeOverflow(); | 1035 diff.SetNeedsRecomputeOverflow(); |
| 1059 | 1036 |
| 1060 if (!diff.NeedsFullPaintInvalidation()) { | 1037 if (!diff.NeedsFullPaintInvalidation()) { |
| 1061 if (style_inherited_data_->color != other.style_inherited_data_->color || | 1038 if (style_inherited_data_->color != other.style_inherited_data_->color || |
| 1062 style_inherited_data_->visited_link_color != | 1039 style_inherited_data_->visited_link_color != |
| 1063 other.style_inherited_data_->visited_link_color || | 1040 other.style_inherited_data_->visited_link_color || |
| 1064 has_simple_underline_ != other.has_simple_underline_ || | 1041 has_simple_underline_ != other.has_simple_underline_ || |
| 1065 visual_->text_decoration != other.visual_->text_decoration) { | 1042 visual_->text_decoration != other.visual_->text_decoration) { |
| 1066 diff.SetTextDecorationOrColorChanged(); | 1043 diff.SetTextDecorationOrColorChanged(); |
| 1067 } else if (rare_non_inherited_data_.Get() != | 1044 } else if ((rare_non_inherited_data_->text_decoration_style_ != |
| 1068 other.rare_non_inherited_data_.Get() && | |
| 1069 (rare_non_inherited_data_->text_decoration_style_ != | |
| 1070 other.rare_non_inherited_data_->text_decoration_style_ || | 1045 other.rare_non_inherited_data_->text_decoration_style_ || |
| 1071 rare_non_inherited_data_->text_decoration_color_ != | 1046 rare_non_inherited_data_->text_decoration_color_ != |
| 1072 other.rare_non_inherited_data_->text_decoration_color_ || | 1047 other.rare_non_inherited_data_->text_decoration_color_ || |
| 1073 rare_non_inherited_data_->visited_link_text_decoration_color_ != | 1048 rare_non_inherited_data_->visited_link_text_decoration_color_ != |
| 1074 other.rare_non_inherited_data_ | 1049 other.rare_non_inherited_data_ |
| 1075 ->visited_link_text_decoration_color_)) { | 1050 ->visited_link_text_decoration_color_)) { |
| 1076 diff.SetTextDecorationOrColorChanged(); | 1051 diff.SetTextDecorationOrColorChanged(); |
| 1077 } else if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get() && | 1052 } else if ((rare_inherited_data_->TextFillColor() != |
| 1078 (rare_inherited_data_->TextFillColor() != | |
| 1079 other.rare_inherited_data_->TextFillColor() || | 1053 other.rare_inherited_data_->TextFillColor() || |
| 1080 rare_inherited_data_->TextStrokeColor() != | 1054 rare_inherited_data_->TextStrokeColor() != |
| 1081 other.rare_inherited_data_->TextStrokeColor() || | 1055 other.rare_inherited_data_->TextStrokeColor() || |
| 1082 rare_inherited_data_->TextEmphasisColor() != | 1056 rare_inherited_data_->TextEmphasisColor() != |
| 1083 other.rare_inherited_data_->TextEmphasisColor() || | 1057 other.rare_inherited_data_->TextEmphasisColor() || |
| 1084 rare_inherited_data_->VisitedLinkTextFillColor() != | 1058 rare_inherited_data_->VisitedLinkTextFillColor() != |
| 1085 other.rare_inherited_data_->VisitedLinkTextFillColor() || | 1059 other.rare_inherited_data_->VisitedLinkTextFillColor() || |
| 1086 rare_inherited_data_->VisitedLinkTextStrokeColor() != | 1060 rare_inherited_data_->VisitedLinkTextStrokeColor() != |
| 1087 other.rare_inherited_data_->VisitedLinkTextStrokeColor() || | 1061 other.rare_inherited_data_->VisitedLinkTextStrokeColor() || |
| 1088 rare_inherited_data_->VisitedLinkTextEmphasisColor() != | 1062 rare_inherited_data_->VisitedLinkTextEmphasisColor() != |
| (...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2504 if (value < 0) | 2478 if (value < 0) |
| 2505 fvalue -= 0.5f; | 2479 fvalue -= 0.5f; |
| 2506 else | 2480 else |
| 2507 fvalue += 0.5f; | 2481 fvalue += 0.5f; |
| 2508 } | 2482 } |
| 2509 | 2483 |
| 2510 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2484 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
| 2511 } | 2485 } |
| 2512 | 2486 |
| 2513 } // namespace blink | 2487 } // namespace blink |
| OLD | NEW |