summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/event.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-23 09:44:30 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-23 17:57:28 +0000
commit33d13f2231a07e7b32ff25da6a6a28cb619d18a9 (patch)
tree8be1d6a857dff58d8aacbc1dc722fceac8343235 /fpdfsdk/javascript/event.cpp
parentc970895f94cf76eb738d0a583ae139fecdd85268 (diff)
downloadpdfium-33d13f2231a07e7b32ff25da6a6a28cb619d18a9.tar.xz
Remove CJS_PropValue
This CL removes the CJS_PropValue class and uses CJS_Value directly. The various Set methods have been moved to CJS_Value and the runtime provided as needed. Change-Id: Ib5d3b9efc9b6cf8182be8f19af98599379c3d7db Reviewed-on: https://pdfium-review.googlesource.com/16431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/event.cpp')
-rw-r--r--fpdfsdk/javascript/event.cpp132
1 files changed, 63 insertions, 69 deletions
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index 9c2e3f490e..34504d5aa4 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -47,61 +47,61 @@ event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {}
event::~event() {}
bool event::get_change(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Change());
+ vp->Set(pRuntime, pEvent->Change());
return true;
}
bool event::set_change(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- if (vp.GetJSValue()->GetType() == CJS_Value::VT_string) {
+ if (vp.GetType() == CJS_Value::VT_string) {
WideString& wChange = pEvent->Change();
- wChange = vp.ToWideString();
+ wChange = vp.ToWideString(pRuntime);
}
return true;
}
bool event::get_change_ex(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->ChangeEx());
+ vp->Set(pRuntime, pEvent->ChangeEx());
return true;
}
bool event::set_change_ex(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_commit_key(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->CommitKey());
+ vp->Set(pRuntime, pEvent->CommitKey());
return true;
}
bool event::set_commit_key(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_field_full(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -109,117 +109,113 @@ bool event::get_field_full(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return false;
- vp->Set(pEvent->FieldFull());
+ vp->Set(pRuntime, pEvent->FieldFull());
return true;
}
bool event::set_field_full(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_key_down(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->KeyDown());
+ vp->Set(pRuntime, pEvent->KeyDown());
return true;
}
bool event::set_key_down(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_modifier(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Modifier());
+ vp->Set(pRuntime, pEvent->Modifier());
return true;
}
bool event::set_modifier(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
-bool event::get_name(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool event::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Name());
+ vp->Set(pRuntime, pEvent->Name());
return true;
}
bool event::set_name(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
-bool event::get_rc(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool event::get_rc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Rc());
+ vp->Set(pRuntime, pEvent->Rc());
return true;
}
bool event::set_rc(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- pEvent->Rc() = vp.ToBool();
+ pEvent->Rc() = vp.ToBool(pRuntime);
return true;
}
bool event::get_rich_change(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return true;
}
bool event::set_rich_change(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return true;
}
bool event::get_rich_change_ex(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return true;
}
bool event::set_rich_change_ex(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return true;
}
bool event::get_rich_value(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return true;
}
bool event::set_rich_value(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return true;
}
bool event::get_sel_end(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -227,12 +223,12 @@ bool event::get_sel_end(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- vp->Set(pEvent->SelEnd());
+ vp->Set(pRuntime, pEvent->SelEnd());
return true;
}
bool event::set_sel_end(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -240,12 +236,12 @@ bool event::set_sel_end(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- pEvent->SelEnd() = vp.ToInt();
+ pEvent->SelEnd() = vp.ToInt(pRuntime);
return true;
}
bool event::get_sel_start(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -253,12 +249,12 @@ bool event::get_sel_start(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- vp->Set(pEvent->SelStart());
+ vp->Set(pRuntime, pEvent->SelStart());
return true;
}
bool event::set_sel_start(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -266,87 +262,85 @@ bool event::set_sel_start(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- pEvent->SelStart() = vp.ToInt();
+ pEvent->SelStart() = vp.ToInt(pRuntime);
return true;
}
bool event::get_shift(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Shift());
+ vp->Set(pRuntime, pEvent->Shift());
return true;
}
bool event::set_shift(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_source(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Source()->GetJSObject());
+ vp->Set(pRuntime, pEvent->Source()->GetJSObject());
return true;
}
bool event::set_source(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_target(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Target_Field()->GetJSObject());
+ vp->Set(pRuntime, pEvent->Target_Field()->GetJSObject());
return true;
}
bool event::set_target(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_target_name(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->TargetName());
+ vp->Set(pRuntime, pEvent->TargetName());
return true;
}
bool event::set_target_name(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
-bool event::get_type(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool event::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->Type());
+ vp->Set(pRuntime, pEvent->Type());
return true;
}
bool event::set_type(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}
bool event::get_value(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -357,12 +351,12 @@ bool event::get_value(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- vp->Set(pEvent->Value());
+ vp->Set(pRuntime, pEvent->Value());
return true;
}
bool event::set_value(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -373,21 +367,21 @@ bool event::set_value(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- pEvent->Value() = vp.ToWideString();
+ pEvent->Value() = vp.ToWideString(pRuntime);
return true;
}
bool event::get_will_commit(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pEvent->WillCommit());
+ vp->Set(pRuntime, pEvent->WillCommit());
return true;
}
bool event::set_will_commit(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return false;
}