Rename "pDoc" instances to "doc" in //fxjs and //testing
Mass rename a common variable name to follow Google C++ style. Gemini
did some of the work, with lots of manual interventions.
Bug: 42271580
Change-Id: I5102d8de4e260c5f6aebb86b530c356c7f64be8e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/134411
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 9c04fb9..df72ee3 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -260,8 +260,8 @@
ByteStringView szPropName,
v8::Local<v8::Value> pValue) {
CXFA_Object* pOriginalNode = ToObject(pIsolate, pObject);
- CXFA_Document* pDoc = pOriginalNode->GetDocument();
- CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
+ CXFA_Document* doc = pOriginalNode->GetDocument();
+ CFXJSE_Engine* pScriptContext = doc->GetScriptContext();
CXFA_Node* pRefNode = ToNode(pScriptContext->GetThisObject());
if (pOriginalNode->IsThisProxy()) {
pRefNode = ToNode(pScriptContext->GetVariablesThis(pOriginalNode));
@@ -281,7 +281,7 @@
pObject, szPropName);
return;
}
- CXFA_FFNotify* pNotify = pDoc->GetNotify();
+ CXFA_FFNotify* pNotify = doc->GetNotify();
if (!pNotify) {
return;
}
@@ -302,8 +302,8 @@
v8::Local<v8::Object> pObject,
ByteStringView szPropName) {
CXFA_Object* pOriginalObject = ToObject(pIsolate, pObject);
- CXFA_Document* pDoc = pOriginalObject->GetDocument();
- CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
+ CXFA_Document* doc = pOriginalObject->GetDocument();
+ CFXJSE_Engine* pScriptContext = doc->GetScriptContext();
WideString wsPropName = WideString::FromUTF8(szPropName);
// Assume failure.
@@ -352,7 +352,7 @@
return pValue;
}
- CXFA_FFNotify* pNotify = pDoc->GetNotify();
+ CXFA_FFNotify* pNotify = doc->GetNotify();
if (!pNotify) {
return pValue;
}
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index e54dbc9..88aa5f3 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -452,14 +452,14 @@
return pHostObj ? pHostObj->AsFormCalcContext() : nullptr;
}
-GCedLocaleIface* LocaleFromString(CXFA_Document* pDoc,
+GCedLocaleIface* LocaleFromString(CXFA_Document* doc,
CXFA_LocaleMgr* pMgr,
ByteStringView bsLocale) {
if (!bsLocale.IsEmpty()) {
return pMgr->GetLocaleByName(WideString::FromUTF8(bsLocale));
}
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ CXFA_Node* pThisNode = ToNode(doc->GetScriptContext()->GetThisObject());
return pThisNode->GetLocale();
}
@@ -486,13 +486,13 @@
}
}
-ByteString GetLocalDateTimeFormat(CXFA_Document* pDoc,
+ByteString GetLocalDateTimeFormat(CXFA_Document* doc,
int32_t iStyle,
ByteStringView bsLocale,
bool bStandard,
bool bIsDate) {
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- LocaleIface* pLocale = LocaleFromString(pDoc, pMgr, bsLocale);
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ LocaleIface* pLocale = LocaleFromString(doc, pMgr, bsLocale);
if (!pLocale) {
return ByteString();
}
@@ -1272,12 +1272,12 @@
// Returns empty value on failure.
v8::Local<v8::Value> GetObjectForName(CFXJSE_HostObject* pHostObject,
ByteStringView bsAccessorName) {
- CXFA_Document* pDoc = ToFormCalcContext(pHostObject)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pHostObject)->GetDocument();
+ if (!doc) {
return v8::Local<v8::Value>();
}
- CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
+ CFXJSE_Engine* pScriptContext = doc->GetScriptContext();
std::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(
pScriptContext->GetThisObject(),
@@ -1300,14 +1300,14 @@
ByteStringView bsSomExp,
bool bDotAccessor,
bool bHasNoResolveName) {
- CXFA_Document* pDoc = ToFormCalcContext(pHostObject)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pHostObject)->GetDocument();
+ if (!doc) {
return std::nullopt;
}
v8::Isolate* pIsolate = ToFormCalcContext(pHostObject)->GetIsolate();
WideString wsSomExpression = WideString::FromUTF8(bsSomExp);
- CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
+ CFXJSE_Engine* pScriptContext = doc->GetScriptContext();
CXFA_Object* pNode = nullptr;
Mask<XFA_ResolveFlag> dwFlags;
if (bDotAccessor) {
@@ -1789,8 +1789,8 @@
return;
}
- CXFA_Document* pDoc = pContext->GetDocument();
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
+ CXFA_Document* doc = pContext->GetDocument();
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
ByteString bsArg = ValueToUTF8String(info.GetIsolate(), argOne);
auto pos = bsArg.Find('T', 0);
if (!pos.has_value() || pos.value() == bsArg.GetLength() - 1) {
@@ -2199,15 +2199,15 @@
bsLocale = ValueToUTF8String(info.GetIsolate(), localeValue);
}
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
GCedLocaleIface* pLocale = nullptr;
if (!bsLocale.IsEmpty()) {
pLocale =
pMgr->GetLocaleByName(WideString::FromUTF8(bsLocale.AsStringView()));
}
if (!pLocale) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ CXFA_Node* pThisNode = ToNode(doc->GetScriptContext()->GetThisObject());
pLocale = pThisNode->GetLocale();
}
@@ -2293,13 +2293,13 @@
ByteStringView bsDate,
ByteStringView bsFormat,
ByteStringView bsLocale) {
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ if (!doc) {
return ByteString();
}
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- GCedLocaleIface* pLocale = LocaleFromString(pDoc, pMgr, bsLocale);
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ GCedLocaleIface* pLocale = LocaleFromString(doc, pMgr, bsLocale);
if (!pLocale) {
return ByteString();
}
@@ -2319,13 +2319,13 @@
ByteStringView bsDate,
ByteStringView bsFormat,
ByteStringView bsLocale) {
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ if (!doc) {
return ByteString();
}
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- GCedLocaleIface* pLocale = LocaleFromString(pDoc, pMgr, bsLocale);
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ GCedLocaleIface* pLocale = LocaleFromString(doc, pMgr, bsLocale);
if (!pLocale) {
return ByteString();
}
@@ -2343,13 +2343,13 @@
ByteStringView bsTime,
ByteStringView bsFormat,
ByteStringView bsLocale) {
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ if (!doc) {
return ByteString();
}
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- GCedLocaleIface* pLocale = LocaleFromString(pDoc, pMgr, bsLocale);
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ GCedLocaleIface* pLocale = LocaleFromString(doc, pMgr, bsLocale);
if (!pLocale) {
return ByteString();
}
@@ -2369,12 +2369,12 @@
int32_t iStyle,
ByteStringView bsLocale,
bool bStandard) {
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ if (!doc) {
return ByteString();
}
- return GetLocalDateTimeFormat(pDoc, iStyle, bsLocale, bStandard,
+ return GetLocalDateTimeFormat(doc, iStyle, bsLocale, bStandard,
/*bIsDate=*/true);
}
@@ -2383,12 +2383,12 @@
int32_t iStyle,
ByteStringView bsLocale,
bool bStandard) {
- CXFA_Document* pDoc = ToFormCalcContext(pThis)->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = ToFormCalcContext(pThis)->GetDocument();
+ if (!doc) {
return ByteString();
}
- return GetLocalDateTimeFormat(pDoc, iStyle, bsLocale, bStandard,
+ return GetLocalDateTimeFormat(doc, iStyle, bsLocale, bStandard,
/*bIsDate=*/false);
}
@@ -3564,9 +3564,9 @@
v8::Local<v8::Value> argTwo = GetSimpleValue(info, 1);
ByteString bsValue = ValueToUTF8String(info.GetIsolate(), argTwo);
- CXFA_Document* pDoc = pContext->GetDocument();
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ CXFA_Document* doc = pContext->GetDocument();
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ CXFA_Node* pThisNode = ToNode(doc->GetScriptContext()->GetThisObject());
GCedLocaleIface* pLocale = pThisNode->GetLocale();
WideString wsPattern = WideString::FromUTF8(bsPattern.AsStringView());
WideString wsValue = WideString::FromUTF8(bsValue.AsStringView());
@@ -3740,9 +3740,9 @@
ByteString bsPattern = ValueToUTF8String(info.GetIsolate(), argOne);
ByteString bsValue = ValueToUTF8String(info.GetIsolate(), argTwo);
- CXFA_Document* pDoc = pContext->GetDocument();
- CXFA_LocaleMgr* pMgr = pDoc->GetLocaleMgr();
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ CXFA_Document* doc = pContext->GetDocument();
+ CXFA_LocaleMgr* pMgr = doc->GetLocaleMgr();
+ CXFA_Node* pThisNode = ToNode(doc->GetScriptContext()->GetThisObject());
GCedLocaleIface* pLocale = pThisNode->GetLocale();
WideString wsPattern = WideString::FromUTF8(bsPattern.AsStringView());
WideString wsValue = WideString::FromUTF8(bsValue.AsStringView());
@@ -4287,12 +4287,12 @@
return;
}
- CXFA_Document* pDoc = pContext->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = pContext->GetDocument();
+ if (!doc) {
return;
}
- CXFA_FFApp::CallbackIface* pAppProvider = pDoc->GetNotify()->GetAppProvider();
+ CXFA_FFApp::CallbackIface* pAppProvider = doc->GetNotify()->GetAppProvider();
if (!pAppProvider) {
return;
}
@@ -4325,12 +4325,12 @@
return;
}
- CXFA_Document* pDoc = pContext->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = pContext->GetDocument();
+ if (!doc) {
return;
}
- CXFA_FFApp::CallbackIface* pAppProvider = pDoc->GetNotify()->GetAppProvider();
+ CXFA_FFApp::CallbackIface* pAppProvider = doc->GetNotify()->GetAppProvider();
if (!pAppProvider) {
return;
}
@@ -4384,12 +4384,12 @@
return;
}
- CXFA_Document* pDoc = pContext->GetDocument();
- if (!pDoc) {
+ CXFA_Document* doc = pContext->GetDocument();
+ if (!doc) {
return;
}
- CXFA_FFApp::CallbackIface* pAppProvider = pDoc->GetNotify()->GetAppProvider();
+ CXFA_FFApp::CallbackIface* pAppProvider = doc->GetNotify()->GetAppProvider();
if (!pAppProvider) {
return;
}
@@ -5118,8 +5118,8 @@
CFXJSE_FormCalcContext::CFXJSE_FormCalcContext(v8::Isolate* pIsolate,
CFXJSE_Context* pScriptContext,
- CXFA_Document* pDoc)
- : isolate_(pIsolate), document_(pDoc) {
+ CXFA_Document* doc)
+ : isolate_(pIsolate), document_(doc) {
value_.Reset(isolate_,
NewBoundV8Object(
isolate_, CFXJSE_Class::Create(pScriptContext,
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index 7e9d743..6ea039d 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -31,7 +31,7 @@
public:
CFXJSE_FormCalcContext(v8::Isolate* pIsolate,
CFXJSE_Context* pScriptContext,
- CXFA_Document* pDoc);
+ CXFA_Document* doc);
~CFXJSE_FormCalcContext() override;
// CFXJSE_HostObject:
diff --git a/fxjs/xfa/cjx_container.cpp b/fxjs/xfa/cjx_container.cpp
index 6c271fb..6e7c611 100644
--- a/fxjs/xfa/cjx_container.cpp
+++ b/fxjs/xfa/cjx_container.cpp
@@ -37,9 +37,9 @@
CJS_Result CJX_Container::getDeltas(CFXJSE_Engine* runtime,
pdfium::span<v8::Local<v8::Value>> params) {
- CXFA_Document* pDoc = GetDocument();
+ CXFA_Document* doc = GetDocument();
auto* pList = cppgc::MakeGarbageCollected<CXFA_ArrayNodeList>(
- pDoc->GetHeap()->GetAllocationHandle(), pDoc);
- pDoc->GetNodeOwner()->PersistList(pList);
+ doc->GetHeap()->GetAllocationHandle(), doc);
+ doc->GetNodeOwner()->PersistList(pList);
return CJS_Result::Success(runtime->NewNormalXFAObject(pList));
}
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index 240deff..ac5ad7f 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -48,10 +48,10 @@
return CJS_Result::Failure(JSMessage::kValueError);
}
- CXFA_Document* pDoc = GetDocument();
+ CXFA_Document* doc = GetDocument();
auto* pFormNodes = cppgc::MakeGarbageCollected<CXFA_ArrayNodeList>(
- pDoc->GetHeap()->GetAllocationHandle(), pDoc);
- pDoc->GetNodeOwner()->PersistList(pFormNodes);
+ doc->GetHeap()->GetAllocationHandle(), doc);
+ doc->GetNodeOwner()->PersistList(pFormNodes);
v8::Local<v8::Value> value = runtime->GetOrCreateJSBindingFromMap(pFormNodes);
return CJS_Result::Success(value);
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index 614ed7f..7035be0 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -400,11 +400,11 @@
return CJS_Result::Success();
}
- CXFA_Document* pDoc = GetDocument();
- auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(pDoc);
+ CXFA_Document* doc = GetDocument();
+ auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(doc);
auto* pArrayNodeList = cppgc::MakeGarbageCollected<CXFA_ArrayNodeList>(
- pDoc->GetHeap()->GetAllocationHandle(), pDoc);
- pDoc->GetNodeOwner()->PersistList(pArrayNodeList);
+ doc->GetHeap()->GetAllocationHandle(), doc);
+ doc->GetNodeOwner()->PersistList(pArrayNodeList);
pArrayNodeList->SetArrayNodeList(
GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea));
return CJS_Result::Success(runtime->NewNormalXFAObject(pArrayNodeList));
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index a74fc9e..6665cc6 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -135,12 +135,12 @@
return;
}
- CXFA_Document* pDoc = GetDocument();
+ CXFA_Document* doc = GetDocument();
auto* pNodeList = cppgc::MakeGarbageCollected<CXFA_AttachNodeList>(
- pDoc->GetHeap()->GetAllocationHandle(), pDoc, GetXFANode());
- pDoc->GetNodeOwner()->PersistList(pNodeList);
+ doc->GetHeap()->GetAllocationHandle(), doc, GetXFANode());
+ doc->GetNodeOwner()->PersistList(pNodeList);
- CFXJSE_Engine* pEngine = pDoc->GetScriptContext();
+ CFXJSE_Engine* pEngine = doc->GetScriptContext();
*pValue = pNodeList->JSObject()->NewBoundV8Object(
pIsolate, pEngine->GetJseNormalClass()->GetTemplate(pIsolate));
}
@@ -213,12 +213,12 @@
refNode = GetXFANode();
}
- CXFA_Document* pDoc = GetDocument();
+ CXFA_Document* doc = GetDocument();
auto* pNodeList = cppgc::MakeGarbageCollected<CXFA_ArrayNodeList>(
- pDoc->GetHeap()->GetAllocationHandle(), pDoc);
- pDoc->GetNodeOwner()->PersistList(pNodeList);
+ doc->GetHeap()->GetAllocationHandle(), doc);
+ doc->GetNodeOwner()->PersistList(pNodeList);
- CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
+ CFXJSE_Engine* pScriptContext = doc->GetScriptContext();
std::optional<CFXJSE_Engine::ResolveResult> maybeResult =
pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
dwFlag);
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index 3368cba..883e14f 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -35,12 +35,12 @@
}
CXFA_Document* XFAJSEmbedderTest::GetXFADocument() const {
- auto* pDoc = CPDFDocumentFromFPDFDocument(document());
- if (!pDoc) {
+ auto* doc = CPDFDocumentFromFPDFDocument(document());
+ if (!doc) {
return nullptr;
}
- auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(doc->GetExtension());
if (!pContext) {
return nullptr;
}
@@ -68,12 +68,12 @@
filename, password, linearize_option, javascript_option)) {
return false;
}
- CXFA_Document* pDoc = GetXFADocument();
- if (!pDoc) {
+ CXFA_Document* doc = GetXFADocument();
+ if (!doc) {
return false;
}
- script_context_ = pDoc->GetScriptContext();
+ script_context_ = doc->GetScriptContext();
return true;
}