summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 17:49:51 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 17:49:51 +0000
commit92704c0bc019169ee9782ace6c81f2a27d4dc923 (patch)
treec559f160dd9625170909356e1b344879829563ef /chrome/browser/renderer_host
parent028b85aedee66ad252a935d4c15c0a70f804b4b4 (diff)
downloadchromium_src-92704c0bc019169ee9782ace6c81f2a27d4dc923.zip
chromium_src-92704c0bc019169ee9782ace6c81f2a27d4dc923.tar.gz
chromium_src-92704c0bc019169ee9782ace6c81f2a27d4dc923.tar.bz2
[Mac]Revert RWHVM to use NSTextInput protocol instead of NSTextInputClient
Using NSTextInputClient protocol somehow causes beep when typing. BUG=25037 Use NSTextInputClient instead of NSTextInput ? BUG=47890 [Leopard] Typing any letter beeps in the normal edit box TEST=Typing in text box should not beep. Review URL: http://codereview.chromium.org/2810040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51272 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm26
2 files changed, 8 insertions, 23 deletions
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 0ed5a3b..de80e22 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -31,10 +31,9 @@ class RWHVMEditCommandHelper;
// RenderWidgetHostViewWin is both the view and the delegate. We split the roles
// but that means that the view needs to own the delegate and will dispose of it
// when it's removed from the view system.
-
+// See http://crbug.com/47890 for why we don't use NSTextInputClient yet.
@interface RenderWidgetHostViewCocoa
- : BaseView <RenderWidgetHostViewMacOwner, NSTextInputClient,
- NSChangeSpelling> {
+ : BaseView <RenderWidgetHostViewMacOwner, NSTextInput, NSChangeSpelling> {
@private
scoped_ptr<RenderWidgetHostViewMac> renderWidgetHostView_;
BOOL canBeKeyView_;
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 3f9a85f..1801f38 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1585,7 +1585,7 @@ static const NSTrackingRectTag kTrackingRectTag = 0xBADFACE;
return [[toolTip_ copy] autorelease];
}
-// Below is our NSTextInputClient implementation.
+// Below is our NSTextInput implementation.
//
// When WebHTMLView receives a NSKeyDown event, WebHTMLView calls the following
// functions to process this event.
@@ -1662,8 +1662,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
return NSNotFound;
}
-- (NSRect)firstRectForCharacterRange:(NSRange)theRange
- actualRange:(NSRangePointer)actualRange {
+- (NSRect)firstRectForCharacterRange:(NSRange)theRange {
// An input method requests a cursor rectangle to display its candidate
// window.
// Calculate the screen coordinate of the cursor rectangle saved in
@@ -1678,12 +1677,6 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
if (window)
resultRect.origin = [window convertBaseToScreen:resultRect.origin];
- // If marked text is available, then we actually return the rect of the
- // selected range within the marked text. Otherwise, we actually can't get
- // the rect of an arbitrary range in the web content, so just return the
- // caret rect instead and don't touch actualRange at all.
- if (actualRange && hasMarkedText_)
- *actualRange = selectedRange_;
return resultRect;
}
@@ -1702,8 +1695,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
return hasMarkedText_ ? markedRange_ : NSMakeRange(NSNotFound, 0);
}
-- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)range
- actualRange:(NSRangePointer)actualRange {
+- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range {
// TODO(hbono): Even though many input method works without implementing
// this method, we need to save a copy of the string in the setMarkedText
// method and create a NSAttributedString with the given range.
@@ -1718,8 +1710,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
// Each RenderWidgetHostViewCocoa has its own input context, but we return
// nil when the caret is in non-editable content or password box to avoid
// making input methods do their work.
-- (NSTextInputContext *)inputContext
-{
+- (NSTextInputContext *)inputContext {
switch(renderWidgetHostView_->text_input_type_) {
case WebKit::WebTextInputTypeNone:
case WebKit::WebTextInputTypePassword:
@@ -1757,13 +1748,10 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
unmarkTextCalled_ = YES;
}
-- (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange
- replacementRange:(NSRange)replacementRange {
+- (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange {
// An input method updates the composition string.
// We send the given text and range to the renderer so it can update the
// composition node of WebKit.
- // TODO(suzhe): It's hard for us to support replacementRange without accessing
- // the full web content.
BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
NSString* im_text = isAttributedString ? [string string] : string;
int length = [im_text length];
@@ -1819,7 +1807,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
}
}
-- (void)insertText:(id)string replacementRange:(NSRange)replacementRange {
+- (void)insertText:(id)string {
// An input method has characters to be inserted.
// Same as Linux, Mac calls this method not only:
// * when an input method finishs composing text, but also;
@@ -1833,8 +1821,6 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
// Text inserting might be initiated by other source instead of keyboard
// events, such as the Characters dialog. In this case the text should be
// sent as an input method event as well.
- // TODO(suzhe): It's hard for us to support replacementRange without accessing
- // the full web content.
BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
NSString* im_text = isAttributedString ? [string string] : string;
if (handlingKeyDown_) {