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 reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 return true; | 528 return true; |
| 529 | 529 |
| 530 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon InheritedData->m_deprecatedFlexibleBox.get() | 530 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon InheritedData->m_deprecatedFlexibleBox.get() |
| 531 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra reNonInheritedData->m_deprecatedFlexibleBox.get()) | 531 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra reNonInheritedData->m_deprecatedFlexibleBox.get()) |
| 532 return true; | 532 return true; |
| 533 | 533 |
| 534 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD ata->m_flexibleBox.get() | 534 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD ata->m_flexibleBox.get() |
| 535 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher itedData->m_flexibleBox.get()) | 535 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher itedData->m_flexibleBox.get()) |
| 536 return true; | 536 return true; |
| 537 | 537 |
| 538 // FIXME: We should add an optimized form of layout that just recomputes visual overflow. | |
| 539 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD ata.get())) | |
| 540 return true; | |
| 541 | |
| 542 if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheri tedData.get())) | 538 if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheri tedData.get())) |
| 543 return true; | 539 return true; |
| 544 | 540 |
| 545 if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData ->m_multiCol.get() | 541 if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData ->m_multiCol.get() |
| 546 && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInherite dData->m_multiCol.get()) | 542 && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInherite dData->m_multiCol.get()) |
| 547 return true; | 543 return true; |
| 548 | 544 |
| 549 // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree. | 545 // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree. |
| 550 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti ves.get(); | 546 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti ves.get(); |
| 551 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD irectives.get(); | 547 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD irectives.get(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 return true; | 648 return true; |
| 653 } else if (noninherited_flags.effectiveDisplay == LIST_ITEM) { | 649 } else if (noninherited_flags.effectiveDisplay == LIST_ITEM) { |
| 654 if (inherited_flags._list_style_type != other.inherited_flags._list_styl e_type | 650 if (inherited_flags._list_style_type != other.inherited_flags._list_styl e_type |
| 655 || inherited_flags._list_style_position != other.inherited_flags._li st_style_position) | 651 || inherited_flags._list_style_position != other.inherited_flags._li st_style_position) |
| 656 return true; | 652 return true; |
| 657 } | 653 } |
| 658 | 654 |
| 659 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) | 655 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) |
| 660 return true; | 656 return true; |
| 661 | 657 |
| 662 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { | |
| 663 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it. | |
| 664 return true; | |
| 665 } | |
| 666 | |
| 667 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll bar)) | 658 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll bar)) |
| 668 return true; | 659 return true; |
| 669 | 660 |
| 670 // Movement of non-static-positioned object is special cased in ComputedStyl e::visualInvalidationDiff(). | 661 // Movement of non-static-positioned object is special cased in ComputedStyl e::visualInvalidationDiff(). |
| 671 | 662 |
| 672 return false; | 663 return false; |
| 673 } | 664 } |
| 674 | 665 |
| 675 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const | 666 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const |
| 676 { | 667 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask | 717 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask |
| 727 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedDat a->m_maskBoxImage) | 718 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedDat a->m_maskBoxImage) |
| 728 return true; | 719 return true; |
| 729 } | 720 } |
| 730 | 721 |
| 731 return false; | 722 return false; |
| 732 } | 723 } |
| 733 | 724 |
| 734 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other) const | 725 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other) const |
| 735 { | 726 { |
| 727 if (!m_background->outline().visuallyEqual(other.m_background->outline())) | |
| 728 return true; | |
|
Xianzhu
2016/03/22 17:02:05
We can avoid this check by adjusting visualOverflo
Xianzhu
2016/03/23 20:28:26
Please ignore this comment if you take the StyleDi
| |
| 736 if (inherited_flags._visibility != other.inherited_flags._visibility | 729 if (inherited_flags._visibility != other.inherited_flags._visibility |
| 737 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo lorAdjust | 730 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo lorAdjust |
| 738 || inherited_flags._insideLink != other.inherited_flags._insideLink | 731 || inherited_flags._insideLink != other.inherited_flags._insideLink |
| 739 || !surround->border.visuallyEqual(other.surround->border) | 732 || !surround->border.visuallyEqual(other.surround->border) |
| 740 || !m_background->visuallyEqual(*other.m_background)) | 733 || !m_background->visuallyEqual(*other.m_background)) |
| 741 return true; | 734 return true; |
| 742 | 735 |
| 743 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 736 if (rareInheritedData.get() != other.rareInheritedData.get()) { |
| 744 if (rareInheritedData->userModify != other.rareInheritedData->userModify | 737 if (rareInheritedData->userModify != other.rareInheritedData->userModify |
| 745 || rareInheritedData->userSelect != other.rareInheritedData->userSel ect | 738 || rareInheritedData->userSelect != other.rareInheritedData->userSel ect |
| 746 || rareInheritedData->m_imageRendering != other.rareInheritedData->m _imageRendering) | 739 || rareInheritedData->m_imageRendering != other.rareInheritedData->m _imageRendering) |
| 747 return true; | 740 return true; |
| 748 } | 741 } |
| 749 | 742 |
| 750 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 743 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
| 751 if (rareNonInheritedData->userDrag != other.rareNonInheritedData->userDr ag | 744 if (rareNonInheritedData->userDrag != other.rareNonInheritedData->userDr ag |
| 752 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData-> m_objectFit | 745 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData-> m_objectFit |
| 753 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedD ata->m_objectPosition | 746 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedD ata->m_objectPosition |
| 747 || !rareNonInheritedData->shadowDataEquivalent(*other.rareNonInherit edData.get()) | |
|
Xianzhu
2016/03/22 17:02:05
Ditto.
| |
| 754 || !rareNonInheritedData->shapeOutsideDataEquivalent(*other.rareNonI nheritedData.get()) | 748 || !rareNonInheritedData->shapeOutsideDataEquivalent(*other.rareNonI nheritedData.get()) |
| 755 || !rareNonInheritedData->clipPathDataEquivalent(*other.rareNonInher itedData.get()) | 749 || !rareNonInheritedData->clipPathDataEquivalent(*other.rareNonInher itedData.get()) |
| 756 || (visitedLinkBorderLeftColor() != other.visitedLinkBorderLeftColor () && borderLeftWidth()) | 750 || (visitedLinkBorderLeftColor() != other.visitedLinkBorderLeftColor () && borderLeftWidth()) |
| 757 || (visitedLinkBorderRightColor() != other.visitedLinkBorderRightCol or() && borderRightWidth()) | 751 || (visitedLinkBorderRightColor() != other.visitedLinkBorderRightCol or() && borderRightWidth()) |
| 758 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC olor() && borderBottomWidth()) | 752 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC olor() && borderBottomWidth()) |
| 759 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor() && borderTopWidth()) | 753 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor() && borderTopWidth()) |
| 760 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() && outlineWidth()) | 754 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() && outlineWidth()) |
| 761 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor ())) | 755 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor ())) |
| 762 return true; | 756 return true; |
| 763 } | 757 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 777 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 771 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
| 778 if (!transformDataEquivalent(other)) | 772 if (!transformDataEquivalent(other)) |
| 779 diff.setTransformChanged(); | 773 diff.setTransformChanged(); |
| 780 | 774 |
| 781 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity ) | 775 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity ) |
| 782 diff.setOpacityChanged(); | 776 diff.setOpacityChanged(); |
| 783 | 777 |
| 784 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt er) | 778 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt er) |
| 785 diff.setFilterChanged(); | 779 diff.setFilterChanged(); |
| 786 | 780 |
| 781 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD ata.get())) | |
| 782 diff.setVisualOverflowChanged(); | |
|
Xianzhu
2016/03/23 20:28:26
Move this to diffNeedsRecomputeOverflow() if you t
| |
| 783 | |
| 787 if (rareNonInheritedData->m_backdropFilter != other.rareNonInheritedData ->m_backdropFilter) | 784 if (rareNonInheritedData->m_backdropFilter != other.rareNonInheritedData ->m_backdropFilter) |
| 788 diff.setBackdropFilterChanged(); | 785 diff.setBackdropFilterChanged(); |
| 789 } | 786 } |
| 790 | 787 |
| 788 if (!m_background->outline().visuallyEqual(other.m_background->outline()) || !surround->border.visualOverflowEqual(other.surround->border)) | |
| 789 diff.setVisualOverflowChanged(); | |
|
Xianzhu
2016/03/23 20:28:26
Ditto.
| |
| 790 | |
| 791 if (!diff.needsPaintInvalidation()) { | 791 if (!diff.needsPaintInvalidation()) { |
| 792 if (inherited->color != other.inherited->color | 792 if (inherited->color != other.inherited->color |
| 793 || inherited->visitedLinkColor != other.inherited->visitedLinkColor | 793 || inherited->visitedLinkColor != other.inherited->visitedLinkColor |
| 794 || inherited_flags.m_textUnderline != other.inherited_flags.m_textUn derline | 794 || inherited_flags.m_textUnderline != other.inherited_flags.m_textUn derline |
| 795 || visual->textDecoration != other.visual->textDecoration) { | 795 || visual->textDecoration != other.visual->textDecoration) { |
| 796 diff.setTextDecorationOrColorChanged(); | 796 diff.setTextDecorationOrColorChanged(); |
| 797 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get( ) | 797 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get( ) |
| 798 && (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe ritedData->m_textDecorationStyle | 798 && (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe ritedData->m_textDecorationStyle |
| 799 || rareNonInheritedData->m_textDecorationColor != other.rareNonI nheritedData->m_textDecorationColor | 799 || rareNonInheritedData->m_textDecorationColor != other.rareNonI nheritedData->m_textDecorationColor |
| 800 || rareNonInheritedData->m_visitedLinkTextDecorationColor != oth er.rareNonInheritedData->m_visitedLinkTextDecorationColor)) { | 800 || rareNonInheritedData->m_visitedLinkTextDecorationColor != oth er.rareNonInheritedData->m_visitedLinkTextDecorationColor)) { |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1881 if (!shadowList) | 1881 if (!shadowList) |
| 1882 return false; | 1882 return false; |
| 1883 for (size_t i = shadowList->shadows().size(); i--; ) { | 1883 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1884 if (shadowList->shadows()[i].color().isCurrentColor()) | 1884 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1885 return true; | 1885 return true; |
| 1886 } | 1886 } |
| 1887 return false; | 1887 return false; |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 } // namespace blink | 1890 } // namespace blink |
| OLD | NEW |