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 "chrome/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
| 8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 // 1) Ensures that we call WebView::Paint without a bunch of other junk | 542 // 1) Ensures that we call WebView::Paint without a bunch of other junk |
| 543 // on the call stack. | 543 // on the call stack. |
| 544 // 2) Allows us to collect more damage rects before painting to help coalesce | 544 // 2) Allows us to collect more damage rects before painting to help coalesce |
| 545 // the work that we will need to do. | 545 // the work that we will need to do. |
| 546 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 546 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 547 this, &RenderWidget::DoDeferredPaint)); | 547 this, &RenderWidget::DoDeferredPaint)); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void RenderWidget::DidScrollRect(WebWidget* webwidget, int dx, int dy, | 550 void RenderWidget::DidScrollRect(WebWidget* webwidget, int dx, int dy, |
| 551 const gfx::Rect& clip_rect) { | 551 const gfx::Rect& clip_rect) { |
| 552 // We only support scrolling along one axis at a time. | 552 if (dx != 0 && dy != 0) { |
| 553 DCHECK((dx && !dy) || (!dx && dy)); | 553 // We only support scrolling along one axis at a time. |
|
darin (slow to review)
2009/02/26 22:15:44
this works by causing us to fall through to the sl
| |
| 554 DidScrollRect(webwidget, 0, dy, clip_rect); | |
| 555 dy = 0; | |
| 556 } | |
| 554 | 557 |
| 555 bool intersects_with_painting = paint_rect_.Intersects(clip_rect); | 558 bool intersects_with_painting = paint_rect_.Intersects(clip_rect); |
| 556 | 559 |
| 557 // If we already have a pending scroll operation or if this scroll operation | 560 // If we already have a pending scroll operation or if this scroll operation |
| 558 // intersects the existing paint region, then just failover to invalidating. | 561 // intersects the existing paint region, then just failover to invalidating. |
| 559 if (!scroll_rect_.IsEmpty() || intersects_with_painting) { | 562 if (!scroll_rect_.IsEmpty() || intersects_with_painting) { |
| 560 if (!intersects_with_painting && scroll_rect_ == clip_rect) { | 563 if (!intersects_with_painting && scroll_rect_ == clip_rect) { |
| 561 // OK, we can just update the scroll delta (requires same scrolling axis) | 564 // OK, we can just update the scroll delta (requires same scrolling axis) |
| 562 if (!dx && !scroll_delta_.x()) { | 565 if (!dx && !scroll_delta_.x()) { |
| 563 scroll_delta_.set_y(scroll_delta_.y() + dy); | 566 scroll_delta_.set_y(scroll_delta_.y() + dy); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 for (; i < plugin_window_moves_.size(); ++i) { | 807 for (; i < plugin_window_moves_.size(); ++i) { |
| 805 if (plugin_window_moves_[i].window == move.window) { | 808 if (plugin_window_moves_[i].window == move.window) { |
| 806 plugin_window_moves_[i] = move; | 809 plugin_window_moves_[i] = move; |
| 807 break; | 810 break; |
| 808 } | 811 } |
| 809 } | 812 } |
| 810 | 813 |
| 811 if (i == plugin_window_moves_.size()) | 814 if (i == plugin_window_moves_.size()) |
| 812 plugin_window_moves_.push_back(move); | 815 plugin_window_moves_.push_back(move); |
| 813 } | 816 } |
| OLD | NEW |