summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/render_widget_host_view_gtk.cc
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 21:29:36 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 21:29:36 +0000
commit1138ccee095823e0c05ec084f19fbabe96b8f0a3 (patch)
tree3e456a5aa0a97f5bf0a430e2dacb24eea59101db /content/browser/renderer_host/render_widget_host_view_gtk.cc
parent70f48c0a4cfc3675313ad7e8262a6e6b72583690 (diff)
downloadchromium_src-1138ccee095823e0c05ec084f19fbabe96b8f0a3.zip
chromium_src-1138ccee095823e0c05ec084f19fbabe96b8f0a3.tar.gz
chromium_src-1138ccee095823e0c05ec084f19fbabe96b8f0a3.tar.bz2
Implement SetVisuallyDeemphasized in ChromeRenderViewObserver.
Implement SetVisuallyDeemphasized in ChromeRenderViewObserver - Add a ChromeViewMsg_SetVisuallyDeemphasized and use it to toggle background dimming on web contents via ChromeRenderViewObserver; - Derive WebViewColorOverlay from WebKit::WebPageOverlay and add to web view when need to dimming the background; - Remove RWHV SetVisuallyDeemphasized since it's no longer used; BUG=103386 TEST=Verify fix for 103386, dimming should show up even when accelerated compositing is on. Review URL: http://codereview.chromium.org/8730001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/render_widget_host_view_gtk.cc')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.cc80
1 files changed, 2 insertions, 78 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc
index fedcbd2..2efe680 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -57,9 +57,6 @@ namespace {
const int kMaxWindowWidth = 4000;
const int kMaxWindowHeight = 4000;
-// The duration of the fade-out animation. See |overlay_animation_|.
-const int kFadeEffectDuration = 300;
-
#if defined(OS_CHROMEOS)
// TODO(davemoore) Under Chromeos we are increasing the rate that the trackpad
// generates events to get better precisions. Eventually we will coordinate the
@@ -567,8 +564,6 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host)
is_hidden_(false),
is_loading_(false),
is_showing_context_menu_(false),
- overlay_color_(0),
- overlay_animation_(this),
parent_(NULL),
is_popup_first_mouse_release_(true),
was_imcontext_focused_before_grab_(false),
@@ -590,8 +585,6 @@ RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
void RenderWidgetHostViewGtk::InitAsChild() {
DoSharedInit();
- overlay_animation_.SetDuration(kFadeEffectDuration);
- overlay_animation_.SetSlideDuration(kFadeEffectDuration);
gtk_widget_show(view_.get());
}
@@ -1110,45 +1103,8 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
// period where this object isn't attached to a window but hasn't been
// Destroy()ed yet and it receives paint messages...
if (window) {
- if (SkColorGetA(overlay_color_) == 0) {
- // In the common case, use XCopyArea. We don't draw more than once, so
- // we don't need to double buffer.
- backing_store->XShowRect(gfx::Point(0, 0),
- paint_rect, ui::GetX11WindowFromGtkWidget(view_.get()));
- } else {
- // If the grey blend is showing, we make two drawing calls. Use double
- // buffering to prevent flicker. Use CairoShowRect because XShowRect
- // shortcuts GDK's double buffering. We won't be able to draw outside
- // of |damage_rect|, so invalidate the difference between |paint_rect|
- // and |damage_rect|.
- if (paint_rect != damage_rect) {
- GdkRectangle extra_gdk_rect =
- paint_rect.Subtract(damage_rect).ToGdkRectangle();
- gdk_window_invalidate_rect(window, &extra_gdk_rect, false);
- }
-
- GdkRectangle rect = { damage_rect.x(), damage_rect.y(),
- damage_rect.width(), damage_rect.height() };
- gdk_window_begin_paint_rect(window, &rect);
-
- backing_store->CairoShowRect(damage_rect, GDK_DRAWABLE(window));
-
- cairo_t* cr = gdk_cairo_create(window);
- gdk_cairo_rectangle(cr, &rect);
- SkColor overlay = SkColorSetA(
- overlay_color_,
- SkColorGetA(overlay_color_) *
- overlay_animation_.GetCurrentValue());
- float r = SkColorGetR(overlay) / 255.;
- float g = SkColorGetG(overlay) / 255.;
- float b = SkColorGetB(overlay) / 255.;
- float a = SkColorGetA(overlay) / 255.;
- cairo_set_source_rgba(cr, r, g, b, a);
- cairo_fill(cr);
- cairo_destroy(cr);
-
- gdk_window_end_paint(window);
- }
+ backing_store->XShowRect(gfx::Point(0, 0),
+ paint_rect, ui::GetX11WindowFromGtkWidget(view_.get()));
}
if (!whiteout_start_time_.is_null()) {
base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
@@ -1206,24 +1162,6 @@ void RenderWidgetHostViewGtk::DestroyPluginContainer(
plugin_container_manager_.DestroyPluginContainer(id);
}
-void RenderWidgetHostViewGtk::SetVisuallyDeemphasized(
- const SkColor* color, bool animate) {
- // Do nothing unless |color| has changed, meaning |animate| is only
- // respected for the first call.
- if (color && (*color == overlay_color_))
- return;
-
- overlay_color_ = color ? *color : 0;
-
- if (animate) {
- overlay_animation_.Reset();
- overlay_animation_.Show();
- } else {
- overlay_animation_.Reset(1.0);
- gtk_widget_queue_draw(view_.get());
- }
-}
-
void RenderWidgetHostViewGtk::UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) {
}
@@ -1363,20 +1301,6 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
host_->ForwardKeyboardEvent(event);
}
-void RenderWidgetHostViewGtk::AnimationEnded(const ui::Animation* animation) {
- gtk_widget_queue_draw(view_.get());
-}
-
-void RenderWidgetHostViewGtk::AnimationProgressed(
- const ui::Animation* animation) {
- gtk_widget_queue_draw(view_.get());
-}
-
-void RenderWidgetHostViewGtk::AnimationCanceled(
- const ui::Animation* animation) {
- gtk_widget_queue_draw(view_.get());
-}
-
void RenderWidgetHostViewGtk::set_last_mouse_down(GdkEventButton* event) {
GdkEventButton* temp = NULL;
if (event) {