Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved........... | 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/webwidget_host.h" | 5 #include "webkit/tools/test_shell/webwidget_host.h" |
| 6 | 6 |
| 7 #include "base/gfx/rect.h" | 7 #include "base/gfx/rect.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 paint_rect_ = paint_rect_.Union(scroll_rect_); | 135 paint_rect_ = paint_rect_.Union(scroll_rect_); |
| 136 ResetScrollRect(); | 136 ResetScrollRect(); |
| 137 } | 137 } |
| 138 paint_rect_ = paint_rect_.Union(damaged_rect); | 138 paint_rect_ = paint_rect_.Union(damaged_rect); |
| 139 | 139 |
| 140 RECT r = damaged_rect.ToRECT(); | 140 RECT r = damaged_rect.ToRECT(); |
| 141 InvalidateRect(view_, &r, FALSE); | 141 InvalidateRect(view_, &r, FALSE); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { | 144 void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { |
| 145 DCHECK(dx || dy); | 145 if (dx != 0 && dy != 0) { |
| 146 // We only support uni-directional scroll | |
|
darin (slow to review)
2009/02/26 22:15:44
ditto
| |
| 147 DidScrollRect(0, dy, clip_rect); | |
| 148 dy = 0; | |
| 149 } | |
| 146 | 150 |
| 147 // If we already have a pending scroll operation or if this scroll operation | 151 // If we already have a pending scroll operation or if this scroll operation |
| 148 // intersects the existing paint region, then just failover to invalidating. | 152 // intersects the existing paint region, then just failover to invalidating. |
| 149 if (!scroll_rect_.IsEmpty() || paint_rect_.Intersects(clip_rect)) { | 153 if (!scroll_rect_.IsEmpty() || paint_rect_.Intersects(clip_rect)) { |
| 150 paint_rect_ = paint_rect_.Union(scroll_rect_); | 154 paint_rect_ = paint_rect_.Union(scroll_rect_); |
| 151 ResetScrollRect(); | 155 ResetScrollRect(); |
| 152 paint_rect_ = paint_rect_.Union(clip_rect); | 156 paint_rect_ = paint_rect_.Union(clip_rect); |
| 153 } | 157 } |
| 154 | 158 |
| 155 // We will perform scrolling lazily, when requested to actually paint. | 159 // We will perform scrolling lazily, when requested to actually paint. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 344 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 341 #ifndef NDEBUG | 345 #ifndef NDEBUG |
| 342 DCHECK(!painting_); | 346 DCHECK(!painting_); |
| 343 #endif | 347 #endif |
| 344 DCHECK(canvas_.get()); | 348 DCHECK(canvas_.get()); |
| 345 | 349 |
| 346 set_painting(true); | 350 set_painting(true); |
| 347 webwidget_->Paint(canvas_.get(), rect); | 351 webwidget_->Paint(canvas_.get(), rect); |
| 348 set_painting(false); | 352 set_painting(false); |
| 349 } | 353 } |
| OLD | NEW |