Index: third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp |
diff --git a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp |
index 0b39d3018136a2256f5fafb862ac38b3fd1ab156..44db5ddfe35051d3bc4974eec90ee0cb688767ef 100644 |
--- a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp |
+++ b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp |
@@ -34,6 +34,7 @@ |
#include "core/layout/api/LayoutBlockItem.h" |
#include "core/layout/api/LayoutItem.h" |
#include "core/layout/api/LayoutViewItem.h" |
+#include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h" |
#include "core/paint/ObjectPaintInvalidator.h" |
#include "core/paint/PaintInfo.h" |
#include "core/paint/PaintInvalidator.h" |
@@ -221,15 +222,23 @@ void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock( |
DCHECK(m_layoutBlock); |
LayoutRect newVisualRect; |
- if (!m_localRect.isEmpty()) { |
- newVisualRect = m_localRect; |
- context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); |
- |
- if (m_layoutBlock->usesCompositedScrolling()) { |
- // The caret should use scrolling coordinate space. |
- DCHECK(m_layoutBlock == context.paintInvalidationContainer); |
- newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); |
+#if DCHECK_IS_ON() |
+ FindVisualRectNeedingUpdateScope finder(*m_layoutBlock, context, m_visualRect, |
+ newVisualRect); |
+#endif |
+ if (context.needsVisualRectUpdate(*m_layoutBlock)) { |
+ if (!m_localRect.isEmpty()) { |
+ newVisualRect = m_localRect; |
+ context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); |
+ |
+ if (m_layoutBlock->usesCompositedScrolling()) { |
+ // The caret should use scrolling coordinate space. |
+ DCHECK(m_layoutBlock == context.paintInvalidationContainer); |
+ newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); |
+ } |
} |
+ } else { |
+ newVisualRect = m_visualRect; |
} |
if (m_layoutBlock == m_previousLayoutBlock) |