summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc')
-rw-r--r--chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc34
1 files changed, 29 insertions, 5 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc b/chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc
index c5926d2f284..2b14e465929 100644
--- a/chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc
+++ b/chromium/third_party/blink/renderer/platform/graphics/paint/paint_chunk.cc
@@ -10,13 +10,13 @@
namespace blink {
struct SameSizeAsPaintChunk {
- size_t begin_index;
- size_t end_index;
+ wtf_size_t begin_index;
+ wtf_size_t end_index;
PaintChunk::Id id;
PropertyTreeState properties;
- FloatRect bounds;
+ IntRect bounds;
+ IntRect drawable_bounds;
float outset_for_raster_effects;
- SkColor safe_opaque_background_color;
unsigned bools; // known_to_be_opaque, is_cacheable, client_is_just_created
void* pointers[1]; // hit_test_data
};
@@ -24,10 +24,34 @@ struct SameSizeAsPaintChunk {
static_assert(sizeof(PaintChunk) == sizeof(SameSizeAsPaintChunk),
"PaintChunk should stay small");
+bool PaintChunk::EqualsForUnderInvalidationChecking(
+ const PaintChunk& other) const {
+ return size() == other.size() && id == other.id &&
+ properties == other.properties && bounds == other.bounds &&
+ drawable_bounds == other.drawable_bounds &&
+ outset_for_raster_effects == other.outset_for_raster_effects &&
+ ((!hit_test_data && !other.hit_test_data) ||
+ (hit_test_data && other.hit_test_data &&
+ *hit_test_data == *other.hit_test_data));
+ // known_to_be_opaque is not checked because it's updated when we create the
+ // next chunk or release chunks. We ensure its correctness with unit tests and
+ // under-invalidation checking of display items.
+}
+
+size_t PaintChunk::MemoryUsageInBytes() const {
+ size_t total_size = sizeof(*this);
+ if (hit_test_data) {
+ total_size += sizeof(*hit_test_data);
+ total_size +=
+ hit_test_data->touch_action_rects.capacity() * sizeof(TouchActionRect);
+ }
+ return total_size;
+}
+
String PaintChunk::ToString() const {
StringBuilder sb;
sb.AppendFormat(
- "PaintChunk(begin=%zu, end=%zu, id=%s cacheable=%d props=(%s) bounds=%s "
+ "PaintChunk(begin=%u, end=%u, id=%s cacheable=%d props=(%s) bounds=%s "
"known_to_be_opaque=%d",
begin_index, end_index, id.ToString().Utf8().c_str(), is_cacheable,
properties.ToString().Utf8().c_str(), bounds.ToString().Utf8().c_str(),