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/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "base/gfx/bitmap_header.h" | 7 #include "base/gfx/bitmap_header.h" |
8 #include "base/gfx/platform_device_win.h" | 8 #include "base/gfx/platform_device_win.h" |
9 #include "base/scoped_handle.h" | 9 #include "base/scoped_handle.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 66 matching lines...) Loading... |
77 Send(new PluginHostMsg_CancelResource(route_id_, id)); | 77 Send(new PluginHostMsg_CancelResource(route_id_, id)); |
78 resource_clients_.erase(id); | 78 resource_clients_.erase(id); |
79 } | 79 } |
80 | 80 |
81 void WebPluginProxy::Invalidate() { | 81 void WebPluginProxy::Invalidate() { |
82 gfx::Rect rect(0, 0, delegate_->rect().width(), delegate_->rect().height()); | 82 gfx::Rect rect(0, 0, delegate_->rect().width(), delegate_->rect().height()); |
83 InvalidateRect(rect); | 83 InvalidateRect(rect); |
84 } | 84 } |
85 | 85 |
86 void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) { | 86 void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) { |
87 // Ignore NPN_InvalidateRect calls with empty rects. | 87 // Ignore NPN_InvalidateRect calls with empty rects. Also don't send an |
88 if (rect.IsEmpty()) | 88 // invalidate if it's outside the clipping region, since if we did it won't |
| 89 // lead to a paint and we'll be stuck waiting forever for a DidPaint response. |
| 90 if (rect.IsEmpty() || !delegate_->clip_rect().Intersects(rect)) |
89 return; | 91 return; |
90 | 92 |
91 damaged_rect_ = damaged_rect_.Union(rect); | 93 damaged_rect_ = damaged_rect_.Union(rect); |
92 // Only send a single InvalidateRect message at a time. From DidPaint we | 94 // Only send a single InvalidateRect message at a time. From DidPaint we |
93 // will dispatch an additional InvalidateRect message if necessary. | 95 // will dispatch an additional InvalidateRect message if necessary. |
94 if (!waiting_for_paint_) { | 96 if (!waiting_for_paint_) { |
95 waiting_for_paint_ = true; | 97 waiting_for_paint_ = true; |
96 // Paint to the plugin bitmap and let the renderer know so it can update | 98 // Paint to the plugin bitmap and let the renderer know so it can update |
97 // its backing store. | 99 // its backing store. |
98 Paint(damaged_rect_); | 100 Paint(damaged_rect_); |
(...skipping 267 matching lines...) Loading... |
366 void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, | 368 void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, |
367 const char* range_info, | 369 const char* range_info, |
368 void* existing_stream, | 370 void* existing_stream, |
369 bool notify_needed, | 371 bool notify_needed, |
370 HANDLE notify_data) { | 372 HANDLE notify_data) { |
371 | 373 |
372 Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, | 374 Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, |
373 range_info, existing_stream, | 375 range_info, existing_stream, |
374 notify_needed, notify_data)); | 376 notify_needed, notify_data)); |
375 } | 377 } |
OLD | NEW |