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 if (Vector<Persistent<StyleImage>>* paintImages = rareNonInheritedData->m_pa intImages.get()) { | |
esprehn
2016/05/09 21:59:54
you can just write
if (rareNonInheritedData->m_pa
ikilpatrick
2016/05/10 20:39:38
Done.
| |
765 for (const auto& image : *paintImages) { | |
766 if (diffNeedsPaintInvalidationObjectForPaintImage(image, other)) | |
767 return true; | |
768 } | |
769 } | |
770 | |
762 return false; | 771 return false; |
763 } | 772 } |
764 | 773 |
774 bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma ge* image, const ComputedStyle& other) const | |
775 { | |
776 CSSPaintValue* value = toCSSPaintValue(image->cssValue()); | |
777 | |
778 if (!value->nativeInvalidationProperties() || !value->customInvalidationProp erties()) | |
779 return true; | |
Timothy Loh
2016/05/09 07:07:07
I don't understand why this is true instead of fal
ikilpatrick
2016/05/10 20:39:38
Added note:
This is because at style-diff time th
| |
780 | |
781 for (CSSPropertyID propertyID : *value->nativeInvalidationProperties()) { | |
782 if (!CSSPropertyEquality::propertiesEqual(propertyID, *this, other)) | |
Timothy Loh
2016/05/09 07:07:07
For now, I think we should just return true if eit
esprehn
2016/05/09 21:59:54
Please add TODOs
ikilpatrick
2016/05/10 20:39:38
Tim, did you mean this check? Don't need isShortha
Timothy Loh
2016/05/11 06:20:37
looks fine
| |
783 return true; | |
784 } | |
785 | |
786 for (const AtomicString& property : *value->customInvalidationProperties()) { | |
787 CSSVariableData* thisVar = variables() ? variables()->getVariable(proper ty) : nullptr; | |
esprehn
2016/05/09 21:59:54
you can early out this before the loop too.
if (s
ikilpatrick
2016/05/10 20:39:38
Not strictly correct as you could have:
this->vari
| |
788 CSSVariableData* otherVar = other.variables() ? other.variables()->getVa riable(property) : nullptr; | |
789 | |
790 if (!dataEquivalent(thisVar, otherVar)) | |
791 return true; | |
792 } | |
793 | |
794 return false; | |
795 } | |
796 | |
765 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const | 797 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const |
766 { | 798 { |
767 // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable . | 799 // 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()) | 800 if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != ot her.m_box->hasAutoZIndex()) |
769 diff.setZIndexChanged(); | 801 diff.setZIndexChanged(); |
770 | 802 |
771 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 803 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
772 if (!transformDataEquivalent(other)) | 804 if (!transformDataEquivalent(other)) |
773 diff.setTransformChanged(); | 805 diff.setTransformChanged(); |
774 | 806 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 || rareInheritedData->visitedLinkTextFillColor() != other.rareIn heritedData->visitedLinkTextFillColor() | 841 || rareInheritedData->visitedLinkTextFillColor() != other.rareIn heritedData->visitedLinkTextFillColor() |
810 || rareInheritedData->visitedLinkTextStrokeColor() != other.rare InheritedData->visitedLinkTextStrokeColor() | 842 || rareInheritedData->visitedLinkTextStrokeColor() != other.rare InheritedData->visitedLinkTextStrokeColor() |
811 || rareInheritedData->visitedLinkTextEmphasisColor() != other.ra reInheritedData->visitedLinkTextEmphasisColor() | 843 || rareInheritedData->visitedLinkTextEmphasisColor() != other.ra reInheritedData->visitedLinkTextEmphasisColor() |
812 || rareInheritedData->textEmphasisFill != other.rareInheritedDat a->textEmphasisFill | 844 || rareInheritedData->textEmphasisFill != other.rareInheritedDat a->textEmphasisFill |
813 || rareInheritedData->appliedTextDecorations != other.rareInheri tedData->appliedTextDecorations)) { | 845 || rareInheritedData->appliedTextDecorations != other.rareInheri tedData->appliedTextDecorations)) { |
814 diff.setTextDecorationOrColorChanged(); | 846 diff.setTextDecorationOrColorChanged(); |
815 } | 847 } |
816 } | 848 } |
817 } | 849 } |
818 | 850 |
851 void ComputedStyle::addPaintImage(StyleImage* image) | |
852 { | |
853 if (!rareNonInheritedData.access()->m_paintImages) | |
854 rareNonInheritedData.access()->m_paintImages = adoptPtr(new Vector<Persi stent<StyleImage>>()); | |
855 rareNonInheritedData.access()->m_paintImages->append(image); | |
856 } | |
857 | |
819 void ComputedStyle::addCursor(StyleImage* image, bool hotSpotSpecified, const In tPoint& hotSpot) | 858 void ComputedStyle::addCursor(StyleImage* image, bool hotSpotSpecified, const In tPoint& hotSpot) |
820 { | 859 { |
821 if (!rareInheritedData.access()->cursorData) | 860 if (!rareInheritedData.access()->cursorData) |
822 rareInheritedData.access()->cursorData = new CursorList; | 861 rareInheritedData.access()->cursorData = new CursorList; |
823 rareInheritedData.access()->cursorData->append(CursorData(image, hotSpotSpec ified, hotSpot)); | 862 rareInheritedData.access()->cursorData->append(CursorData(image, hotSpotSpec ified, hotSpot)); |
824 } | 863 } |
825 | 864 |
826 void ComputedStyle::setCursorList(CursorList* other) | 865 void ComputedStyle::setCursorList(CursorList* other) |
827 { | 866 { |
828 rareInheritedData.access()->cursorData = other; | 867 rareInheritedData.access()->cursorData = other; |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1803 if (!shadowList) | 1842 if (!shadowList) |
1804 return false; | 1843 return false; |
1805 for (size_t i = shadowList->shadows().size(); i--; ) { | 1844 for (size_t i = shadowList->shadows().size(); i--; ) { |
1806 if (shadowList->shadows()[i].color().isCurrentColor()) | 1845 if (shadowList->shadows()[i].color().isCurrentColor()) |
1807 return true; | 1846 return true; |
1808 } | 1847 } |
1809 return false; | 1848 return false; |
1810 } | 1849 } |
1811 | 1850 |
1812 } // namespace blink | 1851 } // namespace blink |
OLD | NEW |