Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1896893004: Hook up style invalidation for CSS Paint API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@css-paint-register
Patch Set: fix component build. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 const StyleImage* image = borderImage().image();
ikilpatrick 2016/04/19 22:31:25 Should this block be if-guarded with: 1) if (Runti
rune 2016/04/27 11:34:34 Something like that. I would check the performance
ikilpatrick 2016/04/28 22:30:16 Changed this quite a bit now after chat with ellio
765 if (image && image->isPaintImage() && diffNeedsPaintInvalidationObjectForPai ntImage(image, other))
rune 2016/04/27 11:34:34 So the assumption here is that the image pointers
ikilpatrick 2016/04/28 22:30:16 Yup thats correct.
766 return true;
767
768 const StyleImage* listImage = listStyleImage();
769 if (listImage && listImage->isPaintImage() && diffNeedsPaintInvalidationObje ctForPaintImage(listImage, other))
770 return true;
771
772 for (const FillLayer* bgLayer = &m_background->background(); bgLayer; bgLaye r = bgLayer->next()) {
773 if (bgLayer->image() && bgLayer->image()->isPaintImage() && diffNeedsPai ntInvalidationObjectForPaintImage(bgLayer->image(), other))
774 return true;
775 }
776
777 for (const ContentData* data = contentData(); data; data = data->next()) {
778 if (data->isImage() && toImageContentData(data)->image()->isPaintImage() && diffNeedsPaintInvalidationObjectForPaintImage(toImageContentData(data)->imag e(), other))
779 return true;
780 }
781
762 return false; 782 return false;
763 } 783 }
764 784
785 bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma ge* image, const ComputedStyle& other) const
786 {
787 CSSPaintValue* value = toCSSPaintValue(image->cssValue());
788
789 for (CSSPropertyID propertyID : value->nativeInvalidationProperties()) {
790 if (!CSSPropertyEquality::propertiesEqual(propertyID, *this, other))
791 return true;
792 }
793
794 for (const AtomicString& property : value->customInvalidationProperties()) {
795 CSSVariableData* thisVar = variables() ? variables()->getVariable(proper ty) : nullptr;
796 CSSVariableData* otherVar = other.variables() ? other.variables()->getVa riable(property) : nullptr;
rune 2016/04/27 11:34:34 The variable is resolved at this point, I guess? (
ikilpatrick 2016/04/28 22:30:16 Yup, the variables are resolved with each other at
797 if (thisVar != otherVar)
rune 2016/04/27 11:34:34 A pointer comparison. Is that correct? If one of
ikilpatrick 2016/04/28 22:30:16 Oh, yeah completely not correct. Sorry about that.
798 return true;
799 }
800
801 return false;
802 }
803
765 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const 804 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const
766 { 805 {
767 // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable . 806 // 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()) 807 if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != ot her.m_box->hasAutoZIndex())
769 diff.setZIndexChanged(); 808 diff.setZIndexChanged();
770 809
771 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 810 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
772 if (!transformDataEquivalent(other)) 811 if (!transformDataEquivalent(other))
773 diff.setTransformChanged(); 812 diff.setTransformChanged();
774 813
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698