diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-02 21:25:19 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-02 21:25:19 +0000 |
commit | 1b11e9917ee936f96019cf859fa4b0eca32fdeed (patch) | |
tree | 83a5e3fb8f137c952c96b41184df14a502f149fe /content | |
parent | 7ac2ab362f09a4c5d8ab3e69cff22bb87bc5e989 (diff) | |
download | chromium_src-1b11e9917ee936f96019cf859fa4b0eca32fdeed.zip chromium_src-1b11e9917ee936f96019cf859fa4b0eca32fdeed.tar.gz chromium_src-1b11e9917ee936f96019cf859fa4b0eca32fdeed.tar.bz2 |
Revert 120237 - Expose contextual menu state.
BUG=93804, 95573
TEST=no change
Review URL: https://chromiumcodereview.appspot.com/9316073
TBR=avi@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9307070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
6 files changed, 27 insertions, 19 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view.cc b/content/browser/renderer_host/render_widget_host_view.cc index 53768f2..4edba28 100644 --- a/content/browser/renderer_host/render_widget_host_view.cc +++ b/content/browser/renderer_host/render_widget_host_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,7 +18,6 @@ RenderWidgetHostView::RenderWidgetHostView() : popup_type_(WebKit::WebPopupTypeNone), mouse_locked_(false), - showing_context_menu_(false), selection_text_offset_(0), selection_range_(ui::Range::InvalidRange()) { } @@ -49,8 +48,3 @@ void RenderWidgetHostView::SelectionChanged(const string16& text, selection_range_.set_start(range.start()); selection_range_.set_end(range.end()); } - -void RenderWidgetHostView::SetShowingContextMenu(bool showing) { - DCHECK_NE(showing_context_menu_, showing); - showing_context_menu_ = showing; -} diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h index b74afad..f3e9b8b 100644 --- a/content/browser/renderer_host/render_widget_host_view.h +++ b/content/browser/renderer_host/render_widget_host_view.h @@ -201,10 +201,11 @@ class RenderWidgetHostView { virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, const gfx::Rect& end_rect) {} - // Tells the View whether the context menu is showing. - virtual void SetShowingContextMenu(bool showing); + // Tells the View whether the context menu is showing. This is used on Linux + // to suppress updates to webkit focus for the duration of the show. + virtual void ShowingContextMenu(bool showing) {} - // Allocate a backing store for this view. + // Allocate a backing store for this view virtual BackingStore* AllocBackingStore(const gfx::Size& size) = 0; // Called when accelerated compositing state changes. @@ -345,7 +346,6 @@ class RenderWidgetHostView { void SetBrowserAccessibilityManager(BrowserAccessibilityManager* manager); bool mouse_locked() const { return mouse_locked_; } - bool showing_context_menu() const { return showing_context_menu_; } protected: // Interface class only, do not construct. @@ -366,9 +366,6 @@ class RenderWidgetHostView { // locked. bool mouse_locked_; - // Whether we are showing a context menu. - bool showing_context_menu_; - // A buffer containing the text inside and around the current selection range. string16 selection_text_; 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 72d71a8..863dc3e 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc @@ -244,7 +244,7 @@ class RenderWidgetHostViewGtkWidget { gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); // If we are showing a context menu, maintain the illusion that webkit has // focus. - if (!host_view->showing_context_menu()) { + if (!host_view->is_showing_context_menu_) { host_view->GetRenderWidgetHost()->SetActive(false); host_view->GetRenderWidgetHost()->Blur(); } @@ -566,6 +566,7 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) about_to_validate_and_paint_(false), is_hidden_(false), is_loading_(false), + is_showing_context_menu_(false), parent_(NULL), is_popup_first_mouse_release_(true), was_imcontext_focused_before_grab_(false), @@ -932,6 +933,10 @@ void RenderWidgetHostViewGtk::SelectionBoundsChanged( im_context_->UpdateCaretBounds(start_rect.Union(end_rect)); } +void RenderWidgetHostViewGtk::ShowingContextMenu(bool showing) { + is_showing_context_menu_ = showing; +} + #if !defined(TOOLKIT_VIEWS) GtkWidget* RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { return im_context_->BuildInputMethodsGtkMenu(); diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h index b66dc88..3601164 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.h +++ b/content/browser/renderer_host/render_widget_host_view_gtk.h @@ -89,6 +89,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView { const ui::Range& range) OVERRIDE; virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, const gfx::Rect& end_rect) OVERRIDE; + virtual void ShowingContextMenu(bool showing) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( @@ -209,6 +210,9 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView { // The cursor for the page. This is passed up from the renderer. WebCursor current_cursor_; + // Whether we are showing a context menu. + bool is_showing_context_menu_; + // The time at which this view started displaying white pixels as a result of // not having anything to paint (empty backing store from renderer). This // value returns true for is_null() if we are not recording whiteout times. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index bd5a23b..94b1598 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -211,7 +211,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { virtual void SelectionChanged(const string16& text, size_t offset, const ui::Range& range) OVERRIDE; - virtual void SetShowingContextMenu(bool showing) OVERRIDE; + virtual void ShowingContextMenu(bool showing) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; @@ -269,6 +269,9 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { virtual gfx::Rect GetRootWindowBounds() OVERRIDE; virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; + // Returns |true| if a context menu is currently being shown. + bool is_showing_context_menu() const { return is_showing_context_menu_; } + void DrawAcceleratedSurfaceInstance( CGLContextObj context, gfx::PluginWindowHandle plugin_handle, @@ -377,6 +380,9 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { // true if the View is not visible. bool is_hidden_; + // Whether we are showing a context menu. + bool is_showing_context_menu_; + // The text to be shown in the tooltip, supplied by the renderer. string16 tooltip_text_; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index e14fab9..0ca290c 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -235,6 +235,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) text_input_type_(ui::TEXT_INPUT_TYPE_NONE), is_loading_(false), is_hidden_(false), + is_showing_context_menu_(false), weak_factory_(this), accelerated_compositing_active_(false), needs_gpu_visibility_update_after_repaint_(false), @@ -496,7 +497,7 @@ void RenderWidgetHostViewMac::UpdateCursorIfNecessary() { // a page? TODO(avi): decide // Don't update the cursor if a context menu is being shown. - if (showing_context_menu()) + if (is_showing_context_menu_) return; // Can we synchronize to the event stream? Switch to -[NSWindow @@ -693,8 +694,9 @@ void RenderWidgetHostViewMac::SelectionChanged(const string16& text, } } -void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) { - RenderWidgetHostView::SetShowingContextMenu(showing); +void RenderWidgetHostViewMac::ShowingContextMenu(bool showing) { + DCHECK_NE(is_showing_context_menu_, showing); + is_showing_context_menu_ = showing; // If the menu was closed, restore the cursor to the saved version initially, // as the renderer will not re-send it if there was no change. |