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

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

Issue 57032: Implement HTML selects as native Cocoa controls for Chrome (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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/common/render_messages_internal.h ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (!has_focus_ && webwidget_) 306 if (!has_focus_ && webwidget_)
307 webwidget_->SetFocus(false); 307 webwidget_->SetFocus(false);
308 } 308 }
309 309
310 void RenderWidget::PaintRect(const gfx::Rect& rect, 310 void RenderWidget::PaintRect(const gfx::Rect& rect,
311 skia::PlatformCanvas* canvas) { 311 skia::PlatformCanvas* canvas) {
312 312
313 // If there is a custom background, tile it. 313 // If there is a custom background, tile it.
314 if (!background_.empty()) { 314 if (!background_.empty()) {
315 canvas->save(); 315 canvas->save();
316 316
317 SkIRect clipRect = { rect.x(), rect.y(), rect.right(), rect.bottom() }; 317 SkIRect clipRect = { rect.x(), rect.y(), rect.right(), rect.bottom() };
318 canvas->setClipRegion(SkRegion(clipRect)); 318 canvas->setClipRegion(SkRegion(clipRect));
319 319
320 SkPaint paint; 320 SkPaint paint;
321 SkShader* shader = SkShader::CreateBitmapShader(background_, 321 SkShader* shader = SkShader::CreateBitmapShader(background_,
322 SkShader::kRepeat_TileMode, 322 SkShader::kRepeat_TileMode,
323 SkShader::kRepeat_TileMode); 323 SkShader::kRepeat_TileMode);
324 paint.setShader(shader)->unref(); 324 paint.setShader(shader)->unref();
325 paint.setPorterDuffXfermode(SkPorterDuff::kSrcOver_Mode); 325 paint.setPorterDuffXfermode(SkPorterDuff::kSrcOver_Mode);
326 canvas->drawPaint(paint); 326 canvas->drawPaint(paint);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 render_thread_->Send(new ViewHostMsg_ShowWidget( 582 render_thread_->Send(new ViewHostMsg_ShowWidget(
583 opener_id_, routing_id_, initial_pos_)); 583 opener_id_, routing_id_, initial_pos_));
584 } 584 }
585 } 585 }
586 586
587 void RenderWidget::ShowAsPopupWithItems(WebWidget* webwidget, 587 void RenderWidget::ShowAsPopupWithItems(WebWidget* webwidget,
588 const WebRect& bounds, 588 const WebRect& bounds,
589 int item_height, 589 int item_height,
590 int selected_index, 590 int selected_index,
591 const std::vector<WebMenuItem>& items) { 591 const std::vector<WebMenuItem>& items) {
592 // TODO(paulg): Implement this for Mac HTML select menus in Chromium, bug 592 ViewHostMsg_ShowPopup_Params params;
593 // number: http://crbug.com/8389 593 params.bounds = bounds;
594 params.item_height = item_height;
595 params.selected_item = selected_index;
596 params.popup_items = items;
597
598 Send(new ViewHostMsg_ShowPopup(routing_id_, params));
594 } 599 }
595 600
596 void RenderWidget::Focus(WebWidget* webwidget) { 601 void RenderWidget::Focus(WebWidget* webwidget) {
597 // Prevent the widget from stealing the focus if it does not have focus 602 // Prevent the widget from stealing the focus if it does not have focus
598 // already. We do this by explicitely setting the focus to false again. 603 // already. We do this by explicitely setting the focus to false again.
599 // We only let the browser focus the renderer. 604 // We only let the browser focus the renderer.
600 if (!has_focus_ && webwidget_) { 605 if (!has_focus_ && webwidget_) {
601 MessageLoop::current()->PostTask(FROM_HERE, 606 MessageLoop::current()->PostTask(FROM_HERE,
602 NewRunnableMethod(this, &RenderWidget::ClearFocus)); 607 NewRunnableMethod(this, &RenderWidget::ClearFocus));
603 } 608 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 if (i == plugin_window_moves_.size()) 810 if (i == plugin_window_moves_.size())
806 plugin_window_moves_.push_back(move); 811 plugin_window_moves_.push_back(move);
807 } 812 }
808 813
809 WebScreenInfo RenderWidget::GetScreenInfo(WebWidget* webwidget) { 814 WebScreenInfo RenderWidget::GetScreenInfo(WebWidget* webwidget) {
810 WebScreenInfo results; 815 WebScreenInfo results;
811 RenderThread::current()->Send( 816 RenderThread::current()->Send(
812 new ViewHostMsg_GetScreenInfo(host_window_, &results)); 817 new ViewHostMsg_GetScreenInfo(host_window_, &results));
813 return results; 818 return results;
814 } 819 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698