Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
index 9d79a3a211b8cac0767ae97c759398b000bf464b..d5acb0f12d122a1b926d1d29053d9aeedd29c17d 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
@@ -245,8 +245,19 @@ void PaintController::BeginShouldKeepAlive(const DisplayItemClient& client) { |
#endif |
void PaintController::ProcessNewItem(DisplayItem& display_item) { |
+#if DCHECK_IS_ON() |
DCHECK(!construction_disabled_); |
+ if (display_item.VisualRect() != display_item.Client().VisualRect()) { |
+ LOG(ERROR) << "Visual rect changed without invalidation: " |
+ << display_item.Client().DebugName() |
+ << " old=" << display_item.VisualRect().ToString() |
+ << " new=" << display_item.Client().VisualRect().ToString(); |
+ if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
+ NOTREACHED(); |
+ } |
+#endif |
+ |
#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
if (display_item.IsCacheable()) { |
BeginShouldKeepAlive(display_item.Client()); |
@@ -529,15 +540,6 @@ void PaintController::CopyCachedSubsequence(size_t begin_index, |
} |
} |
-DISABLE_CFI_PERF |
-static IntRect VisualRectForDisplayItem( |
- const DisplayItem& display_item, |
- const LayoutSize& offset_from_layout_object) { |
- LayoutRect visual_rect = display_item.Client().VisualRect(); |
- visual_rect.Move(-offset_from_layout_object); |
- return EnclosingIntRect(visual_rect); |
-} |
- |
void PaintController::ResetCurrentListIndices() { |
next_item_to_match_ = 0; |
next_item_to_index_ = 0; |
@@ -548,13 +550,13 @@ void PaintController::ResetCurrentListIndices() { |
} |
DISABLE_CFI_PERF |
-void PaintController::CommitNewDisplayItems( |
- const LayoutSize& offset_from_layout_object) { |
+void PaintController::CommitNewDisplayItems() { |
TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", |
"current_display_list_size", |
(int)current_paint_artifact_.GetDisplayItemList().size(), |
"num_non_cached_new_items", |
(int)new_display_item_list_.size() - num_cached_new_items_); |
+ |
num_cached_new_items_ = 0; |
// These data structures are used during painting only. |
DCHECK(!IsSkippingCache()); |
@@ -588,10 +590,6 @@ void PaintController::CommitNewDisplayItems( |
if (num_slow_paths <= kMaxNumberOfSlowPathsBeforeVeto) |
num_slow_paths += item.NumberOfSlowPaths(); |
- // TODO(wkorman): Only compute and append visual rect for drawings. |
- new_display_item_list_.AppendVisualRect( |
- VisualRectForDisplayItem(item, offset_from_layout_object)); |
- |
if (item.IsCacheable()) { |
item.Client().SetDisplayItemsCached(current_cache_generation_); |
} else { |
@@ -675,8 +673,7 @@ size_t PaintController::ApproximateUnsharedMemoryUsage() const { |
void PaintController::AppendDebugDrawingAfterCommit( |
const DisplayItemClient& display_item_client, |
- sk_sp<PaintRecord> record, |
- const LayoutSize& offset_from_layout_object) { |
+ sk_sp<PaintRecord> record) { |
DCHECK(new_display_item_list_.IsEmpty()); |
DrawingDisplayItem& display_item = |
current_paint_artifact_.GetDisplayItemList() |
@@ -684,9 +681,6 @@ void PaintController::AppendDebugDrawingAfterCommit( |
DisplayItem::kDebugDrawing, |
std::move(record)); |
display_item.SetSkippedCache(); |
- // TODO(wkorman): Only compute and append visual rect for drawings. |
- current_paint_artifact_.GetDisplayItemList().AppendVisualRect( |
- VisualRectForDisplayItem(display_item, offset_from_layout_object)); |
} |
void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) { |
@@ -800,13 +794,13 @@ void PaintController::GenerateRasterInvalidationsComparingChunks( |
moved_to_index >= new_chunk.end_index) { |
// The item has been moved into another chunk, so need to invalidate |
// it in the old chunk. |
- client_to_invalidate = |
- &new_display_item_list_[moved_to_index].Client(); |
+ const auto& new_item = new_display_item_list_[moved_to_index]; |
+ client_to_invalidate = &new_item.Client(); |
// And invalidate in the new chunk into which the item was moved. |
PaintChunk& moved_to_chunk = |
new_paint_chunks_.FindChunkByDisplayItemIndex(moved_to_index); |
AddRasterInvalidation(*client_to_invalidate, moved_to_chunk, |
- FloatRect(client_to_invalidate->VisualRect())); |
+ FloatRect(new_item.VisualRect())); |
} else if (moved_to_index < highest_moved_to_index) { |
// The item has been moved behind other cached items, so need to |
// invalidate the area that is probably exposed by the item moved |
@@ -823,10 +817,8 @@ void PaintController::GenerateRasterInvalidationsComparingChunks( |
if (client_to_invalidate && |
invalidated_clients_in_old_chunk.insert(client_to_invalidate) |
.is_new_entry) { |
- AddRasterInvalidation( |
- *client_to_invalidate, new_chunk, |
- FloatRect(current_paint_artifact_.GetDisplayItemList().VisualRect( |
- old_index))); |
+ AddRasterInvalidation(*client_to_invalidate, new_chunk, |
+ FloatRect(old_item.VisualRect())); |
} |
} |
@@ -838,7 +830,7 @@ void PaintController::GenerateRasterInvalidationsComparingChunks( |
invalidated_clients_in_new_chunk.insert(&new_item.Client()) |
.is_new_entry) { |
AddRasterInvalidation(new_item.Client(), new_chunk, |
- FloatRect(new_item.Client().VisualRect())); |
+ FloatRect(new_item.VisualRect())); |
} |
} |
} |