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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 2899793002: Revert of Don't access DisplayItemClient::VisualRect() for cached display items. (Closed)
Patch Set: Created 3 years, 7 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/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 d5acb0f12d122a1b926d1d29053d9aeedd29c17d..9d79a3a211b8cac0767ae97c759398b000bf464b 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -245,18 +245,7 @@
#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()) {
@@ -540,6 +529,15 @@
}
}
+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;
@@ -550,13 +548,13 @@
}
DISABLE_CFI_PERF
-void PaintController::CommitNewDisplayItems() {
+void PaintController::CommitNewDisplayItems(
+ const LayoutSize& offset_from_layout_object) {
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());
@@ -589,6 +587,10 @@
// No reason to continue the analysis once we have a veto.
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_);
@@ -673,7 +675,8 @@
void PaintController::AppendDebugDrawingAfterCommit(
const DisplayItemClient& display_item_client,
- sk_sp<PaintRecord> record) {
+ sk_sp<PaintRecord> record,
+ const LayoutSize& offset_from_layout_object) {
DCHECK(new_display_item_list_.IsEmpty());
DrawingDisplayItem& display_item =
current_paint_artifact_.GetDisplayItemList()
@@ -681,6 +684,9 @@
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) {
@@ -794,13 +800,13 @@
moved_to_index >= new_chunk.end_index) {
// The item has been moved into another chunk, so need to invalidate
// it in the old chunk.
- const auto& new_item = new_display_item_list_[moved_to_index];
- client_to_invalidate = &new_item.Client();
+ client_to_invalidate =
+ &new_display_item_list_[moved_to_index].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(new_item.VisualRect()));
+ FloatRect(client_to_invalidate->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
@@ -817,8 +823,10 @@
if (client_to_invalidate &&
invalidated_clients_in_old_chunk.insert(client_to_invalidate)
.is_new_entry) {
- AddRasterInvalidation(*client_to_invalidate, new_chunk,
- FloatRect(old_item.VisualRect()));
+ AddRasterInvalidation(
+ *client_to_invalidate, new_chunk,
+ FloatRect(current_paint_artifact_.GetDisplayItemList().VisualRect(
+ old_index)));
}
}
@@ -830,7 +838,7 @@
invalidated_clients_in_new_chunk.insert(&new_item.Client())
.is_new_entry) {
AddRasterInvalidation(new_item.Client(), new_chunk,
- FloatRect(new_item.VisualRect()));
+ FloatRect(new_item.Client().VisualRect()));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698