Convert remaining code to google_style_ members
Bug: 42271580
Change-Id: I59f78f0cb432c49e9b2ab5169215d6fbb4d8cf87
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130830
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 97b2d44..c9cebe0 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -122,67 +122,67 @@
CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc,
RetainPtr<IFX_RetainableWriteStream> archive)
- : m_pDocument(pDoc),
- m_pParser(pDoc->GetParser()),
- m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr),
- m_pSecurityHandler(m_pParser ? m_pParser->GetSecurityHandler() : nullptr),
- m_dwLastObjNum(m_pDocument->GetLastObjNum()),
- m_Archive(std::make_unique<CFX_FileBufferArchive>(std::move(archive))) {}
+ : document_(pDoc),
+ parser_(pDoc->GetParser()),
+ encrypt_dict_(parser_ ? parser_->GetEncryptDict() : nullptr),
+ security_handler_(parser_ ? parser_->GetSecurityHandler() : nullptr),
+ last_obj_num_(document_->GetLastObjNum()),
+ archive_(std::make_unique<CFX_FileBufferArchive>(std::move(archive))) {}
CPDF_Creator::~CPDF_Creator() = default;
bool CPDF_Creator::WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj) {
- if (!m_Archive->WriteDWord(objnum) || !m_Archive->WriteString(" 0 obj\r\n")) {
+ if (!archive_->WriteDWord(objnum) || !archive_->WriteString(" 0 obj\r\n")) {
return false;
}
std::unique_ptr<CPDF_Encryptor> encryptor;
- if (GetCryptoHandler() && pObj != m_pEncryptDict) {
+ if (GetCryptoHandler() && pObj != encrypt_dict_) {
encryptor = std::make_unique<CPDF_Encryptor>(GetCryptoHandler(), objnum);
}
- if (!pObj->WriteTo(m_Archive.get(), encryptor.get())) {
+ if (!pObj->WriteTo(archive_.get(), encryptor.get())) {
return false;
}
- return m_Archive->WriteString("\r\nendobj\r\n");
+ return archive_->WriteString("\r\nendobj\r\n");
}
bool CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
- if (m_pParser->IsObjectFree(objnum)) {
+ if (parser_->IsObjectFree(objnum)) {
return true;
}
- m_ObjectOffsets[objnum] = m_Archive->CurrentOffset();
+ object_offsets_[objnum] = archive_->CurrentOffset();
- bool bExistInMap = !!m_pDocument->GetIndirectObject(objnum);
- RetainPtr<CPDF_Object> pObj = m_pDocument->GetOrParseIndirectObject(objnum);
+ bool bExistInMap = !!document_->GetIndirectObject(objnum);
+ RetainPtr<CPDF_Object> pObj = document_->GetOrParseIndirectObject(objnum);
if (!pObj) {
- m_ObjectOffsets.erase(objnum);
+ object_offsets_.erase(objnum);
return true;
}
if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get())) {
return false;
}
if (!bExistInMap) {
- m_pDocument->DeleteIndirectObject(objnum);
+ document_->DeleteIndirectObject(objnum);
}
return true;
}
bool CPDF_Creator::WriteOldObjs() {
- const uint32_t nLastObjNum = m_pParser->GetLastObjNum();
- if (!m_pParser->IsValidObjectNumber(nLastObjNum)) {
+ const uint32_t nLastObjNum = parser_->GetLastObjNum();
+ if (!parser_->IsValidObjectNumber(nLastObjNum)) {
return true;
}
- if (m_CurObjNum > nLastObjNum) {
+ if (cur_obj_num_ > nLastObjNum) {
return true;
}
const std::set<uint32_t> objects_with_refs =
- GetObjectsWithReferences(m_pDocument);
+ GetObjectsWithReferences(document_);
uint32_t last_object_number_written = 0;
- for (uint32_t objnum = m_CurObjNum; objnum <= nLastObjNum; ++objnum) {
+ for (uint32_t objnum = cur_obj_num_; objnum <= nLastObjNum; ++objnum) {
if (!pdfium::Contains(objects_with_refs, objnum)) {
continue;
}
@@ -191,23 +191,23 @@
}
last_object_number_written = objnum;
}
- // If there are no new objects to write, then adjust `m_dwLastObjNum` if
+ // If there are no new objects to write, then adjust `last_obj_num_` if
// needed to reflect the actual last object number.
- if (m_NewObjNumArray.empty()) {
- m_dwLastObjNum = last_object_number_written;
+ if (new_obj_num_array_.empty()) {
+ last_obj_num_ = last_object_number_written;
}
return true;
}
bool CPDF_Creator::WriteNewObjs() {
- for (size_t i = m_CurObjNum; i < m_NewObjNumArray.size(); ++i) {
- uint32_t objnum = m_NewObjNumArray[i];
- RetainPtr<const CPDF_Object> pObj = m_pDocument->GetIndirectObject(objnum);
+ for (size_t i = cur_obj_num_; i < new_obj_num_array_.size(); ++i) {
+ uint32_t objnum = new_obj_num_array_[i];
+ RetainPtr<const CPDF_Object> pObj = document_->GetIndirectObject(objnum);
if (!pObj) {
continue;
}
- m_ObjectOffsets[objnum] = m_Archive->CurrentOffset();
+ object_offsets_[objnum] = archive_->CurrentOffset();
if (!WriteIndirectObj(pObj->GetObjNum(), pObj.Get())) {
return false;
}
@@ -216,159 +216,160 @@
}
void CPDF_Creator::InitNewObjNumOffsets() {
- for (const auto& pair : *m_pDocument) {
+ for (const auto& pair : *document_) {
const uint32_t objnum = pair.first;
- if (m_IsIncremental ||
+ if (is_incremental_ ||
pair.second->GetObjNum() == CPDF_Object::kInvalidObjNum) {
continue;
}
- if (m_pParser && m_pParser->IsValidObjectNumber(objnum) &&
- !m_pParser->IsObjectFree(objnum)) {
+ if (parser_ && parser_->IsValidObjectNumber(objnum) &&
+ !parser_->IsObjectFree(objnum)) {
continue;
}
- m_NewObjNumArray.insert(std::lower_bound(m_NewObjNumArray.begin(),
- m_NewObjNumArray.end(), objnum),
- objnum);
+ new_obj_num_array_.insert(
+ std::lower_bound(new_obj_num_array_.begin(), new_obj_num_array_.end(),
+ objnum),
+ objnum);
}
}
CPDF_Creator::Stage CPDF_Creator::WriteDoc_Stage1() {
- DCHECK(m_iStage > Stage::kInvalid || m_iStage < Stage::kInitWriteObjs20);
- if (m_iStage == Stage::kInit0) {
- if (!m_pParser || (m_bSecurityChanged && m_IsOriginal)) {
- m_IsIncremental = false;
+ DCHECK(stage_ > Stage::kInvalid || stage_ < Stage::kInitWriteObjs20);
+ if (stage_ == Stage::kInit0) {
+ if (!parser_ || (security_changed_ && is_original_)) {
+ is_incremental_ = false;
}
- m_iStage = Stage::kWriteHeader10;
+ stage_ = Stage::kWriteHeader10;
}
- if (m_iStage == Stage::kWriteHeader10) {
- if (!m_IsIncremental) {
- if (!m_Archive->WriteString("%PDF-1.")) {
+ if (stage_ == Stage::kWriteHeader10) {
+ if (!is_incremental_) {
+ if (!archive_->WriteString("%PDF-1.")) {
return Stage::kInvalid;
}
int32_t version = 7;
- if (m_FileVersion) {
- version = m_FileVersion;
- } else if (m_pParser) {
- version = m_pParser->GetFileVersion();
+ if (file_version_) {
+ version = file_version_;
+ } else if (parser_) {
+ version = parser_->GetFileVersion();
}
- if (!m_Archive->WriteDWord(version % 10) ||
- !m_Archive->WriteString("\r\n%\xA1\xB3\xC5\xD7\r\n")) {
+ if (!archive_->WriteDWord(version % 10) ||
+ !archive_->WriteString("\r\n%\xA1\xB3\xC5\xD7\r\n")) {
return Stage::kInvalid;
}
- m_iStage = Stage::kInitWriteObjs20;
+ stage_ = Stage::kInitWriteObjs20;
} else {
- m_SavedOffset = m_pParser->GetDocumentSize();
- m_iStage = Stage::kWriteIncremental15;
+ saved_offset_ = parser_->GetDocumentSize();
+ stage_ = Stage::kWriteIncremental15;
}
}
- if (m_iStage == Stage::kWriteIncremental15) {
- if (m_IsOriginal && m_SavedOffset > 0) {
- if (!m_pParser->WriteToArchive(m_Archive.get(), m_SavedOffset)) {
+ if (stage_ == Stage::kWriteIncremental15) {
+ if (is_original_ && saved_offset_ > 0) {
+ if (!parser_->WriteToArchive(archive_.get(), saved_offset_)) {
return Stage::kInvalid;
}
}
- if (m_IsOriginal && m_pParser->GetLastXRefOffset() == 0) {
- for (uint32_t num = 0; num <= m_pParser->GetLastObjNum(); ++num) {
- if (m_pParser->IsObjectFree(num)) {
+ if (is_original_ && parser_->GetLastXRefOffset() == 0) {
+ for (uint32_t num = 0; num <= parser_->GetLastObjNum(); ++num) {
+ if (parser_->IsObjectFree(num)) {
continue;
}
- m_ObjectOffsets[num] = m_pParser->GetObjectPositionOrZero(num);
+ object_offsets_[num] = parser_->GetObjectPositionOrZero(num);
}
}
- m_iStage = Stage::kInitWriteObjs20;
+ stage_ = Stage::kInitWriteObjs20;
}
InitNewObjNumOffsets();
- return m_iStage;
+ return stage_;
}
CPDF_Creator::Stage CPDF_Creator::WriteDoc_Stage2() {
- DCHECK(m_iStage >= Stage::kInitWriteObjs20 ||
- m_iStage < Stage::kInitWriteXRefs80);
- if (m_iStage == Stage::kInitWriteObjs20) {
- if (!m_IsIncremental && m_pParser) {
- m_CurObjNum = 0;
- m_iStage = Stage::kWriteOldObjs21;
+ DCHECK(stage_ >= Stage::kInitWriteObjs20 ||
+ stage_ < Stage::kInitWriteXRefs80);
+ if (stage_ == Stage::kInitWriteObjs20) {
+ if (!is_incremental_ && parser_) {
+ cur_obj_num_ = 0;
+ stage_ = Stage::kWriteOldObjs21;
} else {
- m_iStage = Stage::kInitWriteNewObjs25;
+ stage_ = Stage::kInitWriteNewObjs25;
}
}
- if (m_iStage == Stage::kWriteOldObjs21) {
+ if (stage_ == Stage::kWriteOldObjs21) {
if (!WriteOldObjs()) {
return Stage::kInvalid;
}
- m_iStage = Stage::kInitWriteNewObjs25;
+ stage_ = Stage::kInitWriteNewObjs25;
}
- if (m_iStage == Stage::kInitWriteNewObjs25) {
- m_CurObjNum = 0;
- m_iStage = Stage::kWriteNewObjs26;
+ if (stage_ == Stage::kInitWriteNewObjs25) {
+ cur_obj_num_ = 0;
+ stage_ = Stage::kWriteNewObjs26;
}
- if (m_iStage == Stage::kWriteNewObjs26) {
+ if (stage_ == Stage::kWriteNewObjs26) {
if (!WriteNewObjs()) {
return Stage::kInvalid;
}
- m_iStage = Stage::kWriteEncryptDict27;
+ stage_ = Stage::kWriteEncryptDict27;
}
- if (m_iStage == Stage::kWriteEncryptDict27) {
- if (m_pEncryptDict && m_pEncryptDict->IsInline()) {
- m_dwLastObjNum += 1;
- FX_FILESIZE saveOffset = m_Archive->CurrentOffset();
- if (!WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict.Get())) {
+ if (stage_ == Stage::kWriteEncryptDict27) {
+ if (encrypt_dict_ && encrypt_dict_->IsInline()) {
+ last_obj_num_ += 1;
+ FX_FILESIZE saveOffset = archive_->CurrentOffset();
+ if (!WriteIndirectObj(last_obj_num_, encrypt_dict_.Get())) {
return Stage::kInvalid;
}
- m_ObjectOffsets[m_dwLastObjNum] = saveOffset;
- if (m_IsIncremental) {
- m_NewObjNumArray.push_back(m_dwLastObjNum);
+ object_offsets_[last_obj_num_] = saveOffset;
+ if (is_incremental_) {
+ new_obj_num_array_.push_back(last_obj_num_);
}
}
- m_iStage = Stage::kInitWriteXRefs80;
+ stage_ = Stage::kInitWriteXRefs80;
}
- return m_iStage;
+ return stage_;
}
CPDF_Creator::Stage CPDF_Creator::WriteDoc_Stage3() {
- DCHECK(m_iStage >= Stage::kInitWriteXRefs80 ||
- m_iStage < Stage::kWriteTrailerAndFinish90);
+ DCHECK(stage_ >= Stage::kInitWriteXRefs80 ||
+ stage_ < Stage::kWriteTrailerAndFinish90);
- uint32_t dwLastObjNum = m_dwLastObjNum;
- if (m_iStage == Stage::kInitWriteXRefs80) {
- m_XrefStart = m_Archive->CurrentOffset();
- if (!m_IsIncremental || !m_pParser->IsXRefStream()) {
- if (!m_IsIncremental || m_pParser->GetLastXRefOffset() == 0) {
+ uint32_t dwLastObjNum = last_obj_num_;
+ if (stage_ == Stage::kInitWriteXRefs80) {
+ xref_start_ = archive_->CurrentOffset();
+ if (!is_incremental_ || !parser_->IsXRefStream()) {
+ if (!is_incremental_ || parser_->GetLastXRefOffset() == 0) {
ByteString str;
- str = pdfium::Contains(m_ObjectOffsets, 1)
+ str = pdfium::Contains(object_offsets_, 1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (!m_Archive->WriteString(str.AsStringView())) {
+ if (!archive_->WriteString(str.AsStringView())) {
return Stage::kInvalid;
}
- m_CurObjNum = 1;
- m_iStage = Stage::kWriteXrefsNotIncremental81;
+ cur_obj_num_ = 1;
+ stage_ = Stage::kWriteXrefsNotIncremental81;
} else {
- if (!m_Archive->WriteString("xref\r\n")) {
+ if (!archive_->WriteString("xref\r\n")) {
return Stage::kInvalid;
}
- m_CurObjNum = 0;
- m_iStage = Stage::kWriteXrefsIncremental82;
+ cur_obj_num_ = 0;
+ stage_ = Stage::kWriteXrefsIncremental82;
}
} else {
- m_iStage = Stage::kWriteTrailerAndFinish90;
+ stage_ = Stage::kWriteTrailerAndFinish90;
}
}
- if (m_iStage == Stage::kWriteXrefsNotIncremental81) {
+ if (stage_ == Stage::kWriteXrefsNotIncremental81) {
ByteString str;
- uint32_t i = m_CurObjNum;
+ uint32_t i = cur_obj_num_;
uint32_t j;
while (i <= dwLastObjNum) {
- while (i <= dwLastObjNum && !pdfium::Contains(m_ObjectOffsets, i)) {
+ while (i <= dwLastObjNum && !pdfium::Contains(object_offsets_, i)) {
i++;
}
@@ -377,7 +378,7 @@
}
j = i;
- while (j <= dwLastObjNum && pdfium::Contains(m_ObjectOffsets, j)) {
+ while (j <= dwLastObjNum && pdfium::Contains(object_offsets_, j)) {
j++;
}
@@ -387,13 +388,13 @@
str = ByteString::Format("%d %d\r\n", i, j - i);
}
- if (!m_Archive->WriteString(str.AsStringView())) {
+ if (!archive_->WriteString(str.AsStringView())) {
return Stage::kInvalid;
}
while (i < j) {
- str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[i++]);
- if (!m_Archive->WriteString(str.AsStringView())) {
+ str = ByteString::Format("%010d 00000 n\r\n", object_offsets_[i++]);
+ if (!archive_->WriteString(str.AsStringView())) {
return Stage::kInvalid;
}
}
@@ -401,66 +402,66 @@
break;
}
}
- m_iStage = Stage::kWriteTrailerAndFinish90;
+ stage_ = Stage::kWriteTrailerAndFinish90;
}
- if (m_iStage == Stage::kWriteXrefsIncremental82) {
+ if (stage_ == Stage::kWriteXrefsIncremental82) {
ByteString str;
- uint32_t iCount = fxcrt::CollectionSize<uint32_t>(m_NewObjNumArray);
- uint32_t i = m_CurObjNum;
+ uint32_t iCount = fxcrt::CollectionSize<uint32_t>(new_obj_num_array_);
+ uint32_t i = cur_obj_num_;
while (i < iCount) {
size_t j = i;
- uint32_t objnum = m_NewObjNumArray[i];
+ uint32_t objnum = new_obj_num_array_[i];
while (j < iCount) {
if (++j == iCount) {
break;
}
- uint32_t dwCurrent = m_NewObjNumArray[j];
+ uint32_t dwCurrent = new_obj_num_array_[j];
if (dwCurrent - objnum > 1) {
break;
}
objnum = dwCurrent;
}
- objnum = m_NewObjNumArray[i];
+ objnum = new_obj_num_array_[i];
if (objnum == 1) {
str = ByteString::Format("0 %d\r\n0000000000 65535 f\r\n", j - i + 1);
} else {
str = ByteString::Format("%d %d\r\n", objnum, j - i);
}
- if (!m_Archive->WriteString(str.AsStringView())) {
+ if (!archive_->WriteString(str.AsStringView())) {
return Stage::kInvalid;
}
while (i < j) {
- objnum = m_NewObjNumArray[i++];
- str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[objnum]);
- if (!m_Archive->WriteString(str.AsStringView())) {
+ objnum = new_obj_num_array_[i++];
+ str = ByteString::Format("%010d 00000 n\r\n", object_offsets_[objnum]);
+ if (!archive_->WriteString(str.AsStringView())) {
return Stage::kInvalid;
}
}
}
- m_iStage = Stage::kWriteTrailerAndFinish90;
+ stage_ = Stage::kWriteTrailerAndFinish90;
}
- return m_iStage;
+ return stage_;
}
CPDF_Creator::Stage CPDF_Creator::WriteDoc_Stage4() {
- DCHECK(m_iStage >= Stage::kWriteTrailerAndFinish90);
+ DCHECK(stage_ >= Stage::kWriteTrailerAndFinish90);
- bool bXRefStream = m_IsIncremental && m_pParser->IsXRefStream();
+ bool bXRefStream = is_incremental_ && parser_->IsXRefStream();
if (!bXRefStream) {
- if (!m_Archive->WriteString("trailer\r\n<<")) {
+ if (!archive_->WriteString("trailer\r\n<<")) {
return Stage::kInvalid;
}
} else {
- if (!m_Archive->WriteDWord(m_pDocument->GetLastObjNum() + 1) ||
- !m_Archive->WriteString(" 0 obj <<")) {
+ if (!archive_->WriteDWord(document_->GetLastObjNum() + 1) ||
+ !archive_->WriteString(" 0 obj <<")) {
return Stage::kInvalid;
}
}
- if (m_pParser) {
- CPDF_DictionaryLocker locker(m_pParser->GetCombinedTrailer());
+ if (parser_) {
+ CPDF_DictionaryLocker locker(parser_->GetCombinedTrailer());
for (const auto& it : locker) {
const ByteString& key = it.first;
const RetainPtr<CPDF_Object>& pValue = it.second;
@@ -470,234 +471,233 @@
key == "Type") {
continue;
}
- if (!m_Archive->WriteString(("/")) ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
+ if (!archive_->WriteString(("/")) ||
+ !archive_->WriteString(PDF_NameEncode(key).AsStringView())) {
return Stage::kInvalid;
}
- if (!pValue->WriteTo(m_Archive.get(), nullptr)) {
+ if (!pValue->WriteTo(archive_.get(), nullptr)) {
return Stage::kInvalid;
}
}
} else {
- if (!m_Archive->WriteString("\r\n/Root ") ||
- !m_Archive->WriteDWord(m_pDocument->GetRoot()->GetObjNum()) ||
- !m_Archive->WriteString(" 0 R\r\n")) {
+ if (!archive_->WriteString("\r\n/Root ") ||
+ !archive_->WriteDWord(document_->GetRoot()->GetObjNum()) ||
+ !archive_->WriteString(" 0 R\r\n")) {
return Stage::kInvalid;
}
- if (m_pDocument->GetInfo()) {
- if (!m_Archive->WriteString("/Info ") ||
- !m_Archive->WriteDWord(m_pDocument->GetInfo()->GetObjNum()) ||
- !m_Archive->WriteString(" 0 R\r\n")) {
+ if (document_->GetInfo()) {
+ if (!archive_->WriteString("/Info ") ||
+ !archive_->WriteDWord(document_->GetInfo()->GetObjNum()) ||
+ !archive_->WriteString(" 0 R\r\n")) {
return Stage::kInvalid;
}
}
}
- if (m_pEncryptDict) {
- if (!m_Archive->WriteString("/Encrypt")) {
+ if (encrypt_dict_) {
+ if (!archive_->WriteString("/Encrypt")) {
return Stage::kInvalid;
}
- uint32_t dwObjNum = m_pEncryptDict->GetObjNum();
+ uint32_t dwObjNum = encrypt_dict_->GetObjNum();
if (dwObjNum == 0) {
- dwObjNum = m_pDocument->GetLastObjNum() + 1;
+ dwObjNum = document_->GetLastObjNum() + 1;
}
- if (!m_Archive->WriteString(" ") || !m_Archive->WriteDWord(dwObjNum) ||
- !m_Archive->WriteString(" 0 R ")) {
+ if (!archive_->WriteString(" ") || !archive_->WriteDWord(dwObjNum) ||
+ !archive_->WriteString(" 0 R ")) {
return Stage::kInvalid;
}
}
- if (!m_Archive->WriteString("/Size ") ||
- !m_Archive->WriteDWord(m_dwLastObjNum + (bXRefStream ? 2 : 1))) {
+ if (!archive_->WriteString("/Size ") ||
+ !archive_->WriteDWord(last_obj_num_ + (bXRefStream ? 2 : 1))) {
return Stage::kInvalid;
}
- if (m_IsIncremental) {
- FX_FILESIZE prev = m_pParser->GetLastXRefOffset();
+ if (is_incremental_) {
+ FX_FILESIZE prev = parser_->GetLastXRefOffset();
if (prev) {
- if (!m_Archive->WriteString("/Prev ") ||
- !m_Archive->WriteFilesize(prev)) {
+ if (!archive_->WriteString("/Prev ") || !archive_->WriteFilesize(prev)) {
return Stage::kInvalid;
}
}
}
- if (m_pIDArray) {
- if (!m_Archive->WriteString(("/ID")) ||
- !m_pIDArray->WriteTo(m_Archive.get(), nullptr)) {
+ if (id_array_) {
+ if (!archive_->WriteString(("/ID")) ||
+ !id_array_->WriteTo(archive_.get(), nullptr)) {
return Stage::kInvalid;
}
}
if (!bXRefStream) {
- if (!m_Archive->WriteString(">>")) {
+ if (!archive_->WriteString(">>")) {
return Stage::kInvalid;
}
} else {
- if (!m_Archive->WriteString("/W[0 4 1]/Index[")) {
+ if (!archive_->WriteString("/W[0 4 1]/Index[")) {
return Stage::kInvalid;
}
- if (m_IsIncremental && m_pParser && m_pParser->GetLastXRefOffset() == 0) {
+ if (is_incremental_ && parser_ && parser_->GetLastXRefOffset() == 0) {
uint32_t i = 0;
- for (i = 0; i < m_dwLastObjNum; i++) {
- if (!pdfium::Contains(m_ObjectOffsets, i)) {
+ for (i = 0; i < last_obj_num_; i++) {
+ if (!pdfium::Contains(object_offsets_, i)) {
continue;
}
- if (!m_Archive->WriteDWord(i) || !m_Archive->WriteString(" 1 ")) {
+ if (!archive_->WriteDWord(i) || !archive_->WriteString(" 1 ")) {
return Stage::kInvalid;
}
}
- if (!m_Archive->WriteString("]/Length ") ||
- !m_Archive->WriteDWord(m_dwLastObjNum * 5) ||
- !m_Archive->WriteString(">>stream\r\n")) {
+ if (!archive_->WriteString("]/Length ") ||
+ !archive_->WriteDWord(last_obj_num_ * 5) ||
+ !archive_->WriteString(">>stream\r\n")) {
return Stage::kInvalid;
}
- for (i = 0; i < m_dwLastObjNum; i++) {
- auto it = m_ObjectOffsets.find(i);
- if (it == m_ObjectOffsets.end()) {
+ for (i = 0; i < last_obj_num_; i++) {
+ auto it = object_offsets_.find(i);
+ if (it == object_offsets_.end()) {
continue;
}
- if (!OutputIndex(m_Archive.get(), it->second)) {
+ if (!OutputIndex(archive_.get(), it->second)) {
return Stage::kInvalid;
}
}
} else {
- int count = fxcrt::CollectionSize<int>(m_NewObjNumArray);
+ int count = fxcrt::CollectionSize<int>(new_obj_num_array_);
int i = 0;
for (i = 0; i < count; i++) {
- if (!m_Archive->WriteDWord(m_NewObjNumArray[i]) ||
- !m_Archive->WriteString(" 1 ")) {
+ if (!archive_->WriteDWord(new_obj_num_array_[i]) ||
+ !archive_->WriteString(" 1 ")) {
return Stage::kInvalid;
}
}
- if (!m_Archive->WriteString("]/Length ") ||
- !m_Archive->WriteDWord(count * 5) ||
- !m_Archive->WriteString(">>stream\r\n")) {
+ if (!archive_->WriteString("]/Length ") ||
+ !archive_->WriteDWord(count * 5) ||
+ !archive_->WriteString(">>stream\r\n")) {
return Stage::kInvalid;
}
for (i = 0; i < count; ++i) {
- if (!OutputIndex(m_Archive.get(),
- m_ObjectOffsets[m_NewObjNumArray[i]])) {
+ if (!OutputIndex(archive_.get(),
+ object_offsets_[new_obj_num_array_[i]])) {
return Stage::kInvalid;
}
}
}
- if (!m_Archive->WriteString("\r\nendstream")) {
+ if (!archive_->WriteString("\r\nendstream")) {
return Stage::kInvalid;
}
}
- if (!m_Archive->WriteString("\r\nstartxref\r\n") ||
- !m_Archive->WriteFilesize(m_XrefStart) ||
- !m_Archive->WriteString("\r\n%%EOF\r\n")) {
+ if (!archive_->WriteString("\r\nstartxref\r\n") ||
+ !archive_->WriteFilesize(xref_start_) ||
+ !archive_->WriteString("\r\n%%EOF\r\n")) {
return Stage::kInvalid;
}
- m_iStage = Stage::kComplete100;
- return m_iStage;
+ stage_ = Stage::kComplete100;
+ return stage_;
}
bool CPDF_Creator::Create(uint32_t flags) {
- m_IsIncremental = !!(flags & FPDFCREATE_INCREMENTAL);
- m_IsOriginal = !(flags & FPDFCREATE_NO_ORIGINAL);
+ is_incremental_ = !!(flags & FPDFCREATE_INCREMENTAL);
+ is_original_ = !(flags & FPDFCREATE_NO_ORIGINAL);
- m_iStage = Stage::kInit0;
- m_dwLastObjNum = m_pDocument->GetLastObjNum();
- m_ObjectOffsets.clear();
- m_NewObjNumArray.clear();
+ stage_ = Stage::kInit0;
+ last_obj_num_ = document_->GetLastObjNum();
+ object_offsets_.clear();
+ new_obj_num_array_.clear();
InitID();
return Continue();
}
void CPDF_Creator::InitID() {
- DCHECK(!m_pIDArray);
+ DCHECK(!id_array_);
- m_pIDArray = pdfium::MakeRetain<CPDF_Array>();
+ id_array_ = pdfium::MakeRetain<CPDF_Array>();
RetainPtr<const CPDF_Array> pOldIDArray =
- m_pParser ? m_pParser->GetIDArray() : nullptr;
+ parser_ ? parser_->GetIDArray() : nullptr;
RetainPtr<const CPDF_Object> pID1 =
pOldIDArray ? pOldIDArray->GetObjectAt(0) : nullptr;
if (pID1) {
- m_pIDArray->Append(pID1->Clone());
+ id_array_->Append(pID1->Clone());
} else {
std::array<uint32_t, 4> file_id =
- GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- m_pIDArray->AppendNew<CPDF_String>(pdfium::as_byte_span(file_id),
- CPDF_String::DataType::kIsHex);
+ GenerateFileID((uint32_t)(uintptr_t)this, last_obj_num_);
+ id_array_->AppendNew<CPDF_String>(pdfium::as_byte_span(file_id),
+ CPDF_String::DataType::kIsHex);
}
if (pOldIDArray) {
RetainPtr<const CPDF_Object> pID2 = pOldIDArray->GetObjectAt(1);
- if (m_IsIncremental && m_pEncryptDict && pID2) {
- m_pIDArray->Append(pID2->Clone());
+ if (is_incremental_ && encrypt_dict_ && pID2) {
+ id_array_->Append(pID2->Clone());
return;
}
std::array<uint32_t, 4> file_id =
- GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- m_pIDArray->AppendNew<CPDF_String>(pdfium::as_byte_span(file_id),
- CPDF_String::DataType::kIsHex);
+ GenerateFileID((uint32_t)(uintptr_t)this, last_obj_num_);
+ id_array_->AppendNew<CPDF_String>(pdfium::as_byte_span(file_id),
+ CPDF_String::DataType::kIsHex);
return;
}
- m_pIDArray->Append(m_pIDArray->GetObjectAt(0)->Clone());
- if (m_pEncryptDict) {
- DCHECK(m_pParser);
- int revision = m_pEncryptDict->GetIntegerFor("R");
+ id_array_->Append(id_array_->GetObjectAt(0)->Clone());
+ if (encrypt_dict_) {
+ DCHECK(parser_);
+ int revision = encrypt_dict_->GetIntegerFor("R");
if ((revision == 2 || revision == 3) &&
- m_pEncryptDict->GetByteStringFor("Filter") == "Standard") {
- m_pNewEncryptDict = ToDictionary(m_pEncryptDict->Clone());
- m_pEncryptDict = m_pNewEncryptDict;
- m_pSecurityHandler = pdfium::MakeRetain<CPDF_SecurityHandler>();
- m_pSecurityHandler->OnCreate(m_pNewEncryptDict.Get(), m_pIDArray.Get(),
- m_pParser->GetEncodedPassword());
- m_bSecurityChanged = true;
+ encrypt_dict_->GetByteStringFor("Filter") == "Standard") {
+ new_encrypt_dict_ = ToDictionary(encrypt_dict_->Clone());
+ encrypt_dict_ = new_encrypt_dict_;
+ security_handler_ = pdfium::MakeRetain<CPDF_SecurityHandler>();
+ security_handler_->OnCreate(new_encrypt_dict_.Get(), id_array_.Get(),
+ parser_->GetEncodedPassword());
+ security_changed_ = true;
}
}
}
bool CPDF_Creator::Continue() {
- if (m_iStage < Stage::kInit0) {
+ if (stage_ < Stage::kInit0) {
return false;
}
Stage iRet = Stage::kInit0;
- while (m_iStage < Stage::kComplete100) {
- if (m_iStage < Stage::kInitWriteObjs20) {
+ while (stage_ < Stage::kComplete100) {
+ if (stage_ < Stage::kInitWriteObjs20) {
iRet = WriteDoc_Stage1();
- } else if (m_iStage < Stage::kInitWriteXRefs80) {
+ } else if (stage_ < Stage::kInitWriteXRefs80) {
iRet = WriteDoc_Stage2();
- } else if (m_iStage < Stage::kWriteTrailerAndFinish90) {
+ } else if (stage_ < Stage::kWriteTrailerAndFinish90) {
iRet = WriteDoc_Stage3();
} else {
iRet = WriteDoc_Stage4();
}
- if (iRet < m_iStage) {
+ if (iRet < stage_) {
break;
}
}
- if (iRet <= Stage::kInit0 || m_iStage == Stage::kComplete100) {
- m_iStage = Stage::kInvalid;
+ if (iRet <= Stage::kInit0 || stage_ == Stage::kComplete100) {
+ stage_ = Stage::kInvalid;
return iRet > Stage::kInit0;
}
- return m_iStage > Stage::kInvalid;
+ return stage_ > Stage::kInvalid;
}
bool CPDF_Creator::SetFileVersion(int32_t fileVersion) {
if (fileVersion < 10 || fileVersion > 17) {
return false;
}
- m_FileVersion = fileVersion;
+ file_version_ = fileVersion;
return true;
}
void CPDF_Creator::RemoveSecurity() {
- m_pSecurityHandler.Reset();
- m_bSecurityChanged = true;
- m_pEncryptDict = nullptr;
- m_pNewEncryptDict.Reset();
+ security_handler_.Reset();
+ security_changed_ = true;
+ encrypt_dict_ = nullptr;
+ new_encrypt_dict_.Reset();
}
CPDF_CryptoHandler* CPDF_Creator::GetCryptoHandler() {
- return m_pSecurityHandler ? m_pSecurityHandler->GetCryptoHandler() : nullptr;
+ return security_handler_ ? security_handler_->GetCryptoHandler() : nullptr;
}
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index b97dc29..5419d0a 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -72,24 +72,24 @@
CPDF_CryptoHandler* GetCryptoHandler();
- UnownedPtr<CPDF_Document> const m_pDocument;
- UnownedPtr<CPDF_Parser> const m_pParser;
- RetainPtr<const CPDF_Dictionary> m_pEncryptDict;
- RetainPtr<CPDF_Dictionary> m_pNewEncryptDict;
- RetainPtr<CPDF_SecurityHandler> m_pSecurityHandler;
- uint32_t m_dwLastObjNum;
- std::unique_ptr<IFX_ArchiveStream> m_Archive;
- FX_FILESIZE m_SavedOffset = 0;
- Stage m_iStage = Stage::kInvalid;
- uint32_t m_CurObjNum = 0;
- FX_FILESIZE m_XrefStart = 0;
- std::map<uint32_t, FX_FILESIZE> m_ObjectOffsets;
- std::vector<uint32_t> m_NewObjNumArray; // Sorted, ascending.
- RetainPtr<CPDF_Array> m_pIDArray;
- int32_t m_FileVersion = 0;
- bool m_bSecurityChanged = false;
- bool m_IsIncremental = false;
- bool m_IsOriginal = false;
+ UnownedPtr<CPDF_Document> const document_;
+ UnownedPtr<CPDF_Parser> const parser_;
+ RetainPtr<const CPDF_Dictionary> encrypt_dict_;
+ RetainPtr<CPDF_Dictionary> new_encrypt_dict_;
+ RetainPtr<CPDF_SecurityHandler> security_handler_;
+ uint32_t last_obj_num_;
+ std::unique_ptr<IFX_ArchiveStream> archive_;
+ FX_FILESIZE saved_offset_ = 0;
+ Stage stage_ = Stage::kInvalid;
+ uint32_t cur_obj_num_ = 0;
+ FX_FILESIZE xref_start_ = 0;
+ std::map<uint32_t, FX_FILESIZE> object_offsets_;
+ std::vector<uint32_t> new_obj_num_array_; // Sorted, ascending.
+ RetainPtr<CPDF_Array> id_array_;
+ int32_t file_version_ = 0;
+ bool security_changed_ = false;
+ bool is_incremental_ = false;
+ bool is_original_ = false;
};
#endif // CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index b1d4415..27ea644 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -319,18 +319,18 @@
CPDF_PageContentGenerator::CPDF_PageContentGenerator(
CPDF_PageObjectHolder* pObjHolder)
- : m_pObjHolder(pObjHolder), m_pDocument(pObjHolder->GetDocument()) {
+ : obj_holder_(pObjHolder), document_(pObjHolder->GetDocument()) {
// Copy all page objects, even if they are inactive. They are needed in
// GenerateModifiedStreams() below.
for (const auto& pObj : *pObjHolder) {
- m_pageObjects.emplace_back(pObj.get());
+ page_objects_.emplace_back(pObj.get());
}
}
CPDF_PageContentGenerator::~CPDF_PageContentGenerator() = default;
void CPDF_PageContentGenerator::GenerateContent() {
- DCHECK(m_pObjHolder->IsPage());
+ DCHECK(obj_holder_->IsPage());
std::map<int32_t, fxcrt::ostringstream> new_stream_data =
GenerateModifiedStreams();
// If no streams were regenerated or removed, nothing to do here.
@@ -346,7 +346,7 @@
CPDF_PageContentGenerator::GenerateModifiedStreams() {
// Figure out which streams are dirty.
std::set<int32_t> all_dirty_streams;
- for (auto& pPageObj : m_pageObjects) {
+ for (auto& pPageObj : page_objects_) {
// Must include dirty page objects even if they are marked as inactive.
// Otherwise an inactive object will not be detected that its stream needs
// to be removed as part of regeneration.
@@ -354,7 +354,7 @@
all_dirty_streams.insert(pPageObj->GetContentStream());
}
}
- std::set<int32_t> marked_dirty_streams = m_pObjHolder->TakeDirtyStreams();
+ std::set<int32_t> marked_dirty_streams = obj_holder_->TakeDirtyStreams();
all_dirty_streams.insert(marked_dirty_streams.begin(),
marked_dirty_streams.end());
@@ -371,8 +371,7 @@
// Set the default graphic state values. Update CTM to be the identity
// matrix for the duration of this stream, if it is not already.
buf << "q\n";
- const CFX_Matrix ctm =
- m_pObjHolder->GetCTMAtBeginningOfStream(dirty_stream);
+ const CFX_Matrix ctm = obj_holder_->GetCTMAtBeginningOfStream(dirty_stream);
if (!ctm.IsIdentity()) {
WriteMatrix(buf, ctm.GetInverse()) << " cm\n";
}
@@ -384,7 +383,7 @@
}
// Process the page objects, write into each dirty stream.
- for (auto& pPageObj : m_pageObjects) {
+ for (auto& pPageObj : page_objects_) {
if (!pPageObj->IsActive()) {
continue;
}
@@ -409,11 +408,11 @@
bool affects_ctm;
if (dirty_stream == 0) {
// For the first stream, `prev_ctm` is the identity matrix.
- ctm = m_pObjHolder->GetCTMAtEndOfStream(dirty_stream);
+ ctm = obj_holder_->GetCTMAtEndOfStream(dirty_stream);
affects_ctm = !ctm.IsIdentity();
} else if (dirty_stream > 0) {
- prev_ctm = m_pObjHolder->GetCTMAtEndOfStream(dirty_stream - 1);
- ctm = m_pObjHolder->GetCTMAtEndOfStream(dirty_stream);
+ prev_ctm = obj_holder_->GetCTMAtEndOfStream(dirty_stream - 1);
+ ctm = obj_holder_->GetCTMAtEndOfStream(dirty_stream);
affects_ctm = prev_ctm != ctm;
} else {
CHECK_EQ(CPDF_PageObject::kNoContentStream, dirty_stream);
@@ -455,9 +454,9 @@
CHECK(!new_stream_data.empty());
// Make sure default graphics are created.
- m_DefaultGraphicsName = GetOrCreateDefaultGraphics();
+ default_graphics_name_ = GetOrCreateDefaultGraphics();
- CPDF_PageContentManager page_content_manager(m_pObjHolder, m_pDocument);
+ CPDF_PageContentManager page_content_manager(obj_holder_, document_);
for (auto& pair : new_stream_data) {
int32_t stream_index = pair.first;
fxcrt::ostringstream* buf = &pair.second;
@@ -478,55 +477,55 @@
}
void CPDF_PageContentGenerator::UpdateResourcesDict() {
- RetainPtr<CPDF_Dictionary> resources = m_pObjHolder->GetMutableResources();
+ RetainPtr<CPDF_Dictionary> resources = obj_holder_->GetMutableResources();
if (!resources) {
return;
}
// Do not modify shared resource dictionaries. Give this page its own copy.
- if (IsPageResourceShared(m_pDocument, m_pObjHolder->GetDict(), resources)) {
+ if (IsPageResourceShared(document_, obj_holder_->GetDict(), resources)) {
resources = pdfium::WrapRetain(resources->Clone()->AsMutableDictionary());
const uint32_t clone_object_number =
- m_pDocument->AddIndirectObject(resources);
- m_pObjHolder->SetResources(resources);
- m_pObjHolder->GetMutableDict()->SetNewFor<CPDF_Reference>(
- pdfium::page_object::kResources, m_pDocument, clone_object_number);
+ document_->AddIndirectObject(resources);
+ obj_holder_->SetResources(resources);
+ obj_holder_->GetMutableDict()->SetNewFor<CPDF_Reference>(
+ pdfium::page_object::kResources, document_, clone_object_number);
}
// Even though `resources` itself is not shared, its dictionary entries may be
// shared. Checked for that and clone those as well.
- CloneResourcesDictEntries(m_pDocument, resources);
+ CloneResourcesDictEntries(document_, resources);
ResourcesMap seen_resources;
- for (auto& page_object : m_pageObjects) {
+ for (auto& page_object : page_objects_) {
if (!page_object->IsActive()) {
continue;
}
RecordPageObjectResourceUsage(page_object, seen_resources);
}
- if (!m_DefaultGraphicsName.IsEmpty()) {
- seen_resources["ExtGState"].insert(m_DefaultGraphicsName);
+ if (!default_graphics_name_.IsEmpty()) {
+ seen_resources["ExtGState"].insert(default_graphics_name_);
}
RemoveOrRestoreUnusedResources(std::move(resources), seen_resources,
- m_pObjHolder->all_removed_resources_map());
+ obj_holder_->all_removed_resources_map());
}
ByteString CPDF_PageContentGenerator::RealizeResource(
const CPDF_Object* pResource,
const ByteString& bsType) const {
DCHECK(pResource);
- if (!m_pObjHolder->GetResources()) {
- m_pObjHolder->SetResources(m_pDocument->NewIndirect<CPDF_Dictionary>());
- m_pObjHolder->GetMutableDict()->SetNewFor<CPDF_Reference>(
- pdfium::page_object::kResources, m_pDocument,
- m_pObjHolder->GetResources()->GetObjNum());
+ if (!obj_holder_->GetResources()) {
+ obj_holder_->SetResources(document_->NewIndirect<CPDF_Dictionary>());
+ obj_holder_->GetMutableDict()->SetNewFor<CPDF_Reference>(
+ pdfium::page_object::kResources, document_,
+ obj_holder_->GetResources()->GetObjNum());
}
RetainPtr<CPDF_Dictionary> resource_dict =
- m_pObjHolder->GetMutableResources()->GetOrCreateDictFor(bsType);
+ obj_holder_->GetMutableResources()->GetOrCreateDictFor(bsType);
const auto& all_removed_resources_map =
- m_pObjHolder->all_removed_resources_map();
+ obj_holder_->all_removed_resources_map();
auto it = all_removed_resources_map.find(bsType);
const CPDF_PageObjectHolder::RemovedResourceMap* removed_resource_map =
it != all_removed_resources_map.end() ? &it->second : nullptr;
@@ -547,7 +546,7 @@
continue;
}
- resource_dict->SetNewFor<CPDF_Reference>(name, m_pDocument,
+ resource_dict->SetNewFor<CPDF_Reference>(name, document_,
pResource->GetObjNum());
return name;
}
@@ -559,8 +558,8 @@
std::make_unique<CPDF_ContentMarks>();
const CPDF_ContentMarks* content_marks = empty_content_marks.get();
- for (auto& pPageObj : m_pageObjects) {
- if (m_pObjHolder->IsPage() &&
+ for (auto& pPageObj : page_objects_) {
+ if (obj_holder_->IsPage() &&
(!pPageObj->IsDirty() || !pPageObj->IsActive())) {
continue;
}
@@ -575,7 +574,7 @@
void CPDF_PageContentGenerator::UpdateStreamlessPageObjects(
int new_content_stream_index) {
- for (auto& pPageObj : m_pageObjects) {
+ for (auto& pPageObj : page_objects_) {
if (!pPageObj->IsActive()) {
continue;
}
@@ -694,7 +693,7 @@
pImageObj->SetResourceName(name);
if (bWasInline) {
- auto* pPageData = CPDF_DocPageData::FromDocument(m_pDocument);
+ auto* pPageData = CPDF_DocPageData::FromDocument(document_);
pImageObj->SetImage(pPageData->GetImage(pStream->GetObjNum()));
}
@@ -876,8 +875,7 @@
}
ByteString name;
- std::optional<ByteString> maybe_name =
- m_pObjHolder->GraphicsMapSearch(graphD);
+ std::optional<ByteString> maybe_name = obj_holder_->GraphicsMapSearch(graphD);
if (maybe_name.has_value()) {
name = std::move(maybe_name.value());
} else {
@@ -894,10 +892,10 @@
gsDict->SetNewFor<CPDF_Name>("BM",
pPageObj->general_state().GetBlendMode());
}
- m_pDocument->AddIndirectObject(gsDict);
+ document_->AddIndirectObject(gsDict);
name = RealizeResource(std::move(gsDict), "ExtGState");
pPageObj->mutable_general_state().SetGraphicsResourceNames({name});
- m_pObjHolder->GraphicsMapInsert(graphD, name);
+ obj_holder_->GraphicsMapInsert(graphD, name);
}
*buf << "/" << PDF_NameEncode(name) << " gs ";
}
@@ -907,8 +905,8 @@
*buf << "0 0 0 RG 0 0 0 rg 1 w "
<< static_cast<int>(CFX_GraphStateData::LineCap::kButt) << " J "
<< static_cast<int>(CFX_GraphStateData::LineJoin::kMiter) << " j\n";
- m_DefaultGraphicsName = GetOrCreateDefaultGraphics();
- *buf << "/" << PDF_NameEncode(m_DefaultGraphicsName) << " gs ";
+ default_graphics_name_ = GetOrCreateDefaultGraphics();
+ *buf << "/" << PDF_NameEncode(default_graphics_name_) << " gs ";
}
ByteString CPDF_PageContentGenerator::GetOrCreateDefaultGraphics() const {
@@ -918,7 +916,7 @@
defaultGraphics.blendType = BlendMode::kNormal;
std::optional<ByteString> maybe_name =
- m_pObjHolder->GraphicsMapSearch(defaultGraphics);
+ obj_holder_->GraphicsMapSearch(defaultGraphics);
if (maybe_name.has_value()) {
return maybe_name.value();
}
@@ -927,9 +925,9 @@
gsDict->SetNewFor<CPDF_Number>("ca", defaultGraphics.fillAlpha);
gsDict->SetNewFor<CPDF_Number>("CA", defaultGraphics.strokeAlpha);
gsDict->SetNewFor<CPDF_Name>("BM", "Normal");
- m_pDocument->AddIndirectObject(gsDict);
+ document_->AddIndirectObject(gsDict);
ByteString name = RealizeResource(std::move(gsDict), "ExtGState");
- m_pObjHolder->GraphicsMapInsert(defaultGraphics, name);
+ obj_holder_->GraphicsMapInsert(defaultGraphics, name);
return name;
}
@@ -950,7 +948,7 @@
RetainPtr<CPDF_Font> pFont(pTextObj->GetFont());
if (!pFont) {
- pFont = CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
+ pFont = CPDF_Font::GetStockFont(document_, "Helvetica");
}
FontData data;
@@ -969,7 +967,7 @@
data.baseFont = pFont->GetBaseFontName();
ByteString dict_name;
- std::optional<ByteString> maybe_name = m_pObjHolder->FontsMapSearch(data);
+ std::optional<ByteString> maybe_name = obj_holder_->FontsMapSearch(data);
if (maybe_name.has_value()) {
dict_name = std::move(maybe_name.value());
} else {
@@ -982,13 +980,13 @@
pFontDict->SetNewFor<CPDF_Name>("BaseFont", data.baseFont);
if (pEncoding) {
pFontDict->SetFor("Encoding",
- pEncoding->Realize(m_pDocument->GetByteStringPool()));
+ pEncoding->Realize(document_->GetByteStringPool()));
}
- m_pDocument->AddIndirectObject(pFontDict);
+ document_->AddIndirectObject(pFontDict);
pIndirectFont = std::move(pFontDict);
}
dict_name = RealizeResource(std::move(pIndirectFont), "Font");
- m_pObjHolder->FontsMapInsert(data, dict_name);
+ obj_holder_->FontsMapInsert(data, dict_name);
}
pTextObj->SetResourceName(dict_name);
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 4d7e67b..8d99401 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -69,14 +69,14 @@
// been parsed from or written to any content stream yet.
void UpdateStreamlessPageObjects(int new_content_stream_index);
- // Updates the resource dictionary for `m_pObjHolder` to account for all the
+ // Updates the resource dictionary for `obj_holder_` to account for all the
// changes.
void UpdateResourcesDict();
- UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
- UnownedPtr<CPDF_Document> const m_pDocument;
- std::vector<UnownedPtr<CPDF_PageObject>> m_pageObjects;
- ByteString m_DefaultGraphicsName;
+ UnownedPtr<CPDF_PageObjectHolder> const obj_holder_;
+ UnownedPtr<CPDF_Document> const document_;
+ std::vector<UnownedPtr<CPDF_PageObject>> page_objects_;
+ ByteString default_graphics_name_;
};
#endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 12be2da..9669f83 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -41,7 +41,7 @@
const ByteString& type,
const ByteString& name) {
RetainPtr<const CPDF_Dictionary> pResources =
- pGen->m_pObjHolder->GetResources();
+ pGen->obj_holder_->GetResources();
return pResources->GetDictFor(type)->GetDictFor(name);
}
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index ff083e8..08d5123 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -110,20 +110,20 @@
} // namespace
CPDF_LinkExtract::CPDF_LinkExtract(const CPDF_TextPage* pTextPage)
- : m_pTextPage(pTextPage) {}
+ : text_page_(pTextPage) {}
CPDF_LinkExtract::~CPDF_LinkExtract() = default;
void CPDF_LinkExtract::ExtractLinks() {
- m_LinkArray.clear();
+ link_array_.clear();
size_t start = 0;
size_t pos = 0;
bool bAfterHyphen = false;
bool bLineBreak = false;
- const size_t nTotalChar = m_pTextPage->CountChars();
- const WideString page_text = m_pTextPage->GetAllPageText();
+ const size_t nTotalChar = text_page_->CountChars();
+ const WideString page_text = text_page_->GetAllPageText();
while (pos < nTotalChar) {
- const CPDF_TextPage::CharInfo& char_info = m_pTextPage->GetCharInfo(pos);
+ const CPDF_TextPage::CharInfo& char_info = text_page_->GetCharInfo(pos);
if (char_info.char_type() != CPDF_TextPage::CharType::kGenerated &&
char_info.unicode() != L' ' && pos != nTotalChar - 1) {
bAfterHyphen =
@@ -170,10 +170,10 @@
if (nCount > 5) {
auto maybe_link = CheckWebLink(strBeCheck);
if (maybe_link.has_value()) {
- maybe_link.value().m_Start += start;
- m_LinkArray.push_back(maybe_link.value());
+ maybe_link.value().start_ += start;
+ link_array_.push_back(maybe_link.value());
} else if (CheckMailLink(&strBeCheck)) {
- m_LinkArray.push_back(Link{{start, nCount}, strBeCheck});
+ link_array_.push_back(Link{{start, nCount}, strBeCheck});
}
}
}
@@ -307,23 +307,22 @@
}
WideString CPDF_LinkExtract::GetURL(size_t index) const {
- return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl
- : WideString();
+ return index < link_array_.size() ? link_array_[index].url_ : WideString();
}
std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const {
- if (index >= m_LinkArray.size()) {
+ if (index >= link_array_.size()) {
return std::vector<CFX_FloatRect>();
}
- return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start,
- m_LinkArray[index].m_Count);
+ return text_page_->GetRectArray(link_array_[index].start_,
+ link_array_[index].count_);
}
std::optional<CPDF_LinkExtract::Range> CPDF_LinkExtract::GetTextRange(
size_t index) const {
- if (index >= m_LinkArray.size()) {
+ if (index >= link_array_.size()) {
return std::nullopt;
}
- return m_LinkArray[index];
+ return link_array_[index];
}
diff --git a/core/fpdftext/cpdf_linkextract.h b/core/fpdftext/cpdf_linkextract.h
index 87f1c18..08e1109 100644
--- a/core/fpdftext/cpdf_linkextract.h
+++ b/core/fpdftext/cpdf_linkextract.h
@@ -22,29 +22,29 @@
class CPDF_LinkExtract {
public:
struct Range {
- size_t m_Start;
- size_t m_Count;
+ size_t start_;
+ size_t count_;
};
explicit CPDF_LinkExtract(const CPDF_TextPage* pTextPage);
~CPDF_LinkExtract();
void ExtractLinks();
- size_t CountLinks() const { return m_LinkArray.size(); }
+ size_t CountLinks() const { return link_array_.size(); }
WideString GetURL(size_t index) const;
std::vector<CFX_FloatRect> GetRects(size_t index) const;
std::optional<Range> GetTextRange(size_t index) const;
protected:
struct Link : public Range {
- WideString m_strUrl;
+ WideString url_;
};
std::optional<Link> CheckWebLink(const WideString& str);
bool CheckMailLink(WideString* str);
- UnownedPtr<const CPDF_TextPage> const m_pTextPage;
- std::vector<Link> m_LinkArray;
+ UnownedPtr<const CPDF_TextPage> const text_page_;
+ std::vector<Link> link_array_;
};
#endif // CORE_FPDFTEXT_CPDF_LINKEXTRACT_H_
diff --git a/core/fpdftext/cpdf_linkextract_unittest.cpp b/core/fpdftext/cpdf_linkextract_unittest.cpp
index c99b43f..ba9632a 100644
--- a/core/fpdftext/cpdf_linkextract_unittest.cpp
+++ b/core/fpdftext/cpdf_linkextract_unittest.cpp
@@ -175,8 +175,8 @@
for (const auto& it : kValidCases) {
auto maybe_link = extractor.CheckWebLink(it.input_string);
ASSERT_TRUE(maybe_link.has_value()) << it.input_string;
- EXPECT_EQ(it.url_extracted, maybe_link.value().m_strUrl);
- EXPECT_EQ(it.start_offset, maybe_link.value().m_Start) << it.input_string;
- EXPECT_EQ(it.count, maybe_link.value().m_Count) << it.input_string;
+ EXPECT_EQ(it.url_extracted, maybe_link.value().url_);
+ EXPECT_EQ(it.start_offset, maybe_link.value().start_) << it.input_string;
+ EXPECT_EQ(it.count, maybe_link.value().count_) << it.input_string;
}
}
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index d8e8d9b..6fe10fc 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -367,47 +367,47 @@
CPDF_TextPage::CharInfo::~CharInfo() = default;
CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, bool rtl)
- : m_pPage(pPage), m_rtl(rtl), m_DisplayMatrix(GetPageMatrix(pPage)) {
+ : page_(pPage), rtl_(rtl), display_matrix_(GetPageMatrix(pPage)) {
Init();
}
CPDF_TextPage::~CPDF_TextPage() = default;
void CPDF_TextPage::Init() {
- m_TextBuf.SetAllocStep(10240);
+ text_buf_.SetAllocStep(10240);
ProcessObject();
const int nCount = CountChars();
if (nCount) {
- m_CharIndices.push_back({0, 0});
+ char_indices_.push_back({0, 0});
}
bool skipped = false;
for (int i = 0; i < nCount; ++i) {
- const CharInfo& charinfo = m_CharList[i];
+ const CharInfo& charinfo = char_list_[i];
if (charinfo.char_type() == CharType::kGenerated ||
(charinfo.unicode() != 0 && !IsControlChar(charinfo)) ||
(charinfo.unicode() == 0 && charinfo.char_code() != 0)) {
- m_CharIndices.back().count++;
+ char_indices_.back().count++;
skipped = true;
} else {
if (skipped) {
- m_CharIndices.push_back({i + 1, 0});
+ char_indices_.push_back({i + 1, 0});
skipped = false;
} else {
- m_CharIndices.back().index = i + 1;
+ char_indices_.back().index = i + 1;
}
}
}
}
int CPDF_TextPage::CountChars() const {
- return fxcrt::CollectionSize<int>(m_CharList);
+ return fxcrt::CollectionSize<int>(char_list_);
}
int CPDF_TextPage::CharIndexFromTextIndex(int text_index) const {
int count = 0;
- for (const auto& info : m_CharIndices) {
+ for (const auto& info : char_indices_) {
count += info.count;
if (count > text_index) {
return text_index - count + info.count + info.index;
@@ -418,7 +418,7 @@
int CPDF_TextPage::TextIndexFromCharIndex(int char_index) const {
int count = 0;
- for (const auto& info : m_CharIndices) {
+ for (const auto& info : char_indices_) {
int text_index = char_index - info.index;
if (text_index < info.count) {
return text_index >= 0 ? text_index + count : -1;
@@ -451,7 +451,7 @@
int pos = start;
bool is_new_rect = true;
while (count--) {
- const CharInfo& charinfo = m_CharList[pos++];
+ const CharInfo& charinfo = char_list_[pos++];
if (charinfo.char_type() == CharType::kGenerated) {
continue;
}
@@ -487,7 +487,7 @@
double ydif = 5000;
const int nCount = CountChars();
for (pos = 0; pos < nCount; ++pos) {
- const CFX_FloatRect& orig_charrect = m_CharList[pos].char_box();
+ const CFX_FloatRect& orig_charrect = char_list_[pos].char_box();
if (orig_charrect.Contains(point)) {
break;
}
@@ -525,7 +525,7 @@
bool IsContainPreChar = false;
bool IsAddLineFeed = false;
WideString strText;
- for (const auto& charinfo : m_CharList) {
+ for (const auto& charinfo : char_list_) {
if (predicate(charinfo)) {
if (fabs(posy - charinfo.origin().y) > 0 && !IsContainPreChar &&
IsAddLineFeed) {
@@ -567,28 +567,28 @@
}
const CPDF_TextPage::CharInfo& CPDF_TextPage::GetCharInfo(size_t index) const {
- CHECK_LT(index, m_CharList.size());
- return m_CharList[index];
+ CHECK_LT(index, char_list_.size());
+ return char_list_[index];
}
CPDF_TextPage::CharInfo& CPDF_TextPage::GetCharInfo(size_t index) {
- CHECK_LT(index, m_CharList.size());
- return m_CharList[index];
+ CHECK_LT(index, char_list_.size());
+ return char_list_[index];
}
float CPDF_TextPage::GetCharFontSize(size_t index) const {
- CHECK_LT(index, m_CharList.size());
- return GetFontSize(m_CharList[index].text_object());
+ CHECK_LT(index, char_list_.size());
+ return GetFontSize(char_list_[index].text_object());
}
CFX_FloatRect CPDF_TextPage::GetCharLooseBounds(size_t index) const {
- CHECK_LT(index, m_CharList.size());
- return m_CharList[index].loose_char_box();
+ CHECK_LT(index, char_list_.size());
+ return char_list_[index].loose_char_box();
}
WideString CPDF_TextPage::GetPageText(int start, int count) const {
- if (start < 0 || start >= CountChars() || count <= 0 || m_CharList.empty() ||
- m_TextBuf.IsEmpty()) {
+ if (start < 0 || start >= CountChars() || count <= 0 || char_list_.empty() ||
+ text_buf_.IsEmpty()) {
return WideString();
}
@@ -629,7 +629,7 @@
int text_count = text_last - text_start + 1;
- return WideString(m_TextBuf.AsStringView().Substr(text_start, text_count));
+ return WideString(text_buf_.AsStringView().Substr(text_start, text_count));
}
int CPDF_TextPage::CountRects(int start, int nCount) {
@@ -637,23 +637,23 @@
return -1;
}
- m_SelRects = GetRectArray(start, nCount);
- return fxcrt::CollectionSize<int>(m_SelRects);
+ sel_rects_ = GetRectArray(start, nCount);
+ return fxcrt::CollectionSize<int>(sel_rects_);
}
bool CPDF_TextPage::GetRect(int rectIndex, CFX_FloatRect* pRect) const {
- if (!fxcrt::IndexInBounds(m_SelRects, rectIndex)) {
+ if (!fxcrt::IndexInBounds(sel_rects_, rectIndex)) {
return false;
}
- *pRect = m_SelRects[rectIndex];
+ *pRect = sel_rects_[rectIndex];
return true;
}
CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation()
const {
- const int32_t nPageWidth = static_cast<int32_t>(m_pPage->GetPageWidth());
- const int32_t nPageHeight = static_cast<int32_t>(m_pPage->GetPageHeight());
+ const int32_t nPageWidth = static_cast<int32_t>(page_->GetPageWidth());
+ const int32_t nPageHeight = static_cast<int32_t>(page_->GetPageHeight());
if (nPageWidth <= 0 || nPageHeight <= 0) {
return TextOrientation::kUnknown;
}
@@ -665,7 +665,7 @@
int32_t nEndH = 0;
int32_t nStartV = nPageHeight;
int32_t nEndV = 0;
- for (const auto& pPageObj : *m_pPage) {
+ for (const auto& pPageObj : *page_) {
if (!pPageObj->IsActive() || !pPageObj->IsText()) {
continue;
}
@@ -730,28 +730,28 @@
}
if (use_temp_buffer) {
- m_TempTextBuf.AppendChar(unicode);
- m_TempCharList.push_back(charinfo.value());
+ temp_text_buf_.AppendChar(unicode);
+ temp_char_list_.push_back(charinfo.value());
} else {
- m_TextBuf.AppendChar(unicode);
- m_CharList.push_back(charinfo.value());
+ text_buf_.AppendChar(unicode);
+ char_list_.push_back(charinfo.value());
}
}
void CPDF_TextPage::ProcessObject() {
- if (m_pPage->GetActivePageObjectCount() == 0) {
+ if (page_->GetActivePageObjectCount() == 0) {
return;
}
- m_TextlineDir = FindTextlineFlowOrientation();
- for (auto it = m_pPage->begin(); it != m_pPage->end(); ++it) {
+ textline_dir_ = FindTextlineFlowOrientation();
+ for (auto it = page_->begin(); it != page_->end(); ++it) {
CPDF_PageObject* pObj = it->get();
if (!pObj->IsActive()) {
continue;
}
if (pObj->IsText()) {
- ProcessTextObject(pObj->AsText(), CFX_Matrix(), m_pPage, it);
+ ProcessTextObject(pObj->AsText(), CFX_Matrix(), page_, it);
} else if (pObj->IsForm()) {
ProcessFormObject(pObj->AsForm(), CFX_Matrix());
}
@@ -786,7 +786,7 @@
const CharInfo& info) {
CharInfo info2 = info;
if (IsControlChar(info2)) {
- m_CharList.push_back(info2);
+ char_list_.push_back(info2);
return;
}
DataVector<wchar_t> normalized;
@@ -794,15 +794,15 @@
normalized = GetUnicodeNormalization(wChar);
}
if (normalized.empty()) {
- m_TextBuf.AppendChar(wChar);
- m_CharList.push_back(info2);
+ text_buf_.AppendChar(wChar);
+ char_list_.push_back(info2);
return;
}
info2.set_char_type(CharType::kPiece);
for (wchar_t normalized_char : normalized) {
info2.set_unicode(normalized_char);
- m_TextBuf.AppendChar(normalized_char);
- m_CharList.push_back(info2);
+ text_buf_.AppendChar(normalized_char);
+ char_list_.push_back(info2);
}
}
@@ -810,31 +810,31 @@
const CharInfo& info) {
CharInfo info2 = info;
if (IsControlChar(info2)) {
- m_CharList.push_back(info2);
+ char_list_.push_back(info2);
return;
}
wChar = pdfium::unicode::GetMirrorChar(wChar);
DataVector<wchar_t> normalized = GetUnicodeNormalization(wChar);
if (normalized.empty()) {
info2.set_unicode(wChar);
- m_TextBuf.AppendChar(wChar);
- m_CharList.push_back(info2);
+ text_buf_.AppendChar(wChar);
+ char_list_.push_back(info2);
return;
}
info2.set_char_type(CharType::kPiece);
for (wchar_t normalized_char : normalized) {
info2.set_unicode(normalized_char);
- m_TextBuf.AppendChar(normalized_char);
- m_CharList.push_back(info2);
+ text_buf_.AppendChar(normalized_char);
+ char_list_.push_back(info2);
}
}
void CPDF_TextPage::CloseTempLine() {
- if (m_TempCharList.empty()) {
+ if (temp_char_list_.empty()) {
return;
}
- WideString str = m_TempTextBuf.MakeString();
+ WideString str = temp_text_buf_.MakeString();
bool bPrevSpace = false;
for (size_t i = 0; i < str.GetLength(); ++i) {
if (str[i] != ' ') {
@@ -842,15 +842,15 @@
continue;
}
if (bPrevSpace) {
- m_TempTextBuf.Delete(i, 1);
- m_TempCharList.erase(m_TempCharList.begin() + i);
+ temp_text_buf_.Delete(i, 1);
+ temp_char_list_.erase(temp_char_list_.begin() + i);
str.Delete(i);
--i;
}
bPrevSpace = true;
}
CFX_BidiString bidi(str);
- if (m_rtl) {
+ if (rtl_) {
bidi.SetOverallDirectionRight();
}
CFX_BidiChar::Direction eCurrentDirection = bidi.OverallDirection();
@@ -860,19 +860,19 @@
eCurrentDirection == CFX_BidiChar::Direction::kRight)) {
eCurrentDirection = CFX_BidiChar::Direction::kRight;
for (int m = segment.start + segment.count; m > segment.start; --m) {
- AddCharInfoByRLDirection(str[m - 1], m_TempCharList[m - 1]);
+ AddCharInfoByRLDirection(str[m - 1], temp_char_list_[m - 1]);
}
} else {
if (segment.direction != CFX_BidiChar::Direction::kLeftWeak) {
eCurrentDirection = CFX_BidiChar::Direction::kLeft;
}
for (int m = segment.start; m < segment.start + segment.count; ++m) {
- AddCharInfoByLRDirection(str[m], m_TempCharList[m]);
+ AddCharInfoByLRDirection(str[m], temp_char_list_[m]);
}
}
}
- m_TempCharList.clear();
- m_TempTextBuf.Delete(0, m_TempTextBuf.GetLength());
+ temp_char_list_.clear();
+ temp_text_buf_.Delete(0, temp_text_buf_.GetLength());
}
void CPDF_TextPage::ProcessTextObject(
@@ -886,8 +886,8 @@
size_t count = mTextObjects.size();
TransformedTextObject new_obj;
- new_obj.m_pTextObj = pTextObj;
- new_obj.m_formMatrix = form_matrix;
+ new_obj.text_obj_ = pTextObj;
+ new_obj.form_matrix_ = form_matrix;
if (count == 0) {
mTextObjects.push_back(new_obj);
return;
@@ -897,18 +897,18 @@
}
TransformedTextObject prev_obj = mTextObjects[count - 1];
- size_t nItem = prev_obj.m_pTextObj->CountItems();
+ size_t nItem = prev_obj.text_obj_->CountItems();
if (nItem == 0) {
return;
}
- CPDF_TextObject::Item item = prev_obj.m_pTextObj->GetItemInfo(nItem - 1);
+ CPDF_TextObject::Item item = prev_obj.text_obj_->GetItemInfo(nItem - 1);
float prev_width =
- GetCharWidth(item.char_code_, prev_obj.m_pTextObj->GetFont().Get()) *
- prev_obj.m_pTextObj->GetFontSize() / 1000;
+ GetCharWidth(item.char_code_, prev_obj.text_obj_->GetFont().Get()) *
+ prev_obj.text_obj_->GetFontSize() / 1000;
CFX_Matrix prev_matrix =
- prev_obj.m_pTextObj->GetTextMatrix() * prev_obj.m_formMatrix;
+ prev_obj.text_obj_->GetTextMatrix() * prev_obj.form_matrix_;
prev_width = prev_matrix.TransformDistance(fabs(prev_width));
item = pTextObj->GetItemInfo(0);
float this_width = GetCharWidth(item.char_code_, pTextObj->GetFont().Get()) *
@@ -919,10 +919,10 @@
this_width = this_matrix.TransformDistance(fabs(this_width));
float threshold = std::max(prev_width, this_width) / 4;
- CFX_PointF prev_pos = m_DisplayMatrix.Transform(
- prev_obj.m_formMatrix.Transform(prev_obj.m_pTextObj->GetPos()));
+ CFX_PointF prev_pos = display_matrix_.Transform(
+ prev_obj.form_matrix_.Transform(prev_obj.text_obj_->GetPos()));
CFX_PointF this_pos =
- m_DisplayMatrix.Transform(form_matrix.Transform(pTextObj->GetPos()));
+ display_matrix_.Transform(form_matrix.Transform(pTextObj->GetPos()));
if (fabs(this_pos.y - prev_pos.y) > threshold * 2) {
for (size_t i = 0; i < count; ++i) {
ProcessTextObject(mTextObjects[i]);
@@ -935,8 +935,8 @@
for (size_t i = count; i > 0; --i) {
TransformedTextObject prev_text_obj = mTextObjects[i - 1];
CFX_PointF new_prev_pos =
- m_DisplayMatrix.Transform(prev_text_obj.m_formMatrix.Transform(
- prev_text_obj.m_pTextObj->GetPos()));
+ display_matrix_.Transform(prev_text_obj.form_matrix_.Transform(
+ prev_text_obj.text_obj_->GetPos()));
if (this_pos.x >= new_prev_pos.x) {
mTextObjects.insert(mTextObjects.begin() + i, new_obj);
return;
@@ -972,8 +972,8 @@
return MarkedContentState::kPass;
}
- if (m_pPrevTextObj) {
- const CPDF_ContentMarks* pPrevMarks = m_pPrevTextObj->GetContentMarks();
+ if (prev_text_obj_) {
+ const CPDF_ContentMarks* pPrevMarks = prev_text_obj_->GetContentMarks();
if (pPrevMarks->CountItems() == nContentMarks &&
pPrevMarks->GetItem(nContentMarks - 1)->GetParam() == pDict) {
return MarkedContentState::kDone;
@@ -1013,7 +1013,7 @@
}
void CPDF_TextPage::ProcessMarkedContent(const TransformedTextObject& obj) {
- CPDF_TextObject* const pTextObj = obj.m_pTextObj;
+ CPDF_TextObject* const pTextObj = obj.text_obj_;
const CPDF_ContentMarks* pMarks = pTextObj->GetContentMarks();
const size_t nContentMarks = pMarks->CountItems();
WideString actual_text;
@@ -1029,7 +1029,7 @@
}
const bool bR2L = IsRightToLeft(*pTextObj);
- CFX_Matrix matrix = pTextObj->GetTextMatrix() * obj.m_formMatrix;
+ CFX_Matrix matrix = pTextObj->GetTextMatrix() * obj.form_matrix_;
CFX_FloatRect rect = pTextObj->GetRect();
float step = 0;
@@ -1053,8 +1053,8 @@
CFX_FloatRect char_box(rect);
char_box.Translate(k * step, 0);
- m_TempTextBuf.AppendChar(wChar);
- m_TempCharList.push_back(
+ temp_text_buf_.AppendChar(wChar);
+ temp_char_list_.push_back(
CharInfo(CharType::kPiece, font->CharCodeFromUnicode(wChar), wChar,
pTextObj->GetPos(), char_box, matrix, pTextObj));
}
@@ -1067,21 +1067,21 @@
}
if (pPrevCharInfo->text_object()) {
- m_pPrevTextObj = pPrevCharInfo->text_object();
+ prev_text_obj_ = pPrevCharInfo->text_object();
}
}
void CPDF_TextPage::SwapTempTextBuf(size_t iCharListStartAppend,
size_t iBufStartAppend) {
- DCHECK(!m_TempCharList.empty());
- if (iCharListStartAppend < m_TempCharList.size()) {
- auto fwd = m_TempCharList.begin() + iCharListStartAppend;
- auto rev = m_TempCharList.end() - 1;
+ DCHECK(!temp_char_list_.empty());
+ if (iCharListStartAppend < temp_char_list_.size()) {
+ auto fwd = temp_char_list_.begin() + iCharListStartAppend;
+ auto rev = temp_char_list_.end() - 1;
for (; fwd < rev; ++fwd, --rev) {
std::swap(*fwd, *rev);
}
}
- pdfium::span<wchar_t> temp_span = m_TempTextBuf.GetWideSpan();
+ pdfium::span<wchar_t> temp_span = temp_text_buf_.GetWideSpan();
DCHECK(!temp_span.empty());
if (iBufStartAppend < temp_span.size()) {
pdfium::span<wchar_t> reverse_span = temp_span.subspan(iBufStartAppend);
@@ -1090,50 +1090,50 @@
}
void CPDF_TextPage::ProcessTextObject(const TransformedTextObject& obj) {
- CPDF_TextObject* const pTextObj = obj.m_pTextObj;
+ CPDF_TextObject* const pTextObj = obj.text_obj_;
if (fabs(pTextObj->GetRect().Width()) < kSizeEpsilon) {
return;
}
- const CFX_Matrix form_matrix = obj.m_formMatrix;
+ const CFX_Matrix form_matrix = obj.form_matrix_;
const MarkedContentState ePreMKC = PreMarkedContent(pTextObj);
if (ePreMKC == MarkedContentState::kDone) {
- m_pPrevTextObj = pTextObj;
- m_PrevMatrix = form_matrix;
+ prev_text_obj_ = pTextObj;
+ prev_matrix_ = form_matrix;
return;
}
- if (m_pPrevTextObj) {
+ if (prev_text_obj_) {
GenerateCharacter type = ProcessInsertObject(pTextObj, form_matrix);
if (type == GenerateCharacter::kLineBreak) {
- m_CurlineRect = pTextObj->GetRect();
+ curline_rect_ = pTextObj->GetRect();
} else {
- m_CurlineRect.Union(pTextObj->GetRect());
+ curline_rect_.Union(pTextObj->GetRect());
}
if (!ProcessGenerateCharacter(type, pTextObj, form_matrix)) {
return;
}
} else {
- m_CurlineRect = pTextObj->GetRect();
+ curline_rect_ = pTextObj->GetRect();
}
if (ePreMKC == MarkedContentState::kDelay) {
ProcessMarkedContent(obj);
- m_pPrevTextObj = pTextObj;
- m_PrevMatrix = form_matrix;
+ prev_text_obj_ = pTextObj;
+ prev_matrix_ = form_matrix;
return;
}
- m_pPrevTextObj = pTextObj;
- m_PrevMatrix = form_matrix;
+ prev_text_obj_ = pTextObj;
+ prev_matrix_ = form_matrix;
const bool bR2L = IsRightToLeft(*pTextObj);
const CFX_Matrix matrix = pTextObj->GetTextMatrix() * form_matrix;
const bool bIsBidiAndMirrorInverse =
bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0;
- const size_t iBufStartAppend = m_TempTextBuf.GetLength();
- const size_t iCharListStartAppend = m_TempCharList.size();
+ const size_t iBufStartAppend = temp_text_buf_.GetLength();
+ const size_t iCharListStartAppend = temp_char_list_.size();
ProcessTextObjectItems(pTextObj, form_matrix, matrix);
if (bIsBidiAndMirrorInverse) {
@@ -1145,7 +1145,7 @@
const CPDF_TextObject* pTextObj) const {
size_t nChars = pTextObj->CountChars();
if (nChars <= 1) {
- return m_TextlineDir;
+ return textline_dir_;
}
CPDF_TextObject::Item first = pTextObj->GetCharInfo(0);
@@ -1166,15 +1166,15 @@
v.Normalize();
bool bXUnderThreshold = v.x <= kThreshold;
if (v.y <= kThreshold) {
- return bXUnderThreshold ? m_TextlineDir : TextOrientation::kHorizontal;
+ return bXUnderThreshold ? textline_dir_ : TextOrientation::kHorizontal;
}
- return bXUnderThreshold ? TextOrientation::kVertical : m_TextlineDir;
+ return bXUnderThreshold ? TextOrientation::kVertical : textline_dir_;
}
bool CPDF_TextPage::IsHyphen(wchar_t curChar) const {
- WideStringView curText = m_TempTextBuf.AsStringView();
+ WideStringView curText = temp_text_buf_.AsStringView();
if (curText.IsEmpty()) {
- curText = m_TextBuf.AsStringView();
+ curText = text_buf_.AsStringView();
}
if (curText.IsEmpty()) {
@@ -1203,10 +1203,10 @@
}
const CPDF_TextPage::CharInfo* CPDF_TextPage::GetPrevCharInfo() const {
- if (!m_TempCharList.empty()) {
- return &m_TempCharList.back();
+ if (!temp_char_list_.empty()) {
+ return &temp_char_list_.back();
}
- return !m_CharList.empty() ? &m_CharList.back() : nullptr;
+ return !char_list_.empty() ? &char_list_.back() : nullptr;
}
CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
@@ -1215,18 +1215,18 @@
FindPreviousTextObject();
TextOrientation WritingMode = GetTextObjectWritingMode(pObj);
if (WritingMode == TextOrientation::kUnknown) {
- WritingMode = GetTextObjectWritingMode(m_pPrevTextObj);
+ WritingMode = GetTextObjectWritingMode(prev_text_obj_);
}
- size_t nItem = m_pPrevTextObj->CountItems();
+ size_t nItem = prev_text_obj_->CountItems();
if (nItem == 0) {
return GenerateCharacter::kNone;
}
- CPDF_TextObject::Item PrevItem = m_pPrevTextObj->GetItemInfo(nItem - 1);
+ CPDF_TextObject::Item PrevItem = prev_text_obj_->GetItemInfo(nItem - 1);
CPDF_TextObject::Item item = pObj->GetItemInfo(0);
const CFX_FloatRect& this_rect = pObj->GetRect();
- const CFX_FloatRect& prev_rect = m_pPrevTextObj->GetRect();
+ const CFX_FloatRect& prev_rect = prev_text_obj_->GetRect();
WideString unicode = pObj->GetFont()->UnicodeFromCharCode(item.char_code_);
if (unicode.IsEmpty()) {
unicode += static_cast<wchar_t>(item.char_code_);
@@ -1239,8 +1239,8 @@
: GenerateCharacter::kLineBreak;
}
} else if (WritingMode == TextOrientation::kVertical) {
- if (EndVerticalLine(this_rect, prev_rect, m_CurlineRect,
- pObj->GetFontSize(), m_pPrevTextObj->GetFontSize())) {
+ if (EndVerticalLine(this_rect, prev_rect, curline_rect_,
+ pObj->GetFontSize(), prev_text_obj_->GetFontSize())) {
return IsHyphen(curChar) ? GenerateCharacter::kHyphen
: GenerateCharacter::kLineBreak;
}
@@ -1248,14 +1248,14 @@
float last_pos = PrevItem.origin_.x;
int nLastWidth =
- GetCharWidth(PrevItem.char_code_, m_pPrevTextObj->GetFont().Get());
- float last_width = nLastWidth * m_pPrevTextObj->GetFontSize() / 1000;
+ GetCharWidth(PrevItem.char_code_, prev_text_obj_->GetFont().Get());
+ float last_width = nLastWidth * prev_text_obj_->GetFontSize() / 1000;
last_width = fabs(last_width);
int nThisWidth = GetCharWidth(item.char_code_, pObj->GetFont().Get());
float this_width = fabs(nThisWidth * pObj->GetFontSize() / 1000);
float threshold = std::max(last_width, this_width) / 4;
- CFX_Matrix prev_matrix = m_pPrevTextObj->GetTextMatrix() * m_PrevMatrix;
+ CFX_Matrix prev_matrix = prev_text_obj_->GetTextMatrix() * prev_matrix_;
CFX_Matrix prev_reverse = prev_matrix.GetInverse();
CFX_PointF pos =
@@ -1266,7 +1266,7 @@
bool bNewline = false;
if (WritingMode == TextOrientation::kHorizontal) {
- CFX_FloatRect rect = m_pPrevTextObj->GetRect();
+ CFX_FloatRect rect = prev_text_obj_->GetRect();
float rect_height = rect.Height();
rect.Normalize();
if ((rect.IsEmpty() && rect_height > 5) ||
@@ -1274,20 +1274,20 @@
(fabs(pos.y) >= 1 || fabs(pos.y) > fabs(pos.x)))) {
bNewline = true;
if (nItem > 1) {
- CPDF_TextObject::Item tempItem = m_pPrevTextObj->GetItemInfo(0);
- CFX_Matrix m = m_pPrevTextObj->GetTextMatrix();
+ CPDF_TextObject::Item tempItem = prev_text_obj_->GetItemInfo(0);
+ CFX_Matrix m = prev_text_obj_->GetTextMatrix();
if (PrevItem.origin_.x > tempItem.origin_.x &&
- m_DisplayMatrix.a > 0.9 && m_DisplayMatrix.b < 0.1 &&
- m_DisplayMatrix.c < 0.1 && m_DisplayMatrix.d < -0.9 && m.b < 0.1 &&
+ display_matrix_.a > 0.9 && display_matrix_.b < 0.1 &&
+ display_matrix_.c < 0.1 && display_matrix_.d < -0.9 && m.b < 0.1 &&
m.c < 0.1) {
- CFX_FloatRect re(0, m_pPrevTextObj->GetRect().bottom, 1000,
- m_pPrevTextObj->GetRect().top);
+ CFX_FloatRect re(0, prev_text_obj_->GetRect().bottom, 1000,
+ prev_text_obj_->GetRect().top);
if (re.Contains(pObj->GetPos())) {
bNewline = false;
} else {
if (CFX_FloatRect(0, pObj->GetRect().bottom, 1000,
pObj->GetRect().top)
- .Contains(m_pPrevTextObj->GetPos())) {
+ .Contains(prev_text_obj_->GetPos())) {
bNewline = false;
}
}
@@ -1309,7 +1309,7 @@
}
WideString PrevStr =
- m_pPrevTextObj->GetFont()->UnicodeFromCharCode(PrevItem.char_code_);
+ prev_text_obj_->GetFont()->UnicodeFromCharCode(PrevItem.char_code_);
wchar_t preChar = PrevStr.Back();
if (preChar == L' ') {
return GenerateCharacter::kNone;
@@ -1319,7 +1319,7 @@
float threshold2 = std::max(nLastWidth, nThisWidth);
threshold2 = NormalizeThreshold(threshold2, 400, 700, 800);
if (nLastWidth >= nThisWidth) {
- threshold2 *= fabs(m_pPrevTextObj->GetFontSize());
+ threshold2 *= fabs(prev_text_obj_->GetFontSize());
} else {
threshold2 *= fabs(pObj->GetFontSize());
threshold2 = matrix.TransformDistance(threshold2);
@@ -1347,7 +1347,7 @@
}
case GenerateCharacter::kLineBreak:
CloseTempLine();
- if (m_TextBuf.GetSize()) {
+ if (text_buf_.GetSize()) {
AppendGeneratedCharacter(L'\r', form_matrix, /*use_temp_buffer=*/false);
AppendGeneratedCharacter(L'\n', form_matrix, /*use_temp_buffer=*/false);
}
@@ -1365,16 +1365,16 @@
return false;
}
}
- while (m_TempTextBuf.GetSize() > 0 &&
- m_TempTextBuf.AsStringView().Back() == 0x20) {
- m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
- m_TempCharList.pop_back();
+ while (temp_text_buf_.GetSize() > 0 &&
+ temp_text_buf_.AsStringView().Back() == 0x20) {
+ temp_text_buf_.Delete(temp_text_buf_.GetLength() - 1, 1);
+ temp_char_list_.pop_back();
}
- CharInfo& charinfo = m_TempCharList.back();
- m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
+ CharInfo& charinfo = temp_char_list_.back();
+ temp_text_buf_.Delete(temp_text_buf_.GetLength() - 1, 1);
charinfo.set_char_type(CharType::kHyphen);
charinfo.set_unicode(0x2);
- m_TempTextBuf.AppendChar(0xfffe);
+ temp_text_buf_.AppendChar(0xfffe);
return true;
}
NOTREACHED();
@@ -1392,9 +1392,9 @@
for (size_t i = 0; i < nItems; ++i) {
CPDF_TextObject::Item item = text_object->GetItemInfo(i);
if (item.char_code_ == 0xffffffff) {
- WideStringView str = m_TempTextBuf.AsStringView();
+ WideStringView str = temp_text_buf_.AsStringView();
if (str.IsEmpty()) {
- str = m_TextBuf.AsStringView();
+ str = text_buf_.AsStringView();
}
if (!str.IsEmpty() && str.Back() != L' ') {
float fontsize_h = text_object->text_state().GetFontSizeH();
@@ -1409,9 +1409,9 @@
const float threshold = CalculateSpaceThreshold(
font, text_object->text_state().GetFontSizeH(), item.char_code_);
if (threshold && spacing && spacing >= threshold) {
- m_TempTextBuf.AppendChar(L' ');
+ temp_text_buf_.AppendChar(L' ');
CFX_PointF origin = matrix.Transform(item.origin_);
- m_TempCharList.push_back(CharInfo(
+ temp_char_list_.push_back(CharInfo(
CharType::kGenerated, CPDF_Font::kInvalidCharCode, L' ', origin,
CFX_FloatRect(origin.x, origin.y, origin.x, origin.y), form_matrix,
text_object));
@@ -1448,19 +1448,19 @@
matrix.Transform(item.origin_), char_box, matrix,
text_object);
if (unicode.IsEmpty()) {
- m_TempCharList.push_back(charinfo);
- m_TempTextBuf.AppendChar(0xfffe);
+ temp_char_list_.push_back(charinfo);
+ temp_text_buf_.AppendChar(0xfffe);
continue;
}
bool add_unicode = true;
- const int count = std::min(fxcrt::CollectionSize<int>(m_TempCharList), 7);
+ const int count = std::min(fxcrt::CollectionSize<int>(temp_char_list_), 7);
static constexpr float kTextCharRatioGapDelta = 0.07f;
float threshold = charinfo.matrix().TransformXDistance(
kTextCharRatioGapDelta * text_object->GetFontSize());
- for (int n = fxcrt::CollectionSize<int>(m_TempCharList);
- n > fxcrt::CollectionSize<int>(m_TempCharList) - count; --n) {
- const CharInfo& charinfo1 = m_TempCharList[n - 1];
+ for (int n = fxcrt::CollectionSize<int>(temp_char_list_);
+ n > fxcrt::CollectionSize<int>(temp_char_list_) - count; --n) {
+ const CharInfo& charinfo1 = temp_char_list_[n - 1];
CFX_PointF diff = charinfo1.origin() - charinfo.origin();
if (charinfo1.char_code() == charinfo.char_code() &&
charinfo1.text_object()->GetFont() ==
@@ -1473,14 +1473,14 @@
if (add_unicode) {
for (wchar_t c : unicode) {
charinfo.set_unicode(c);
- m_TempTextBuf.AppendChar(c ? c : 0xfffe);
- m_TempCharList.push_back(charinfo);
+ temp_text_buf_.AppendChar(c ? c : 0xfffe);
+ temp_char_list_.push_back(charinfo);
}
} else if (i == 0) {
- WideStringView str = m_TempTextBuf.AsStringView();
+ WideStringView str = temp_text_buf_.AsStringView();
if (!str.IsEmpty() && str.Back() == L' ') {
- m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
- m_TempCharList.pop_back();
+ temp_text_buf_.Delete(temp_text_buf_.GetLength() - 1, 1);
+ temp_char_list_.pop_back();
}
}
}
@@ -1496,9 +1496,9 @@
const CFX_FloatRect& rcCurObj = pTextObj1->GetRect();
if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) {
float dbXdif = fabs(rcPreObj.left - rcCurObj.left);
- size_t nCount = m_CharList.size();
+ size_t nCount = char_list_.size();
if (nCount >= 2) {
- float dbSpace = m_CharList[nCount - 2].char_box().Width();
+ float dbSpace = char_list_[nCount - 2].char_box().Width();
if (dbXdif > dbSpace) {
return false;
}
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 4ab40d6..4ebd80e 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -90,7 +90,7 @@
int CharIndexFromTextIndex(int text_index) const;
int TextIndexFromCharIndex(int char_index) const;
- size_t size() const { return m_CharList.size(); }
+ size_t size() const { return char_list_.size(); }
int CountChars() const;
// These methods CHECK() to make sure |index| is within bounds.
@@ -104,8 +104,8 @@
WideString GetTextByRect(const CFX_FloatRect& rect) const;
WideString GetTextByObject(const CPDF_TextObject* pTextObj) const;
- // Returns string with the text from |m_TextBuf| that are covered by the input
- // range. |start| and |count| are in terms of the |m_CharIndices|, so the
+ // Returns string with the text from |text_buf_| that are covered by the input
+ // range. |start| and |count| are in terms of the |char_indices_|, so the
// range will be converted into appropriate indices.
WideString GetPageText(int start, int count) const;
WideString GetAllPageText() const { return GetPageText(0, CountChars()); }
@@ -134,8 +134,8 @@
TransformedTextObject(const TransformedTextObject& that);
~TransformedTextObject();
- UnownedPtr<CPDF_TextObject> m_pTextObj;
- CFX_Matrix m_formMatrix;
+ UnownedPtr<CPDF_TextObject> text_obj_;
+ CFX_Matrix form_matrix_;
};
void Init();
@@ -181,20 +181,20 @@
WideString GetTextByPredicate(
const std::function<bool(const CharInfo&)>& predicate) const;
- UnownedPtr<const CPDF_Page> const m_pPage;
- DataVector<TextPageCharSegment> m_CharIndices;
- std::deque<CharInfo> m_CharList;
- std::deque<CharInfo> m_TempCharList;
- WideTextBuffer m_TextBuf;
- WideTextBuffer m_TempTextBuf;
- UnownedPtr<const CPDF_TextObject> m_pPrevTextObj;
- CFX_Matrix m_PrevMatrix;
- const bool m_rtl;
- const CFX_Matrix m_DisplayMatrix;
- std::vector<CFX_FloatRect> m_SelRects;
+ UnownedPtr<const CPDF_Page> const page_;
+ DataVector<TextPageCharSegment> char_indices_;
+ std::deque<CharInfo> char_list_;
+ std::deque<CharInfo> temp_char_list_;
+ WideTextBuffer text_buf_;
+ WideTextBuffer temp_text_buf_;
+ UnownedPtr<const CPDF_TextObject> prev_text_obj_;
+ CFX_Matrix prev_matrix_;
+ const bool rtl_;
+ const CFX_Matrix display_matrix_;
+ std::vector<CFX_FloatRect> sel_rects_;
std::vector<TransformedTextObject> mTextObjects;
- TextOrientation m_TextlineDir = TextOrientation::kUnknown;
- CFX_FloatRect m_CurlineRect;
+ TextOrientation textline_dir_ = TextOrientation::kUnknown;
+ CFX_FloatRect curline_rect_;
};
#endif // CORE_FPDFTEXT_CPDF_TEXTPAGE_H_
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 3c8b5b6..4adf61a 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -206,48 +206,48 @@
const std::vector<WideString>& findwhat_array,
const Options& options,
std::optional<size_t> startPos)
- : m_pTextPage(pTextPage),
- m_strText(GetStringCase(pTextPage->GetAllPageText(), options.bMatchCase)),
- m_csFindWhatArray(findwhat_array),
- m_options(options) {
- if (!m_strText.IsEmpty()) {
- m_findNextStart = startPos;
- m_findPreStart = startPos.value_or(m_strText.GetLength() - 1);
+ : text_page_(pTextPage),
+ str_text_(GetStringCase(pTextPage->GetAllPageText(), options.bMatchCase)),
+ find_what_array_(findwhat_array),
+ options_(options) {
+ if (!str_text_.IsEmpty()) {
+ find_next_start_ = startPos;
+ find_pre_start_ = startPos.value_or(str_text_.GetLength() - 1);
}
}
CPDF_TextPageFind::~CPDF_TextPageFind() = default;
int CPDF_TextPageFind::GetCharIndex(int index) const {
- return m_pTextPage->CharIndexFromTextIndex(index);
+ return text_page_->CharIndexFromTextIndex(index);
}
bool CPDF_TextPageFind::FindFirst() {
- return m_strText.IsEmpty() || !m_csFindWhatArray.empty();
+ return str_text_.IsEmpty() || !find_what_array_.empty();
}
bool CPDF_TextPageFind::FindNext() {
- if (m_strText.IsEmpty() || !m_findNextStart.has_value()) {
+ if (str_text_.IsEmpty() || !find_next_start_.has_value()) {
return false;
}
- const size_t strLen = m_strText.GetLength();
- size_t nStartPos = m_findNextStart.value();
+ const size_t strLen = str_text_.GetLength();
+ size_t nStartPos = find_next_start_.value();
if (nStartPos >= strLen) {
return false;
}
- int nCount = fxcrt::CollectionSize<int>(m_csFindWhatArray);
+ int nCount = fxcrt::CollectionSize<int>(find_what_array_);
std::optional<size_t> nResultPos = 0;
bool bSpaceStart = false;
for (int iWord = 0; iWord < nCount; iWord++) {
- WideString csWord = m_csFindWhatArray[iWord];
+ WideString csWord = find_what_array_[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
if (nStartPos >= strLen) {
return false;
}
- wchar_t strInsert = m_strText[nStartPos];
+ wchar_t strInsert = str_text_[nStartPos];
if (strInsert == L'\n' || strInsert == L' ' || strInsert == L'\r' ||
strInsert == kNonBreakingSpace) {
nResultPos = nStartPos + 1;
@@ -259,20 +259,20 @@
}
continue;
}
- nResultPos = m_strText.Find(csWord.AsStringView(), nStartPos);
+ nResultPos = str_text_.Find(csWord.AsStringView(), nStartPos);
if (!nResultPos.has_value()) {
return false;
}
size_t endIndex = nResultPos.value() + csWord.GetLength() - 1;
if (iWord == 0) {
- m_resStart = nResultPos.value();
+ res_start_ = nResultPos.value();
}
bool bMatch = true;
if (iWord != 0 && !bSpaceStart) {
size_t PreResEndPos = nStartPos;
int curChar = csWord[0];
- WideString lastWord = m_csFindWhatArray[iWord - 1];
+ WideString lastWord = find_what_array_[iWord - 1];
int lastChar = lastWord.Back();
if (nStartPos == nResultPos.value() &&
!(IsIgnoreSpaceCharacter(lastChar) ||
@@ -280,7 +280,7 @@
bMatch = false;
}
for (size_t d = PreResEndPos; d < nResultPos.value(); d++) {
- wchar_t strInsert = m_strText[d];
+ wchar_t strInsert = str_text_[d];
if (strInsert != L'\n' && strInsert != L' ' && strInsert != L'\r' &&
strInsert != kNonBreakingSpace) {
bMatch = false;
@@ -289,18 +289,18 @@
}
} else if (bSpaceStart) {
if (nResultPos.value() > 0) {
- wchar_t strInsert = m_strText[nResultPos.value() - 1];
+ wchar_t strInsert = str_text_[nResultPos.value() - 1];
if (strInsert != L'\n' && strInsert != L' ' && strInsert != L'\r' &&
strInsert != kNonBreakingSpace) {
bMatch = false;
- m_resStart = nResultPos.value();
+ res_start_ = nResultPos.value();
} else {
- m_resStart = nResultPos.value() - 1;
+ res_start_ = nResultPos.value() - 1;
}
}
}
- if (m_options.bMatchWholeWord && bMatch) {
- bMatch = IsMatchWholeWord(m_strText, nResultPos.value(), endIndex);
+ if (options_.bMatchWholeWord && bMatch) {
+ bMatch = IsMatchWholeWord(str_text_, nResultPos.value(), endIndex);
}
if (bMatch) {
@@ -308,26 +308,26 @@
} else {
iWord = -1;
size_t index = bSpaceStart ? 1 : 0;
- nStartPos = m_resStart + m_csFindWhatArray[index].GetLength();
+ nStartPos = res_start_ + find_what_array_[index].GetLength();
}
}
- m_resEnd = nResultPos.value() + m_csFindWhatArray.back().GetLength() - 1;
- if (m_options.bConsecutive) {
- m_findNextStart = m_resStart + 1;
- m_findPreStart = m_resEnd - 1;
+ res_end_ = nResultPos.value() + find_what_array_.back().GetLength() - 1;
+ if (options_.bConsecutive) {
+ find_next_start_ = res_start_ + 1;
+ find_pre_start_ = res_end_ - 1;
} else {
- m_findNextStart = m_resEnd + 1;
- m_findPreStart = m_resStart - 1;
+ find_next_start_ = res_end_ + 1;
+ find_pre_start_ = res_start_ - 1;
}
return true;
}
bool CPDF_TextPageFind::FindPrev() {
- if (m_strText.IsEmpty() || !m_findPreStart.has_value()) {
+ if (str_text_.IsEmpty() || !find_pre_start_.has_value()) {
return false;
}
- CPDF_TextPageFind find_engine(m_pTextPage, m_csFindWhatArray, m_options, 0);
+ CPDF_TextPageFind find_engine(text_page_, find_what_array_, options_, 0);
if (!find_engine.FindFirst()) {
return false;
}
@@ -338,7 +338,7 @@
int cur_order = find_engine.GetCurOrder();
int cur_match = find_engine.GetMatchedCount();
int temp = cur_order + cur_match;
- if (temp < 0 || static_cast<size_t>(temp) > m_findPreStart.value() + 1) {
+ if (temp < 0 || static_cast<size_t>(temp) > find_pre_start_.value() + 1) {
break;
}
@@ -349,24 +349,24 @@
return false;
}
- m_resStart = m_pTextPage->TextIndexFromCharIndex(order);
- m_resEnd = m_pTextPage->TextIndexFromCharIndex(order + matches - 1);
- if (m_options.bConsecutive) {
- m_findNextStart = m_resStart + 1;
- m_findPreStart = m_resEnd - 1;
+ res_start_ = text_page_->TextIndexFromCharIndex(order);
+ res_end_ = text_page_->TextIndexFromCharIndex(order + matches - 1);
+ if (options_.bConsecutive) {
+ find_next_start_ = res_start_ + 1;
+ find_pre_start_ = res_end_ - 1;
} else {
- m_findNextStart = m_resEnd + 1;
- m_findPreStart = m_resStart - 1;
+ find_next_start_ = res_end_ + 1;
+ find_pre_start_ = res_start_ - 1;
}
return true;
}
int CPDF_TextPageFind::GetCurOrder() const {
- return GetCharIndex(m_resStart);
+ return GetCharIndex(res_start_);
}
int CPDF_TextPageFind::GetMatchedCount() const {
- int resStart = GetCharIndex(m_resStart);
- int resEnd = GetCharIndex(m_resEnd);
+ int resStart = GetCharIndex(res_start_);
+ int resEnd = GetCharIndex(res_end_);
return resEnd - resStart + 1;
}
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index fa0653d..7611dbe 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -51,14 +51,14 @@
int GetCharIndex(int index) const;
- UnownedPtr<const CPDF_TextPage> const m_pTextPage;
- const WideString m_strText;
- const std::vector<WideString> m_csFindWhatArray;
- std::optional<size_t> m_findNextStart;
- std::optional<size_t> m_findPreStart;
- int m_resStart = 0;
- int m_resEnd = -1;
- const Options m_options;
+ UnownedPtr<const CPDF_TextPage> const text_page_;
+ const WideString str_text_;
+ const std::vector<WideString> find_what_array_;
+ std::optional<size_t> find_next_start_;
+ std::optional<size_t> find_pre_start_;
+ int res_start_ = 0;
+ int res_end_ = -1;
+ const Options options_;
};
#endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_
diff --git a/core/fxcrt/tree_node.h b/core/fxcrt/tree_node.h
index adcb064..b39d159 100644
--- a/core/fxcrt/tree_node.h
+++ b/core/fxcrt/tree_node.h
@@ -22,18 +22,18 @@
TreeNodeBase() = default;
virtual ~TreeNodeBase() = default;
- inline T* GetParent() const { return static_cast<const T*>(this)->m_pParent; }
+ inline T* GetParent() const { return static_cast<const T*>(this)->parent_; }
inline T* GetFirstChild() const {
- return static_cast<const T*>(this)->m_pFirstChild;
+ return static_cast<const T*>(this)->first_child_;
}
inline T* GetLastChild() const {
- return static_cast<const T*>(this)->m_pLastChild;
+ return static_cast<const T*>(this)->last_child_;
}
inline T* GetNextSibling() const {
- return static_cast<const T*>(this)->m_pNextSibling;
+ return static_cast<const T*>(this)->next_sibling_;
}
inline T* GetPrevSibling() const {
- return static_cast<const T*>(this)->m_pPrevSibling;
+ return static_cast<const T*>(this)->prev_sibling_;
}
bool HasChild(const T* child) const {
@@ -94,7 +94,7 @@
} else {
other->GetPrevSibling()->SetNextSibling(child);
}
- other->m_pPrevSibling = child;
+ other->prev_sibling_ = child;
}
void InsertAfter(T* child, T* other) {
@@ -150,30 +150,30 @@
// These are private because they may leave the tree in an invalid state
// until subsequent operations restore it.
inline void SetParent(T* pParent) {
- static_cast<T*>(this)->m_pParent = pParent;
+ static_cast<T*>(this)->parent_ = pParent;
}
inline void SetFirstChild(T* pChild) {
- static_cast<T*>(this)->m_pFirstChild = pChild;
+ static_cast<T*>(this)->first_child_ = pChild;
}
inline void SetLastChild(T* pChild) {
- static_cast<T*>(this)->m_pLastChild = pChild;
+ static_cast<T*>(this)->last_child_ = pChild;
}
inline void SetNextSibling(T* pSibling) {
- static_cast<T*>(this)->m_pNextSibling = pSibling;
+ static_cast<T*>(this)->next_sibling_ = pSibling;
}
inline void SetPrevSibling(T* pSibling) {
- static_cast<T*>(this)->m_pPrevSibling = pSibling;
+ static_cast<T*>(this)->prev_sibling_ = pSibling;
}
// Child left in state where sibling members need subsequent adjustment.
void BecomeParent(T* child) {
CHECK(child != this); // Detect attempts at self-insertion.
- if (child->m_pParent) {
- child->m_pParent->TreeNodeBase<T>::RemoveChild(child);
+ if (child->parent_) {
+ child->parent_->TreeNodeBase<T>::RemoveChild(child);
}
- child->m_pParent = static_cast<T*>(this);
- CHECK(!child->m_pNextSibling);
- CHECK(!child->m_pPrevSibling);
+ child->parent_ = static_cast<T*>(this);
+ CHECK(!child->next_sibling_);
+ CHECK(!child->prev_sibling_);
}
};
@@ -187,11 +187,11 @@
private:
friend class TreeNodeBase<T>;
- UNOWNED_PTR_EXCLUSION T* m_pParent = nullptr; // intra-tree pointer.
- UNOWNED_PTR_EXCLUSION T* m_pFirstChild = nullptr; // intra-tree pointer.
- UNOWNED_PTR_EXCLUSION T* m_pLastChild = nullptr; // intra-tree pointer.
- UNOWNED_PTR_EXCLUSION T* m_pNextSibling = nullptr; // intra-tree pointer.
- UNOWNED_PTR_EXCLUSION T* m_pPrevSibling = nullptr; // intra-tree pointer.
+ UNOWNED_PTR_EXCLUSION T* parent_ = nullptr; // intra-tree pointer.
+ UNOWNED_PTR_EXCLUSION T* first_child_ = nullptr; // intra-tree pointer.
+ UNOWNED_PTR_EXCLUSION T* last_child_ = nullptr; // intra-tree pointer.
+ UNOWNED_PTR_EXCLUSION T* next_sibling_ = nullptr; // intra-tree pointer.
+ UNOWNED_PTR_EXCLUSION T* prev_sibling_ = nullptr; // intra-tree pointer.
};
} // namespace fxcrt
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index d1aaf66..3a812de 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -601,8 +601,8 @@
return false;
}
- *start_char_index = pdfium::checked_cast<int>(maybe_range.value().m_Start);
- *char_count = pdfium::checked_cast<int>(maybe_range.value().m_Count);
+ *start_char_index = pdfium::checked_cast<int>(maybe_range.value().start_);
+ *char_count = pdfium::checked_cast<int>(maybe_range.value().count_);
return true;
}
diff --git a/fxjs/cfx_v8.cpp b/fxjs/cfx_v8.cpp
index b34dc87..9eb5b1f 100644
--- a/fxjs/cfx_v8.cpp
+++ b/fxjs/cfx_v8.cpp
@@ -9,7 +9,7 @@
#include "fxjs/fxv8.h"
#include "v8/include/v8-isolate.h"
-CFX_V8::CFX_V8(v8::Isolate* isolate) : m_pIsolate(isolate) {}
+CFX_V8::CFX_V8(v8::Isolate* isolate) : isolate_(isolate) {}
CFX_V8::~CFX_V8() = default;
@@ -33,8 +33,8 @@
}
void CFX_V8::DisposeIsolate() {
- if (m_pIsolate) {
- m_pIsolate.ExtractAsDangling()->Dispose();
+ if (isolate_) {
+ isolate_.ExtractAsDangling()->Dispose();
}
}
diff --git a/fxjs/cfx_v8.h b/fxjs/cfx_v8.h
index 7b2ddc9..2695172 100644
--- a/fxjs/cfx_v8.h
+++ b/fxjs/cfx_v8.h
@@ -20,7 +20,7 @@
explicit CFX_V8(v8::Isolate* pIsolate);
virtual ~CFX_V8();
- v8::Isolate* GetIsolate() const { return m_pIsolate; }
+ v8::Isolate* GetIsolate() const { return isolate_; }
v8::Local<v8::Value> NewNull();
v8::Local<v8::Value> NewUndefined();
@@ -59,11 +59,11 @@
v8::Local<v8::Value> pValue);
protected:
- void SetIsolate(v8::Isolate* pIsolate) { m_pIsolate = pIsolate; }
+ void SetIsolate(v8::Isolate* isolate) { isolate_ = isolate; }
void DisposeIsolate();
private:
- UnownedPtr<v8::Isolate> m_pIsolate;
+ UnownedPtr<v8::Isolate> isolate_;
};
// Use with std::unique_ptr<v8::Isolate> to dispose of isolates correctly.
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index 09defd1..04cd11e 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -181,7 +181,7 @@
obj_type_(eObjType),
constructor_(pConstructor),
destructor_(pDestructor),
- m_pIsolate(isolate) {
+ isolate_(isolate) {
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::FunctionTemplate> fn = v8::FunctionTemplate::New(isolate);
@@ -214,7 +214,7 @@
FXJSOBJTYPE GetObjType() const { return obj_type_; }
const char* GetObjName() const { return obj_name_; }
- v8::Isolate* GetIsolate() const { return m_pIsolate; }
+ v8::Isolate* GetIsolate() const { return isolate_; }
void DefineConst(const char* sConstName, v8::Local<v8::Value> pDefault) {
GetInstanceTemplate()->Set(GetIsolate(), sConstName, pDefault);
@@ -276,7 +276,7 @@
const FXJSOBJTYPE obj_type_;
const CFXJS_Engine::Constructor constructor_;
const CFXJS_Engine::Destructor destructor_;
- UnownedPtr<v8::Isolate> m_pIsolate;
+ UnownedPtr<v8::Isolate> isolate_;
v8::Global<v8::FunctionTemplate> function_template_;
v8::Global<v8::Signature> signature_;
};
diff --git a/fxjs/gc/gced_tree_node.h b/fxjs/gc/gced_tree_node.h
index fed5e73..1a39737 100644
--- a/fxjs/gc/gced_tree_node.h
+++ b/fxjs/gc/gced_tree_node.h
@@ -18,11 +18,11 @@
public fxcrt::TreeNodeBase<T> {
public:
virtual void Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pParent);
- visitor->Trace(m_pFirstChild);
- visitor->Trace(m_pLastChild);
- visitor->Trace(m_pNextSibling);
- visitor->Trace(m_pPrevSibling);
+ visitor->Trace(parent_);
+ visitor->Trace(first_child_);
+ visitor->Trace(last_child_);
+ visitor->Trace(next_sibling_);
+ visitor->Trace(prev_sibling_);
}
protected:
@@ -33,11 +33,11 @@
private:
friend class fxcrt::TreeNodeBase<T>;
- cppgc::Member<T> m_pParent;
- cppgc::Member<T> m_pFirstChild;
- cppgc::Member<T> m_pLastChild;
- cppgc::Member<T> m_pNextSibling;
- cppgc::Member<T> m_pPrevSibling;
+ cppgc::Member<T> parent_;
+ cppgc::Member<T> first_child_;
+ cppgc::Member<T> last_child_;
+ cppgc::Member<T> next_sibling_;
+ cppgc::Member<T> prev_sibling_;
};
} // namespace fxjs
diff --git a/fxjs/gc/gced_tree_node_mixin.h b/fxjs/gc/gced_tree_node_mixin.h
index 2f160e0..3f7b5bb 100644
--- a/fxjs/gc/gced_tree_node_mixin.h
+++ b/fxjs/gc/gced_tree_node_mixin.h
@@ -19,11 +19,11 @@
public fxcrt::TreeNodeBase<T> {
public:
virtual void Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pParent);
- visitor->Trace(m_pFirstChild);
- visitor->Trace(m_pLastChild);
- visitor->Trace(m_pNextSibling);
- visitor->Trace(m_pPrevSibling);
+ visitor->Trace(parent_);
+ visitor->Trace(first_child_);
+ visitor->Trace(last_child_);
+ visitor->Trace(next_sibling_);
+ visitor->Trace(prev_sibling_);
}
protected:
@@ -34,11 +34,11 @@
private:
friend class fxcrt::TreeNodeBase<T>;
- cppgc::Member<T> m_pParent;
- cppgc::Member<T> m_pFirstChild;
- cppgc::Member<T> m_pLastChild;
- cppgc::Member<T> m_pNextSibling;
- cppgc::Member<T> m_pPrevSibling;
+ cppgc::Member<T> parent_;
+ cppgc::Member<T> first_child_;
+ cppgc::Member<T> last_child_;
+ cppgc::Member<T> next_sibling_;
+ cppgc::Member<T> prev_sibling_;
};
} // namespace fxjs
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index d5618f4..d8a8d32 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -301,8 +301,8 @@
v8::Isolate* pIsolate = pContext->GetIsolate();
auto pClass = std::make_unique<CFXJSE_Class>(pContext);
- pClass->m_szClassName = pClassDescriptor->name;
- pClass->m_pClassDescriptor = pClassDescriptor;
+ pClass->class_name_ = pClassDescriptor->name;
+ pClass->class_descriptor_ = pClassDescriptor;
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
v8::Local<v8::FunctionTemplate> hFunctionTemplate = v8::FunctionTemplate::New(
pIsolate, bIsJSGlobal ? nullptr : V8ConstructorCallback_Wrapper,
@@ -338,18 +338,18 @@
fn->RemovePrototype();
hObjectTemplate->Set(fxv8::NewStringHelper(pIsolate, "toString"), fn);
}
- pClass->m_hTemplate.Reset(pContext->GetIsolate(), hFunctionTemplate);
+ pClass->func_template_.Reset(pContext->GetIsolate(), hFunctionTemplate);
CFXJSE_Class* pResult = pClass.get();
pContext->AddClass(std::move(pClass));
return pResult;
}
CFXJSE_Class::CFXJSE_Class(const CFXJSE_Context* pContext)
- : m_pContext(pContext) {}
+ : context_(pContext) {}
CFXJSE_Class::~CFXJSE_Class() = default;
v8::Local<v8::FunctionTemplate> CFXJSE_Class::GetTemplate(
v8::Isolate* pIsolate) {
- return v8::Local<v8::FunctionTemplate>::New(pIsolate, m_hTemplate);
+ return v8::Local<v8::FunctionTemplate>::New(pIsolate, func_template_);
}
diff --git a/fxjs/xfa/cfxjse_class.h b/fxjs/xfa/cfxjse_class.h
index 5f4d752..2cda10a 100644
--- a/fxjs/xfa/cfxjse_class.h
+++ b/fxjs/xfa/cfxjse_class.h
@@ -24,15 +24,15 @@
explicit CFXJSE_Class(const CFXJSE_Context* pContext);
~CFXJSE_Class();
- bool IsName(ByteStringView name) const { return name == m_szClassName; }
- const CFXJSE_Context* GetContext() const { return m_pContext; }
+ bool IsName(ByteStringView name) const { return name == class_name_; }
+ const CFXJSE_Context* GetContext() const { return context_; }
v8::Local<v8::FunctionTemplate> GetTemplate(v8::Isolate* pIsolate);
protected:
- ByteString m_szClassName;
- UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_pClassDescriptor;
- UnownedPtr<const CFXJSE_Context> const m_pContext;
- v8::Global<v8::FunctionTemplate> m_hTemplate;
+ ByteString class_name_;
+ UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> class_descriptor_;
+ UnownedPtr<const CFXJSE_Context> const context_;
+ v8::Global<v8::FunctionTemplate> func_template_;
};
#endif // FXJS_XFA_CFXJSE_CLASS_H_
diff --git a/fxjs/xfa/cfxjse_context.cpp b/fxjs/xfa/cfxjse_context.cpp
index f0de408..fdfeb40 100644
--- a/fxjs/xfa/cfxjse_context.cpp
+++ b/fxjs/xfa/cfxjse_context.cpp
@@ -206,12 +206,12 @@
v8::Local<v8::Context> hRootContext =
CFXJSE_RuntimeData::Get(pIsolate)->GetRootContext(pIsolate);
hNewContext->SetSecurityToken(hRootContext->GetSecurityToken());
- pContext->m_hContext.Reset(pIsolate, hNewContext);
+ pContext->context_.Reset(pIsolate, hNewContext);
return pContext;
}
CFXJSE_Context::CFXJSE_Context(v8::Isolate* pIsolate, CXFA_ThisProxy* pProxy)
- : m_pIsolate(pIsolate), m_pProxy(pProxy) {}
+ : isolate_(pIsolate), this_proxy_(pProxy) {}
CFXJSE_Context::~CFXJSE_Context() = default;
@@ -219,27 +219,27 @@
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::EscapableHandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> hContext =
- v8::Local<v8::Context>::New(GetIsolate(), m_hContext);
+ v8::Local<v8::Context>::New(GetIsolate(), context_);
v8::Local<v8::Object> result =
hContext->Global()->GetPrototype().As<v8::Object>();
return handle_scope.Escape(result);
}
v8::Local<v8::Context> CFXJSE_Context::GetContext() {
- return v8::Local<v8::Context>::New(GetIsolate(), m_hContext);
+ return v8::Local<v8::Context>::New(GetIsolate(), context_);
}
void CFXJSE_Context::AddClass(std::unique_ptr<CFXJSE_Class> pClass) {
- m_rgClasses.push_back(std::move(pClass));
+ classes_.push_back(std::move(pClass));
}
CFXJSE_Class* CFXJSE_Context::GetClassByName(ByteStringView szName) const {
auto pClass =
- std::find_if(m_rgClasses.begin(), m_rgClasses.end(),
+ std::find_if(classes_.begin(), classes_.end(),
[szName](const std::unique_ptr<CFXJSE_Class>& item) {
return item->IsName(szName);
});
- return pClass != m_rgClasses.end() ? pClass->get() : nullptr;
+ return pClass != classes_.end() ? pClass->get() : nullptr;
}
void CFXJSE_Context::EnableCompatibleMode() {
diff --git a/fxjs/xfa/cfxjse_context.h b/fxjs/xfa/cfxjse_context.h
index e312d28..9735d92 100644
--- a/fxjs/xfa/cfxjse_context.h
+++ b/fxjs/xfa/cfxjse_context.h
@@ -43,7 +43,7 @@
~CFXJSE_Context();
- v8::Isolate* GetIsolate() const { return m_pIsolate; }
+ v8::Isolate* GetIsolate() const { return isolate_; }
v8::Local<v8::Context> GetContext();
v8::Local<v8::Object> GetGlobalObject();
@@ -60,10 +60,10 @@
CFXJSE_Context(const CFXJSE_Context&) = delete;
CFXJSE_Context& operator=(const CFXJSE_Context&) = delete;
- v8::Global<v8::Context> m_hContext;
- UnownedPtr<v8::Isolate> m_pIsolate;
- std::vector<std::unique_ptr<CFXJSE_Class>> m_rgClasses;
- cppgc::Persistent<CXFA_ThisProxy> m_pProxy;
+ v8::Global<v8::Context> context_;
+ UnownedPtr<v8::Isolate> isolate_;
+ std::vector<std::unique_ptr<CFXJSE_Class>> classes_;
+ cppgc::Persistent<CXFA_ThisProxy> this_proxy_;
};
void FXJSE_UpdateObjectBinding(v8::Local<v8::Object> hObject,
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 2627d89..b1a589f 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -122,29 +122,29 @@
CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument,
CJS_Runtime* fxjs_runtime)
: CFX_V8(fxjs_runtime->GetIsolate()),
- m_pSubordinateRuntime(fxjs_runtime),
- m_pDocument(pDocument),
- m_JsContext(CFXJSE_Context::Create(fxjs_runtime->GetIsolate(),
+ subordinate_runtime_(fxjs_runtime),
+ document_(pDocument),
+ js_context_(CFXJSE_Context::Create(fxjs_runtime->GetIsolate(),
&kGlobalClassDescriptor,
pDocument->GetRoot()->JSObject(),
nullptr)),
- m_NodeHelper(std::make_unique<CFXJSE_NodeHelper>()),
- m_ResolveProcessor(
- std::make_unique<CFXJSE_ResolveProcessor>(this, m_NodeHelper.get())) {
- RemoveBuiltInObjs(m_JsContext.get());
- m_JsContext->EnableCompatibleMode();
+ node_helper_(std::make_unique<CFXJSE_NodeHelper>()),
+ resolve_processor_(
+ std::make_unique<CFXJSE_ResolveProcessor>(this, node_helper_.get())) {
+ RemoveBuiltInObjs(js_context_.get());
+ js_context_->EnableCompatibleMode();
// Don't know if this can happen before we remove the builtin objs and set
// compatibility mode.
- m_pJsClass =
- CFXJSE_Class::Create(m_JsContext.get(), &kNormalClassDescriptor, false);
+ js_class_ =
+ CFXJSE_Class::Create(js_context_.get(), &kNormalClassDescriptor, false);
}
CFXJSE_Engine::~CFXJSE_Engine() {
// This is what ensures that the v8 object bound to a CJX_Object
// no longer retains that binding since it will outlive that object.
CFXJSE_ScopeUtil_IsolateHandleContext scope(GetJseContext());
- for (const auto& pair : m_mapObjectToObject) {
+ for (const auto& pair : map_object_to_object_) {
const v8::Global<v8::Object>& binding = pair.second;
FXJSE_ClearObjectBinding(v8::Local<v8::Object>::New(GetIsolate(), binding));
}
@@ -153,16 +153,16 @@
CFXJSE_Engine::EventParamScope::EventParamScope(CFXJSE_Engine* pEngine,
CXFA_Node* pTarget,
CXFA_EventParam* pEventParam)
- : m_pEngine(pEngine),
- m_pPrevTarget(pEngine->GetEventTarget()),
- m_pPrevEventParam(pEngine->GetEventParam()) {
- m_pEngine->m_pTarget = pTarget;
- m_pEngine->m_eventParam = pEventParam;
+ : engine_(pEngine),
+ prev_target_(pEngine->GetEventTarget()),
+ prev_event_param_(pEngine->GetEventParam()) {
+ engine_->target_ = pTarget;
+ engine_->event_param_ = pEventParam;
}
CFXJSE_Engine::EventParamScope::~EventParamScope() {
- m_pEngine->m_pTarget = m_pPrevTarget;
- m_pEngine->m_eventParam = m_pPrevEventParam;
+ engine_->target_ = prev_target_;
+ engine_->event_param_ = prev_event_param_;
}
CFXJSE_Context::ExecutionResult CFXJSE_Engine::RunScript(
@@ -170,17 +170,17 @@
WideStringView wsScript,
CXFA_Object* pThisObject) {
CFXJSE_ScopeUtil_IsolateHandleContext scope(GetJseContext());
- AutoRestorer<CXFA_Script::Type> typeRestorer(&m_eScriptType);
- m_eScriptType = eScriptType;
+ AutoRestorer<CXFA_Script::Type> typeRestorer(&script_type_);
+ script_type_ = eScriptType;
ByteString btScript;
if (eScriptType == CXFA_Script::Type::Formcalc) {
- if (!m_FormCalcContext) {
- m_FormCalcContext = std::make_unique<CFXJSE_FormCalcContext>(
- GetIsolate(), m_JsContext.get(), m_pDocument.Get());
+ if (!form_calc_context_) {
+ form_calc_context_ = std::make_unique<CFXJSE_FormCalcContext>(
+ GetIsolate(), js_context_.get(), document_.Get());
}
std::optional<WideTextBuffer> wsJavaScript =
- CFXJSE_FormCalcContext::Translate(m_pDocument->GetHeap(), wsScript);
+ CFXJSE_FormCalcContext::Translate(document_->GetHeap(), wsScript);
if (!wsJavaScript.has_value()) {
auto undefined_value = std::make_unique<CFXJSE_Value>();
undefined_value->SetUndefined(GetIsolate());
@@ -190,16 +190,16 @@
} else {
btScript = FX_UTF8Encode(wsScript);
}
- AutoRestorer<cppgc::Persistent<CXFA_Object>> nodeRestorer(&m_pThisObject);
- m_pThisObject = pThisObject;
+ AutoRestorer<cppgc::Persistent<CXFA_Object>> nodeRestorer(&this_object_);
+ this_object_ = pThisObject;
v8::Local<v8::Object> pThisBinding;
if (pThisObject) {
pThisBinding = GetOrCreateJSBindingFromMap(pThisObject);
}
- IJS_Runtime::ScopedEventContext ctx(m_pSubordinateRuntime);
- return m_JsContext->ExecuteScript(btScript.AsStringView(), pThisBinding);
+ IJS_Runtime::ScopedEventContext ctx(subordinate_runtime_);
+ return js_context_->ExecuteScript(btScript.AsStringView(), pThisBinding);
}
bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode,
@@ -312,7 +312,7 @@
if (pScriptContext->GetType() == CXFA_Script::Type::Formcalc) {
if (szPropName == kFormCalcRuntime) {
- return pScriptContext->m_FormCalcContext->GlobalPropertyGetter();
+ return pScriptContext->form_calc_context_->GlobalPropertyGetter();
}
XFA_HashCode uHashCode =
@@ -577,19 +577,19 @@
}
bool CFXJSE_Engine::IsStrictScopeInJavaScript() {
- return m_pDocument->is_strict_scoping();
+ return document_->is_strict_scoping();
}
CXFA_Script::Type CFXJSE_Engine::GetType() {
- return m_eScriptType;
+ return script_type_;
}
void CFXJSE_Engine::AddObjectToUpArray(CXFA_Node* pNode) {
- m_upObjectArray.push_back(pNode);
+ up_object_array_.push_back(pNode);
}
CXFA_Node* CFXJSE_Engine::LastObjectFromUpArray() {
- return !m_upObjectArray.empty() ? m_upObjectArray.back() : nullptr;
+ return !up_object_array_.empty() ? up_object_array_.back() : nullptr;
}
CFXJSE_Context* CFXJSE_Engine::CreateVariablesContext(CXFA_Script* pScriptNode,
@@ -606,7 +606,7 @@
RemoveBuiltInObjs(pNewContext.get());
pNewContext->EnableCompatibleMode();
CFXJSE_Context* pResult = pNewContext.get();
- m_mapVariableToContext[pScriptNode->JSObject()] = std::move(pNewContext);
+ map_variable_to_context_[pScriptNode->JSObject()] = std::move(pNewContext);
return pResult;
}
@@ -630,8 +630,8 @@
return;
}
- auto it = m_mapVariableToContext.find(pScriptNode->JSObject());
- if (it != m_mapVariableToContext.end() && it->second) {
+ auto it = map_variable_to_context_.find(pScriptNode->JSObject());
+ if (it != map_variable_to_context_.end() && it->second) {
return;
}
@@ -650,8 +650,8 @@
CXFA_Node* pThisObject = pParent->GetParent();
CFXJSE_Context* pVariablesContext =
CreateVariablesContext(pScriptNode, pThisObject);
- AutoRestorer<cppgc::Persistent<CXFA_Object>> nodeRestorer(&m_pThisObject);
- m_pThisObject = pThisObject;
+ AutoRestorer<cppgc::Persistent<CXFA_Object>> nodeRestorer(&this_object_);
+ this_object_ = pThisObject;
pVariablesContext->ExecuteScript(btScript.AsStringView(),
v8::Local<v8::Object>());
}
@@ -667,8 +667,8 @@
return nullptr;
}
- auto it = m_mapVariableToContext.find(pScriptNode->JSObject());
- return it != m_mapVariableToContext.end() ? it->second.get() : nullptr;
+ auto it = map_variable_to_context_.find(pScriptNode->JSObject());
+ return it != map_variable_to_context_.end() ? it->second.get() : nullptr;
}
bool CFXJSE_Engine::QueryVariableValue(CXFA_Script* pScriptNode,
@@ -736,48 +736,48 @@
return std::nullopt;
}
- AutoRestorer<bool> resolving_restorer(&m_bResolvingNodes);
- m_bResolvingNodes = true;
+ AutoRestorer<bool> resolving_restorer(&resolving_nodes_);
+ resolving_nodes_ = true;
const bool bParentOrSiblings =
!!(dwStyles & Mask<XFA_ResolveFlag>{XFA_ResolveFlag::kParent,
XFA_ResolveFlag::kSiblings});
- if (m_eScriptType != CXFA_Script::Type::Formcalc || bParentOrSiblings) {
- m_upObjectArray.clear();
+ if (script_type_ != CXFA_Script::Type::Formcalc || bParentOrSiblings) {
+ up_object_array_.clear();
}
if (refObject && refObject->IsNode() && bParentOrSiblings) {
- m_upObjectArray.push_back(refObject->AsNode());
+ up_object_array_.push_back(refObject->AsNode());
}
ResolveResult result;
bool bNextCreate = false;
if (dwStyles & XFA_ResolveFlag::kCreateNode) {
- m_NodeHelper->SetCreateNodeType(bindNode);
+ node_helper_->SetCreateNodeType(bindNode);
}
- m_NodeHelper->m_pCreateParent = nullptr;
- m_NodeHelper->m_iCurAllStart = -1;
+ node_helper_->create_parent_ = nullptr;
+ node_helper_->cur_all_start_ = -1;
CFXJSE_ResolveProcessor::NodeData rndFind;
int32_t nStart = 0;
int32_t nLevel = 0;
std::vector<cppgc::Member<CXFA_Object>> findObjects;
- findObjects.emplace_back(refObject ? refObject : m_pDocument->GetRoot());
+ findObjects.emplace_back(refObject ? refObject : document_->GetRoot());
int32_t nNodes = 0;
CFXJSE_ScopeUtil_IsolateHandleContext scope(GetJseContext());
while (true) {
nNodes = fxcrt::CollectionSize<int32_t>(findObjects);
int32_t i = 0;
- rndFind.m_dwStyles = dwStyles;
- m_ResolveProcessor->SetCurStart(nStart);
- nStart = m_ResolveProcessor->GetFilter(wsExpression, nStart, rndFind);
+ rndFind.styles_ = dwStyles;
+ resolve_processor_->SetCurStart(nStart);
+ nStart = resolve_processor_->GetFilter(wsExpression, nStart, rndFind);
if (nStart < 1) {
if ((dwStyles & XFA_ResolveFlag::kCreateNode) && !bNextCreate) {
CXFA_Node* pDataNode = nullptr;
- nStart = m_NodeHelper->m_iCurAllStart;
+ nStart = node_helper_->cur_all_start_;
if (nStart != -1) {
- pDataNode = m_pDocument->GetNotBindNode(findObjects);
+ pDataNode = document_->GetNotBindNode(findObjects);
if (pDataNode) {
findObjects.clear();
findObjects.emplace_back(pDataNode);
@@ -791,7 +791,7 @@
}
dwStyles |= XFA_ResolveFlag::kBind;
findObjects.clear();
- findObjects.emplace_back(m_NodeHelper->m_pAllStartParent.Get());
+ findObjects.emplace_back(node_helper_->all_start_parent_.Get());
continue;
}
break;
@@ -799,7 +799,7 @@
if (bNextCreate) {
int32_t checked_length =
pdfium::checked_cast<int32_t>(wsExpression.GetLength());
- if (m_NodeHelper->CreateNode(rndFind.m_wsName, rndFind.m_wsCondition,
+ if (node_helper_->CreateNode(rndFind.name_, rndFind.condition_,
nStart == checked_length, this)) {
continue;
}
@@ -812,35 +812,35 @@
(dwStyles & XFA_ResolveFlag::kCreateNode)) &&
nNodes > 1) {
CFXJSE_ResolveProcessor::NodeData rndBind;
- m_ResolveProcessor->GetFilter(wsExpression, nStart, rndBind);
- i = m_ResolveProcessor->IndexForDataBind(rndBind.m_wsCondition, nNodes);
+ resolve_processor_->GetFilter(wsExpression, nStart, rndBind);
+ i = resolve_processor_->IndexForDataBind(rndBind.condition_, nNodes);
bDataBind = true;
}
- rndFind.m_CurObject = findObjects[i++].Get();
- rndFind.m_nLevel = nLevel;
- rndFind.m_Result.type = ResolveResult::Type::kNodes;
- if (!m_ResolveProcessor->Resolve(GetIsolate(), rndFind)) {
+ rndFind.cur_object_ = findObjects[i++].Get();
+ rndFind.level_ = nLevel;
+ rndFind.result_.type = ResolveResult::Type::kNodes;
+ if (!resolve_processor_->Resolve(GetIsolate(), rndFind)) {
continue;
}
- if (rndFind.m_Result.type == ResolveResult::Type::kAttribute &&
- rndFind.m_Result.script_attribute.callback &&
+ if (rndFind.result_.type == ResolveResult::Type::kAttribute &&
+ rndFind.result_.script_attribute.callback &&
nStart < pdfium::checked_cast<int32_t>(wsExpression.GetLength())) {
v8::Local<v8::Value> pValue;
- CJX_Object* jsObject = rndFind.m_Result.objects.front()->JSObject();
- (*rndFind.m_Result.script_attribute.callback)(
+ CJX_Object* jsObject = rndFind.result_.objects.front()->JSObject();
+ (*rndFind.result_.script_attribute.callback)(
GetIsolate(), jsObject, &pValue, false,
- rndFind.m_Result.script_attribute.attribute);
+ rndFind.result_.script_attribute.attribute);
if (!pValue.IsEmpty()) {
- rndFind.m_Result.objects.front() = ToObject(GetIsolate(), pValue);
+ rndFind.result_.objects.front() = ToObject(GetIsolate(), pValue);
}
}
- if (!m_upObjectArray.empty()) {
- m_upObjectArray.pop_back();
+ if (!up_object_array_.empty()) {
+ up_object_array_.pop_back();
}
- retObjects.insert(retObjects.end(), rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- rndFind.m_Result.objects.clear();
+ retObjects.insert(retObjects.end(), rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ rndFind.result_.objects.clear();
if (bDataBind) {
break;
}
@@ -851,13 +851,13 @@
if (nNodes < 1) {
if (dwStyles & XFA_ResolveFlag::kCreateNode) {
bNextCreate = true;
- if (!m_NodeHelper->m_pCreateParent) {
- m_NodeHelper->m_pCreateParent = ToNode(rndFind.m_CurObject);
- m_NodeHelper->m_iCreateCount = 1;
+ if (!node_helper_->create_parent_) {
+ node_helper_->create_parent_ = ToNode(rndFind.cur_object_);
+ node_helper_->create_count_ = 1;
}
int32_t checked_length =
pdfium::checked_cast<int32_t>(wsExpression.GetLength());
- if (m_NodeHelper->CreateNode(rndFind.m_wsName, rndFind.m_wsCondition,
+ if (node_helper_->CreateNode(rndFind.name_, rndFind.condition_,
nStart == checked_length, this)) {
continue;
}
@@ -866,7 +866,7 @@
}
findObjects = std::move(retObjects);
- rndFind.m_Result.objects.clear();
+ rndFind.result_.objects.clear();
if (nLevel == 0) {
dwStyles.Clear(XFA_ResolveFlag::kParent);
dwStyles.Clear(XFA_ResolveFlag::kSiblings);
@@ -875,28 +875,28 @@
}
if (!bNextCreate) {
- result.type = rndFind.m_Result.type;
+ result.type = rndFind.result_.type;
if (nNodes > 0) {
result.objects.insert(result.objects.end(), findObjects.begin(),
findObjects.end());
}
- if (rndFind.m_Result.type == ResolveResult::Type::kAttribute) {
- result.script_attribute = rndFind.m_Result.script_attribute;
+ if (rndFind.result_.type == ResolveResult::Type::kAttribute) {
+ result.script_attribute = rndFind.result_.script_attribute;
return result;
}
}
if ((dwStyles & XFA_ResolveFlag::kCreateNode) ||
(dwStyles & XFA_ResolveFlag::kBind) ||
(dwStyles & XFA_ResolveFlag::kBindNew)) {
- if (m_NodeHelper->m_pCreateParent) {
- result.objects.emplace_back(m_NodeHelper->m_pCreateParent.Get());
+ if (node_helper_->create_parent_) {
+ result.objects.emplace_back(node_helper_->create_parent_.Get());
} else {
- m_NodeHelper->CreateNodeForCondition(rndFind.m_wsCondition);
+ node_helper_->CreateNodeForCondition(rndFind.condition_);
}
- result.type = m_NodeHelper->m_iCreateFlag;
+ result.type = node_helper_->create_flag_;
if (result.type == ResolveResult::Type::kCreateNodeOne) {
- if (m_NodeHelper->m_iCurAllStart != -1) {
+ if (node_helper_->cur_all_start_ != -1) {
result.type = ResolveResult::Type::kCreateNodeMidAll;
}
}
@@ -923,26 +923,26 @@
RunVariablesScript(CXFA_Script::FromNode(pObject->AsNode()));
CJX_Object* pCJXObject = pObject->JSObject();
- auto iter = m_mapObjectToObject.find(pCJXObject);
- if (iter != m_mapObjectToObject.end()) {
+ auto iter = map_object_to_object_.find(pCJXObject);
+ if (iter != map_object_to_object_.end()) {
return v8::Local<v8::Object>::New(GetIsolate(), iter->second);
}
v8::Local<v8::Object> binding = pCJXObject->NewBoundV8Object(
- GetIsolate(), m_pJsClass->GetTemplate(GetIsolate()));
+ GetIsolate(), js_class_->GetTemplate(GetIsolate()));
- m_mapObjectToObject[pCJXObject].Reset(GetIsolate(), binding);
+ map_object_to_object_[pCJXObject].Reset(GetIsolate(), binding);
return binding;
}
void CFXJSE_Engine::SetNodesOfRunScript(
std::vector<cppgc::Persistent<CXFA_Node>>* pArray) {
- m_pScriptNodeArray = pArray;
+ script_node_array_ = pArray;
}
void CFXJSE_Engine::AddNodesOfRunScript(CXFA_Node* pNode) {
- if (m_pScriptNodeArray && !pdfium::Contains(*m_pScriptNodeArray, pNode)) {
- m_pScriptNodeArray->emplace_back(pNode);
+ if (script_node_array_ && !pdfium::Contains(*script_node_array_, pNode)) {
+ script_node_array_->emplace_back(pNode);
}
}
diff --git a/fxjs/xfa/cfxjse_engine.h b/fxjs/xfa/cfxjse_engine.h
index 5890483..f58f81f 100644
--- a/fxjs/xfa/cfxjse_engine.h
+++ b/fxjs/xfa/cfxjse_engine.h
@@ -125,14 +125,14 @@
~EventParamScope();
private:
- UnownedPtr<CFXJSE_Engine> m_pEngine;
- UnownedPtr<CXFA_Node> m_pPrevTarget;
- UnownedPtr<CXFA_EventParam> m_pPrevEventParam;
+ UnownedPtr<CFXJSE_Engine> engine_;
+ UnownedPtr<CXFA_Node> prev_target_;
+ UnownedPtr<CXFA_EventParam> prev_event_param_;
};
friend class EventParamScope;
- CXFA_Node* GetEventTarget() const { return m_pTarget; }
- CXFA_EventParam* GetEventParam() const { return m_eventParam; }
+ CXFA_Node* GetEventTarget() const { return target_; }
+ CXFA_EventParam* GetEventParam() const { return event_param_; }
CFXJSE_Context::ExecutionResult RunScript(CXFA_Script::Type eScriptType,
WideStringView wsScript,
@@ -150,15 +150,15 @@
v8::Local<v8::Object> GetOrCreateJSBindingFromMap(CXFA_Object* pObject);
- CXFA_Object* GetThisObject() const { return m_pThisObject; }
- CFXJSE_Class* GetJseNormalClass() const { return m_pJsClass; }
- CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
+ CXFA_Object* GetThisObject() const { return this_object_; }
+ CFXJSE_Class* GetJseNormalClass() const { return js_class_; }
+ CXFA_Document* GetDocument() const { return document_.Get(); }
void SetNodesOfRunScript(std::vector<cppgc::Persistent<CXFA_Node>>* pArray);
void AddNodesOfRunScript(CXFA_Node* pNode);
- void SetRunAtType(XFA_AttributeValue eRunAt) { m_eRunAtType = eRunAt; }
- bool IsRunAtClient() { return m_eRunAtType != XFA_AttributeValue::Server; }
+ void SetRunAtType(XFA_AttributeValue eRunAt) { run_at_type_ = eRunAt; }
+ bool IsRunAtClient() { return run_at_type_ != XFA_AttributeValue::Server; }
CXFA_Script::Type GetType();
@@ -168,12 +168,12 @@
CXFA_Object* ToXFAObject(v8::Local<v8::Value> obj);
v8::Local<v8::Object> NewNormalXFAObject(CXFA_Object* obj);
- bool IsResolvingNodes() const { return m_bResolvingNodes; }
+ bool IsResolvingNodes() const { return resolving_nodes_; }
CFXJSE_Context* GetJseContextForTest() const { return GetJseContext(); }
private:
- CFXJSE_Context* GetJseContext() const { return m_JsContext.get(); }
+ CFXJSE_Context* GetJseContext() const { return js_context_.get(); }
CFXJSE_Context* CreateVariablesContext(CXFA_Script* pScriptNode,
CXFA_Node* pSubform);
void RemoveBuiltInObjs(CFXJSE_Context* pContext);
@@ -197,27 +197,27 @@
v8::Local<v8::Value> pValue);
void RunVariablesScript(CXFA_Script* pScriptNode);
- UnownedPtr<CJS_Runtime> const m_pSubordinateRuntime;
- cppgc::WeakPersistent<CXFA_Document> const m_pDocument;
- std::unique_ptr<CFXJSE_Context> m_JsContext;
- UnownedPtr<CFXJSE_Class> m_pJsClass;
- CXFA_Script::Type m_eScriptType = CXFA_Script::Type::Unknown;
- // |m_mapObjectToValue| is what ensures the v8 object bound to a
+ UnownedPtr<CJS_Runtime> const subordinate_runtime_;
+ cppgc::WeakPersistent<CXFA_Document> const document_;
+ std::unique_ptr<CFXJSE_Context> js_context_;
+ UnownedPtr<CFXJSE_Class> js_class_;
+ CXFA_Script::Type script_type_ = CXFA_Script::Type::Unknown;
+ // |map_object_to_value_| is what ensures the v8 object bound to a
// CJX_Object remains valid for the lifetime of the engine.
std::map<cppgc::Persistent<CJX_Object>, v8::Global<v8::Object>>
- m_mapObjectToObject;
+ map_object_to_object_;
std::map<cppgc::Persistent<CJX_Object>, std::unique_ptr<CFXJSE_Context>>
- m_mapVariableToContext;
- cppgc::Persistent<CXFA_Node> m_pTarget;
- UnownedPtr<CXFA_EventParam> m_eventParam;
- std::vector<cppgc::Persistent<CXFA_Node>> m_upObjectArray;
- UnownedPtr<std::vector<cppgc::Persistent<CXFA_Node>>> m_pScriptNodeArray;
- std::unique_ptr<CFXJSE_NodeHelper> const m_NodeHelper;
- std::unique_ptr<CFXJSE_ResolveProcessor> const m_ResolveProcessor;
- std::unique_ptr<CFXJSE_FormCalcContext> m_FormCalcContext;
- cppgc::Persistent<CXFA_Object> m_pThisObject;
- XFA_AttributeValue m_eRunAtType = XFA_AttributeValue::Client;
- bool m_bResolvingNodes = false;
+ map_variable_to_context_;
+ cppgc::Persistent<CXFA_Node> target_;
+ UnownedPtr<CXFA_EventParam> event_param_;
+ std::vector<cppgc::Persistent<CXFA_Node>> up_object_array_;
+ UnownedPtr<std::vector<cppgc::Persistent<CXFA_Node>>> script_node_array_;
+ std::unique_ptr<CFXJSE_NodeHelper> const node_helper_;
+ std::unique_ptr<CFXJSE_ResolveProcessor> const resolve_processor_;
+ std::unique_ptr<CFXJSE_FormCalcContext> form_calc_context_;
+ cppgc::Persistent<CXFA_Object> this_object_;
+ XFA_AttributeValue run_at_type_ = XFA_AttributeValue::Client;
+ bool resolving_nodes_ = false;
};
#endif // FXJS_XFA_CFXJSE_ENGINE_H_
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 0bbd2c1..131a1ab 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -69,12 +69,12 @@
L'c', L'd', L'e', L'f'}};
struct XFA_FMHtmlReserveCode {
- uint16_t m_uCode;
+ uint16_t code_;
// Inline string data reduces size for small strings.
- const char m_htmlReserve[10];
+ const char html_reserve_[10];
};
-// Sorted by |m_htmlReserve|.
+// Sorted by |html_reserve_|.
const XFA_FMHtmlReserveCode kReservesForDecode[] = {
{198, "AElig"}, {193, "Aacute"}, {194, "Acirc"}, {192, "Agrave"},
{913, "Alpha"}, {197, "Aring"}, {195, "Atilde"}, {196, "Auml"},
@@ -141,7 +141,7 @@
{255, "yuml"}, {950, "zeta"}, {8205, "zwj"}, {8204, "zwnj"},
};
-// Sorted by |m_uCode|.
+// Sorted by |code_|.
const XFA_FMHtmlReserveCode kReservesForEncode[] = {
{34, "quot"}, {38, "amp"}, {39, "apos"}, {60, "lt"},
{62, "gt"}, {160, "nbsp"}, {161, "iexcl"}, {162, "cent"},
@@ -553,7 +553,7 @@
bool HTMLSTR2Code(const WideString& pData, uint32_t* iCode) {
auto cmpFunc = [](const XFA_FMHtmlReserveCode& iter, ByteStringView val) {
- return UNSAFE_TODO(strcmp(val.unterminated_c_str(), iter.m_htmlReserve)) >
+ return UNSAFE_TODO(strcmp(val.unterminated_c_str(), iter.html_reserve_)) >
0;
};
if (!pData.IsASCII()) {
@@ -564,8 +564,8 @@
std::begin(kReservesForDecode), std::end(kReservesForDecode),
temp.AsStringView(), cmpFunc);
if (result != std::end(kReservesForDecode) &&
- !UNSAFE_TODO(strcmp(temp.c_str(), result->m_htmlReserve))) {
- *iCode = result->m_uCode;
+ !UNSAFE_TODO(strcmp(temp.c_str(), result->html_reserve_))) {
+ *iCode = result->code_;
return true;
}
return false;
@@ -573,13 +573,13 @@
bool HTMLCode2STR(uint32_t iCode, WideString* wsHTMLReserve) {
auto cmpFunc = [](const XFA_FMHtmlReserveCode iter, const uint32_t& val) {
- return iter.m_uCode < val;
+ return iter.code_ < val;
};
const XFA_FMHtmlReserveCode* result =
std::lower_bound(std::begin(kReservesForEncode),
std::end(kReservesForEncode), iCode, cmpFunc);
- if (result != std::end(kReservesForEncode) && result->m_uCode == iCode) {
- *wsHTMLReserve = WideString::FromASCII(result->m_htmlReserve);
+ if (result != std::end(kReservesForEncode) && result->code_ == iCode) {
+ *wsHTMLReserve = WideString::FromASCII(result->html_reserve_);
return true;
}
return false;
@@ -5116,12 +5116,12 @@
CFXJSE_FormCalcContext::CFXJSE_FormCalcContext(v8::Isolate* pIsolate,
CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc)
- : m_pIsolate(pIsolate), m_pDocument(pDoc) {
- m_Value.Reset(m_pIsolate,
- NewBoundV8Object(
- m_pIsolate, CFXJSE_Class::Create(
- pScriptContext, &kFormCalcDescriptor, false)
- ->GetTemplate(m_pIsolate)));
+ : isolate_(pIsolate), document_(pDoc) {
+ value_.Reset(isolate_,
+ NewBoundV8Object(
+ isolate_, CFXJSE_Class::Create(pScriptContext,
+ &kFormCalcDescriptor, false)
+ ->GetTemplate(isolate_)));
}
CFXJSE_FormCalcContext::~CFXJSE_FormCalcContext() = default;
@@ -5131,7 +5131,7 @@
}
v8::Local<v8::Value> CFXJSE_FormCalcContext::GlobalPropertyGetter() {
- return v8::Local<v8::Value>::New(m_pIsolate, m_Value);
+ return v8::Local<v8::Value>::New(isolate_, value_);
}
// static
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index 6757b08..7e9d743 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -272,8 +272,8 @@
WideStringView wsFormcalc);
v8::Local<v8::Value> GlobalPropertyGetter();
- v8::Isolate* GetIsolate() const { return m_pIsolate; }
- CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
+ v8::Isolate* GetIsolate() const { return isolate_; }
+ CXFA_Document* GetDocument() const { return document_.Get(); }
private:
friend class FormCalcContextTest_GenerateSomExpression_Test;
@@ -326,9 +326,9 @@
void ThrowParamCountMismatchException(ByteStringView method) const;
void ThrowException(ByteStringView str) const;
- UnownedPtr<v8::Isolate> const m_pIsolate;
- v8::Global<v8::Value> m_Value;
- cppgc::WeakPersistent<CXFA_Document> const m_pDocument;
+ UnownedPtr<v8::Isolate> const isolate_;
+ v8::Global<v8::Value> value_;
+ cppgc::WeakPersistent<CXFA_Document> const document_;
};
#endif // FXJS_XFA_CFXJSE_FORMCALC_CONTEXT_H_
diff --git a/fxjs/xfa/cfxjse_mapmodule.cpp b/fxjs/xfa/cfxjse_mapmodule.cpp
index b787cb0..91723c0 100644
--- a/fxjs/xfa/cfxjse_mapmodule.cpp
+++ b/fxjs/xfa/cfxjse_mapmodule.cpp
@@ -14,35 +14,35 @@
CFXJSE_MapModule::~CFXJSE_MapModule() = default;
void CFXJSE_MapModule::SetValue(uint32_t key, int32_t value) {
- m_StringMap.erase(key);
- m_MeasurementMap.erase(key);
- m_ValueMap[key] = value;
+ string_map_.erase(key);
+ measurement_map_.erase(key);
+ value_map_[key] = value;
}
void CFXJSE_MapModule::SetString(uint32_t key, const WideString& wsString) {
- m_ValueMap.erase(key);
- m_MeasurementMap.erase(key);
- m_StringMap[key] = wsString;
+ value_map_.erase(key);
+ measurement_map_.erase(key);
+ string_map_[key] = wsString;
}
void CFXJSE_MapModule::SetMeasurement(uint32_t key,
const CXFA_Measurement& measurement) {
- m_ValueMap.erase(key);
- m_StringMap.erase(key);
- m_MeasurementMap[key] = measurement;
+ value_map_.erase(key);
+ string_map_.erase(key);
+ measurement_map_[key] = measurement;
}
std::optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
- auto it = m_ValueMap.find(key);
- if (it == m_ValueMap.end()) {
+ auto it = value_map_.find(key);
+ if (it == value_map_.end()) {
return std::nullopt;
}
return it->second;
}
std::optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
- auto it = m_StringMap.find(key);
- if (it == m_StringMap.end()) {
+ auto it = string_map_.find(key);
+ if (it == string_map_.end()) {
return std::nullopt;
}
return it->second;
@@ -50,35 +50,35 @@
std::optional<CXFA_Measurement> CFXJSE_MapModule::GetMeasurement(
uint32_t key) const {
- auto it = m_MeasurementMap.find(key);
- if (it == m_MeasurementMap.end()) {
+ auto it = measurement_map_.find(key);
+ if (it == measurement_map_.end()) {
return std::nullopt;
}
return it->second;
}
bool CFXJSE_MapModule::HasKey(uint32_t key) const {
- return pdfium::Contains(m_ValueMap, key) ||
- pdfium::Contains(m_StringMap, key) ||
- pdfium::Contains(m_MeasurementMap, key);
+ return pdfium::Contains(value_map_, key) ||
+ pdfium::Contains(string_map_, key) ||
+ pdfium::Contains(measurement_map_, key);
}
void CFXJSE_MapModule::RemoveKey(uint32_t key) {
- m_ValueMap.erase(key);
- m_StringMap.erase(key);
- m_MeasurementMap.erase(key);
+ value_map_.erase(key);
+ string_map_.erase(key);
+ measurement_map_.erase(key);
}
void CFXJSE_MapModule::MergeDataFrom(const CFXJSE_MapModule* pSrc) {
- for (const auto& pair : pSrc->m_ValueMap) {
+ for (const auto& pair : pSrc->value_map_) {
SetValue(pair.first, pair.second);
}
- for (const auto& pair : pSrc->m_StringMap) {
+ for (const auto& pair : pSrc->string_map_) {
SetString(pair.first, pair.second);
}
- for (const auto& pair : pSrc->m_MeasurementMap) {
+ for (const auto& pair : pSrc->measurement_map_) {
SetMeasurement(pair.first, pair.second);
}
}
diff --git a/fxjs/xfa/cfxjse_mapmodule.h b/fxjs/xfa/cfxjse_mapmodule.h
index 81b8f9c..63041b2 100644
--- a/fxjs/xfa/cfxjse_mapmodule.h
+++ b/fxjs/xfa/cfxjse_mapmodule.h
@@ -36,9 +36,9 @@
private:
// keyed by result of GetMapKey_*().
- std::map<uint32_t, int32_t> m_ValueMap;
- std::map<uint32_t, WideString> m_StringMap;
- std::map<uint32_t, CXFA_Measurement> m_MeasurementMap;
+ std::map<uint32_t, int32_t> value_map_;
+ std::map<uint32_t, WideString> string_map_;
+ std::map<uint32_t, CXFA_Measurement> measurement_map_;
};
#endif // FXJS_XFA_CFXJSE_MAPMODULE_H_
diff --git a/fxjs/xfa/cfxjse_nodehelper.cpp b/fxjs/xfa/cfxjse_nodehelper.cpp
index b5ef524..208c69c 100644
--- a/fxjs/xfa/cfxjse_nodehelper.cpp
+++ b/fxjs/xfa/cfxjse_nodehelper.cpp
@@ -22,7 +22,7 @@
bool CFXJSE_NodeHelper::CreateNodeForCondition(const WideString& wsCondition) {
size_t szLen = wsCondition.GetLength();
if (szLen == 0) {
- m_iCreateFlag = CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne;
+ create_flag_ = CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne;
return false;
}
if (wsCondition[0] != '[') {
@@ -32,20 +32,20 @@
for (; i < szLen; ++i) {
wchar_t ch = wsCondition[i];
if (ch == '*') {
- m_iCreateFlag = CFXJSE_Engine::ResolveResult::Type::kCreateNodeAll;
- m_iCreateCount = 1;
+ create_flag_ = CFXJSE_Engine::ResolveResult::Type::kCreateNodeAll;
+ create_count_ = 1;
return true;
}
if (ch != ' ') {
break;
}
}
- m_iCreateFlag = CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne;
+ create_flag_ = CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne;
int32_t iCount = wsCondition.Substr(i, szLen - 1 - i).GetInteger();
if (iCount < 0) {
return false;
}
- m_iCreateCount = iCount;
+ create_count_ = iCount;
return true;
}
@@ -53,7 +53,7 @@
const WideString& wsCondition,
bool bLastNode,
CFXJSE_Engine* pScriptContext) {
- if (!m_pCreateParent) {
+ if (!create_parent_) {
return false;
}
@@ -62,7 +62,7 @@
bool bResult = false;
if (!wsNameView.IsEmpty() && wsNameView[0] == '!') {
wsNameView = wsNameView.Last(wsNameView.GetLength() - 1);
- m_pCreateParent = ToNode(
+ create_parent_ = ToNode(
pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
}
if (!wsNameView.IsEmpty() && wsNameView[0] == '#') {
@@ -73,7 +73,7 @@
return false;
}
- if (m_iCreateCount == 0) {
+ if (create_count_ == 0) {
CreateNodeForCondition(wsCondition);
}
@@ -83,12 +83,12 @@
return false;
}
- for (size_t i = 0; i < m_iCreateCount; ++i) {
- CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eType);
+ for (size_t i = 0; i < create_count_; ++i) {
+ CXFA_Node* pNewNode = create_parent_->CreateSamePacketNode(eType);
if (pNewNode) {
- m_pCreateParent->InsertChildAndNotify(pNewNode, nullptr);
- if (i == m_iCreateCount - 1) {
- m_pCreateParent = pNewNode;
+ create_parent_->InsertChildAndNotify(pNewNode, nullptr);
+ if (i == create_count_ - 1) {
+ create_parent_ = pNewNode;
}
bResult = true;
}
@@ -96,24 +96,24 @@
} else {
XFA_Element eClassType = XFA_Element::DataGroup;
if (bLastNode) {
- eClassType = m_eLastCreateType;
+ eClassType = last_create_type_;
}
- for (size_t i = 0; i < m_iCreateCount; ++i) {
- CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType);
+ for (size_t i = 0; i < create_count_; ++i) {
+ CXFA_Node* pNewNode = create_parent_->CreateSamePacketNode(eClassType);
if (pNewNode) {
pNewNode->JSObject()->SetAttributeByEnum(XFA_Attribute::Name,
WideString(wsNameView), false);
pNewNode->CreateXMLMappingNode();
- m_pCreateParent->InsertChildAndNotify(pNewNode, nullptr);
- if (i == m_iCreateCount - 1) {
- m_pCreateParent = pNewNode;
+ create_parent_->InsertChildAndNotify(pNewNode, nullptr);
+ if (i == create_count_ - 1) {
+ create_parent_ = pNewNode;
}
bResult = true;
}
}
}
if (!bResult) {
- m_pCreateParent = nullptr;
+ create_parent_ = nullptr;
}
return bResult;
@@ -125,12 +125,12 @@
}
if (refNode->GetElementType() == XFA_Element::Subform) {
- m_eLastCreateType = XFA_Element::DataGroup;
+ last_create_type_ = XFA_Element::DataGroup;
} else if (refNode->GetElementType() == XFA_Element::Field) {
- m_eLastCreateType = XFA_FieldIsMultiListBox(refNode)
+ last_create_type_ = XFA_FieldIsMultiListBox(refNode)
? XFA_Element::DataGroup
: XFA_Element::DataValue;
} else if (refNode->GetElementType() == XFA_Element::ExclGroup) {
- m_eLastCreateType = XFA_Element::DataValue;
+ last_create_type_ = XFA_Element::DataValue;
}
}
diff --git a/fxjs/xfa/cfxjse_nodehelper.h b/fxjs/xfa/cfxjse_nodehelper.h
index 7afc10c..616c382 100644
--- a/fxjs/xfa/cfxjse_nodehelper.h
+++ b/fxjs/xfa/cfxjse_nodehelper.h
@@ -26,13 +26,13 @@
bool CreateNodeForCondition(const WideString& wsCondition);
void SetCreateNodeType(CXFA_Node* refNode);
- XFA_Element m_eLastCreateType = XFA_Element::DataValue;
- CFXJSE_Engine::ResolveResult::Type m_iCreateFlag =
+ XFA_Element last_create_type_ = XFA_Element::DataValue;
+ CFXJSE_Engine::ResolveResult::Type create_flag_ =
CFXJSE_Engine::ResolveResult::Type::kCreateNodeOne;
- size_t m_iCreateCount = 0;
- int32_t m_iCurAllStart = -1;
- cppgc::Persistent<CXFA_Node> m_pCreateParent;
- cppgc::Persistent<CXFA_Node> m_pAllStartParent;
+ size_t create_count_ = 0;
+ int32_t cur_all_start_ = -1;
+ cppgc::Persistent<CXFA_Node> create_parent_;
+ cppgc::Persistent<CXFA_Node> all_start_parent_;
};
#endif // FXJS_XFA_CFXJSE_NODEHELPER_H_
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index ad332a1..544fb7d 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -27,28 +27,28 @@
CFXJSE_ResolveProcessor::CFXJSE_ResolveProcessor(CFXJSE_Engine* pEngine,
CFXJSE_NodeHelper* pHelper)
- : m_pEngine(pEngine), m_pNodeHelper(pHelper) {}
+ : engine_(pEngine), node_helper_(pHelper) {}
CFXJSE_ResolveProcessor::~CFXJSE_ResolveProcessor() = default;
bool CFXJSE_ResolveProcessor::Resolve(v8::Isolate* pIsolate, NodeData& rnd) {
- if (!rnd.m_CurObject) {
+ if (!rnd.cur_object_) {
return false;
}
- if (!rnd.m_CurObject->IsNode()) {
- if (rnd.m_dwStyles & XFA_ResolveFlag::kAttributes) {
- return ResolveForAttributeRs(rnd.m_CurObject, &rnd.m_Result,
- rnd.m_wsName.AsStringView());
+ if (!rnd.cur_object_->IsNode()) {
+ if (rnd.styles_ & XFA_ResolveFlag::kAttributes) {
+ return ResolveForAttributeRs(rnd.cur_object_, &rnd.result_,
+ rnd.name_.AsStringView());
}
return false;
}
- if (rnd.m_dwStyles & XFA_ResolveFlag::kAnyChild) {
+ if (rnd.styles_ & XFA_ResolveFlag::kAnyChild) {
return ResolveAnyChild(pIsolate, rnd);
}
- if (rnd.m_wsName.GetLength()) {
- wchar_t wch = rnd.m_wsName[0];
+ if (rnd.name_.GetLength()) {
+ wchar_t wch = rnd.name_[0];
switch (wch) {
case '$':
return ResolveDollar(pIsolate, rnd);
@@ -65,44 +65,44 @@
break;
}
}
- if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) {
- rnd.m_Result.objects.emplace_back(m_pEngine->GetThisObject());
+ if (rnd.hash_name_ == XFA_HASHCODE_This && rnd.level_ == 0) {
+ rnd.result_.objects.emplace_back(engine_->GetThisObject());
return true;
}
- if (rnd.m_CurObject->GetElementType() == XFA_Element::Xfa) {
+ if (rnd.cur_object_->GetElementType() == XFA_Element::Xfa) {
CXFA_Object* pObjNode =
- m_pEngine->GetDocument()->GetXFAObject(rnd.m_uHashName);
+ engine_->GetDocument()->GetXFAObject(rnd.hash_name_);
if (pObjNode) {
- rnd.m_Result.objects.emplace_back(pObjNode);
- } else if (rnd.m_uHashName == XFA_HASHCODE_Xfa) {
- rnd.m_Result.objects.emplace_back(rnd.m_CurObject);
- } else if ((rnd.m_dwStyles & XFA_ResolveFlag::kAttributes) &&
- ResolveForAttributeRs(rnd.m_CurObject, &rnd.m_Result,
- rnd.m_wsName.AsStringView())) {
+ rnd.result_.objects.emplace_back(pObjNode);
+ } else if (rnd.hash_name_ == XFA_HASHCODE_Xfa) {
+ rnd.result_.objects.emplace_back(rnd.cur_object_);
+ } else if ((rnd.styles_ & XFA_ResolveFlag::kAttributes) &&
+ ResolveForAttributeRs(rnd.cur_object_, &rnd.result_,
+ rnd.name_.AsStringView())) {
return true;
}
- if (!rnd.m_Result.objects.empty()) {
- FilterCondition(pIsolate, rnd.m_wsCondition, &rnd);
+ if (!rnd.result_.objects.empty()) {
+ FilterCondition(pIsolate, rnd.condition_, &rnd);
}
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
- if (!ResolveNormal(pIsolate, rnd) && rnd.m_uHashName == XFA_HASHCODE_Xfa) {
- rnd.m_Result.objects.emplace_back(m_pEngine->GetDocument()->GetRoot());
+ if (!ResolveNormal(pIsolate, rnd) && rnd.hash_name_ == XFA_HASHCODE_Xfa) {
+ rnd.result_.objects.emplace_back(engine_->GetDocument()->GetRoot());
}
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
bool CFXJSE_ResolveProcessor::ResolveAnyChild(v8::Isolate* pIsolate,
NodeData& rnd) {
- CXFA_Node* pParent = ToNode(rnd.m_CurObject);
+ CXFA_Node* pParent = ToNode(rnd.cur_object_);
if (!pParent) {
return false;
}
- WideStringView wsName = rnd.m_wsName.AsStringView();
- WideString wsCondition = rnd.m_wsCondition;
+ WideStringView wsName = rnd.name_.AsStringView();
+ WideString wsCondition = rnd.condition_;
const bool bClassName = !wsName.IsEmpty() && wsName[0] == '#';
CXFA_Node* const pChild =
bClassName
@@ -113,114 +113,114 @@
}
if (wsCondition.IsEmpty()) {
- rnd.m_Result.objects.emplace_back(pChild);
+ rnd.result_.objects.emplace_back(pChild);
return true;
}
std::vector<CXFA_Node*> nodes;
- for (const auto& pObject : rnd.m_Result.objects) {
+ for (const auto& pObject : rnd.result_.objects) {
nodes.push_back(pObject->AsNode());
}
std::vector<CXFA_Node*> siblings = pChild->GetSiblings(bClassName);
nodes.insert(nodes.end(), siblings.begin(), siblings.end());
- rnd.m_Result.objects =
+ rnd.result_.objects =
std::vector<cppgc::Member<CXFA_Object>>(nodes.begin(), nodes.end());
FilterCondition(pIsolate, wsCondition, &rnd);
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
bool CFXJSE_ResolveProcessor::ResolveDollar(v8::Isolate* pIsolate,
NodeData& rnd) {
- WideString wsName = rnd.m_wsName;
- WideString wsCondition = rnd.m_wsCondition;
+ WideString wsName = rnd.name_;
+ WideString wsCondition = rnd.condition_;
size_t nNameLen = wsName.GetLength();
if (nNameLen == 1) {
- rnd.m_Result.objects.emplace_back(rnd.m_CurObject);
+ rnd.result_.objects.emplace_back(rnd.cur_object_);
return true;
}
- if (rnd.m_nLevel > 0) {
+ if (rnd.level_ > 0) {
return false;
}
- CXFA_Document* pDocument = m_pEngine->GetDocument();
+ CXFA_Document* pDocument = engine_->GetDocument();
XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(
FX_HashCode_GetW(wsName.AsStringView().Last(nNameLen - 1)));
if (dwNameHash == XFA_HASHCODE_Xfa) {
- rnd.m_Result.objects.emplace_back(pDocument->GetRoot());
+ rnd.result_.objects.emplace_back(pDocument->GetRoot());
} else {
CXFA_Object* pObjNode = pDocument->GetXFAObject(dwNameHash);
if (pObjNode) {
- rnd.m_Result.objects.emplace_back(pObjNode);
+ rnd.result_.objects.emplace_back(pObjNode);
}
}
- if (!rnd.m_Result.objects.empty()) {
+ if (!rnd.result_.objects.empty()) {
FilterCondition(pIsolate, wsCondition, &rnd);
}
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
bool CFXJSE_ResolveProcessor::ResolveExcalmatory(v8::Isolate* pIsolate,
NodeData& rnd) {
- if (rnd.m_nLevel > 0) {
+ if (rnd.level_ > 0) {
return false;
}
CXFA_Node* datasets =
- ToNode(m_pEngine->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
+ ToNode(engine_->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
if (!datasets) {
return false;
}
NodeData rndFind;
- rndFind.m_CurObject = datasets;
- rndFind.m_wsName = rnd.m_wsName.Last(rnd.m_wsName.GetLength() - 1);
- rndFind.m_uHashName = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(rndFind.m_wsName.AsStringView()));
- rndFind.m_nLevel = rnd.m_nLevel + 1;
- rndFind.m_dwStyles = XFA_ResolveFlag::kChildren;
- rndFind.m_wsCondition = rnd.m_wsCondition;
+ rndFind.cur_object_ = datasets;
+ rndFind.name_ = rnd.name_.Last(rnd.name_.GetLength() - 1);
+ rndFind.hash_name_ =
+ static_cast<XFA_HashCode>(FX_HashCode_GetW(rndFind.name_.AsStringView()));
+ rndFind.level_ = rnd.level_ + 1;
+ rndFind.styles_ = XFA_ResolveFlag::kChildren;
+ rndFind.condition_ = rnd.condition_;
Resolve(pIsolate, rndFind);
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- return !rnd.m_Result.objects.empty();
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ return !rnd.result_.objects.empty();
}
bool CFXJSE_ResolveProcessor::ResolveNumberSign(v8::Isolate* pIsolate,
NodeData& rnd) {
- WideString wsName = rnd.m_wsName.Last(rnd.m_wsName.GetLength() - 1);
- WideString wsCondition = rnd.m_wsCondition;
- CXFA_Node* curNode = ToNode(rnd.m_CurObject);
- if (ResolveForAttributeRs(curNode, &rnd.m_Result, wsName.AsStringView())) {
+ WideString wsName = rnd.name_.Last(rnd.name_.GetLength() - 1);
+ WideString wsCondition = rnd.condition_;
+ CXFA_Node* curNode = ToNode(rnd.cur_object_);
+ if (ResolveForAttributeRs(curNode, &rnd.result_, wsName.AsStringView())) {
return true;
}
NodeData rndFind;
- rndFind.m_nLevel = rnd.m_nLevel + 1;
- rndFind.m_dwStyles = rnd.m_dwStyles;
- rndFind.m_dwStyles |= XFA_ResolveFlag::kTagName;
- rndFind.m_dwStyles.Clear(XFA_ResolveFlag::kAttributes);
- rndFind.m_wsName = std::move(wsName);
- rndFind.m_uHashName = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(rndFind.m_wsName.AsStringView()));
- rndFind.m_wsCondition = wsCondition;
- rndFind.m_CurObject = curNode;
+ rndFind.level_ = rnd.level_ + 1;
+ rndFind.styles_ = rnd.styles_;
+ rndFind.styles_ |= XFA_ResolveFlag::kTagName;
+ rndFind.styles_.Clear(XFA_ResolveFlag::kAttributes);
+ rndFind.name_ = std::move(wsName);
+ rndFind.hash_name_ =
+ static_cast<XFA_HashCode>(FX_HashCode_GetW(rndFind.name_.AsStringView()));
+ rndFind.condition_ = wsCondition;
+ rndFind.cur_object_ = curNode;
ResolveNormal(pIsolate, rndFind);
- if (rndFind.m_Result.objects.empty()) {
+ if (rndFind.result_.objects.empty()) {
return false;
}
if (wsCondition.IsEmpty() &&
- pdfium::Contains(rndFind.m_Result.objects, curNode)) {
- rnd.m_Result.objects.emplace_back(curNode);
+ pdfium::Contains(rndFind.result_.objects, curNode)) {
+ rnd.result_.objects.emplace_back(curNode);
} else {
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
}
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
bool CFXJSE_ResolveProcessor::ResolveForAttributeRs(
@@ -241,22 +241,22 @@
bool CFXJSE_ResolveProcessor::ResolveNormal(v8::Isolate* pIsolate,
NodeData& rnd) {
- if (rnd.m_nLevel > 32 || !rnd.m_CurObject->IsNode()) {
+ if (rnd.level_ > 32 || !rnd.cur_object_->IsNode()) {
return false;
}
- CXFA_Node* curNode = rnd.m_CurObject->AsNode();
- size_t nNum = rnd.m_Result.objects.size();
- Mask<XFA_ResolveFlag> dwStyles = rnd.m_dwStyles;
- WideString& wsName = rnd.m_wsName;
- XFA_HashCode uNameHash = rnd.m_uHashName;
- WideString& wsCondition = rnd.m_wsCondition;
+ CXFA_Node* curNode = rnd.cur_object_->AsNode();
+ size_t nNum = rnd.result_.objects.size();
+ Mask<XFA_ResolveFlag> dwStyles = rnd.styles_;
+ WideString& wsName = rnd.name_;
+ XFA_HashCode uNameHash = rnd.hash_name_;
+ WideString& wsCondition = rnd.condition_;
NodeData rndFind;
- rndFind.m_wsName = rnd.m_wsName;
- rndFind.m_wsCondition = rnd.m_wsCondition;
- rndFind.m_nLevel = rnd.m_nLevel + 1;
- rndFind.m_uHashName = uNameHash;
+ rndFind.name_ = rnd.name_;
+ rndFind.condition_ = rnd.condition_;
+ rndFind.level_ = rnd.level_ + 1;
+ rndFind.hash_name_ = uNameHash;
std::vector<CXFA_Node*> children;
std::vector<CXFA_Node*> properties;
@@ -280,21 +280,21 @@
}
if ((dwStyles & XFA_ResolveFlag::kProperties) && pVariablesNode) {
if (pVariablesNode->GetClassHashCode() == uNameHash) {
- rnd.m_Result.objects.emplace_back(pVariablesNode);
+ rnd.result_.objects.emplace_back(pVariablesNode);
} else {
- rndFind.m_CurObject = pVariablesNode;
+ rndFind.cur_object_ = pVariablesNode;
SetStylesForChild(dwStyles, rndFind);
- WideString wsSaveCondition = std::move(rndFind.m_wsCondition);
+ WideString wsSaveCondition = std::move(rndFind.condition_);
ResolveNormal(pIsolate, rndFind);
- rndFind.m_wsCondition = std::move(wsSaveCondition);
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- rndFind.m_Result.objects.clear();
+ rndFind.condition_ = std::move(wsSaveCondition);
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ rndFind.result_.objects.clear();
}
- if (rnd.m_Result.objects.size() > nNum) {
+ if (rnd.result_.objects.size() > nNum) {
FilterCondition(pIsolate, wsCondition, &rnd);
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
}
@@ -307,10 +307,10 @@
for (CXFA_Node* child : children) {
if (dwStyles & XFA_ResolveFlag::kTagName) {
if (child->GetClassHashCode() == uNameHash) {
- rnd.m_Result.objects.emplace_back(child);
+ rnd.result_.objects.emplace_back(child);
}
} else if (child->GetNameHash() == uNameHash) {
- rnd.m_Result.objects.emplace_back(child);
+ rnd.result_.objects.emplace_back(child);
}
if (child->GetElementType() != XFA_Element::PageSet &&
@@ -319,40 +319,40 @@
SetStylesForChild(dwStyles, rndFind);
bSetFlag = true;
}
- rndFind.m_CurObject = child;
+ rndFind.cur_object_ = child;
- WideString wsSaveCondition = std::move(rndFind.m_wsCondition);
+ WideString wsSaveCondition = std::move(rndFind.condition_);
ResolveNormal(pIsolate, rndFind);
- rndFind.m_wsCondition = std::move(wsSaveCondition);
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- rndFind.m_Result.objects.clear();
+ rndFind.condition_ = std::move(wsSaveCondition);
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ rndFind.result_.objects.clear();
}
}
- if (rnd.m_Result.objects.size() > nNum) {
+ if (rnd.result_.objects.size() > nNum) {
if (!(dwStyles & XFA_ResolveFlag::kALL)) {
std::vector<CXFA_Node*> upArrayNodes;
if (curNode->IsTransparent()) {
- CXFA_Node* pCurrent = ToNode(rnd.m_Result.objects.front().Get());
+ CXFA_Node* pCurrent = ToNode(rnd.result_.objects.front().Get());
if (pCurrent) {
upArrayNodes =
pCurrent->GetSiblings(!!(dwStyles & XFA_ResolveFlag::kTagName));
}
}
- if (upArrayNodes.size() > rnd.m_Result.objects.size()) {
- CXFA_Object* pSaveObject = rnd.m_Result.objects.front().Get();
- rnd.m_Result.objects = std::vector<cppgc::Member<CXFA_Object>>(
+ if (upArrayNodes.size() > rnd.result_.objects.size()) {
+ CXFA_Object* pSaveObject = rnd.result_.objects.front().Get();
+ rnd.result_.objects = std::vector<cppgc::Member<CXFA_Object>>(
upArrayNodes.begin(), upArrayNodes.end());
- rnd.m_Result.objects.front() = pSaveObject;
+ rnd.result_.objects.front() = pSaveObject;
}
}
FilterCondition(pIsolate, wsCondition, &rnd);
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
}
if (dwStyles & XFA_ResolveFlag::kAttributes) {
- if (ResolveForAttributeRs(curNode, &rnd.m_Result, wsName.AsStringView())) {
+ if (ResolveForAttributeRs(curNode, &rnd.result_, wsName.AsStringView())) {
return true;
}
}
@@ -360,19 +360,19 @@
for (CXFA_Node* pChildProperty : properties) {
if (pChildProperty->IsUnnamed()) {
if (pChildProperty->GetClassHashCode() == uNameHash) {
- rnd.m_Result.objects.emplace_back(pChildProperty);
+ rnd.result_.objects.emplace_back(pChildProperty);
}
continue;
}
if (pChildProperty->GetNameHash() == uNameHash &&
pChildProperty->GetElementType() != XFA_Element::Extras &&
pChildProperty->GetElementType() != XFA_Element::Items) {
- rnd.m_Result.objects.emplace_back(pChildProperty);
+ rnd.result_.objects.emplace_back(pChildProperty);
}
}
- if (rnd.m_Result.objects.size() > nNum) {
+ if (rnd.result_.objects.size() > nNum) {
FilterCondition(pIsolate, wsCondition, &rnd);
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
CXFA_Node* pProp = nullptr;
@@ -392,8 +392,8 @@
}
}
if (pProp) {
- rnd.m_Result.objects.emplace_back(pProp);
- return !rnd.m_Result.objects.empty();
+ rnd.result_.objects.emplace_back(pProp);
+ return !rnd.result_.objects.empty();
}
}
@@ -401,9 +401,9 @@
uint32_t uCurClassHash = curNode->GetClassHashCode();
if (!parentNode) {
if (uCurClassHash == uNameHash) {
- rnd.m_Result.objects.emplace_back(curNode);
+ rnd.result_.objects.emplace_back(curNode);
FilterCondition(pIsolate, wsCondition, &rnd);
- if (!rnd.m_Result.objects.empty()) {
+ if (!rnd.result_.objects.empty()) {
return true;
}
}
@@ -421,19 +421,19 @@
dwSubStyles |= XFA_ResolveFlag::kALL;
}
- rndFind.m_dwStyles = dwSubStyles;
+ rndFind.styles_ = dwSubStyles;
while (child) {
if (child == curNode) {
if (dwStyles & XFA_ResolveFlag::kTagName) {
if (uCurClassHash == uNameHash) {
- rnd.m_Result.objects.emplace_back(curNode);
+ rnd.result_.objects.emplace_back(curNode);
}
} else {
if (child->GetNameHash() == uNameHash) {
- rnd.m_Result.objects.emplace_back(curNode);
- if (rnd.m_nLevel == 0 && wsCondition.IsEmpty()) {
- rnd.m_Result.objects.clear();
- rnd.m_Result.objects.emplace_back(curNode);
+ rnd.result_.objects.emplace_back(curNode);
+ if (rnd.level_ == 0 && wsCondition.IsEmpty()) {
+ rnd.result_.objects.clear();
+ rnd.result_.objects.emplace_back(curNode);
return true;
}
}
@@ -444,10 +444,10 @@
if (dwStyles & XFA_ResolveFlag::kTagName) {
if (child->GetClassHashCode() == uNameHash) {
- rnd.m_Result.objects.emplace_back(child);
+ rnd.result_.objects.emplace_back(child);
}
} else if (child->GetNameHash() == uNameHash) {
- rnd.m_Result.objects.emplace_back(child);
+ rnd.result_.objects.emplace_back(child);
}
bool bInnerSearch = false;
@@ -460,37 +460,37 @@
bInnerSearch = true;
}
if (bInnerSearch) {
- rndFind.m_CurObject = child;
- WideString wsOriginCondition = std::move(rndFind.m_wsCondition);
- Mask<XFA_ResolveFlag> dwOriginStyle = rndFind.m_dwStyles;
- rndFind.m_dwStyles = dwOriginStyle | XFA_ResolveFlag::kALL;
+ rndFind.cur_object_ = child;
+ WideString wsOriginCondition = std::move(rndFind.condition_);
+ Mask<XFA_ResolveFlag> dwOriginStyle = rndFind.styles_;
+ rndFind.styles_ = dwOriginStyle | XFA_ResolveFlag::kALL;
ResolveNormal(pIsolate, rndFind);
- rndFind.m_dwStyles = dwOriginStyle;
- rndFind.m_wsCondition = std::move(wsOriginCondition);
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- rndFind.m_Result.objects.clear();
+ rndFind.styles_ = dwOriginStyle;
+ rndFind.condition_ = std::move(wsOriginCondition);
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ rndFind.result_.objects.clear();
}
child = child->GetNextSibling();
}
- if (rnd.m_Result.objects.size() > nNum) {
+ if (rnd.result_.objects.size() > nNum) {
if (parentNode->IsTransparent()) {
std::vector<CXFA_Node*> upArrayNodes;
- CXFA_Node* pCurrent = ToNode(rnd.m_Result.objects.front().Get());
+ CXFA_Node* pCurrent = ToNode(rnd.result_.objects.front().Get());
if (pCurrent) {
upArrayNodes =
pCurrent->GetSiblings(!!(dwStyles & XFA_ResolveFlag::kTagName));
}
- if (upArrayNodes.size() > rnd.m_Result.objects.size()) {
- CXFA_Object* pSaveObject = rnd.m_Result.objects.front().Get();
- rnd.m_Result.objects = std::vector<cppgc::Member<CXFA_Object>>(
+ if (upArrayNodes.size() > rnd.result_.objects.size()) {
+ CXFA_Object* pSaveObject = rnd.result_.objects.front().Get();
+ rnd.result_.objects = std::vector<cppgc::Member<CXFA_Object>>(
upArrayNodes.begin(), upArrayNodes.end());
- rnd.m_Result.objects.front() = pSaveObject;
+ rnd.result_.objects.front() = pSaveObject;
}
}
FilterCondition(pIsolate, wsCondition, &rnd);
- return !rnd.m_Result.objects.empty();
+ return !rnd.result_.objects.empty();
}
}
@@ -505,15 +505,15 @@
dwSubStyles |= XFA_ResolveFlag::kALL;
}
- m_pEngine->AddObjectToUpArray(parentNode);
- rndFind.m_dwStyles = dwSubStyles;
- rndFind.m_CurObject = parentNode;
+ engine_->AddObjectToUpArray(parentNode);
+ rndFind.styles_ = dwSubStyles;
+ rndFind.cur_object_ = parentNode;
ResolveNormal(pIsolate, rndFind);
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(),
- rndFind.m_Result.objects.begin(),
- rndFind.m_Result.objects.end());
- rndFind.m_Result.objects.clear();
- if (rnd.m_Result.objects.size() > nNum) {
+ rnd.result_.objects.insert(rnd.result_.objects.end(),
+ rndFind.result_.objects.begin(),
+ rndFind.result_.objects.end());
+ rndFind.result_.objects.clear();
+ if (rnd.result_.objects.size() > nNum) {
return true;
}
}
@@ -521,12 +521,12 @@
}
bool CFXJSE_ResolveProcessor::ResolveAsterisk(NodeData& rnd) {
- CXFA_Node* curNode = ToNode(rnd.m_CurObject);
+ CXFA_Node* curNode = ToNode(rnd.cur_object_);
std::vector<CXFA_Node*> array = curNode->GetNodeListWithFilter(
{XFA_NodeFilter::kChildren, XFA_NodeFilter::kProperties});
- rnd.m_Result.objects.insert(rnd.m_Result.objects.end(), array.begin(),
- array.end());
- return !rnd.m_Result.objects.empty();
+ rnd.result_.objects.insert(rnd.result_.objects.end(), array.begin(),
+ array.end());
+ return !rnd.result_.objects.empty();
}
int32_t CFXJSE_ResolveProcessor::GetFilter(WideStringView wsExpression,
@@ -539,8 +539,8 @@
return 0;
}
- WideString& wsName = rnd.m_wsName;
- WideString& wsCondition = rnd.m_wsCondition;
+ WideString& wsName = rnd.name_;
+ WideString& wsCondition = rnd.condition_;
int32_t nNameCount = 0;
int32_t nConditionCount = 0;
{
@@ -558,7 +558,7 @@
wCur = pSrc[nStart++];
if (wCur == '.') {
if (nNameCount == 0) {
- rnd.m_dwStyles |= XFA_ResolveFlag::kAnyChild;
+ rnd.styles_ |= XFA_ResolveFlag::kAnyChild;
continue;
}
if (wPrev == '\\') {
@@ -609,7 +609,7 @@
wsCondition.ReleaseBuffer(nConditionCount);
wsName.TrimWhitespace();
wsCondition.TrimWhitespace();
- rnd.m_uHashName =
+ rnd.hash_name_ =
static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringView()));
return nStart;
}
@@ -636,20 +636,20 @@
break;
}
if (bAll) {
- if (pRnd->m_dwStyles & XFA_ResolveFlag::kCreateNode) {
- if (pRnd->m_dwStyles & XFA_ResolveFlag::kBind) {
- m_pNodeHelper->m_pCreateParent = ToNode(pRnd->m_CurObject);
- m_pNodeHelper->m_iCreateCount = 1;
- pRnd->m_Result.objects.clear();
- m_pNodeHelper->m_iCurAllStart = -1;
- m_pNodeHelper->m_pAllStartParent = nullptr;
- } else if (m_pNodeHelper->m_iCurAllStart == -1) {
- m_pNodeHelper->m_iCurAllStart = m_iCurStart;
- m_pNodeHelper->m_pAllStartParent = ToNode(pRnd->m_CurObject);
+ if (pRnd->styles_ & XFA_ResolveFlag::kCreateNode) {
+ if (pRnd->styles_ & XFA_ResolveFlag::kBind) {
+ node_helper_->create_parent_ = ToNode(pRnd->cur_object_);
+ node_helper_->create_count_ = 1;
+ pRnd->result_.objects.clear();
+ node_helper_->cur_all_start_ = -1;
+ node_helper_->all_start_parent_ = nullptr;
+ } else if (node_helper_->cur_all_start_ == -1) {
+ node_helper_->cur_all_start_ = cur_start_;
+ node_helper_->all_start_parent_ = ToNode(pRnd->cur_object_);
}
- } else if (pRnd->m_dwStyles & XFA_ResolveFlag::kBindNew) {
- if (m_pNodeHelper->m_iCurAllStart == -1) {
- m_pNodeHelper->m_iCurAllStart = m_iCurStart;
+ } else if (pRnd->styles_ & XFA_ResolveFlag::kBindNew) {
+ if (node_helper_->cur_all_start_ == -1) {
+ node_helper_->cur_all_start_ = cur_start_;
}
}
return;
@@ -664,14 +664,14 @@
}
if (iIndex < 0 || static_cast<size_t>(iIndex) >= iFoundCount) {
- if (pRnd->m_dwStyles & XFA_ResolveFlag::kCreateNode) {
- m_pNodeHelper->m_pCreateParent = ToNode(pRnd->m_CurObject);
- m_pNodeHelper->m_iCreateCount = iIndex - iFoundCount + 1;
+ if (pRnd->styles_ & XFA_ResolveFlag::kCreateNode) {
+ node_helper_->create_parent_ = ToNode(pRnd->cur_object_);
+ node_helper_->create_count_ = iIndex - iFoundCount + 1;
}
- pRnd->m_Result.objects.clear();
+ pRnd->result_.objects.clear();
} else {
- pRnd->m_Result.objects = std::vector<cppgc::Member<CXFA_Object>>(
- 1, pRnd->m_Result.objects[iIndex]);
+ pRnd->result_.objects = std::vector<cppgc::Member<CXFA_Object>>(
+ 1, pRnd->result_.objects[iIndex]);
}
}
@@ -679,7 +679,7 @@
WideString wsCondition,
NodeData* pRnd) {
size_t iCurIndex = 0;
- CXFA_Node* pNode = m_pEngine->LastObjectFromUpArray();
+ CXFA_Node* pNode = engine_->LastObjectFromUpArray();
if (pNode) {
const bool bIsProperty = pNode->IsProperty();
const bool bIsClassIndex =
@@ -688,12 +688,12 @@
iCurIndex = pNode->GetIndex(bIsProperty, bIsClassIndex);
}
- size_t iFoundCount = pRnd->m_Result.objects.size();
+ size_t iFoundCount = pRnd->result_.objects.size();
wsCondition.TrimWhitespace();
const size_t nLen = wsCondition.GetLength();
if (nLen == 0) {
- if (pRnd->m_dwStyles & XFA_ResolveFlag::kALL) {
+ if (pRnd->styles_ & XFA_ResolveFlag::kALL) {
return;
}
if (iFoundCount == 1) {
@@ -701,16 +701,16 @@
}
if (iFoundCount <= iCurIndex) {
- if (pRnd->m_dwStyles & XFA_ResolveFlag::kCreateNode) {
- m_pNodeHelper->m_pCreateParent = ToNode(pRnd->m_CurObject);
- m_pNodeHelper->m_iCreateCount = iCurIndex - iFoundCount + 1;
+ if (pRnd->styles_ & XFA_ResolveFlag::kCreateNode) {
+ node_helper_->create_parent_ = ToNode(pRnd->cur_object_);
+ node_helper_->create_count_ = iCurIndex - iFoundCount + 1;
}
- pRnd->m_Result.objects.clear();
+ pRnd->result_.objects.clear();
return;
}
- pRnd->m_Result.objects = std::vector<cppgc::Member<CXFA_Object>>(
- 1, pRnd->m_Result.objects[iCurIndex]);
+ pRnd->result_.objects = std::vector<cppgc::Member<CXFA_Object>>(
+ 1, pRnd->result_.objects[iCurIndex]);
return;
}
@@ -739,14 +739,14 @@
if (dwParentStyles & XFA_ResolveFlag::kTagName) {
dwSubStyles |= XFA_ResolveFlag::kTagName;
}
- rnd.m_dwStyles = dwSubStyles;
+ rnd.styles_ = dwSubStyles;
}
int32_t CFXJSE_ResolveProcessor::IndexForDataBind(
const WideString& wsNextCondition,
int32_t iCount) {
- if (m_pNodeHelper->CreateNodeForCondition(wsNextCondition) &&
- m_pNodeHelper->m_eLastCreateType == XFA_Element::DataGroup) {
+ if (node_helper_->CreateNodeForCondition(wsNextCondition) &&
+ node_helper_->last_create_type_ == XFA_Element::DataGroup) {
return 0;
}
return iCount - 1;
@@ -756,7 +756,7 @@
WideString wsCondition,
size_t iFoundCount,
NodeData* pRnd) {
- DCHECK_EQ(iFoundCount, pRnd->m_Result.objects.size());
+ DCHECK_EQ(iFoundCount, pRnd->result_.objects.size());
CXFA_Script::Type eLangType = CXFA_Script::Type::Unknown;
if (wsCondition.First(2).EqualsASCII(".[") && wsCondition.Back() == L']') {
eLangType = CXFA_Script::Type::Formcalc;
@@ -770,10 +770,10 @@
WideString wsExpression = wsCondition.Substr(2, wsCondition.GetLength() - 3);
for (size_t i = iFoundCount; i > 0; --i) {
CFXJSE_Context::ExecutionResult exec_result =
- m_pEngine->RunScript(eLangType, wsExpression.AsStringView(),
- pRnd->m_Result.objects[i - 1].Get());
+ engine_->RunScript(eLangType, wsExpression.AsStringView(),
+ pRnd->result_.objects[i - 1].Get());
if (!exec_result.status || !exec_result.value->ToBoolean(pIsolate)) {
- pRnd->m_Result.objects.erase(pRnd->m_Result.objects.begin() + i - 1);
+ pRnd->result_.objects.erase(pRnd->result_.objects.begin() + i - 1);
}
}
}
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.h b/fxjs/xfa/cfxjse_resolveprocessor.h
index f7125c9..0b33221 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.h
+++ b/fxjs/xfa/cfxjse_resolveprocessor.h
@@ -27,13 +27,13 @@
NodeData();
~NodeData();
- UnownedPtr<CXFA_Object> m_CurObject; // Ok, stack-only.
- WideString m_wsName;
- WideString m_wsCondition;
- XFA_HashCode m_uHashName = XFA_HASHCODE_None;
- int32_t m_nLevel = 0;
- Mask<XFA_ResolveFlag> m_dwStyles = XFA_ResolveFlag::kChildren;
- CFXJSE_Engine::ResolveResult m_Result;
+ UnownedPtr<CXFA_Object> cur_object_; // Ok, stack-only.
+ WideString name_;
+ WideString condition_;
+ XFA_HashCode hash_name_ = XFA_HASHCODE_None;
+ int32_t level_ = 0;
+ Mask<XFA_ResolveFlag> styles_ = XFA_ResolveFlag::kChildren;
+ CFXJSE_Engine::ResolveResult result_;
};
CFXJSE_ResolveProcessor(CFXJSE_Engine* pEngine, CFXJSE_NodeHelper* pHelper);
@@ -42,7 +42,7 @@
bool Resolve(v8::Isolate* pIsolate, NodeData& rnd);
int32_t GetFilter(WideStringView wsExpression, int32_t nStart, NodeData& rnd);
int32_t IndexForDataBind(const WideString& wsNextCondition, int32_t iCount);
- void SetCurStart(int32_t start) { m_iCurStart = start; }
+ void SetCurStart(int32_t start) { cur_start_ = start; }
private:
bool ResolveForAttributeRs(CXFA_Object* curNode,
@@ -68,9 +68,9 @@
size_t iFoundCount,
NodeData* pRnd);
- int32_t m_iCurStart = 0;
- UnownedPtr<CFXJSE_Engine> const m_pEngine;
- UnownedPtr<CFXJSE_NodeHelper> const m_pNodeHelper;
+ int32_t cur_start_ = 0;
+ UnownedPtr<CFXJSE_Engine> const engine_;
+ UnownedPtr<CFXJSE_NodeHelper> const node_helper_;
};
#endif // FXJS_XFA_CFXJSE_RESOLVEPROCESSOR_H_
diff --git a/fxjs/xfa/cfxjse_value.cpp b/fxjs/xfa/cfxjse_value.cpp
index fe3bc74..cd6d610 100644
--- a/fxjs/xfa/cfxjse_value.cpp
+++ b/fxjs/xfa/cfxjse_value.cpp
@@ -84,16 +84,15 @@
CFXJSE_HostObject* CFXJSE_Value::ToHostObject(v8::Isolate* pIsolate) const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- return CFXJSE_HostObject::FromV8(
- v8::Local<v8::Value>::New(pIsolate, m_hValue));
+ return CFXJSE_HostObject::FromV8(v8::Local<v8::Value>::New(pIsolate, value_));
}
void CFXJSE_Value::SetHostObject(v8::Isolate* pIsolate,
CFXJSE_HostObject* pObject,
CFXJSE_Class* pClass) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- m_hValue.Reset(pIsolate, pObject->NewBoundV8Object(
- pIsolate, pClass->GetTemplate(pIsolate)));
+ value_.Reset(pIsolate, pObject->NewBoundV8Object(
+ pIsolate, pClass->GetTemplate(pIsolate)));
}
void CFXJSE_Value::SetArray(
@@ -111,12 +110,12 @@
}
v8::Local<v8::Array> hArrayObject =
v8::Array::New(pIsolate, local_values.data(), local_values.size());
- m_hValue.Reset(pIsolate, hArrayObject);
+ value_.Reset(pIsolate, hArrayObject);
}
void CFXJSE_Value::SetFloat(v8::Isolate* pIsolate, float fFloat) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, ftod(fFloat)));
+ value_.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, ftod(fFloat)));
}
bool CFXJSE_Value::SetObjectProperty(v8::Isolate* pIsolate,
@@ -170,7 +169,7 @@
void CFXJSE_Value::DeleteObjectProperty(v8::Isolate* pIsolate,
ByteStringView szPropName) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(pIsolate, value_);
if (hObject->IsObject()) {
fxv8::ReentrantDeleteObjectPropertyHelper(
pIsolate, hObject.As<v8::Object>(), szPropName);
@@ -181,13 +180,13 @@
ByteStringView szPropName,
CFXJSE_Value* pPropValue) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(pIsolate, value_);
if (!hObject->IsObject()) {
return false;
}
v8::Local<v8::Value> pValue =
- v8::Local<v8::Value>::New(pIsolate, pPropValue->m_hValue);
+ v8::Local<v8::Value>::New(pIsolate, pPropValue->value_);
return fxv8::ReentrantSetObjectOwnPropertyHelper(
pIsolate, hObject.As<v8::Object>(), szPropName, pValue);
}
@@ -223,11 +222,11 @@
}
v8::Local<v8::Value> CFXJSE_Value::GetValue(v8::Isolate* pIsolate) const {
- return v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ return v8::Local<v8::Value>::New(pIsolate, value_);
}
bool CFXJSE_Value::IsEmpty() const {
- return m_hValue.IsEmpty();
+ return value_.IsEmpty();
}
bool CFXJSE_Value::IsUndefined(v8::Isolate* pIsolate) const {
@@ -236,7 +235,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsUndefined();
}
@@ -246,7 +245,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsNull();
}
@@ -256,7 +255,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsBoolean();
}
@@ -266,7 +265,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsString();
}
@@ -276,7 +275,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsNumber();
}
@@ -286,7 +285,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsInt32();
}
@@ -296,7 +295,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsObject();
}
@@ -306,7 +305,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsArray();
}
@@ -316,7 +315,7 @@
}
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, m_hValue);
+ v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(pIsolate, value_);
return hValue->IsFunction();
}
@@ -324,7 +323,7 @@
DCHECK(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
return fxv8::ReentrantToBooleanHelper(
- pIsolate, v8::Local<v8::Value>::New(pIsolate, m_hValue));
+ pIsolate, v8::Local<v8::Value>::New(pIsolate, value_));
}
float CFXJSE_Value::ToFloat(v8::Isolate* pIsolate) const {
@@ -335,49 +334,49 @@
DCHECK(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
return fxv8::ReentrantToDoubleHelper(
- pIsolate, v8::Local<v8::Value>::New(pIsolate, m_hValue));
+ pIsolate, v8::Local<v8::Value>::New(pIsolate, value_));
}
int32_t CFXJSE_Value::ToInteger(v8::Isolate* pIsolate) const {
DCHECK(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
return fxv8::ReentrantToInt32Helper(
- pIsolate, v8::Local<v8::Value>::New(pIsolate, m_hValue));
+ pIsolate, v8::Local<v8::Value>::New(pIsolate, value_));
}
ByteString CFXJSE_Value::ToString(v8::Isolate* pIsolate) const {
DCHECK(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
return fxv8::ReentrantToByteStringHelper(
- pIsolate, v8::Local<v8::Value>::New(pIsolate, m_hValue));
+ pIsolate, v8::Local<v8::Value>::New(pIsolate, value_));
}
void CFXJSE_Value::SetUndefined(v8::Isolate* pIsolate) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewUndefinedHelper(pIsolate));
+ value_.Reset(pIsolate, fxv8::NewUndefinedHelper(pIsolate));
}
void CFXJSE_Value::SetNull(v8::Isolate* pIsolate) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewNullHelper(pIsolate));
+ value_.Reset(pIsolate, fxv8::NewNullHelper(pIsolate));
}
void CFXJSE_Value::SetBoolean(v8::Isolate* pIsolate, bool bBoolean) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewBooleanHelper(pIsolate, bBoolean));
+ value_.Reset(pIsolate, fxv8::NewBooleanHelper(pIsolate, bBoolean));
}
void CFXJSE_Value::SetInteger(v8::Isolate* pIsolate, int32_t nInteger) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, nInteger));
+ value_.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, nInteger));
}
void CFXJSE_Value::SetDouble(v8::Isolate* pIsolate, double dDouble) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, dDouble));
+ value_.Reset(pIsolate, fxv8::NewNumberHelper(pIsolate, dDouble));
}
void CFXJSE_Value::SetString(v8::Isolate* pIsolate, ByteStringView szString) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- m_hValue.Reset(pIsolate, fxv8::NewStringHelper(pIsolate, szString));
+ value_.Reset(pIsolate, fxv8::NewStringHelper(pIsolate, szString));
}
diff --git a/fxjs/xfa/cfxjse_value.h b/fxjs/xfa/cfxjse_value.h
index 14b96d6..174bfcf 100644
--- a/fxjs/xfa/cfxjse_value.h
+++ b/fxjs/xfa/cfxjse_value.h
@@ -83,16 +83,16 @@
v8::Local<v8::Object> lpNewThis);
v8::Local<v8::Value> GetValue(v8::Isolate* pIsolate) const;
- const v8::Global<v8::Value>& DirectGetValue() const { return m_hValue; }
+ const v8::Global<v8::Value>& DirectGetValue() const { return value_; }
void ForceSetValue(v8::Isolate* pIsolate, v8::Local<v8::Value> hValue) {
- m_hValue.Reset(pIsolate, hValue);
+ value_.Reset(pIsolate, hValue);
}
private:
CFXJSE_Value(const CFXJSE_Value&) = delete;
CFXJSE_Value& operator=(const CFXJSE_Value&) = delete;
- v8::Global<v8::Value> m_hValue;
+ v8::Global<v8::Value> value_;
};
#endif // FXJS_XFA_CFXJSE_VALUE_H_
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index b7113cc..5f23067 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -44,9 +44,9 @@
};
struct ExecEventParaInfo {
- uint32_t m_uHash; // hashed as wide string.
- XFA_EVENTTYPE m_eventType;
- EventAppliesTo m_validFlags;
+ uint32_t hash_; // hashed as wide string.
+ XFA_EVENTTYPE event_type_;
+ EventAppliesTo valid_flags_;
};
#undef PARA
@@ -82,9 +82,9 @@
auto* result = std::lower_bound(
std::begin(kExecEventParaInfoTable), std::end(kExecEventParaInfoTable),
uHash, [](const ExecEventParaInfo& iter, const uint16_t& hash) {
- return iter.m_uHash < hash;
+ return iter.hash_ < hash;
});
- if (result != std::end(kExecEventParaInfoTable) && result->m_uHash == uHash) {
+ if (result != std::end(kExecEventParaInfoTable) && result->hash_ == uHash) {
return result;
}
return nullptr;
@@ -500,21 +500,21 @@
return XFA_EventError::kNotExist;
}
- switch (eventParaInfo->m_validFlags) {
+ switch (eventParaInfo->valid_flags_) {
case EventAppliesTo::kNone:
return XFA_EventError::kNotExist;
case EventAppliesTo::kAll:
case EventAppliesTo::kAllNonRecursive:
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false,
- eventParaInfo->m_validFlags == EventAppliesTo::kAll);
+ GetXFANode(), eventParaInfo->event_type_, false,
+ eventParaInfo->valid_flags_ == EventAppliesTo::kAll);
case EventAppliesTo::kSubform:
if (eType != XFA_Element::Subform) {
return XFA_EventError::kNotExist;
}
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false, false);
+ GetXFANode(), eventParaInfo->event_type_, false, false);
case EventAppliesTo::kFieldOrExclusion: {
if (eType != XFA_Element::ExclGroup && eType != XFA_Element::Field) {
return XFA_EventError::kNotExist;
@@ -524,11 +524,11 @@
if (pParentNode &&
pParentNode->GetElementType() == XFA_Element::ExclGroup) {
// TODO(dsinclair): This seems like a bug, we do the same work twice?
- pNotify->ExecEventByDeepFirst(GetXFANode(), eventParaInfo->m_eventType,
+ pNotify->ExecEventByDeepFirst(GetXFANode(), eventParaInfo->event_type_,
false, false);
}
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false, false);
+ GetXFANode(), eventParaInfo->event_type_, false, false);
}
case EventAppliesTo::kField:
if (eType != XFA_Element::Field) {
@@ -536,7 +536,7 @@
}
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false, false);
+ GetXFANode(), eventParaInfo->event_type_, false, false);
case EventAppliesTo::kSignature: {
if (!GetXFANode()->IsWidgetReady()) {
return XFA_EventError::kNotExist;
@@ -546,7 +546,7 @@
return XFA_EventError::kNotExist;
}
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false, false);
+ GetXFANode(), eventParaInfo->event_type_, false, false);
}
case EventAppliesTo::kChoiceList: {
if (!GetXFANode()->IsWidgetReady()) {
@@ -557,7 +557,7 @@
return XFA_EventError::kNotExist;
}
return pNotify->ExecEventByDeepFirst(
- GetXFANode(), eventParaInfo->m_eventType, false, false);
+ GetXFANode(), eventParaInfo->event_type_, false, false);
}
}
return XFA_EventError::kNotExist;
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index eaf3a7a..c88e3c7 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -1503,5 +1503,5 @@
CJX_Object::CalcData::~CalcData() = default;
void CJX_Object::CalcData::Trace(cppgc::Visitor* visitor) const {
- ContainerTrace(visitor, m_Globals);
+ ContainerTrace(visitor, globals_);
}
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index efd7ed5..624d347 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -91,7 +91,7 @@
void Trace(cppgc::Visitor* visitor) const;
- std::vector<cppgc::Member<CXFA_Node>> m_Globals;
+ std::vector<cppgc::Member<CXFA_Node>> globals_;
private:
CalcData();
diff --git a/testing/external_engine_embedder_test.cpp b/testing/external_engine_embedder_test.cpp
index 759361c..34d1eb8 100644
--- a/testing/external_engine_embedder_test.cpp
+++ b/testing/external_engine_embedder_test.cpp
@@ -22,16 +22,16 @@
v8::Isolate::Scope isolate_scope(isolate());
v8::HandleScope handle_scope(isolate());
CFXJS_PerIsolateData::SetUp(isolate());
- m_Engine = std::make_unique<CFXJS_Engine>(isolate());
- m_Engine->InitializeEngine();
+ engine_ = std::make_unique<CFXJS_Engine>(isolate());
+ engine_->InitializeEngine();
}
void ExternalEngineEmbedderTest::TearDown() {
- m_Engine->ReleaseEngine();
- m_Engine.reset();
+ engine_->ReleaseEngine();
+ engine_.reset();
JSEmbedderTest::TearDown();
}
v8::Local<v8::Context> ExternalEngineEmbedderTest::GetV8Context() {
- return m_Engine->GetV8Context();
+ return engine_->GetV8Context();
}
diff --git a/testing/external_engine_embedder_test.h b/testing/external_engine_embedder_test.h
index 258e124..d346048 100644
--- a/testing/external_engine_embedder_test.h
+++ b/testing/external_engine_embedder_test.h
@@ -25,11 +25,11 @@
void SetUp() override;
void TearDown() override;
- CFXJS_Engine* engine() const { return m_Engine.get(); }
+ CFXJS_Engine* engine() const { return engine_.get(); }
v8::Local<v8::Context> GetV8Context();
private:
- std::unique_ptr<CFXJS_Engine> m_Engine;
+ std::unique_ptr<CFXJS_Engine> engine_;
};
#endif // TESTING_EXTERNAL_ENGINE_EMBEDDER_TEST_H_
diff --git a/testing/fuzzers/pdfium_fuzzer_helper.cc b/testing/fuzzers/pdfium_fuzzer_helper.cc
index 52aa34b..efbd59a 100644
--- a/testing/fuzzers/pdfium_fuzzer_helper.cc
+++ b/testing/fuzzers/pdfium_fuzzer_helper.cc
@@ -30,7 +30,7 @@
class FuzzerTestLoader {
public:
- explicit FuzzerTestLoader(pdfium::span<const char> span) : m_Span(span) {}
+ explicit FuzzerTestLoader(pdfium::span<const char> span) : span_(span) {}
static int GetBlock(void* param,
unsigned long pos,
@@ -39,14 +39,14 @@
FuzzerTestLoader* pLoader = static_cast<FuzzerTestLoader*>(param);
pdfium::CheckedNumeric<size_t> end = pos;
end += size;
- CHECK_LE(end.ValueOrDie(), pLoader->m_Span.size());
+ CHECK_LE(end.ValueOrDie(), pLoader->span_.size());
- FXSYS_memcpy(pBuf, &pLoader->m_Span[pos], size);
+ FXSYS_memcpy(pBuf, &pLoader->span_[pos], size);
return 1;
}
private:
- const pdfium::span<const char> m_Span;
+ const pdfium::span<const char> span_;
};
int ExampleAppAlert(IPDF_JSPLATFORM*,
diff --git a/testing/test_loader.cpp b/testing/test_loader.cpp
index 71fa274..75ac467 100644
--- a/testing/test_loader.cpp
+++ b/testing/test_loader.cpp
@@ -10,7 +10,7 @@
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/numerics/checked_math.h"
-TestLoader::TestLoader(pdfium::span<const uint8_t> span) : m_Span(span) {}
+TestLoader::TestLoader(pdfium::span<const uint8_t> span) : span_(span) {}
// static
int TestLoader::GetBlock(void* param,
@@ -20,8 +20,8 @@
TestLoader* pLoader = static_cast<TestLoader*>(param);
pdfium::CheckedNumeric<size_t> end = pos;
end += size;
- CHECK_LE(end.ValueOrDie(), pLoader->m_Span.size());
+ CHECK_LE(end.ValueOrDie(), pLoader->span_.size());
- FXSYS_memcpy(pBuf, &pLoader->m_Span[pos], size);
+ FXSYS_memcpy(pBuf, &pLoader->span_[pos], size);
return 1;
}
diff --git a/testing/test_loader.h b/testing/test_loader.h
index ee0c821..a601e4a 100644
--- a/testing/test_loader.h
+++ b/testing/test_loader.h
@@ -20,7 +20,7 @@
unsigned long size);
private:
- const pdfium::raw_span<const uint8_t> m_Span;
+ const pdfium::raw_span<const uint8_t> span_;
};
#endif // TESTING_TEST_LOADER_H_
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 3e8ac2d..a63993c 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -604,7 +604,7 @@
return;
}
- for (auto& pResult : pGlobalData->m_Globals) {
+ for (auto& pResult : pGlobalData->globals_) {
if (!pResult->HasRemovedChildren() && pResult->IsWidgetReady()) {
AddCalculateNode(pResult);
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index c16f636..c16cb9f 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3000,8 +3000,8 @@
CJX_Object::CalcData* pGlobalData =
pRefNode->JSObject()->GetOrCreateCalcData(pDoc->GetHeap());
- if (!pdfium::Contains(pGlobalData->m_Globals, this)) {
- pGlobalData->m_Globals.push_back(this);
+ if (!pdfium::Contains(pGlobalData->globals_, this)) {
+ pGlobalData->globals_.push_back(this);
}
}
}