mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Various fixes related to the C++11/14 update (see issue #3140)
- Convert scoped_ptr to std::unique_ptr from <memory> - Convert arraysize to base::size from include/base/cef_cxx17_backports.h - Convert NULL to nullptr - Include include/base/cef_callback.h instead of include/base/cef_bind.h - Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone; use .get() instead See the issue for additional details.
This commit is contained in:
@@ -14,10 +14,12 @@
|
||||
#include "tests/shared/browser/main_message_loop.h"
|
||||
#include "tests/shared/browser/util_win.h"
|
||||
|
||||
#define ColorUNDERLINE 0xFF000000 // Black SkColor value for underline,
|
||||
// same as Blink.
|
||||
#define ColorBKCOLOR 0x00000000 // White SkColor value for background,
|
||||
// same as Blink.
|
||||
#define ColorUNDERLINE \
|
||||
0xFF000000 // Black SkColor value for underline,
|
||||
// same as Blink.
|
||||
#define ColorBKCOLOR \
|
||||
0x00000000 // White SkColor value for background,
|
||||
// same as Blink.
|
||||
|
||||
namespace client {
|
||||
|
||||
@@ -35,7 +37,7 @@ bool IsSelectionAttribute(char attribute) {
|
||||
void GetCompositionSelectionRange(HIMC imc,
|
||||
int* target_start,
|
||||
int* target_end) {
|
||||
int attribute_size = ::ImmGetCompositionString(imc, GCS_COMPATTR, NULL, 0);
|
||||
int attribute_size = ::ImmGetCompositionString(imc, GCS_COMPATTR, nullptr, 0);
|
||||
if (attribute_size > 0) {
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
@@ -64,7 +66,7 @@ void GetCompositionUnderlines(
|
||||
int target_start,
|
||||
int target_end,
|
||||
std::vector<CefCompositionUnderline>& underlines) {
|
||||
int clause_size = ::ImmGetCompositionString(imc, GCS_COMPCLAUSE, NULL, 0);
|
||||
int clause_size = ::ImmGetCompositionString(imc, GCS_COMPCLAUSE, nullptr, 0);
|
||||
int clause_length = clause_size / sizeof(uint32);
|
||||
if (clause_length) {
|
||||
std::vector<uint32> clause_data(clause_length);
|
||||
@@ -131,7 +133,7 @@ void OsrImeHandlerWin::CreateImeWindow() {
|
||||
if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE ||
|
||||
PRIMARYLANGID(input_language_id_) == LANG_JAPANESE) {
|
||||
if (!system_caret_) {
|
||||
if (::CreateCaret(hwnd_, NULL, 1, 1))
|
||||
if (::CreateCaret(hwnd_, nullptr, 1, 1))
|
||||
system_caret_ = true;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +264,7 @@ void OsrImeHandlerWin::GetCompositionInfo(
|
||||
if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) {
|
||||
// IMM32 does not support non-zero-width selection in a composition. So
|
||||
// always use the caret position as selection range.
|
||||
int cursor = ::ImmGetCompositionString(imc, GCS_CURSORPOS, NULL, 0);
|
||||
int cursor = ::ImmGetCompositionString(imc, GCS_CURSORPOS, nullptr, 0);
|
||||
composition_start = cursor;
|
||||
} else {
|
||||
composition_start = 0;
|
||||
@@ -304,11 +306,11 @@ bool OsrImeHandlerWin::GetString(HIMC imc,
|
||||
CefString& result) {
|
||||
if (!(lparam & type))
|
||||
return false;
|
||||
LONG string_size = ::ImmGetCompositionString(imc, type, NULL, 0);
|
||||
LONG string_size = ::ImmGetCompositionString(imc, type, nullptr, 0);
|
||||
if (string_size <= 0)
|
||||
return false;
|
||||
|
||||
// For trailing NULL - ImmGetCompositionString excludes that.
|
||||
// For trailing nullptr - ImmGetCompositionString excludes that.
|
||||
string_size += sizeof(WCHAR);
|
||||
|
||||
std::vector<wchar_t> buffer(string_size);
|
||||
@@ -354,7 +356,7 @@ bool OsrImeHandlerWin::GetComposition(
|
||||
|
||||
void OsrImeHandlerWin::DisableIME() {
|
||||
CleanupComposition();
|
||||
::ImmAssociateContextEx(hwnd_, NULL, 0);
|
||||
::ImmAssociateContextEx(hwnd_, nullptr, 0);
|
||||
}
|
||||
|
||||
void OsrImeHandlerWin::CancelIME() {
|
||||
@@ -370,7 +372,7 @@ void OsrImeHandlerWin::CancelIME() {
|
||||
|
||||
void OsrImeHandlerWin::EnableIME() {
|
||||
// Load the default IME context.
|
||||
::ImmAssociateContextEx(hwnd_, NULL, IACE_DEFAULT);
|
||||
::ImmAssociateContextEx(hwnd_, nullptr, IACE_DEFAULT);
|
||||
}
|
||||
|
||||
void OsrImeHandlerWin::UpdateCaretPosition(int index) {
|
||||
|
Reference in New Issue
Block a user