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

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

Issue 2286203004: Revert of Fix paint invalidation and painting for composited-scrolling input elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 c3e64a223da90e036e741bba2d716dd11e1dca2f..9781217137343403d52c8a7a8792b44c9c4e04f2 100644
--- a/third_party/WebKit/Source/core/editing/CaretBase.cpp
+++ b/third_party/WebKit/Source/core/editing/CaretBase.cpp
@@ -34,10 +34,7 @@
#include "core/layout/api/LayoutBlockItem.h"
#include "core/layout/api/LayoutItem.h"
#include "core/paint/PaintInfo.h"
-#include "core/paint/PaintLayer.h"
#include "platform/graphics/GraphicsContext.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/paint/DrawingRecorder.h"
namespace blink {
@@ -142,21 +139,13 @@
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.
void CaretBase::invalidateLocalCaretRect(Node* node, const LayoutRect& rect)
{
- LayoutBlock* caretLayoutBlock = caretLayoutObject(node);
- if (!caretLayoutBlock)
+ LayoutBlockItem caretPainter = LayoutBlockItem(caretLayoutObject(node));
+ if (!caretPainter)
return;
// FIXME: Need to over-paint 1 pixel to workaround some rounding problems.
@@ -164,10 +153,12 @@
LayoutRect inflatedRect = rect;
inflatedRect.inflate(LayoutUnit(1));
+ // FIXME: We should use mapLocalToAncestor() since we know we're not un-rooted.
+ mapCaretRectToCaretPainter(LayoutItem(node->layoutObject()), caretPainter, inflatedRect);
+
// FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
DisablePaintInvalidationStateAsserts disabler;
-
- node->layoutObject()->invalidatePaintRectangle(inflatedRect, displayItemClientForCaret(node));
+ caretPainter.invalidatePaintRectangle(inflatedRect);
}
bool CaretBase::shouldRepaintCaret(Node& node) const
@@ -201,12 +192,9 @@
}
}
-void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoint& paintOffset, DisplayItem::Type displayItemType) const
+void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoint& paintOffset) const
{
if (m_caretVisibility == CaretVisibility::Hidden)
- return;
-
- if (DrawingRecorder::useCachedDrawingIfPossible(context, *displayItemClientForCaret(node), displayItemType))
return;
LayoutRect drawingRect = localCaretRectWithoutUpdate();
@@ -225,8 +213,6 @@
if (element && element->layoutObject())
caretColor = element->layoutObject()->resolveColor(CSSPropertyColor);
- DrawingRecorder drawingRecorder(context, *displayItemClientForCaret(node), DisplayItem::Caret, FloatRect(drawingRect));
-
context.fillRect(FloatRect(drawingRect), caretColor);
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/CaretBase.h ('k') | third_party/WebKit/Source/core/editing/DragCaretController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698