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

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..a9b9186573173e1c0ae054cef247e0ec3ee0d488 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,46 @@ bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
if (resize() != other.resize())
return true;
+ const StyleImage* image = borderImage().image();
+ if (image && image->isPaintImage() && diffNeedsPaintInvalidationObjectForPaintImage(image, other))
+ return true;
+
+ const StyleImage* listImage = listStyleImage();
+ if (listImage && listImage->isPaintImage() && diffNeedsPaintInvalidationObjectForPaintImage(listImage, other))
+ return true;
+
+ for (const FillLayer* bgLayer = &m_background->background(); bgLayer; bgLayer = bgLayer->next()) {
+ if (bgLayer->image() && bgLayer->image()->isPaintImage() && diffNeedsPaintInvalidationObjectForPaintImage(bgLayer->image(), other))
+ return true;
+ }
+
+ for (const ContentData* data = contentData(); data; data = data->next()) {
+ if (data->isImage() && toImageContentData(data)->image()->isPaintImage() && diffNeedsPaintInvalidationObjectForPaintImage(toImageContentData(data)->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)
+ return true;
+ }
+
return false;
}

Powered by Google App Engine
This is Rietveld 408576698