Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Side by Side Diff: chrome/renderer/render_widget.cc

Issue 3547008: Handle resize corner layout entirely in the platform BrowserWindow*/BrowserView* code... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/surface/transport_dib.h" 7 #include "app/surface/transport_dib.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DCHECK(opener_id != MSG_ROUTING_NONE); 96 DCHECK(opener_id != MSG_ROUTING_NONE);
97 scoped_refptr<RenderWidget> widget(new RenderWidget(render_thread, 97 scoped_refptr<RenderWidget> widget(new RenderWidget(render_thread,
98 popup_type)); 98 popup_type));
99 widget->Init(opener_id); // adds reference 99 widget->Init(opener_id); // adds reference
100 return widget; 100 return widget;
101 } 101 }
102 102
103 // static 103 // static
104 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { 104 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) {
105 switch (render_widget->popup_type_) { 105 switch (render_widget->popup_type_) {
106 case WebKit::WebPopupTypeNone: // Nothing to create. 106 case WebKit::WebPopupTypeNone: // Nothing to create.
107 break; 107 break;
108 case WebKit::WebPopupTypeSelect: 108 case WebKit::WebPopupTypeSelect:
109 case WebKit::WebPopupTypeSuggestion: 109 case WebKit::WebPopupTypeSuggestion:
110 return WebPopupMenu::create(render_widget); 110 return WebPopupMenu::create(render_widget);
111 default: 111 default:
112 NOTREACHED(); 112 NOTREACHED();
113 } 113 }
114 return NULL; 114 return NULL;
115 } 115 }
116 116
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Balances the AddRef taken when we called AddRoute. 227 // Balances the AddRef taken when we called AddRoute.
228 Release(); 228 Release();
229 } 229 }
230 230
231 void RenderWidget::OnResize(const gfx::Size& new_size, 231 void RenderWidget::OnResize(const gfx::Size& new_size,
232 const gfx::Rect& resizer_rect) { 232 const gfx::Rect& resizer_rect) {
233 // During shutdown we can just ignore this message. 233 // During shutdown we can just ignore this message.
234 if (!webwidget_) 234 if (!webwidget_)
235 return; 235 return;
236 236
237 // We shouldn't be asked to resize to our current size.
238 DCHECK(size_ != new_size || resizer_rect_ != resizer_rect);
239
237 // Remember the rect where the resize corner will be drawn. 240 // Remember the rect where the resize corner will be drawn.
238 resizer_rect_ = resizer_rect; 241 resizer_rect_ = resizer_rect;
239 242
243 if (size_ == new_size)
244 return;
245
240 // TODO(darin): We should not need to reset this here. 246 // TODO(darin): We should not need to reset this here.
241 SetHidden(false); 247 SetHidden(false);
242 needs_repainting_on_restore_ = false; 248 needs_repainting_on_restore_ = false;
243 249
244 // We shouldn't be asked to resize to our current size.
245 DCHECK(size_ != new_size);
246 size_ = new_size; 250 size_ = new_size;
247 251
248 // We should not be sent a Resize message if we have not ACK'd the previous 252 // We should not be sent a Resize message if we have not ACK'd the previous
249 DCHECK(!next_paint_is_resize_ack()); 253 DCHECK(!next_paint_is_resize_ack());
250 254
251 paint_aggregator_.ClearPendingUpdate(); 255 paint_aggregator_.ClearPendingUpdate();
252 256
253 // When resizing, we want to wait to paint before ACK'ing the resize. This 257 // When resizing, we want to wait to paint before ACK'ing the resize. This
254 // ensures that we only resize as fast as we can paint. We only need to send 258 // ensures that we only resize as fast as we can paint. We only need to send
255 // an ACK if we are resized to a non-empty rect. 259 // an ACK if we are resized to a non-empty rect.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 if (is_gpu_rendering_active_) { 572 if (is_gpu_rendering_active_) {
569 // If painting is done via the gpu process then we clear out all damage 573 // If painting is done via the gpu process then we clear out all damage
570 // rects to save the browser process from doing unecessary work. 574 // rects to save the browser process from doing unecessary work.
571 params.scroll_rect = gfx::Rect(); 575 params.scroll_rect = gfx::Rect();
572 params.copy_rects.clear(); 576 params.copy_rects.clear();
573 } else { 577 } else {
574 params.scroll_rect = update.scroll_rect; 578 params.scroll_rect = update.scroll_rect;
575 params.copy_rects.swap(copy_rects); // TODO(darin): clip to bounds? 579 params.copy_rects.swap(copy_rects); // TODO(darin): clip to bounds?
576 } 580 }
577 params.view_size = size_; 581 params.view_size = size_;
582 params.resizer_rect = resizer_rect_;
578 params.plugin_window_moves.swap(plugin_window_moves_); 583 params.plugin_window_moves.swap(plugin_window_moves_);
579 params.flags = next_paint_flags_; 584 params.flags = next_paint_flags_;
580 585
581 update_reply_pending_ = true; 586 update_reply_pending_ = true;
582 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); 587 Send(new ViewHostMsg_UpdateRect(routing_id_, params));
583 next_paint_flags_ = 0; 588 next_paint_flags_ = 0;
584 589
585 UpdateInputMethod(); 590 UpdateInputMethod();
586 591
587 // Let derived classes know we've painted. 592 // Let derived classes know we've painted.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 this, &RenderWidget::CallDoDeferredUpdate)); 669 this, &RenderWidget::CallDoDeferredUpdate));
665 } 670 }
666 671
667 void RenderWidget::scheduleComposite() { 672 void RenderWidget::scheduleComposite() {
668 // TODO(nduca): replace with something a little less hacky. The reason this 673 // TODO(nduca): replace with something a little less hacky. The reason this
669 // hack is still used is because the Invalidate-DoDeferredUpdate loop 674 // hack is still used is because the Invalidate-DoDeferredUpdate loop
670 // contains a lot of host-renderer synchronization logic that is still 675 // contains a lot of host-renderer synchronization logic that is still
671 // important for the accelerated compositing case. The option of simply 676 // important for the accelerated compositing case. The option of simply
672 // duplicating all that code is less desirable than "faking out" the 677 // duplicating all that code is less desirable than "faking out" the
673 // invalidation path using a magical damage rect. 678 // invalidation path using a magical damage rect.
674 didInvalidateRect(WebRect(0,0,1,1)); 679 didInvalidateRect(WebRect(0, 0, 1, 1));
675 } 680 }
676 681
677 void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) { 682 void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) {
678 // TODO(darin): Eliminate this temporary. 683 // TODO(darin): Eliminate this temporary.
679 WebCursor cursor(cursor_info); 684 WebCursor cursor(cursor_info);
680 685
681 // Only send a SetCursor message if we need to make a change. 686 // Only send a SetCursor message if we need to make a change.
682 if (!current_cursor_.IsEqual(cursor)) { 687 if (!current_cursor_.IsEqual(cursor)) {
683 current_cursor_ = cursor; 688 current_cursor_ = cursor;
684 Send(new ViewHostMsg_SetCursor(routing_id_, cursor)); 689 Send(new ViewHostMsg_SetCursor(routing_id_, cursor));
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1018
1014 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1019 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1015 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1020 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1016 i != plugin_window_moves_.end(); ++i) { 1021 i != plugin_window_moves_.end(); ++i) {
1017 if (i->window == window) { 1022 if (i->window == window) {
1018 plugin_window_moves_.erase(i); 1023 plugin_window_moves_.erase(i);
1019 break; 1024 break;
1020 } 1025 }
1021 } 1026 }
1022 } 1027 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698