Cleanup some longstanding style issues in XFA. -- Convert lp prefixes to p, as there's nothing special about these pointers that would imply an 'l' designation. -- Make some variable names match types. -- Fix typo in local name. -- Avoid some null comparisons in ? operators. -- Remove unused CFXJSE_Value::Assign() method. Change-Id: I19dfe6d846b025356550faa67fd1760ebeb2cf81 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81270 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp index b9a7f5b..8995b74 100644 --- a/fxjs/xfa/cfxjse_class.cpp +++ b/fxjs/xfa/cfxjse_class.cpp
@@ -36,12 +36,12 @@ void V8FunctionCallback_Wrapper( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_FUNCTION_DESCRIPTOR* lpFunctionInfo = + const FXJSE_FUNCTION_DESCRIPTOR* pFunctionInfo = AsFunctionDescriptor(info.Data().As<v8::External>()->Value()); - if (!lpFunctionInfo) + if (!pFunctionInfo) return; - lpFunctionInfo->callbackProc(CFXJSE_HostObject::FromV8(info.Holder()), info); + pFunctionInfo->callbackProc(CFXJSE_HostObject::FromV8(info.Holder()), info); } void V8ConstructorCallback_Wrapper( @@ -49,9 +49,9 @@ if (!info.IsConstructCall()) return; - const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition = + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor = AsClassDescriptor(info.Data().As<v8::External>()->Value()); - if (!lpClassDefinition) + if (!pClassDescriptor) return; DCHECK_EQ(info.Holder()->InternalFieldCount(), 2); @@ -61,13 +61,14 @@ void Context_GlobalObjToString( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_CLASS_DESCRIPTOR* lpClass = + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor = AsClassDescriptor(info.Data().As<v8::External>()->Value()); - if (!lpClass) + if (!pClassDescriptor) return; - if (info.This() == info.Holder() && lpClass->name) { - ByteString szStringVal = ByteString::Format("[object %s]", lpClass->name); + if (info.This() == info.Holder() && pClassDescriptor->name) { + ByteString szStringVal = + ByteString::Format("[object %s]", pClassDescriptor->name); info.GetReturnValue().Set( fxv8::NewStringHelper(info.GetIsolate(), szStringVal.AsStringView())); return; @@ -115,23 +116,23 @@ } void DynPropGetterAdapter(v8::Isolate* pIsolate, - const FXJSE_CLASS_DESCRIPTOR* lpClass, + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor, v8::Local<v8::Object> pObject, ByteStringView szPropName, CFXJSE_Value* pValue) { - DCHECK(lpClass); + DCHECK(pClassDescriptor); - int32_t nPropType = - lpClass->dynPropTypeGetter == nullptr - ? FXJSE_ClassPropType_Property - : lpClass->dynPropTypeGetter(pIsolate, pObject, szPropName, false); + int32_t nPropType = pClassDescriptor->dynPropTypeGetter + ? pClassDescriptor->dynPropTypeGetter( + pIsolate, pObject, szPropName, false) + : FXJSE_ClassPropType_Property; if (nPropType == FXJSE_ClassPropType_Property) { - if (lpClass->dynPropGetter) { - pValue->ForceSetValue( - pIsolate, lpClass->dynPropGetter(pIsolate, pObject, szPropName)); + if (pClassDescriptor->dynPropGetter) { + pValue->ForceSetValue(pIsolate, pClassDescriptor->dynPropGetter( + pIsolate, pObject, szPropName)); } } else if (nPropType == FXJSE_ClassPropType_Method) { - if (lpClass->dynMethodCall && pValue) { + if (pClassDescriptor->dynMethodCall && pValue) { v8::HandleScope hscope(pIsolate); v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate = v8::ObjectTemplate::New(pIsolate); @@ -140,7 +141,7 @@ hCallBackInfoTemplate->NewInstance(pIsolate->GetCurrentContext()) .ToLocalChecked(); hCallBackInfo->SetAlignedPointerInInternalField( - 0, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClass)); + 0, const_cast<FXJSE_CLASS_DESCRIPTOR*>(pClassDescriptor)); hCallBackInfo->SetInternalField( 1, fxv8::NewStringHelper(pIsolate, szPropName)); pValue->ForceSetValue( @@ -154,32 +155,32 @@ } void DynPropSetterAdapter(v8::Isolate* pIsolate, - const FXJSE_CLASS_DESCRIPTOR* lpClass, + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor, v8::Local<v8::Object> pObject, ByteStringView szPropName, CFXJSE_Value* pValue) { - DCHECK(lpClass); - int32_t nPropType = - lpClass->dynPropTypeGetter == nullptr - ? FXJSE_ClassPropType_Property - : lpClass->dynPropTypeGetter(pIsolate, pObject, szPropName, false); + DCHECK(pClassDescriptor); + int32_t nPropType = pClassDescriptor->dynPropTypeGetter + ? pClassDescriptor->dynPropTypeGetter( + pIsolate, pObject, szPropName, false) + : FXJSE_ClassPropType_Property; if (nPropType != FXJSE_ClassPropType_Method) { - if (lpClass->dynPropSetter) { - lpClass->dynPropSetter(pIsolate, pObject, szPropName, - pValue->GetValue(pIsolate)); + if (pClassDescriptor->dynPropSetter) { + pClassDescriptor->dynPropSetter(pIsolate, pObject, szPropName, + pValue->GetValue(pIsolate)); } } } bool DynPropQueryAdapter(v8::Isolate* pIsolate, - const FXJSE_CLASS_DESCRIPTOR* lpClass, + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor, v8::Local<v8::Object> pObject, ByteStringView szPropName) { - DCHECK(lpClass); - int32_t nPropType = - lpClass->dynPropTypeGetter == nullptr - ? FXJSE_ClassPropType_Property - : lpClass->dynPropTypeGetter(pIsolate, pObject, szPropName, true); + DCHECK(pClassDescriptor); + int32_t nPropType = pClassDescriptor->dynPropTypeGetter + ? pClassDescriptor->dynPropTypeGetter( + pIsolate, pObject, szPropName, true) + : FXJSE_ClassPropType_Property; return nPropType != FXJSE_ClassPropType_None; } @@ -243,15 +244,15 @@ void SetUpNamedPropHandler(v8::Isolate* pIsolate, v8::Local<v8::ObjectTemplate> pObjectTemplate, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition) { + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor) { v8::NamedPropertyHandlerConfiguration configuration( - lpClassDefinition->dynPropGetter ? NamedPropertyGetterCallback : nullptr, - lpClassDefinition->dynPropSetter ? NamedPropertySetterCallback : nullptr, - lpClassDefinition->dynPropTypeGetter ? NamedPropertyQueryCallback - : nullptr, + pClassDescriptor->dynPropGetter ? NamedPropertyGetterCallback : nullptr, + pClassDescriptor->dynPropSetter ? NamedPropertySetterCallback : nullptr, + pClassDescriptor->dynPropTypeGetter ? NamedPropertyQueryCallback + : nullptr, nullptr, NamedPropertyEnumeratorCallback, v8::External::New(pIsolate, - const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), + const_cast<FXJSE_CLASS_DESCRIPTOR*>(pClassDescriptor)), v8::PropertyHandlerFlags::kNonMasking); pObjectTemplate->SetHandler(configuration); } @@ -260,28 +261,28 @@ // static CFXJSE_Class* CFXJSE_Class::Create( - CFXJSE_Context* lpContext, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition, + CFXJSE_Context* pContext, + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor, bool bIsJSGlobal) { - if (!lpContext || !lpClassDefinition) + if (!pContext || !pClassDescriptor) return nullptr; CFXJSE_Class* pExistingClass = - lpContext->GetClassByName(lpClassDefinition->name); + pContext->GetClassByName(pClassDescriptor->name); if (pExistingClass) return pExistingClass; - v8::Isolate* pIsolate = lpContext->GetIsolate(); - auto pClass = std::make_unique<CFXJSE_Class>(lpContext); - pClass->m_szClassName = lpClassDefinition->name; - pClass->m_lpClassDefinition = lpClassDefinition; + v8::Isolate* pIsolate = pContext->GetIsolate(); + auto pClass = std::make_unique<CFXJSE_Class>(pContext); + pClass->m_szClassName = pClassDescriptor->name; + pClass->m_pClassDescriptor = pClassDescriptor; CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::FunctionTemplate> hFunctionTemplate = v8::FunctionTemplate::New( pIsolate, bIsJSGlobal ? 0 : V8ConstructorCallback_Wrapper, - v8::External::New( - pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition))); + v8::External::New(pIsolate, + const_cast<FXJSE_CLASS_DESCRIPTOR*>(pClassDescriptor))); v8::Local<v8::String> classname = - fxv8::NewStringHelper(pIsolate, lpClassDefinition->name); + fxv8::NewStringHelper(pIsolate, pClassDescriptor->name); hFunctionTemplate->SetClassName(classname); hFunctionTemplate->PrototypeTemplate()->Set( v8::Symbol::GetToStringTag(pIsolate), classname, @@ -289,17 +290,17 @@ hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(2); v8::Local<v8::ObjectTemplate> hObjectTemplate = hFunctionTemplate->InstanceTemplate(); - SetUpNamedPropHandler(pIsolate, hObjectTemplate, lpClassDefinition); + SetUpNamedPropHandler(pIsolate, hObjectTemplate, pClassDescriptor); - if (lpClassDefinition->methNum) { - for (int32_t i = 0; i < lpClassDefinition->methNum; i++) { + if (pClassDescriptor->methNum) { + for (int32_t i = 0; i < pClassDescriptor->methNum; i++) { v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New( pIsolate, V8FunctionCallback_Wrapper, v8::External::New(pIsolate, const_cast<FXJSE_FUNCTION_DESCRIPTOR*>( - lpClassDefinition->methods + i))); + pClassDescriptor->methods + i))); fun->RemovePrototype(); hObjectTemplate->Set( - fxv8::NewStringHelper(pIsolate, lpClassDefinition->methods[i].name), + fxv8::NewStringHelper(pIsolate, pClassDescriptor->methods[i].name), fun, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); } @@ -309,18 +310,18 @@ v8::Local<v8::FunctionTemplate> fn = v8::FunctionTemplate::New( pIsolate, Context_GlobalObjToString, v8::External::New( - pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition))); + pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(pClassDescriptor))); fn->RemovePrototype(); hObjectTemplate->Set(fxv8::NewStringHelper(pIsolate, "toString"), fn); } - pClass->m_hTemplate.Reset(lpContext->GetIsolate(), hFunctionTemplate); + pClass->m_hTemplate.Reset(pContext->GetIsolate(), hFunctionTemplate); CFXJSE_Class* pResult = pClass.get(); - lpContext->AddClass(std::move(pClass)); + pContext->AddClass(std::move(pClass)); return pResult; } -CFXJSE_Class::CFXJSE_Class(const CFXJSE_Context* lpContext) - : m_pContext(lpContext) {} +CFXJSE_Class::CFXJSE_Class(const CFXJSE_Context* pContext) + : m_pContext(pContext) {} CFXJSE_Class::~CFXJSE_Class() = default;
diff --git a/fxjs/xfa/cfxjse_class.h b/fxjs/xfa/cfxjse_class.h index ff3b2f2..c5491b6 100644 --- a/fxjs/xfa/cfxjse_class.h +++ b/fxjs/xfa/cfxjse_class.h
@@ -17,10 +17,10 @@ class CFXJSE_Class { public: static CFXJSE_Class* Create(CFXJSE_Context* pContext, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion, + const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor, bool bIsJSGlobal); - explicit CFXJSE_Class(const CFXJSE_Context* lpContext); + explicit CFXJSE_Class(const CFXJSE_Context* pContext); ~CFXJSE_Class(); bool IsName(ByteStringView name) const { return name == m_szClassName; } @@ -29,7 +29,7 @@ protected: ByteString m_szClassName; - UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_lpClassDefinition; + UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_pClassDescriptor; UnownedPtr<const CFXJSE_Context> const m_pContext; v8::Global<v8::FunctionTemplate> m_hTemplate; };
diff --git a/fxjs/xfa/cfxjse_context.cpp b/fxjs/xfa/cfxjse_context.cpp index be7fd8b..b5eb033 100644 --- a/fxjs/xfa/cfxjse_context.cpp +++ b/fxjs/xfa/cfxjse_context.cpp
@@ -123,12 +123,12 @@ } // namespace void FXJSE_UpdateObjectBinding(v8::Local<v8::Object> hObject, - CFXJSE_HostObject* lpNewBinding) { + CFXJSE_HostObject* pNewBinding) { DCHECK(!hObject.IsEmpty()); DCHECK_EQ(hObject->InternalFieldCount(), 2); hObject->SetAlignedPointerInInternalField( 0, const_cast<wchar_t*>(kFXJSEHostObjectTag)); - hObject->SetAlignedPointerInInternalField(1, lpNewBinding); + hObject->SetAlignedPointerInInternalField(1, pNewBinding); } void FXJSE_ClearObjectBinding(v8::Local<v8::Object> hObject) { @@ -236,7 +236,7 @@ } bool CFXJSE_Context::ExecuteScript(const char* szScript, - CFXJSE_Value* lpRetValue, + CFXJSE_Value* pRetValue, v8::Local<v8::Object> hNewThis) { CFXJSE_ScopeUtil_IsolateHandleContext scope(this); v8::Local<v8::Context> hContext = GetIsolate()->GetCurrentContext(); @@ -250,14 +250,15 @@ v8::Local<v8::Value> hValue; if (hScript->Run(hContext).ToLocal(&hValue)) { DCHECK(!trycatch.HasCaught()); - if (lpRetValue) - lpRetValue->ForceSetValue(GetIsolate(), hValue); + if (pRetValue) + pRetValue->ForceSetValue(GetIsolate(), hValue); return true; } } - if (lpRetValue) - lpRetValue->ForceSetValue(GetIsolate(), - CreateReturnValue(GetIsolate(), &trycatch)); + if (pRetValue) { + pRetValue->ForceSetValue(GetIsolate(), + CreateReturnValue(GetIsolate(), &trycatch)); + } return false; } @@ -274,8 +275,8 @@ if (hWrapperFn->Call(hContext, hNewThis.As<v8::Object>(), 1, rgArgs) .ToLocal(&hValue)) { DCHECK(!trycatch.HasCaught()); - if (lpRetValue) - lpRetValue->ForceSetValue(GetIsolate(), hValue); + if (pRetValue) + pRetValue->ForceSetValue(GetIsolate(), hValue); return true; } } @@ -294,9 +295,9 @@ } #endif // NDEBUG - if (lpRetValue) { - lpRetValue->ForceSetValue(GetIsolate(), - CreateReturnValue(GetIsolate(), &trycatch)); + if (pRetValue) { + pRetValue->ForceSetValue(GetIsolate(), + CreateReturnValue(GetIsolate(), &trycatch)); } return false; }
diff --git a/fxjs/xfa/cfxjse_context.h b/fxjs/xfa/cfxjse_context.h index 85c3f31..a423ac8 100644 --- a/fxjs/xfa/cfxjse_context.h +++ b/fxjs/xfa/cfxjse_context.h
@@ -39,10 +39,10 @@ CFXJSE_Class* GetClassByName(ByteStringView szName) const; void EnableCompatibleMode(); - // Note: `lpNewThisObject` may be empty. + // Note: `pNewThisObject` may be empty. bool ExecuteScript(const char* szScript, - CFXJSE_Value* lpRetValue, - v8::Local<v8::Object> lpNewThisObject); + CFXJSE_Value* pRetValue, + v8::Local<v8::Object> pNewThisObject); private: CFXJSE_Context(v8::Isolate* pIsolate, CXFA_ThisProxy* pProxy); @@ -56,7 +56,7 @@ }; void FXJSE_UpdateObjectBinding(v8::Local<v8::Object> hObject, - CFXJSE_HostObject* lpNewBinding); + CFXJSE_HostObject* pNewBinding); void FXJSE_ClearObjectBinding(v8::Local<v8::Object> hJSObject); CFXJSE_HostObject* FXJSE_RetrieveObjectBinding(v8::Local<v8::Value> hValue);
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp index ce2ff2a..7fdf91e 100644 --- a/fxjs/xfa/cfxjse_engine.cpp +++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -232,23 +232,23 @@ v8::Local<v8::Object> pObject, ByteStringView szPropName, v8::Local<v8::Value> pValue) { - CXFA_Object* lpOrginalNode = ToObject(pIsolate, pObject); - CXFA_Document* pDoc = lpOrginalNode->GetDocument(); - CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); - CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); - if (lpOrginalNode->IsThisProxy()) - pRefNode = ToNode(lpScriptContext->GetVariablesThis(lpOrginalNode)); + CXFA_Object* pOriginalNode = ToObject(pIsolate, pObject); + CXFA_Document* pDoc = pOriginalNode->GetDocument(); + CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext(); + CXFA_Node* pRefNode = ToNode(pScriptContext->GetThisObject()); + if (pOriginalNode->IsThisProxy()) + pRefNode = ToNode(pScriptContext->GetVariablesThis(pOriginalNode)); WideString wsPropName = WideString::FromUTF8(szPropName); - if (lpScriptContext->UpdateNodeByFlag( + if (pScriptContext->UpdateNodeByFlag( pRefNode, wsPropName.AsStringView(), pValue, XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes)) { return; } - if (lpOrginalNode->IsThisProxy() && fxv8::IsUndefined(pValue)) { - fxv8::ReentrantDeleteObjectPropertyHelper(lpScriptContext->GetIsolate(), + if (pOriginalNode->IsThisProxy() && fxv8::IsUndefined(pValue)) { + fxv8::ReentrantDeleteObjectPropertyHelper(pScriptContext->GetIsolate(), pObject, szPropName); return; } @@ -272,45 +272,45 @@ ByteStringView szPropName) { CXFA_Object* pOriginalObject = ToObject(pIsolate, pObject); CXFA_Document* pDoc = pOriginalObject->GetDocument(); - CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext(); WideString wsPropName = WideString::FromUTF8(szPropName); // Assume failure. v8::Local<v8::Value> pValue = fxv8::NewUndefinedHelper(pIsolate); - if (lpScriptContext->GetType() == CXFA_Script::Type::Formcalc) { + if (pScriptContext->GetType() == CXFA_Script::Type::Formcalc) { if (szPropName == kFormCalcRuntime) - return lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(); + return pScriptContext->m_FM2JSContext->GlobalPropertyGetter(); XFA_HashCode uHashCode = static_cast<XFA_HashCode>(FX_HashCode_GetW(wsPropName.AsStringView())); if (uHashCode != XFA_HASHCODE_Layout) { CXFA_Object* pObj = - lpScriptContext->GetDocument()->GetXFAObject(uHashCode); + pScriptContext->GetDocument()->GetXFAObject(uHashCode); if (pObj) - return lpScriptContext->GetOrCreateJSBindingFromMap(pObj); + return pScriptContext->GetOrCreateJSBindingFromMap(pObj); } } - CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); + CXFA_Node* pRefNode = ToNode(pScriptContext->GetThisObject()); if (pOriginalObject->IsThisProxy()) - pRefNode = ToNode(lpScriptContext->GetVariablesThis(pOriginalObject)); + pRefNode = ToNode(pScriptContext->GetVariablesThis(pOriginalObject)); - if (lpScriptContext->QueryNodeByFlag( + if (pScriptContext->QueryNodeByFlag( pRefNode, wsPropName.AsStringView(), &pValue, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes)) { return pValue; } - if (lpScriptContext->QueryNodeByFlag( + if (pScriptContext->QueryNodeByFlag( pRefNode, wsPropName.AsStringView(), &pValue, XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings)) { return pValue; } CXFA_Object* pScriptObject = - lpScriptContext->GetVariablesScript(pOriginalObject); - if (pScriptObject && lpScriptContext->QueryVariableValue( + pScriptContext->GetVariablesScript(pOriginalObject); + if (pScriptObject && pScriptContext->QueryVariableValue( pScriptObject->AsNode(), szPropName, &pValue)) { return pValue; } @@ -340,8 +340,8 @@ if (!pObject) return FXJSE_ClassPropType_None; - CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); - pObject = lpScriptContext->GetVariablesThis(pObject); + CFXJSE_Engine* pScriptContext = pObject->GetDocument()->GetScriptContext(); + pObject = pScriptContext->GetVariablesThis(pObject); WideString wsPropName = WideString::FromUTF8(szPropName); if (pObject->JSObject()->HasMethod(wsPropName)) return FXJSE_ClassPropType_Method; @@ -358,40 +358,40 @@ if (!pOriginalObject) return fxv8::NewUndefinedHelper(pIsolate); - CFXJSE_Engine* lpScriptContext = + CFXJSE_Engine* pScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); WideString wsPropName = WideString::FromUTF8(szPropName); if (wsPropName.EqualsASCII("xfa")) { - return lpScriptContext->GetOrCreateJSBindingFromMap( - lpScriptContext->GetDocument()->GetRoot()); + return pScriptContext->GetOrCreateJSBindingFromMap( + pScriptContext->GetDocument()->GetRoot()); } v8::Local<v8::Value> pReturnValue = fxv8::NewUndefinedHelper(pIsolate); - CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); + CXFA_Object* pObject = pScriptContext->GetVariablesThis(pOriginalObject); CXFA_Node* pRefNode = ToNode(pObject); - if (lpScriptContext->QueryNodeByFlag( + if (pScriptContext->QueryNodeByFlag( pRefNode, wsPropName.AsStringView(), &pReturnValue, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes)) { return pReturnValue; } - if (pObject == lpScriptContext->GetThisObject() || - (lpScriptContext->GetType() == CXFA_Script::Type::Javascript && - !lpScriptContext->IsStrictScopeInJavaScript())) { - if (lpScriptContext->QueryNodeByFlag( + if (pObject == pScriptContext->GetThisObject() || + (pScriptContext->GetType() == CXFA_Script::Type::Javascript && + !pScriptContext->IsStrictScopeInJavaScript())) { + if (pScriptContext->QueryNodeByFlag( pRefNode, wsPropName.AsStringView(), &pReturnValue, XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings)) { return pReturnValue; } } CXFA_Object* pScriptObject = - lpScriptContext->GetVariablesScript(pOriginalObject); + pScriptContext->GetVariablesScript(pOriginalObject); if (!pScriptObject) return pReturnValue; - if (lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, - &pReturnValue)) { + if (pScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, + &pReturnValue)) { return pReturnValue; } Optional<XFA_SCRIPTATTRIBUTEINFO> info = XFA_GetScriptAttributeByName( @@ -427,9 +427,9 @@ if (!pOriginalObject) return; - CFXJSE_Engine* lpScriptContext = + CFXJSE_Engine* pScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); - CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); + CXFA_Object* pObject = pScriptContext->GetVariablesThis(pOriginalObject); WideString wsPropName = WideString::FromUTF8(szPropName); WideStringView wsPropNameView = wsPropName.AsStringView(); Optional<XFA_SCRIPTATTRIBUTEINFO> info = @@ -467,10 +467,10 @@ } CXFA_Object* pScriptObject = - lpScriptContext->GetVariablesScript(pOriginalObject); + pScriptContext->GetVariablesScript(pOriginalObject); if (pScriptObject) { - lpScriptContext->UpdateVariableValue(ToNode(pScriptObject), szPropName, - pValue); + pScriptContext->UpdateVariableValue(ToNode(pScriptObject), szPropName, + pValue); } } @@ -482,8 +482,8 @@ if (!pObject) return FXJSE_ClassPropType_None; - CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); - pObject = lpScriptContext->GetVariablesThis(pObject); + CFXJSE_Engine* pScriptContext = pObject->GetDocument()->GetScriptContext(); + pObject = pScriptContext->GetVariablesThis(pObject); XFA_Element eType = pObject->GetElementType(); WideString wsPropName = WideString::FromUTF8(szPropName); if (pObject->JSObject()->HasMethod(wsPropName)) @@ -503,8 +503,8 @@ if (!pObject) return CJS_Result::Failure(L"no Holder() present."); - CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); - pObject = lpScriptContext->GetVariablesThis(pObject); + CFXJSE_Engine* pScriptContext = pObject->GetDocument()->GetScriptContext(); + pObject = pScriptContext->GetVariablesThis(pObject); std::vector<v8::Local<v8::Value>> parameters; for (int i = 0; i < info.Length(); i++)
diff --git a/fxjs/xfa/cfxjse_value.cpp b/fxjs/xfa/cfxjse_value.cpp index d87f91a..9a5ed51 100644 --- a/fxjs/xfa/cfxjse_value.cpp +++ b/fxjs/xfa/cfxjse_value.cpp
@@ -113,8 +113,8 @@ bool CFXJSE_Value::SetObjectProperty(v8::Isolate* pIsolate, ByteStringView szPropName, - CFXJSE_Value* lpPropValue) { - if (lpPropValue->IsEmpty()) + CFXJSE_Value* pPropValue) { + if (pPropValue->IsEmpty()) return false; CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); @@ -124,18 +124,18 @@ return fxv8::ReentrantPutObjectPropertyHelper( pIsolate, hObject.As<v8::Object>(), szPropName, - lpPropValue->GetValue(pIsolate)); + pPropValue->GetValue(pIsolate)); } bool CFXJSE_Value::GetObjectProperty(v8::Isolate* pIsolate, ByteStringView szPropName, - CFXJSE_Value* lpPropValue) { + CFXJSE_Value* pPropValue) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::Value> hObject = GetValue(pIsolate); if (!hObject->IsObject()) return false; - lpPropValue->ForceSetValue( + pPropValue->ForceSetValue( pIsolate, fxv8::ReentrantGetObjectPropertyHelper( pIsolate, hObject.As<v8::Object>(), szPropName)); return true; @@ -143,15 +143,15 @@ bool CFXJSE_Value::GetObjectPropertyByIdx(v8::Isolate* pIsolate, uint32_t uPropIdx, - CFXJSE_Value* lpPropValue) { + CFXJSE_Value* pPropValue) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::Value> hObject = GetValue(pIsolate); if (!hObject->IsArray()) return false; - lpPropValue->ForceSetValue(pIsolate, - fxv8::ReentrantGetArrayElementHelper( - pIsolate, hObject.As<v8::Array>(), uPropIdx)); + pPropValue->ForceSetValue(pIsolate, + fxv8::ReentrantGetArrayElementHelper( + pIsolate, hObject.As<v8::Array>(), uPropIdx)); return true; }
diff --git a/fxjs/xfa/cfxjse_value.h b/fxjs/xfa/cfxjse_value.h index 1f44226..f6615f3 100644 --- a/fxjs/xfa/cfxjse_value.h +++ b/fxjs/xfa/cfxjse_value.h
@@ -54,7 +54,7 @@ void SetFloat(v8::Isolate* pIsolate, float fFloat); void SetHostObject(v8::Isolate* pIsolate, - CFXJSE_HostObject* lpObject, + CFXJSE_HostObject* pObject, CFXJSE_Class* pClass); void SetArray(v8::Isolate* pIsolate, @@ -62,17 +62,17 @@ bool GetObjectProperty(v8::Isolate* pIsolate, ByteStringView szPropName, - CFXJSE_Value* lpPropValue); + CFXJSE_Value* pPropValue); bool SetObjectProperty(v8::Isolate* pIsolate, ByteStringView szPropName, - CFXJSE_Value* lpPropValue); + CFXJSE_Value* pPropValue); bool GetObjectPropertyByIdx(v8::Isolate* pIsolate, uint32_t uPropIdx, - CFXJSE_Value* lpPropValue); + CFXJSE_Value* pPropValue); void DeleteObjectProperty(v8::Isolate* pIsolate, ByteStringView szPropName); bool SetObjectOwnProperty(v8::Isolate* pIsolate, ByteStringView szPropName, - CFXJSE_Value* lpPropValue); + CFXJSE_Value* pPropValue); // Return empty local on error. static v8::Local<v8::Function> NewBoundFunction( @@ -85,14 +85,6 @@ void ForceSetValue(v8::Isolate* pIsolate, v8::Local<v8::Value> hValue) { m_hValue.Reset(pIsolate, hValue); } - void Assign(v8::Isolate* pIsolate, const CFXJSE_Value* lpValue) { - DCHECK(lpValue); - if (lpValue) { - m_hValue.Reset(pIsolate, lpValue->m_hValue); - } else { - m_hValue.Reset(); - } - } private: CFXJSE_Value(const CFXJSE_Value&) = delete;
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 19cb57a..0f8064a 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -365,31 +365,31 @@ if (!name_table) return results; - const uint8_t* lpTable = name_table; + const uint8_t* pTable = name_table; WideString wsFamily; - const uint8_t* sp = lpTable + 2; - const uint8_t* lpNameRecord = lpTable + 6; + const uint8_t* sp = pTable + 2; + const uint8_t* pNameRecord = pTable + 6; uint16_t nNameCount = GetUInt16(sp); - const uint8_t* lpStr = lpTable + GetUInt16(sp + 2); + const uint8_t* pStr = pTable + GetUInt16(sp + 2); for (uint16_t j = 0; j < nNameCount; j++) { - uint16_t nNameID = GetUInt16(lpNameRecord + j * 12 + 6); + uint16_t nNameID = GetUInt16(pNameRecord + j * 12 + 6); if (nNameID != 1) continue; - uint16_t nPlatformID = GetUInt16(lpNameRecord + j * 12 + 0); - uint16_t nNameLength = GetUInt16(lpNameRecord + j * 12 + 8); - uint16_t nNameOffset = GetUInt16(lpNameRecord + j * 12 + 10); + uint16_t nPlatformID = GetUInt16(pNameRecord + j * 12 + 0); + uint16_t nNameLength = GetUInt16(pNameRecord + j * 12 + 8); + uint16_t nNameOffset = GetUInt16(pNameRecord + j * 12 + 10); wsFamily.clear(); if (nPlatformID != 1) { for (uint16_t k = 0; k < nNameLength / 2; k++) { - wchar_t wcTemp = GetUInt16(lpStr + nNameOffset + k * 2); + wchar_t wcTemp = GetUInt16(pStr + nNameOffset + k * 2); wsFamily += wcTemp; } results.push_back(wsFamily); continue; } for (uint16_t k = 0; k < nNameLength; k++) { - wchar_t wcTemp = GetUInt8(lpStr + nNameOffset + k); + wchar_t wcTemp = GetUInt8(pStr + nNameOffset + k); wsFamily += wcTemp; } results.push_back(wsFamily);
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index d3ccb1a..a7e10a9 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -676,12 +676,12 @@ int32_t iCurSel = GetDayAtPoint(pMsg->m_pos); if (iCurSel > 0) { - DATEINFO* lpDatesInfo = m_DateArray[iCurSel - 1].get(); - CFX_RectF rtInvalidate(lpDatesInfo->rect); + DATEINFO* pDateInfo = m_DateArray[iCurSel - 1].get(); + CFX_RectF rtInvalidate(pDateInfo->rect); if (iOldSel > 0 && iOldSel <= pdfium::CollectionSize<int32_t>(m_DateArray)) { - lpDatesInfo = m_DateArray[iOldSel - 1].get(); - rtInvalidate.Union(lpDatesInfo->rect); + pDateInfo = m_DateArray[iOldSel - 1].get(); + rtInvalidate.Union(pDateInfo->rect); } AddSelDay(iCurSel); CFWL_DateTimePicker* pDateTime =