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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2107043002: Schedule cursor update on URL cursor image loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eae's review Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index c2580420c02f4c091e01ae0b105f340926273b41..4d57d3685eb65a00655bbb01586901599690f3e2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1893,6 +1893,7 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
updateImage(oldBoxReflectMaskImage, newBoxReflectMaskImage);
updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOutside());
+ updateCursorImages(oldStyle ? oldStyle->cursors() : nullptr, m_style->cursors());
bool doesNotNeedLayoutOrPaintInvalidation = !m_parent;
@@ -2117,6 +2118,20 @@ void LayoutObject::updateFillImages(const FillLayer* oldLayers, const FillLayer&
}
}
+void LayoutObject::updateCursorImages(const CursorList* oldCursors, const CursorList* newCursors)
+{
+ if (oldCursors && newCursors && *oldCursors == *newCursors)
+ return;
+
+ if (newCursors) {
+ for (const CursorData& cursorNew : *newCursors) {
+ if (cursorNew.image())
+ cursorNew.image()->addClient(this);
+ }
+ }
+ removeCursorImageClient(oldCursors);
+}
+
void LayoutObject::updateImage(StyleImage* oldImage, StyleImage* newImage)
{
if (oldImage != newImage) {
@@ -2646,6 +2661,7 @@ void LayoutObject::willBeDestroyed()
m_style->boxReflect()->mask().image()->removeClient(this);
removeShapeImageClient(m_style->shapeOutside());
+ removeCursorImageClient(m_style->cursors());
}
if (frameView())
@@ -2831,6 +2847,16 @@ void LayoutObject::removeShapeImageClient(ShapeValue* shapeValue)
shapeImage->removeClient(this);
}
+void LayoutObject::removeCursorImageClient(const CursorList* cursorList)
+{
+ if (!cursorList)
+ return;
+ for (const CursorData& cursor : *cursorList) {
+ if (cursor.image())
+ cursor.image()->removeClient(this);
+ }
+}
+
PositionWithAffinity LayoutObject::positionForPoint(const LayoutPoint&)
{
return createPositionWithAffinity(caretMinOffset());
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698