summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-06 00:58:55 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-06 00:58:55 +0000
commitc631b592135bd46aba81ec9c9d0c6944ac7aa7ea (patch)
tree16cd7cc1926c646c59715affef8f4eb09f100727
parent33de31fd08abedb4d7fdf3eb8f1f807468ddcc17 (diff)
downloadchromium_src-c631b592135bd46aba81ec9c9d0c6944ac7aa7ea.zip
chromium_src-c631b592135bd46aba81ec9c9d0c6944ac7aa7ea.tar.gz
chromium_src-c631b592135bd46aba81ec9c9d0c6944ac7aa7ea.tar.bz2
Revert 95698 - Implement touch selection for RWHVV.
BUG=none TEST=none Review URL: http://codereview.chromium.org/7570001 TBR=varunjain@chromium.org Review URL: http://codereview.chromium.org/7584021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95705 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views.cc38
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views.h21
-rw-r--r--content/browser/renderer_host/render_view_host.cc6
-rw-r--r--content/browser/renderer_host/render_view_host.h3
-rw-r--r--content/browser/renderer_host/render_widget_host_view.h8
-rw-r--r--content/common/view_messages.h11
-rw-r--r--content/renderer/render_view.cc33
-rw-r--r--content/renderer/render_view.h5
12 files changed, 18 insertions, 123 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index e3b1e13..bb7f266 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -835,9 +835,7 @@ void RenderWidgetHostViewGtk::SetTooltipText(const std::wstring& tooltip_text) {
}
void RenderWidgetHostViewGtk::SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) {
+ const ui::Range& range) {
if (!text.empty()) {
GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
gtk_clipboard_set_text(x_clipboard, text.c_str(), text.length());
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 227e0811..d93b9a1 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -88,9 +88,7 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}
virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE;
virtual void SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) OVERRIDE;
+ const ui::Range& range) OVERRIDE;
virtual void ShowingContextMenu(bool showing) OVERRIDE;
virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
virtual void SetBackground(const SkBitmap& background) OVERRIDE;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index 7bdd77c..9a3daf8 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -206,9 +206,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
virtual void Destroy() OVERRIDE;
virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE;
virtual void SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) OVERRIDE;
+ const ui::Range& range) OVERRIDE;
virtual void ShowingContextMenu(bool showing) OVERRIDE;
virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 28bbb7a..cb1d21f 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -644,9 +644,7 @@ void RenderWidgetHostViewMac::SetTooltipText(const std::wstring& tooltip_text) {
// which implements NSServicesRequests protocol.
//
void RenderWidgetHostViewMac::SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) {
+ const ui::Range& range) {
selected_text_ = text;
[cocoa_view_ setSelectedRange:range.ToNSRange()];
// Updaes markedRange when there is no marked text so that retrieving
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
index 95f5083..858547c 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -87,9 +87,7 @@ RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host)
visually_deemphasized_(false),
touch_event_(),
text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
- has_composition_text_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(touch_selection_controller_(
- views::TouchSelectionController::create(this))) {
+ has_composition_text_(false) {
set_focusable(true);
host_->SetView(this);
@@ -306,13 +304,9 @@ void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) {
}
void RenderWidgetHostViewViews::SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) {
+ const ui::Range& range) {
// TODO(anicolao): deal with the clipboard without GTK
NOTIMPLEMENTED();
- if (touch_selection_controller_.get())
- touch_selection_controller_->SelectionChanged(start, end);
}
void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) {
@@ -335,34 +329,6 @@ void RenderWidgetHostViewViews::SetVisuallyDeemphasized(
// TODO(anicolao)
}
-void RenderWidgetHostViewViews::SelectRect(const gfx::Point& start,
- const gfx::Point& end) {
- if (host_)
- host_->Send(new ViewMsg_SelectRange(host_->routing_id(), start, end));
-}
-
-bool RenderWidgetHostViewViews::IsCommandIdChecked(int command_id) const {
- // TODO(varunjain): implement this and other menu delegate methods.
- NOTREACHED();
- return true;
-}
-
-bool RenderWidgetHostViewViews::IsCommandIdEnabled(int command_id) const {
- NOTREACHED();
- return true;
-}
-
-bool RenderWidgetHostViewViews::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
- NOTREACHED();
- return true;
-}
-
-void RenderWidgetHostViewViews::ExecuteCommand(int command_id) {
- NOTREACHED();
-}
-
std::string RenderWidgetHostViewViews::GetClassName() const {
return kViewClassName;
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.h b/chrome/browser/renderer_host/render_widget_host_view_views.h
index 715c6b7..e10694e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.h
@@ -18,7 +18,6 @@
#include "views/controls/native/native_view_host.h"
#include "views/events/event.h"
#include "views/ime/text_input_client.h"
-#include "views/touchui/touch_selection_controller.h"
#include "views/view.h"
#include "webkit/glue/webcursor.h"
@@ -36,7 +35,7 @@ struct NativeWebKeyboardEvent;
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
class RenderWidgetHostViewViews : public RenderWidgetHostView,
- public views::TouchSelectionClientView,
+ public views::View,
public views::TextInputClient {
public:
// Internal class name.
@@ -80,9 +79,7 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
virtual void Destroy() OVERRIDE;
virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE;
virtual void SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) OVERRIDE;
+ const ui::Range& range) OVERRIDE;
virtual void ShowingContextMenu(bool showing) OVERRIDE;
virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
virtual void SetBackground(const SkBitmap& background) OVERRIDE;
@@ -101,18 +98,6 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
#endif
virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
- // Overridden from views::TouchSelectionClientView.
- virtual void SelectRect(const gfx::Point& start,
- const gfx::Point& end) OVERRIDE;
-
- // Overridden from ui::SimpleMenuModel::Delegate.
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
- virtual void ExecuteCommand(int command_id) OVERRIDE;
-
// Overridden from views::View.
virtual std::string GetClassName() const OVERRIDE;
virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE;
@@ -255,8 +240,6 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
string16 tooltip_text_;
- scoped_ptr<views::TouchSelectionController> touch_selection_controller_;
-
#if defined(TOUCH_UI)
std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerTouch> >
accelerated_surface_containers_;
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 2127b1b..3f12fc2 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -1002,11 +1002,9 @@ void RenderViewHost::OnMsgDidContentsPreferredSizeChange(
}
void RenderViewHost::OnMsgSelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) {
+ const ui::Range& range) {
if (view())
- view()->SelectionChanged(text, range, start, end);
+ view()->SelectionChanged(text, range);
}
void RenderViewHost::OnMsgRunJavaScriptMessage(
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index 693e679..c6a8010 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -428,8 +428,7 @@ class RenderViewHost : public RenderWidgetHost {
void OnMsgOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition);
void OnMsgDidContentsPreferredSizeChange(const gfx::Size& new_size);
- void OnMsgSelectionChanged(const std::string& text, const ui::Range& range,
- const gfx::Point& start, const gfx::Point& end);
+ void OnMsgSelectionChanged(const std::string& text, const ui::Range& range);
void OnMsgPasteFromSelectionClipboard();
void OnMsgRunJavaScriptMessage(const string16& message,
const string16& default_prompt,
diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h
index cd1bc2f..8463cb8 100644
--- a/content/browser/renderer_host/render_widget_host_view.h
+++ b/content/browser/renderer_host/render_widget_host_view.h
@@ -179,13 +179,9 @@ class RenderWidgetHostView {
// the page has changed.
virtual void SetTooltipText(const std::wstring& tooltip_text) = 0;
- // Notifies the View that the renderer text selection has changed. |start|
- // and |end| are the visual end points of the selection in the coordinate
- // system of the render view.
+ // Notifies the View that the renderer text selection has changed.
virtual void SelectionChanged(const std::string& text,
- const ui::Range& range,
- const gfx::Point& start,
- const gfx::Point& end) {}
+ const ui::Range& range) {}
// 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.
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index eaf0655..4022238 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -923,11 +923,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_Replace,
IPC_MESSAGE_ROUTED0(ViewMsg_Delete)
IPC_MESSAGE_ROUTED0(ViewMsg_SelectAll)
-// Requests the renderer to select the region between two points.
-IPC_MESSAGE_ROUTED2(ViewMsg_SelectRange,
- gfx::Point /* start */,
- gfx::Point /* end */)
-
// Copies the image at location x, y to the clipboard (if there indeed is an
// image at that location).
IPC_MESSAGE_ROUTED2(ViewMsg_CopyImageAt,
@@ -1716,11 +1711,9 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_SetTooltipText,
WebKit::WebTextDirection /* text direction hint */)
// Notification that the text selection has changed.
-IPC_MESSAGE_ROUTED4(ViewHostMsg_SelectionChanged,
+IPC_MESSAGE_ROUTED2(ViewHostMsg_SelectionChanged,
std::string /* currently selected text */,
- ui::Range /* selection range */,
- gfx::Point,
- gfx::Point /* visual end points of selection */)
+ ui::Range /* selection range */)
// Asks the browser to display the file chooser. The result is returned in a
// ViewHost_RunFileChooserResponse message.
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 972349f..a0bea3c 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -361,8 +361,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
accessibility_ack_pending_(false),
p2p_socket_dispatcher_(NULL),
devtools_agent_(NULL),
- session_storage_namespace_id_(session_storage_namespace_id),
- handling_select_range_(false) {
+ session_storage_namespace_id_(session_storage_namespace_id) {
routing_id_ = routing_id;
if (opener_id != MSG_ROUTING_NONE)
opener_id_ = opener_id;
@@ -615,7 +614,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
- IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange)
IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
@@ -981,15 +979,6 @@ void RenderView::OnSelectAll() {
WebString::fromUTF8("SelectAll"));
}
-void RenderView::OnSelectRange(const gfx::Point& start, const gfx::Point& end) {
- if (!webview())
- return;
-
- handling_select_range_ = true;
- webview()->focusedFrame()->selectRange(start, end);
- handling_select_range_ = false;
-}
-
void RenderView::OnSetInitialFocus(bool reverse) {
if (!webview())
return;
@@ -1526,9 +1515,8 @@ bool RenderView::isSelectTrailingWhitespaceEnabled() {
void RenderView::didChangeSelection(bool is_empty_selection) {
#if defined(OS_POSIX)
- if (!handling_input_event_ && !handling_select_range_)
+ if (!handling_input_event_)
return;
- handling_select_range_ = false;
if (is_empty_selection) {
last_selection_.clear();
@@ -1549,22 +1537,7 @@ void RenderView::didChangeSelection(bool is_empty_selection) {
range.set_start(location);
range.set_end(location + length);
}
-
- WebKit::WebPoint start, end;
- webview()->selectionRange(start, end);
-
- // Webkit gives an offset of 1 between start and end even if there is no
- // selection. So we need to check against that.
- // TODO(varunjain): remove this check once that is fixed.
- gfx::Point p1, p2;
- if (std::abs(start.x - end.x) > 1 || std::abs(start.y - end.y) > 1) {
- gfx::Point scroll_offset = GetScrollOffset();
- p1.SetPoint(start.x + scroll_offset.x(), start.y + scroll_offset.y());
- p2.SetPoint(end.x + scroll_offset.x(), end.y + scroll_offset.y());
- }
- // TODO(varunjain): add other hooks for SelectionChanged.
- Send(new ViewHostMsg_SelectionChanged(routing_id_, last_selection_, range,
- p1, p2));
+ Send(new ViewHostMsg_SelectionChanged(routing_id_, last_selection_, range));
#endif // defined(OS_POSIX)
}
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index 430f054..0db5615 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -819,7 +819,6 @@ class RenderView : public RenderWidget,
int id,
bool notify_result);
void OnSelectAll();
- void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
void OnSetAccessibilityFocus(int acc_obj_id);
void OnSetActive(bool active);
void OnSetAltErrorPageURL(const GURL& gurl);
@@ -1198,10 +1197,6 @@ class RenderView : public RenderWidget,
// is fine.
ObserverList<RenderViewObserver> observers_;
- // Used to inform didChangeSelection() when it is called in the context
- // of handling a ViewMsg_SelectRange IPC.
- bool handling_select_range_;
-
// ---------------------------------------------------------------------------
// ADDING NEW DATA? Please see if it fits appropriately in one of the above
// sections rather than throwing it randomly at the end. If you're adding a