Add CefFrame::PasteAndMatchStyle

This commit is contained in:
Michael Bragg 2024-10-18 14:49:52 -04:00 committed by Marshall Greenblatt
parent fc20e76d3b
commit a787036a8a
12 changed files with 68 additions and 10 deletions

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=8f347a95168778ec0e686cdef93be3bc517e2f68$ // $hash=6ff215fc96e15be41034d964d6736d6ade64fd1b$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
@ -98,6 +98,11 @@ typedef struct _cef_frame_t {
/// ///
void(CEF_CALLBACK* paste)(struct _cef_frame_t* self); void(CEF_CALLBACK* paste)(struct _cef_frame_t* self);
///
/// Execute paste and match style in this frame.
///
void(CEF_CALLBACK* paste_and_match_style)(struct _cef_frame_t* self);
/// ///
/// Execute delete in this frame. /// Execute delete in this frame.
/// ///

View File

@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal // way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash // hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected. // values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "676af077d6826353caf40425f5f2bae1262347ea" #define CEF_API_HASH_UNIVERSAL "0f72eb5c0deb1e48c1fd0ae0c41b28ed2f5a982b"
#if defined(OS_WIN) #if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "51848171cdea10858c4e0fca0f7099b0fdc759f9" #define CEF_API_HASH_PLATFORM "fc6006ffe5e37c2642b75e49e86d5697946181f2"
#elif defined(OS_MAC) #elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "8cc826c5f5fe97c275dfa3b9c020470678a5d2fd" #define CEF_API_HASH_PLATFORM "e3d6ffd493f9e05aa201bdcedc602bbee1009f6d"
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "0aec2348de1bf14fafa7a23baa0df942d342d409" #define CEF_API_HASH_PLATFORM "bcb5ec16be5dcd38cf84cf7b0da93879fc21a0c3"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -95,6 +95,12 @@ class CefFrame : public virtual CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual void Paste() = 0; virtual void Paste() = 0;
///
/// Execute paste and match style in this frame.
///
/*--cef()--*/
virtual void PasteAndMatchStyle() = 0;
/// ///
/// Execute delete in this frame. /// Execute delete in this frame.
/// ///

View File

@ -1900,8 +1900,9 @@ typedef enum {
MENU_ID_CUT = 112, MENU_ID_CUT = 112,
MENU_ID_COPY = 113, MENU_ID_COPY = 113,
MENU_ID_PASTE = 114, MENU_ID_PASTE = 114,
MENU_ID_DELETE = 115, MENU_ID_PASTE_MATCH_STYLE = 115,
MENU_ID_SELECT_ALL = 116, MENU_ID_DELETE = 116,
MENU_ID_SELECT_ALL = 117,
// Miscellaneous. // Miscellaneous.
MENU_ID_FIND = 130, MENU_ID_FIND = 130,

View File

@ -133,6 +133,10 @@ void CefFrameHostImpl::Paste() {
EXEC_WEBCONTENTS_COMMAND(Paste); EXEC_WEBCONTENTS_COMMAND(Paste);
} }
void CefFrameHostImpl::PasteAndMatchStyle() {
EXEC_WEBCONTENTS_COMMAND(PasteAndMatchStyle);
}
void CefFrameHostImpl::Delete() { void CefFrameHostImpl::Delete() {
EXEC_WEBCONTENTS_COMMAND(Delete); EXEC_WEBCONTENTS_COMMAND(Delete);
} }

View File

@ -55,6 +55,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
void Cut() override; void Cut() override;
void Copy() override; void Copy() override;
void Paste() override; void Paste() override;
void PasteAndMatchStyle() override;
void Delete() override; void Delete() override;
void SelectAll() override; void SelectAll() override;
void ViewSource() override; void ViewSource() override;

View File

@ -328,6 +328,8 @@ void CefMenuManager::CreateDefaultModel() {
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_CONTENT_CONTEXT_CUT)); model_->AddItem(MENU_ID_CUT, GetLabel(IDS_CONTENT_CONTEXT_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_CONTENT_CONTEXT_COPY)); model_->AddItem(MENU_ID_COPY, GetLabel(IDS_CONTENT_CONTEXT_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_CONTENT_CONTEXT_PASTE)); model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_CONTENT_CONTEXT_PASTE));
model_->AddItem(MENU_ID_PASTE_MATCH_STYLE,
GetLabel(IDS_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE));
model_->AddSeparator(); model_->AddSeparator();
model_->AddItem(MENU_ID_SELECT_ALL, model_->AddItem(MENU_ID_SELECT_ALL,
@ -347,6 +349,7 @@ void CefMenuManager::CreateDefaultModel() {
} }
if (!(params_.edit_flags & CM_EDITFLAG_CAN_PASTE)) { if (!(params_.edit_flags & CM_EDITFLAG_CAN_PASTE)) {
model_->SetEnabled(MENU_ID_PASTE, false); model_->SetEnabled(MENU_ID_PASTE, false);
model_->SetEnabled(MENU_ID_PASTE_MATCH_STYLE, false);
} }
if (!(params_.edit_flags & CM_EDITFLAG_CAN_DELETE)) { if (!(params_.edit_flags & CM_EDITFLAG_CAN_DELETE)) {
model_->SetEnabled(MENU_ID_DELETE, false); model_->SetEnabled(MENU_ID_DELETE, false);
@ -458,6 +461,9 @@ void CefMenuManager::ExecuteDefaultCommand(int command_id) {
case MENU_ID_PASTE: case MENU_ID_PASTE:
browser_->GetFocusedFrame()->Paste(); browser_->GetFocusedFrame()->Paste();
break; break;
case MENU_ID_PASTE_MATCH_STYLE:
browser_->GetFocusedFrame()->PasteAndMatchStyle();
break;
case MENU_ID_DELETE: case MENU_ID_DELETE:
browser_->GetFocusedFrame()->Delete(); browser_->GetFocusedFrame()->Delete();
break; break;

View File

@ -104,6 +104,10 @@ void CefFrameImpl::Paste() {
SendCommand("Paste"); SendCommand("Paste");
} }
void CefFrameImpl::PasteAndMatchStyle() {
SendCommand("PasteAndMatchStyle");
}
void CefFrameImpl::Delete() { void CefFrameImpl::Delete() {
SendCommand("Delete"); SendCommand("Delete");
} }

View File

@ -54,6 +54,7 @@ class CefFrameImpl
void Cut() override; void Cut() override;
void Copy() override; void Copy() override;
void Paste() override; void Paste() override;
void PasteAndMatchStyle() override;
void Delete() override; void Delete() override;
void SelectAll() override; void SelectAll() override;
void ViewSource() override; void ViewSource() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=1edf2a7d9f2dc18f4422c9651554577735b83b66$ // $hash=78b6ea5be9077164a1d7ea6143601040b124f1c0$
// //
#include "libcef_dll/cpptoc/frame_cpptoc.h" #include "libcef_dll/cpptoc/frame_cpptoc.h"
@ -115,6 +115,20 @@ void CEF_CALLBACK frame_paste(struct _cef_frame_t* self) {
CefFrameCppToC::Get(self)->Paste(); CefFrameCppToC::Get(self)->Paste();
} }
void CEF_CALLBACK frame_paste_and_match_style(struct _cef_frame_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return;
}
// Execute
CefFrameCppToC::Get(self)->PasteAndMatchStyle();
}
void CEF_CALLBACK frame_del(struct _cef_frame_t* self) { void CEF_CALLBACK frame_del(struct _cef_frame_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -486,6 +500,7 @@ CefFrameCppToC::CefFrameCppToC() {
GetStruct()->cut = frame_cut; GetStruct()->cut = frame_cut;
GetStruct()->copy = frame_copy; GetStruct()->copy = frame_copy;
GetStruct()->paste = frame_paste; GetStruct()->paste = frame_paste;
GetStruct()->paste_and_match_style = frame_paste_and_match_style;
GetStruct()->del = frame_del; GetStruct()->del = frame_del;
GetStruct()->select_all = frame_select_all; GetStruct()->select_all = frame_select_all;
GetStruct()->view_source = frame_view_source; GetStruct()->view_source = frame_view_source;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=2422c489d40f44ad21b8f80d284ec6375ae93689$ // $hash=d5d7d1577311729c9db2209af72abc2e0126dfa5$
// //
#include "libcef_dll/ctocpp/frame_ctocpp.h" #include "libcef_dll/ctocpp/frame_ctocpp.h"
@ -113,6 +113,20 @@ NO_SANITIZE("cfi-icall") void CefFrameCToCpp::Paste() {
_struct->paste(_struct); _struct->paste(_struct);
} }
NO_SANITIZE("cfi-icall") void CefFrameCToCpp::PasteAndMatchStyle() {
shutdown_checker::AssertNotShutdown();
cef_frame_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, paste_and_match_style)) {
return;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->paste_and_match_style(_struct);
}
NO_SANITIZE("cfi-icall") void CefFrameCToCpp::Delete() { NO_SANITIZE("cfi-icall") void CefFrameCToCpp::Delete() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=c70637482d64cbe5fd1bea33bf18950594a50dac$ // $hash=15ea4aa67b0535061854dc3a10c72fb10581157b$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_FRAME_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_FRAME_CTOCPP_H_
@ -45,6 +45,7 @@ class CefFrameCToCpp
void Cut() override; void Cut() override;
void Copy() override; void Copy() override;
void Paste() override; void Paste() override;
void PasteAndMatchStyle() override;
void Delete() override; void Delete() override;
void SelectAll() override; void SelectAll() override;
void ViewSource() override; void ViewSource() override;