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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/style/ComputedStyle.h" | 23 #include "core/style/ComputedStyle.h" |
| 24 | 24 |
| 25 #include "core/css/CSSPaintValue.h" | |
| 26 #include "core/css/CSSPropertyEquality.h" | |
| 25 #include "core/css/resolver/StyleResolver.h" | 27 #include "core/css/resolver/StyleResolver.h" |
| 26 #include "core/layout/LayoutTheme.h" | 28 #include "core/layout/LayoutTheme.h" |
| 27 #include "core/layout/TextAutosizer.h" | 29 #include "core/layout/TextAutosizer.h" |
| 28 #include "core/style/AppliedTextDecoration.h" | 30 #include "core/style/AppliedTextDecoration.h" |
| 29 #include "core/style/BorderEdge.h" | 31 #include "core/style/BorderEdge.h" |
| 30 #include "core/style/ContentData.h" | 32 #include "core/style/ContentData.h" |
| 31 #include "core/style/DataEquivalency.h" | 33 #include "core/style/DataEquivalency.h" |
| 32 #include "core/style/ComputedStyleConstants.h" | 34 #include "core/style/ComputedStyleConstants.h" |
| 33 #include "core/style/QuotesData.h" | 35 #include "core/style/QuotesData.h" |
| 34 #include "core/style/ShadowList.h" | 36 #include "core/style/ShadowList.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC olor() && borderBottomWidth()) | 754 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC olor() && borderBottomWidth()) |
| 753 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor() && borderTopWidth()) | 755 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor() && borderTopWidth()) |
| 754 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() && outlineWidth()) | 756 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() && outlineWidth()) |
| 755 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor ())) | 757 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor ())) |
| 756 return true; | 758 return true; |
| 757 } | 759 } |
| 758 | 760 |
| 759 if (resize() != other.resize()) | 761 if (resize() != other.resize()) |
| 760 return true; | 762 return true; |
| 761 | 763 |
| 764 for (const auto& image : paintImages()) { | |
| 765 if (diffNeedsPaintInvalidationObjectForPaintImage(image, other)) | |
| 766 return true; | |
| 767 } | |
| 768 | |
| 762 return false; | 769 return false; |
| 763 } | 770 } |
| 764 | 771 |
| 772 bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma ge* image, const ComputedStyle& other) const | |
| 773 { | |
| 774 CSSPaintValue* value = toCSSPaintValue(image->cssValue()); | |
| 775 | |
| 776 if (!value->nativeInvalidationProperties() || !value->customInvalidationProp erties()) | |
| 777 return true; | |
| 778 | |
| 779 for (CSSPropertyID propertyID : *value->nativeInvalidationProperties()) { | |
| 780 if (!CSSPropertyEquality::propertiesEqual(propertyID, *this, other)) | |
| 781 return true; | |
| 782 } | |
| 783 | |
| 784 for (const AtomicString& property : *value->customInvalidationProperties()) { | |
| 785 CSSVariableData* thisVar = variables() ? variables()->getVariable(proper ty) : nullptr; | |
| 786 CSSVariableData* otherVar = other.variables() ? other.variables()->getVa riable(property) : nullptr; | |
| 787 | |
| 788 if (thisVar == otherVar) | |
| 789 continue; | |
| 790 | |
| 791 if (!thisVar || !otherVar) | |
| 792 return true; | |
| 793 | |
| 794 if (thisVar->tokenRange().serialize() != otherVar->tokenRange().serializ e()) | |
|
rune
2016/04/29 08:06:37
Could you implement an operator==() on CSSTokenRan
ikilpatrick
2016/04/29 22:42:01
+timloh to see what he thinks.
Tim what do you th
Timothy Loh
2016/05/03 08:01:39
It should be used to in style diffing at the momen
| |
| 795 return true; | |
| 796 } | |
| 797 | |
| 798 return false; | |
| 799 } | |
| 800 | |
| 765 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const | 801 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const |
| 766 { | 802 { |
| 767 // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable . | 803 // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable . |
| 768 if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != ot her.m_box->hasAutoZIndex()) | 804 if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != ot her.m_box->hasAutoZIndex()) |
| 769 diff.setZIndexChanged(); | 805 diff.setZIndexChanged(); |
| 770 | 806 |
| 771 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 807 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
| 772 if (!transformDataEquivalent(other)) | 808 if (!transformDataEquivalent(other)) |
| 773 diff.setTransformChanged(); | 809 diff.setTransformChanged(); |
| 774 | 810 |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1803 if (!shadowList) | 1839 if (!shadowList) |
| 1804 return false; | 1840 return false; |
| 1805 for (size_t i = shadowList->shadows().size(); i--; ) { | 1841 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1806 if (shadowList->shadows()[i].color().isCurrentColor()) | 1842 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1807 return true; | 1843 return true; |
| 1808 } | 1844 } |
| 1809 return false; | 1845 return false; |
| 1810 } | 1846 } |
| 1811 | 1847 |
| 1812 } // namespace blink | 1848 } // namespace blink |
| OLD | NEW |