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

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

Issue 42495: A tricky fix for Issue 1845 (Take 2).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months 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
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | webkit/glue/webtextdirection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "chrome/common/transport_dib.h" 14 #include "chrome/common/transport_dib.h"
15 #include "chrome/renderer/render_process.h" 15 #include "chrome/renderer/render_process.h"
16 #include "skia/ext/platform_canvas.h" 16 #include "skia/ext/platform_canvas.h"
17 17
18 #if defined(OS_POSIX) 18 #if defined(OS_POSIX)
19 #include "skia/include/SkPixelRef.h" 19 #include "skia/include/SkPixelRef.h"
20 #include "skia/include/SkMallocPixelRef.h" 20 #include "skia/include/SkMallocPixelRef.h"
21 #endif // defined(OS_POSIX) 21 #endif // defined(OS_POSIX)
22 22
23 #include "webkit/glue/webinputevent.h" 23 #include "webkit/glue/webinputevent.h"
24 #include "webkit/glue/webtextdirection.h"
24 #include "webkit/glue/webwidget.h" 25 #include "webkit/glue/webwidget.h"
25 26
26 RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) 27 RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable)
27 : routing_id_(MSG_ROUTING_NONE), 28 : routing_id_(MSG_ROUTING_NONE),
28 webwidget_(NULL), 29 webwidget_(NULL),
29 opener_id_(MSG_ROUTING_NONE), 30 opener_id_(MSG_ROUTING_NONE),
30 render_thread_(render_thread), 31 render_thread_(render_thread),
31 host_window_(NULL), 32 host_window_(NULL),
32 current_paint_buf_(NULL), 33 current_paint_buf_(NULL),
33 current_scroll_buf_(NULL), 34 current_scroll_buf_(NULL),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) 113 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden)
113 IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) 114 IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored)
114 IPC_MESSAGE_HANDLER(ViewMsg_PaintRect_ACK, OnPaintRectAck) 115 IPC_MESSAGE_HANDLER(ViewMsg_PaintRect_ACK, OnPaintRectAck)
115 IPC_MESSAGE_HANDLER(ViewMsg_ScrollRect_ACK, OnScrollRectAck) 116 IPC_MESSAGE_HANDLER(ViewMsg_ScrollRect_ACK, OnScrollRectAck)
116 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) 117 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent)
117 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) 118 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost)
118 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) 119 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus)
119 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetInputMode, OnImeSetInputMode) 120 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetInputMode, OnImeSetInputMode)
120 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) 121 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
121 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) 122 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint)
123 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
122 IPC_MESSAGE_UNHANDLED_ERROR() 124 IPC_MESSAGE_UNHANDLED_ERROR()
123 IPC_END_MESSAGE_MAP() 125 IPC_END_MESSAGE_MAP()
124 126
125 bool RenderWidget::Send(IPC::Message* message) { 127 bool RenderWidget::Send(IPC::Message* message) {
126 // Don't send any messages after the browser has told us to close. 128 // Don't send any messages after the browser has told us to close.
127 if (closing_) { 129 if (closing_) {
128 delete message; 130 delete message;
129 return false; 131 return false;
130 } 132 }
131 133
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) { 639 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
638 // During shutdown we can just ignore this message. 640 // During shutdown we can just ignore this message.
639 if (!webwidget_) 641 if (!webwidget_)
640 return; 642 return;
641 643
642 set_next_paint_is_repaint_ack(); 644 set_next_paint_is_repaint_ack();
643 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); 645 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height());
644 DidInvalidateRect(webwidget_, repaint_rect); 646 DidInvalidateRect(webwidget_, repaint_rect);
645 } 647 }
646 648
649 void RenderWidget::OnSetTextDirection(int direction) {
650 if (!webwidget_)
651 return;
652
653 WebTextDirection new_direction = static_cast<WebTextDirection>(direction);
654 if (new_direction == WEB_TEXT_DIRECTION_DEFAULT ||
655 new_direction == WEB_TEXT_DIRECTION_LTR ||
656 new_direction == WEB_TEXT_DIRECTION_RTL) {
657 webwidget_->SetTextDirection(new_direction);
658 } else {
659 NOTREACHED();
660 }
661 }
662
647 bool RenderWidget::next_paint_is_resize_ack() const { 663 bool RenderWidget::next_paint_is_resize_ack() const {
648 return ViewHostMsg_PaintRect_Flags::is_resize_ack(next_paint_flags_); 664 return ViewHostMsg_PaintRect_Flags::is_resize_ack(next_paint_flags_);
649 } 665 }
650 666
651 bool RenderWidget::next_paint_is_restore_ack() const { 667 bool RenderWidget::next_paint_is_restore_ack() const {
652 return ViewHostMsg_PaintRect_Flags::is_restore_ack(next_paint_flags_); 668 return ViewHostMsg_PaintRect_Flags::is_restore_ack(next_paint_flags_);
653 } 669 }
654 670
655 void RenderWidget::set_next_paint_is_resize_ack() { 671 void RenderWidget::set_next_paint_is_resize_ack() {
656 next_paint_flags_ |= ViewHostMsg_PaintRect_Flags::IS_RESIZE_ACK; 672 next_paint_flags_ |= ViewHostMsg_PaintRect_Flags::IS_RESIZE_ACK;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 for (; i < plugin_window_moves_.size(); ++i) { 757 for (; i < plugin_window_moves_.size(); ++i) {
742 if (plugin_window_moves_[i].window == move.window) { 758 if (plugin_window_moves_[i].window == move.window) {
743 plugin_window_moves_[i] = move; 759 plugin_window_moves_[i] = move;
744 break; 760 break;
745 } 761 }
746 } 762 }
747 763
748 if (i == plugin_window_moves_.size()) 764 if (i == plugin_window_moves_.size())
749 plugin_window_moves_.push_back(move); 765 plugin_window_moves_.push_back(move);
750 } 766 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | webkit/glue/webtextdirection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698