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

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: . 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..df3878a4bcc5d2583f007ea06197ef6ac78a41ae 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,40 @@ bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
if (resize() != other.resize())
return true;
+ 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;
+
+ for (CSSPropertyID propertyID : *value->nativeInvalidationProperties()) {
+ if (!CSSPropertyEquality::propertiesEqual(propertyID, *this, other))
+ return true;
+ }
+
+ for (const AtomicString& property : *value->customInvalidationProperties()) {
+ CSSVariableData* thisVar = variables() ? variables()->getVariable(property) : nullptr;
+ CSSVariableData* otherVar = other.variables() ? other.variables()->getVariable(property) : nullptr;
+
+ if (thisVar == otherVar)
+ continue;
+
+ if (!thisVar || !otherVar)
+ return true;
+
+ if (thisVar->tokenRange().serialize() != otherVar->tokenRange().serialize())
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
+ return true;
+ }
+
return false;
}

Powered by Google App Engine
This is Rietveld 408576698