| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/paint_aggregator.h" | 5 #include "content/renderer/paint_aggregator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 | 9 |
| 10 // ---------------------------------------------------------------------------- | 10 // ---------------------------------------------------------------------------- |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 void PaintAggregator::ScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { | 159 void PaintAggregator::ScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { |
| 160 // We only support scrolling along one axis at a time. | 160 // We only support scrolling along one axis at a time. |
| 161 if (dx != 0 && dy != 0) { | 161 if (dx != 0 && dy != 0) { |
| 162 InvalidateRect(clip_rect); | 162 InvalidateRect(clip_rect); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 // We can only scroll one rect at a time. | 166 // We can only scroll one rect at a time. |
| 167 if (!update_.scroll_rect.IsEmpty() && | 167 if (!update_.scroll_rect.IsEmpty() && update_.scroll_rect != clip_rect) { |
| 168 !update_.scroll_rect.Equals(clip_rect)) { | |
| 169 InvalidateRect(clip_rect); | 168 InvalidateRect(clip_rect); |
| 170 return; | 169 return; |
| 171 } | 170 } |
| 172 | 171 |
| 173 // Again, we only support scrolling along one axis at a time. Make sure this | 172 // Again, we only support scrolling along one axis at a time. Make sure this |
| 174 // update doesn't scroll on a different axis than any existing one. | 173 // update doesn't scroll on a different axis than any existing one. |
| 175 if ((dx && update_.scroll_delta.y()) || (dy && update_.scroll_delta.x())) { | 174 if ((dx && update_.scroll_delta.y()) || (dy && update_.scroll_delta.x())) { |
| 176 InvalidateRect(clip_rect); | 175 InvalidateRect(clip_rect); |
| 177 return; | 176 return; |
| 178 } | 177 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 inner = inner.Union(existing_rect); | 274 inner = inner.Union(existing_rect); |
| 276 } else { | 275 } else { |
| 277 outer = outer.Union(existing_rect); | 276 outer = outer.Union(existing_rect); |
| 278 } | 277 } |
| 279 } | 278 } |
| 280 update_.paint_rects.clear(); | 279 update_.paint_rects.clear(); |
| 281 update_.paint_rects.push_back(inner); | 280 update_.paint_rects.push_back(inner); |
| 282 update_.paint_rects.push_back(outer); | 281 update_.paint_rects.push_back(outer); |
| 283 } | 282 } |
| 284 } | 283 } |
| OLD | NEW |