2010-06-28 Zhe Su <suzhe@chromium.org>

        Reviewed by Jian Li.

        [chromium]Remove deprecated code related to input method.
        https://bugs.webkit.org/show_bug.cgi?id=41244

        Also update TestWebWidget in tests/PopupMenuTest.cpp to add missing implementations.

        * WebKit.gyp:
        * public/WebCompositionCommand.h: Removed.
        * public/WebViewClient.h:
        * public/WebWidget.h:
        * src/EditorClientImpl.cpp:
        (WebKit::EditorClientImpl::setInputMethodState):
        * src/WebPopupMenuImpl.cpp:
        * src/WebPopupMenuImpl.h:
        * src/WebViewImpl.cpp:
        * src/WebViewImpl.h:
        * tests/PopupMenuTest.cpp:
        (WebKit::TestWebWidget::setComposition):
        (WebKit::TestWebWidget::confirmComposition):
        (WebKit::TestWebWidget::textInputType):
        (WebKit::TestWebWidget::caretOrSelectionBounds):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent de6bb494
2010-06-28 Zhe Su <suzhe@chromium.org>
Reviewed by Jian Li.
[chromium]Remove deprecated code related to input method.
https://bugs.webkit.org/show_bug.cgi?id=41244
Also update TestWebWidget in tests/PopupMenuTest.cpp to add missing implementations.
* WebKit.gyp:
* public/WebCompositionCommand.h: Removed.
* public/WebViewClient.h:
* public/WebWidget.h:
* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::setInputMethodState):
* src/WebPopupMenuImpl.cpp:
* src/WebPopupMenuImpl.h:
* src/WebViewImpl.cpp:
* src/WebViewImpl.h:
* tests/PopupMenuTest.cpp:
(WebKit::TestWebWidget::setComposition):
(WebKit::TestWebWidget::confirmComposition):
(WebKit::TestWebWidget::textInputType):
(WebKit::TestWebWidget::caretOrSelectionBounds):
2010-06-27 John Abd-El-Malek <jam@chromium.org>
Reviewed by Darin Fisher.
......
......@@ -92,7 +92,6 @@
'public/WebColorName.h',
'public/WebCommon.h',
'public/WebCommonWorkerClient.h',
'public/WebCompositionCommand.h',
'public/WebCompositionUnderline.h',
'public/WebConsoleMessage.h',
'public/WebContextMenuData.h',
......
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebCompositionCommand_h
#define WebCompositionCommand_h
namespace WebKit {
// DEPRECATED.
enum WebCompositionCommand {
WebCompositionCommandDiscard,
WebCompositionCommandSet,
WebCompositionCommandConfirm,
};
} // namespace WebKit
#endif
......@@ -126,9 +126,6 @@ public:
virtual bool isSmartInsertDeleteEnabled() { return true; }
virtual bool isSelectTrailingWhitespaceEnabled() { return true; }
// DEPRECATED: replaced by WebWidgetClient::resetInputMethod().
virtual void setInputMethodEnabled(bool enabled) { }
virtual void didBeginEditing() { }
virtual void didChangeSelection(bool isSelectionEmpty) { }
virtual void didChangeContents() { }
......
......@@ -33,7 +33,6 @@
#include "WebCanvas.h"
#include "WebCommon.h"
#include "WebCompositionCommand.h"
#include "WebCompositionUnderline.h"
#include "WebTextInputType.h"
#include "WebTextDirection.h"
......@@ -79,13 +78,6 @@ public:
// Called to inform the WebWidget that it has gained or lost keyboard focus.
virtual void setFocus(bool) = 0;
// DEPRECATED. It's replaced by setComposition() and confirmComposition().
virtual bool handleCompositionEvent(WebCompositionCommand command,
int cursorPosition,
int targetStart,
int targetEnd,
const WebString& text) = 0;
// Called to inform the WebWidget of a new composition text.
// If selectionStart and selectionEnd has the same value, then it indicates
// the input caret position. If the text is empty, then the existing
......@@ -101,10 +93,6 @@ public:
// Returns true if there is an ongoing composition.
virtual bool confirmComposition() = 0;
// DEPRECATED. It's replaced by textInputType() and
// caretOrSelectionBounds().
virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0;
// Returns the current text input type of this WebWidget.
virtual WebTextInputType textInputType() = 0;
......
......@@ -921,13 +921,8 @@ void EditorClientImpl::getGuessesForWord(const String&,
void EditorClientImpl::setInputMethodState(bool enabled)
{
if (m_webView->client()) {
if (m_webView->client())
m_webView->client()->resetInputMethod();
// Remove this line when WebViewClient::setInputMethodEnabled() gets
// removed.
m_webView->client()->setInputMethodEnabled(enabled);
}
}
} // namesace WebKit
......@@ -230,14 +230,6 @@ void WebPopupMenuImpl::setFocus(bool enable)
{
}
// DEPRECATED, will be removed later.
bool WebPopupMenuImpl::handleCompositionEvent(
WebCompositionCommand command, int cursorPosition, int targetStart,
int targetEnd, const WebString& imeString)
{
return false;
}
bool WebPopupMenuImpl::setComposition(
const WebString& text, const WebVector<WebCompositionUnderline>& underlines,
int selectionStart, int selectionEnd)
......@@ -250,12 +242,6 @@ bool WebPopupMenuImpl::confirmComposition()
return false;
}
// DEPRECATED, will be removed later.
bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled, WebRect* caretRect)
{
return false;
}
WebTextInputType WebPopupMenuImpl::textInputType()
{
return WebTextInputTypeNone;
......
......@@ -66,19 +66,11 @@ public:
virtual bool handleInputEvent(const WebInputEvent&);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
// DEPRECATED, will be removed later.
virtual bool handleCompositionEvent(
WebCompositionCommand command, int cursorPosition,
int targetStart, int targetEnd, const WebString& text);
virtual bool setComposition(
const WebString& text,
const WebVector<WebCompositionUnderline>& underlines,
int selectionStart, int selectionEnd);
virtual bool confirmComposition();
// DEPRECATED, will be removed later.
virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect);
virtual WebTextInputType textInputType();
virtual WebRect caretOrSelectionBounds();
virtual void setTextDirection(WebTextDirection direction);
......
......@@ -1164,48 +1164,6 @@ void WebViewImpl::setFocus(bool enable)
}
}
// DEPRECATED, will be removed later.
bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command,
int cursorPosition,
int targetStart,
int targetEnd,
const WebString& imeString)
{
if (command == WebKit::WebCompositionCommandSet) {
if (targetStart < 0)
targetStart = 0;
if (targetEnd < 0)
targetEnd = static_cast<int>(imeString.length());
// Create custom underlines.
// To emphasize the selection, the selected region uses a solid black
// for its underline while other regions uses a pale gray for theirs.
WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(3));
underlines[0].startOffset = 0;
underlines[0].endOffset = targetStart;
underlines[0].thick = true;
underlines[0].color = 0xffd3d3d3;
underlines[1].startOffset = targetStart;
underlines[1].endOffset = targetEnd;
underlines[1].thick = true;
underlines[1].color = 0xff000000;
underlines[2].startOffset = targetEnd;
underlines[2].endOffset = static_cast<unsigned>(imeString.length());
underlines[2].thick = true;
underlines[2].color = 0xffd3d3d3;
return setComposition(imeString, underlines, cursorPosition, cursorPosition);
}
if (command == WebKit::WebCompositionCommandDiscard)
setComposition(WebString(), WebVector<WebCompositionUnderline>(), 0, 0);
else if (command == WebKit::WebCompositionCommandConfirm) {
setComposition(imeString, WebVector<WebCompositionUnderline>(), 0, 0);
confirmComposition();
}
return true;
}
bool WebViewImpl::setComposition(
const WebString& text,
const WebVector<WebCompositionUnderline>& underlines,
......@@ -1284,41 +1242,6 @@ bool WebViewImpl::confirmComposition()
return true;
}
// DEPRECATED, will be removed later.
bool WebViewImpl::queryCompositionStatus(bool* enableIME, WebRect* caretRect)
{
// Store whether the selected node needs IME and the caret rectangle.
// This process consists of the following four steps:
// 1. Retrieve the selection controller of the focused frame;
// 2. Retrieve the caret rectangle from the controller;
// 3. Convert the rectangle, which is relative to the parent view, to the
// one relative to the client window, and;
// 4. Store the converted rectangle.
const Frame* focused = focusedWebCoreFrame();
if (!focused)
return false;
const Editor* editor = focused->editor();
if (!editor || !editor->canEdit())
return false;
SelectionController* controller = focused->selection();
if (!controller)
return false;
const Node* node = controller->start().node();
if (!node)
return false;
*enableIME = node->shouldUseInputMethod() && !controller->isInPasswordField();
const FrameView* view = node->document()->view();
if (!view)
return false;
*caretRect = view->contentsToWindow(controller->absoluteCaretBounds());
return true;
}
WebTextInputType WebViewImpl::textInputType()
{
WebTextInputType type = WebTextInputTypeNone;
......
......@@ -93,22 +93,12 @@ public:
virtual bool handleInputEvent(const WebInputEvent&);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
// DEPRECATED, will be removed later.
virtual bool handleCompositionEvent(WebCompositionCommand command,
int cursorPosition,
int targetStart,
int targetEnd,
const WebString& text);
virtual bool setComposition(
const WebString& text,
const WebVector<WebCompositionUnderline>& underlines,
int selectionStart,
int selectionEnd);
virtual bool confirmComposition();
// DEPRECATED, will be removed later.
virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect);
virtual WebTextInputType textInputType();
virtual WebRect caretOrSelectionBounds();
virtual void setTextDirection(WebTextDirection direction);
......
......@@ -122,12 +122,14 @@ public:
virtual bool handleInputEvent(const WebInputEvent&) { return true; }
virtual void mouseCaptureLost() { }
virtual void setFocus(bool) { }
virtual bool handleCompositionEvent(WebCompositionCommand command,
int cursorPosition,
int targetStart,
int targetEnd,
const WebString& text) { return true; }
virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) { return true; }
virtual bool setComposition(
const WebString& text,
const WebVector<WebCompositionUnderline>& underlines,
int selectionStart,
int selectionEnd) { return true; }
virtual bool confirmComposition() { return true; }
virtual WebTextInputType textInputType() { return WebKit::WebTextInputTypeNone; }
virtual WebRect caretOrSelectionBounds() { return WebRect(); }
virtual void setTextDirection(WebTextDirection) { }
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment