#include "xfa/fwl/cfwl_edit.h"
#include <algorithm>
#include <memory>
#include <utility>
#include <vector>
#include "build/build_config.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/text_char_pos.h"
#include "v8/include/cppgc/visitor.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/graphics/cfgas_gegraphics.h"
#include "xfa/fgas/graphics/cfgas_gepath.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_caret.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_eventtextwillchange.h"
#include "xfa/fwl/cfwl_eventvalidate.h"
#include "xfa/fwl/cfwl_messagekey.h"
#include "xfa/fwl/cfwl_messagemouse.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_themepart.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/fwl_widgetdef.h"
#include "xfa/fwl/ifwl_themeprovider.h"
#include "xfa/fwl/theme/cfwl_utils.h"
namespace pdfium {
namespace {
constexpr int kEditMargin = …;
#if BUILDFLAG(IS_APPLE)
constexpr XFA_FWL_KeyFlag kEditingModifier = XFA_FWL_KeyFlag::kCommand;
#else
constexpr XFA_FWL_KeyFlag kEditingModifier = …;
#endif
}
CFWL_Edit::CFWL_Edit(CFWL_App* app,
const Properties& properties,
CFWL_Widget* pOuter)
: … { … }
CFWL_Edit::~CFWL_Edit() = default;
void CFWL_Edit::PreFinalize() { … }
void CFWL_Edit::Trace(cppgc::Visitor* visitor) const { … }
FWL_Type CFWL_Edit::GetClassID() const { … }
CFX_RectF CFWL_Edit::GetWidgetRect() { … }
CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() { … }
void CFWL_Edit::SetStates(uint32_t dwStates) { … }
void CFWL_Edit::Update() { … }
FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) { … }
void CFWL_Edit::DrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) { … }
void CFWL_Edit::SetText(const WideString& wsText) { … }
void CFWL_Edit::SetTextSkipNotify(const WideString& wsText) { … }
size_t CFWL_Edit::GetTextLength() const { … }
WideString CFWL_Edit::GetText() const { … }
void CFWL_Edit::ClearText() { … }
void CFWL_Edit::SelectAll() { … }
bool CFWL_Edit::HasSelection() const { … }
std::pair<size_t, size_t> CFWL_Edit::GetSelection() const { … }
void CFWL_Edit::ClearSelection() { … }
int32_t CFWL_Edit::GetLimit() const { … }
void CFWL_Edit::SetLimit(int32_t nLimit) { … }
void CFWL_Edit::SetAliasChar(wchar_t wAlias) { … }
std::optional<WideString> CFWL_Edit::Copy() { … }
std::optional<WideString> CFWL_Edit::Cut() { … }
bool CFWL_Edit::Paste(const WideString& wsPaste) { … }
bool CFWL_Edit::Undo() { … }
bool CFWL_Edit::Redo() { … }
bool CFWL_Edit::CanUndo() { … }
bool CFWL_Edit::CanRedo() { … }
void CFWL_Edit::NotifyTextFull() { … }
void CFWL_Edit::OnCaretChanged() { … }
void CFWL_Edit::OnTextWillChange(CFDE_TextEditEngine::TextChange* change) { … }
void CFWL_Edit::OnTextChanged() { … }
void CFWL_Edit::OnSelChanged() { … }
bool CFWL_Edit::OnValidate(const WideString& wsText) { … }
void CFWL_Edit::SetScrollOffset(float fScrollOffset) { … }
void CFWL_Edit::DrawContent(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) { … }
void CFWL_Edit::DrawContentNonComb(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) { … }
void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev,
const CFX_RectF& clipRect,
const CFX_Matrix& mt) { … }
void CFWL_Edit::UpdateEditEngine() { … }
void CFWL_Edit::UpdateEditParams() { … }
void CFWL_Edit::UpdateEditLayout() { … }
bool CFWL_Edit::UpdateOffset() { … }
bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged) { … }
void CFWL_Edit::UpdateVAlignment() { … }
void CFWL_Edit::UpdateCaret() { … }
CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { … }
bool CFWL_Edit::IsShowVertScrollBar() const { … }
bool CFWL_Edit::IsContentHeightOverflow() const { … }
void CFWL_Edit::Layout() { … }
void CFWL_Edit::LayoutScrollBar() { … }
CFX_PointF CFWL_Edit::DeviceToEngine(const CFX_PointF& pt) { … }
void CFWL_Edit::InitVerticalScrollBar() { … }
void CFWL_Edit::ShowCaret(CFX_RectF* pRect) { … }
void CFWL_Edit::HideCaret(CFX_RectF* pRect) { … }
void CFWL_Edit::InitCaret() { … }
void CFWL_Edit::UpdateCursorRect() { … }
void CFWL_Edit::SetCursorPosition(size_t position) { … }
void CFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { … }
void CFWL_Edit::OnProcessEvent(CFWL_Event* pEvent) { … }
void CFWL_Edit::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) { … }
void CFWL_Edit::DoRButtonDown(CFWL_MessageMouse* pMsg) { … }
void CFWL_Edit::OnFocusGained() { … }
void CFWL_Edit::OnFocusLost() { … }
void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) { … }
void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) { … }
void CFWL_Edit::OnButtonDoubleClick(CFWL_MessageMouse* pMsg) { … }
void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) { … }
void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { … }
void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { … }
bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
float fPos) { … }
}