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

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

Issue 2709693003: Repaint selection when element with ::selection style is recalculated. (Closed)
Patch Set: Created 3 years, 10 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/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 68baec2858e10ef18b15fd7e1892c1b891a5824f..1a67a0a4cace26d6a83e5f1f79085bbbd1c33244 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1712,6 +1712,8 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) {
else if (diff.needsPaintInvalidationObject() ||
updatedDiff.needsPaintInvalidationObject())
setShouldDoFullPaintInvalidation();
+ else if (diff.needsPaintInvalidationSelection())
+ invalidatePaintForSelection();
// Text nodes share style with their parents but the paint properties don't
// apply to them, hence the !isText() check.
@@ -3467,6 +3469,23 @@ LayoutRect LayoutObject::debugRect() const {
return rect;
}
+void LayoutObject::invalidatePaintForSelection() {
+ LayoutBlock* block =
+ isLayoutBlock() ? toLayoutBlock(this) : containingBlock();
mstensho (USE GERRIT) 2017/02/21 21:03:54 Even if you also explain it in the commit comment,
rune 2017/02/21 21:42:00 OK.
rune 2017/02/21 22:34:57 Done.
+ if (!block)
+ return;
+ if (!block->hasSelectedChildren())
+ return;
+ for (LayoutObject* child = slowFirstChild(); child;
mstensho (USE GERRIT) 2017/02/21 21:03:54 Likewise, I think it's worth mentioning right here
rune 2017/02/21 21:42:00 Acknowledged.
rune 2017/02/21 22:34:57 Done.
+ child = child->nextSibling()) {
+ if (!child->canBeSelectionLeaf())
+ continue;
+ if (child->getSelectionState() == SelectionNone)
+ continue;
+ child->setShouldInvalidateSelection();
+ }
+}
+
} // namespace blink
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698