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

Unified Diff: third_party/WebKit/Source/core/editing/CaretBase.cpp

Issue 2296203002: Make CaretBase a DisplayItemClient. (Closed)
Patch Set: Created 4 years, 4 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/editing/CaretBase.cpp
diff --git a/third_party/WebKit/Source/core/editing/CaretBase.cpp b/third_party/WebKit/Source/core/editing/CaretBase.cpp
index ac6c1529f8bcfc7c1672378857a83bd5ab5b6710..9a470a0b2d67df7b23184f4bfa7a0ff9bde3fa97 100644
--- a/third_party/WebKit/Source/core/editing/CaretBase.cpp
+++ b/third_party/WebKit/Source/core/editing/CaretBase.cpp
@@ -142,14 +142,6 @@ IntRect CaretBase::absoluteBoundsForLocalRect(Node* node, const LayoutRect& rect
return caretPainter->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox();
}
-DisplayItemClient* CaretBase::displayItemClientForCaret(Node* node)
-{
- LayoutBlock* caretLayoutBlock = caretLayoutObject(node);
- if (caretLayoutBlock->usesCompositedScrolling())
- return static_cast<DisplayItemClient*>(caretLayoutBlock->layer()->graphicsLayerBackingForScrolling());
- return caretLayoutBlock;
-}
-
// TODO(yoichio): |node| is FrameSelection::m_previousCaretNode and this is bad
// design. We should use only previous layoutObject or Rectangle to invalidate
// old caret.
@@ -167,7 +159,7 @@ void CaretBase::invalidateLocalCaretRect(Node* node, const LayoutRect& rect)
// FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
DisablePaintInvalidationStateAsserts disabler;
- node->layoutObject()->invalidatePaintRectangle(inflatedRect, displayItemClientForCaret(node));
+ m_visualRect = node->layoutObject()->invalidatePaintRectangle(inflatedRect, this);
}
bool CaretBase::shouldRepaintCaret(Node& node) const
@@ -206,7 +198,7 @@ void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoi
if (m_caretVisibility == CaretVisibility::Hidden)
return;
- if (DrawingRecorder::useCachedDrawingIfPossible(context, *displayItemClientForCaret(node), displayItemType))
+ if (DrawingRecorder::useCachedDrawingIfPossible(context, *this, displayItemType))
return;
LayoutRect drawingRect = localCaretRectWithoutUpdate();
@@ -225,7 +217,7 @@ void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoi
if (element && element->layoutObject())
caretColor = element->layoutObject()->resolveColor(CSSPropertyColor);
- DrawingRecorder drawingRecorder(context, *displayItemClientForCaret(node), DisplayItem::kCaret, FloatRect(drawingRect));
+ DrawingRecorder drawingRecorder(context, *this, DisplayItem::kCaret, FloatRect(drawingRect));
context.fillRect(FloatRect(drawingRect), caretColor);
}
@@ -235,4 +227,14 @@ void CaretBase::setCaretVisibility(CaretVisibility visibility)
m_caretVisibility = visibility;
}
+String CaretBase::debugName() const
+{
+ return "Caret";
+}
+
+LayoutRect CaretBase::visualRect() const
+{
+ return m_visualRect;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/CaretBase.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698