Index: cc/surfaces/surface_aggregator.cc |
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc |
index 819ab63b0447b0c5f1d7fb58011479f970c53560..2beb8043e2b970c1eeb812622415e948c0732a97 100644 |
--- a/cc/surfaces/surface_aggregator.cc |
+++ b/cc/surfaces/surface_aggregator.cc |
@@ -153,14 +153,22 @@ gfx::Rect SurfaceAggregator::DamageRectForSurface( |
const RenderPass& source, |
const gfx::Rect& full_rect) const { |
auto it = previous_contained_surfaces_.find(surface->surface_id()); |
- if (it == previous_contained_surfaces_.end()) |
- return full_rect; |
+ if (it != previous_contained_surfaces_.end()) { |
+ int previous_index = it->second; |
+ if (previous_index == surface->frame_index()) |
+ return gfx::Rect(); |
+ } |
+ SurfaceId previous_surface_id = surface->previous_frame_surface_id(); |
+ |
+ if (surface->surface_id() != previous_surface_id) { |
+ it = previous_contained_surfaces_.find(previous_surface_id); |
+ } |
+ if (it != previous_contained_surfaces_.end()) { |
+ int previous_index = it->second; |
+ if (previous_index == surface->frame_index() - 1) |
+ return source.damage_rect; |
+ } |
- int previous_index = it->second; |
- if (previous_index == surface->frame_index()) |
- return gfx::Rect(); |
- if (previous_index == surface->frame_index() - 1) |
- return source.damage_rect; |
return full_rect; |
} |