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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h

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/DisplayItemList.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
index aaf7a3954205f69c08ea938efb4e09b76df60ee7..0a48df379a67a535725ba2698636f1bf3f6dc8fb 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h
@@ -32,31 +32,26 @@
DisplayItemList(size_t initial_size_bytes)
: ContiguousContainer(kMaximumDisplayItemSize, initial_size_bytes) {}
DisplayItemList(DisplayItemList&& source)
- : ContiguousContainer(std::move(source)) {}
+ : ContiguousContainer(std::move(source)),
+ visual_rects_(std::move(source.visual_rects_)) {}
DisplayItemList& operator=(DisplayItemList&& source) {
ContiguousContainer::operator=(std::move(source));
+ visual_rects_ = std::move(source.visual_rects_);
return *this;
}
- DisplayItem& AppendByMoving(DisplayItem& item) {
-#ifndef NDEBUG
- String original_debug_string = item.AsDebugString();
-#endif
- DCHECK(item.HasValidClient());
- DisplayItem& result =
- ContiguousContainer::AppendByMoving(item, item.DerivedSize());
- // ContiguousContainer::AppendByMoving() calls an in-place constructor
- // on item which replaces it with a tombstone/"dead display item" that
- // can be safely destructed but should never be used.
- DCHECK(!item.HasValidClient());
-#ifndef NDEBUG
- // Save original debug string in the old item to help debugging.
- item.SetClientDebugString(original_debug_string);
-#endif
- item.visual_rect_ = result.visual_rect_;
- return result;
+ DisplayItem& AppendByMoving(DisplayItem&);
+
+ bool HasVisualRect(size_t index) const {
+ return index < visual_rects_.size();
}
+ IntRect VisualRect(size_t index) const {
+ DCHECK(HasVisualRect(index));
+ return visual_rects_[index];
+ }
+
+ void AppendVisualRect(const IntRect& visual_rect);
// Useful for iterating with a range-based for loop.
template <typename Iterator>
@@ -86,6 +81,9 @@
std::unique_ptr<JSONArray> SubsequenceAsJSON(size_t begin_index,
size_t end_index,
JsonFlags options) const;
+
+ private:
+ Vector<IntRect> visual_rects_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698