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

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

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 years, 9 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 | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698