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

Unified 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: Redo CSSParserToken::operator==() 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index f1f26471f33d4eab5c6e9dcd5a0c5bce22aa2edd..5c613ad05030ce7230e00581bc8a5f4be3087dbb 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -22,6 +22,8 @@
#include "core/style/ComputedStyle.h"
+#include "core/css/CSSPaintValue.h"
+#include "core/css/CSSPropertyEquality.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/layout/LayoutTheme.h"
#include "core/layout/TextAutosizer.h"
@@ -759,6 +761,36 @@ bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
if (resize() != other.resize())
return true;
+ if (Vector<Persistent<StyleImage>>* paintImages = rareNonInheritedData->m_paintImages.get()) {
esprehn 2016/05/09 21:59:54 you can just write if (rareNonInheritedData->m_pa
ikilpatrick 2016/05/10 20:39:38 Done.
+ for (const auto& image : *paintImages) {
+ if (diffNeedsPaintInvalidationObjectForPaintImage(image, other))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleImage* image, const ComputedStyle& other) const
+{
+ CSSPaintValue* value = toCSSPaintValue(image->cssValue());
+
+ if (!value->nativeInvalidationProperties() || !value->customInvalidationProperties())
+ 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
+
+ for (CSSPropertyID propertyID : *value->nativeInvalidationProperties()) {
+ 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
+ return true;
+ }
+
+ for (const AtomicString& property : *value->customInvalidationProperties()) {
+ CSSVariableData* thisVar = variables() ? variables()->getVariable(property) : 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
+ CSSVariableData* otherVar = other.variables() ? other.variables()->getVariable(property) : nullptr;
+
+ if (!dataEquivalent(thisVar, otherVar))
+ return true;
+ }
+
return false;
}
@@ -816,6 +848,13 @@ void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other
}
}
+void ComputedStyle::addPaintImage(StyleImage* image)
+{
+ if (!rareNonInheritedData.access()->m_paintImages)
+ rareNonInheritedData.access()->m_paintImages = adoptPtr(new Vector<Persistent<StyleImage>>());
+ rareNonInheritedData.access()->m_paintImages->append(image);
+}
+
void ComputedStyle::addCursor(StyleImage* image, bool hotSpotSpecified, const IntPoint& hotSpot)
{
if (!rareInheritedData.access()->cursorData)

Powered by Google App Engine
This is Rietveld 408576698