Rename CompositionUnderline to ImeTextSpan
This class (of which we have three versions: ui::CompositionUnderline,
blink::WebCompositionUnderline, and blink::CompositionUnderline) is
poorly-named, since it's not just used for composition underlines, it's also
used by IMEs to add background highlighting. The name is going to get even worse
once we start also using it to pass Android SuggestionSpans into editing code
(see crbug.com/672259). I talked to changwan@ and he thinks ImeSpan is a better
name for this class.
This CL renames these classes, and also all the variables named "underlines"
that store instances of these classes.
[email protected],[email protected]
Bug: 672259
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I065656eb29880e70aef32545a3a43b8cfd53cf5b
Reviewed-on: https://chromium-review.googlesource.com/609524
Commit-Queue: Ryan Landay <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Yoshifumi Inoue <[email protected]>
Reviewed-by: Changwan Ryu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#493934}
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 378c891..9ffada491 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -126,13 +126,13 @@
"+third_party/WebKit/public/platform/reporting.mojom.h",
"+third_party/WebKit/public/public_features.h",
"+third_party/WebKit/public/web/WebAXEnums.h",
- "+third_party/WebKit/public/web/WebCompositionUnderline.h",
"+third_party/WebKit/public/web/WebConsoleMessage.h",
"+third_party/WebKit/public/web/WebContextMenuData.h",
"+third_party/WebKit/public/web/WebDeviceEmulationParams.h",
"+third_party/WebKit/public/web/WebDragStatus.h",
"+third_party/WebKit/public/web/WebFindOptions.h",
"+third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h",
+ "+third_party/WebKit/public/web/WebImeTextSpan.h",
"+third_party/WebKit/public/web/WebMediaPlayerAction.h",
"+third_party/WebKit/public/web/WebPluginAction.h",
"+third_party/WebKit/public/web/WebPopupType.h",
diff --git a/content/browser/android/ime_adapter_android.cc b/content/browser/android/ime_adapter_android.cc
index d23bbe9..275e2468 100644
--- a/content/browser/android/ime_adapter_android.cc
+++ b/content/browser/android/ime_adapter_android.cc
@@ -27,7 +27,7 @@
#include "jni/ImeAdapter_jni.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebTextInputType.h"
-#include "ui/base/ime/composition_underline.h"
+#include "ui/base/ime/ime_text_span.h"
using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF16;
@@ -73,37 +73,37 @@
}
// Callback from Java to convert BackgroundColorSpan data to a
-// ui::CompositionUnderline instance, and append it to |underlines_ptr|.
+// ui::ImeTextSpan instance, and append it to |ime_text_spans_ptr|.
void AppendBackgroundColorSpan(JNIEnv*,
const JavaParamRef<jclass>&,
- jlong underlines_ptr,
+ jlong ime_text_spans_ptr,
jint start,
jint end,
jint background_color) {
DCHECK_GE(start, 0);
DCHECK_GE(end, 0);
// Do not check |background_color|.
- std::vector<ui::CompositionUnderline>* underlines =
- reinterpret_cast<std::vector<ui::CompositionUnderline>*>(underlines_ptr);
- underlines->push_back(ui::CompositionUnderline(
+ std::vector<ui::ImeTextSpan>* ime_text_spans =
+ reinterpret_cast<std::vector<ui::ImeTextSpan>*>(ime_text_spans_ptr);
+ ime_text_spans->push_back(ui::ImeTextSpan(
static_cast<unsigned>(start), static_cast<unsigned>(end),
SK_ColorTRANSPARENT, false, static_cast<unsigned>(background_color)));
}
// Callback from Java to convert UnderlineSpan data to a
-// ui::CompositionUnderline instance, and append it to |underlines_ptr|.
+// ui::ImeTextSpan instance, and append it to |ime_text_spans_ptr|.
void AppendUnderlineSpan(JNIEnv*,
const JavaParamRef<jclass>&,
- jlong underlines_ptr,
+ jlong ime_text_spans_ptr,
jint start,
jint end) {
DCHECK_GE(start, 0);
DCHECK_GE(end, 0);
- std::vector<ui::CompositionUnderline>* underlines =
- reinterpret_cast<std::vector<ui::CompositionUnderline>*>(underlines_ptr);
- underlines->push_back(ui::CompositionUnderline(
- static_cast<unsigned>(start), static_cast<unsigned>(end), SK_ColorBLACK,
- false, SK_ColorTRANSPARENT));
+ std::vector<ui::ImeTextSpan>* ime_text_spans =
+ reinterpret_cast<std::vector<ui::ImeTextSpan>*>(ime_text_spans_ptr);
+ ime_text_spans->push_back(
+ ui::ImeTextSpan(static_cast<unsigned>(start), static_cast<unsigned>(end),
+ SK_ColorBLACK, false, SK_ColorTRANSPARENT));
}
ImeAdapterAndroid::ImeAdapterAndroid(JNIEnv* env,
@@ -210,13 +210,13 @@
base::string16 text16 = ConvertJavaStringToUTF16(env, text_str);
- std::vector<ui::CompositionUnderline> underlines =
- GetUnderlinesFromSpans(env, obj, text, text16);
+ std::vector<ui::ImeTextSpan> ime_text_spans =
+ GetImeTextSpansFromJava(env, obj, text, text16);
// Default to plain underline if we didn't find any span that we care about.
- if (underlines.empty()) {
- underlines.push_back(ui::CompositionUnderline(
- 0, text16.length(), SK_ColorBLACK, false, SK_ColorTRANSPARENT));
+ if (ime_text_spans.empty()) {
+ ime_text_spans.push_back(ui::ImeTextSpan(0, text16.length(), SK_ColorBLACK,
+ false, SK_ColorTRANSPARENT));
}
// relative_cursor_pos is as described in the Android API for
@@ -225,7 +225,7 @@
if (relative_cursor_pos > 0)
relative_cursor_pos = text16.length() + relative_cursor_pos - 1;
- rwhi->ImeSetComposition(text16, underlines, gfx::Range::InvalidRange(),
+ rwhi->ImeSetComposition(text16, ime_text_spans, gfx::Range::InvalidRange(),
relative_cursor_pos, relative_cursor_pos);
}
@@ -240,8 +240,8 @@
base::string16 text16 = ConvertJavaStringToUTF16(env, text_str);
- std::vector<ui::CompositionUnderline> underlines =
- GetUnderlinesFromSpans(env, obj, text, text16);
+ std::vector<ui::ImeTextSpan> ime_text_spans =
+ GetImeTextSpansFromJava(env, obj, text, text16);
// relative_cursor_pos is as described in the Android API for
// InputConnection#commitText, whereas the parameters for
@@ -251,7 +251,7 @@
else
relative_cursor_pos -= text16.length();
- rwhi->ImeCommitText(text16, underlines, gfx::Range::InvalidRange(),
+ rwhi->ImeCommitText(text16, ime_text_spans, gfx::Range::InvalidRange(),
relative_cursor_pos);
}
@@ -336,12 +336,12 @@
if (!rfh)
return;
- std::vector<ui::CompositionUnderline> underlines;
- underlines.push_back(ui::CompositionUnderline(0, end - start, SK_ColorBLACK,
- false, SK_ColorTRANSPARENT));
+ std::vector<ui::ImeTextSpan> ime_text_spans;
+ ime_text_spans.push_back(ui::ImeTextSpan(0, end - start, SK_ColorBLACK, false,
+ SK_ColorTRANSPARENT));
rfh->GetFrameInputHandler()->SetCompositionFromExistingText(start, end,
- underlines);
+ ime_text_spans);
}
void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*,
@@ -412,22 +412,22 @@
return nullptr;
}
-std::vector<ui::CompositionUnderline> ImeAdapterAndroid::GetUnderlinesFromSpans(
+std::vector<ui::ImeTextSpan> ImeAdapterAndroid::GetImeTextSpansFromJava(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& text,
const base::string16& text16) {
- std::vector<ui::CompositionUnderline> underlines;
+ std::vector<ui::ImeTextSpan> ime_text_spans;
// Iterate over spans in |text|, dispatch those that we care about (e.g.,
// BackgroundColorSpan) to a matching callback (e.g.,
- // AppendBackgroundColorSpan()), and populate |underlines|.
- Java_ImeAdapter_populateUnderlinesFromSpans(
- env, obj, text, reinterpret_cast<jlong>(&underlines));
+ // AppendBackgroundColorSpan()), and populate |ime_text_spans|.
+ Java_ImeAdapter_populateImeTextSpansFromJava(
+ env, obj, text, reinterpret_cast<jlong>(&ime_text_spans));
// Sort spans by |.startOffset|.
- std::sort(underlines.begin(), underlines.end());
+ std::sort(ime_text_spans.begin(), ime_text_spans.end());
- return underlines;
+ return ime_text_spans;
}
} // namespace content
diff --git a/content/browser/android/ime_adapter_android.h b/content/browser/android/ime_adapter_android.h
index 06bd658..9e591fe 100644
--- a/content/browser/android/ime_adapter_android.h
+++ b/content/browser/android/ime_adapter_android.h
@@ -16,7 +16,7 @@
namespace ui {
-struct CompositionUnderline;
+struct ImeTextSpan;
} // namespace ui
@@ -113,7 +113,7 @@
private:
RenderWidgetHostImpl* GetFocusedWidget();
RenderFrameHost* GetFocusedFrame();
- std::vector<ui::CompositionUnderline> GetUnderlinesFromSpans(
+ std::vector<ui::ImeTextSpan> GetImeTextSpansFromJava(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& text,
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 0eed74e..e44dd5ab 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -62,15 +62,16 @@
namespace {
-std::vector<ui::CompositionUnderline> ConvertToUiUnderline(
- const std::vector<blink::WebCompositionUnderline>& underlines) {
- std::vector<ui::CompositionUnderline> ui_underlines;
- for (const auto& underline : underlines) {
- ui_underlines.emplace_back(ui::CompositionUnderline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color));
+std::vector<ui::ImeTextSpan> ConvertToUiImeTextSpan(
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans) {
+ std::vector<ui::ImeTextSpan> ui_ime_text_spans;
+ for (const auto& ime_text_span : ime_text_spans) {
+ ui_ime_text_spans.emplace_back(
+ ui::ImeTextSpan(ime_text_span.start_offset, ime_text_span.end_offset,
+ ime_text_span.color, ime_text_span.thick,
+ ime_text_span.background_color));
}
- return ui_underlines;
+ return ui_ime_text_spans;
}
}; // namespace
@@ -929,29 +930,30 @@
void BrowserPluginGuest::OnImeSetComposition(
int browser_plugin_instance_id,
const BrowserPluginHostMsg_SetComposition_Params& params) {
- std::vector<ui::CompositionUnderline> ui_underlines =
- ConvertToUiUnderline(params.underlines);
+ std::vector<ui::ImeTextSpan> ui_ime_text_spans =
+ ConvertToUiImeTextSpan(params.ime_text_spans);
GetWebContents()
->GetRenderViewHost()
->GetWidget()
->GetWidgetInputHandler()
- ->ImeSetComposition(params.text, ui_underlines, params.replacement_range,
- params.selection_start, params.selection_end);
+ ->ImeSetComposition(params.text, ui_ime_text_spans,
+ params.replacement_range, params.selection_start,
+ params.selection_end);
}
void BrowserPluginGuest::OnImeCommitText(
int browser_plugin_instance_id,
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos) {
- std::vector<ui::CompositionUnderline> ui_underlines =
- ConvertToUiUnderline(underlines);
+ std::vector<ui::ImeTextSpan> ui_ime_text_spans =
+ ConvertToUiImeTextSpan(ime_text_spans);
GetWebContents()
->GetRenderViewHost()
->GetWidget()
->GetWidgetInputHandler()
- ->ImeCommitText(text, ui_underlines, replacement_range,
+ ->ImeCommitText(text, ui_ime_text_spans, replacement_range,
relative_cursor_pos);
}
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 725b77d..ac97e22 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -38,8 +38,8 @@
#include "third_party/WebKit/public/platform/WebDragOperation.h"
#include "third_party/WebKit/public/platform/WebFocusType.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebDragStatus.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "ui/base/ime/text_input_mode.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/geometry/rect.h"
@@ -336,12 +336,11 @@
void OnImeSetComposition(
int instance_id,
const BrowserPluginHostMsg_SetComposition_Params& params);
- void OnImeCommitText(
- int instance_id,
- const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
- const gfx::Range& replacement_range,
- int relative_cursor_pos);
+ void OnImeCommitText(int instance_id,
+ const base::string16& text,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const gfx::Range& replacement_range,
+ int relative_cursor_pos);
void OnImeFinishComposingText(int instance_id, bool keep_selection);
void OnExtendSelectionAndDelete(int instance_id, int before, int after);
void OnImeCancelComposition();
diff --git a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
index 849d9c1..b44c9e5 100644
--- a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
+++ b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
@@ -20,17 +20,18 @@
void LegacyIPCFrameInputHandler::SetCompositionFromExistingText(
int32_t start,
int32_t end,
- const std::vector<ui::CompositionUnderline>& ui_underlines) {
- std::vector<blink::WebCompositionUnderline> underlines;
- for (const auto& underline : ui_underlines) {
- blink::WebCompositionUnderline blink_underline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color);
- underlines.push_back(blink_underline);
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ for (const auto& ime_text_span : ui_ime_text_spans) {
+ blink::WebImeTextSpan blink_ime_text_span(
+ ime_text_span.start_offset, ime_text_span.end_offset,
+ ime_text_span.color, ime_text_span.thick,
+ ime_text_span.background_color);
+ ime_text_spans.push_back(blink_ime_text_span);
}
SendInput(base::MakeUnique<InputMsg_SetCompositionFromExistingText>(
- routing_id_, start, end, underlines));
+ routing_id_, start, end, ime_text_spans));
}
void LegacyIPCFrameInputHandler::ExtendSelectionAndDelete(int32_t before,
diff --git a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.h b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.h
index 7a10e51..c46e6940 100644
--- a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.h
+++ b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.h
@@ -24,7 +24,7 @@
void SetCompositionFromExistingText(
int32_t start,
int32_t end,
- const std::vector<ui::CompositionUnderline>& underlines) override;
+ const std::vector<ui::ImeTextSpan>& ime_text_spans) override;
void ExtendSelectionAndDelete(int32_t before, int32_t after) override;
void DeleteSurroundingText(int32_t before, int32_t after) override;
void DeleteSurroundingTextInCodePoints(int32_t before,
diff --git a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc
index 12f039c..282843f 100644
--- a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc
+++ b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc
@@ -13,15 +13,16 @@
namespace content {
namespace {
-std::vector<blink::WebCompositionUnderline> ConvertToBlinkUnderline(
- const std::vector<ui::CompositionUnderline>& ui_underlines) {
- std::vector<blink::WebCompositionUnderline> underlines;
- for (const auto& underline : ui_underlines) {
- underlines.emplace_back(blink::WebCompositionUnderline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color));
+std::vector<blink::WebImeTextSpan> ConvertToBlinkImeTextSpan(
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ for (const auto& ime_text_span : ui_ime_text_spans) {
+ ime_text_spans.emplace_back(blink::WebImeTextSpan(
+ ime_text_span.start_offset, ime_text_span.end_offset,
+ ime_text_span.color, ime_text_span.thick,
+ ime_text_span.background_color));
}
- return underlines;
+ return ime_text_spans;
}
} // namespace
@@ -29,7 +30,6 @@
LegacyIPCWidgetInputHandler::LegacyIPCWidgetInputHandler(
LegacyInputRouterImpl* input_router)
: input_router_(input_router) {}
-
LegacyIPCWidgetInputHandler::~LegacyIPCWidgetInputHandler() {}
void LegacyIPCWidgetInputHandler::SetFocus(bool focused) {
@@ -52,25 +52,25 @@
void LegacyIPCWidgetInputHandler::ImeSetComposition(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& ui_underlines,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans,
const gfx::Range& range,
int32_t start,
int32_t end) {
- std::vector<blink::WebCompositionUnderline> underlines =
- ConvertToBlinkUnderline(ui_underlines);
+ std::vector<blink::WebImeTextSpan> ime_text_spans =
+ ConvertToBlinkImeTextSpan(ui_ime_text_spans);
SendInput(base::MakeUnique<InputMsg_ImeSetComposition>(
- input_router_->routing_id(), text, underlines, range, start, end));
+ input_router_->routing_id(), text, ime_text_spans, range, start, end));
}
void LegacyIPCWidgetInputHandler::ImeCommitText(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& ui_underlines,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) {
- std::vector<blink::WebCompositionUnderline> underlines =
- ConvertToBlinkUnderline(ui_underlines);
+ std::vector<blink::WebImeTextSpan> ime_text_spans =
+ ConvertToBlinkImeTextSpan(ui_ime_text_spans);
SendInput(base::MakeUnique<InputMsg_ImeCommitText>(
- input_router_->routing_id(), text, underlines, range,
+ input_router_->routing_id(), text, ime_text_spans, range,
relative_cursor_position));
}
diff --git a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.h b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.h
index 9bc8f0c6..7bfd9e7 100644
--- a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.h
+++ b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.h
@@ -27,14 +27,13 @@
void SetEditCommandsForNextKeyEvent(
const std::vector<EditCommand>& commands) override;
void CursorVisibilityChanged(bool visible) override;
- void ImeSetComposition(
- const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
- const gfx::Range& range,
- int32_t start,
- int32_t end) override;
+ void ImeSetComposition(const base::string16& text,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
+ const gfx::Range& range,
+ int32_t start,
+ int32_t end) override;
void ImeCommitText(const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) override;
void ImeFinishComposingText(bool keep_selection) override;
diff --git a/content/browser/renderer_host/input/mock_widget_input_handler.cc b/content/browser/renderer_host/input/mock_widget_input_handler.cc
index df93838..5e9c0f7 100644
--- a/content/browser/renderer_host/input/mock_widget_input_handler.cc
+++ b/content/browser/renderer_host/input/mock_widget_input_handler.cc
@@ -32,14 +32,14 @@
void MockWidgetInputHandler::ImeSetComposition(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t start,
int32_t end) {}
void MockWidgetInputHandler::ImeCommitText(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) {}
diff --git a/content/browser/renderer_host/input/mock_widget_input_handler.h b/content/browser/renderer_host/input/mock_widget_input_handler.h
index 8eb481b..adae4d3 100644
--- a/content/browser/renderer_host/input/mock_widget_input_handler.h
+++ b/content/browser/renderer_host/input/mock_widget_input_handler.h
@@ -36,14 +36,13 @@
void SetEditCommandsForNextKeyEvent(
const std::vector<content::EditCommand>& commands) override;
void CursorVisibilityChanged(bool visible) override;
- void ImeSetComposition(
- const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
- const gfx::Range& range,
- int32_t start,
- int32_t end) override;
+ void ImeSetComposition(const base::string16& text,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
+ const gfx::Range& range,
+ int32_t start,
+ int32_t end) override;
void ImeCommitText(const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) override;
void ImeFinishComposingText(bool keep_selection) override;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 66146f0..4d07580 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -83,7 +83,7 @@
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
#include "storage/browser/fileapi/isolated_context.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/ui_base_switches.h"
#include "ui/display/display_switches.h"
@@ -1719,21 +1719,21 @@
void RenderWidgetHostImpl::ImeSetComposition(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int selection_start,
int selection_end) {
GetWidgetInputHandler()->ImeSetComposition(
- text, underlines, replacement_range, selection_start, selection_end);
+ text, ime_text_spans, replacement_range, selection_start, selection_end);
}
void RenderWidgetHostImpl::ImeCommitText(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos) {
- GetWidgetInputHandler()->ImeCommitText(text, underlines, replacement_range,
- relative_cursor_pos);
+ GetWidgetInputHandler()->ImeCommitText(
+ text, ime_text_spans, replacement_range, relative_cursor_pos);
}
void RenderWidgetHostImpl::ImeFinishComposingText(bool keep_selection) {
@@ -1741,9 +1741,9 @@
}
void RenderWidgetHostImpl::ImeCancelComposition() {
- GetWidgetInputHandler()->ImeSetComposition(
- base::string16(), std::vector<ui::CompositionUnderline>(),
- gfx::Range::InvalidRange(), 0, 0);
+ GetWidgetInputHandler()->ImeSetComposition(base::string16(),
+ std::vector<ui::ImeTextSpan>(),
+ gfx::Range::InvalidRange(), 0, 0);
}
void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 8cc27498..52b5fa9 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -415,12 +415,11 @@
// (on Windows);
// * when it receives a "preedit_changed" signal of GtkIMContext (on Linux);
// * when markedText of NSTextInput is called (on Mac).
- void ImeSetComposition(
- const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
- const gfx::Range& replacement_range,
- int selection_start,
- int selection_end);
+ void ImeSetComposition(const base::string16& text,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
+ const gfx::Range& replacement_range,
+ int selection_start,
+ int selection_end);
// Deletes the ongoing composition if any, inserts the specified text, and
// moves the cursor.
@@ -430,7 +429,7 @@
// * when it receives a "commit" signal of GtkIMContext (on Linux);
// * when insertText of NSTextInput is called (on Mac).
void ImeCommitText(const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index ffd1e2ee..f693b0e3 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -61,7 +61,7 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "services/ui/public/interfaces/window_manager_constants.mojom.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "ui/accessibility/platform/aura_window_properties.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
@@ -1191,7 +1191,7 @@
// TODO(suzhe): due to a bug of webkit, we can't use selection range with
// composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
text_input_manager_->GetActiveWidget()->ImeSetComposition(
- composition.text, composition.underlines, gfx::Range::InvalidRange(),
+ composition.text, composition.ime_text_spans, gfx::Range::InvalidRange(),
composition.selection.end(), composition.selection.end());
has_composition_text_ = !composition.text.empty();
@@ -1218,8 +1218,7 @@
if (text_input_manager_ && text_input_manager_->GetActiveWidget()) {
if (text.length())
text_input_manager_->GetActiveWidget()->ImeCommitText(
- text, std::vector<ui::CompositionUnderline>(),
- gfx::Range::InvalidRange(), 0);
+ text, std::vector<ui::ImeTextSpan>(), gfx::Range::InvalidRange(), 0);
else if (has_composition_text_)
text_input_manager_->GetActiveWidget()->ImeFinishComposingText(false);
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index fa9609c..c111633 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -1648,14 +1648,14 @@
composition_text.text = base::ASCIIToUTF16("|a|b");
// Focused segment
- composition_text.underlines.push_back(
- ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412));
+ composition_text.ime_text_spans.push_back(
+ ui::ImeTextSpan(0, 3, 0xff000000, true, 0x78563412));
// Non-focused segment, with different background color.
- composition_text.underlines.push_back(
- ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90));
+ composition_text.ime_text_spans.push_back(
+ ui::ImeTextSpan(3, 4, 0xff000000, false, 0xefcdab90));
- const ui::CompositionUnderlines& underlines = composition_text.underlines;
+ const ui::ImeTextSpans& ime_text_spans = composition_text.ime_text_spans;
// Caret is at the end. (This emulates Japanese MSIME 2007 and later)
composition_text.selection = gfx::Range(4);
@@ -1672,15 +1672,16 @@
InputMsg_ImeSetComposition::Read(msg, ¶ms);
// composition text
EXPECT_EQ(composition_text.text, std::get<0>(params));
- // underlines
- ASSERT_EQ(underlines.size(), std::get<1>(params).size());
- for (size_t i = 0; i < underlines.size(); ++i) {
- EXPECT_EQ(underlines[i].start_offset,
+ // ime spans
+ ASSERT_EQ(ime_text_spans.size(), std::get<1>(params).size());
+ for (size_t i = 0; i < ime_text_spans.size(); ++i) {
+ EXPECT_EQ(ime_text_spans[i].start_offset,
std::get<1>(params)[i].start_offset);
- EXPECT_EQ(underlines[i].end_offset, std::get<1>(params)[i].end_offset);
- EXPECT_EQ(underlines[i].color, std::get<1>(params)[i].color);
- EXPECT_EQ(underlines[i].thick, std::get<1>(params)[i].thick);
- EXPECT_EQ(underlines[i].background_color,
+ EXPECT_EQ(ime_text_spans[i].end_offset,
+ std::get<1>(params)[i].end_offset);
+ EXPECT_EQ(ime_text_spans[i].color, std::get<1>(params)[i].color);
+ EXPECT_EQ(ime_text_spans[i].thick, std::get<1>(params)[i].thick);
+ EXPECT_EQ(ime_text_spans[i].background_color,
std::get<1>(params)[i].background_color);
}
EXPECT_EQ(gfx::Range::InvalidRange(), std::get<2>(params));
@@ -1704,12 +1705,12 @@
composition_text.text = base::ASCIIToUTF16("|a|b");
// Focused segment
- composition_text.underlines.push_back(
- ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412));
+ composition_text.ime_text_spans.push_back(
+ ui::ImeTextSpan(0, 3, 0xff000000, true, 0x78563412));
// Non-focused segment, with different background color.
- composition_text.underlines.push_back(
- ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90));
+ composition_text.ime_text_spans.push_back(
+ ui::ImeTextSpan(3, 4, 0xff000000, false, 0xefcdab90));
// Caret is at the end. (This emulates Japanese MSIME 2007 and later)
composition_text.selection = gfx::Range(4);
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 9374bf3..72664cd 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -37,7 +37,7 @@
#import "ui/base/cocoa/command_dispatcher.h"
#include "ui/base/cocoa/remote_layer_api.h"
#import "ui/base/cocoa/tool_tip_base_view.h"
-#include "ui/base/ime/composition_underline.h"
+#include "ui/base/ime/ime_text_span.h"
#include "ui/display/display_observer.h"
namespace content {
@@ -127,7 +127,7 @@
NSRange markedTextSelectedRange_;
// Underline information of the |markedText_|.
- std::vector<ui::CompositionUnderline> underlines_;
+ std::vector<ui::ImeTextSpan> ime_text_spans_;
// Replacement range information received from |setMarkedText:|.
gfx::Range setMarkedTextReplacementRange_;
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 db0fb3681..d61f81f 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -280,7 +280,7 @@
// Extract underline information from an attributed string. Mostly copied from
// third_party/WebKit/Source/WebKit/mac/WebView/WebHTMLView.mm
void ExtractUnderlines(NSAttributedString* string,
- std::vector<ui::CompositionUnderline>* underlines) {
+ std::vector<ui::ImeTextSpan>* ime_text_spans) {
int length = [[string string] length];
int i = 0;
while (i < length) {
@@ -295,9 +295,9 @@
color = WebColorFromNSColor(
[colorAttr colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
}
- underlines->push_back(
- ui::CompositionUnderline(range.location, NSMaxRange(range), color,
- [style intValue] > 1, SK_ColorTRANSPARENT));
+ ime_text_spans->push_back(
+ ui::ImeTextSpan(range.location, NSMaxRange(range), color,
+ [style intValue] > 1, SK_ColorTRANSPARENT));
}
i = range.location + range.length;
}
@@ -2197,7 +2197,7 @@
textToBeInserted_.clear();
markedText_.clear();
markedTextSelectedRange_ = NSMakeRange(NSNotFound, 0);
- underlines_.clear();
+ ime_text_spans_.clear();
setMarkedTextReplacementRange_ = gfx::Range::InvalidRange();
unmarkTextCalled_ = NO;
hasEditCommands_ = NO;
@@ -2259,8 +2259,7 @@
BOOL textInserted = NO;
if (textToBeInserted_.length() >
((hasMarkedText_ || oldHasMarkedText) ? 0u : 1u)) {
- widgetHost->ImeCommitText(textToBeInserted_,
- std::vector<ui::CompositionUnderline>(),
+ widgetHost->ImeCommitText(textToBeInserted_, std::vector<ui::ImeTextSpan>(),
gfx::Range::InvalidRange(), 0);
textInserted = YES;
}
@@ -2272,7 +2271,7 @@
// composition node in WebKit.
// When marked text is available, |markedTextSelectedRange_| will be the
// range being selected inside the marked text.
- widgetHost->ImeSetComposition(markedText_, underlines_,
+ widgetHost->ImeSetComposition(markedText_, ime_text_spans_,
setMarkedTextReplacementRange_,
markedTextSelectedRange_.location,
NSMaxRange(markedTextSelectedRange_));
@@ -3306,7 +3305,7 @@
hasMarkedText_ = NO;
markedText_.clear();
markedTextSelectedRange_ = NSMakeRange(NSNotFound, 0);
- underlines_.clear();
+ ime_text_spans_.clear();
// If we are handling a key down event, then FinishComposingText() will be
// called in keyEvent: method.
@@ -3335,13 +3334,13 @@
markedText_ = base::SysNSStringToUTF16(im_text);
hasMarkedText_ = (length > 0);
- underlines_.clear();
+ ime_text_spans_.clear();
if (isAttributedString) {
- ExtractUnderlines(string, &underlines_);
+ ExtractUnderlines(string, &ime_text_spans_);
} else {
// Use a thin black underline by default.
- underlines_.push_back(ui::CompositionUnderline(0, length, SK_ColorBLACK,
- false, SK_ColorTRANSPARENT));
+ ime_text_spans_.push_back(
+ ui::ImeTextSpan(0, length, SK_ColorBLACK, false, SK_ColorTRANSPARENT));
}
// If we are handling a key down event, then SetComposition() will be
@@ -3356,7 +3355,7 @@
} else {
if (renderWidgetHostView_->GetActiveWidget()) {
renderWidgetHostView_->GetActiveWidget()->ImeSetComposition(
- markedText_, underlines_, gfx::Range(replacementRange),
+ markedText_, ime_text_spans_, gfx::Range(replacementRange),
newSelRange.location, NSMaxRange(newSelRange));
}
}
@@ -3415,8 +3414,8 @@
gfx::Range replacement_range(replacementRange);
if (renderWidgetHostView_->GetActiveWidget()) {
renderWidgetHostView_->GetActiveWidget()->ImeCommitText(
- base::SysNSStringToUTF16(im_text),
- std::vector<ui::CompositionUnderline>(), replacement_range, 0);
+ base::SysNSStringToUTF16(im_text), std::vector<ui::ImeTextSpan>(),
+ replacement_range, 0);
}
}
diff --git a/content/common/DEPS b/content/common/DEPS
index 736590dd..c0da6de2 100644
--- a/content/common/DEPS
+++ b/content/common/DEPS
@@ -65,12 +65,12 @@
"+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h",
"+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h",
"+third_party/WebKit/public/web/WebAXEnums.h",
- "+third_party/WebKit/public/web/WebCompositionUnderline.h",
"+third_party/WebKit/public/web/WebDeviceEmulationParams.h",
"+third_party/WebKit/public/web/WebDragStatus.h",
"+third_party/WebKit/public/web/WebFindOptions.h",
"+third_party/WebKit/public/web/WebFrameOwnerProperties.h",
"+third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h",
+ "+third_party/WebKit/public/web/WebImeTextSpan.h",
"+third_party/WebKit/public/web/WebMediaPlayerAction.h",
"+third_party/WebKit/public/web/WebPluginAction.h",
"+third_party/WebKit/public/web/WebPopupType.h",
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h
index 57ac7ad..1258423 100644
--- a/content/common/browser_plugin/browser_plugin_messages.h
+++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -18,8 +18,8 @@
#include "ipc/ipc_message_utils.h"
#include "third_party/WebKit/public/platform/WebDragOperation.h"
#include "third_party/WebKit/public/platform/WebFocusType.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebDragStatus.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -45,7 +45,7 @@
IPC_STRUCT_BEGIN(BrowserPluginHostMsg_SetComposition_Params)
IPC_STRUCT_MEMBER(base::string16, text)
- IPC_STRUCT_MEMBER(std::vector<blink::WebCompositionUnderline>, underlines)
+ IPC_STRUCT_MEMBER(std::vector<blink::WebImeTextSpan>, ime_text_spans)
IPC_STRUCT_MEMBER(gfx::Range, replacement_range)
IPC_STRUCT_MEMBER(int, selection_start)
IPC_STRUCT_MEMBER(int, selection_end)
@@ -81,13 +81,12 @@
// This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
// deleting the current composition and inserting specified text is requested.
-IPC_MESSAGE_CONTROL5(
- BrowserPluginHostMsg_ImeCommitText,
- int /* browser_plugin_instance_id */,
- base::string16 /* text */,
- std::vector<blink::WebCompositionUnderline> /* underlines */,
- gfx::Range /* replacement_range */,
- int /* relative_cursor_pos */)
+IPC_MESSAGE_CONTROL5(BrowserPluginHostMsg_ImeCommitText,
+ int /* browser_plugin_instance_id */,
+ base::string16 /* text */,
+ std::vector<blink::WebImeTextSpan> /* ime_text_spans */,
+ gfx::Range /* replacement_range */,
+ int /* relative_cursor_pos */)
// This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
// inserting the current composition is requested.
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h
index a1187c78..9c5638e 100644
--- a/content/common/content_param_traits_macros.h
+++ b/content/common/content_param_traits_macros.h
@@ -21,7 +21,7 @@
#include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebSharedWorkerCreationContextType.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
@@ -52,7 +52,7 @@
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPageVisibilityState,
blink::kWebPageVisibilityStateLast)
-IPC_STRUCT_TRAITS_BEGIN(blink::WebCompositionUnderline)
+IPC_STRUCT_TRAITS_BEGIN(blink::WebImeTextSpan)
IPC_STRUCT_TRAITS_MEMBER(start_offset)
IPC_STRUCT_TRAITS_MEMBER(end_offset)
IPC_STRUCT_TRAITS_MEMBER(color)
diff --git a/content/common/input/input_handler.mojom b/content/common/input/input_handler.mojom
index 39cc748..2613a00 100644
--- a/content/common/input/input_handler.mojom
+++ b/content/common/input/input_handler.mojom
@@ -169,13 +169,13 @@
// This message sends a string being composed with an input method.
ImeSetComposition(mojo.common.mojom.String16 text,
- array<ui.mojom.CompositionUnderline> underlines,
+ array<ui.mojom.ImeTextSpan> ime_text_spans,
gfx.mojom.Range range, int32 start, int32 end);
// This message deletes the current composition, inserts specified text, and
// moves the cursor.
ImeCommitText(mojo.common.mojom.String16 text,
- array<ui.mojom.CompositionUnderline> underlines,
+ array<ui.mojom.ImeTextSpan> ime_text_spans,
gfx.mojom.Range range, int32 relative_cursor_position);
// This message inserts the ongoing composition.
@@ -216,7 +216,7 @@
// Sets the text composition to be between the given start and end offsets in
// the currently focused editable field.
SetCompositionFromExistingText(
- int32 start, int32 end, array<ui.mojom.CompositionUnderline> underlines);
+ int32 start, int32 end, array<ui.mojom.ImeTextSpan> ime_text_spans);
// Deletes the current selection plus the specified number of characters
// before and after the selection or caret.
diff --git a/content/common/input_messages.h b/content/common/input_messages.h
index 142f8db4..73dedb03 100644
--- a/content/common/input_messages.h
+++ b/content/common/input_messages.h
@@ -169,9 +169,9 @@
// Sets the text composition to be between the given start and end offsets in
// the currently focused editable field.
IPC_MESSAGE_ROUTED3(InputMsg_SetCompositionFromExistingText,
- int /* start */,
- int /* end */,
- std::vector<blink::WebCompositionUnderline> /* underlines */)
+ int /* start */,
+ int /* end */,
+ std::vector<blink::WebImeTextSpan> /* ime_text_spans */)
// Deletes the current selection plus the specified number of characters before
// and after the selection or caret.
@@ -201,22 +201,20 @@
int /* end */)
// This message sends a string being composed with an input method.
-IPC_MESSAGE_ROUTED5(
- InputMsg_ImeSetComposition,
- base::string16, /* text */
- std::vector<blink::WebCompositionUnderline>, /* underlines */
- gfx::Range /* replacement_range */,
- int, /* selectiont_start */
- int /* selection_end */)
+IPC_MESSAGE_ROUTED5(InputMsg_ImeSetComposition,
+ base::string16, /* text */
+ std::vector<blink::WebImeTextSpan>, /* ime_text_spans */
+ gfx::Range /* replacement_range */,
+ int, /* selectiont_start */
+ int /* selection_end */)
// This message deletes the current composition, inserts specified text, and
// moves the cursor.
-IPC_MESSAGE_ROUTED4(
- InputMsg_ImeCommitText,
- base::string16 /* text */,
- std::vector<blink::WebCompositionUnderline>, /* underlines */
- gfx::Range /* replacement_range */,
- int /* relative_cursor_pos */)
+IPC_MESSAGE_ROUTED4(InputMsg_ImeCommitText,
+ base::string16 /* text */,
+ std::vector<blink::WebImeTextSpan>, /* ime_text_spans */
+ gfx::Range /* replacement_range */,
+ int /* relative_cursor_pos */)
// This message inserts the ongoing composition.
IPC_MESSAGE_ROUTED1(InputMsg_ImeFinishComposingText, bool /* keep_selection */)
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
index 713b236..5370d225 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
@@ -872,9 +872,10 @@
}
@CalledByNative
- private void populateUnderlinesFromSpans(CharSequence text, long underlines) {
+ private void populateImeTextSpansFromJava(CharSequence text, long imeTextSpans) {
if (DEBUG_LOGS) {
- Log.i(TAG, "populateUnderlinesFromSpans: text [%s], underlines [%d]", text, underlines);
+ Log.i(TAG, "populateImeTextSpansFromJava: text [%s], ime_text_spans [%d]", text,
+ imeTextSpans);
}
if (!(text instanceof SpannableString)) return;
@@ -883,11 +884,11 @@
spannableString.getSpans(0, text.length(), CharacterStyle.class);
for (CharacterStyle span : spans) {
if (span instanceof BackgroundColorSpan) {
- nativeAppendBackgroundColorSpan(underlines, spannableString.getSpanStart(span),
+ nativeAppendBackgroundColorSpan(imeTextSpans, spannableString.getSpanStart(span),
spannableString.getSpanEnd(span),
((BackgroundColorSpan) span).getBackgroundColor());
} else if (span instanceof UnderlineSpan) {
- nativeAppendUnderlineSpan(underlines, spannableString.getSpanStart(span),
+ nativeAppendUnderlineSpan(imeTextSpans, spannableString.getSpanStart(span),
spannableString.getSpanEnd(span));
}
}
@@ -917,9 +918,9 @@
private native boolean nativeSendKeyEvent(long nativeImeAdapterAndroid, KeyEvent event,
int type, int modifiers, long timestampMs, int keyCode, int scanCode,
boolean isSystemKey, int unicodeChar);
- private static native void nativeAppendUnderlineSpan(long underlinePtr, int start, int end);
- private static native void nativeAppendBackgroundColorSpan(long underlinePtr, int start,
- int end, int backgroundColor);
+ private static native void nativeAppendUnderlineSpan(long spanPtr, int start, int end);
+ private static native void nativeAppendBackgroundColorSpan(
+ long spanPtr, int start, int end, int backgroundColor);
private native void nativeSetComposingText(long nativeImeAdapterAndroid, CharSequence text,
String textStr, int newCursorPosition);
private native void nativeCommitText(
diff --git a/content/public/test/text_input_test_utils.cc b/content/public/test/text_input_test_utils.cc
index 65ec8d2..1e7153a 100644
--- a/content/public/test/text_input_test_utils.cc
+++ b/content/public/test/text_input_test_utils.cc
@@ -22,8 +22,8 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/test_utils.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
-#include "ui/base/ime/composition_underline.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
+#include "ui/base/ime/ime_text_span.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/input_method_observer.h"
@@ -268,22 +268,22 @@
void SendImeCommitTextToWidget(
RenderWidgetHost* rwh,
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos) {
RenderWidgetHostImpl::From(rwh)->ImeCommitText(
- text, underlines, replacement_range, relative_cursor_pos);
+ text, ime_text_spans, replacement_range, relative_cursor_pos);
}
void SendImeSetCompositionTextToWidget(
RenderWidgetHost* rwh,
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int selection_start,
int selection_end) {
RenderWidgetHostImpl::From(rwh)->ImeSetComposition(
- text, underlines, replacement_range, selection_start, selection_end);
+ text, ime_text_spans, replacement_range, selection_start, selection_end);
}
bool DestroyRenderWidgetHost(int32_t process_id,
diff --git a/content/public/test/text_input_test_utils.h b/content/public/test/text_input_test_utils.h
index c8d9775..80c055c 100644
--- a/content/public/test/text_input_test_utils.h
+++ b/content/public/test/text_input_test_utils.h
@@ -26,7 +26,7 @@
}
namespace ui {
-struct CompositionUnderline;
+struct ImeTextSpan;
}
namespace content {
@@ -74,7 +74,7 @@
void SendImeCommitTextToWidget(
RenderWidgetHost* rwh,
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos);
@@ -83,7 +83,7 @@
void SendImeSetCompositionTextToWidget(
RenderWidgetHost* rwh,
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int selection_start,
int selection_end);
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 88ef96b5..9e281e4 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -551,7 +551,7 @@
bool BrowserPlugin::SetComposition(
const blink::WebString& text,
- const blink::WebVector<blink::WebCompositionUnderline>& underlines,
+ const blink::WebVector<blink::WebImeTextSpan>& ime_text_spans,
const blink::WebRange& replacementRange,
int selectionStart,
int selectionEnd) {
@@ -560,8 +560,8 @@
BrowserPluginHostMsg_SetComposition_Params params;
params.text = text.Utf16();
- for (size_t i = 0; i < underlines.size(); ++i) {
- params.underlines.push_back(underlines[i]);
+ for (size_t i = 0; i < ime_text_spans.size(); ++i) {
+ params.ime_text_spans.push_back(ime_text_spans[i]);
}
params.replacement_range =
@@ -580,15 +580,15 @@
bool BrowserPlugin::CommitText(
const blink::WebString& text,
- const blink::WebVector<blink::WebCompositionUnderline>& underlines,
+ const blink::WebVector<blink::WebImeTextSpan>& ime_text_spans,
const blink::WebRange& replacementRange,
int relative_cursor_pos) {
if (!attached())
return false;
- std::vector<blink::WebCompositionUnderline> std_underlines;
- for (size_t i = 0; i < underlines.size(); ++i) {
- std_underlines.push_back(underlines[i]);
+ std::vector<blink::WebImeTextSpan> std_ime_text_spans;
+ for (size_t i = 0; i < ime_text_spans.size(); ++i) {
+ std_ime_text_spans.push_back(ime_text_spans[i]);
}
gfx::Range replacement_range =
replacementRange.IsNull()
@@ -597,7 +597,7 @@
static_cast<uint32_t>(replacementRange.EndOffset()));
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ImeCommitText(
- browser_plugin_instance_id_, text.Utf16(), std_underlines,
+ browser_plugin_instance_id_, text.Utf16(), std_ime_text_spans,
replacement_range, relative_cursor_pos));
// TODO(kochi): This assumes the IPC handling always succeeds.
return true;
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index 637002e8..74abac0 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -14,8 +14,8 @@
#include "base/sequenced_task_runner_helpers.h"
#include "content/renderer/mouse_lock_dispatcher.h"
#include "content/renderer/render_view_impl.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebDragStatus.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebInputMethodController.h"
#include "third_party/WebKit/public/web/WebNode.h"
@@ -111,15 +111,14 @@
const blink::WebString& value) override;
bool SetComposition(
const blink::WebString& text,
- const blink::WebVector<blink::WebCompositionUnderline>& underlines,
+ const blink::WebVector<blink::WebImeTextSpan>& ime_text_spans,
const blink::WebRange& replacementRange,
int selectionStart,
int selectionEnd) override;
- bool CommitText(
- const blink::WebString& text,
- const blink::WebVector<blink::WebCompositionUnderline>& underlines,
- const blink::WebRange& replacementRange,
- int relative_cursor_pos) override;
+ bool CommitText(const blink::WebString& text,
+ const blink::WebVector<blink::WebImeTextSpan>& ime_text_spans,
+ const blink::WebRange& replacementRange,
+ int relative_cursor_pos) override;
bool FinishComposingText(
blink::WebInputMethodController::ConfirmCompositionBehavior
selection_behavior) override;
diff --git a/content/renderer/input/frame_input_handler_impl.cc b/content/renderer/input/frame_input_handler_impl.cc
index ba35f657..637ebdcb 100644
--- a/content/renderer/input/frame_input_handler_impl.cc
+++ b/content/renderer/input/frame_input_handler_impl.cc
@@ -66,11 +66,11 @@
void FrameInputHandlerImpl::SetCompositionFromExistingText(
int32_t start,
int32_t end,
- const std::vector<ui::CompositionUnderline>& ui_underlines) {
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
if (!main_thread_task_runner_->BelongsToCurrentThread()) {
RunOnMainThread(
base::Bind(&FrameInputHandlerImpl::SetCompositionFromExistingText,
- weak_this_, start, end, ui_underlines));
+ weak_this_, start, end, ui_ime_text_spans));
return;
}
@@ -78,16 +78,17 @@
return;
ImeEventGuard guard(render_frame_->GetRenderWidget());
- std::vector<blink::WebCompositionUnderline> underlines;
- for (const auto& underline : ui_underlines) {
- blink::WebCompositionUnderline blink_underline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color);
- underlines.push_back(blink_underline);
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ for (const auto& ime_text_span : ui_ime_text_spans) {
+ blink::WebImeTextSpan blink_ime_text_span(
+ ime_text_span.start_offset, ime_text_span.end_offset,
+ ime_text_span.color, ime_text_span.thick,
+ ime_text_span.background_color);
+ ime_text_spans.push_back(blink_ime_text_span);
}
render_frame_->GetWebFrame()->SetCompositionFromExistingText(start, end,
- underlines);
+ ime_text_spans);
}
void FrameInputHandlerImpl::ExtendSelectionAndDelete(int32_t before,
diff --git a/content/renderer/input/frame_input_handler_impl.h b/content/renderer/input/frame_input_handler_impl.h
index 705f816..6519950 100644
--- a/content/renderer/input/frame_input_handler_impl.h
+++ b/content/renderer/input/frame_input_handler_impl.h
@@ -44,7 +44,7 @@
void SetCompositionFromExistingText(
int32_t start,
int32_t end,
- const std::vector<ui::CompositionUnderline>& underlines) override;
+ const std::vector<ui::ImeTextSpan>& ime_text_spans) override;
void ExtendSelectionAndDelete(int32_t before, int32_t after) override;
void DeleteSurroundingText(int32_t before, int32_t after) override;
void DeleteSurroundingTextInCodePoints(int32_t before,
diff --git a/content/renderer/input/widget_input_handler_impl.cc b/content/renderer/input/widget_input_handler_impl.cc
index a042d773..d82da0f3 100644
--- a/content/renderer/input/widget_input_handler_impl.cc
+++ b/content/renderer/input/widget_input_handler_impl.cc
@@ -24,17 +24,17 @@
namespace {
-std::vector<blink::WebCompositionUnderline>
-ConvertUIUnderlinesToBlinkUnderlines(
- const std::vector<ui::CompositionUnderline>& ui_underlines) {
- std::vector<blink::WebCompositionUnderline> underlines;
- for (const auto& underline : ui_underlines) {
- blink::WebCompositionUnderline blink_underline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color);
- underlines.push_back(blink_underline);
+std::vector<blink::WebImeTextSpan> ConvertUIImeTextSpansToBlinkImeTextSpans(
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ for (const auto& ime_text_span : ui_ime_text_spans) {
+ blink::WebImeTextSpan blink_ime_text_span(
+ ime_text_span.start_offset, ime_text_span.end_offset,
+ ime_text_span.color, ime_text_span.thick,
+ ime_text_span.background_color);
+ ime_text_spans.push_back(blink_ime_text_span);
}
- return underlines;
+ return ime_text_spans;
}
} // namespace
@@ -89,24 +89,25 @@
void WidgetInputHandlerImpl::ImeSetComposition(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t start,
int32_t end) {
- RunOnMainThread(base::Bind(
- &RenderWidget::OnImeSetComposition, render_widget_, text,
- ConvertUIUnderlinesToBlinkUnderlines(underlines), range, start, end));
+ RunOnMainThread(
+ base::Bind(&RenderWidget::OnImeSetComposition, render_widget_, text,
+ ConvertUIImeTextSpansToBlinkImeTextSpans(ime_text_spans),
+ range, start, end));
}
void WidgetInputHandlerImpl::ImeCommitText(
const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) {
- RunOnMainThread(base::Bind(&RenderWidget::OnImeCommitText, render_widget_,
- text,
- ConvertUIUnderlinesToBlinkUnderlines(underlines),
- range, relative_cursor_position));
+ RunOnMainThread(
+ base::Bind(&RenderWidget::OnImeCommitText, render_widget_, text,
+ ConvertUIImeTextSpansToBlinkImeTextSpans(ime_text_spans),
+ range, relative_cursor_position));
}
void WidgetInputHandlerImpl::ImeFinishComposingText(bool keep_selection) {
diff --git a/content/renderer/input/widget_input_handler_impl.h b/content/renderer/input/widget_input_handler_impl.h
index c05ac43..5c5cddc2 100644
--- a/content/renderer/input/widget_input_handler_impl.h
+++ b/content/renderer/input/widget_input_handler_impl.h
@@ -36,14 +36,13 @@
void SetEditCommandsForNextKeyEvent(
const std::vector<EditCommand>& commands) override;
void CursorVisibilityChanged(bool visible) override;
- void ImeSetComposition(
- const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
- const gfx::Range& range,
- int32_t start,
- int32_t end) override;
+ void ImeSetComposition(const base::string16& text,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
+ const gfx::Range& range,
+ int32_t start,
+ int32_t end) override;
void ImeCommitText(const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
const gfx::Range& range,
int32_t relative_cursor_position) override;
void ImeFinishComposingText(bool keep_selection) override;
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index ea83dcf..f4692bf 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -110,9 +110,9 @@
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebDocumentLoader.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/WebKit/public/web/WebPluginScriptForbiddenScope.h"
@@ -945,22 +945,19 @@
bool PepperPluginInstanceImpl::SendCompositionEventToPlugin(
PP_InputEvent_Type type,
const base::string16& text) {
- std::vector<blink::WebCompositionUnderline> empty;
- return SendCompositionEventWithUnderlineInformationToPlugin(
- type,
- text,
- empty,
- static_cast<int>(text.size()),
+ std::vector<blink::WebImeTextSpan> empty;
+ return SendCompositionEventWithImeTextSpanInformationToPlugin(
+ type, text, empty, static_cast<int>(text.size()),
static_cast<int>(text.size()));
}
-bool
-PepperPluginInstanceImpl::SendCompositionEventWithUnderlineInformationToPlugin(
- PP_InputEvent_Type type,
- const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) {
+bool PepperPluginInstanceImpl::
+ SendCompositionEventWithImeTextSpanInformationToPlugin(
+ PP_InputEvent_Type type,
+ const base::string16& text,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ int selection_start,
+ int selection_end) {
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PepperPluginInstanceImpl> ref(this);
@@ -981,9 +978,9 @@
std::vector<size_t> utf16_offsets;
utf16_offsets.push_back(selection_start);
utf16_offsets.push_back(selection_end);
- for (size_t i = 0; i < underlines.size(); ++i) {
- utf16_offsets.push_back(underlines[i].start_offset);
- utf16_offsets.push_back(underlines[i].end_offset);
+ for (size_t i = 0; i < ime_text_spans.size(); ++i) {
+ utf16_offsets.push_back(ime_text_spans[i].start_offset);
+ utf16_offsets.push_back(ime_text_spans[i].end_offset);
}
std::vector<size_t> utf8_offsets(utf16_offsets);
event.character_text = base::UTF16ToUTF8AndAdjustOffsets(text, &utf8_offsets);
@@ -1006,8 +1003,8 @@
offset_set.end());
// Set the composition target.
- for (size_t i = 0; i < underlines.size(); ++i) {
- if (underlines[i].thick) {
+ for (size_t i = 0; i < ime_text_spans.size(); ++i) {
+ if (ime_text_spans[i].thick) {
std::vector<uint32_t>::iterator it =
std::find(event.composition_segment_offsets.begin(),
event.composition_segment_offsets.end(),
@@ -1049,15 +1046,12 @@
bool PepperPluginInstanceImpl::HandleCompositionUpdate(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end) {
- return SendCompositionEventWithUnderlineInformationToPlugin(
- PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE,
- text,
- underlines,
- selection_start,
- selection_end);
+ return SendCompositionEventWithImeTextSpanInformationToPlugin(
+ PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE, text, ime_text_spans,
+ selection_start, selection_end);
}
bool PepperPluginInstanceImpl::HandleCompositionEnd(
@@ -2335,7 +2329,7 @@
return false;
render_frame_->SimulateImeCommitText(
base::UTF8ToUTF16(input_event.character_text),
- std::vector<blink::WebCompositionUnderline>(), gfx::Range());
+ std::vector<blink::WebImeTextSpan>(), gfx::Range());
break;
default:
return false;
@@ -2358,18 +2352,18 @@
base::string16 utf16_text =
base::UTF8ToUTF16AndAdjustOffsets(input_event.character_text, &offsets);
- std::vector<blink::WebCompositionUnderline> underlines;
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
for (size_t i = 2; i + 1 < offsets.size(); ++i) {
- blink::WebCompositionUnderline underline;
- underline.start_offset = offsets[i];
- underline.end_offset = offsets[i + 1];
+ blink::WebImeTextSpan ime_text_span;
+ ime_text_span.start_offset = offsets[i];
+ ime_text_span.end_offset = offsets[i + 1];
if (input_event.composition_target_segment == static_cast<int32_t>(i - 2))
- underline.thick = true;
- underlines.push_back(underline);
+ ime_text_span.thick = true;
+ ime_text_spans.push_back(ime_text_span);
}
- render_frame_->SimulateImeSetComposition(
- utf16_text, underlines, offsets[0], offsets[1]);
+ render_frame_->SimulateImeSetComposition(utf16_text, ime_text_spans,
+ offsets[0], offsets[1]);
}
ContentDecryptorDelegate*
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index f0cc2331..11e1961d 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -78,7 +78,7 @@
class WebMouseEvent;
class WebPluginContainer;
class WebURLResponse;
-struct WebCompositionUnderline;
+struct WebImeTextSpan;
struct WebCursorInfo;
struct WebURLError;
struct WebPrintParams;
@@ -240,7 +240,7 @@
bool HandleCompositionStart(const base::string16& text);
bool HandleCompositionUpdate(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
bool HandleCompositionEnd(const base::string16& text);
@@ -688,10 +688,10 @@
// Internal helper functions for HandleCompositionXXX().
bool SendCompositionEventToPlugin(PP_InputEvent_Type type,
const base::string16& text);
- bool SendCompositionEventWithUnderlineInformationToPlugin(
+ bool SendCompositionEventWithImeTextSpanInformationToPlugin(
PP_InputEvent_Type type,
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index f0b6745..971139b7 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1478,19 +1478,19 @@
void RenderFrameImpl::SimulateImeSetComposition(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end) {
- render_view_->OnImeSetComposition(
- text, underlines, gfx::Range::InvalidRange(),
- selection_start, selection_end);
+ render_view_->OnImeSetComposition(text, ime_text_spans,
+ gfx::Range::InvalidRange(), selection_start,
+ selection_end);
}
void RenderFrameImpl::SimulateImeCommitText(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range) {
- render_view_->OnImeCommitText(text, underlines, replacement_range, 0);
+ render_view_->OnImeCommitText(text, ime_text_spans, replacement_range, 0);
}
void RenderFrameImpl::SimulateImeFinishComposingText(bool keep_selection) {
@@ -1499,7 +1499,7 @@
void RenderFrameImpl::OnImeSetComposition(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end) {
// When a PPAPI plugin has focus, we bypass WebKit.
@@ -1523,7 +1523,8 @@
// Nonempty: composition is ongoing.
if (!pepper_composition_text_.empty()) {
focused_pepper_plugin_->HandleCompositionUpdate(
- pepper_composition_text_, underlines, selection_start, selection_end);
+ pepper_composition_text_, ime_text_spans, selection_start,
+ selection_end);
}
}
}
@@ -2215,10 +2216,11 @@
}
void RenderFrameImpl::OnSetCompositionFromExistingText(
- int start, int end,
- const std::vector<blink::WebCompositionUnderline>& underlines) {
+ int start,
+ int end,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans) {
ImeEventGuard guard(GetRenderWidget());
- frame_->SetCompositionFromExistingText(start, end, underlines);
+ frame_->SetCompositionFromExistingText(start, end, ime_text_spans);
}
void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) {
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index d83c434..8b5770dd 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -103,7 +103,7 @@
class WebPresentationClient;
class WebPushClient;
class WebSecurityOrigin;
-struct WebCompositionUnderline;
+struct WebImeTextSpan;
struct WebContextMenuData;
struct WebCursorInfo;
struct WebFindOptions;
@@ -372,12 +372,12 @@
// Simulates IME events for testing purpose.
void SimulateImeSetComposition(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
void SimulateImeCommitText(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range);
void SimulateImeFinishComposingText(bool keep_selection);
@@ -385,7 +385,7 @@
// RenderFrame.
void OnImeSetComposition(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
void OnImeCommitText(const base::string16& text,
@@ -940,8 +940,9 @@
void OnVisualStateRequest(uint64_t key);
void OnSetEditableSelectionOffsets(int start, int end);
void OnSetCompositionFromExistingText(
- int start, int end,
- const std::vector<blink::WebCompositionUnderline>& underlines);
+ int start,
+ int end,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans);
void OnExecuteNoValueEditCommand(const std::string& name);
void OnExtendSelectionAndDelete(int before, int after);
void OnDeleteSurroundingText(int before, int after);
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index dec950f..8a8b844 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1256,15 +1256,13 @@
case IME_SETCOMPOSITION:
view()->OnImeSetComposition(
base::WideToUTF16(ime_message->ime_string),
- std::vector<blink::WebCompositionUnderline>(),
- gfx::Range::InvalidRange(),
- ime_message->selection_start,
- ime_message->selection_end);
+ std::vector<blink::WebImeTextSpan>(), gfx::Range::InvalidRange(),
+ ime_message->selection_start, ime_message->selection_end);
break;
case IME_COMMITTEXT:
view()->OnImeCommitText(base::WideToUTF16(ime_message->ime_string),
- std::vector<blink::WebCompositionUnderline>(),
+ std::vector<blink::WebImeTextSpan>(),
gfx::Range::InvalidRange(), 0);
break;
@@ -1273,11 +1271,9 @@
break;
case IME_CANCELCOMPOSITION:
- view()->OnImeSetComposition(
- base::string16(),
- std::vector<blink::WebCompositionUnderline>(),
- gfx::Range::InvalidRange(),
- 0, 0);
+ view()->OnImeSetComposition(base::string16(),
+ std::vector<blink::WebImeTextSpan>(),
+ gfx::Range::InvalidRange(), 0, 0);
break;
}
@@ -1511,48 +1507,44 @@
ExecuteJavaScriptForTests("document.getElementById('test').focus();");
const base::string16 empty_string;
- const std::vector<blink::WebCompositionUnderline> empty_underline;
+ const std::vector<blink::WebImeTextSpan> empty_ime_text_span;
std::vector<gfx::Rect> bounds;
view()->OnSetFocus(true);
// ASCII composition
const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo");
- view()->OnImeSetComposition(ascii_composition, empty_underline,
+ view()->OnImeSetComposition(ascii_composition, empty_ime_text_span,
gfx::Range::InvalidRange(), 0, 0);
view()->GetCompositionCharacterBounds(&bounds);
ASSERT_EQ(ascii_composition.size(), bounds.size());
for (size_t i = 0; i < bounds.size(); ++i)
EXPECT_LT(0, bounds[i].width());
- view()->OnImeCommitText(empty_string,
- std::vector<blink::WebCompositionUnderline>(),
+ view()->OnImeCommitText(empty_string, std::vector<blink::WebImeTextSpan>(),
gfx::Range::InvalidRange(), 0);
// Non surrogate pair unicode character.
const base::string16 unicode_composition = base::UTF8ToUTF16(
"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A");
- view()->OnImeSetComposition(unicode_composition, empty_underline,
+ view()->OnImeSetComposition(unicode_composition, empty_ime_text_span,
gfx::Range::InvalidRange(), 0, 0);
view()->GetCompositionCharacterBounds(&bounds);
ASSERT_EQ(unicode_composition.size(), bounds.size());
for (size_t i = 0; i < bounds.size(); ++i)
EXPECT_LT(0, bounds[i].width());
- view()->OnImeCommitText(empty_string, empty_underline,
+ view()->OnImeCommitText(empty_string, empty_ime_text_span,
gfx::Range::InvalidRange(), 0);
// Surrogate pair character.
const base::string16 surrogate_pair_char =
base::UTF8ToUTF16("\xF0\xA0\xAE\x9F");
- view()->OnImeSetComposition(surrogate_pair_char,
- empty_underline,
- gfx::Range::InvalidRange(),
- 0,
- 0);
+ view()->OnImeSetComposition(surrogate_pair_char, empty_ime_text_span,
+ gfx::Range::InvalidRange(), 0, 0);
view()->GetCompositionCharacterBounds(&bounds);
ASSERT_EQ(surrogate_pair_char.size(), bounds.size());
EXPECT_LT(0, bounds[0].width());
EXPECT_EQ(0, bounds[1].width());
- view()->OnImeCommitText(empty_string, empty_underline,
+ view()->OnImeCommitText(empty_string, empty_ime_text_span,
gfx::Range::InvalidRange(), 0);
// Mixed string.
@@ -1563,10 +1555,8 @@
const bool is_surrogate_pair_empty_rect[8] = {
false, true, false, false, true, false, false, true };
view()->OnImeSetComposition(surrogate_pair_mixed_composition,
- empty_underline,
- gfx::Range::InvalidRange(),
- 0,
- 0);
+ empty_ime_text_span, gfx::Range::InvalidRange(),
+ 0, 0);
view()->GetCompositionCharacterBounds(&bounds);
ASSERT_EQ(utf16_length, bounds.size());
for (size_t i = 0; i < utf16_length; ++i) {
@@ -1576,7 +1566,7 @@
EXPECT_LT(0, bounds[i].width());
}
}
- view()->OnImeCommitText(empty_string, empty_underline,
+ view()->OnImeCommitText(empty_string, empty_ime_text_span,
gfx::Range::InvalidRange(), 0);
}
#endif
@@ -1592,8 +1582,8 @@
"</html>");
ExecuteJavaScriptForTests("document.getElementById('test1').focus();");
frame()->SetEditableSelectionOffsets(4, 8);
- const std::vector<blink::WebCompositionUnderline> empty_underline;
- frame()->SetCompositionFromExistingText(7, 10, empty_underline);
+ const std::vector<blink::WebImeTextSpan> empty_ime_text_span;
+ frame()->SetCompositionFromExistingText(7, 10, empty_ime_text_span);
blink::WebInputMethodController* controller =
frame()->GetWebFrame()->GetInputMethodController();
blink::WebTextInputInfo info = controller->TextInputInfo();
@@ -2457,13 +2447,13 @@
ExecuteJavaScriptForTests("document.getElementById('test').focus();");
const base::string16 empty_string;
- const std::vector<blink::WebCompositionUnderline> empty_underline;
+ const std::vector<blink::WebImeTextSpan> empty_ime_text_span;
std::vector<gfx::Rect> bounds_at_1x;
view()->OnSetFocus(true);
// ASCII composition
const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo");
- view()->OnImeSetComposition(ascii_composition, empty_underline,
+ view()->OnImeSetComposition(ascii_composition, empty_ime_text_span,
gfx::Range::InvalidRange(), 0, 0);
view()->GetCompositionCharacterBounds(&bounds_at_1x);
ASSERT_EQ(ascii_composition.size(), bounds_at_1x.size());
diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm
index c425813..21e28f8 100644
--- a/content/renderer/render_view_browsertest_mac.mm
+++ b/content/renderer/render_view_browsertest_mac.mm
@@ -23,7 +23,7 @@
#include <Cocoa/Cocoa.h>
using blink::WebFrameContentDumper;
-using blink::WebCompositionUnderline;
+using blink::WebImeTextSpan;
namespace content {
@@ -182,11 +182,11 @@
// Simulate some IME related IPCs.
using Text = base::string16;
- using Underlines = std::vector<blink::WebCompositionUnderline>;
+ using ImeTextSpans = std::vector<blink::WebImeTextSpan>;
view->OnMessageReceived(InputMsg_ImeSetComposition(
- routing_id, Text(), Underlines(), Range(), 0, 0));
+ routing_id, Text(), ImeTextSpans(), Range(), 0, 0));
view->OnMessageReceived(
- InputMsg_ImeCommitText(routing_id, Text(), Underlines(), Range(), 0));
+ InputMsg_ImeCommitText(routing_id, Text(), ImeTextSpans(), Range(), 0));
view->OnMessageReceived(InputMsg_ImeFinishComposingText(routing_id, false));
}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 89e9a3a..5c373d4 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -120,7 +120,7 @@
#include "content/renderer/text_input_client_observer.h"
#endif
-using blink::WebCompositionUnderline;
+using blink::WebImeTextSpan;
using blink::WebCursorInfo;
using blink::WebDeviceEmulationParams;
using blink::WebDragOperation;
@@ -1660,15 +1660,16 @@
void RenderWidget::OnImeSetComposition(
const base::string16& text,
- const std::vector<WebCompositionUnderline>& underlines,
+ const std::vector<WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
- int selection_start, int selection_end) {
+ int selection_start,
+ int selection_end) {
if (!ShouldHandleImeEvents())
return;
#if BUILDFLAG(ENABLE_PLUGINS)
if (auto* plugin = GetFocusedPepperPluginInsideWidget()) {
- plugin->render_frame()->OnImeSetComposition(text, underlines,
+ plugin->render_frame()->OnImeSetComposition(text, ime_text_spans,
selection_start, selection_end);
return;
}
@@ -1677,8 +1678,7 @@
blink::WebInputMethodController* controller = GetInputMethodController();
if (!controller ||
!controller->SetComposition(
- WebString::FromUTF16(text),
- WebVector<WebCompositionUnderline>(underlines),
+ WebString::FromUTF16(text), WebVector<WebImeTextSpan>(ime_text_spans),
replacement_range.IsValid()
? WebRange(replacement_range.start(), replacement_range.length())
: WebRange(),
@@ -1693,7 +1693,7 @@
void RenderWidget::OnImeCommitText(
const base::string16& text,
- const std::vector<WebCompositionUnderline>& underlines,
+ const std::vector<WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int relative_cursor_pos) {
if (!ShouldHandleImeEvents())
@@ -1710,8 +1710,7 @@
input_handler_->set_handling_input_event(true);
if (auto* controller = GetInputMethodController()) {
controller->CommitText(
- WebString::FromUTF16(text),
- WebVector<WebCompositionUnderline>(underlines),
+ WebString::FromUTF16(text), WebVector<WebImeTextSpan>(ime_text_spans),
replacement_range.IsValid()
? WebRange(replacement_range.start(), replacement_range.length())
: WebRange(),
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index ab1b3ea..3785f02 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -52,7 +52,7 @@
#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
#include "third_party/WebKit/public/platform/WebTextInputInfo.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebPopupType.h"
#include "third_party/WebKit/public/web/WebTextDirection.h"
#include "third_party/WebKit/public/web/WebWidget.h"
@@ -435,15 +435,14 @@
void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
void OnImeSetComposition(
const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
const gfx::Range& replacement_range,
int selection_start,
int selection_end);
- void OnImeCommitText(
- const base::string16& text,
- const std::vector<blink::WebCompositionUnderline>& underlines,
- const gfx::Range& replacement_range,
- int relative_cursor_pos);
+ void OnImeCommitText(const base::string16& text,
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const gfx::Range& replacement_range,
+ int relative_cursor_pos);
void OnImeFinishComposingText(bool keep_selection);
// Called by the browser process to update text input state.
diff --git a/content/renderer/render_widget_browsertest.cc b/content/renderer/render_widget_browsertest.cc
index 3f8fcf9..7d4cc20 100644
--- a/content/renderer/render_widget_browsertest.cc
+++ b/content/renderer/render_widget_browsertest.cc
@@ -37,10 +37,9 @@
}
void CommitText(std::string text) {
- widget()->OnImeCommitText(
- base::UTF8ToUTF16(text),
- std::vector<blink::WebCompositionUnderline>(),
- gfx::Range::InvalidRange(), 0);
+ widget()->OnImeCommitText(base::UTF8ToUTF16(text),
+ std::vector<blink::WebImeTextSpan>(),
+ gfx::Range::InvalidRange(), 0);
}
ui::TextInputType GetTextInputType() { return widget()->GetTextInputType(); }
@@ -128,10 +127,10 @@
LoadHTML(
"<div contenteditable>EDITABLE</div>"
"<script> document.querySelector('div').focus(); </script>");
- blink::WebVector<blink::WebCompositionUnderline> emptyUnderlines;
+ blink::WebVector<blink::WebImeTextSpan> empty_ime_text_spans;
DCHECK(widget()->GetInputMethodController());
- widget()->GetInputMethodController()->SetComposition("hello", emptyUnderlines,
- blink::WebRange(), 3, 3);
+ widget()->GetInputMethodController()->SetComposition(
+ "hello", empty_ime_text_spans, blink::WebRange(), 3, 3);
gfx::Range range;
GetCompositionRange(&range);
EXPECT_TRUE(range.IsValid());
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index a40db586f..4206136 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -30,7 +30,7 @@
using blink::WebCanvas;
using blink::WebCoalescedInputEvent;
-using blink::WebCompositionUnderline;
+using blink::WebImeTextSpan;
using blink::WebCursorInfo;
using blink::WebGestureEvent;
using blink::WebInputEvent;
diff --git a/content/shell/test_runner/text_input_controller.cc b/content/shell/test_runner/text_input_controller.cc
index 9e7d7ba..d9f0929 100644
--- a/content/shell/test_runner/text_input_controller.cc
+++ b/content/shell/test_runner/text_input_controller.cc
@@ -14,8 +14,8 @@
#include "third_party/WebKit/public/platform/WebCoalescedInputEvent.h"
#include "third_party/WebKit/public/platform/WebInputEventResult.h"
#include "third_party/WebKit/public/platform/WebKeyboardEvent.h"
-#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebFrameWidget.h"
+#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebInputMethodController.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
@@ -173,7 +173,7 @@
void TextInputController::InsertText(const std::string& text) {
if (auto* controller = GetInputMethodController()) {
controller->CommitText(blink::WebString::FromUTF8(text),
- std::vector<blink::WebCompositionUnderline>(),
+ std::vector<blink::WebImeTextSpan>(),
blink::WebRange(), 0);
}
}
@@ -202,28 +202,28 @@
blink::WebString web_text(blink::WebString::FromUTF8(text));
// Split underline into up to 3 elements (before, selection, and after).
- std::vector<blink::WebCompositionUnderline> underlines;
- blink::WebCompositionUnderline underline;
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ blink::WebImeTextSpan ime_text_span;
if (!start) {
- underline.end_offset = length;
+ ime_text_span.end_offset = length;
} else {
- underline.end_offset = start;
- underlines.push_back(underline);
- underline.start_offset = start;
- underline.end_offset = start + length;
+ ime_text_span.end_offset = start;
+ ime_text_spans.push_back(ime_text_span);
+ ime_text_span.start_offset = start;
+ ime_text_span.end_offset = start + length;
}
- underline.thick = true;
- underlines.push_back(underline);
+ ime_text_span.thick = true;
+ ime_text_spans.push_back(ime_text_span);
if (start + length < static_cast<int>(web_text.length())) {
- underline.start_offset = underline.end_offset;
- underline.end_offset = web_text.length();
- underline.thick = false;
- underlines.push_back(underline);
+ ime_text_span.start_offset = ime_text_span.end_offset;
+ ime_text_span.end_offset = web_text.length();
+ ime_text_span.thick = false;
+ ime_text_spans.push_back(ime_text_span);
}
if (auto* controller = GetInputMethodController()) {
- controller->SetComposition(web_text, underlines, blink::WebRange(), start,
- start + length);
+ controller->SetComposition(web_text, ime_text_spans, blink::WebRange(),
+ start, start + length);
}
}
@@ -311,12 +311,12 @@
blink::WebString newText = blink::WebString::FromUTF8(text);
size_t textLength = newText.length();
- std::vector<blink::WebCompositionUnderline> underlines;
- underlines.push_back(blink::WebCompositionUnderline(
- 0, textLength, SK_ColorBLACK, false, SK_ColorTRANSPARENT));
+ std::vector<blink::WebImeTextSpan> ime_text_spans;
+ ime_text_spans.push_back(blink::WebImeTextSpan(0, textLength, SK_ColorBLACK,
+ false, SK_ColorTRANSPARENT));
if (auto* controller = GetInputMethodController()) {
controller->SetComposition(
- newText, blink::WebVector<blink::WebCompositionUnderline>(underlines),
+ newText, blink::WebVector<blink::WebImeTextSpan>(ime_text_spans),
blink::WebRange(), textLength, textLength);
}
}
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index 09a4d4b..d6c1bb15 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -106,8 +106,8 @@
void TestRenderFrame::SetCompositionFromExistingText(
int start,
int end,
- const std::vector<blink::WebCompositionUnderline>& underlines) {
- OnSetCompositionFromExistingText(start, end, underlines);
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans) {
+ OnSetCompositionFromExistingText(start, end, ime_text_spans);
}
blink::WebNavigationPolicy TestRenderFrame::DecidePolicyForNavigation(
diff --git a/content/test/test_render_frame.h b/content/test/test_render_frame.h
index 567b3555a..cc888aa 100644
--- a/content/test/test_render_frame.h
+++ b/content/test/test_render_frame.h
@@ -49,7 +49,7 @@
void SetCompositionFromExistingText(
int start,
int end,
- const std::vector<blink::WebCompositionUnderline>& underlines);
+ const std::vector<blink::WebImeTextSpan>& ime_text_spans);
blink::WebNavigationPolicy DecidePolicyForNavigation(
const blink::WebFrameClient::NavigationPolicyInfo& info) override;