Convert to google_style_ members in xfa/
-- Includes sub-directories.
-- Manual changes required at boundaries between old and new code.
Bug: 42271580
Change-Id: I1bc9e871414b4b7bfbf0335a4d5cbd6275e0591d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130330
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index b432763..08c6b8e 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -225,15 +225,15 @@
return false;
CXFA_EventParam param(eEventType);
- param.m_wsChange = data->sChange;
- param.m_iCommitKey = 0;
- param.m_bShift = data->bShift;
- param.m_iSelStart = data->nSelStart;
- param.m_iSelEnd = data->nSelEnd;
- param.m_wsFullText = data->sValue;
- param.m_bKeyDown = data->bKeyDown;
- param.m_bModifier = data->bModifier;
- param.m_wsPrevText = data->sValue;
+ param.change_ = data->sChange;
+ param.commit_key_ = 0;
+ param.shift_ = data->bShift;
+ param.sel_start_ = data->nSelStart;
+ param.sel_end_ = data->nSelEnd;
+ param.full_text_ = data->sValue;
+ param.key_down_ = data->bKeyDown;
+ param.modifier_ = data->bModifier;
+ param.prev_text_ = data->sValue;
if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
GetFieldType() == FormFieldType::kRadioButton) {
CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget();
@@ -320,15 +320,15 @@
return false;
CXFA_EventParam param(eEventType);
- param.m_wsChange = data->sChange;
- param.m_iCommitKey = 0;
- param.m_bShift = data->bShift;
- param.m_iSelStart = data->nSelStart;
- param.m_iSelEnd = data->nSelEnd;
- param.m_wsFullText = data->sValue;
- param.m_bKeyDown = data->bKeyDown;
- param.m_bModifier = data->bModifier;
- param.m_wsPrevText = data->sValue;
+ param.change_ = data->sChange;
+ param.commit_key_ = 0;
+ param.shift_ = data->bShift;
+ param.sel_start_ = data->nSelStart;
+ param.sel_end_ = data->nSelEnd;
+ param.full_text_ = data->sValue;
+ param.key_down_ = data->bKeyDown;
+ param.modifier_ = data->bModifier;
+ param.prev_text_ = data->sValue;
bool ret = hWidget->ProcessEventUnderHandler(¶m, pXFAWidgetHandler);
CXFA_FFDocView* pDocView = pContext->GetXFADocView();
if (pDocView)
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 31655ee..8d526e8 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -445,7 +445,7 @@
CXFA_ReadyNodeIterator it(pXFADocView->GetRootSubform());
while (CXFA_Node* pNode = it.MoveToNext()) {
CXFA_EventParam preParam(XFA_EVENT_PostSave);
- preParam.m_bTargeted = false;
+ preParam.targeted_ = false;
pWidgetHandler->ProcessEvent(pNode, &preParam);
}
pXFADocView->UpdateDocView();
@@ -465,7 +465,7 @@
CXFA_ReadyNodeIterator it(pXFADocView->GetRootSubform());
while (CXFA_Node* pNode = it.MoveToNext()) {
CXFA_EventParam preParam(XFA_EVENT_PreSave);
- preParam.m_bTargeted = false;
+ preParam.targeted_ = false;
pWidgetHandler->ProcessEvent(pNode, &preParam);
}
pXFADocView->UpdateDocView();
diff --git a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
index a04d79c..6c9c3e2 100644
--- a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
@@ -1035,7 +1035,7 @@
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_wsChange = L"changed";
+ params.change_ = L"changed";
CFXJSE_Engine* context = GetScriptContext();
CFXJSE_Engine::EventParamScope event_scope(context, nullptr, ¶ms);
@@ -1053,125 +1053,125 @@
const char test[] = {"xfa.event.change = \"changed\""};
EXPECT_TRUE(Execute(test));
- EXPECT_EQ(L"changed", params.m_wsChange);
+ EXPECT_EQ(L"changed", params.change_);
}
TEST_F(CFXJSEFormCalcContextEmbedderTest, SetXFAEventFullTextFails) {
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_wsFullText = L"Original Full Text";
+ params.full_text_ = L"Original Full Text";
CFXJSE_Engine* context = GetScriptContext();
CFXJSE_Engine::EventParamScope event_scope(context, nullptr, ¶ms);
const char test[] = {"xfa.event.fullText = \"Changed Full Text\""};
EXPECT_TRUE(Execute(test));
- EXPECT_EQ(L"Original Full Text", params.m_wsFullText);
+ EXPECT_EQ(L"Original Full Text", params.full_text_);
}
TEST_F(CFXJSEFormCalcContextEmbedderTest, EventChangeSelection) {
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_wsPrevText = L"1234";
- params.m_iSelStart = 1;
- params.m_iSelEnd = 3;
+ params.prev_text_ = L"1234";
+ params.sel_start_ = 1;
+ params.sel_end_ = 3;
CFXJSE_Engine* context = GetScriptContext();
CFXJSE_Engine::EventParamScope event_scope(context, nullptr, ¶ms);
// Moving end to start works fine.
EXPECT_TRUE(Execute("xfa.event.selEnd = \"1\""));
- EXPECT_EQ(1, params.m_iSelStart);
- EXPECT_EQ(1, params.m_iSelEnd);
+ EXPECT_EQ(1, params.sel_start_);
+ EXPECT_EQ(1, params.sel_end_);
// Moving end before end, forces start to move in response.
EXPECT_TRUE(Execute("xfa.event.selEnd = \"0\""));
- EXPECT_EQ(0, params.m_iSelStart);
- EXPECT_EQ(0, params.m_iSelEnd);
+ EXPECT_EQ(0, params.sel_start_);
+ EXPECT_EQ(0, params.sel_end_);
// Negatives not allowed
EXPECT_TRUE(Execute("xfa.event.selEnd = \"-1\""));
- EXPECT_EQ(0, params.m_iSelStart);
- EXPECT_EQ(0, params.m_iSelEnd);
+ EXPECT_EQ(0, params.sel_start_);
+ EXPECT_EQ(0, params.sel_end_);
// Negatives not allowed
EXPECT_TRUE(Execute("xfa.event.selStart = \"-1\""));
- EXPECT_EQ(0, params.m_iSelStart);
- EXPECT_EQ(0, params.m_iSelEnd);
+ EXPECT_EQ(0, params.sel_start_);
+ EXPECT_EQ(0, params.sel_end_);
- params.m_iSelEnd = 1;
+ params.sel_end_ = 1;
// Moving start to end works fine.
EXPECT_TRUE(Execute("xfa.event.selStart = \"1\""));
- EXPECT_EQ(1, params.m_iSelStart);
- EXPECT_EQ(1, params.m_iSelEnd);
+ EXPECT_EQ(1, params.sel_start_);
+ EXPECT_EQ(1, params.sel_end_);
// Moving start after end moves end.
EXPECT_TRUE(Execute("xfa.event.selStart = \"2\""));
- EXPECT_EQ(2, params.m_iSelStart);
- EXPECT_EQ(2, params.m_iSelEnd);
+ EXPECT_EQ(2, params.sel_start_);
+ EXPECT_EQ(2, params.sel_end_);
// Setting End past end of string clamps to string length;
EXPECT_TRUE(Execute("xfa.event.selEnd = \"20\""));
- EXPECT_EQ(2, params.m_iSelStart);
- EXPECT_EQ(4, params.m_iSelEnd);
+ EXPECT_EQ(2, params.sel_start_);
+ EXPECT_EQ(4, params.sel_end_);
// Setting Start past end of string clamps to string length;
EXPECT_TRUE(Execute("xfa.event.selStart = \"20\""));
- EXPECT_EQ(4, params.m_iSelStart);
- EXPECT_EQ(4, params.m_iSelEnd);
+ EXPECT_EQ(4, params.sel_start_);
+ EXPECT_EQ(4, params.sel_end_);
}
TEST_F(CFXJSEFormCalcContextEmbedderTest, XFAEventCancelAction) {
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_bCancelAction = false;
+ params.cancel_action_ = false;
CFXJSE_Engine* context = GetScriptContext();
CFXJSE_Engine::EventParamScope event_scope(context, nullptr, ¶ms);
ExecuteExpectBool("xfa.event.cancelAction", false);
EXPECT_TRUE(Execute("xfa.event.cancelAction = \"true\""));
- EXPECT_TRUE(params.m_bCancelAction);
+ EXPECT_TRUE(params.cancel_action_);
}
TEST_F(CFXJSEFormCalcContextEmbedderTest, ComplexTextChangeEvent) {
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_wsChange = L"g";
- params.m_wsPrevText = L"abcd";
- params.m_iSelStart = 1;
- params.m_iSelEnd = 3;
+ params.change_ = L"g";
+ params.prev_text_ = L"abcd";
+ params.sel_start_ = 1;
+ params.sel_end_ = 3;
CFXJSE_Engine* context = GetScriptContext();
CFXJSE_Engine::EventParamScope event_scope(context, nullptr, ¶ms);
- EXPECT_EQ(L"abcd", params.m_wsPrevText);
+ EXPECT_EQ(L"abcd", params.prev_text_);
EXPECT_EQ(L"agd", params.GetNewText());
- EXPECT_EQ(L"g", params.m_wsChange);
- EXPECT_EQ(1, params.m_iSelStart);
- EXPECT_EQ(3, params.m_iSelEnd);
+ EXPECT_EQ(L"g", params.change_);
+ EXPECT_EQ(1, params.sel_start_);
+ EXPECT_EQ(3, params.sel_end_);
const char change_event[] = {"xfa.event.change = \"xyz\""};
EXPECT_TRUE(Execute(change_event));
- EXPECT_EQ(L"abcd", params.m_wsPrevText);
- EXPECT_EQ(L"xyz", params.m_wsChange);
+ EXPECT_EQ(L"abcd", params.prev_text_);
+ EXPECT_EQ(L"xyz", params.change_);
EXPECT_EQ(L"axyzd", params.GetNewText());
- EXPECT_EQ(1, params.m_iSelStart);
- EXPECT_EQ(3, params.m_iSelEnd);
+ EXPECT_EQ(1, params.sel_start_);
+ EXPECT_EQ(3, params.sel_end_);
const char sel_event[] = {"xfa.event.selEnd = \"1\""};
EXPECT_TRUE(Execute(sel_event));
- EXPECT_EQ(L"abcd", params.m_wsPrevText);
- EXPECT_EQ(L"xyz", params.m_wsChange);
+ EXPECT_EQ(L"abcd", params.prev_text_);
+ EXPECT_EQ(L"xyz", params.change_);
EXPECT_EQ(L"axyzbcd", params.GetNewText());
- EXPECT_EQ(1, params.m_iSelStart);
- EXPECT_EQ(1, params.m_iSelEnd);
+ EXPECT_EQ(1, params.sel_start_);
+ EXPECT_EQ(1, params.sel_end_);
}
// Should not crash.
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index 8ba9737..56ac33a 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -241,68 +241,67 @@
switch (dwFlag) {
case XFA_Event::CancelAction:
- BooleanProperty(pIsolate, pValue, &pEventParam->m_bCancelAction,
- bSetting);
+ BooleanProperty(pIsolate, pValue, &pEventParam->cancel_action_, bSetting);
break;
case XFA_Event::Change:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsChange, bSetting);
+ StringProperty(pIsolate, pValue, &pEventParam->change_, bSetting);
break;
case XFA_Event::CommitKey:
- IntegerProperty(pIsolate, pValue, &pEventParam->m_iCommitKey, bSetting);
+ IntegerProperty(pIsolate, pValue, &pEventParam->commit_key_, bSetting);
break;
case XFA_Event::FullText:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsFullText, bSetting);
+ StringProperty(pIsolate, pValue, &pEventParam->full_text_, bSetting);
break;
case XFA_Event::Keydown:
- BooleanProperty(pIsolate, pValue, &pEventParam->m_bKeyDown, bSetting);
+ BooleanProperty(pIsolate, pValue, &pEventParam->key_down_, bSetting);
break;
case XFA_Event::Modifier:
- BooleanProperty(pIsolate, pValue, &pEventParam->m_bModifier, bSetting);
+ BooleanProperty(pIsolate, pValue, &pEventParam->modifier_, bSetting);
break;
case XFA_Event::NewContentType:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsNewContentType,
+ StringProperty(pIsolate, pValue, &pEventParam->new_content_type_,
bSetting);
break;
case XFA_Event::NewText:
NOTREACHED();
case XFA_Event::PreviousContentType:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsPrevContentType,
+ StringProperty(pIsolate, pValue, &pEventParam->prev_content_type_,
bSetting);
break;
case XFA_Event::PreviousText:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsPrevText, bSetting);
+ StringProperty(pIsolate, pValue, &pEventParam->prev_text_, bSetting);
break;
case XFA_Event::Reenter:
- BooleanProperty(pIsolate, pValue, &pEventParam->m_bReenter, bSetting);
+ BooleanProperty(pIsolate, pValue, &pEventParam->reenter_, bSetting);
break;
case XFA_Event::SelectionEnd:
- IntegerProperty(pIsolate, pValue, &pEventParam->m_iSelEnd, bSetting);
+ IntegerProperty(pIsolate, pValue, &pEventParam->sel_end_, bSetting);
- pEventParam->m_iSelEnd = std::max(0, pEventParam->m_iSelEnd);
- pEventParam->m_iSelEnd = std::min(
- pEventParam->m_iSelEnd,
- pdfium::checked_cast<int32_t>(pEventParam->m_wsPrevText.GetLength()));
- pEventParam->m_iSelStart =
- std::min(pEventParam->m_iSelStart, pEventParam->m_iSelEnd);
+ pEventParam->sel_end_ = std::max(0, pEventParam->sel_end_);
+ pEventParam->sel_end_ = std::min(
+ pEventParam->sel_end_,
+ pdfium::checked_cast<int32_t>(pEventParam->prev_text_.GetLength()));
+ pEventParam->sel_start_ =
+ std::min(pEventParam->sel_start_, pEventParam->sel_end_);
break;
case XFA_Event::SelectionStart:
- IntegerProperty(pIsolate, pValue, &pEventParam->m_iSelStart, bSetting);
- pEventParam->m_iSelStart = std::max(0, pEventParam->m_iSelStart);
- pEventParam->m_iSelStart = std::min(
- pEventParam->m_iSelStart,
- pdfium::checked_cast<int32_t>(pEventParam->m_wsPrevText.GetLength()));
- pEventParam->m_iSelEnd =
- std::max(pEventParam->m_iSelStart, pEventParam->m_iSelEnd);
+ IntegerProperty(pIsolate, pValue, &pEventParam->sel_start_, bSetting);
+ pEventParam->sel_start_ = std::max(0, pEventParam->sel_start_);
+ pEventParam->sel_start_ = std::min(
+ pEventParam->sel_start_,
+ pdfium::checked_cast<int32_t>(pEventParam->prev_text_.GetLength()));
+ pEventParam->sel_end_ =
+ std::max(pEventParam->sel_start_, pEventParam->sel_end_);
break;
case XFA_Event::Shift:
- BooleanProperty(pIsolate, pValue, &pEventParam->m_bShift, bSetting);
+ BooleanProperty(pIsolate, pValue, &pEventParam->shift_, bSetting);
break;
case XFA_Event::SoapFaultCode:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsSoapFaultCode,
+ StringProperty(pIsolate, pValue, &pEventParam->soap_fault_code_,
bSetting);
break;
case XFA_Event::SoapFaultString:
- StringProperty(pIsolate, pValue, &pEventParam->m_wsSoapFaultString,
+ StringProperty(pIsolate, pValue, &pEventParam->soap_fault_string_,
bSetting);
break;
case XFA_Event::Target:
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index df85b94..3214ed5 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -79,8 +79,8 @@
CJS_Result CJX_Form::recalculate(CFXJSE_Engine* runtime,
pdfium::span<v8::Local<v8::Value>> params) {
CXFA_EventParam* pEventParam = runtime->GetEventParam();
- if (pEventParam && (pEventParam->m_eType == XFA_EVENT_Calculate ||
- pEventParam->m_eType == XFA_EVENT_InitCalculate)) {
+ if (pEventParam && (pEventParam->type_ == XFA_EVENT_Calculate ||
+ pEventParam->type_ == XFA_EVENT_InitCalculate)) {
return CJS_Result::Success();
}
if (params.size() != 1)
diff --git a/testing/fuzzers/pdf_bidi_fuzzer.cc b/testing/fuzzers/pdf_bidi_fuzzer.cc
index 7db15d7..6990324 100644
--- a/testing/fuzzers/pdf_bidi_fuzzer.cc
+++ b/testing/fuzzers/pdf_bidi_fuzzer.cc
@@ -36,7 +36,7 @@
rtf_break.AppendChar(ch);
std::vector<CFGAS_Char> chars =
- rtf_break.GetCurrentLineForTesting()->m_LineChars;
+ rtf_break.GetCurrentLineForTesting()->line_chars_;
CFGAS_Char::BidiLine(&chars, chars.size());
return 0;
}
diff --git a/testing/fuzzers/pdf_formcalc_context_fuzzer.cc b/testing/fuzzers/pdf_formcalc_context_fuzzer.cc
index d7b584d..0cb5df8 100644
--- a/testing/fuzzers/pdf_formcalc_context_fuzzer.cc
+++ b/testing/fuzzers/pdf_formcalc_context_fuzzer.cc
@@ -523,7 +523,7 @@
CFXJSE_Engine* script_context = xfa_document->GetScriptContext();
CXFA_EventParam params(XFA_EVENT_Unknown);
- params.m_bCancelAction = false;
+ params.cancel_action_ = false;
CFXJSE_Engine::EventParamScope param_scope(script_context, nullptr,
¶ms);
auto data_view = UNSAFE_TODO(ByteStringView(data_, size_));
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 400464a..3f352c3 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -1095,7 +1095,7 @@
current_piece_start += txtEdtPiece.nCount;
for (int32_t k = 0; k < txtEdtPiece.nCount; ++k)
- char_widths_.push_back(piece->GetChar(k)->m_iCharWidth);
+ char_widths_.push_back(piece->GetChar(k)->char_width_);
}
current_line_start += line_spacing_;
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 1a9bba0..28081f0 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -127,37 +127,35 @@
CFDE_TextOut::Piece::~Piece() = default;
-CFDE_TextOut::CFDE_TextOut()
- : m_pTxtBreak(std::make_unique<CFGAS_TxtBreak>()) {}
+CFDE_TextOut::CFDE_TextOut() : txt_break_(std::make_unique<CFGAS_TxtBreak>()) {}
CFDE_TextOut::~CFDE_TextOut() = default;
void CFDE_TextOut::SetFont(RetainPtr<CFGAS_GEFont> pFont) {
DCHECK(pFont);
- m_pFont = std::move(pFont);
- m_pTxtBreak->SetFont(m_pFont);
+ font_ = std::move(pFont);
+ txt_break_->SetFont(font_);
}
void CFDE_TextOut::SetFontSize(float fFontSize) {
DCHECK(fFontSize > 0);
- m_fFontSize = fFontSize;
- m_pTxtBreak->SetFontSize(fFontSize);
+ font_size_ = fFontSize;
+ txt_break_->SetFontSize(fFontSize);
}
void CFDE_TextOut::SetStyles(const FDE_TextStyle& dwStyles) {
- m_Styles = dwStyles;
- m_dwTxtBkStyles = m_Styles.single_line_
- ? CFGAS_Break::LayoutStyle::kSingleLine
- : CFGAS_Break::LayoutStyle::kNone;
+ styles_ = dwStyles;
+ txt_bk_styles_ = styles_.single_line_ ? CFGAS_Break::LayoutStyle::kSingleLine
+ : CFGAS_Break::LayoutStyle::kNone;
- m_pTxtBreak->SetLayoutStyles(m_dwTxtBkStyles);
+ txt_break_->SetLayoutStyles(txt_bk_styles_);
}
void CFDE_TextOut::SetAlignment(FDE_TextAlignment iAlignment) {
- m_iAlignment = iAlignment;
+ alignment_ = iAlignment;
int32_t txtBreakAlignment = 0;
- switch (m_iAlignment) {
+ switch (alignment_) {
case FDE_TextAlignment::kCenter:
txtBreakAlignment = CFX_TxtLineAlignment_Center;
break;
@@ -169,17 +167,17 @@
txtBreakAlignment = CFX_TxtLineAlignment_Left;
break;
}
- m_pTxtBreak->SetAlignment(txtBreakAlignment);
+ txt_break_->SetAlignment(txtBreakAlignment);
}
void CFDE_TextOut::SetLineSpace(float fLineSpace) {
DCHECK(fLineSpace > 1.0f);
- m_fLineSpace = fLineSpace;
+ line_space_ = fLineSpace;
}
void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) {
- m_fTolerance = fTolerance;
- m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
+ tolerance_ = fTolerance;
+ txt_break_->SetLineBreakTolerance(tolerance_);
}
void CFDE_TextOut::CalcLogicSize(WideStringView str, CFX_SizeF* pSize) {
@@ -195,17 +193,17 @@
return;
}
- DCHECK(m_pFont);
- DCHECK(m_fFontSize >= 1.0f);
+ DCHECK(font_);
+ DCHECK(font_size_ >= 1.0f);
- if (!m_Styles.single_line_) {
+ if (!styles_.single_line_) {
if (pRect->Width() < 1.0f)
- pRect->width = m_fFontSize * 1000.0f;
+ pRect->width = font_size_ * 1000.0f;
- m_pTxtBreak->SetLineWidth(pRect->Width());
+ txt_break_->SetLineWidth(pRect->Width());
}
- m_iTotalLines = 0;
+ total_lines_ = 0;
float fWidth = 0.0f;
float fHeight = 0.0f;
float fStartPos = pRect->right();
@@ -214,30 +212,32 @@
for (const wchar_t& wch : str) {
if (!break_char_is_set && (wch == L'\n' || wch == L'\r')) {
break_char_is_set = true;
- m_pTxtBreak->SetParagraphBreakChar(wch);
+ txt_break_->SetParagraphBreakChar(wch);
}
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ dwBreakStatus = txt_break_->AppendChar(wch);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
}
- dwBreakStatus = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
+ dwBreakStatus = txt_break_->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
- m_pTxtBreak->Reset();
+ txt_break_->Reset();
float fInc = pRect->Height() - fHeight;
- if (TextAlignmentVerticallyCentered(m_iAlignment))
+ if (TextAlignmentVerticallyCentered(alignment_)) {
fInc /= 2.0f;
- else if (IsTextAlignmentTop(m_iAlignment))
+ } else if (IsTextAlignmentTop(alignment_)) {
fInc = 0.0f;
+ }
pRect->left += fStartPos;
pRect->top += fInc;
pRect->width = std::min(fWidth, pRect->Width());
pRect->height = fHeight;
- if (m_Styles.last_line_height_)
- pRect->height -= m_fLineSpace - m_fFontSize;
+ if (styles_.last_line_height_) {
+ pRect->height -= line_space_ - font_size_;
+ }
}
bool CFDE_TextOut::RetrieveLineWidth(CFGAS_Char::BreakType dwBreakStatus,
@@ -247,66 +247,68 @@
if (CFX_BreakTypeNoneOrPiece(dwBreakStatus))
return false;
- float fLineStep = std::max(m_fLineSpace, m_fFontSize);
+ float fLineStep = std::max(line_space_, font_size_);
float fLineWidth = 0.0f;
- for (int32_t i = 0; i < m_pTxtBreak->CountBreakPieces(); i++) {
- const CFGAS_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
+ for (int32_t i = 0; i < txt_break_->CountBreakPieces(); i++) {
+ const CFGAS_BreakPiece* pPiece = txt_break_->GetBreakPieceUnstable(i);
fLineWidth += static_cast<float>(pPiece->GetWidth()) / 20000.0f;
*pStartPos = std::min(*pStartPos,
static_cast<float>(pPiece->GetStartPos()) / 20000.0f);
}
- m_pTxtBreak->ClearBreakPieces();
+ txt_break_->ClearBreakPieces();
if (dwBreakStatus == CFGAS_Char::BreakType::kParagraph)
- m_pTxtBreak->Reset();
- if (!m_Styles.line_wrap_ && dwBreakStatus == CFGAS_Char::BreakType::kLine) {
+ txt_break_->Reset();
+ if (!styles_.line_wrap_ && dwBreakStatus == CFGAS_Char::BreakType::kLine) {
*pWidth += fLineWidth;
} else {
*pWidth = std::max(*pWidth, fLineWidth);
*pHeight += fLineStep;
}
- ++m_iTotalLines;
+ ++total_lines_;
return true;
}
void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device,
const WideString& str,
const CFX_RectF& rect) {
- DCHECK(m_pFont);
- DCHECK(m_fFontSize >= 1.0f);
+ DCHECK(font_);
+ DCHECK(font_size_ >= 1.0f);
if (str.IsEmpty())
return;
- if (rect.width < m_fFontSize || rect.height < m_fFontSize)
+ if (rect.width < font_size_ || rect.height < font_size_) {
return;
+ }
float fLineWidth = rect.width;
- m_pTxtBreak->SetLineWidth(fLineWidth);
- m_ttoLines.clear();
- m_wsText.clear();
+ txt_break_->SetLineWidth(fLineWidth);
+ tto_lines_.clear();
+ text_.clear();
LoadText(str, rect);
Reload(rect);
DoAlignment(rect);
- if (!device || m_ttoLines.empty())
+ if (!device || tto_lines_.empty()) {
return;
+ }
- CFX_RectF rtClip = m_Matrix.TransformRect(CFX_RectF());
+ CFX_RectF rtClip = matrix_.TransformRect(CFX_RectF());
device->SaveState();
if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f)
device->SetClip_Rect(rtClip.GetOuterRect());
- for (auto& line : m_ttoLines) {
+ for (auto& line : tto_lines_) {
for (size_t i = 0; i < line.GetSize(); ++i) {
const Piece* pPiece = line.GetPieceAtIndex(i);
size_t szCount = GetDisplayPos(pPiece);
if (szCount == 0) {
continue;
}
- CFDE_TextOut::DrawString(device, m_TxtColor, m_pFont,
- make_span(m_CharPos).first(szCount), m_fFontSize,
- m_Matrix);
+ CFDE_TextOut::DrawString(device, txt_color_, font_,
+ make_span(char_pos_).first(szCount), font_size_,
+ matrix_);
}
}
device->RestoreState(false);
@@ -315,47 +317,48 @@
void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) {
DCHECK(!str.IsEmpty());
- m_wsText = str;
+ text_ = str;
- if (m_CharWidths.size() < str.GetLength())
- m_CharWidths.resize(str.GetLength(), 0);
+ if (char_widths_.size() < str.GetLength()) {
+ char_widths_.resize(str.GetLength(), 0);
+ }
- float fLineStep = std::max(m_fLineSpace, m_fFontSize);
+ float fLineStep = std::max(line_space_, font_size_);
float fLineStop = rect.bottom();
- m_fLinePos = rect.top;
+ line_pos_ = rect.top;
size_t start_char = 0;
int32_t iPieceWidths = 0;
CFGAS_Char::BreakType dwBreakStatus;
bool bRet = false;
for (const auto& wch : str) {
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ dwBreakStatus = txt_break_->AppendChar(wch);
if (CFX_BreakTypeNoneOrPiece(dwBreakStatus))
continue;
bool bEndofLine =
RetrievePieces(dwBreakStatus, false, rect, &start_char, &iPieceWidths);
- if (bEndofLine && (m_Styles.line_wrap_ ||
+ if (bEndofLine && (styles_.line_wrap_ ||
dwBreakStatus == CFGAS_Char::BreakType::kParagraph ||
dwBreakStatus == CFGAS_Char::BreakType::kPage)) {
iPieceWidths = 0;
- ++m_iCurLine;
- m_fLinePos += fLineStep;
+ ++cur_line_;
+ line_pos_ += fLineStep;
}
- if (m_fLinePos + fLineStep > fLineStop) {
- size_t iCurLine = bEndofLine ? m_iCurLine - 1 : m_iCurLine;
- CHECK_LT(m_iCurLine, m_ttoLines.size());
- m_ttoLines[iCurLine].set_new_reload(true);
+ if (line_pos_ + fLineStep > fLineStop) {
+ size_t iCurLine = bEndofLine ? cur_line_ - 1 : cur_line_;
+ CHECK_LT(cur_line_, tto_lines_.size());
+ tto_lines_[iCurLine].set_new_reload(true);
bRet = true;
break;
}
}
- dwBreakStatus = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
+ dwBreakStatus = txt_break_->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus) && !bRet)
RetrievePieces(dwBreakStatus, false, rect, &start_char, &iPieceWidths);
- m_pTxtBreak->ClearBreakPieces();
- m_pTxtBreak->Reset();
+ txt_break_->ClearBreakPieces();
+ txt_break_->Reset();
}
bool CFDE_TextOut::RetrievePieces(CFGAS_Char::BreakType dwBreakStatus,
@@ -363,14 +366,14 @@
const CFX_RectF& rect,
size_t* pStartChar,
int32_t* pPieceWidths) {
- float fLineStep = std::max(m_fLineSpace, m_fFontSize);
+ float fLineStep = std::max(line_space_, font_size_);
bool bNeedReload = false;
int32_t iLineWidth = FXSYS_roundf(rect.Width() * 20000.0f);
- int32_t iCount = m_pTxtBreak->CountBreakPieces();
+ int32_t iCount = txt_break_->CountBreakPieces();
size_t chars_to_skip = *pStartChar;
for (int32_t i = 0; i < iCount; i++) {
- const CFGAS_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
+ const CFGAS_BreakPiece* pPiece = txt_break_->GetBreakPieceUnstable(i);
size_t iPieceChars = pPiece->GetLength();
if (chars_to_skip > iPieceChars) {
chars_to_skip -= iPieceChars;
@@ -382,20 +385,20 @@
size_t j = chars_to_skip;
for (; j < iPieceChars; j++) {
const CFGAS_Char* pTC = pPiece->GetChar(j);
- int32_t iCurCharWidth = std::max(pTC->m_iCharWidth, 0);
- if (m_Styles.single_line_ || !m_Styles.line_wrap_) {
+ int32_t iCurCharWidth = std::max(pTC->char_width_, 0);
+ if (styles_.single_line_ || !styles_.line_wrap_) {
if (iLineWidth - *pPieceWidths - iWidth < iCurCharWidth) {
bNeedReload = true;
break;
}
}
iWidth += iCurCharWidth;
- m_CharWidths[iChar++] = iCurCharWidth;
+ char_widths_[iChar++] = iCurCharWidth;
}
if (j == chars_to_skip && !bReload) {
- CHECK_LT(m_iCurLine, m_ttoLines.size());
- m_ttoLines[m_iCurLine].set_new_reload(true);
+ CHECK_LT(cur_line_, tto_lines_.size());
+ tto_lines_[cur_line_].set_new_reload(true);
} else if (j > chars_to_skip) {
Piece piece;
piece.start_char = *pStartChar;
@@ -403,7 +406,7 @@
piece.char_styles = pPiece->GetCharStyles();
piece.bounds = CFX_RectF(
rect.left + static_cast<float>(pPiece->GetStartPos()) / 20000.0f,
- m_fLinePos, iWidth / 20000.0f, fLineStep);
+ line_pos_, iWidth / 20000.0f, fLineStep);
if (FX_IsOdd(pPiece->GetBidiLevel()))
piece.char_styles |= FX_TXTCHARSTYLE_OddBidiLevel;
@@ -413,43 +416,44 @@
*pStartChar += iPieceChars;
*pPieceWidths += iWidth;
}
- m_pTxtBreak->ClearBreakPieces();
+ txt_break_->ClearBreakPieces();
- return m_Styles.single_line_ || m_Styles.line_wrap_ || bNeedReload ||
+ return styles_.single_line_ || styles_.line_wrap_ || bNeedReload ||
dwBreakStatus == CFGAS_Char::BreakType::kParagraph;
}
void CFDE_TextOut::AppendPiece(const Piece& piece,
bool bNeedReload,
bool bEnd) {
- if (m_iCurLine >= m_ttoLines.size()) {
+ if (cur_line_ >= tto_lines_.size()) {
Line ttoLine;
ttoLine.set_new_reload(bNeedReload);
- m_iCurPiece = ttoLine.AddPiece(m_iCurPiece, piece);
- m_ttoLines.push_back(ttoLine);
- m_iCurLine = m_ttoLines.size() - 1;
+ cur_piece_ = ttoLine.AddPiece(cur_piece_, piece);
+ tto_lines_.push_back(ttoLine);
+ cur_line_ = tto_lines_.size() - 1;
} else {
- Line* pLine = &m_ttoLines[m_iCurLine];
+ Line* pLine = &tto_lines_[cur_line_];
pLine->set_new_reload(bNeedReload);
- m_iCurPiece = pLine->AddPiece(m_iCurPiece, piece);
+ cur_piece_ = pLine->AddPiece(cur_piece_, piece);
if (bEnd) {
size_t iPieces = pLine->GetSize();
- if (m_iCurPiece < iPieces)
- pLine->RemoveLast(iPieces - m_iCurPiece - 1);
+ if (cur_piece_ < iPieces) {
+ pLine->RemoveLast(iPieces - cur_piece_ - 1);
+ }
}
}
if (!bEnd && bNeedReload)
- m_iCurPiece = 0;
+ cur_piece_ = 0;
}
void CFDE_TextOut::Reload(const CFX_RectF& rect) {
size_t i = 0;
- for (auto& line : m_ttoLines) {
+ for (auto& line : tto_lines_) {
if (line.new_reload()) {
- m_iCurLine = i;
- m_iCurPiece = 0;
+ cur_line_ = i;
+ cur_piece_ = 0;
ReloadLinePiece(&line, rect);
}
++i;
@@ -457,7 +461,7 @@
}
void CFDE_TextOut::ReloadLinePiece(Line* line, const CFX_RectF& rect) {
- span<const wchar_t> text_span = m_wsText.span();
+ span<const wchar_t> text_span = text_.span();
size_t start_char = 0;
size_t piece_count = line->GetSize();
int32_t piece_widths = 0;
@@ -465,62 +469,65 @@
for (size_t piece_index = 0; piece_index < piece_count; ++piece_index) {
const Piece* piece = line->GetPieceAtIndex(piece_index);
if (piece_index == 0)
- m_fLinePos = piece->bounds.top;
+ line_pos_ = piece->bounds.top;
start_char = piece->start_char;
const size_t end = piece->start_char + piece->char_count;
for (size_t char_index = start_char; char_index < end; ++char_index) {
- break_status = m_pTxtBreak->AppendChar(text_span[char_index]);
+ break_status = txt_break_->AppendChar(text_span[char_index]);
if (!CFX_BreakTypeNoneOrPiece(break_status))
RetrievePieces(break_status, true, rect, &start_char, &piece_widths);
}
}
- break_status = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
+ break_status = txt_break_->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(break_status))
RetrievePieces(break_status, true, rect, &start_char, &piece_widths);
- m_pTxtBreak->Reset();
+ txt_break_->Reset();
}
void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
- if (m_ttoLines.empty())
+ if (tto_lines_.empty()) {
return;
+ }
- const Piece* pFirstPiece = m_ttoLines.back().GetPieceAtIndex(0);
+ const Piece* pFirstPiece = tto_lines_.back().GetPieceAtIndex(0);
if (!pFirstPiece)
return;
float fInc = rect.bottom() - pFirstPiece->bounds.bottom();
- if (TextAlignmentVerticallyCentered(m_iAlignment))
+ if (TextAlignmentVerticallyCentered(alignment_)) {
fInc /= 2.0f;
- else if (IsTextAlignmentTop(m_iAlignment))
+ } else if (IsTextAlignmentTop(alignment_)) {
fInc = 0.0f;
+ }
if (fInc < 1.0f)
return;
- for (auto& line : m_ttoLines) {
+ for (auto& line : tto_lines_) {
for (size_t i = 0; i < line.GetSize(); ++i)
line.GetPieceAtIndex(i)->bounds.top += fInc;
}
}
size_t CFDE_TextOut::GetDisplayPos(const Piece* pPiece) {
- if (m_CharPos.size() < pPiece->char_count)
- m_CharPos.resize(pPiece->char_count, TextCharPos());
+ if (char_pos_.size() < pPiece->char_count) {
+ char_pos_.resize(pPiece->char_count, TextCharPos());
+ }
CFGAS_TxtBreak::Run tr;
- tr.wsStr = m_wsText.Substr(pPiece->start_char);
- tr.pWidths = make_span(m_CharWidths).subspan(pPiece->start_char);
+ tr.wsStr = text_.Substr(pPiece->start_char);
+ tr.pWidths = make_span(char_widths_).subspan(pPiece->start_char);
tr.iLength = checked_cast<int32_t>(pPiece->char_count);
- tr.pFont = m_pFont;
- tr.fFontSize = m_fFontSize;
- tr.dwStyles = m_dwTxtBkStyles;
+ tr.pFont = font_;
+ tr.fFontSize = font_size_;
+ tr.dwStyles = txt_bk_styles_;
tr.dwCharStyles = pPiece->char_styles;
tr.pRect = &pPiece->bounds;
- return m_pTxtBreak->GetDisplayPos(tr, m_CharPos);
+ return txt_break_->GetDisplayPos(tr, char_pos_);
}
CFDE_TextOut::Line::Line() = default;
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 7675f0f..c25543f 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -40,11 +40,11 @@
void SetFont(RetainPtr<CFGAS_GEFont> pFont);
void SetFontSize(float fFontSize);
- void SetTextColor(FX_ARGB color) { m_TxtColor = color; }
+ void SetTextColor(FX_ARGB color) { txt_color_ = color; }
void SetStyles(const FDE_TextStyle& dwStyles);
void SetAlignment(FDE_TextAlignment iAlignment);
void SetLineSpace(float fLineSpace);
- void SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
+ void SetMatrix(const CFX_Matrix& matrix) { matrix_ = matrix; }
void SetLineBreakTolerance(float fTolerance);
void CalcLogicSize(WideStringView str, CFX_SizeF* pSize);
@@ -52,7 +52,7 @@
void DrawLogicText(CFX_RenderDevice* device,
const WideString& str,
const CFX_RectF& rect);
- int32_t GetTotalLines() const { return m_iTotalLines; }
+ int32_t GetTotalLines() const { return total_lines_; }
private:
struct Piece {
@@ -103,24 +103,24 @@
void DoAlignment(const CFX_RectF& rect);
size_t GetDisplayPos(const Piece* pPiece);
- std::unique_ptr<CFGAS_TxtBreak> const m_pTxtBreak;
- RetainPtr<CFGAS_GEFont> m_pFont;
- float m_fFontSize = 12.0f;
- float m_fLineSpace = 12.0f;
- float m_fLinePos = 0.0f;
- float m_fTolerance = 0.0f;
- FDE_TextAlignment m_iAlignment = FDE_TextAlignment::kTopLeft;
- FDE_TextStyle m_Styles;
- std::vector<int32_t> m_CharWidths;
- FX_ARGB m_TxtColor = 0xFF000000;
- Mask<CFGAS_Break::LayoutStyle> m_dwTxtBkStyles;
- WideString m_wsText;
- CFX_Matrix m_Matrix;
- std::deque<Line> m_ttoLines;
- size_t m_iCurLine = 0;
- size_t m_iCurPiece = 0;
- int32_t m_iTotalLines = 0;
- std::vector<TextCharPos> m_CharPos;
+ std::unique_ptr<CFGAS_TxtBreak> const txt_break_;
+ RetainPtr<CFGAS_GEFont> font_;
+ float font_size_ = 12.0f;
+ float line_space_ = 12.0f;
+ float line_pos_ = 0.0f;
+ float tolerance_ = 0.0f;
+ FDE_TextAlignment alignment_ = FDE_TextAlignment::kTopLeft;
+ FDE_TextStyle styles_;
+ std::vector<int32_t> char_widths_;
+ FX_ARGB txt_color_ = 0xFF000000;
+ Mask<CFGAS_Break::LayoutStyle> txt_bk_styles_;
+ WideString text_;
+ CFX_Matrix matrix_;
+ std::deque<Line> tto_lines_;
+ size_t cur_line_ = 0;
+ size_t cur_piece_ = 0;
+ int32_t total_lines_ = 0;
+ std::vector<TextCharPos> char_pos_;
};
} // namespace pdfium
diff --git a/xfa/fgas/crt/cfgas_decimal.cpp b/xfa/fgas/crt/cfgas_decimal.cpp
index 1ad1973..a9a0912 100644
--- a/xfa/fgas/crt/cfgas_decimal.cpp
+++ b/xfa/fgas/crt/cfgas_decimal.cpp
@@ -270,22 +270,21 @@
CFGAS_Decimal::CFGAS_Decimal() = default;
CFGAS_Decimal::CFGAS_Decimal(uint64_t val)
- : m_uMid(static_cast<uint32_t>(FXMATH_DECIMAL_RSHIFT32BIT(val))),
- m_uLo(static_cast<uint32_t>(val)) {}
+ : mid_(static_cast<uint32_t>(FXMATH_DECIMAL_RSHIFT32BIT(val))),
+ lo_(static_cast<uint32_t>(val)) {}
-CFGAS_Decimal::CFGAS_Decimal(uint32_t val)
- : m_uLo(static_cast<uint32_t>(val)) {}
+CFGAS_Decimal::CFGAS_Decimal(uint32_t val) : lo_(static_cast<uint32_t>(val)) {}
CFGAS_Decimal::CFGAS_Decimal(uint32_t lo,
uint32_t mid,
uint32_t hi,
bool neg,
uint8_t scale)
- : m_uHi(hi),
- m_uMid(mid),
- m_uLo(lo),
- m_bNeg(neg && IsNotZero()),
- m_uScale(scale > FXMATH_DECIMAL_SCALELIMIT ? 0 : scale) {}
+ : hi_(hi),
+ mid_(mid),
+ lo_(lo),
+ neg_(neg && IsNotZero()),
+ u_scale_(scale > FXMATH_DECIMAL_SCALELIMIT ? 0 : scale) {}
CFGAS_Decimal::CFGAS_Decimal(int32_t val) {
if (val >= 0) {
@@ -318,11 +317,11 @@
plo += FXSYS_roundf(newval);
decimal_helper_normalize(phi, pmid, plo);
- m_uHi = static_cast<uint32_t>(phi);
- m_uMid = static_cast<uint32_t>(pmid);
- m_uLo = static_cast<uint32_t>(plo);
- m_bNeg = val < 0 && IsNotZero();
- m_uScale = scale;
+ hi_ = static_cast<uint32_t>(phi);
+ mid_ = static_cast<uint32_t>(pmid);
+ lo_ = static_cast<uint32_t>(plo);
+ neg_ = val < 0 && IsNotZero();
+ u_scale_ = scale;
}
CFGAS_Decimal::CFGAS_Decimal(WideStringView str) {
@@ -348,35 +347,36 @@
if (!FXSYS_IsDecimalDigit(static_cast<wchar_t>(str.Front()))) {
break;
}
- m_uHi = m_uHi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uMid * 0xA);
- m_uMid = m_uMid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uLo * 0xA);
- m_uLo = m_uLo * 0xA + (str.Front() - '0');
+ hi_ = hi_ * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)mid_ * 0xA);
+ mid_ = mid_ * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)lo_ * 0xA);
+ lo_ = lo_ * 0xA + (str.Front() - '0');
if (pointmet) {
scale++;
}
str = str.Substr(1);
}
- m_bNeg = negmet && IsNotZero();
- m_uScale = scale;
+ neg_ = negmet && IsNotZero();
+ u_scale_ = scale;
}
WideString CFGAS_Decimal::ToWideString() const {
WideString retString;
WideString tmpbuf;
- uint64_t phi = m_uHi;
- uint64_t pmid = m_uMid;
- uint64_t plo = m_uLo;
+ uint64_t phi = hi_;
+ uint64_t pmid = mid_;
+ uint64_t plo = lo_;
while (phi || pmid || plo)
tmpbuf += decimal_helper_div10(phi, pmid, plo) + '0';
uint8_t outputlen = (uint8_t)tmpbuf.GetLength();
- uint8_t scale = m_uScale;
+ uint8_t scale = u_scale_;
while (scale >= outputlen) {
tmpbuf += '0';
outputlen++;
}
- if (m_bNeg && IsNotZero())
+ if (neg_ && IsNotZero()) {
retString += '-';
+ }
for (uint8_t idx = 0; idx < outputlen; idx++) {
if (idx == (outputlen - scale) && scale != 0)
@@ -392,28 +392,28 @@
double CFGAS_Decimal::ToDouble() const {
double pow = (double)(1 << 16) * (1 << 16);
- double base = static_cast<double>(m_uHi) * pow * pow +
- static_cast<double>(m_uMid) * pow + static_cast<double>(m_uLo);
- return (m_bNeg ? -1 : 1) * base * powf(10.0f, -m_uScale);
+ double base = static_cast<double>(hi_) * pow * pow +
+ static_cast<double>(mid_) * pow + static_cast<double>(lo_);
+ return (neg_ ? -1 : 1) * base * powf(10.0f, -u_scale_);
}
void CFGAS_Decimal::SetScale(uint8_t newscale) {
- uint8_t oldscale = m_uScale;
+ uint8_t oldscale = u_scale_;
if (oldscale == newscale)
return;
- uint64_t phi = m_uHi;
- uint64_t pmid = m_uMid;
- uint64_t plo = m_uLo;
+ uint64_t phi = hi_;
+ uint64_t pmid = mid_;
+ uint64_t plo = lo_;
if (newscale > oldscale) {
for (uint8_t iter = 0; iter < newscale - oldscale; iter++)
decimal_helper_mul10(phi, pmid, plo);
- m_uHi = static_cast<uint32_t>(phi);
- m_uMid = static_cast<uint32_t>(pmid);
- m_uLo = static_cast<uint32_t>(plo);
- m_bNeg = m_bNeg && IsNotZero();
- m_uScale = newscale;
+ hi_ = static_cast<uint32_t>(phi);
+ mid_ = static_cast<uint32_t>(pmid);
+ lo_ = static_cast<uint32_t>(plo);
+ neg_ = neg_ && IsNotZero();
+ u_scale_ = newscale;
} else {
uint64_t point5_hi = 0;
uint64_t point5_mid = 0;
@@ -428,25 +428,24 @@
for (uint8_t iter = 0; iter < oldscale - newscale; iter++)
decimal_helper_div10(phi, pmid, plo);
}
- m_uHi = static_cast<uint32_t>(phi);
- m_uMid = static_cast<uint32_t>(pmid);
- m_uLo = static_cast<uint32_t>(plo);
- m_bNeg = m_bNeg && IsNotZero();
- m_uScale = newscale;
+ hi_ = static_cast<uint32_t>(phi);
+ mid_ = static_cast<uint32_t>(pmid);
+ lo_ = static_cast<uint32_t>(plo);
+ neg_ = neg_ && IsNotZero();
+ u_scale_ = newscale;
}
void CFGAS_Decimal::SetNegate() {
if (IsNotZero())
- m_bNeg = !m_bNeg;
+ neg_ = !neg_;
}
CFGAS_Decimal CFGAS_Decimal::operator*(const CFGAS_Decimal& val) const {
- uint64_t a[3] = {m_uLo, m_uMid, m_uHi},
- b[3] = {val.m_uLo, val.m_uMid, val.m_uHi};
+ uint64_t a[3] = {lo_, mid_, hi_}, b[3] = {val.lo_, val.mid_, val.hi_};
uint64_t c[6];
decimal_helper_raw_mul(a, 3, b, 3, c, 6);
- bool neg = m_bNeg ^ val.m_bNeg;
- uint8_t scale = m_uScale + val.m_uScale;
+ bool neg = neg_ ^ val.neg_;
+ uint8_t scale = u_scale_ + val.u_scale_;
decimal_helper_shrinkintorange(c, 6, 3, scale);
return CFGAS_Decimal(static_cast<uint32_t>(c[0]), static_cast<uint32_t>(c[1]),
static_cast<uint32_t>(c[2]), neg, scale);
@@ -456,15 +455,16 @@
if (!val.IsNotZero())
return CFGAS_Decimal();
- bool neg = m_bNeg ^ val.m_bNeg;
- uint64_t a[7] = {m_uLo, m_uMid, m_uHi},
- b[3] = {val.m_uLo, val.m_uMid, val.m_uHi}, c[7] = {0};
+ bool neg = neg_ ^ val.neg_;
+ uint64_t a[7] = {lo_, mid_, hi_}, b[3] = {val.lo_, val.mid_, val.hi_},
+ c[7] = {0};
uint8_t scale = 0;
- if (m_uScale < val.m_uScale) {
- for (int i = val.m_uScale - m_uScale; i > 0; i--)
+ if (u_scale_ < val.u_scale_) {
+ for (int i = val.u_scale_ - u_scale_; i > 0; i--) {
decimal_helper_mul10_any(a, 7);
+ }
} else {
- scale = m_uScale - val.m_uScale;
+ scale = u_scale_ - val.u_scale_;
}
uint8_t minscale = scale;
diff --git a/xfa/fgas/crt/cfgas_decimal.h b/xfa/fgas/crt/cfgas_decimal.h
index 0e2b7b9..31f0796 100644
--- a/xfa/fgas/crt/cfgas_decimal.h
+++ b/xfa/fgas/crt/cfgas_decimal.h
@@ -25,8 +25,8 @@
CFGAS_Decimal operator*(const CFGAS_Decimal& val) const;
CFGAS_Decimal operator/(const CFGAS_Decimal& val) const;
- bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; }
- uint8_t GetScale() const { return m_uScale; }
+ bool IsNotZero() const { return hi_ || mid_ || lo_; }
+ uint8_t GetScale() const { return u_scale_; }
void SetScale(uint8_t newScale);
void SetNegate();
@@ -37,11 +37,11 @@
bool neg,
uint8_t scale);
- uint32_t m_uHi = 0;
- uint32_t m_uMid = 0;
- uint32_t m_uLo = 0;
- bool m_bNeg = false;
- uint8_t m_uScale = 0;
+ uint32_t hi_ = 0;
+ uint32_t mid_ = 0;
+ uint32_t lo_ = 0;
+ bool neg_ = false;
+ uint8_t u_scale_ = 0;
};
#endif // XFA_FGAS_CRT_CFGAS_DECIMAL_H_
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index fd58d99..f07acd3 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -869,7 +869,7 @@
}
CFGAS_StringFormatter::CFGAS_StringFormatter(const WideString& wsPattern)
- : m_wsPattern(wsPattern), m_spPattern(m_wsPattern.span()) {}
+ : pattern_(wsPattern), pattern_span_(pattern_.span()) {}
CFGAS_StringFormatter::~CFGAS_StringFormatter() = default;
@@ -899,24 +899,26 @@
Category eCategory = Category::kUnknown;
size_t ccf = 0;
bool bBraceOpen = false;
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '\'') {
- GetLiteralText(m_spPattern, &ccf);
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '\'') {
+ GetLiteralText(pattern_span_, &ccf);
continue;
}
- if (!bBraceOpen && !pdfium::Contains(kConstChars, m_spPattern[ccf])) {
- WideString wsCategory(m_spPattern[ccf]);
+ if (!bBraceOpen && !pdfium::Contains(kConstChars, pattern_span_[ccf])) {
+ WideString wsCategory(pattern_span_[ccf]);
ccf++;
while (true) {
- if (ccf >= m_spPattern.size())
+ if (ccf >= pattern_span_.size()) {
return eCategory;
- if (m_spPattern[ccf] == '.' || m_spPattern[ccf] == '(')
+ }
+ if (pattern_span_[ccf] == '.' || pattern_span_[ccf] == '(') {
break;
- if (m_spPattern[ccf] == '{') {
+ }
+ if (pattern_span_[ccf] == '{') {
bBraceOpen = true;
break;
}
- wsCategory += m_spPattern[ccf];
+ wsCategory += pattern_span_[ccf];
ccf++;
}
if (wsCategory == kDateTimeStr)
@@ -938,7 +940,7 @@
return Category::kDateTime;
eCategory = Category::kTime;
}
- } else if (m_spPattern[ccf] == '}') {
+ } else if (pattern_span_[ccf] == '}') {
bBraceOpen = false;
}
ccf++;
@@ -951,44 +953,45 @@
size_t ccf = 0;
bool bBrackOpen = false;
WideString wsPurgePattern;
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '\'') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '\'') {
size_t iCurChar = ccf;
- GetLiteralText(m_spPattern, &ccf);
+ GetLiteralText(pattern_span_, &ccf);
wsPurgePattern +=
- WideStringView(m_spPattern.subspan(iCurChar, ccf - iCurChar));
+ WideStringView(pattern_span_.subspan(iCurChar, ccf - iCurChar));
continue;
}
- if (!bBrackOpen && !pdfium::Contains(kConstChars, m_spPattern[ccf])) {
- WideString wsSearchCategory(m_spPattern[ccf]);
+ if (!bBrackOpen && !pdfium::Contains(kConstChars, pattern_span_[ccf])) {
+ WideString wsSearchCategory(pattern_span_[ccf]);
ccf++;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != '{' &&
- m_spPattern[ccf] != '.' && m_spPattern[ccf] != '(') {
- wsSearchCategory += m_spPattern[ccf];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != '{' &&
+ pattern_span_[ccf] != '.' && pattern_span_[ccf] != '(') {
+ wsSearchCategory += pattern_span_[ccf];
ccf++;
}
if (wsSearchCategory != wsCategory)
continue;
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '(') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '(') {
ccf++;
// Skip over the encoding name.
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != ')')
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != ')') {
ccf++;
- } else if (m_spPattern[ccf] == '{') {
+ }
+ } else if (pattern_span_[ccf] == '{') {
bBrackOpen = true;
break;
}
ccf++;
}
- } else if (m_spPattern[ccf] != '}') {
- wsPurgePattern += m_spPattern[ccf];
+ } else if (pattern_span_[ccf] != '}') {
+ wsPurgePattern += pattern_span_[ccf];
}
ccf++;
}
if (!bBrackOpen)
- wsPurgePattern = m_wsPattern;
+ wsPurgePattern = pattern_;
return wsPurgePattern;
}
@@ -1003,20 +1006,20 @@
size_t ccf = 0;
bool bFindDot = false;
bool bBrackOpen = false;
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '\'') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '\'') {
size_t iCurChar = ccf;
- GetLiteralText(m_spPattern, &ccf);
+ GetLiteralText(pattern_span_, &ccf);
*wsPurgePattern +=
- WideStringView(m_spPattern.subspan(iCurChar, ccf - iCurChar));
+ WideStringView(pattern_span_.subspan(iCurChar, ccf - iCurChar));
continue;
}
- if (!bBrackOpen && !pdfium::Contains(kConstChars, m_spPattern[ccf])) {
- WideString wsCategory(m_spPattern[ccf]);
+ if (!bBrackOpen && !pdfium::Contains(kConstChars, pattern_span_[ccf])) {
+ WideString wsCategory(pattern_span_[ccf]);
ccf++;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != '{' &&
- m_spPattern[ccf] != '.' && m_spPattern[ccf] != '(') {
- wsCategory += m_spPattern[ccf];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != '{' &&
+ pattern_span_[ccf] != '.' && pattern_span_[ccf] != '(') {
+ wsCategory += pattern_span_[ccf];
ccf++;
}
if (!wsCategory.EqualsASCII("num")) {
@@ -1024,24 +1027,25 @@
ccf = 0;
continue;
}
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '{') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '{') {
bBrackOpen = true;
break;
}
- if (m_spPattern[ccf] == '(') {
+ if (pattern_span_[ccf] == '(') {
ccf++;
WideString wsLCID;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != ')')
- wsLCID += m_spPattern[ccf++];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != ')') {
+ wsLCID += pattern_span_[ccf++];
+ }
pLocale = pLocaleMgr->GetLocaleByName(wsLCID);
- } else if (m_spPattern[ccf] == '.') {
+ } else if (pattern_span_[ccf] == '.') {
WideString wsSubCategory;
ccf++;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != '(' &&
- m_spPattern[ccf] != '{') {
- wsSubCategory += m_spPattern[ccf++];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != '(' &&
+ pattern_span_[ccf] != '{') {
+ wsSubCategory += pattern_span_[ccf++];
}
uint32_t dwSubHash = FX_HashCode_GetW(wsSubCategory.AsStringView());
LocaleIface::NumSubcategory eSubCategory =
@@ -1070,18 +1074,18 @@
}
ccf++;
}
- } else if (m_spPattern[ccf] == 'E') {
+ } else if (pattern_span_[ccf] == 'E') {
*dwStyle |= FX_NUMSTYLE_Exponent;
- *wsPurgePattern += m_spPattern[ccf];
- } else if (m_spPattern[ccf] == '%') {
+ *wsPurgePattern += pattern_span_[ccf];
+ } else if (pattern_span_[ccf] == '%') {
*dwStyle |= FX_NUMSTYLE_Percent;
- *wsPurgePattern += m_spPattern[ccf];
- } else if (m_spPattern[ccf] != '}') {
- *wsPurgePattern += m_spPattern[ccf];
+ *wsPurgePattern += pattern_span_[ccf];
+ } else if (pattern_span_[ccf] != '}') {
+ *wsPurgePattern += pattern_span_[ccf];
}
- if (!bFindDot && ccf < m_spPattern.size() &&
- (m_spPattern[ccf] == '.' || m_spPattern[ccf] == 'V' ||
- m_spPattern[ccf] == 'v')) {
+ if (!bFindDot && ccf < pattern_span_.size() &&
+ (pattern_span_[ccf] == '.' || pattern_span_[ccf] == 'V' ||
+ pattern_span_[ccf] == 'v')) {
bFindDot = true;
*iDotIndex = wsPurgePattern->GetLength() - 1;
*dwStyle |= FX_NUMSTYLE_DotVorv;
@@ -1098,8 +1102,9 @@
bool CFGAS_StringFormatter::ParseText(const WideString& wsSrcText,
WideString* wsValue) const {
wsValue->clear();
- if (wsSrcText.IsEmpty() || m_spPattern.empty())
+ if (wsSrcText.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
WideString wsTextFormat = GetTextFormat(L"text");
if (wsTextFormat.IsEmpty())
@@ -1169,10 +1174,11 @@
const WideString& wsSrcNum,
WideString* wsValue) const {
wsValue->clear();
- if (wsSrcNum.IsEmpty() || m_spPattern.empty())
+ if (wsSrcNum.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
- size_t dot_index_f = m_spPattern.size();
+ size_t dot_index_f = pattern_span_.size();
uint32_t dwFormatStyle = 0;
WideString wsNumFormat;
LocaleIface* pLocale =
@@ -1598,29 +1604,29 @@
DateTimeType eDateTimeType = DateTimeType::kUnknown;
size_t ccf = 0;
bool bBraceOpen = false;
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '\'') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '\'') {
size_t iCurChar = ccf;
- GetLiteralText(m_spPattern, &ccf);
+ GetLiteralText(pattern_span_, &ccf);
wsTempPattern +=
- WideStringView(m_spPattern.subspan(iCurChar, ccf - iCurChar));
+ WideStringView(pattern_span_.subspan(iCurChar, ccf - iCurChar));
continue;
}
if (!bBraceOpen && eDateTimeType != DateTimeType::kDateTime &&
- !pdfium::Contains(kConstChars, m_spPattern[ccf])) {
- WideString wsCategory(m_spPattern[ccf]);
+ !pdfium::Contains(kConstChars, pattern_span_[ccf])) {
+ WideString wsCategory(pattern_span_[ccf]);
ccf++;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != '{' &&
- m_spPattern[ccf] != '.' && m_spPattern[ccf] != '(') {
- if (m_spPattern[ccf] == 'T') {
- *wsDatePattern = m_wsPattern.First(ccf);
- *wsTimePattern = m_wsPattern.Last(m_wsPattern.GetLength() - ccf);
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != '{' &&
+ pattern_span_[ccf] != '.' && pattern_span_[ccf] != '(') {
+ if (pattern_span_[ccf] == 'T') {
+ *wsDatePattern = pattern_.First(ccf);
+ *wsTimePattern = pattern_.Last(pattern_.GetLength() - ccf);
wsTimePattern->SetAt(0, ' ');
if (!*pLocale)
*pLocale = pLocaleMgr->GetDefLocale();
return DateTimeType::kDateTime;
}
- wsCategory += m_spPattern[ccf];
+ wsCategory += pattern_span_[ccf];
ccf++;
}
if (!HasDate(eDateTimeType) && wsCategory.EqualsASCII("date")) {
@@ -1635,24 +1641,26 @@
} else {
continue;
}
- while (ccf < m_spPattern.size()) {
- if (m_spPattern[ccf] == '{') {
+ while (ccf < pattern_span_.size()) {
+ if (pattern_span_[ccf] == '{') {
bBraceOpen = true;
break;
}
- if (m_spPattern[ccf] == '(') {
+ if (pattern_span_[ccf] == '(') {
ccf++;
WideString wsLCID;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != ')')
- wsLCID += m_spPattern[ccf++];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != ')') {
+ wsLCID += pattern_span_[ccf++];
+ }
*pLocale = pLocaleMgr->GetLocaleByName(wsLCID);
- } else if (m_spPattern[ccf] == '.') {
+ } else if (pattern_span_[ccf] == '.') {
WideString wsSubCategory;
ccf++;
- while (ccf < m_spPattern.size() && m_spPattern[ccf] != '(' &&
- m_spPattern[ccf] != '{')
- wsSubCategory += m_spPattern[ccf++];
+ while (ccf < pattern_span_.size() && pattern_span_[ccf] != '(' &&
+ pattern_span_[ccf] != '{') {
+ wsSubCategory += pattern_span_[ccf++];
+ }
uint32_t dwSubHash = FX_HashCode_GetW(wsSubCategory.AsStringView());
LocaleIface::DateTimeSubcategory eSubCategory =
@@ -1688,7 +1696,7 @@
}
ccf++;
}
- } else if (m_spPattern[ccf] == '}') {
+ } else if (pattern_span_[ccf] == '}') {
bBraceOpen = false;
if (!wsTempPattern.IsEmpty()) {
if (eCategory == Category::kTime)
@@ -1699,7 +1707,7 @@
wsTempPattern.clear();
}
} else {
- wsTempPattern += m_spPattern[ccf];
+ wsTempPattern += pattern_span_[ccf];
}
ccf++;
}
@@ -1714,7 +1722,7 @@
*pLocale = pLocaleMgr->GetDefLocale();
if (eDateTimeType == DateTimeType::kUnknown) {
wsTimePattern->clear();
- *wsDatePattern = m_wsPattern;
+ *wsDatePattern = pattern_;
}
return eDateTimeType;
}
@@ -1724,8 +1732,9 @@
DateTimeType eDateTimeType,
CFX_DateTime* dtValue) const {
dtValue->Reset();
- if (wsSrcDateTime.IsEmpty() || m_spPattern.empty())
+ if (wsSrcDateTime.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
LocaleIface* pLocale = nullptr;
WideString wsDatePattern;
@@ -1819,8 +1828,9 @@
bool CFGAS_StringFormatter::FormatText(const WideString& wsSrcText,
WideString* wsOutput) const {
- if (wsSrcText.IsEmpty() || m_spPattern.empty())
+ if (wsSrcText.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
WideString wsTextFormat = GetTextFormat(L"text");
pdfium::span<const wchar_t> spSrcText = wsSrcText.span();
@@ -1877,10 +1887,11 @@
bool CFGAS_StringFormatter::FormatNum(LocaleMgrIface* pLocaleMgr,
const WideString& wsInputNum,
WideString* wsOutput) const {
- if (wsInputNum.IsEmpty() || m_spPattern.empty())
+ if (wsInputNum.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
- size_t dot_index_f = m_spPattern.size();
+ size_t dot_index_f = pattern_span_.size();
uint32_t dwNumStyle = 0;
WideString wsNumFormat;
LocaleIface* pLocale =
@@ -2228,8 +2239,9 @@
const WideString& wsSrcDateTime,
DateTimeType eDateTimeType,
WideString* wsOutput) const {
- if (wsSrcDateTime.IsEmpty() || m_spPattern.empty())
+ if (wsSrcDateTime.IsEmpty() || pattern_span_.empty()) {
return false;
+ }
WideString wsDatePattern;
WideString wsTimePattern;
@@ -2284,8 +2296,9 @@
}
bool CFGAS_StringFormatter::FormatZero(WideString* wsOutput) const {
- if (m_spPattern.empty())
+ if (pattern_span_.empty()) {
return false;
+ }
WideString wsTextFormat = GetTextFormat(L"zero");
pdfium::span<const wchar_t> spTextFormat = wsTextFormat.span();
@@ -2301,8 +2314,9 @@
}
bool CFGAS_StringFormatter::FormatNull(WideString* wsOutput) const {
- if (m_spPattern.empty())
+ if (pattern_span_.empty()) {
return false;
+ }
WideString wsTextFormat = GetTextFormat(L"null");
pdfium::span<const wchar_t> spTextFormat = wsTextFormat.span();
diff --git a/xfa/fgas/crt/cfgas_stringformatter.h b/xfa/fgas/crt/cfgas_stringformatter.h
index 6d6442c..1a2a825 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.h
+++ b/xfa/fgas/crt/cfgas_stringformatter.h
@@ -85,10 +85,10 @@
WideString* wsTimePattern) const;
// keep pattern string alive.
- const WideString m_wsPattern;
+ const WideString pattern_;
- // span into `m_wsPattern`.
- const pdfium::raw_span<const wchar_t> m_spPattern;
+ // span into `pattern_`.
+ const pdfium::raw_span<const wchar_t> pattern_span_;
};
#endif // XFA_FGAS_CRT_CFGAS_STRINGFORMATTER_H_
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 90d6b2d..308ca93 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -229,7 +229,7 @@
} // namespace
-CFGAS_FontMgr::CFGAS_FontMgr() : m_FontFaces(EnumGdiFonts(nullptr, 0xFEFF)) {}
+CFGAS_FontMgr::CFGAS_FontMgr() : font_faces_(EnumGdiFonts(nullptr, 0xFEFF)) {}
CFGAS_FontMgr::~CFGAS_FontMgr() = default;
@@ -261,11 +261,11 @@
pFont->SetLogicalFontStyle(dwFontStyles);
if (!VerifyUnicode(pFont, wUnicode)) {
- m_FailedUnicodesSet.insert(wUnicode);
+ failed_unicodes_set_.insert(wUnicode);
return nullptr;
}
- m_Hash2Fonts[dwHash].push_back(pFont);
+ hash_2fonts_[dwHash].push_back(pFont);
return pFont;
}
@@ -284,7 +284,7 @@
params.dwFontStyles = dwFontStyles;
params.matchParagraphStyle = matchParagraphStyle;
- const FX_FONTDESCRIPTOR* pDesc = MatchDefaultFont(¶ms, m_FontFaces);
+ const FX_FONTDESCRIPTOR* pDesc = MatchDefaultFont(¶ms, font_faces_);
if (pDesc)
return pDesc;
@@ -301,12 +301,13 @@
if (!pDesc)
return nullptr;
- auto it = std::find(m_FontFaces.rbegin(), m_FontFaces.rend(), *pDesc);
- if (it != m_FontFaces.rend())
+ auto it = std::find(font_faces_.rbegin(), font_faces_.rend(), *pDesc);
+ if (it != font_faces_.rend()) {
return &*it;
+ }
- m_FontFaces.push_back(*pDesc);
- return &m_FontFaces.back();
+ font_faces_.push_back(*pDesc);
+ return &font_faces_.back();
}
#else // BUILDFLAG(IS_WIN)
@@ -556,20 +557,20 @@
bool VerifyUnicodeForFontDescriptor(CFGAS_FontDescriptor* pDesc,
wchar_t wcUnicode) {
- if (!pDesc->m_pFace) {
+ if (!pDesc->face_) {
RetainPtr<IFX_SeekableReadStream> pFileRead =
- CreateFontStream(pDesc->m_wsFaceName.ToUTF8());
+ CreateFontStream(pDesc->face_name_.ToUTF8());
if (!pFileRead) {
return false;
}
- pDesc->m_pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex);
- if (!pDesc->m_pFace) {
+ pDesc->face_ = LoadFace(pFileRead, pDesc->face_index_);
+ if (!pDesc->face_) {
return false;
}
- pDesc->m_pFace->ClearExternalStream();
+ pDesc->face_->ClearExternalStream();
}
- return pDesc->m_pFace->SelectCharMap(fxge::FontEncoding::kUnicode) &&
- pDesc->m_pFace->GetCharIndex(wcUnicode);
+ return pDesc->face_->SelectCharMap(fxge::FontEncoding::kUnicode) &&
+ pDesc->face_->GetCharIndex(wcUnicode);
}
bool IsPartName(const WideString& name1, const WideString& name2) {
@@ -583,34 +584,38 @@
wchar_t wcUnicode) {
int32_t nPenalty = 30000;
if (FontName.GetLength() != 0) {
- if (FontName != pInstalled->m_wsFaceName) {
+ if (FontName != pInstalled->face_name_) {
size_t i;
- for (i = 0; i < pInstalled->m_wsFamilyNames.size(); ++i) {
- if (pInstalled->m_wsFamilyNames[i] == FontName)
+ for (i = 0; i < pInstalled->family_names_.size(); ++i) {
+ if (pInstalled->family_names_[i] == FontName) {
break;
+ }
}
- if (i == pInstalled->m_wsFamilyNames.size())
+ if (i == pInstalled->family_names_.size()) {
nPenalty += 0xFFFF;
- else
+ } else {
nPenalty -= 28000;
+ }
} else {
nPenalty -= 30000;
}
- if (nPenalty == 30000 && !IsPartName(pInstalled->m_wsFaceName, FontName)) {
+ if (nPenalty == 30000 && !IsPartName(pInstalled->face_name_, FontName)) {
size_t i;
- for (i = 0; i < pInstalled->m_wsFamilyNames.size(); i++) {
- if (IsPartName(pInstalled->m_wsFamilyNames[i], FontName))
+ for (i = 0; i < pInstalled->family_names_.size(); i++) {
+ if (IsPartName(pInstalled->family_names_[i], FontName)) {
break;
+ }
}
- if (i == pInstalled->m_wsFamilyNames.size())
+ if (i == pInstalled->family_names_.size()) {
nPenalty += 0xFFFF;
- else
+ } else {
nPenalty -= 26000;
+ }
} else {
nPenalty -= 27000;
}
}
- uint32_t dwStyleMask = pInstalled->m_dwFontStyles ^ dwFontStyles;
+ uint32_t dwStyleMask = pInstalled->font_styles_ ^ dwFontStyles;
if (FontStyleIsForceBold(dwStyleMask))
nPenalty += 4500;
if (FontStyleIsFixedPitch(dwStyleMask))
@@ -630,19 +635,21 @@
: FX_GetCodePageBit(wCodePage);
if (wBit != static_cast<uint16_t>(-1)) {
DCHECK(wBit < 64);
- if ((pInstalled->m_dwCsb[wBit / 32] & (1 << (wBit % 32))) == 0)
+ if ((pInstalled->csb_[wBit / 32] & (1 << (wBit % 32))) == 0) {
nPenalty += 0xFFFF;
- else
+ } else {
nPenalty -= 60000;
+ }
}
wBit = (wcUnicode == 0 || wcUnicode == 0xFFFE) ? FGAS_FONTUSB::kNoBitField
: FX_GetUnicodeBit(wcUnicode);
if (wBit != FGAS_FONTUSB::kNoBitField) {
DCHECK(wBit < 128);
- if ((pInstalled->m_dwUsb[wBit / 32] & (1 << (wBit % 32))) == 0)
+ if ((pInstalled->usb_[wBit / 32] & (1 << (wBit % 32))) == 0) {
nPenalty += 0xFFFF;
- else
+ } else {
nPenalty -= 60000;
+ }
}
return nPenalty;
}
@@ -673,7 +680,7 @@
RegisterFaces(pFontStream, wsFaceName);
}
- return !m_InstalledFonts.empty();
+ return !installed_fonts_.empty();
}
bool CFGAS_FontMgr::EnumFonts() {
@@ -687,24 +694,24 @@
uint32_t dwHash,
FX_CodePage wCodePage,
uint16_t /* wBitField*/) {
- if (!pdfium::Contains(m_Hash2CandidateList, dwHash)) {
- m_Hash2CandidateList[dwHash] =
+ if (!pdfium::Contains(hash_2candidate_list_, dwHash)) {
+ hash_2candidate_list_[dwHash] =
MatchFonts(wCodePage, dwFontStyles, pszFontFamily, wUnicode);
}
- for (const auto& info : m_Hash2CandidateList[dwHash]) {
+ for (const auto& info : hash_2candidate_list_[dwHash]) {
CFGAS_FontDescriptor* pDesc = info.pFont;
if (!VerifyUnicodeForFontDescriptor(pDesc, wUnicode))
continue;
RetainPtr<CFGAS_GEFont> pFont =
- LoadFontInternal(pDesc->m_wsFaceName, pDesc->m_nFaceIndex);
+ LoadFontInternal(pDesc->face_name_, pDesc->face_index_);
if (!pFont)
continue;
pFont->SetLogicalFontStyle(dwFontStyles);
- m_Hash2Fonts[dwHash].push_back(pFont);
+ hash_2fonts_[dwHash].push_back(pFont);
return pFont;
}
if (!pszFontFamily)
- m_FailedUnicodesSet.insert(wUnicode);
+ failed_unicodes_set_.insert(wUnicode);
return nullptr;
}
@@ -729,7 +736,7 @@
const WideString& FontName,
wchar_t wcUnicode) {
std::vector<CFGAS_FontDescriptorInfo> matched_fonts;
- for (const auto& pFont : m_InstalledFonts) {
+ for (const auto& pFont : installed_fonts_) {
int32_t nPenalty =
CalcPenalty(pFont.get(), wCodePage, dwFontStyles, FontName, wcUnicode);
if (nPenalty >= 0xffff)
@@ -749,24 +756,24 @@
}
auto pFont = std::make_unique<CFGAS_FontDescriptor>();
- pFont->m_dwFontStyles |= GetFlags(pFace);
+ pFont->font_styles_ |= GetFlags(pFace);
// TODO(crbug.com/pdfium/2085): Use make_span() in fewer places after updating
// pdfium::span.
std::optional<std::array<uint32_t, 4>> unicode_range =
pFace->GetOs2UnicodeRange();
if (unicode_range.has_value()) {
- fxcrt::Copy(unicode_range.value(), pFont->m_dwUsb);
+ fxcrt::Copy(unicode_range.value(), pFont->usb_);
} else {
- fxcrt::Fill(pFont->m_dwUsb, 0);
+ fxcrt::Fill(pFont->usb_, 0);
}
std::optional<std::array<uint32_t, 2>> code_page_range =
pFace->GetOs2CodePageRange();
if (code_page_range.has_value()) {
- fxcrt::Copy(code_page_range.value(), pFont->m_dwCsb);
+ fxcrt::Copy(code_page_range.value(), pFont->csb_);
} else {
- fxcrt::Fill(pFont->m_dwCsb, 0);
+ fxcrt::Fill(pFont->csb_, 0);
}
static constexpr uint32_t kNameTag =
@@ -780,13 +787,13 @@
table.clear();
}
}
- pFont->m_wsFamilyNames = GetNames(table);
- pFont->m_wsFamilyNames.push_back(
+ pFont->family_names_ = GetNames(table);
+ pFont->family_names_.push_back(
WideString::FromUTF8(pFace->GetRec()->family_name));
- pFont->m_wsFaceName = wsFaceName;
- pFont->m_nFaceIndex =
+ pFont->face_name_ = wsFaceName;
+ pFont->face_index_ =
pdfium::checked_cast<int32_t>(pFace->GetRec()->face_index);
- m_InstalledFonts.push_back(std::move(pFont));
+ installed_fonts_.push_back(std::move(pFont));
}
void CFGAS_FontMgr::RegisterFaces(
@@ -814,7 +821,7 @@
uint32_t dwFontStyles,
const wchar_t* pszFontFamily) {
uint32_t dwHash = ShortFormHash(wCodePage, dwFontStyles, pszFontFamily);
- auto* pFontVector = &m_Hash2Fonts[dwHash];
+ auto* pFontVector = &hash_2fonts_[dwHash];
if (!pFontVector->empty()) {
for (auto iter = pFontVector->begin(); iter != pFontVector->end(); ++iter) {
if (*iter != nullptr)
@@ -841,16 +848,17 @@
RetainPtr<CFGAS_GEFont> pFont =
CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage);
#else // BUILDFLAG(IS_WIN)
- if (!pdfium::Contains(m_Hash2CandidateList, dwHash)) {
- m_Hash2CandidateList[dwHash] =
+ if (!pdfium::Contains(hash_2candidate_list_, dwHash)) {
+ hash_2candidate_list_[dwHash] =
MatchFonts(wCodePage, dwFontStyles, WideString(pszFontFamily), 0);
}
- if (m_Hash2CandidateList[dwHash].empty())
+ if (hash_2candidate_list_[dwHash].empty()) {
return nullptr;
+ }
- CFGAS_FontDescriptor* pDesc = m_Hash2CandidateList[dwHash].front().pFont;
+ CFGAS_FontDescriptor* pDesc = hash_2candidate_list_[dwHash].front().pFont;
RetainPtr<CFGAS_GEFont> pFont =
- LoadFontInternal(pDesc->m_wsFaceName, pDesc->m_nFaceIndex);
+ LoadFontInternal(pDesc->face_name_, pDesc->face_index_);
#endif // BUILDFLAG(IS_WIN)
if (!pFont)
@@ -865,8 +873,9 @@
wchar_t wUnicode,
uint32_t dwFontStyles,
const wchar_t* pszFontFamily) {
- if (pdfium::Contains(m_FailedUnicodesSet, wUnicode))
+ if (pdfium::Contains(failed_unicodes_set_, wUnicode)) {
return nullptr;
+ }
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode);
FX_CodePage wCodePage = x ? x->wCodePage : FX_CodePage::kFailure;
@@ -875,7 +884,7 @@
wCodePage == FX_CodePage::kFailure
? LongFormHash(wCodePage, wBitField, dwFontStyles, pszFontFamily)
: ShortFormHash(wCodePage, dwFontStyles, pszFontFamily);
- for (auto& pFont : m_Hash2Fonts[dwHash]) {
+ for (auto& pFont : hash_2fonts_[dwHash]) {
if (VerifyUnicode(pFont, wUnicode))
return pFont;
}
@@ -888,7 +897,7 @@
FX_CodePage wCodePage) {
#if BUILDFLAG(IS_WIN)
uint32_t dwHash = ShortFormHash(wCodePage, dwFontStyles, pszFontFamily);
- std::vector<RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash];
+ std::vector<RetainPtr<CFGAS_GEFont>>* pFontArray = &hash_2fonts_[dwHash];
if (!pFontArray->empty())
return pFontArray->front();
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index 3957ca8..eb0061a 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -59,13 +59,13 @@
CFGAS_FontDescriptor();
~CFGAS_FontDescriptor();
- int32_t m_nFaceIndex = 0;
- uint32_t m_dwFontStyles = 0;
- WideString m_wsFaceName;
- RetainPtr<CFX_Face> m_pFace;
- std::vector<WideString> m_wsFamilyNames;
- std::array<uint32_t, 4> m_dwUsb = {};
- std::array<uint32_t, 2> m_dwCsb = {};
+ int32_t face_index_ = 0;
+ uint32_t font_styles_ = 0;
+ WideString face_name_;
+ RetainPtr<CFX_Face> face_;
+ std::vector<WideString> family_names_;
+ std::array<uint32_t, 4> usb_ = {};
+ std::array<uint32_t, 2> csb_ = {};
};
struct CFGAS_FontDescriptorInfo {
@@ -131,15 +131,15 @@
int32_t iFaceIndex);
#endif // BUILDFLAG(IS_WIN)
- std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts;
- std::set<wchar_t> m_FailedUnicodesSet;
+ std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> hash_2fonts_;
+ std::set<wchar_t> failed_unicodes_set_;
#if BUILDFLAG(IS_WIN)
- std::deque<FX_FONTDESCRIPTOR> m_FontFaces;
+ std::deque<FX_FONTDESCRIPTOR> font_faces_;
#else
- std::vector<std::unique_ptr<CFGAS_FontDescriptor>> m_InstalledFonts;
+ std::vector<std::unique_ptr<CFGAS_FontDescriptor>> installed_fonts_;
std::map<uint32_t, std::vector<CFGAS_FontDescriptorInfo>>
- m_Hash2CandidateList;
+ hash_2candidate_list_;
#endif // BUILDFLAG(IS_WIN)
};
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index dae2004..3208d5d 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -71,8 +71,9 @@
bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
FX_CodePage wCodePage) {
- if (m_pFont)
+ if (font_) {
return false;
+ }
ByteString csFontFamily;
if (pszFontFamily)
csFontFamily = WideString(pszFontFamily).ToDefANSI();
@@ -80,7 +81,7 @@
int32_t iWeight = FontStyleIsForceBold(dwFontStyles)
? pdfium::kFontWeightBold
: pdfium::kFontWeightNormal;
- m_pFont = std::make_unique<CFX_Font>();
+ font_ = std::make_unique<CFX_Font>();
if (FontStyleIsItalic(dwFontStyles) && FontStyleIsForceBold(dwFontStyles))
csFontFamily += ",BoldItalic";
else if (FontStyleIsForceBold(dwFontStyles))
@@ -88,66 +89,71 @@
else if (FontStyleIsItalic(dwFontStyles))
csFontFamily += ",Italic";
- m_pFont->LoadSubst(csFontFamily, true, dwFontStyles, iWeight, 0, wCodePage,
- false);
- return m_pFont->GetFace() && InitFont();
+ font_->LoadSubst(csFontFamily, true, dwFontStyles, iWeight, 0, wCodePage,
+ false);
+ return font_->GetFace() && InitFont();
}
#endif // BUILDFLAG(IS_WIN)
bool CFGAS_GEFont::LoadFontInternal(RetainPtr<CPDF_Font> pPDFFont) {
DCHECK(pPDFFont);
- if (m_pFont)
+ if (font_) {
return false;
+ }
- m_pPDFFont = std::move(pPDFFont); // Keep `pPDFFont` alive for the duration.
- m_pFont = m_pPDFFont->GetFont();
+ pdffont_ = std::move(pPDFFont); // Keep `pPDFFont` alive for the duration.
+ font_ = pdffont_->GetFont();
return InitFont();
}
bool CFGAS_GEFont::LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont) {
- if (m_pFont || !pInternalFont)
+ if (font_ || !pInternalFont) {
return false;
+ }
- m_pFont = std::move(pInternalFont);
+ font_ = std::move(pInternalFont);
return InitFont();
}
bool CFGAS_GEFont::InitFont() {
- if (!m_pFont)
+ if (!font_) {
return false;
+ }
- if (m_pFontEncoding)
+ if (font_encoding_) {
return true;
+ }
- m_pFontEncoding = FX_CreateFontEncodingEx(m_pFont.Get());
- return !!m_pFontEncoding;
+ font_encoding_ = FX_CreateFontEncodingEx(font_.Get());
+ return !!font_encoding_;
}
WideString CFGAS_GEFont::GetFamilyName() const {
- CFX_SubstFont* subst_font = m_pFont->GetSubstFont();
+ CFX_SubstFont* subst_font = font_->GetSubstFont();
ByteString family_name = subst_font && !subst_font->m_Family.IsEmpty()
? subst_font->m_Family
- : m_pFont->GetFamilyName();
+ : font_->GetFamilyName();
return WideString::FromDefANSI(family_name.AsStringView());
}
uint32_t CFGAS_GEFont::GetFontStyles() const {
- DCHECK(m_pFont);
- if (m_dwLogFontStyle.has_value())
- return m_dwLogFontStyle.value();
+ DCHECK(font_);
+ if (log_font_style_.has_value()) {
+ return log_font_style_.value();
+ }
uint32_t dwStyles = 0;
- auto* pSubstFont = m_pFont->GetSubstFont();
+ auto* pSubstFont = font_->GetSubstFont();
if (pSubstFont) {
if (pSubstFont->m_Weight == pdfium::kFontWeightBold) {
dwStyles |= pdfium::kFontStyleForceBold;
}
} else {
- if (m_pFont->IsBold()) {
+ if (font_->IsBold()) {
dwStyles |= pdfium::kFontStyleForceBold;
}
- if (m_pFont->IsItalic()) {
+ if (font_->IsItalic()) {
dwStyles |= pdfium::kFontStyleItalic;
}
}
@@ -155,32 +161,34 @@
}
std::optional<uint16_t> CFGAS_GEFont::GetCharWidth(wchar_t wUnicode) {
- auto it = m_CharWidthMap.find(wUnicode);
- if (it != m_CharWidthMap.end())
+ auto it = char_width_map_.find(wUnicode);
+ if (it != char_width_map_.end()) {
return it->second;
+ }
auto [glyph, pFont] = GetGlyphIndexAndFont(wUnicode, true);
if (!pFont || glyph == 0xffff) {
- m_CharWidthMap[wUnicode] = std::nullopt;
+ char_width_map_[wUnicode] = std::nullopt;
return std::nullopt;
}
if (pFont != this)
return pFont->GetCharWidth(wUnicode);
- int32_t width_from_cfx_font = m_pFont->GetGlyphWidth(glyph);
+ int32_t width_from_cfx_font = font_->GetGlyphWidth(glyph);
if (width_from_cfx_font < 0) {
- m_CharWidthMap[wUnicode] = std::nullopt;
+ char_width_map_[wUnicode] = std::nullopt;
return std::nullopt;
}
uint16_t width = static_cast<uint16_t>(width_from_cfx_font);
- m_CharWidthMap[wUnicode] = width;
+ char_width_map_[wUnicode] = width;
return width;
}
std::optional<FX_RECT> CFGAS_GEFont::GetCharBBox(wchar_t wUnicode) {
- auto it = m_BBoxMap.find(wUnicode);
- if (it != m_BBoxMap.end())
+ auto it = bbox_map_.find(wUnicode);
+ if (it != bbox_map_.end()) {
return it->second;
+ }
auto [iGlyph, pFont] = GetGlyphIndexAndFont(wUnicode, true);
if (!pFont || iGlyph == 0xFFFF)
@@ -189,9 +197,9 @@
if (pFont.Get() != this)
return pFont->GetCharBBox(wUnicode);
- std::optional<FX_RECT> rtBBox = m_pFont->GetGlyphBBox(iGlyph);
+ std::optional<FX_RECT> rtBBox = font_->GetGlyphBBox(iGlyph);
if (rtBBox.has_value())
- m_BBoxMap[wUnicode] = rtBBox.value();
+ bbox_map_[wUnicode] = rtBBox.value();
return rtBBox;
}
@@ -203,7 +211,7 @@
std::pair<int32_t, RetainPtr<CFGAS_GEFont>> CFGAS_GEFont::GetGlyphIndexAndFont(
wchar_t wUnicode,
bool bRecursive) {
- int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode);
+ int32_t iGlyphIndex = font_encoding_->GlyphFromCharCode(wUnicode);
if (iGlyphIndex > 0)
return {iGlyphIndex, pdfium::WrapRetain(this)};
@@ -215,15 +223,16 @@
if (wBitField >= 128)
return {0xFFFF, nullptr};
- auto it = m_FontMapper.find(wUnicode);
- if (it != m_FontMapper.end() && it->second && it->second.Get() != this) {
+ auto it = font_mapper_.find(wUnicode);
+ if (it != font_mapper_.end() && it->second && it->second.Get() != this) {
RetainPtr<CFGAS_GEFont> font;
std::tie(iGlyphIndex, font) =
it->second->GetGlyphIndexAndFont(wUnicode, false);
if (iGlyphIndex != 0xFFFF) {
- for (size_t i = 0; i < m_SubstFonts.size(); ++i) {
- if (m_SubstFonts[i] == it->second)
+ for (size_t i = 0; i < subst_fonts_.size(); ++i) {
+ if (subst_fonts_[i] == it->second) {
return {(iGlyphIndex | ((i + 1) << 24)), it->second};
+ }
}
}
}
@@ -241,28 +250,28 @@
if (!pFont || pFont == this) // Avoids direct cycles below.
return {0xFFFF, nullptr};
- m_FontMapper[wUnicode] = pFont;
- m_SubstFonts.push_back(pFont);
+ font_mapper_[wUnicode] = pFont;
+ subst_fonts_.push_back(pFont);
RetainPtr<CFGAS_GEFont> font;
std::tie(iGlyphIndex, font) = pFont->GetGlyphIndexAndFont(wUnicode, false);
if (iGlyphIndex == 0xFFFF)
return {0xFFFF, nullptr};
- return {(iGlyphIndex | (m_SubstFonts.size() << 24)), pFont};
+ return {(iGlyphIndex | (subst_fonts_.size() << 24)), pFont};
}
int32_t CFGAS_GEFont::GetAscent() const {
- return m_pFont->GetAscent();
+ return font_->GetAscent();
}
int32_t CFGAS_GEFont::GetDescent() const {
- return m_pFont->GetDescent();
+ return font_->GetDescent();
}
RetainPtr<CFGAS_GEFont> CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) {
iGlyphIndex = static_cast<uint32_t>(iGlyphIndex) >> 24;
if (iGlyphIndex == 0)
return pdfium::WrapRetain(this);
- return m_SubstFonts[iGlyphIndex - 1];
+ return subst_fonts_[iGlyphIndex - 1];
}
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index 7ebf2d9..83f8fc0 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -47,10 +47,10 @@
std::optional<FX_RECT> GetCharBBox(wchar_t wUnicode);
RetainPtr<CFGAS_GEFont> GetSubstFont(int32_t iGlyphIndex);
- CFX_Font* GetDevFont() const { return m_pFont.Get(); }
+ CFX_Font* GetDevFont() const { return font_.Get(); }
void SetLogicalFontStyle(uint32_t dwLogFontStyle) {
- m_dwLogFontStyle = dwLogFontStyle;
+ log_font_style_ = dwLogFontStyle;
}
private:
@@ -70,14 +70,14 @@
bool bRecursive);
WideString GetFamilyName() const;
- std::optional<uint32_t> m_dwLogFontStyle;
- RetainPtr<CPDF_Font> m_pPDFFont; // Must come before |m_pFont|.
- MaybeOwned<CFX_Font> m_pFont; // Must come before |m_pFontEncoding|.
- std::unique_ptr<CFX_UnicodeEncodingEx> m_pFontEncoding;
- std::map<wchar_t, std::optional<uint16_t>> m_CharWidthMap;
- std::map<wchar_t, FX_RECT> m_BBoxMap;
- std::vector<RetainPtr<CFGAS_GEFont>> m_SubstFonts;
- std::map<wchar_t, RetainPtr<CFGAS_GEFont>> m_FontMapper;
+ std::optional<uint32_t> log_font_style_;
+ RetainPtr<CPDF_Font> pdffont_; // Must come before |font_|.
+ MaybeOwned<CFX_Font> font_; // Must come before |font_encoding_|.
+ std::unique_ptr<CFX_UnicodeEncodingEx> font_encoding_;
+ std::map<wchar_t, std::optional<uint16_t>> char_width_map_;
+ std::map<wchar_t, FX_RECT> bbox_map_;
+ std::vector<RetainPtr<CFGAS_GEFont>> subst_fonts_;
+ std::map<wchar_t, RetainPtr<CFGAS_GEFont>> font_mapper_;
};
#endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index dd89b0f..821b98a 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -124,7 +124,7 @@
} // namespace
-CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(const CPDF_Document* pDoc) : m_pDoc(pDoc) {
+CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(const CPDF_Document* pDoc) : doc_(pDoc) {
DCHECK(pDoc);
}
@@ -135,7 +135,7 @@
bool bItalic,
bool bStrictMatch) {
RetainPtr<const CPDF_Dictionary> pFontSetDict =
- m_pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
+ doc_->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
if (!pFontSetDict) {
return nullptr;
}
@@ -148,7 +148,7 @@
ByteString name = strPsName;
name.Remove(' ');
- auto* pData = CPDF_DocPageData::FromDocument(m_pDoc);
+ auto* pData = CPDF_DocPageData::FromDocument(doc_);
CPDF_DictionaryLocker locker(pFontSetDict);
for (const auto& it : locker) {
const ByteString& key = it.first;
@@ -178,8 +178,8 @@
uint32_t dwFontStyles,
bool bStrictMatch) {
auto key = std::make_pair(wsFontFamily, dwFontStyles);
- auto it = m_FontMap.find(key);
- if (it != m_FontMap.end()) {
+ auto it = font_map_.find(key);
+ if (it != font_map_.end()) {
return it->second;
}
@@ -193,6 +193,6 @@
return nullptr;
}
- m_FontMap[key] = pFont;
+ font_map_[key] = pFont;
return pFont;
}
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h
index f022aa2..237a9ed 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.h
+++ b/xfa/fgas/font/cfgas_pdffontmgr.h
@@ -33,8 +33,8 @@
bool bItalic,
bool bStrictMatch);
- UnownedPtr<const CPDF_Document> const m_pDoc;
- std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> m_FontMap;
+ UnownedPtr<const CPDF_Document> const doc_;
+ std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> font_map_;
};
#endif // XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_
diff --git a/xfa/fgas/graphics/cfgas_gecolor.cpp b/xfa/fgas/graphics/cfgas_gecolor.cpp
index 685118e..a94004a 100644
--- a/xfa/fgas/graphics/cfgas_gecolor.cpp
+++ b/xfa/fgas/graphics/cfgas_gecolor.cpp
@@ -6,13 +6,13 @@
#include "xfa/fgas/graphics/cfgas_gecolor.h"
-CFGAS_GEColor::CFGAS_GEColor(FX_ARGB argb) : m_type(Solid), m_argb(argb) {}
+CFGAS_GEColor::CFGAS_GEColor(FX_ARGB argb) : type_(Solid), argb_(argb) {}
CFGAS_GEColor::CFGAS_GEColor(CFGAS_GEPattern* pattern, FX_ARGB argb)
- : m_type(Pattern), m_argb(argb), m_pPattern(pattern) {}
+ : type_(Pattern), argb_(argb), pattern_(pattern) {}
CFGAS_GEColor::CFGAS_GEColor(CFGAS_GEShading* shading)
- : m_type(Shading), m_pShading(shading) {}
+ : type_(Shading), shading_(shading) {}
CFGAS_GEColor::CFGAS_GEColor(const CFGAS_GEColor& that) = default;
diff --git a/xfa/fgas/graphics/cfgas_gecolor.h b/xfa/fgas/graphics/cfgas_gecolor.h
index 6ccebc4..19c0637 100644
--- a/xfa/fgas/graphics/cfgas_gecolor.h
+++ b/xfa/fgas/graphics/cfgas_gecolor.h
@@ -26,18 +26,18 @@
CFGAS_GEColor(const CFGAS_GEColor& that);
~CFGAS_GEColor();
- Type GetType() const { return m_type; }
+ Type GetType() const { return type_; }
FX_ARGB GetArgb() const {
- DCHECK(m_type == Solid || m_type == Pattern);
- return m_argb;
+ DCHECK(type_ == Solid || type_ == Pattern);
+ return argb_;
}
CFGAS_GEPattern* GetPattern() const {
- DCHECK_EQ(m_type, Pattern);
- return m_pPattern;
+ DCHECK_EQ(type_, Pattern);
+ return pattern_;
}
CFGAS_GEShading* GetShading() const {
- DCHECK_EQ(m_type, Shading);
- return m_pShading;
+ DCHECK_EQ(type_, Shading);
+ return shading_;
}
CFGAS_GEColor& operator=(const CFGAS_GEColor& that);
@@ -45,10 +45,10 @@
static ByteString ColorToString(FX_ARGB argb);
private:
- Type m_type = Invalid;
- FX_ARGB m_argb = 0;
- UnownedPtr<CFGAS_GEPattern> m_pPattern;
- UnownedPtr<CFGAS_GEShading> m_pShading;
+ Type type_ = Invalid;
+ FX_ARGB argb_ = 0;
+ UnownedPtr<CFGAS_GEPattern> pattern_;
+ UnownedPtr<CFGAS_GEShading> shading_;
};
#endif // XFA_FGAS_GRAPHICS_CFGAS_GECOLOR_H_
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index b9d11a5..af82d7a 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -117,58 +117,58 @@
} // namespace
CFGAS_GEGraphics::CFGAS_GEGraphics(CFX_RenderDevice* renderDevice)
- : m_renderDevice(renderDevice) {
- DCHECK(m_renderDevice);
+ : render_device_(renderDevice) {
+ DCHECK(render_device_);
}
CFGAS_GEGraphics::~CFGAS_GEGraphics() = default;
void CFGAS_GEGraphics::SaveGraphState() {
- m_renderDevice->SaveState();
- m_infoStack.push_back(std::make_unique<TInfo>(m_info));
+ render_device_->SaveState();
+ info_stack_.push_back(std::make_unique<TInfo>(info_));
}
void CFGAS_GEGraphics::RestoreGraphState() {
- m_renderDevice->RestoreState(false);
- CHECK(!m_infoStack.empty());
- m_info = *m_infoStack.back();
- m_infoStack.pop_back();
+ render_device_->RestoreState(false);
+ CHECK(!info_stack_.empty());
+ info_ = *info_stack_.back();
+ info_stack_.pop_back();
return;
}
void CFGAS_GEGraphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) {
- m_info.graphState.set_line_cap(lineCap);
+ info_.graphState.set_line_cap(lineCap);
}
void CFGAS_GEGraphics::SetLineDash(std::vector<float> dash_array) {
// For `dash_array` to be empty, call SetSolidLineDash() instead.
CHECK(!dash_array.empty());
- const float scale = m_info.isActOnDash ? m_info.graphState.line_width() : 1.0;
+ const float scale = info_.isActOnDash ? info_.graphState.line_width() : 1.0;
for (float& f : dash_array) {
f *= scale;
}
- m_info.graphState.set_dash_array(std::move(dash_array));
- m_info.graphState.set_dash_phase(0);
+ info_.graphState.set_dash_array(std::move(dash_array));
+ info_.graphState.set_dash_phase(0);
}
void CFGAS_GEGraphics::SetSolidLineDash() {
- m_info.graphState.set_dash_array({});
+ info_.graphState.set_dash_array({});
}
void CFGAS_GEGraphics::SetLineWidth(float lineWidth) {
- m_info.graphState.set_line_width(lineWidth);
+ info_.graphState.set_line_width(lineWidth);
}
void CFGAS_GEGraphics::EnableActOnDash() {
- m_info.isActOnDash = true;
+ info_.isActOnDash = true;
}
void CFGAS_GEGraphics::SetStrokeColor(const CFGAS_GEColor& color) {
- m_info.strokeColor = color;
+ info_.strokeColor = color;
}
void CFGAS_GEGraphics::SetFillColor(const CFGAS_GEColor& color) {
- m_info.fillColor = color;
+ info_.fillColor = color;
}
void CFGAS_GEGraphics::StrokePath(const CFGAS_GEPath& path,
@@ -183,37 +183,38 @@
}
void CFGAS_GEGraphics::ConcatMatrix(const CFX_Matrix& matrix) {
- m_info.CTM.Concat(matrix);
+ info_.CTM.Concat(matrix);
}
const CFX_Matrix* CFGAS_GEGraphics::GetMatrix() const {
- return &m_info.CTM;
+ return &info_.CTM;
}
CFX_RectF CFGAS_GEGraphics::GetClipRect() const {
- FX_RECT r = m_renderDevice->GetClipBox();
+ FX_RECT r = render_device_->GetClipBox();
return CFX_RectF(r.left, r.top, r.Width(), r.Height());
}
void CFGAS_GEGraphics::SetClipRect(const CFX_RectF& rect) {
- m_renderDevice->SetClip_Rect(
+ render_device_->SetClip_Rect(
FX_RECT(FXSYS_roundf(rect.left), FXSYS_roundf(rect.top),
FXSYS_roundf(rect.right()), FXSYS_roundf(rect.bottom())));
}
CFX_RenderDevice* CFGAS_GEGraphics::GetRenderDevice() {
- return m_renderDevice;
+ return render_device_;
}
void CFGAS_GEGraphics::RenderDeviceStrokePath(const CFGAS_GEPath& path,
const CFX_Matrix& matrix) {
- if (m_info.strokeColor.GetType() != CFGAS_GEColor::Solid)
+ if (info_.strokeColor.GetType() != CFGAS_GEColor::Solid) {
return;
+ }
- CFX_Matrix m = m_info.CTM;
+ CFX_Matrix m = info_.CTM;
m.Concat(matrix);
- m_renderDevice->DrawPath(path.GetPath(), &m, &m_info.graphState, 0x0,
- m_info.strokeColor.GetArgb(),
+ render_device_->DrawPath(path.GetPath(), &m, &info_.graphState, 0x0,
+ info_.strokeColor.GetArgb(),
CFX_FillRenderOptions());
}
@@ -221,14 +222,14 @@
const CFGAS_GEPath& path,
CFX_FillRenderOptions::FillType fill_type,
const CFX_Matrix& matrix) {
- CFX_Matrix m = m_info.CTM;
+ CFX_Matrix m = info_.CTM;
m.Concat(matrix);
const CFX_FillRenderOptions fill_options(fill_type);
- switch (m_info.fillColor.GetType()) {
+ switch (info_.fillColor.GetType()) {
case CFGAS_GEColor::Solid:
- m_renderDevice->DrawPath(path.GetPath(), &m, &m_info.graphState,
- m_info.fillColor.GetArgb(), 0x0, fill_options);
+ render_device_->DrawPath(path.GetPath(), &m, &info_.graphState,
+ info_.fillColor.GetArgb(), 0x0, fill_options);
return;
case CFGAS_GEColor::Pattern:
FillPathWithPattern(path, fill_options, m);
@@ -245,17 +246,17 @@
const CFGAS_GEPath& path,
const CFX_FillRenderOptions& fill_options,
const CFX_Matrix& matrix) {
- RetainPtr<const CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
+ RetainPtr<const CFX_DIBitmap> bitmap = render_device_->GetBitmap();
int32_t width = bitmap->GetWidth();
int32_t height = bitmap->GetHeight();
auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/355630556): Consider adding support for
// `FXDIB_Format::kBgraPremul`
CHECK(bmp->Create(width, height, FXDIB_Format::kBgra));
- m_renderDevice->GetDIBits(bmp, 0, 0);
+ render_device_->GetDIBits(bmp, 0, 0);
CFGAS_GEPattern::HatchStyle hatchStyle =
- m_info.fillColor.GetPattern()->GetHatchStyle();
+ info_.fillColor.GetPattern()->GetHatchStyle();
const FX_HATCHDATA& data =
GetHatchBitmapData(static_cast<size_t>(hatchStyle));
@@ -270,15 +271,15 @@
CFX_DefaultRenderDevice device;
device.Attach(bmp);
- device.FillRect(rect, m_info.fillColor.GetPattern()->GetBackArgb());
+ device.FillRect(rect, info_.fillColor.GetPattern()->GetBackArgb());
for (int32_t j = rect.bottom; j < rect.top; j += mask->GetHeight()) {
for (int32_t i = rect.left; i < rect.right; i += mask->GetWidth()) {
device.SetBitMask(mask, i, j,
- m_info.fillColor.GetPattern()->GetForeArgb());
+ info_.fillColor.GetPattern()->GetForeArgb());
}
}
- CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
- m_renderDevice->SetClip_PathFill(path.GetPath(), &matrix, fill_options);
+ CFX_RenderDevice::StateRestorer restorer(render_device_);
+ render_device_->SetClip_PathFill(path.GetPath(), &matrix, fill_options);
SetDIBitsWithMatrix(std::move(bmp), CFX_Matrix());
}
@@ -286,20 +287,20 @@
const CFGAS_GEPath& path,
const CFX_FillRenderOptions& fill_options,
const CFX_Matrix& matrix) {
- RetainPtr<const CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
+ RetainPtr<const CFX_DIBitmap> bitmap = render_device_->GetBitmap();
int32_t width = bitmap->GetWidth();
int32_t height = bitmap->GetHeight();
- float start_x = m_info.fillColor.GetShading()->GetBeginPoint().x;
- float start_y = m_info.fillColor.GetShading()->GetBeginPoint().y;
- float end_x = m_info.fillColor.GetShading()->GetEndPoint().x;
- float end_y = m_info.fillColor.GetShading()->GetEndPoint().y;
+ float start_x = info_.fillColor.GetShading()->GetBeginPoint().x;
+ float start_y = info_.fillColor.GetShading()->GetBeginPoint().y;
+ float end_x = info_.fillColor.GetShading()->GetEndPoint().x;
+ float end_y = info_.fillColor.GetShading()->GetEndPoint().y;
auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/355630556): Consider adding support for
// `FXDIB_Format::kBgraPremul`
CHECK(bmp->Create(width, height, FXDIB_Format::kBgra));
- m_renderDevice->GetDIBits(bmp, 0, 0);
+ render_device_->GetDIBits(bmp, 0, 0);
bool result = false;
- switch (m_info.fillColor.GetShading()->GetType()) {
+ switch (info_.fillColor.GetShading()->GetType()) {
case CFGAS_GEShading::Type::kAxial: {
float x_span = end_x - start_x;
float y_span = end_y - start_y;
@@ -314,24 +315,26 @@
scale = (((x - start_x) * x_span) + ((y - start_y) * y_span)) /
axis_len_square;
if (isnan(scale) || scale < 0.0f) {
- if (!m_info.fillColor.GetShading()->IsExtendedBegin())
+ if (!info_.fillColor.GetShading()->IsExtendedBegin()) {
continue;
+ }
scale = 0.0f;
} else if (scale > 1.0f) {
- if (!m_info.fillColor.GetShading()->IsExtendedEnd())
+ if (!info_.fillColor.GetShading()->IsExtendedEnd()) {
continue;
+ }
scale = 1.0f;
}
}
- dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(scale);
+ dib_buf[column] = info_.fillColor.GetShading()->GetArgb(scale);
}
}
result = true;
break;
}
case CFGAS_GEShading::Type::kRadial: {
- float start_r = m_info.fillColor.GetShading()->GetBeginRadius();
- float end_r = m_info.fillColor.GetShading()->GetEndRadius();
+ float start_r = info_.fillColor.GetShading()->GetBeginRadius();
+ float end_r = info_.fillColor.GetShading()->GetEndRadius();
float a = ((start_x - end_x) * (start_x - end_x)) +
((start_y - end_y) * (start_y - end_y)) -
((start_r - end_r) * (start_r - end_r));
@@ -363,7 +366,7 @@
s2 = (-b - root) / (2 * a);
s1 = (-b + root) / (2 * a);
}
- if (s2 <= 1.0f || m_info.fillColor.GetShading()->IsExtendedEnd()) {
+ if (s2 <= 1.0f || info_.fillColor.GetShading()->IsExtendedEnd()) {
s = (s2);
} else {
s = (s1);
@@ -373,16 +376,18 @@
}
}
if (isnan(s) || s < 0.0f) {
- if (!m_info.fillColor.GetShading()->IsExtendedBegin())
+ if (!info_.fillColor.GetShading()->IsExtendedBegin()) {
continue;
+ }
s = 0.0f;
}
if (s > 1.0f) {
- if (!m_info.fillColor.GetShading()->IsExtendedEnd())
+ if (!info_.fillColor.GetShading()->IsExtendedEnd()) {
continue;
+ }
s = 1.0f;
}
- dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(s);
+ dib_buf[column] = info_.fillColor.GetShading()->GetArgb(s);
}
}
result = true;
@@ -390,8 +395,8 @@
}
}
if (result) {
- CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
- m_renderDevice->SetClip_PathFill(path.GetPath(), &matrix, fill_options);
+ CFX_RenderDevice::StateRestorer restorer(render_device_);
+ render_device_->SetClip_PathFill(path.GetPath(), &matrix, fill_options);
SetDIBitsWithMatrix(std::move(bmp), matrix);
}
}
@@ -399,7 +404,7 @@
void CFGAS_GEGraphics::SetDIBitsWithMatrix(RetainPtr<CFX_DIBBase> source,
const CFX_Matrix& matrix) {
if (matrix.IsIdentity()) {
- m_renderDevice->SetDIBits(source, 0, 0);
+ render_device_->SetDIBits(source, 0, 0);
} else {
CFX_Matrix m((float)source->GetWidth(), 0, 0, (float)source->GetHeight(), 0,
0);
@@ -408,7 +413,7 @@
int32_t top;
RetainPtr<CFX_DIBitmap> bmp1 = source->FlipImage(false, true);
RetainPtr<CFX_DIBitmap> bmp2 = bmp1->TransformTo(m, &left, &top);
- m_renderDevice->SetDIBits(bmp2, left, top);
+ render_device_->SetDIBits(bmp2, left, top);
}
}
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.h b/xfa/fgas/graphics/cfgas_gegraphics.h
index 6dfd1d0..1426f20 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.h
+++ b/xfa/fgas/graphics/cfgas_gegraphics.h
@@ -87,9 +87,9 @@
void SetDIBitsWithMatrix(RetainPtr<CFX_DIBBase> source,
const CFX_Matrix& matrix);
- UnownedPtr<CFX_RenderDevice> const m_renderDevice;
- TInfo m_info;
- std::vector<std::unique_ptr<TInfo>> m_infoStack;
+ UnownedPtr<CFX_RenderDevice> const render_device_;
+ TInfo info_;
+ std::vector<std::unique_ptr<TInfo>> info_stack_;
};
#endif // XFA_FGAS_GRAPHICS_CFGAS_GEGRAPHICS_H_
diff --git a/xfa/fgas/graphics/cfgas_gepattern.cpp b/xfa/fgas/graphics/cfgas_gepattern.cpp
index e3d6000..fe2d596 100644
--- a/xfa/fgas/graphics/cfgas_gepattern.cpp
+++ b/xfa/fgas/graphics/cfgas_gepattern.cpp
@@ -9,6 +9,6 @@
CFGAS_GEPattern::CFGAS_GEPattern(HatchStyle hatchStyle,
FX_ARGB foreArgb,
FX_ARGB backArgb)
- : m_hatchStyle(hatchStyle), m_foreArgb(foreArgb), m_backArgb(backArgb) {}
+ : hatch_style_(hatchStyle), fore_argb_(foreArgb), back_argb_(backArgb) {}
CFGAS_GEPattern::~CFGAS_GEPattern() = default;
diff --git a/xfa/fgas/graphics/cfgas_gepattern.h b/xfa/fgas/graphics/cfgas_gepattern.h
index c04c3ac..d2066bf 100644
--- a/xfa/fgas/graphics/cfgas_gepattern.h
+++ b/xfa/fgas/graphics/cfgas_gepattern.h
@@ -23,14 +23,14 @@
CFGAS_GEPattern(HatchStyle hatchStyle, FX_ARGB foreArgb, FX_ARGB backArgb);
~CFGAS_GEPattern();
- HatchStyle GetHatchStyle() const { return m_hatchStyle; }
- FX_ARGB GetForeArgb() const { return m_foreArgb; }
- FX_ARGB GetBackArgb() const { return m_backArgb; }
+ HatchStyle GetHatchStyle() const { return hatch_style_; }
+ FX_ARGB GetForeArgb() const { return fore_argb_; }
+ FX_ARGB GetBackArgb() const { return back_argb_; }
private:
- const HatchStyle m_hatchStyle;
- const FX_ARGB m_foreArgb;
- const FX_ARGB m_backArgb;
+ const HatchStyle hatch_style_;
+ const FX_ARGB fore_argb_;
+ const FX_ARGB back_argb_;
};
#endif // XFA_FGAS_GRAPHICS_CFGAS_GEPATTERN_H_
diff --git a/xfa/fgas/graphics/cfgas_geshading.cpp b/xfa/fgas/graphics/cfgas_geshading.cpp
index f220d43..941e814 100644
--- a/xfa/fgas/graphics/cfgas_geshading.cpp
+++ b/xfa/fgas/graphics/cfgas_geshading.cpp
@@ -12,13 +12,13 @@
bool isExtendedEnd,
FX_ARGB beginArgb,
FX_ARGB endArgb)
- : m_type(Type::kAxial),
- m_beginPoint(beginPoint),
- m_endPoint(endPoint),
- m_beginRadius(0),
- m_endRadius(0),
- m_isExtendedBegin(isExtendedBegin),
- m_isExtendedEnd(isExtendedEnd) {
+ : type_(Type::kAxial),
+ begin_point_(beginPoint),
+ end_point_(endPoint),
+ begin_radius_(0),
+ end_radius_(0),
+ is_extended_begin_(isExtendedBegin),
+ is_extended_end_(isExtendedEnd) {
InitArgbArray(beginArgb, endArgb);
}
@@ -30,13 +30,13 @@
bool isExtendedEnd,
FX_ARGB beginArgb,
FX_ARGB endArgb)
- : m_type(Type::kRadial),
- m_beginPoint(beginPoint),
- m_endPoint(endPoint),
- m_beginRadius(beginRadius),
- m_endRadius(endRadius),
- m_isExtendedBegin(isExtendedBegin),
- m_isExtendedEnd(isExtendedEnd) {
+ : type_(Type::kRadial),
+ begin_point_(beginPoint),
+ end_point_(endPoint),
+ begin_radius_(beginRadius),
+ end_radius_(endRadius),
+ is_extended_begin_(isExtendedBegin),
+ is_extended_end_(isExtendedEnd) {
InitArgbArray(beginArgb, endArgb);
}
@@ -53,7 +53,7 @@
const float b_scale = 1.0 * (bgra1.blue - bgra0.blue) / f;
for (size_t i = 0; i < kSteps; i++) {
- m_argbArray[i] = ArgbEncode(static_cast<int32_t>(i * a_scale) + bgra0.alpha,
+ argb_array_[i] = ArgbEncode(static_cast<int32_t>(i * a_scale) + bgra0.alpha,
static_cast<int32_t>(i * r_scale) + bgra0.red,
static_cast<int32_t>(i * g_scale) + bgra0.green,
static_cast<int32_t>(i * b_scale) + bgra0.blue);
diff --git a/xfa/fgas/graphics/cfgas_geshading.h b/xfa/fgas/graphics/cfgas_geshading.h
index 0ceeb14..dfb7bb1 100644
--- a/xfa/fgas/graphics/cfgas_geshading.h
+++ b/xfa/fgas/graphics/cfgas_geshading.h
@@ -38,15 +38,15 @@
~CFGAS_GEShading();
- Type GetType() const { return m_type; }
- CFX_PointF GetBeginPoint() const { return m_beginPoint; }
- CFX_PointF GetEndPoint() const { return m_endPoint; }
- float GetBeginRadius() const { return m_beginRadius; }
- float GetEndRadius() const { return m_endRadius; }
- bool IsExtendedBegin() const { return m_isExtendedBegin; }
- bool IsExtendedEnd() const { return m_isExtendedEnd; }
+ Type GetType() const { return type_; }
+ CFX_PointF GetBeginPoint() const { return begin_point_; }
+ CFX_PointF GetEndPoint() const { return end_point_; }
+ float GetBeginRadius() const { return begin_radius_; }
+ float GetEndRadius() const { return end_radius_; }
+ bool IsExtendedBegin() const { return is_extended_begin_; }
+ bool IsExtendedEnd() const { return is_extended_end_; }
FX_ARGB GetArgb(float value) const {
- return m_argbArray[static_cast<size_t>(value * (kSteps - 1))];
+ return argb_array_[static_cast<size_t>(value * (kSteps - 1))];
}
private:
@@ -54,14 +54,14 @@
void InitArgbArray(FX_ARGB begin_argb, FX_ARGB end_argb);
- const Type m_type;
- const CFX_PointF m_beginPoint;
- const CFX_PointF m_endPoint;
- const float m_beginRadius;
- const float m_endRadius;
- const bool m_isExtendedBegin;
- const bool m_isExtendedEnd;
- std::array<FX_ARGB, kSteps> m_argbArray;
+ const Type type_;
+ const CFX_PointF begin_point_;
+ const CFX_PointF end_point_;
+ const float begin_radius_;
+ const float end_radius_;
+ const bool is_extended_begin_;
+ const bool is_extended_end_;
+ std::array<FX_ARGB, kSteps> argb_array_;
};
#endif // XFA_FGAS_GRAPHICS_CFGAS_GESHADING_H_
diff --git a/xfa/fgas/layout/cfgas_break.cpp b/xfa/fgas/layout/cfgas_break.cpp
index 23f2320..f26bd3f 100644
--- a/xfa/fgas/layout/cfgas_break.cpp
+++ b/xfa/fgas/layout/cfgas_break.cpp
@@ -18,69 +18,75 @@
const int CFGAS_Break::kMinimumTabWidth = 160000;
CFGAS_Break::CFGAS_Break(Mask<LayoutStyle> dwLayoutStyles)
- : m_dwLayoutStyles(dwLayoutStyles), m_pCurLine(&m_Lines[0]) {}
+ : layout_styles_(dwLayoutStyles), cur_line_(&lines_[0]) {}
CFGAS_Break::~CFGAS_Break() = default;
void CFGAS_Break::Reset() {
- m_eCharType = FX_CHARTYPE::kUnknown;
- for (CFGAS_BreakLine& line : m_Lines)
+ char_type_ = FX_CHARTYPE::kUnknown;
+ for (CFGAS_BreakLine& line : lines_) {
line.Clear();
+ }
}
void CFGAS_Break::SetLayoutStyles(Mask<LayoutStyle> dwLayoutStyles) {
- m_dwLayoutStyles = dwLayoutStyles;
- m_bSingleLine = !!(m_dwLayoutStyles & LayoutStyle::kSingleLine);
- m_bCombText = !!(m_dwLayoutStyles & LayoutStyle::kCombText);
+ layout_styles_ = dwLayoutStyles;
+ single_line_ = !!(layout_styles_ & LayoutStyle::kSingleLine);
+ comb_text_ = !!(layout_styles_ & LayoutStyle::kCombText);
}
void CFGAS_Break::SetHorizontalScale(int32_t iScale) {
iScale = std::max(iScale, 0);
- if (m_iHorizontalScale == iScale)
+ if (horizontal_scale_ == iScale) {
return;
+ }
SetBreakStatus();
- m_iHorizontalScale = iScale;
+ horizontal_scale_ = iScale;
}
void CFGAS_Break::SetVerticalScale(int32_t iScale) {
if (iScale < 0)
iScale = 0;
- if (m_iVerticalScale == iScale)
+ if (vertical_scale_ == iScale) {
return;
+ }
SetBreakStatus();
- m_iVerticalScale = iScale;
+ vertical_scale_ = iScale;
}
void CFGAS_Break::SetFont(RetainPtr<CFGAS_GEFont> pFont) {
- if (!pFont || pFont == m_pFont)
+ if (!pFont || pFont == font_) {
return;
+ }
SetBreakStatus();
- m_pFont = std::move(pFont);
+ font_ = std::move(pFont);
}
void CFGAS_Break::SetFontSize(float fFontSize) {
int32_t iFontSize = FXSYS_roundf(fFontSize * 20.0f);
- if (m_iFontSize == iFontSize)
+ if (font_size_ == iFontSize) {
return;
+ }
SetBreakStatus();
- m_iFontSize = iFontSize;
+ font_size_ = iFontSize;
}
void CFGAS_Break::SetBreakStatus() {
- ++m_dwIdentity;
+ ++identity_;
- CFGAS_Char* tc = m_pCurLine->LastChar();
- if (tc && tc->m_dwStatus == CFGAS_Char::BreakType::kNone)
- tc->m_dwStatus = CFGAS_Char::BreakType::kPiece;
+ CFGAS_Char* tc = cur_line_->LastChar();
+ if (tc && tc->status_ == CFGAS_Char::BreakType::kNone) {
+ tc->status_ = CFGAS_Char::BreakType::kPiece;
+ }
}
bool CFGAS_Break::IsGreaterThanLineWidth(int32_t width) const {
- FX_SAFE_INT32 line_width = m_iLineWidth;
- line_width += m_iTolerance;
+ FX_SAFE_INT32 line_width = line_width_;
+ line_width += tolerance_;
return line_width.IsValid() && width > line_width.ValueOrDie();
}
@@ -92,45 +98,45 @@
// Note, the use of max here was only done in the TxtBreak code. Leaving this
// in for the RTFBreak code for consistency. If we see issues with tab widths
// we may need to fix this.
- m_iTabWidth =
+ tab_width_ =
std::max(FXSYS_roundf(fTabWidth * kConversionFactor), kMinimumTabWidth);
}
void CFGAS_Break::SetParagraphBreakChar(wchar_t wch) {
if (wch != L'\r' && wch != L'\n')
return;
- m_wParagraphBreakChar = wch;
+ w_paragraph_break_char_ = wch;
}
void CFGAS_Break::SetLineBreakTolerance(float fTolerance) {
- m_iTolerance = FXSYS_roundf(fTolerance * kConversionFactor);
+ tolerance_ = FXSYS_roundf(fTolerance * kConversionFactor);
}
void CFGAS_Break::SetCharSpace(float fCharSpace) {
- m_iCharSpace = FXSYS_roundf(fCharSpace * kConversionFactor);
+ char_space_ = FXSYS_roundf(fCharSpace * kConversionFactor);
}
void CFGAS_Break::SetLineBoundary(float fLineStart, float fLineEnd) {
if (fLineStart > fLineEnd)
return;
- m_iLineStart = FXSYS_roundf(fLineStart * kConversionFactor);
- m_iLineWidth = FXSYS_roundf(fLineEnd * kConversionFactor);
- m_pCurLine->m_iStart = std::min(m_pCurLine->m_iStart, m_iLineWidth);
- m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iLineStart);
+ line_start_ = FXSYS_roundf(fLineStart * kConversionFactor);
+ line_width_ = FXSYS_roundf(fLineEnd * kConversionFactor);
+ cur_line_->start_ = std::min(cur_line_->start_, line_width_);
+ cur_line_->start_ = std::max(cur_line_->start_, line_start_);
}
CFGAS_Char* CFGAS_Break::GetLastChar(int32_t index,
bool bOmitChar,
bool bRichText) const {
- std::vector<CFGAS_Char>& tca = m_pCurLine->m_LineChars;
+ std::vector<CFGAS_Char>& tca = cur_line_->line_chars_;
if (!fxcrt::IndexInBounds(tca, index))
return nullptr;
int32_t iStart = fxcrt::CollectionSize<int32_t>(tca) - 1;
while (iStart > -1) {
CFGAS_Char* pTC = &tca[iStart--];
- if (((bRichText && pTC->m_iCharWidth < 0) || bOmitChar) &&
+ if (((bRichText && pTC->char_width_ < 0) || bOmitChar) &&
pTC->GetCharType() == FX_CHARTYPE::kCombination) {
continue;
}
@@ -142,7 +148,7 @@
int32_t CFGAS_Break::CountBreakPieces() const {
return HasLine() ? fxcrt::CollectionSize<int32_t>(
- m_Lines[m_iReadyLineIndex].m_LinePieces)
+ lines_[ready_line_index_].line_pieces_)
: 0;
}
@@ -150,13 +156,14 @@
int32_t index) const {
if (!HasLine())
return nullptr;
- if (!fxcrt::IndexInBounds(m_Lines[m_iReadyLineIndex].m_LinePieces, index))
+ if (!fxcrt::IndexInBounds(lines_[ready_line_index_].line_pieces_, index)) {
return nullptr;
- return &m_Lines[m_iReadyLineIndex].m_LinePieces[index];
+ }
+ return &lines_[ready_line_index_].line_pieces_[index];
}
void CFGAS_Break::ClearBreakPieces() {
if (HasLine())
- m_Lines[m_iReadyLineIndex].Clear();
- m_iReadyLineIndex = -1;
+ lines_[ready_line_index_].Clear();
+ ready_line_index_ = -1;
}
diff --git a/xfa/fgas/layout/cfgas_break.h b/xfa/fgas/layout/cfgas_break.h
index eb61d32..b82b74f 100644
--- a/xfa/fgas/layout/cfgas_break.h
+++ b/xfa/fgas/layout/cfgas_break.h
@@ -33,12 +33,12 @@
void Reset();
void SetLayoutStyles(Mask<LayoutStyle> dwLayoutStyles);
- Mask<LayoutStyle> GetLayoutStyles() const { return m_dwLayoutStyles; }
+ Mask<LayoutStyle> GetLayoutStyles() const { return layout_styles_; }
void SetFont(RetainPtr<CFGAS_GEFont> pFont);
void SetFontSize(float fFontSize);
void SetTabWidth(float fTabWidth);
- int32_t GetTabWidth() const { return m_iTabWidth; }
+ int32_t GetTabWidth() const { return tab_width_; }
void SetHorizontalScale(int32_t iScale);
void SetVerticalScale(int32_t iScale);
@@ -53,7 +53,7 @@
void ClearBreakPieces();
CFGAS_Char* GetLastChar(int32_t index, bool bOmitChar, bool bRichText) const;
- const CFGAS_BreakLine* GetCurrentLineForTesting() const { return m_pCurLine; }
+ const CFGAS_BreakLine* GetCurrentLineForTesting() const { return cur_line_; }
protected:
struct TPO {
@@ -69,28 +69,28 @@
explicit CFGAS_Break(Mask<LayoutStyle> dwLayoutStyles);
void SetBreakStatus();
- bool HasLine() const { return m_iReadyLineIndex >= 0; }
+ bool HasLine() const { return ready_line_index_ >= 0; }
bool IsGreaterThanLineWidth(int32_t width) const;
FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const;
- FX_CHARTYPE m_eCharType = FX_CHARTYPE::kUnknown;
- bool m_bSingleLine = false;
- bool m_bCombText = false;
- Mask<LayoutStyle> m_dwLayoutStyles = LayoutStyle::kNone;
- uint32_t m_dwIdentity = 0;
- int32_t m_iLineStart = 0;
- int32_t m_iLineWidth = 2000000;
- wchar_t m_wParagraphBreakChar = L'\n';
- int32_t m_iFontSize = 240;
- int32_t m_iTabWidth = 720000;
- int32_t m_iHorizontalScale = 100;
- int32_t m_iVerticalScale = 100;
- int32_t m_iTolerance = 0;
- int32_t m_iCharSpace = 0;
- RetainPtr<CFGAS_GEFont> m_pFont;
- int8_t m_iReadyLineIndex = -1;
- std::array<CFGAS_BreakLine, 2> m_Lines;
- UnownedPtr<CFGAS_BreakLine> m_pCurLine;
+ FX_CHARTYPE char_type_ = FX_CHARTYPE::kUnknown;
+ bool single_line_ = false;
+ bool comb_text_ = false;
+ Mask<LayoutStyle> layout_styles_ = LayoutStyle::kNone;
+ uint32_t identity_ = 0;
+ int32_t line_start_ = 0;
+ int32_t line_width_ = 2000000;
+ wchar_t w_paragraph_break_char_ = L'\n';
+ int32_t font_size_ = 240;
+ int32_t tab_width_ = 720000;
+ int32_t horizontal_scale_ = 100;
+ int32_t vertical_scale_ = 100;
+ int32_t tolerance_ = 0;
+ int32_t char_space_ = 0;
+ RetainPtr<CFGAS_GEFont> font_;
+ int8_t ready_line_index_ = -1;
+ std::array<CFGAS_BreakLine, 2> lines_;
+ UnownedPtr<CFGAS_BreakLine> cur_line_;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_BREAK_H_
diff --git a/xfa/fgas/layout/cfgas_breakline.cpp b/xfa/fgas/layout/cfgas_breakline.cpp
index 7d46e75..e07cbbd 100644
--- a/xfa/fgas/layout/cfgas_breakline.cpp
+++ b/xfa/fgas/layout/cfgas_breakline.cpp
@@ -14,28 +14,29 @@
CFGAS_BreakLine::~CFGAS_BreakLine() = default;
CFGAS_Char* CFGAS_BreakLine::LastChar() {
- if (m_LineChars.empty())
+ if (line_chars_.empty()) {
return nullptr;
+ }
- return &m_LineChars.back();
+ return &line_chars_.back();
}
int32_t CFGAS_BreakLine::GetLineEnd() const {
- return m_iStart + m_iWidth;
+ return start_ + width_;
}
void CFGAS_BreakLine::Clear() {
- m_LineChars.clear();
- m_LinePieces.clear();
- m_iWidth = 0;
- m_iArabicChars = 0;
+ line_chars_.clear();
+ line_pieces_.clear();
+ width_ = 0;
+ arabic_chars_ = 0;
}
void CFGAS_BreakLine::IncrementArabicCharCount() {
- ++m_iArabicChars;
+ ++arabic_chars_;
}
void CFGAS_BreakLine::DecrementArabicCharCount() {
- DCHECK(m_iArabicChars > 0);
- --m_iArabicChars;
+ DCHECK(arabic_chars_ > 0);
+ --arabic_chars_;
}
diff --git a/xfa/fgas/layout/cfgas_breakline.h b/xfa/fgas/layout/cfgas_breakline.h
index ec239cc..423c71d 100644
--- a/xfa/fgas/layout/cfgas_breakline.h
+++ b/xfa/fgas/layout/cfgas_breakline.h
@@ -24,15 +24,15 @@
void IncrementArabicCharCount();
void DecrementArabicCharCount();
- bool HasArabicChar() const { return m_iArabicChars > 0; }
+ bool HasArabicChar() const { return arabic_chars_ > 0; }
- std::vector<CFGAS_Char> m_LineChars;
- std::vector<CFGAS_BreakPiece> m_LinePieces;
- int32_t m_iStart = 0;
- int32_t m_iWidth = 0;
+ std::vector<CFGAS_Char> line_chars_;
+ std::vector<CFGAS_BreakPiece> line_pieces_;
+ int32_t start_ = 0;
+ int32_t width_ = 0;
private:
- int32_t m_iArabicChars = 0;
+ int32_t arabic_chars_ = 0;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_BREAKLINE_H_
diff --git a/xfa/fgas/layout/cfgas_breakpiece.cpp b/xfa/fgas/layout/cfgas_breakpiece.cpp
index 3478299..9840f9a 100644
--- a/xfa/fgas/layout/cfgas_breakpiece.cpp
+++ b/xfa/fgas/layout/cfgas_breakpiece.cpp
@@ -17,11 +17,11 @@
CFGAS_BreakPiece::~CFGAS_BreakPiece() = default;
int32_t CFGAS_BreakPiece::GetEndPos() const {
- return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
+ return width_ < 0 ? start_pos_ : start_pos_ + width_;
}
size_t CFGAS_BreakPiece::GetLength() const {
- return pdfium::checked_cast<size_t>(m_iCharCount);
+ return pdfium::checked_cast<size_t>(char_count_);
}
CFGAS_Char* CFGAS_BreakPiece::GetChar(int32_t index) const {
@@ -30,22 +30,24 @@
CFGAS_Char* CFGAS_BreakPiece::GetChar(size_t index) const {
DCHECK_LT(index, GetLength());
- DCHECK(m_pChars);
- return &(*m_pChars)[m_iStartChar + index];
+ DCHECK(chars_);
+ return &(*chars_)[start_char_ + index];
}
WideString CFGAS_BreakPiece::GetString() const {
WideString ret;
- ret.Reserve(m_iCharCount);
- for (int32_t i = m_iStartChar; i < m_iStartChar + m_iCharCount; i++)
- ret += static_cast<wchar_t>((*m_pChars)[i].char_code());
+ ret.Reserve(char_count_);
+ for (int32_t i = start_char_; i < start_char_ + char_count_; i++) {
+ ret += static_cast<wchar_t>((*chars_)[i].char_code());
+ }
return ret;
}
std::vector<int32_t> CFGAS_BreakPiece::GetWidths() const {
std::vector<int32_t> ret;
- ret.reserve(m_iCharCount);
- for (int32_t i = m_iStartChar; i < m_iStartChar + m_iCharCount; i++)
- ret.push_back((*m_pChars)[i].m_iCharWidth);
+ ret.reserve(char_count_);
+ for (int32_t i = start_char_; i < start_char_ + char_count_; i++) {
+ ret.push_back((*chars_)[i].char_width_);
+ }
return ret;
}
diff --git a/xfa/fgas/layout/cfgas_breakpiece.h b/xfa/fgas/layout/cfgas_breakpiece.h
index 92c39a9..dd01ab2 100644
--- a/xfa/fgas/layout/cfgas_breakpiece.h
+++ b/xfa/fgas/layout/cfgas_breakpiece.h
@@ -32,62 +32,62 @@
WideString GetString() const;
std::vector<int32_t> GetWidths() const;
- CFGAS_Char::BreakType GetStatus() const { return m_dwStatus; }
- void SetStatus(CFGAS_Char::BreakType status) { m_dwStatus = status; }
+ CFGAS_Char::BreakType GetStatus() const { return status_; }
+ void SetStatus(CFGAS_Char::BreakType status) { status_ = status; }
- int32_t GetStartPos() const { return m_iStartPos; }
- void SetStartPos(int32_t pos) { m_iStartPos = pos; }
- void IncrementStartPos(int32_t count) { m_iStartPos += count; }
+ int32_t GetStartPos() const { return start_pos_; }
+ void SetStartPos(int32_t pos) { start_pos_ = pos; }
+ void IncrementStartPos(int32_t count) { start_pos_ += count; }
- int32_t GetWidth() const { return m_iWidth; }
- void SetWidth(int32_t width) { m_iWidth = width; }
- void IncrementWidth(int32_t width) { m_iWidth += width; }
+ int32_t GetWidth() const { return width_; }
+ void SetWidth(int32_t width) { width_ = width; }
+ void IncrementWidth(int32_t width) { width_ += width; }
- int32_t GetStartChar() const { return m_iStartChar; }
- void SetStartChar(int32_t pos) { m_iStartChar = pos; }
+ int32_t GetStartChar() const { return start_char_; }
+ void SetStartChar(int32_t pos) { start_char_ = pos; }
- int32_t GetCharCount() const { return m_iCharCount; }
- void SetCharCount(int32_t count) { m_iCharCount = count; }
+ int32_t GetCharCount() const { return char_count_; }
+ void SetCharCount(int32_t count) { char_count_ = count; }
- int32_t GetBidiLevel() const { return m_iBidiLevel; }
- void SetBidiLevel(int32_t level) { m_iBidiLevel = level; }
+ int32_t GetBidiLevel() const { return bidi_level_; }
+ void SetBidiLevel(int32_t level) { bidi_level_ = level; }
- int32_t GetBidiPos() const { return m_iBidiPos; }
- void SetBidiPos(int32_t pos) { m_iBidiPos = pos; }
+ int32_t GetBidiPos() const { return bidi_pos_; }
+ void SetBidiPos(int32_t pos) { bidi_pos_ = pos; }
- int32_t GetFontSize() const { return m_iFontSize; }
- void SetFontSize(int32_t font_size) { m_iFontSize = font_size; }
+ int32_t GetFontSize() const { return font_size_; }
+ void SetFontSize(int32_t font_size) { font_size_ = font_size; }
- int32_t GetHorizontalScale() const { return m_iHorizontalScale; }
- void SetHorizontalScale(int32_t scale) { m_iHorizontalScale = scale; }
+ int32_t GetHorizontalScale() const { return horizontal_scale_; }
+ void SetHorizontalScale(int32_t scale) { horizontal_scale_ = scale; }
- int32_t GetVerticalScale() const { return m_iVerticalScale; }
- void SetVerticalScale(int32_t scale) { m_iVerticalScale = scale; }
+ int32_t GetVerticalScale() const { return vertical_scale_; }
+ void SetVerticalScale(int32_t scale) { vertical_scale_ = scale; }
- uint32_t GetCharStyles() const { return m_dwCharStyles; }
- void SetCharStyles(uint32_t styles) { m_dwCharStyles = styles; }
+ uint32_t GetCharStyles() const { return char_styles_; }
+ void SetCharStyles(uint32_t styles) { char_styles_ = styles; }
- void SetChars(std::vector<CFGAS_Char>* chars) { m_pChars = chars; }
+ void SetChars(std::vector<CFGAS_Char>* chars) { chars_ = chars; }
- const CFGAS_TextUserData* GetUserData() const { return m_pUserData.Get(); }
+ const CFGAS_TextUserData* GetUserData() const { return user_data_.Get(); }
void SetUserData(const RetainPtr<CFGAS_TextUserData>& user_data) {
- m_pUserData = user_data;
+ user_data_ = user_data;
}
private:
- CFGAS_Char::BreakType m_dwStatus = CFGAS_Char::BreakType::kPiece;
- int32_t m_iStartPos = 0;
- int32_t m_iWidth = -1;
- int32_t m_iStartChar = 0;
- int32_t m_iCharCount = 0;
- int32_t m_iBidiLevel = 0;
- int32_t m_iBidiPos = 0;
- int32_t m_iFontSize = 0;
- int32_t m_iHorizontalScale = 100;
- int32_t m_iVerticalScale = 100;
- uint32_t m_dwCharStyles = 0;
- UnownedPtr<std::vector<CFGAS_Char>> m_pChars;
- RetainPtr<CFGAS_TextUserData> m_pUserData;
+ CFGAS_Char::BreakType status_ = CFGAS_Char::BreakType::kPiece;
+ int32_t start_pos_ = 0;
+ int32_t width_ = -1;
+ int32_t start_char_ = 0;
+ int32_t char_count_ = 0;
+ int32_t bidi_level_ = 0;
+ int32_t bidi_pos_ = 0;
+ int32_t font_size_ = 0;
+ int32_t horizontal_scale_ = 100;
+ int32_t vertical_scale_ = 100;
+ uint32_t char_styles_ = 0;
+ UnownedPtr<std::vector<CFGAS_Char>> chars_;
+ RetainPtr<CFGAS_TextUserData> user_data_;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_BREAKPIECE_H_
diff --git a/xfa/fgas/layout/cfgas_char.cpp b/xfa/fgas/layout/cfgas_char.cpp
index 68b27c9..56e06e6 100644
--- a/xfa/fgas/layout/cfgas_char.cpp
+++ b/xfa/fgas/layout/cfgas_char.cpp
@@ -283,7 +283,7 @@
size_t iLast = iStart - iCount;
for (size_t i = iStart; i > iLast; --i)
- (*chars)[i - 1].m_iBidiClass = eValue;
+ (*chars)[i - 1].bidi_class_ = eValue;
}
void SetDeferredRunLevel(std::vector<CFGAS_Char>* chars,
@@ -295,27 +295,27 @@
size_t iLast = iStart - iCount;
for (size_t i = iStart; i > iLast; --i)
- (*chars)[i - 1].m_iBidiLevel = static_cast<int16_t>(iValue);
+ (*chars)[i - 1].bidi_level_ = static_cast<int16_t>(iValue);
}
void Classify(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
CFGAS_Char& cur = (*chars)[i];
- cur.m_iBidiClass = pdfium::unicode::GetBidiClass(cur.char_code());
+ cur.bidi_class_ = pdfium::unicode::GetBidiClass(cur.char_code());
}
}
void ClassifyWithTransform(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
CFGAS_Char& cur = (*chars)[i];
- cur.m_iBidiClass = kNTypes[static_cast<size_t>(
+ cur.bidi_class_ = kNTypes[static_cast<size_t>(
pdfium::unicode::GetBidiClass(cur.char_code()))];
}
}
void ResolveExplicit(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i)
- (*chars)[i].m_iBidiLevel = 0;
+ (*chars)[i].bidi_level_ = 0;
}
void ResolveWeak(std::vector<CFGAS_Char>* chars, size_t iCount) {
@@ -332,21 +332,21 @@
size_t i = 0;
for (; i <= iCount; ++i) {
CFGAS_Char* pTC = &(*chars)[i];
- eClsCur = pTC->m_iBidiClass;
+ eClsCur = pTC->bidi_class_;
if (eClsCur == FX_BIDICLASS::kBN) {
- pTC->m_iBidiLevel = (int16_t)iLevelCur;
+ pTC->bidi_level_ = (int16_t)iLevelCur;
if (i == iCount && iLevelCur != 0) {
eClsCur = Direction(iLevelCur);
- pTC->m_iBidiClass = eClsCur;
+ pTC->bidi_class_ = eClsCur;
} else if (i < iCount) {
CFGAS_Char* pTCNext = &(*chars)[i + 1];
- eClsNew = pTCNext->m_iBidiClass;
- int32_t iLevelNext = pTCNext->m_iBidiLevel;
+ eClsNew = pTCNext->bidi_class_;
+ int32_t iLevelNext = pTCNext->bidi_level_;
if (eClsNew != FX_BIDICLASS::kBN && iLevelCur != iLevelNext) {
int32_t iLevelNew = std::max(iLevelNext, iLevelCur);
- pTC->m_iBidiLevel = static_cast<int16_t>(iLevelNew);
+ pTC->bidi_level_ = static_cast<int16_t>(iLevelNew);
eClsCur = Direction(iLevelNew);
- pTC->m_iBidiClass = eClsCur;
+ pTC->bidi_class_ = eClsCur;
iLevelCur = iLevelNext;
} else {
if (iNum > 0)
@@ -370,7 +370,7 @@
}
eClsNew = GetResolvedType(eAction);
if (eClsNew != static_cast<FX_BIDICLASS>(0xF))
- pTC->m_iBidiClass = eClsNew;
+ pTC->bidi_class_ = eClsNew;
if (FX_BWAIX & eAction)
++iNum;
@@ -400,7 +400,7 @@
FX_BIDICLASS eClsNew;
for (; i <= iCount; ++i) {
pTC = &(*chars)[i];
- eClsCur = pTC->m_iBidiClass;
+ eClsCur = pTC->bidi_class_;
if (eClsCur == FX_BIDICLASS::kBN) {
if (iNum)
++iNum;
@@ -418,12 +418,12 @@
eClsNew = GetResolvedNeutrals(eAction);
if (eClsNew != FX_BIDICLASS::kN)
- pTC->m_iBidiClass = eClsNew;
+ pTC->bidi_class_ = eClsNew;
if (FX_BNAIn & eAction)
++iNum;
eState = GetNeutralState(eState, eClsCur);
- iLevel = pTC->m_iBidiLevel;
+ iLevel = pTC->bidi_level_;
}
if (iNum == 0)
return;
@@ -436,14 +436,13 @@
void ResolveImplicit(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
- FX_BIDICLASS eCls = (*chars)[i].m_iBidiClass;
+ FX_BIDICLASS eCls = (*chars)[i].bidi_class_;
if (eCls == FX_BIDICLASS::kBN || eCls <= FX_BIDICLASS::kON ||
eCls >= FX_BIDICLASS::kAL) {
continue;
}
- (*chars)[i].m_iBidiLevel +=
- kAddLevelTable[FX_IsOdd((*chars)[i].m_iBidiLevel)]
- [static_cast<size_t>(eCls) - 1];
+ (*chars)[i].bidi_level_ += kAddLevelTable[FX_IsOdd((*chars)[i].bidi_level_)]
+ [static_cast<size_t>(eCls) - 1];
}
}
@@ -456,7 +455,7 @@
size_t i = 0;
size_t iNum = 0;
for (; i <= iCount; ++i) {
- switch (static_cast<FX_BIDICLASS>((*chars)[i].m_iBidiClass)) {
+ switch (static_cast<FX_BIDICLASS>((*chars)[i].bidi_class_)) {
case FX_BIDICLASS::kWS:
++iNum;
break;
@@ -466,7 +465,7 @@
case FX_BIDICLASS::kRLO:
case FX_BIDICLASS::kPDF:
case FX_BIDICLASS::kBN:
- (*chars)[i].m_iBidiLevel = static_cast<int16_t>(iLevel);
+ (*chars)[i].bidi_level_ = static_cast<int16_t>(iLevel);
++iNum;
break;
case FX_BIDICLASS::kS:
@@ -474,14 +473,14 @@
if (iNum > 0)
SetDeferredRunLevel(chars, i, iNum, 0);
- (*chars)[i].m_iBidiLevel = 0;
+ (*chars)[i].bidi_level_ = 0;
iNum = 0;
break;
default:
iNum = 0;
break;
}
- iLevel = (*chars)[i].m_iBidiLevel;
+ iLevel = (*chars)[i].bidi_level_;
}
if (iNum > 0)
SetDeferredRunLevel(chars, i, iNum, 0);
@@ -502,7 +501,7 @@
bReverse = bReverse || FX_IsOdd(iBaseLevel);
size_t i = iStart;
for (; i < iCount; ++i) {
- int32_t iLevel = (*chars)[i].m_iBidiLevel;
+ int32_t iLevel = (*chars)[i].bidi_level_;
if (iLevel == iBaseLevel)
continue;
if (iLevel < iBaseLevel)
@@ -525,10 +524,11 @@
void Position(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
- if ((*chars)[i].m_iBidiPos > iCount)
+ if ((*chars)[i].bidi_pos_ > iCount) {
continue;
+ }
- (*chars)[(*chars)[i].m_iBidiPos].m_iBidiOrder = i;
+ (*chars)[(*chars)[i].bidi_pos_].bidi_order_ = i;
}
}
@@ -556,14 +556,14 @@
CFGAS_Char::CFGAS_Char(uint16_t wCharCode,
int32_t iHorizontalScale,
int32_t iVerticalScale)
- : m_wCharCode(wCharCode),
- m_iHorizontalScale(iHorizontalScale),
- m_iVerticalScale(iVerticalScale) {}
+ : char_code_(wCharCode),
+ horizontal_scale_(iHorizontalScale),
+ vertical_scale_(iVerticalScale) {}
CFGAS_Char::CFGAS_Char(const CFGAS_Char& other) = default;
CFGAS_Char::~CFGAS_Char() = default;
FX_CHARTYPE CFGAS_Char::GetCharType() const {
- return pdfium::unicode::GetCharType(m_wCharCode);
+ return pdfium::unicode::GetCharType(char_code_);
}
diff --git a/xfa/fgas/layout/cfgas_char.h b/xfa/fgas/layout/cfgas_char.h
index 693fe61..4721f8d 100644
--- a/xfa/fgas/layout/cfgas_char.h
+++ b/xfa/fgas/layout/cfgas_char.h
@@ -37,26 +37,26 @@
~CFGAS_Char();
FX_CHARTYPE GetCharType() const;
- uint16_t char_code() const { return m_wCharCode; }
- int16_t horizonal_scale() const { return m_iHorizontalScale; }
- int16_t vertical_scale() const { return m_iVerticalScale; }
+ uint16_t char_code() const { return char_code_; }
+ int16_t horizonal_scale() const { return horizontal_scale_; }
+ int16_t vertical_scale() const { return vertical_scale_; }
- BreakType m_dwStatus = BreakType::kNone;
- FX_BIDICLASS m_iBidiClass = FX_BIDICLASS::kON;
- FX_LINEBREAKTYPE m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
- uint32_t m_dwCharStyles = 0;
- int32_t m_iCharWidth = 0;
- uint16_t m_iBidiLevel = 0;
- uint16_t m_iBidiPos = 0;
- uint16_t m_iBidiOrder = 0;
- int32_t m_iFontSize = 0;
- uint32_t m_dwIdentity = 0;
- RetainPtr<CFGAS_TextUserData> m_pUserData;
+ BreakType status_ = BreakType::kNone;
+ FX_BIDICLASS bidi_class_ = FX_BIDICLASS::kON;
+ FX_LINEBREAKTYPE line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
+ uint32_t char_styles_ = 0;
+ int32_t char_width_ = 0;
+ uint16_t bidi_level_ = 0;
+ uint16_t bidi_pos_ = 0;
+ uint16_t bidi_order_ = 0;
+ int32_t font_size_ = 0;
+ uint32_t identity_ = 0;
+ RetainPtr<CFGAS_TextUserData> user_data_;
private:
- uint16_t m_wCharCode;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
+ uint16_t char_code_;
+ int32_t horizontal_scale_;
+ int32_t vertical_scale_;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
diff --git a/xfa/fgas/layout/cfgas_linkuserdata.cpp b/xfa/fgas/layout/cfgas_linkuserdata.cpp
index cd64034..b4a996b 100644
--- a/xfa/fgas/layout/cfgas_linkuserdata.cpp
+++ b/xfa/fgas/layout/cfgas_linkuserdata.cpp
@@ -7,6 +7,6 @@
#include "xfa/fgas/layout/cfgas_linkuserdata.h"
CFGAS_LinkUserData::CFGAS_LinkUserData(const WideString& wsText)
- : m_wsURLContent(wsText) {}
+ : urlcontent_(wsText) {}
CFGAS_LinkUserData::~CFGAS_LinkUserData() = default;
diff --git a/xfa/fgas/layout/cfgas_linkuserdata.h b/xfa/fgas/layout/cfgas_linkuserdata.h
index aeae940..be31fa1 100644
--- a/xfa/fgas/layout/cfgas_linkuserdata.h
+++ b/xfa/fgas/layout/cfgas_linkuserdata.h
@@ -14,13 +14,13 @@
public:
CONSTRUCT_VIA_MAKE_RETAIN;
- WideString GetLinkURL() const { return m_wsURLContent; }
+ WideString GetLinkURL() const { return urlcontent_; }
private:
explicit CFGAS_LinkUserData(const WideString& wsText);
~CFGAS_LinkUserData() override;
- WideString m_wsURLContent;
+ WideString urlcontent_;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_LINKUSERDATA_H_
diff --git a/xfa/fgas/layout/cfgas_rtfbreak.cpp b/xfa/fgas/layout/cfgas_rtfbreak.cpp
index 17e9057..2422309 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak.cpp
@@ -27,68 +27,71 @@
CFGAS_RTFBreak::CFGAS_RTFBreak(Mask<LayoutStyle> dwLayoutStyles)
: CFGAS_Break(dwLayoutStyles) {
SetBreakStatus();
- m_bPagination = !!(m_dwLayoutStyles & LayoutStyle::kPagination);
+ pagination_ = !!(layout_styles_ & LayoutStyle::kPagination);
}
CFGAS_RTFBreak::~CFGAS_RTFBreak() = default;
void CFGAS_RTFBreak::SetLineStartPos(float fLinePos) {
int32_t iLinePos = FXSYS_roundf(fLinePos * kConversionFactor);
- iLinePos = std::min(iLinePos, m_iLineWidth);
- iLinePos = std::max(iLinePos, m_iLineStart);
- m_pCurLine->m_iStart = iLinePos;
+ iLinePos = std::min(iLinePos, line_width_);
+ iLinePos = std::max(iLinePos, line_start_);
+ cur_line_->start_ = iLinePos;
}
void CFGAS_RTFBreak::AddPositionedTab(float fTabPos) {
int32_t iTabPos = std::min(
- FXSYS_roundf(fTabPos * kConversionFactor) + m_iLineStart, m_iLineWidth);
- auto it = std::lower_bound(m_PositionedTabs.begin(), m_PositionedTabs.end(),
+ FXSYS_roundf(fTabPos * kConversionFactor) + line_start_, line_width_);
+ auto it = std::lower_bound(positioned_tabs_.begin(), positioned_tabs_.end(),
iTabPos);
- if (it != m_PositionedTabs.end() && *it == iTabPos)
+ if (it != positioned_tabs_.end() && *it == iTabPos) {
return;
- m_PositionedTabs.insert(it, iTabPos);
+ }
+ positioned_tabs_.insert(it, iTabPos);
}
void CFGAS_RTFBreak::SetUserData(
const RetainPtr<CFGAS_TextUserData>& pUserData) {
- if (m_pUserData == pUserData)
+ if (user_data_ == pUserData) {
return;
+ }
SetBreakStatus();
- m_pUserData = pUserData;
+ user_data_ = pUserData;
}
bool CFGAS_RTFBreak::GetPositionedTab(int32_t* iTabPos) const {
- auto it = std::upper_bound(m_PositionedTabs.begin(), m_PositionedTabs.end(),
+ auto it = std::upper_bound(positioned_tabs_.begin(), positioned_tabs_.end(),
*iTabPos);
- if (it == m_PositionedTabs.end())
+ if (it == positioned_tabs_.end()) {
return false;
+ }
*iTabPos = *it;
return true;
}
CFGAS_Char::BreakType CFGAS_RTFBreak::AppendChar(wchar_t wch) {
- DCHECK(m_pCurLine);
+ DCHECK(cur_line_);
FX_CHARTYPE chartype = pdfium::unicode::GetCharType(wch);
- m_pCurLine->m_LineChars.emplace_back(wch, m_iHorizontalScale,
- m_iVerticalScale);
- CFGAS_Char* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_iFontSize = m_iFontSize;
- pCurChar->m_dwIdentity = m_dwIdentity;
- pCurChar->m_pUserData = m_pUserData;
+ cur_line_->line_chars_.emplace_back(wch, horizontal_scale_, vertical_scale_);
+ CFGAS_Char* pCurChar = &cur_line_->line_chars_.back();
+ pCurChar->font_size_ = font_size_;
+ pCurChar->identity_ = identity_;
+ pCurChar->user_data_ = user_data_;
CFGAS_Char::BreakType dwRet1 = CFGAS_Char::BreakType::kNone;
if (chartype != FX_CHARTYPE::kCombination &&
- GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
- m_eCharType != FX_CHARTYPE::kUnknown &&
- IsGreaterThanLineWidth(m_pCurLine->GetLineEnd()) &&
- (m_eCharType != FX_CHARTYPE::kSpace ||
+ GetUnifiedCharType(char_type_) != GetUnifiedCharType(chartype) &&
+ char_type_ != FX_CHARTYPE::kUnknown &&
+ IsGreaterThanLineWidth(cur_line_->GetLineEnd()) &&
+ (char_type_ != FX_CHARTYPE::kSpace ||
chartype != FX_CHARTYPE::kControl)) {
dwRet1 = EndBreak(CFGAS_Char::BreakType::kLine);
- if (!m_pCurLine->m_LineChars.empty())
- pCurChar = &m_pCurLine->m_LineChars.back();
+ if (!cur_line_->line_chars_.empty()) {
+ pCurChar = &cur_line_->line_chars_.back();
+ }
}
CFGAS_Char::BreakType dwRet2 = CFGAS_Char::BreakType::kNone;
@@ -118,57 +121,58 @@
break;
}
- m_eCharType = chartype;
+ char_type_ = chartype;
return std::max(dwRet1, dwRet2);
}
void CFGAS_RTFBreak::AppendChar_Combination(CFGAS_Char* pCurChar) {
std::optional<uint16_t> iCharWidthRet;
- if (m_pFont) {
- iCharWidthRet = m_pFont->GetCharWidth(pCurChar->char_code());
+ if (font_) {
+ iCharWidthRet = font_->GetCharWidth(pCurChar->char_code());
}
FX_SAFE_INT32 iCharWidth = iCharWidthRet.value_or(0);
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
CFGAS_Char* pLastChar = GetLastChar(0, false, true);
if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE::kCombination)
iCharWidth *= -1;
else
- m_eCharType = FX_CHARTYPE::kCombination;
+ char_type_ = FX_CHARTYPE::kCombination;
int32_t iCharWidthValid = iCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iCharWidthValid;
+ pCurChar->char_width_ = iCharWidthValid;
if (iCharWidthValid > 0) {
- FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
+ FX_SAFE_INT32 checked_width = cur_line_->width_;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
return;
- m_pCurLine->m_iWidth = checked_width.ValueOrDie();
+ cur_line_->width_ = checked_width.ValueOrDie();
}
}
void CFGAS_RTFBreak::AppendChar_Tab(CFGAS_Char* pCurChar) {
- if (!(m_dwLayoutStyles & LayoutStyle::kExpandTab))
+ if (!(layout_styles_ & LayoutStyle::kExpandTab)) {
return;
+ }
- int32_t& iLineWidth = m_pCurLine->m_iWidth;
+ int32_t& iLineWidth = cur_line_->width_;
int32_t iCharWidth = iLineWidth;
FX_SAFE_INT32 iSafeCharWidth;
if (GetPositionedTab(&iCharWidth)) {
iSafeCharWidth = iCharWidth;
} else {
// Tab width is >= 160000, so this part does not need to be checked.
- DCHECK(m_iTabWidth >= kMinimumTabWidth);
- iSafeCharWidth = iLineWidth / m_iTabWidth + 1;
- iSafeCharWidth *= m_iTabWidth;
+ DCHECK(tab_width_ >= kMinimumTabWidth);
+ iSafeCharWidth = iLineWidth / tab_width_ + 1;
+ iSafeCharWidth *= tab_width_;
}
iSafeCharWidth -= iLineWidth;
iCharWidth = iSafeCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iCharWidth;
+ pCurChar->char_width_ = iCharWidth;
iLineWidth += iCharWidth;
}
@@ -186,8 +190,9 @@
dwRet2 = CFGAS_Char::BreakType::kParagraph;
break;
default:
- if (pCurChar->char_code() == m_wParagraphBreakChar)
+ if (pCurChar->char_code() == w_paragraph_break_char_) {
dwRet2 = CFGAS_Char::BreakType::kParagraph;
+ }
break;
}
if (dwRet2 != CFGAS_Char::BreakType::kNone)
@@ -197,43 +202,43 @@
}
CFGAS_Char::BreakType CFGAS_RTFBreak::AppendChar_Arabic(CFGAS_Char* pCurChar) {
- m_pCurLine->IncrementArabicCharCount();
+ cur_line_->IncrementArabicCharCount();
CFGAS_Char* pLastChar = nullptr;
wchar_t wForm;
bool bAlef = false;
- if (m_eCharType >= FX_CHARTYPE::kArabicAlef &&
- m_eCharType <= FX_CHARTYPE::kArabicDistortion) {
+ if (char_type_ >= FX_CHARTYPE::kArabicAlef &&
+ char_type_ <= FX_CHARTYPE::kArabicDistortion) {
pLastChar = GetLastChar(1, false, true);
if (pLastChar) {
- m_pCurLine->m_iWidth -= pLastChar->m_iCharWidth;
+ cur_line_->width_ -= pLastChar->char_width_;
CFGAS_Char* pPrevChar = GetLastChar(2, false, true);
wForm = pdfium::GetArabicFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == pdfium::unicode::kZeroWidthNoBreakSpace &&
pLastChar->GetCharType() == FX_CHARTYPE::kArabicAlef);
FX_SAFE_INT32 iCharWidth = 0;
- if (m_pFont) {
- std::optional<uint16_t> iCharWidthRet = m_pFont->GetCharWidth(wForm);
+ if (font_) {
+ std::optional<uint16_t> iCharWidthRet = font_->GetCharWidth(wForm);
if (iCharWidthRet.has_value()) {
iCharWidth = iCharWidthRet.value();
} else {
- iCharWidthRet = m_pFont->GetCharWidth(pLastChar->char_code());
+ iCharWidthRet = font_->GetCharWidth(pLastChar->char_code());
iCharWidth = iCharWidthRet.value_or(0);
}
}
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
int iCharWidthValid = iCharWidth.ValueOrDefault(0);
- pLastChar->m_iCharWidth = iCharWidthValid;
+ pLastChar->char_width_ = iCharWidthValid;
- FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
+ FX_SAFE_INT32 checked_width = cur_line_->width_;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
return CFGAS_Char::BreakType::kNone;
- m_pCurLine->m_iWidth = checked_width.ValueOrDie();
+ cur_line_->width_ = checked_width.ValueOrDie();
iCharWidth = 0;
}
}
@@ -241,28 +246,29 @@
wForm =
pdfium::GetArabicFormChar(pCurChar, bAlef ? nullptr : pLastChar, nullptr);
FX_SAFE_INT32 iCharWidth = 0;
- if (m_pFont) {
- std::optional<uint16_t> iCharWidthRet = m_pFont->GetCharWidth(wForm);
+ if (font_) {
+ std::optional<uint16_t> iCharWidthRet = font_->GetCharWidth(wForm);
if (!iCharWidthRet.has_value())
- iCharWidthRet = m_pFont->GetCharWidth(pCurChar->char_code());
+ iCharWidthRet = font_->GetCharWidth(pCurChar->char_code());
iCharWidth = iCharWidthRet.value_or(0);
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
}
int iCharWidthValid = iCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iCharWidthValid;
+ pCurChar->char_width_ = iCharWidthValid;
- FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
+ FX_SAFE_INT32 checked_width = cur_line_->width_;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
return CFGAS_Char::BreakType::kNone;
- m_pCurLine->m_iWidth = checked_width.ValueOrDie();
+ cur_line_->width_ = checked_width.ValueOrDie();
- if (IsGreaterThanLineWidth(m_pCurLine->GetLineEnd()))
+ if (IsGreaterThanLineWidth(cur_line_->GetLineEnd())) {
return EndBreak(CFGAS_Char::BreakType::kLine);
+ }
return CFGAS_Char::BreakType::kNone;
}
@@ -270,25 +276,25 @@
FX_CHARTYPE chartype = pCurChar->GetCharType();
wchar_t wForm = pCurChar->char_code();
FX_SAFE_INT32 iCharWidth = 0;
- if (m_pFont) {
- iCharWidth = m_pFont->GetCharWidth(wForm).value_or(0);
+ if (font_) {
+ iCharWidth = font_->GetCharWidth(wForm).value_or(0);
}
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
- iCharWidth += m_iCharSpace;
+ iCharWidth += char_space_;
int iValidCharWidth = iCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iValidCharWidth;
+ pCurChar->char_width_ = iValidCharWidth;
- FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
+ FX_SAFE_INT32 checked_width = cur_line_->width_;
checked_width += iValidCharWidth;
if (!checked_width.IsValid())
return CFGAS_Char::BreakType::kNone;
- m_pCurLine->m_iWidth = checked_width.ValueOrDie();
+ cur_line_->width_ = checked_width.ValueOrDie();
if (chartype != FX_CHARTYPE::kSpace &&
- IsGreaterThanLineWidth(m_pCurLine->GetLineEnd())) {
+ IsGreaterThanLineWidth(cur_line_->GetLineEnd())) {
return EndBreak(CFGAS_Char::BreakType::kLine);
}
return CFGAS_Char::BreakType::kNone;
@@ -297,45 +303,47 @@
CFGAS_Char::BreakType CFGAS_RTFBreak::EndBreak(CFGAS_Char::BreakType dwStatus) {
DCHECK(dwStatus != CFGAS_Char::BreakType::kNone);
- ++m_dwIdentity;
- if (!m_pCurLine->m_LinePieces.empty()) {
+ ++identity_;
+ if (!cur_line_->line_pieces_.empty()) {
if (dwStatus != CFGAS_Char::BreakType::kPiece)
- m_pCurLine->m_LinePieces.back().SetStatus(dwStatus);
- return m_pCurLine->m_LinePieces.back().GetStatus();
+ cur_line_->line_pieces_.back().SetStatus(dwStatus);
+ return cur_line_->line_pieces_.back().GetStatus();
}
if (HasLine()) {
- if (m_Lines[m_iReadyLineIndex].m_LinePieces.empty())
+ if (lines_[ready_line_index_].line_pieces_.empty()) {
return CFGAS_Char::BreakType::kNone;
+ }
if (dwStatus != CFGAS_Char::BreakType::kPiece)
- m_Lines[m_iReadyLineIndex].m_LinePieces.back().SetStatus(dwStatus);
- return m_Lines[m_iReadyLineIndex].m_LinePieces.back().GetStatus();
+ lines_[ready_line_index_].line_pieces_.back().SetStatus(dwStatus);
+ return lines_[ready_line_index_].line_pieces_.back().GetStatus();
}
- CFGAS_Char* tc = m_pCurLine->LastChar();
+ CFGAS_Char* tc = cur_line_->LastChar();
if (!tc)
return CFGAS_Char::BreakType::kNone;
- tc->m_dwStatus = dwStatus;
+ tc->status_ = dwStatus;
if (dwStatus == CFGAS_Char::BreakType::kPiece)
return dwStatus;
- m_iReadyLineIndex = m_pCurLine == &m_Lines[0] ? 0 : 1;
- CFGAS_BreakLine* pNextLine = &m_Lines[1 - m_iReadyLineIndex];
- bool bAllChars = m_iAlignment == LineAlignment::Justified ||
- m_iAlignment == LineAlignment::Distributed;
+ ready_line_index_ = cur_line_ == &lines_[0] ? 0 : 1;
+ CFGAS_BreakLine* pNextLine = &lines_[1 - ready_line_index_];
+ bool bAllChars = alignment_ == LineAlignment::Justified ||
+ alignment_ == LineAlignment::Distributed;
if (!EndBreakSplitLine(pNextLine, bAllChars, dwStatus)) {
std::deque<TPO> tpos = EndBreakBidiLine(dwStatus);
- if (!m_bPagination && m_iAlignment != LineAlignment::Left)
+ if (!pagination_ && alignment_ != LineAlignment::Left) {
EndBreakAlignment(tpos, bAllChars, dwStatus);
+ }
}
- m_pCurLine = pNextLine;
- m_pCurLine->m_iStart = m_iLineStart;
+ cur_line_ = pNextLine;
+ cur_line_->start_ = line_start_;
CFGAS_Char* pTC = GetLastChar(0, false, true);
- m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
+ char_type_ = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
return dwStatus;
}
@@ -343,34 +351,34 @@
bool bAllChars,
CFGAS_Char::BreakType dwStatus) {
bool bDone = false;
- if (IsGreaterThanLineWidth(m_pCurLine->GetLineEnd())) {
- const CFGAS_Char* tc = m_pCurLine->LastChar();
+ if (IsGreaterThanLineWidth(cur_line_->GetLineEnd())) {
+ const CFGAS_Char* tc = cur_line_->LastChar();
switch (tc->GetCharType()) {
case FX_CHARTYPE::kTab:
case FX_CHARTYPE::kControl:
case FX_CHARTYPE::kSpace:
break;
default:
- SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars);
+ SplitTextLine(cur_line_, pNextLine, !pagination_ && bAllChars);
bDone = true;
break;
}
}
- if (!m_bPagination) {
+ if (!pagination_) {
if (bAllChars && !bDone) {
- int32_t endPos = m_pCurLine->GetLineEnd();
- GetBreakPos(m_pCurLine->m_LineChars, bAllChars, true, &endPos);
+ int32_t endPos = cur_line_->GetLineEnd();
+ GetBreakPos(cur_line_->line_chars_, bAllChars, true, &endPos);
}
return false;
}
- const CFGAS_Char* pCurChars = m_pCurLine->m_LineChars.data();
+ const CFGAS_Char* pCurChars = cur_line_->line_chars_.data();
CFGAS_BreakPiece tp;
- tp.SetChars(&m_pCurLine->m_LineChars);
+ tp.SetChars(&cur_line_->line_chars_);
bool bNew = true;
uint32_t dwIdentity = static_cast<uint32_t>(-1);
- int32_t iLast = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars) - 1;
+ int32_t iLast = fxcrt::CollectionSize<int32_t>(cur_line_->line_chars_) - 1;
int32_t j = 0;
for (int32_t i = 0; i <= iLast;) {
const CFGAS_Char* pTC = UNSAFE_TODO(pCurChars + i);
@@ -378,28 +386,28 @@
tp.SetStartChar(i);
tp.IncrementStartPos(tp.GetWidth());
tp.SetWidth(0);
- tp.SetStatus(pTC->m_dwStatus);
- tp.SetFontSize(pTC->m_iFontSize);
+ tp.SetStatus(pTC->status_);
+ tp.SetFontSize(pTC->font_size_);
tp.SetHorizontalScale(pTC->horizonal_scale());
tp.SetVerticalScale(pTC->vertical_scale());
- dwIdentity = pTC->m_dwIdentity;
- tp.SetUserData(pTC->m_pUserData);
+ dwIdentity = pTC->identity_;
+ tp.SetUserData(pTC->user_data_);
j = i;
bNew = false;
}
- if (i == iLast || pTC->m_dwStatus != CFGAS_Char::BreakType::kNone ||
- pTC->m_dwIdentity != dwIdentity) {
- if (pTC->m_dwIdentity == dwIdentity) {
- tp.SetStatus(pTC->m_dwStatus);
- tp.IncrementWidth(pTC->m_iCharWidth);
+ if (i == iLast || pTC->status_ != CFGAS_Char::BreakType::kNone ||
+ pTC->identity_ != dwIdentity) {
+ if (pTC->identity_ == dwIdentity) {
+ tp.SetStatus(pTC->status_);
+ tp.IncrementWidth(pTC->char_width_);
++i;
}
tp.SetCharCount(i - j);
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
bNew = true;
} else {
- tp.IncrementWidth(pTC->m_iCharWidth);
+ tp.IncrementWidth(pTC->char_width_);
++i;
}
}
@@ -409,30 +417,30 @@
std::deque<CFGAS_Break::TPO> CFGAS_RTFBreak::EndBreakBidiLine(
CFGAS_Char::BreakType dwStatus) {
CFGAS_Char* pTC;
- std::vector<CFGAS_Char>& chars = m_pCurLine->m_LineChars;
- if (!m_bPagination && m_pCurLine->HasArabicChar()) {
+ std::vector<CFGAS_Char>& chars = cur_line_->line_chars_;
+ if (!pagination_ && cur_line_->HasArabicChar()) {
size_t iBidiNum = 0;
- for (size_t i = 0; i < m_pCurLine->m_LineChars.size(); ++i) {
+ for (size_t i = 0; i < cur_line_->line_chars_.size(); ++i) {
pTC = &chars[i];
- pTC->m_iBidiPos = static_cast<int32_t>(i);
+ pTC->bidi_pos_ = static_cast<int32_t>(i);
if (pTC->GetCharType() != FX_CHARTYPE::kControl)
iBidiNum = i;
if (i == 0)
- pTC->m_iBidiLevel = 1;
+ pTC->bidi_level_ = 1;
}
CFGAS_Char::BidiLine(&chars, iBidiNum + 1);
} else {
- for (size_t i = 0; i < m_pCurLine->m_LineChars.size(); ++i) {
+ for (size_t i = 0; i < cur_line_->line_chars_.size(); ++i) {
pTC = &chars[i];
- pTC->m_iBidiLevel = 0;
- pTC->m_iBidiPos = 0;
- pTC->m_iBidiOrder = 0;
+ pTC->bidi_level_ = 0;
+ pTC->bidi_pos_ = 0;
+ pTC->bidi_order_ = 0;
}
}
CFGAS_BreakPiece tp;
tp.SetStatus(CFGAS_Char::BreakType::kPiece);
- tp.SetStartPos(m_pCurLine->m_iStart);
+ tp.SetStartPos(cur_line_->start_);
tp.SetChars(&chars);
int32_t iBidiLevel = -1;
@@ -441,32 +449,31 @@
uint32_t dwIdentity = static_cast<uint32_t>(-1);
int32_t i = 0;
int32_t j = 0;
- int32_t iCount = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(cur_line_->line_chars_);
while (i < iCount) {
pTC = &chars[i];
if (iBidiLevel < 0) {
- iBidiLevel = pTC->m_iBidiLevel;
- iCharWidth = pTC->m_iCharWidth;
+ iBidiLevel = pTC->bidi_level_;
+ iCharWidth = pTC->char_width_;
tp.SetWidth(iCharWidth < 1 ? 0 : iCharWidth);
tp.SetBidiLevel(iBidiLevel);
- tp.SetBidiPos(pTC->m_iBidiOrder);
- tp.SetFontSize(pTC->m_iFontSize);
+ tp.SetBidiPos(pTC->bidi_order_);
+ tp.SetFontSize(pTC->font_size_);
tp.SetHorizontalScale(pTC->horizonal_scale());
tp.SetVerticalScale(pTC->vertical_scale());
- dwIdentity = pTC->m_dwIdentity;
- tp.SetUserData(pTC->m_pUserData);
+ dwIdentity = pTC->identity_;
+ tp.SetUserData(pTC->user_data_);
tp.SetStatus(CFGAS_Char::BreakType::kPiece);
++i;
- } else if (iBidiLevel != pTC->m_iBidiLevel ||
- pTC->m_dwIdentity != dwIdentity) {
+ } else if (iBidiLevel != pTC->bidi_level_ || pTC->identity_ != dwIdentity) {
tp.SetCharCount(i - tp.GetStartChar());
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
tp.IncrementStartPos(tp.GetWidth());
tp.SetStartChar(i);
tpos.push_back({j++, tp.GetBidiPos()});
iBidiLevel = -1;
} else {
- iCharWidth = pTC->m_iCharWidth;
+ iCharWidth = pTC->char_width_;
if (iCharWidth > 0)
tp.IncrementWidth(iCharWidth);
++i;
@@ -476,14 +483,14 @@
if (i > tp.GetStartChar()) {
tp.SetStatus(dwStatus);
tp.SetCharCount(i - tp.GetStartChar());
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
tpos.push_back({j, tp.GetBidiPos()});
}
std::sort(tpos.begin(), tpos.end());
- int32_t iStartPos = m_pCurLine->m_iStart;
+ int32_t iStartPos = cur_line_->start_;
for (const auto& it : tpos) {
- CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[it.index];
+ CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[it.index];
ttp.SetStartPos(iStartPos);
iStartPos += ttp.GetWidth();
}
@@ -493,11 +500,11 @@
void CFGAS_RTFBreak::EndBreakAlignment(const std::deque<TPO>& tpos,
bool bAllChars,
CFGAS_Char::BreakType dwStatus) {
- int32_t iNetWidth = m_pCurLine->m_iWidth;
+ int32_t iNetWidth = cur_line_->width_;
int32_t iGapChars = 0;
bool bFind = false;
for (const TPO& pos : pdfium::Reversed(tpos)) {
- const CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[pos.index];
+ const CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[pos.index];
if (!bFind)
iNetWidth = ttp.GetEndPos();
@@ -505,15 +512,16 @@
int32_t j = bArabic ? 0 : ttp.GetCharCount() - 1;
while (j > -1 && j < ttp.GetCharCount()) {
const CFGAS_Char* tc = ttp.GetChar(j);
- if (tc->m_eLineBreakType == FX_LINEBREAKTYPE::kDIRECT_BRK)
+ if (tc->line_break_type_ == FX_LINEBREAKTYPE::kDIRECT_BRK) {
++iGapChars;
+ }
if (!bFind || !bAllChars) {
FX_CHARTYPE dwCharType = tc->GetCharType();
if (dwCharType == FX_CHARTYPE::kSpace ||
dwCharType == FX_CHARTYPE::kControl) {
if (!bFind) {
- int32_t iCharWidth = tc->m_iCharWidth;
+ int32_t iCharWidth = tc->char_width_;
if (bAllChars && iCharWidth > 0)
iNetWidth -= iCharWidth;
}
@@ -529,13 +537,13 @@
break;
}
- int32_t iOffset = m_iLineWidth - iNetWidth;
- if (iGapChars > 0 && (m_iAlignment == LineAlignment::Distributed ||
- (m_iAlignment == LineAlignment::Justified &&
+ int32_t iOffset = line_width_ - iNetWidth;
+ if (iGapChars > 0 && (alignment_ == LineAlignment::Distributed ||
+ (alignment_ == LineAlignment::Justified &&
dwStatus != CFGAS_Char::BreakType::kParagraph))) {
int32_t iStart = -1;
for (const auto& tpo : tpos) {
- CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
+ CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[tpo.index];
if (iStart < 0)
iStart = ttp.GetStartPos();
else
@@ -543,12 +551,12 @@
for (int32_t j = 0; j < ttp.GetCharCount(); ++j) {
CFGAS_Char* tc = ttp.GetChar(j);
- if (tc->m_eLineBreakType != FX_LINEBREAKTYPE::kDIRECT_BRK ||
- tc->m_iCharWidth < 0) {
+ if (tc->line_break_type_ != FX_LINEBREAKTYPE::kDIRECT_BRK ||
+ tc->char_width_ < 0) {
continue;
}
int32_t k = iOffset / iGapChars;
- tc->m_iCharWidth += k;
+ tc->char_width_ += k;
ttp.IncrementWidth(k);
iOffset -= k;
--iGapChars;
@@ -557,13 +565,15 @@
}
iStart += ttp.GetWidth();
}
- } else if (m_iAlignment == LineAlignment::Right ||
- m_iAlignment == LineAlignment::Center) {
- if (m_iAlignment == LineAlignment::Center)
+ } else if (alignment_ == LineAlignment::Right ||
+ alignment_ == LineAlignment::Center) {
+ if (alignment_ == LineAlignment::Center) {
iOffset /= 2;
+ }
if (iOffset > 0) {
- for (auto& ttp : m_pCurLine->m_LinePieces)
+ for (auto& ttp : cur_line_->line_pieces_) {
ttp.IncrementStartPos(iOffset);
+ }
}
}
}
@@ -582,7 +592,7 @@
int32_t iIndirectPos = -1;
int32_t iLast = -1;
int32_t iLastPos = -1;
- if (*pEndPos <= m_iLineWidth) {
+ if (*pEndPos <= line_width_) {
if (!bAllChars)
return iLength;
@@ -594,10 +604,10 @@
CFGAS_Char* pCur = UNSAFE_TODO(pCharArray + iLength);
--iLength;
if (bAllChars)
- pCur->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ pCur->line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
FX_BREAKPROPERTY nNext = pdfium::unicode::GetBreakProperty(pCur->char_code());
- int32_t iCharWidth = pCur->m_iCharWidth;
+ int32_t iCharWidth = pCur->char_width_;
if (iCharWidth > 0)
*pEndPos -= iCharWidth;
@@ -621,11 +631,11 @@
: GetLineBreakTypeFromPair(nCur, nNext);
}
if (bAllChars)
- pCur->m_eLineBreakType = eType;
+ pCur->line_break_type_ = eType;
if (!bOnlyBrk) {
- iCharWidth = pCur->m_iCharWidth;
- if (*pEndPos <= m_iLineWidth || bNeedBreak) {
+ iCharWidth = pCur->char_width_;
+ if (*pEndPos <= line_width_ || bNeedBreak) {
if (eType == FX_LINEBREAKTYPE::kDIRECT_BRK && iBreak < 0) {
iBreak = iLength;
iBreakPos = *pEndPos;
@@ -670,36 +680,37 @@
DCHECK(pCurLine);
DCHECK(pNextLine);
- if (pCurLine->m_LineChars.size() < 2)
+ if (pCurLine->line_chars_.size() < 2) {
return;
+ }
int32_t iEndPos = pCurLine->GetLineEnd();
- std::vector<CFGAS_Char>& curChars = pCurLine->m_LineChars;
+ std::vector<CFGAS_Char>& curChars = pCurLine->line_chars_;
int32_t iCharPos = GetBreakPos(curChars, bAllChars, false, &iEndPos);
if (iCharPos < 0)
iCharPos = 0;
++iCharPos;
- if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
+ if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->line_chars_)) {
pNextLine->Clear();
- curChars[iCharPos - 1].m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ curChars[iCharPos - 1].line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
return;
}
- pNextLine->m_LineChars =
+ pNextLine->line_chars_ =
std::vector<CFGAS_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
- pNextLine->m_iStart = pCurLine->m_iStart;
- pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos;
- pCurLine->m_iWidth = iEndPos;
- curChars[iCharPos - 1].m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ pNextLine->start_ = pCurLine->start_;
+ pNextLine->width_ = pCurLine->GetLineEnd() - iEndPos;
+ pCurLine->width_ = iEndPos;
+ curChars[iCharPos - 1].line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
- for (size_t i = 0; i < pNextLine->m_LineChars.size(); ++i) {
- if (pNextLine->m_LineChars[i].GetCharType() >= FX_CHARTYPE::kArabicAlef) {
+ for (size_t i = 0; i < pNextLine->line_chars_.size(); ++i) {
+ if (pNextLine->line_chars_[i].GetCharType() >= FX_CHARTYPE::kArabicAlef) {
pCurLine->DecrementArabicCharCount();
pNextLine->IncrementArabicCharCount();
}
- pNextLine->m_LineChars[i].m_dwStatus = CFGAS_Char::BreakType::kNone;
+ pNextLine->line_chars_[i].status_ = CFGAS_Char::BreakType::kNone;
}
}
@@ -764,8 +775,9 @@
if (!bEmptyChar) {
current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wForm);
- if (current_char_pos.m_GlyphIndex == 0xFFFF)
+ if (current_char_pos.m_GlyphIndex == 0xFFFF) {
current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wch);
+ }
#if BUILDFLAG(IS_APPLE)
current_char_pos.m_ExtGID = current_char_pos.m_GlyphIndex;
#endif
diff --git a/xfa/fgas/layout/cfgas_rtfbreak.h b/xfa/fgas/layout/cfgas_rtfbreak.h
index 7a89eeb..f2b1113 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak.h
+++ b/xfa/fgas/layout/cfgas_rtfbreak.h
@@ -35,7 +35,7 @@
void SetLineStartPos(float fLinePos);
- void SetAlignment(LineAlignment align) { m_iAlignment = align; }
+ void SetAlignment(LineAlignment align) { alignment_ = align; }
void SetUserData(const RetainPtr<CFGAS_TextUserData>& pUserData);
void AddPositionedTab(float fTabPos);
@@ -70,10 +70,10 @@
bool bAllChars,
CFGAS_Char::BreakType dwStatus);
- bool m_bPagination = false;
- LineAlignment m_iAlignment = LineAlignment::Left;
- std::vector<int32_t> m_PositionedTabs;
- RetainPtr<CFGAS_TextUserData> m_pUserData;
+ bool pagination_ = false;
+ LineAlignment alignment_ = LineAlignment::Left;
+ std::vector<int32_t> positioned_tabs_;
+ RetainPtr<CFGAS_TextUserData> user_data_;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_RTFBREAK_H_
diff --git a/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
index 23d2496..27d8729 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak_unittest.cpp
@@ -90,7 +90,7 @@
}
std::vector<CFGAS_Char> chars =
- rtf_break->GetCurrentLineForTesting()->m_LineChars;
+ rtf_break->GetCurrentLineForTesting()->line_chars_;
CFGAS_Char::BidiLine(&chars, chars.size());
EXPECT_EQ(3u, chars.size());
}
diff --git a/xfa/fgas/layout/cfgas_textuserdata.cpp b/xfa/fgas/layout/cfgas_textuserdata.cpp
index 9b3ae43..d918a4f 100644
--- a/xfa/fgas/layout/cfgas_textuserdata.cpp
+++ b/xfa/fgas/layout/cfgas_textuserdata.cpp
@@ -13,11 +13,11 @@
CFGAS_TextUserData::CFGAS_TextUserData(
const RetainPtr<CFX_CSSComputedStyle>& pStyle)
- : m_pStyle(pStyle) {}
+ : style_(pStyle) {}
CFGAS_TextUserData::CFGAS_TextUserData(
const RetainPtr<CFX_CSSComputedStyle>& pStyle,
const RetainPtr<CFGAS_LinkUserData>& pLinkData)
- : m_pStyle(pStyle), m_pLinkData(pLinkData) {}
+ : style_(pStyle), link_data_(pLinkData) {}
CFGAS_TextUserData::~CFGAS_TextUserData() = default;
diff --git a/xfa/fgas/layout/cfgas_textuserdata.h b/xfa/fgas/layout/cfgas_textuserdata.h
index 4d56bc2..d5a65c5 100644
--- a/xfa/fgas/layout/cfgas_textuserdata.h
+++ b/xfa/fgas/layout/cfgas_textuserdata.h
@@ -16,8 +16,8 @@
public:
CONSTRUCT_VIA_MAKE_RETAIN;
- RetainPtr<CFX_CSSComputedStyle> m_pStyle;
- RetainPtr<CFGAS_LinkUserData> m_pLinkData;
+ RetainPtr<CFX_CSSComputedStyle> style_;
+ RetainPtr<CFGAS_LinkUserData> link_data_;
private:
explicit CFGAS_TextUserData(const RetainPtr<CFX_CSSComputedStyle>& pStyle);
diff --git a/xfa/fgas/layout/cfgas_txtbreak.cpp b/xfa/fgas/layout/cfgas_txtbreak.cpp
index b29fc7c..2943e8f 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak.cpp
@@ -44,28 +44,28 @@
CFGAS_TxtBreak::~CFGAS_TxtBreak() = default;
void CFGAS_TxtBreak::SetLineWidth(float fLineWidth) {
- m_iLineWidth = FXSYS_roundf(fLineWidth * kConversionFactor);
- DCHECK(m_iLineWidth >= 20000);
+ line_width_ = FXSYS_roundf(fLineWidth * kConversionFactor);
+ DCHECK(line_width_ >= 20000);
}
void CFGAS_TxtBreak::SetAlignment(int32_t iAlignment) {
DCHECK(iAlignment >= CFX_TxtLineAlignment_Left);
DCHECK(iAlignment <= CFX_TxtLineAlignment_Justified);
- m_iAlignment = iAlignment;
+ alignment_ = iAlignment;
}
void CFGAS_TxtBreak::SetCombWidth(float fCombWidth) {
- m_iCombWidth = FXSYS_roundf(fCombWidth * kConversionFactor);
+ comb_width_ = FXSYS_roundf(fCombWidth * kConversionFactor);
}
void CFGAS_TxtBreak::AppendChar_Combination(CFGAS_Char* pCurChar) {
- FX_SAFE_INT32 iCharWidth = m_iCombWidth;
- pCurChar->m_iCharWidth = -1;
- if (!m_bCombText) {
+ FX_SAFE_INT32 iCharWidth = comb_width_;
+ pCurChar->char_width_ = -1;
+ if (!comb_text_) {
wchar_t wch = pCurChar->char_code();
CFGAS_Char* pLastChar = GetLastChar(0, false, false);
if (pLastChar &&
- (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
+ (pLastChar->char_styles_ & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
wchar_t wLast = pLastChar->char_code();
std::optional<uint16_t> maybe_shadda;
if (wch == pdfium::kArabicShadda) {
@@ -75,32 +75,32 @@
}
if (maybe_shadda.has_value()) {
wch = maybe_shadda.value();
- pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
- pLastChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
- pLastChar->m_iCharWidth = 0;
+ pCurChar->char_styles_ |= FX_TXTCHARSTYLE_ArabicShadda;
+ pLastChar->char_styles_ |= FX_TXTCHARSTYLE_ArabicShadda;
+ pLastChar->char_width_ = 0;
}
}
std::optional<uint16_t> iCharWidthRet;
- if (m_pFont) {
- iCharWidthRet = m_pFont->GetCharWidth(wch);
+ if (font_) {
+ iCharWidthRet = font_->GetCharWidth(wch);
}
iCharWidth = iCharWidthRet.value_or(0);
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
}
iCharWidth *= -1;
- pCurChar->m_iCharWidth = iCharWidth.ValueOrDefault(0);
+ pCurChar->char_width_ = iCharWidth.ValueOrDefault(0);
}
void CFGAS_TxtBreak::AppendChar_Tab(CFGAS_Char* pCurChar) {
- m_eCharType = FX_CHARTYPE::kTab;
+ char_type_ = FX_CHARTYPE::kTab;
}
CFGAS_Char::BreakType CFGAS_TxtBreak::AppendChar_Control(CFGAS_Char* pCurChar) {
- m_eCharType = FX_CHARTYPE::kControl;
+ char_type_ = FX_CHARTYPE::kControl;
CFGAS_Char::BreakType dwRet = CFGAS_Char::BreakType::kNone;
- if (!m_bSingleLine) {
+ if (!single_line_) {
wchar_t wch = pCurChar->char_code();
switch (wch) {
case L'\v':
@@ -114,8 +114,9 @@
dwRet = CFGAS_Char::BreakType::kParagraph;
break;
default:
- if (wch == m_wParagraphBreakChar)
+ if (wch == w_paragraph_break_char_) {
dwRet = CFGAS_Char::BreakType::kParagraph;
+ }
break;
}
if (dwRet != CFGAS_Char::BreakType::kNone)
@@ -126,86 +127,88 @@
CFGAS_Char::BreakType CFGAS_TxtBreak::AppendChar_Arabic(CFGAS_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
- int32_t& iLineWidth = m_pCurLine->m_iWidth;
+ int32_t& iLineWidth = cur_line_->width_;
wchar_t wForm;
CFGAS_Char* pLastChar = nullptr;
bool bAlef = false;
- if (!m_bCombText && m_eCharType >= FX_CHARTYPE::kArabicAlef &&
- m_eCharType <= FX_CHARTYPE::kArabicDistortion) {
+ if (!comb_text_ && char_type_ >= FX_CHARTYPE::kArabicAlef &&
+ char_type_ <= FX_CHARTYPE::kArabicDistortion) {
FX_SAFE_INT32 iCharWidth = 0;
pLastChar = GetLastChar(1, true, false);
if (pLastChar) {
- if (pLastChar->m_iCharWidth > 0)
- iLineWidth -= pLastChar->m_iCharWidth;
- iCharWidth = pLastChar->m_iCharWidth;
+ if (pLastChar->char_width_ > 0) {
+ iLineWidth -= pLastChar->char_width_;
+ }
+ iCharWidth = pLastChar->char_width_;
CFGAS_Char* pPrevChar = GetLastChar(2, true, false);
wForm = pdfium::GetArabicFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == pdfium::unicode::kZeroWidthNoBreakSpace &&
pLastChar->GetCharType() == FX_CHARTYPE::kArabicAlef);
- if (m_pFont) {
- iCharWidth = m_pFont->GetCharWidth(wForm).value_or(0);
+ if (font_) {
+ iCharWidth = font_->GetCharWidth(wForm).value_or(0);
}
if (wForm == pdfium::unicode::kZeroWidthNoBreakSpace)
iCharWidth = 0;
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
int32_t iCharWidthValid = iCharWidth.ValueOrDefault(0);
- pLastChar->m_iCharWidth = iCharWidthValid;
+ pLastChar->char_width_ = iCharWidthValid;
iLineWidth += iCharWidthValid;
}
}
- m_eCharType = chartype;
+ char_type_ = chartype;
wForm =
pdfium::GetArabicFormChar(pCurChar, bAlef ? nullptr : pLastChar, nullptr);
FX_SAFE_INT32 iCharWidth = 0;
- if (m_bCombText) {
- iCharWidth = m_iCombWidth;
+ if (comb_text_) {
+ iCharWidth = comb_width_;
} else {
- if (m_pFont && wForm != pdfium::unicode::kZeroWidthNoBreakSpace) {
- iCharWidth = m_pFont->GetCharWidth(wForm).value_or(0);
+ if (font_ && wForm != pdfium::unicode::kZeroWidthNoBreakSpace) {
+ iCharWidth = font_->GetCharWidth(wForm).value_or(0);
}
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
}
int32_t iCharWidthValid = iCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iCharWidthValid;
+ pCurChar->char_width_ = iCharWidthValid;
iLineWidth += iCharWidthValid;
- m_pCurLine->IncrementArabicCharCount();
- if (!m_bSingleLine && IsGreaterThanLineWidth(iLineWidth))
+ cur_line_->IncrementArabicCharCount();
+ if (!single_line_ && IsGreaterThanLineWidth(iLineWidth)) {
return EndBreak(CFGAS_Char::BreakType::kLine);
+ }
return CFGAS_Char::BreakType::kNone;
}
CFGAS_Char::BreakType CFGAS_TxtBreak::AppendChar_Others(CFGAS_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
- int32_t& iLineWidth = m_pCurLine->m_iWidth;
- m_eCharType = chartype;
+ int32_t& iLineWidth = cur_line_->width_;
+ char_type_ = chartype;
wchar_t wch = pCurChar->char_code();
wchar_t wForm = wch;
FX_SAFE_INT32 iCharWidth = 0;
- if (m_bCombText) {
- iCharWidth = m_iCombWidth;
- } else if (m_pFont) {
- iCharWidth = m_pFont->GetCharWidth(wForm).value_or(0);
- iCharWidth *= m_iFontSize;
- iCharWidth *= m_iHorizontalScale;
+ if (comb_text_) {
+ iCharWidth = comb_width_;
+ } else if (font_) {
+ iCharWidth = font_->GetCharWidth(wForm).value_or(0);
+ iCharWidth *= font_size_;
+ iCharWidth *= horizontal_scale_;
iCharWidth /= 100;
}
- iCharWidth += m_iCharSpace;
+ iCharWidth += char_space_;
int32_t iValidCharWidth = iCharWidth.ValueOrDefault(0);
- pCurChar->m_iCharWidth = iValidCharWidth;
+ pCurChar->char_width_ = iValidCharWidth;
iLineWidth += iValidCharWidth;
- if (!m_bSingleLine && chartype != FX_CHARTYPE::kSpace &&
+ if (!single_line_ && chartype != FX_CHARTYPE::kSpace &&
IsGreaterThanLineWidth(iLineWidth)) {
return EndBreak(CFGAS_Char::BreakType::kLine);
}
@@ -215,25 +218,25 @@
CFGAS_Char::BreakType CFGAS_TxtBreak::AppendChar(wchar_t wch) {
FX_CHARTYPE chartype = pdfium::unicode::GetCharType(wch);
- m_pCurLine->m_LineChars.emplace_back(wch, m_iHorizontalScale,
- m_iVerticalScale);
- CFGAS_Char* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_dwCharStyles = m_iAlignment | (1 << 8);
+ cur_line_->line_chars_.emplace_back(wch, horizontal_scale_, vertical_scale_);
+ CFGAS_Char* pCurChar = &cur_line_->line_chars_.back();
+ pCurChar->char_styles_ = alignment_ | (1 << 8);
CFGAS_Char::BreakType dwRet1 = CFGAS_Char::BreakType::kNone;
if (chartype != FX_CHARTYPE::kCombination &&
- GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
- m_eCharType != FX_CHARTYPE::kUnknown && !m_bSingleLine &&
- IsGreaterThanLineWidth(m_pCurLine->m_iWidth) &&
- (m_eCharType != FX_CHARTYPE::kSpace ||
+ GetUnifiedCharType(char_type_) != GetUnifiedCharType(chartype) &&
+ char_type_ != FX_CHARTYPE::kUnknown && !single_line_ &&
+ IsGreaterThanLineWidth(cur_line_->width_) &&
+ (char_type_ != FX_CHARTYPE::kSpace ||
chartype != FX_CHARTYPE::kControl)) {
dwRet1 = EndBreak(CFGAS_Char::BreakType::kLine);
- if (!m_pCurLine->m_LineChars.empty())
- pCurChar = &m_pCurLine->m_LineChars.back();
+ if (!cur_line_->line_chars_.empty()) {
+ pCurChar = &cur_line_->line_chars_.back();
+ }
}
CFGAS_Char::BreakType dwRet2 = CFGAS_Char::BreakType::kNone;
- if (wch == m_wParagraphBreakChar) {
+ if (wch == w_paragraph_break_char_) {
// This is handled in AppendChar_Control, but it seems like \n and \r
// don't get matched as control characters so we go into AppendChar_other
// and never detect the new paragraph ...
@@ -273,22 +276,22 @@
bool bAllChars) {
bool bDone = false;
CFGAS_Char* pTC;
- if (!m_bSingleLine && IsGreaterThanLineWidth(m_pCurLine->m_iWidth)) {
- pTC = m_pCurLine->LastChar();
+ if (!single_line_ && IsGreaterThanLineWidth(cur_line_->width_)) {
+ pTC = cur_line_->LastChar();
switch (pTC->GetCharType()) {
case FX_CHARTYPE::kTab:
case FX_CHARTYPE::kControl:
case FX_CHARTYPE::kSpace:
break;
default:
- SplitTextLine(m_pCurLine, pNextLine, bAllChars);
+ SplitTextLine(cur_line_, pNextLine, bAllChars);
bDone = true;
break;
}
}
if (bAllChars && !bDone) {
- int32_t iEndPos = m_pCurLine->m_iWidth;
- GetBreakPos(&m_pCurLine->m_LineChars, bAllChars, true, &iEndPos);
+ int32_t iEndPos = cur_line_->width_;
+ GetBreakPos(&cur_line_->line_chars_, bAllChars, true, &iEndPos);
}
}
@@ -297,72 +300,72 @@
CFGAS_BreakPiece tp;
std::deque<TPO> tpos;
CFGAS_Char* pTC;
- std::vector<CFGAS_Char>& chars = m_pCurLine->m_LineChars;
- if (!m_pCurLine->HasArabicChar()) {
+ std::vector<CFGAS_Char>& chars = cur_line_->line_chars_;
+ if (!cur_line_->HasArabicChar()) {
tp.SetStatus(dwStatus);
- tp.SetStartPos(m_pCurLine->m_iStart);
- tp.SetWidth(m_pCurLine->m_iWidth);
+ tp.SetStartPos(cur_line_->start_);
+ tp.SetWidth(cur_line_->width_);
tp.SetStartChar(0);
- tp.SetCharCount(fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars));
- tp.SetChars(&m_pCurLine->m_LineChars);
+ tp.SetCharCount(fxcrt::CollectionSize<int32_t>(cur_line_->line_chars_));
+ tp.SetChars(&cur_line_->line_chars_);
pTC = &chars[0];
- tp.SetCharStyles(pTC->m_dwCharStyles);
+ tp.SetCharStyles(pTC->char_styles_);
tp.SetHorizontalScale(pTC->horizonal_scale());
tp.SetVerticalScale(pTC->vertical_scale());
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
tpos.push_back({0, 0});
return tpos;
}
size_t iBidiNum = 0;
- for (size_t i = 0; i < m_pCurLine->m_LineChars.size(); ++i) {
+ for (size_t i = 0; i < cur_line_->line_chars_.size(); ++i) {
pTC = &chars[i];
- pTC->m_iBidiPos = static_cast<int32_t>(i);
+ pTC->bidi_pos_ = static_cast<int32_t>(i);
if (pTC->GetCharType() != FX_CHARTYPE::kControl)
iBidiNum = i;
if (i == 0)
- pTC->m_iBidiLevel = 1;
+ pTC->bidi_level_ = 1;
}
CFGAS_Char::BidiLine(&chars, iBidiNum + 1);
tp.SetStatus(CFGAS_Char::BreakType::kPiece);
- tp.SetStartPos(m_pCurLine->m_iStart);
- tp.SetChars(&m_pCurLine->m_LineChars);
+ tp.SetStartPos(cur_line_->start_);
+ tp.SetChars(&cur_line_->line_chars_);
int32_t iBidiLevel = -1;
int32_t iCharWidth;
int32_t i = 0;
int32_t j = -1;
- int32_t iCount = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(cur_line_->line_chars_);
while (i < iCount) {
pTC = &chars[i];
if (iBidiLevel < 0) {
- iBidiLevel = pTC->m_iBidiLevel;
+ iBidiLevel = pTC->bidi_level_;
tp.SetWidth(0);
tp.SetBidiLevel(iBidiLevel);
- tp.SetBidiPos(pTC->m_iBidiOrder);
- tp.SetCharStyles(pTC->m_dwCharStyles);
+ tp.SetBidiPos(pTC->bidi_order_);
+ tp.SetCharStyles(pTC->char_styles_);
tp.SetHorizontalScale(pTC->horizonal_scale());
tp.SetVerticalScale(pTC->vertical_scale());
tp.SetStatus(CFGAS_Char::BreakType::kPiece);
}
- if (iBidiLevel != pTC->m_iBidiLevel ||
- pTC->m_dwStatus != CFGAS_Char::BreakType::kNone) {
- if (iBidiLevel == pTC->m_iBidiLevel) {
- tp.SetStatus(pTC->m_dwStatus);
- iCharWidth = pTC->m_iCharWidth;
+ if (iBidiLevel != pTC->bidi_level_ ||
+ pTC->status_ != CFGAS_Char::BreakType::kNone) {
+ if (iBidiLevel == pTC->bidi_level_) {
+ tp.SetStatus(pTC->status_);
+ iCharWidth = pTC->char_width_;
if (iCharWidth > 0)
tp.IncrementWidth(iCharWidth);
i++;
}
tp.SetCharCount(i - tp.GetStartChar());
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
tp.IncrementStartPos(tp.GetWidth());
tp.SetStartChar(i);
tpos.push_back({++j, tp.GetBidiPos()});
iBidiLevel = -1;
} else {
- iCharWidth = pTC->m_iCharWidth;
+ iCharWidth = pTC->char_width_;
if (iCharWidth > 0)
tp.IncrementWidth(iCharWidth);
@@ -372,7 +375,7 @@
if (i > tp.GetStartChar()) {
tp.SetStatus(dwStatus);
tp.SetCharCount(i - tp.GetStartChar());
- m_pCurLine->m_LinePieces.push_back(tp);
+ cur_line_->line_pieces_.push_back(tp);
tpos.push_back({++j, tp.GetBidiPos()});
}
if (j > -1) {
@@ -380,12 +383,12 @@
std::sort(tpos.begin(), tpos.end());
int32_t iStartPos = 0;
for (i = 0; i <= j; i++) {
- CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpos[i].index];
+ CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[tpos[i].index];
ttp.SetStartPos(iStartPos);
iStartPos += ttp.GetWidth();
}
}
- m_pCurLine->m_LinePieces[j].SetStatus(dwStatus);
+ cur_line_->line_pieces_[j].SetStatus(dwStatus);
}
return tpos;
}
@@ -393,11 +396,11 @@
void CFGAS_TxtBreak::EndBreakAlignment(const std::deque<TPO>& tpos,
bool bAllChars,
CFGAS_Char::BreakType dwStatus) {
- int32_t iNetWidth = m_pCurLine->m_iWidth;
+ int32_t iNetWidth = cur_line_->width_;
int32_t iGapChars = 0;
bool bFind = false;
for (const TPO& pos : pdfium::Reversed(tpos)) {
- const CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[pos.index];
+ const CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[pos.index];
if (!bFind)
iNetWidth = ttp.GetEndPos();
@@ -405,14 +408,16 @@
int32_t j = bArabic ? 0 : ttp.GetCharCount() - 1;
while (j > -1 && j < ttp.GetCharCount()) {
const CFGAS_Char* pTC = ttp.GetChar(j);
- if (pTC->m_eLineBreakType == FX_LINEBREAKTYPE::kDIRECT_BRK)
+ if (pTC->line_break_type_ == FX_LINEBREAKTYPE::kDIRECT_BRK) {
iGapChars++;
+ }
if (!bFind || !bAllChars) {
FX_CHARTYPE chartype = pTC->GetCharType();
if (chartype == FX_CHARTYPE::kSpace ||
chartype == FX_CHARTYPE::kControl) {
- if (!bFind && bAllChars && pTC->m_iCharWidth > 0)
- iNetWidth -= pTC->m_iCharWidth;
+ if (!bFind && bAllChars && pTC->char_width_ > 0) {
+ iNetWidth -= pTC->char_width_;
+ }
} else {
bFind = true;
if (!bAllChars)
@@ -425,12 +430,12 @@
break;
}
- int32_t iOffset = m_iLineWidth - iNetWidth;
- if (iGapChars > 0 && m_iAlignment & CFX_TxtLineAlignment_Justified &&
+ int32_t iOffset = line_width_ - iNetWidth;
+ if (iGapChars > 0 && alignment_ & CFX_TxtLineAlignment_Justified &&
dwStatus != CFGAS_Char::BreakType::kParagraph) {
int32_t iStart = -1;
for (auto& tpo : tpos) {
- CFGAS_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
+ CFGAS_BreakPiece& ttp = cur_line_->line_pieces_[tpo.index];
if (iStart < -1)
iStart = ttp.GetStartPos();
else
@@ -439,26 +444,27 @@
for (int32_t j = 0; j < ttp.GetCharCount() && iGapChars > 0;
j++, iGapChars--) {
CFGAS_Char* pTC = ttp.GetChar(j);
- if (pTC->m_eLineBreakType != FX_LINEBREAKTYPE::kDIRECT_BRK ||
- pTC->m_iCharWidth < 0) {
+ if (pTC->line_break_type_ != FX_LINEBREAKTYPE::kDIRECT_BRK ||
+ pTC->char_width_ < 0) {
continue;
}
int32_t k = iOffset / iGapChars;
- pTC->m_iCharWidth += k;
+ pTC->char_width_ += k;
ttp.IncrementWidth(k);
iOffset -= k;
}
iStart += ttp.GetWidth();
}
- } else if (m_iAlignment & CFX_TxtLineAlignment_Center ||
- m_iAlignment & CFX_TxtLineAlignment_Right) {
- if (m_iAlignment & CFX_TxtLineAlignment_Center &&
- !(m_iAlignment & CFX_TxtLineAlignment_Right)) {
+ } else if (alignment_ & CFX_TxtLineAlignment_Center ||
+ alignment_ & CFX_TxtLineAlignment_Right) {
+ if (alignment_ & CFX_TxtLineAlignment_Center &&
+ !(alignment_ & CFX_TxtLineAlignment_Right)) {
iOffset /= 2;
}
if (iOffset > 0) {
- for (auto& ttp : m_pCurLine->m_LinePieces)
+ for (auto& ttp : cur_line_->line_pieces_) {
ttp.IncrementStartPos(iOffset);
+ }
}
}
}
@@ -466,40 +472,43 @@
CFGAS_Char::BreakType CFGAS_TxtBreak::EndBreak(CFGAS_Char::BreakType dwStatus) {
DCHECK(dwStatus != CFGAS_Char::BreakType::kNone);
- if (!m_pCurLine->m_LinePieces.empty()) {
+ if (!cur_line_->line_pieces_.empty()) {
if (dwStatus != CFGAS_Char::BreakType::kPiece)
- m_pCurLine->m_LinePieces.back().SetStatus(dwStatus);
- return m_pCurLine->m_LinePieces.back().GetStatus();
+ cur_line_->line_pieces_.back().SetStatus(dwStatus);
+ return cur_line_->line_pieces_.back().GetStatus();
}
if (HasLine()) {
- if (m_Lines[m_iReadyLineIndex].m_LinePieces.empty())
+ if (lines_[ready_line_index_].line_pieces_.empty()) {
return CFGAS_Char::BreakType::kNone;
+ }
if (dwStatus != CFGAS_Char::BreakType::kPiece)
- m_Lines[m_iReadyLineIndex].m_LinePieces.back().SetStatus(dwStatus);
- return m_Lines[m_iReadyLineIndex].m_LinePieces.back().GetStatus();
+ lines_[ready_line_index_].line_pieces_.back().SetStatus(dwStatus);
+ return lines_[ready_line_index_].line_pieces_.back().GetStatus();
}
- if (m_pCurLine->m_LineChars.empty())
+ if (cur_line_->line_chars_.empty()) {
return CFGAS_Char::BreakType::kNone;
+ }
- m_pCurLine->m_LineChars.back().m_dwStatus = dwStatus;
+ cur_line_->line_chars_.back().status_ = dwStatus;
if (dwStatus == CFGAS_Char::BreakType::kPiece)
return dwStatus;
- m_iReadyLineIndex = m_pCurLine == &m_Lines[0] ? 0 : 1;
- CFGAS_BreakLine* pNextLine = &m_Lines[1 - m_iReadyLineIndex];
- const bool bAllChars = m_iAlignment > CFX_TxtLineAlignment_Right;
+ ready_line_index_ = cur_line_ == &lines_[0] ? 0 : 1;
+ CFGAS_BreakLine* pNextLine = &lines_[1 - ready_line_index_];
+ const bool bAllChars = alignment_ > CFX_TxtLineAlignment_Right;
EndBreakSplitLine(pNextLine, bAllChars);
std::deque<TPO> tpos = EndBreakBidiLine(dwStatus);
- if (m_iAlignment > CFX_TxtLineAlignment_Left)
+ if (alignment_ > CFX_TxtLineAlignment_Left) {
EndBreakAlignment(tpos, bAllChars, dwStatus);
+ }
- m_pCurLine = pNextLine;
+ cur_line_ = pNextLine;
CFGAS_Char* pTC = GetLastChar(0, false, false);
- m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
+ char_type_ = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
return dwStatus;
}
@@ -518,7 +527,7 @@
int32_t iIndirectPos = -1;
int32_t iLast = -1;
int32_t iLastPos = -1;
- if (m_bSingleLine || *pEndPos <= m_iLineWidth) {
+ if (single_line_ || *pEndPos <= line_width_) {
if (!bAllChars)
return iLength;
@@ -531,10 +540,10 @@
FX_BREAKPROPERTY nNext;
CFGAS_Char* pCur = &chars[iLength--];
if (bAllChars)
- pCur->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ pCur->line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
nNext = pdfium::unicode::GetBreakProperty(pCur->char_code());
- int32_t iCharWidth = pCur->m_iCharWidth;
+ int32_t iCharWidth = pCur->char_width_;
if (iCharWidth > 0)
*pEndPos -= iCharWidth;
@@ -546,9 +555,9 @@
else
eType = GetLineBreakTypeFromPair(nCur, nNext);
if (bAllChars)
- pCur->m_eLineBreakType = eType;
+ pCur->line_break_type_ = eType;
if (!bOnlyBrk) {
- if (m_bSingleLine || *pEndPos <= m_iLineWidth ||
+ if (single_line_ || *pEndPos <= line_width_ ||
nCur == FX_BREAKPROPERTY::kSP) {
if (eType == FX_LINEBREAKTYPE::kDIRECT_BRK && iBreak < 0) {
iBreak = iLength;
@@ -564,7 +573,7 @@
iLastPos = *pEndPos;
}
}
- iCharWidth = pCur->m_iCharWidth;
+ iCharWidth = pCur->char_width_;
if (iCharWidth > 0)
*pEndPos -= iCharWidth;
}
@@ -594,39 +603,40 @@
DCHECK(pCurLine);
DCHECK(pNextLine);
- if (pCurLine->m_LineChars.size() < 2)
+ if (pCurLine->line_chars_.size() < 2) {
return;
+ }
- int32_t iEndPos = pCurLine->m_iWidth;
- std::vector<CFGAS_Char>& curChars = pCurLine->m_LineChars;
+ int32_t iEndPos = pCurLine->width_;
+ std::vector<CFGAS_Char>& curChars = pCurLine->line_chars_;
int32_t iCharPos = GetBreakPos(&curChars, bAllChars, false, &iEndPos);
if (iCharPos < 0)
iCharPos = 0;
iCharPos++;
- if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
+ if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->line_chars_)) {
pNextLine->Clear();
CFGAS_Char* pTC = &curChars[iCharPos - 1];
- pTC->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ pTC->line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
return;
}
- pNextLine->m_LineChars =
+ pNextLine->line_chars_ =
std::vector<CFGAS_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
- pCurLine->m_iWidth = iEndPos;
+ pCurLine->width_ = iEndPos;
CFGAS_Char* pTC = &curChars[iCharPos - 1];
- pTC->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
+ pTC->line_break_type_ = FX_LINEBREAKTYPE::kUNKNOWN;
int32_t iWidth = 0;
- for (size_t i = 0; i < pNextLine->m_LineChars.size(); ++i) {
- if (pNextLine->m_LineChars[i].GetCharType() >= FX_CHARTYPE::kArabicAlef) {
+ for (size_t i = 0; i < pNextLine->line_chars_.size(); ++i) {
+ if (pNextLine->line_chars_[i].GetCharType() >= FX_CHARTYPE::kArabicAlef) {
pCurLine->DecrementArabicCharCount();
pNextLine->IncrementArabicCharCount();
}
- iWidth += std::max(0, pNextLine->m_LineChars[i].m_iCharWidth);
- pNextLine->m_LineChars[i].m_dwStatus = CFGAS_Char::BreakType::kNone;
+ iWidth += std::max(0, pNextLine->line_chars_[i].char_width_);
+ pNextLine->line_chars_[i].status_ = CFGAS_Char::BreakType::kNone;
}
- pNextLine->m_iWidth = iWidth;
+ pNextLine->width_ = iWidth;
}
size_t CFGAS_TxtBreak::GetDisplayPos(const Run& run,
diff --git a/xfa/fgas/layout/cfgas_txtbreak.h b/xfa/fgas/layout/cfgas_txtbreak.h
index 0393266..52bd69f 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.h
+++ b/xfa/fgas/layout/cfgas_txtbreak.h
@@ -101,8 +101,8 @@
CFGAS_BreakLine* pNextLine,
bool bAllChars);
- int32_t m_iAlignment = CFX_TxtLineAlignment_Left;
- int32_t m_iCombWidth = 360000;
+ int32_t alignment_ = CFX_TxtLineAlignment_Left;
+ int32_t comb_width_ = 360000;
};
#endif // XFA_FGAS_LAYOUT_CFGAS_TXTBREAK_H_
diff --git a/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp b/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
index 0e328be..c1483ab 100644
--- a/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak_unittest.cpp
@@ -45,7 +45,7 @@
}
std::vector<CFGAS_Char> chars =
- txt_break->GetCurrentLineForTesting()->m_LineChars;
+ txt_break->GetCurrentLineForTesting()->line_chars_;
CFGAS_Char::BidiLine(&chars, chars.size());
EXPECT_EQ(3u, chars.size());
}
diff --git a/xfa/fwl/cfwl_app.cpp b/xfa/fwl/cfwl_app.cpp
index 2741b02..d542af9 100644
--- a/xfa/fwl/cfwl_app.cpp
+++ b/xfa/fwl/cfwl_app.cpp
@@ -14,21 +14,21 @@
namespace pdfium {
CFWL_App::CFWL_App(AdapterIface* pAdapter)
- : m_pAdapter(pAdapter),
- m_pWidgetMgr(cppgc::MakeGarbageCollected<CFWL_WidgetMgr>(
+ : adapter_(pAdapter),
+ widget_mgr_(cppgc::MakeGarbageCollected<CFWL_WidgetMgr>(
pAdapter->GetHeap()->GetAllocationHandle(),
pAdapter->GetWidgetMgrAdapter(),
this)),
- m_pNoteDriver(cppgc::MakeGarbageCollected<CFWL_NoteDriver>(
+ note_driver_(cppgc::MakeGarbageCollected<CFWL_NoteDriver>(
pAdapter->GetHeap()->GetAllocationHandle(),
this)) {}
CFWL_App::~CFWL_App() = default;
void CFWL_App::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pAdapter);
- visitor->Trace(m_pWidgetMgr);
- visitor->Trace(m_pNoteDriver);
+ visitor->Trace(adapter_);
+ visitor->Trace(widget_mgr_);
+ visitor->Trace(note_driver_);
}
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_app.h b/xfa/fwl/cfwl_app.h
index 6d91cc4..8ce895f 100644
--- a/xfa/fwl/cfwl_app.h
+++ b/xfa/fwl/cfwl_app.h
@@ -36,24 +36,24 @@
void Trace(cppgc::Visitor* visitor) const;
CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() const {
- return m_pAdapter->GetWidgetMgrAdapter();
+ return adapter_->GetWidgetMgrAdapter();
}
CFX_Timer::HandlerIface* GetTimerHandler() const {
- return m_pAdapter->GetTimerHandler();
+ return adapter_->GetTimerHandler();
}
IFWL_ThemeProvider* GetThemeProvider() const {
- return m_pAdapter->GetThemeProvider();
+ return adapter_->GetThemeProvider();
}
- cppgc::Heap* GetHeap() const { return m_pAdapter->GetHeap(); }
- CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr; }
- CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver; }
+ cppgc::Heap* GetHeap() const { return adapter_->GetHeap(); }
+ CFWL_WidgetMgr* GetWidgetMgr() const { return widget_mgr_; }
+ CFWL_NoteDriver* GetNoteDriver() const { return note_driver_; }
private:
explicit CFWL_App(AdapterIface* pAdapter);
- cppgc::Member<AdapterIface> const m_pAdapter;
- cppgc::Member<CFWL_WidgetMgr> m_pWidgetMgr;
- cppgc::Member<CFWL_NoteDriver> m_pNoteDriver;
+ cppgc::Member<AdapterIface> const adapter_;
+ cppgc::Member<CFWL_WidgetMgr> widget_mgr_;
+ cppgc::Member<CFWL_NoteDriver> note_driver_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index 7091da4..b54fc14 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -37,10 +37,11 @@
if (!pGraphics)
return;
- if ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0) {
+ if ((properties_.states_ & FWL_STATE_WGT_Focused) == 0) {
GenerateBarcodeImageCache();
- if (!m_pBarcodeEngine || m_eStatus != Status::kEncodeSuccess)
+ if (!barcode_engine_ || status_ != Status::kEncodeSuccess) {
return;
+ }
CFX_Matrix mt;
mt.e = GetRTClient().left;
@@ -48,141 +49,156 @@
mt.Concat(matrix);
// TODO(tsepez): Curious as to why |mt| is unused?
- m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), matrix);
+ barcode_engine_->RenderDevice(pGraphics->GetRenderDevice(), matrix);
return;
}
CFWL_Edit::DrawWidget(pGraphics, matrix);
}
void CFWL_Barcode::SetType(BC_TYPE type) {
- if (m_type == type)
+ if (type_ == type) {
return;
+ }
- m_pBarcodeEngine.reset();
- m_type = type;
- m_eStatus = Status::kNeedUpdate;
+ barcode_engine_.reset();
+ type_ = type;
+ status_ = Status::kNeedUpdate;
}
void CFWL_Barcode::SetText(const WideString& wsText) {
- m_pBarcodeEngine.reset();
- m_eStatus = Status::kNeedUpdate;
+ barcode_engine_.reset();
+ status_ = Status::kNeedUpdate;
CFWL_Edit::SetText(wsText);
}
void CFWL_Barcode::SetTextSkipNotify(const WideString& wsText) {
- m_pBarcodeEngine.reset();
- m_eStatus = Status::kNeedUpdate;
+ barcode_engine_.reset();
+ status_ = Status::kNeedUpdate;
CFWL_Edit::SetTextSkipNotify(wsText);
}
bool CFWL_Barcode::IsProtectedType() const {
- if (!m_pBarcodeEngine)
+ if (!barcode_engine_) {
return true;
+ }
- BC_TYPE tEngineType = m_pBarcodeEngine->GetType();
+ BC_TYPE tEngineType = barcode_engine_->GetType();
return tEngineType == BC_TYPE::kQRCode || tEngineType == BC_TYPE::kPDF417 ||
tEngineType == BC_TYPE::kDataMatrix;
}
void CFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) {
if (pEvent->GetType() == CFWL_Event::Type::TextWillChange) {
- m_pBarcodeEngine.reset();
- m_eStatus = Status::kNeedUpdate;
+ barcode_engine_.reset();
+ status_ = Status::kNeedUpdate;
}
CFWL_Edit::OnProcessEvent(pEvent);
}
void CFWL_Barcode::SetModuleHeight(int32_t height) {
- m_nModuleHeight = height;
+ module_height_ = height;
}
void CFWL_Barcode::SetModuleWidth(int32_t width) {
- m_nModuleWidth = width;
+ module_width_ = width;
}
void CFWL_Barcode::SetDataLength(int32_t dataLength) {
- m_nDataLength = dataLength;
+ data_length_ = dataLength;
SetLimit(dataLength);
}
void CFWL_Barcode::SetCalChecksum(bool calChecksum) {
- m_bCalChecksum = calChecksum;
+ cal_checksum_ = calChecksum;
}
void CFWL_Barcode::SetPrintChecksum(bool printChecksum) {
- m_bPrintChecksum = printChecksum;
+ print_checksum_ = printChecksum;
}
void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) {
- m_eTextLocation = location;
+ text_location_ = location;
}
void CFWL_Barcode::SetWideNarrowRatio(int8_t ratio) {
- m_nWideNarrowRatio = ratio;
+ wide_narrow_ratio_ = ratio;
}
void CFWL_Barcode::SetStartChar(char startChar) {
- m_cStartChar = startChar;
+ start_char_ = startChar;
}
void CFWL_Barcode::SetEndChar(char endChar) {
- m_cEndChar = endChar;
+ end_char_ = endChar;
}
void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) {
- m_nECLevel = ecLevel;
+ eclevel_ = ecLevel;
}
void CFWL_Barcode::GenerateBarcodeImageCache() {
- if (m_eStatus != Status::kNeedUpdate)
+ if (status_ != Status::kNeedUpdate) {
return;
+ }
- m_eStatus = Status::kNormal;
+ status_ = Status::kNormal;
CreateBarcodeEngine();
- if (!m_pBarcodeEngine)
+ if (!barcode_engine_) {
return;
+ }
IFWL_ThemeProvider* pTheme = GetThemeProvider();
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
if (RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(part)) {
if (CFX_Font* pCXFont = pFont->GetDevFont())
- m_pBarcodeEngine->SetFont(pCXFont);
+ barcode_engine_->SetFont(pCXFont);
}
- m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(part));
- m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(part));
- m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height));
- m_pBarcodeEngine->SetWidth(int32_t(GetRTClient().width));
- if (m_nModuleHeight.has_value())
- m_pBarcodeEngine->SetModuleHeight(m_nModuleHeight.value());
- if (m_nModuleWidth.has_value())
- m_pBarcodeEngine->SetModuleWidth(m_nModuleWidth.value());
- if (m_nDataLength.has_value())
- m_pBarcodeEngine->SetDataLength(m_nDataLength.value());
- if (m_bCalChecksum.has_value())
- m_pBarcodeEngine->SetCalChecksum(m_bCalChecksum.value());
- if (m_bPrintChecksum.has_value())
- m_pBarcodeEngine->SetPrintChecksum(m_bPrintChecksum.value());
- if (m_eTextLocation.has_value())
- m_pBarcodeEngine->SetTextLocation(m_eTextLocation.value());
- if (m_nWideNarrowRatio.has_value())
- m_pBarcodeEngine->SetWideNarrowRatio(m_nWideNarrowRatio.value());
- if (m_cStartChar.has_value())
- m_pBarcodeEngine->SetStartChar(m_cStartChar.value());
- if (m_cEndChar.has_value())
- m_pBarcodeEngine->SetEndChar(m_cEndChar.value());
- if (m_nECLevel.has_value())
- m_pBarcodeEngine->SetErrorCorrectionLevel(m_nECLevel.value());
+ barcode_engine_->SetFontSize(pTheme->GetFontSize(part));
+ barcode_engine_->SetFontColor(pTheme->GetTextColor(part));
+ barcode_engine_->SetHeight(int32_t(GetRTClient().height));
+ barcode_engine_->SetWidth(int32_t(GetRTClient().width));
+ if (module_height_.has_value()) {
+ barcode_engine_->SetModuleHeight(module_height_.value());
+ }
+ if (module_width_.has_value()) {
+ barcode_engine_->SetModuleWidth(module_width_.value());
+ }
+ if (data_length_.has_value()) {
+ barcode_engine_->SetDataLength(data_length_.value());
+ }
+ if (cal_checksum_.has_value()) {
+ barcode_engine_->SetCalChecksum(cal_checksum_.value());
+ }
+ if (print_checksum_.has_value()) {
+ barcode_engine_->SetPrintChecksum(print_checksum_.value());
+ }
+ if (text_location_.has_value()) {
+ barcode_engine_->SetTextLocation(text_location_.value());
+ }
+ if (wide_narrow_ratio_.has_value()) {
+ barcode_engine_->SetWideNarrowRatio(wide_narrow_ratio_.value());
+ }
+ if (start_char_.has_value()) {
+ barcode_engine_->SetStartChar(start_char_.value());
+ }
+ if (end_char_.has_value()) {
+ barcode_engine_->SetEndChar(end_char_.value());
+ }
+ if (eclevel_.has_value()) {
+ barcode_engine_->SetErrorCorrectionLevel(eclevel_.value());
+ }
- m_eStatus = m_pBarcodeEngine->Encode(GetText().AsStringView())
- ? Status::kEncodeSuccess
- : Status::kNormal;
+ status_ = barcode_engine_->Encode(GetText().AsStringView())
+ ? Status::kEncodeSuccess
+ : Status::kNormal;
}
void CFWL_Barcode::CreateBarcodeEngine() {
- if (m_pBarcodeEngine || m_type == BC_TYPE::kUnknown)
+ if (barcode_engine_ || type_ == BC_TYPE::kUnknown) {
return;
+ }
- m_pBarcodeEngine = CFX_Barcode::Create(m_type);
+ barcode_engine_ = CFX_Barcode::Create(type_);
}
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h
index 3657b83..5168b77 100644
--- a/xfa/fwl/cfwl_barcode.h
+++ b/xfa/fwl/cfwl_barcode.h
@@ -61,19 +61,19 @@
void GenerateBarcodeImageCache();
void CreateBarcodeEngine();
- BC_TYPE m_type = BC_TYPE::kUnknown;
- Status m_eStatus = Status::kNormal;
- std::optional<BC_TEXT_LOC> m_eTextLocation;
- std::optional<bool> m_bCalChecksum;
- std::optional<bool> m_bPrintChecksum;
- std::optional<char> m_cStartChar;
- std::optional<char> m_cEndChar;
- std::optional<int8_t> m_nWideNarrowRatio;
- std::optional<int32_t> m_nModuleHeight;
- std::optional<int32_t> m_nModuleWidth;
- std::optional<int32_t> m_nDataLength;
- std::optional<int32_t> m_nECLevel;
- std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
+ BC_TYPE type_ = BC_TYPE::kUnknown;
+ Status status_ = Status::kNormal;
+ std::optional<BC_TEXT_LOC> text_location_;
+ std::optional<bool> cal_checksum_;
+ std::optional<bool> print_checksum_;
+ std::optional<char> start_char_;
+ std::optional<char> end_char_;
+ std::optional<int8_t> wide_narrow_ratio_;
+ std::optional<int32_t> module_height_;
+ std::optional<int32_t> module_width_;
+ std::optional<int32_t> data_length_;
+ std::optional<int32_t> eclevel_;
+ std::unique_ptr<CFX_Barcode> barcode_engine_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index 2dea5d0..754a0d2 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -47,27 +47,28 @@
}
void CFWL_Caret::ShowCaret() {
- m_pTimer = std::make_unique<CFX_Timer>(GetFWLApp()->GetTimerHandler(), this,
- kBlinkPeriodMs);
+ timer_ = std::make_unique<CFX_Timer>(GetFWLApp()->GetTimerHandler(), this,
+ kBlinkPeriodMs);
RemoveStates(FWL_STATE_WGT_Invisible);
SetStates(kStateHighlight);
}
void CFWL_Caret::HideCaret() {
- m_pTimer.reset();
+ timer_.reset();
SetStates(FWL_STATE_WGT_Invisible);
}
void CFWL_Caret::DrawCaretBK(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
- if (!(m_Properties.m_dwStates & kStateHighlight))
+ if (!(properties_.states_ & kStateHighlight)) {
return;
+ }
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- param.m_PartRect = CFX_RectF(0, 0, GetWidgetRect().Size());
- param.m_dwStates = CFWL_PartState::kHightLight;
- param.m_matrix = mtMatrix;
+ param.part_rect_ = CFX_RectF(0, 0, GetWidgetRect().Size());
+ param.states_ = CFWL_PartState::kHightLight;
+ param.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(param);
}
diff --git a/xfa/fwl/cfwl_caret.h b/xfa/fwl/cfwl_caret.h
index 5d1dbfe..e2626ed 100644
--- a/xfa/fwl/cfwl_caret.h
+++ b/xfa/fwl/cfwl_caret.h
@@ -40,7 +40,7 @@
void DrawCaretBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
- std::unique_ptr<CFX_Timer> m_pTimer;
+ std::unique_ptr<CFX_Timer> timer_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index b5b4421..63f06f8 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -31,7 +31,7 @@
CFWL_CheckBox::CFWL_CheckBox(CFWL_App* app)
: CFWL_Widget(app, Properties(), nullptr) {
- m_TTOStyles.single_line_ = true;
+ tto_styles_.single_line_ = true;
}
CFWL_CheckBox::~CFWL_CheckBox() = default;
@@ -41,7 +41,7 @@
}
void CFWL_CheckBox::SetBoxSize(float fHeight) {
- m_fBoxHeight = fHeight;
+ box_height_ = fHeight;
}
void CFWL_CheckBox::Update() {
@@ -64,124 +64,132 @@
IFWL_ThemeProvider* pTheme = GetThemeProvider();
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- param.m_dwStates = dwStates;
- param.m_matrix = matrix;
- param.m_PartRect = m_ClientRect;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
- param.m_pRtData = &m_FocusRect;
+ param.states_ = dwStates;
+ param.matrix_ = matrix;
+ param.part_rect_ = client_rect_;
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
+ param.data_rect_ = &focus_rect_;
+ }
pTheme->DrawBackground(param);
CFWL_ThemeBackground checkParam(CFWL_ThemePart::Part::kCheckBox, this,
pGraphics);
- checkParam.m_dwStates = dwStates;
- checkParam.m_matrix = matrix;
- checkParam.m_PartRect = m_BoxRect;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
- checkParam.m_pRtData = &m_FocusRect;
+ checkParam.states_ = dwStates;
+ checkParam.matrix_ = matrix;
+ checkParam.part_rect_ = box_rect_;
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
+ checkParam.data_rect_ = &focus_rect_;
+ }
pTheme->DrawBackground(checkParam);
CFWL_ThemeText textParam(CFWL_ThemePart::Part::kCaption, this, pGraphics);
- textParam.m_dwStates = dwStates;
- textParam.m_matrix = matrix;
- textParam.m_PartRect = m_CaptionRect;
- textParam.m_wsText = WideString::FromASCII("Check box");
- textParam.m_dwTTOStyles = m_TTOStyles;
- textParam.m_iTTOAlign = m_iTTOAlign;
+ textParam.states_ = dwStates;
+ textParam.matrix_ = matrix;
+ textParam.part_rect_ = caption_rect_;
+ textParam.text_ = WideString::FromASCII("Check box");
+ textParam.tto_styles_ = tto_styles_;
+ textParam.tto_align_ = tto_align_;
pTheme->DrawText(textParam);
}
void CFWL_CheckBox::SetCheckState(int32_t iCheck) {
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_CheckMask;
+ properties_.states_ &= ~FWL_STATE_CKB_CheckMask;
switch (iCheck) {
case 1:
- m_Properties.m_dwStates |= FWL_STATE_CKB_Checked;
+ properties_.states_ |= FWL_STATE_CKB_Checked;
break;
case 2:
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CKB_3State)
- m_Properties.m_dwStates |= FWL_STATE_CKB_Neutral;
+ if (properties_.style_exts_ & FWL_STYLEEXT_CKB_3State) {
+ properties_.states_ |= FWL_STATE_CKB_Neutral;
+ }
break;
default:
break;
}
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
void CFWL_CheckBox::Layout() {
- m_WidgetRect.width = FXSYS_roundf(m_WidgetRect.width);
- m_WidgetRect.height = FXSYS_roundf(m_WidgetRect.height);
- m_ClientRect = GetClientRect();
+ widget_rect_.width = FXSYS_roundf(widget_rect_.width);
+ widget_rect_.height = FXSYS_roundf(widget_rect_.height);
+ client_rect_ = GetClientRect();
- float fTextLeft = m_ClientRect.left + m_fBoxHeight;
- m_BoxRect = CFX_RectF(m_ClientRect.TopLeft(), m_fBoxHeight, m_fBoxHeight);
- m_CaptionRect =
- CFX_RectF(fTextLeft, m_ClientRect.top, m_ClientRect.right() - fTextLeft,
- m_ClientRect.height);
- m_CaptionRect.Inflate(-kCaptionMargin, -kCaptionMargin);
+ float fTextLeft = client_rect_.left + box_height_;
+ box_rect_ = CFX_RectF(client_rect_.TopLeft(), box_height_, box_height_);
+ caption_rect_ =
+ CFX_RectF(fTextLeft, client_rect_.top, client_rect_.right() - fTextLeft,
+ client_rect_.height);
+ caption_rect_.Inflate(-kCaptionMargin, -kCaptionMargin);
- CFX_RectF rtFocus = m_CaptionRect;
- CalcTextRect(WideString::FromASCII("Check box"), m_TTOStyles, m_iTTOAlign,
+ CFX_RectF rtFocus = caption_rect_;
+ CalcTextRect(WideString::FromASCII("Check box"), tto_styles_, tto_align_,
&rtFocus);
- m_FocusRect = CFX_RectF(m_CaptionRect.TopLeft(),
- std::max(m_CaptionRect.width, rtFocus.width),
- std::min(m_CaptionRect.height, rtFocus.height));
- m_FocusRect.Inflate(1, 1);
+ focus_rect_ = CFX_RectF(caption_rect_.TopLeft(),
+ std::max(caption_rect_.width, rtFocus.width),
+ std::min(caption_rect_.height, rtFocus.height));
+ focus_rect_.Inflate(1, 1);
}
Mask<CFWL_PartState> CFWL_CheckBox::GetPartStates() const {
Mask<CFWL_PartState> dwStates = CFWL_PartState::kNormal;
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_CheckMask) ==
+ if ((properties_.states_ & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral) {
dwStates = CFWL_PartState::kNeutral;
- } else if ((m_Properties.m_dwStates & FWL_STATE_CKB_CheckMask) ==
+ } else if ((properties_.states_ & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Checked) {
dwStates = CFWL_PartState::kChecked;
}
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
dwStates |= CFWL_PartState::kDisabled;
- else if (m_Properties.m_dwStates & FWL_STATE_CKB_Hovered)
+ } else if (properties_.states_ & FWL_STATE_CKB_Hovered) {
dwStates |= CFWL_PartState::kHovered;
- else if (m_Properties.m_dwStates & FWL_STATE_CKB_Pressed)
+ } else if (properties_.states_ & FWL_STATE_CKB_Pressed) {
dwStates |= CFWL_PartState::kPressed;
- else
+ } else {
dwStates |= CFWL_PartState::kNormal;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
+ }
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
dwStates |= CFWL_PartState::kFocused;
+ }
return dwStates;
}
void CFWL_CheckBox::UpdateTextOutStyles() {
- m_iTTOAlign = FDE_TextAlignment::kTopLeft;
- m_TTOStyles.Reset();
- m_TTOStyles.single_line_ = true;
+ tto_align_ = FDE_TextAlignment::kTopLeft;
+ tto_styles_.Reset();
+ tto_styles_.single_line_ = true;
}
void CFWL_CheckBox::NextStates() {
- uint32_t dwFirststate = m_Properties.m_dwStates;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CKB_RadioButton) {
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_CheckMask) ==
+ uint32_t dwFirststate = properties_.states_;
+ if (properties_.style_exts_ & FWL_STYLEEXT_CKB_RadioButton) {
+ if ((properties_.states_ & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Unchecked) {
- m_Properties.m_dwStates |= FWL_STATE_CKB_Checked;
+ properties_.states_ |= FWL_STATE_CKB_Checked;
}
} else {
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_CheckMask) ==
+ if ((properties_.states_ & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral) {
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_CheckMask;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CKB_3State)
- m_Properties.m_dwStates |= FWL_STATE_CKB_Checked;
- } else if ((m_Properties.m_dwStates & FWL_STATE_CKB_CheckMask) ==
+ properties_.states_ &= ~FWL_STATE_CKB_CheckMask;
+ if (properties_.style_exts_ & FWL_STYLEEXT_CKB_3State) {
+ properties_.states_ |= FWL_STATE_CKB_Checked;
+ }
+ } else if ((properties_.states_ & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Checked) {
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_CheckMask;
+ properties_.states_ &= ~FWL_STATE_CKB_CheckMask;
} else {
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CKB_3State)
- m_Properties.m_dwStates |= FWL_STATE_CKB_Neutral;
- else
- m_Properties.m_dwStates |= FWL_STATE_CKB_Checked;
+ if (properties_.style_exts_ & FWL_STYLEEXT_CKB_3State) {
+ properties_.states_ |= FWL_STATE_CKB_Neutral;
+ } else {
+ properties_.states_ |= FWL_STATE_CKB_Checked;
+ }
}
}
- RepaintRect(m_ClientRect);
- if (dwFirststate == m_Properties.m_dwStates)
+ RepaintRect(client_rect_);
+ if (dwFirststate == properties_.states_) {
return;
+ }
CFWL_Event wmCheckBoxState(CFWL_Event::Type::CheckStateChanged, this);
DispatchEvent(&wmCheckBoxState);
@@ -197,7 +205,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown();
break;
@@ -217,8 +225,9 @@
}
case CFWL_Message::Type::kKey: {
CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage);
- if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown)
+ if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
OnKeyDown(pKey);
+ }
break;
}
default:
@@ -235,89 +244,95 @@
}
void CFWL_CheckBox::OnFocusGained() {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_CheckBox::OnFocusLost() {
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_CheckBox::OnLButtonDown() {
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
return;
+ }
- m_bBtnDown = true;
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_Hovered;
- m_Properties.m_dwStates |= FWL_STATE_CKB_Pressed;
- RepaintRect(m_ClientRect);
+ btn_down_ = true;
+ properties_.states_ &= ~FWL_STATE_CKB_Hovered;
+ properties_.states_ |= FWL_STATE_CKB_Pressed;
+ RepaintRect(client_rect_);
}
void CFWL_CheckBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- if (!m_bBtnDown)
+ if (!btn_down_) {
return;
+ }
- m_bBtnDown = false;
- if (!m_ClientRect.Contains(pMsg->m_pos))
+ btn_down_ = false;
+ if (!client_rect_.Contains(pMsg->pos_)) {
return;
+ }
- m_Properties.m_dwStates |= FWL_STATE_CKB_Hovered;
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_Pressed;
+ properties_.states_ |= FWL_STATE_CKB_Hovered;
+ properties_.states_ &= ~FWL_STATE_CKB_Pressed;
NextStates();
}
void CFWL_CheckBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
return;
+ }
bool bRepaint = false;
- if (m_bBtnDown) {
- if (m_ClientRect.Contains(pMsg->m_pos)) {
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_Pressed) == 0) {
+ if (btn_down_) {
+ if (client_rect_.Contains(pMsg->pos_)) {
+ if ((properties_.states_ & FWL_STATE_CKB_Pressed) == 0) {
bRepaint = true;
- m_Properties.m_dwStates |= FWL_STATE_CKB_Pressed;
+ properties_.states_ |= FWL_STATE_CKB_Pressed;
}
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_Hovered)) {
+ if ((properties_.states_ & FWL_STATE_CKB_Hovered)) {
bRepaint = true;
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_Hovered;
+ properties_.states_ &= ~FWL_STATE_CKB_Hovered;
}
} else {
- if (m_Properties.m_dwStates & FWL_STATE_CKB_Pressed) {
+ if (properties_.states_ & FWL_STATE_CKB_Pressed) {
bRepaint = true;
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_Pressed;
+ properties_.states_ &= ~FWL_STATE_CKB_Pressed;
}
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_Hovered) == 0) {
+ if ((properties_.states_ & FWL_STATE_CKB_Hovered) == 0) {
bRepaint = true;
- m_Properties.m_dwStates |= FWL_STATE_CKB_Hovered;
+ properties_.states_ |= FWL_STATE_CKB_Hovered;
}
}
} else {
- if (m_ClientRect.Contains(pMsg->m_pos)) {
- if ((m_Properties.m_dwStates & FWL_STATE_CKB_Hovered) == 0) {
+ if (client_rect_.Contains(pMsg->pos_)) {
+ if ((properties_.states_ & FWL_STATE_CKB_Hovered) == 0) {
bRepaint = true;
- m_Properties.m_dwStates |= FWL_STATE_CKB_Hovered;
+ properties_.states_ |= FWL_STATE_CKB_Hovered;
}
}
}
if (bRepaint)
- RepaintRect(m_BoxRect);
+ RepaintRect(box_rect_);
}
void CFWL_CheckBox::OnMouseLeave() {
- if (m_bBtnDown)
- m_Properties.m_dwStates |= FWL_STATE_CKB_Hovered;
- else
- m_Properties.m_dwStates &= ~FWL_STATE_CKB_Hovered;
+ if (btn_down_) {
+ properties_.states_ |= FWL_STATE_CKB_Hovered;
+ } else {
+ properties_.states_ &= ~FWL_STATE_CKB_Hovered;
+ }
- RepaintRect(m_BoxRect);
+ RepaintRect(box_rect_);
}
void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) {
- if (pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Tab)
+ if (pMsg->key_code_or_char_ == XFA_FWL_VKEY_Tab) {
return;
- if (pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return ||
- pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Space) {
+ }
+ if (pMsg->key_code_or_char_ == XFA_FWL_VKEY_Return ||
+ pMsg->key_code_or_char_ == XFA_FWL_VKEY_Space) {
NextStates();
}
}
diff --git a/xfa/fwl/cfwl_checkbox.h b/xfa/fwl/cfwl_checkbox.h
index 9787532..f0d078ba 100644
--- a/xfa/fwl/cfwl_checkbox.h
+++ b/xfa/fwl/cfwl_checkbox.h
@@ -64,14 +64,14 @@
void OnMouseLeave();
void OnKeyDown(CFWL_MessageKey* pMsg);
- CFX_RectF m_ClientRect;
- CFX_RectF m_BoxRect;
- CFX_RectF m_CaptionRect;
- CFX_RectF m_FocusRect;
- FDE_TextStyle m_TTOStyles;
- FDE_TextAlignment m_iTTOAlign = FDE_TextAlignment::kCenter;
- bool m_bBtnDown = false;
- float m_fBoxHeight = 16.0f;
+ CFX_RectF client_rect_;
+ CFX_RectF box_rect_;
+ CFX_RectF caption_rect_;
+ CFX_RectF focus_rect_;
+ FDE_TextStyle tto_styles_;
+ FDE_TextAlignment tto_align_ = FDE_TextAlignment::kCenter;
+ bool btn_down_ = false;
+ float box_height_ = 16.0f;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 86103ba..40e800f 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -29,12 +29,12 @@
CFWL_ComboBox::CFWL_ComboBox(CFWL_App* app)
: CFWL_Widget(app, Properties(), nullptr),
- m_pEdit(cppgc::MakeGarbageCollected<CFWL_ComboEdit>(
+ edit_(cppgc::MakeGarbageCollected<CFWL_ComboEdit>(
app->GetHeap()->GetAllocationHandle(),
app,
Properties(),
this)),
- m_pListBox(cppgc::MakeGarbageCollected<CFWL_ComboList>(
+ list_box_(cppgc::MakeGarbageCollected<CFWL_ComboList>(
app->GetHeap()->GetAllocationHandle(),
app,
Properties{FWL_STYLE_WGT_Border | FWL_STYLE_WGT_VScroll, 0,
@@ -45,8 +45,8 @@
void CFWL_ComboBox::Trace(cppgc::Visitor* visitor) const {
CFWL_Widget::Trace(visitor);
- visitor->Trace(m_pEdit);
- visitor->Trace(m_pListBox);
+ visitor->Trace(edit_);
+ visitor->Trace(list_box_);
}
FWL_Type CFWL_ComboBox::GetClassID() const {
@@ -54,15 +54,15 @@
}
void CFWL_ComboBox::AddString(const WideString& wsText) {
- m_pListBox->AddString(wsText);
+ list_box_->AddString(wsText);
}
void CFWL_ComboBox::RemoveAt(int32_t iIndex) {
- m_pListBox->RemoveAt(iIndex);
+ list_box_->RemoveAt(iIndex);
}
void CFWL_ComboBox::RemoveAll() {
- m_pListBox->DeleteAll();
+ list_box_->DeleteAll();
}
void CFWL_ComboBox::ModifyStyleExts(uint32_t dwStyleExtsAdded,
@@ -70,11 +70,11 @@
bool bAddDropDown = !!(dwStyleExtsAdded & FWL_STYLEEXT_CMB_DropDown);
bool bDelDropDown = !!(dwStyleExtsRemoved & FWL_STYLEEXT_CMB_DropDown);
dwStyleExtsRemoved &= ~FWL_STYLEEXT_CMB_DropDown;
- m_Properties.m_dwStyleExts |= FWL_STYLEEXT_CMB_DropDown;
+ properties_.style_exts_ |= FWL_STYLEEXT_CMB_DropDown;
if (bAddDropDown)
- m_pEdit->ModifyStyleExts(0, FWL_STYLEEXT_EDT_ReadOnly);
+ edit_->ModifyStyleExts(0, FWL_STYLEEXT_EDT_ReadOnly);
else if (bDelDropDown)
- m_pEdit->ModifyStyleExts(FWL_STYLEEXT_EDT_ReadOnly, 0);
+ edit_->ModifyStyleExts(FWL_STYLEEXT_EDT_ReadOnly, 0);
CFWL_Widget::ModifyStyleExts(dwStyleExtsAdded, dwStyleExtsRemoved);
}
@@ -83,20 +83,22 @@
if (IsLocked())
return;
- if (m_pEdit)
+ if (edit_) {
ResetEditAlignment();
+ }
Layout();
}
FWL_WidgetHit CFWL_ComboBox::HitTest(const CFX_PointF& point) {
- CFX_RectF rect(0, 0, m_WidgetRect.width - m_BtnRect.width,
- m_WidgetRect.height);
+ CFX_RectF rect(0, 0, widget_rect_.width - btn_rect_.width,
+ widget_rect_.height);
if (rect.Contains(point))
return FWL_WidgetHit::Edit;
- if (m_BtnRect.Contains(point))
+ if (btn_rect_.Contains(point)) {
return FWL_WidgetHit::Client;
+ }
if (IsDropListVisible()) {
- rect = m_pListBox->GetWidgetRect();
+ rect = list_box_->GetWidgetRect();
if (rect.Contains(point))
return FWL_WidgetHit::Client;
}
@@ -105,89 +107,97 @@
void CFWL_ComboBox::DrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- if (!m_BtnRect.IsEmpty(0.1f)) {
+ if (!btn_rect_.IsEmpty(0.1f)) {
CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
pGraphics->ConcatMatrix(matrix);
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kDropDownButton, this,
pGraphics);
- param.m_dwStates = m_iBtnState;
- param.m_PartRect = m_BtnRect;
+ param.states_ = btn_state_;
+ param.part_rect_ = btn_rect_;
GetThemeProvider()->DrawBackground(param);
}
- if (m_pEdit) {
- CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
+ if (edit_) {
+ CFX_RectF rtEdit = edit_->GetWidgetRect();
CFX_Matrix mt(1, 0, 0, 1, rtEdit.left, rtEdit.top);
mt.Concat(matrix);
- m_pEdit->DrawWidget(pGraphics, mt);
+ edit_->DrawWidget(pGraphics, mt);
}
- if (m_pListBox && IsDropListVisible()) {
- CFX_RectF rtList = m_pListBox->GetWidgetRect();
+ if (list_box_ && IsDropListVisible()) {
+ CFX_RectF rtList = list_box_->GetWidgetRect();
CFX_Matrix mt(1, 0, 0, 1, rtList.left, rtList.top);
mt.Concat(matrix);
- m_pListBox->DrawWidget(pGraphics, mt);
+ list_box_->DrawWidget(pGraphics, mt);
}
}
WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const {
- CFWL_ListBox::Item* pItem = m_pListBox->GetItem(m_pListBox, iIndex);
+ CFWL_ListBox::Item* pItem = list_box_->GetItem(list_box_, iIndex);
return pItem ? pItem->GetText() : WideString();
}
void CFWL_ComboBox::SetCurSel(int32_t iSel) {
- int32_t iCount = m_pListBox->CountItems(nullptr);
+ int32_t iCount = list_box_->CountItems(nullptr);
bool bClearSel = iSel < 0 || iSel >= iCount;
- if (IsDropDownStyle() && m_pEdit) {
+ if (IsDropDownStyle() && edit_) {
if (bClearSel) {
- m_pEdit->SetText(WideString());
+ edit_->SetText(WideString());
} else {
- CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, iSel);
- m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
+ CFWL_ListBox::Item* hItem = list_box_->GetItem(this, iSel);
+ edit_->SetText(hItem ? hItem->GetText() : WideString());
}
- m_pEdit->Update();
+ edit_->Update();
}
- m_iCurSel = bClearSel ? -1 : iSel;
+ cur_sel_ = bClearSel ? -1 : iSel;
}
void CFWL_ComboBox::SetStates(uint32_t dwStates) {
- if (IsDropDownStyle() && m_pEdit)
- m_pEdit->SetStates(dwStates);
- if (m_pListBox)
- m_pListBox->SetStates(dwStates);
+ if (IsDropDownStyle() && edit_) {
+ edit_->SetStates(dwStates);
+ }
+ if (list_box_) {
+ list_box_->SetStates(dwStates);
+ }
CFWL_Widget::SetStates(dwStates);
}
void CFWL_ComboBox::RemoveStates(uint32_t dwStates) {
- if (IsDropDownStyle() && m_pEdit)
- m_pEdit->RemoveStates(dwStates);
- if (m_pListBox)
- m_pListBox->RemoveStates(dwStates);
+ if (IsDropDownStyle() && edit_) {
+ edit_->RemoveStates(dwStates);
+ }
+ if (list_box_) {
+ list_box_->RemoveStates(dwStates);
+ }
CFWL_Widget::RemoveStates(dwStates);
}
void CFWL_ComboBox::SetEditText(const WideString& wsText) {
- if (!m_pEdit)
+ if (!edit_) {
return;
+ }
- m_pEdit->SetText(wsText);
- m_pEdit->Update();
+ edit_->SetText(wsText);
+ edit_->Update();
}
WideString CFWL_ComboBox::GetEditText() const {
- if (m_pEdit)
- return m_pEdit->GetText();
- if (!m_pListBox)
+ if (edit_) {
+ return edit_->GetText();
+ }
+ if (!list_box_) {
return WideString();
+ }
- CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
+ CFWL_ListBox::Item* hItem = list_box_->GetItem(this, cur_sel_);
return hItem ? hItem->GetText() : WideString();
}
CFX_RectF CFWL_ComboBox::GetBBox() const {
- CFX_RectF rect = m_WidgetRect;
- if (!m_pListBox || !IsDropListVisible())
+ CFX_RectF rect = widget_rect_;
+ if (!list_box_ || !IsDropListVisible()) {
return rect;
+ }
- CFX_RectF rtList = m_pListBox->GetWidgetRect();
+ CFX_RectF rtList = list_box_->GetWidgetRect();
rtList.Offset(rect.left, rect.top);
rect.Union(rtList);
return rect;
@@ -195,8 +205,9 @@
void CFWL_ComboBox::EditModifyStyleExts(uint32_t dwStyleExtsAdded,
uint32_t dwStyleExtsRemoved) {
- if (m_pEdit)
- m_pEdit->ModifyStyleExts(dwStyleExtsAdded, dwStyleExtsRemoved);
+ if (edit_) {
+ edit_->ModifyStyleExts(dwStyleExtsAdded, dwStyleExtsRemoved);
+ }
}
void CFWL_ComboBox::ShowDropDownList() {
@@ -208,13 +219,13 @@
if (!preEvent.GetSrcTarget())
return;
- CFWL_ComboList* pComboList = m_pListBox;
+ CFWL_ComboList* pComboList = list_box_;
int32_t iItems = pComboList->CountItems(nullptr);
if (iItems < 1)
return;
ResetListItemAlignment();
- pComboList->ChangeSelected(m_iCurSel);
+ pComboList->ChangeSelected(cur_sel_);
float fItemHeight = pComboList->CalcItemHeight();
float fBorder = GetCXBorderSize();
@@ -223,11 +234,11 @@
fPopupMin = fItemHeight * 3 + fBorder * 2;
float fPopupMax = fItemHeight * iItems + fBorder * 2;
- CFX_RectF rtList(m_ClientRect.left, 0, m_WidgetRect.width, 0);
- GetPopupPos(fPopupMin, fPopupMax, m_WidgetRect, &rtList);
- m_pListBox->SetWidgetRect(rtList);
- m_pListBox->Update();
- m_pListBox->RemoveStates(FWL_STATE_WGT_Invisible);
+ CFX_RectF rtList(client_rect_.left, 0, widget_rect_.width, 0);
+ GetPopupPos(fPopupMin, fPopupMax, widget_rect_, &rtList);
+ list_box_->SetWidgetRect(rtList);
+ list_box_->Update();
+ list_box_->RemoveStates(FWL_STATE_WGT_Invisible);
CFWL_Event postEvent(CFWL_Event::Type::PostDropDown, this);
DispatchEvent(&postEvent);
@@ -238,75 +249,77 @@
if (!IsDropListVisible())
return;
- m_pListBox->SetStates(FWL_STATE_WGT_Invisible);
+ list_box_->SetStates(FWL_STATE_WGT_Invisible);
RepaintInflatedListBoxRect();
}
void CFWL_ComboBox::RepaintInflatedListBoxRect() {
- CFX_RectF rect = m_pListBox->GetWidgetRect();
+ CFX_RectF rect = list_box_->GetWidgetRect();
rect.Inflate(2, 2);
RepaintRect(rect);
}
void CFWL_ComboBox::MatchEditText() {
- WideString wsText = m_pEdit->GetText();
- int32_t iMatch = m_pListBox->MatchItem(wsText.AsStringView());
- if (iMatch != m_iCurSel) {
- m_pListBox->ChangeSelected(iMatch);
+ WideString wsText = edit_->GetText();
+ int32_t iMatch = list_box_->MatchItem(wsText.AsStringView());
+ if (iMatch != cur_sel_) {
+ list_box_->ChangeSelected(iMatch);
if (iMatch >= 0)
SyncEditText(iMatch);
} else if (iMatch >= 0) {
- m_pEdit->SetSelected();
+ edit_->SetSelected();
}
- m_iCurSel = iMatch;
+ cur_sel_ = iMatch;
}
void CFWL_ComboBox::SyncEditText(int32_t iListItem) {
- CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, iListItem);
- m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
- m_pEdit->Update();
- m_pEdit->SetSelected();
+ CFWL_ListBox::Item* hItem = list_box_->GetItem(this, iListItem);
+ edit_->SetText(hItem ? hItem->GetText() : WideString());
+ edit_->Update();
+ edit_->SetSelected();
}
void CFWL_ComboBox::Layout() {
- m_ClientRect = GetClientRect();
- m_ContentRect = m_ClientRect;
+ client_rect_ = GetClientRect();
+ content_rect_ = client_rect_;
IFWL_ThemeProvider* theme = GetThemeProvider();
float borderWidth = 1;
float fBtn = theme->GetScrollBarWidth();
if (!(GetStyleExts() & FWL_STYLEEXT_CMB_ReadOnly)) {
- m_BtnRect =
- CFX_RectF(m_ClientRect.right() - fBtn, m_ClientRect.top + borderWidth,
- fBtn - borderWidth, m_ClientRect.height - 2 * borderWidth);
+ btn_rect_ =
+ CFX_RectF(client_rect_.right() - fBtn, client_rect_.top + borderWidth,
+ fBtn - borderWidth, client_rect_.height - 2 * borderWidth);
}
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
CFX_RectF pUIMargin = theme->GetUIMargin(part);
- m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
+ content_rect_.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
- if (!IsDropDownStyle() || !m_pEdit)
+ if (!IsDropDownStyle() || !edit_) {
return;
-
- CFX_RectF rtEdit(m_ContentRect.left, m_ContentRect.top,
- m_ContentRect.width - fBtn, m_ContentRect.height);
- m_pEdit->SetWidgetRect(rtEdit);
-
- if (m_iCurSel >= 0) {
- CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
- ScopedUpdateLock update_lock(m_pEdit);
- m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
}
- m_pEdit->Update();
+
+ CFX_RectF rtEdit(content_rect_.left, content_rect_.top,
+ content_rect_.width - fBtn, content_rect_.height);
+ edit_->SetWidgetRect(rtEdit);
+
+ if (cur_sel_ >= 0) {
+ CFWL_ListBox::Item* hItem = list_box_->GetItem(this, cur_sel_);
+ ScopedUpdateLock update_lock(edit_);
+ edit_->SetText(hItem ? hItem->GetText() : WideString());
+ }
+ edit_->Update();
}
void CFWL_ComboBox::ResetEditAlignment() {
- if (!m_pEdit)
+ if (!edit_) {
return;
+ }
uint32_t dwAdd = 0;
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CMB_EditHAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_CMB_EditHAlignMask) {
case FWL_STYLEEXT_CMB_EditHCenter: {
dwAdd |= FWL_STYLEEXT_EDT_HCenter;
break;
@@ -316,7 +329,7 @@
break;
}
}
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CMB_EditVAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_CMB_EditVAlignMask) {
case FWL_STYLEEXT_CMB_EditVCenter: {
dwAdd |= FWL_STYLEEXT_EDT_VCenter;
break;
@@ -330,20 +343,22 @@
break;
}
}
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CMB_EditJustified)
+ if (properties_.style_exts_ & FWL_STYLEEXT_CMB_EditJustified) {
dwAdd |= FWL_STYLEEXT_EDT_Justified;
+ }
- m_pEdit->ModifyStyleExts(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
- FWL_STYLEEXT_EDT_HAlignModeMask |
- FWL_STYLEEXT_EDT_VAlignMask);
+ edit_->ModifyStyleExts(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
+ FWL_STYLEEXT_EDT_HAlignModeMask |
+ FWL_STYLEEXT_EDT_VAlignMask);
}
void CFWL_ComboBox::ResetListItemAlignment() {
- if (!m_pListBox)
+ if (!list_box_) {
return;
+ }
uint32_t dwAdd = 0;
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_CMB_ListItemAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_CMB_ListItemAlignMask) {
case FWL_STYLEEXT_CMB_ListItemCenterAlign: {
dwAdd |= FWL_STYLEEXT_LTB_CenterAlign;
break;
@@ -353,23 +368,23 @@
break;
}
}
- m_pListBox->ModifyStyleExts(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask);
+ list_box_->ModifyStyleExts(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask);
}
void CFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) {
- m_iCurSel = m_pListBox->GetItemIndex(this, m_pListBox->GetSelItem(0));
+ cur_sel_ = list_box_->GetItemIndex(this, list_box_->GetSelItem(0));
if (!IsDropDownStyle()) {
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
return;
}
- CFWL_ListBox::Item* hItem = m_pListBox->GetItem(this, m_iCurSel);
+ CFWL_ListBox::Item* hItem = list_box_->GetItem(this, cur_sel_);
if (!hItem)
return;
- if (m_pEdit) {
- m_pEdit->SetText(hItem->GetText());
- m_pEdit->Update();
- m_pEdit->SetSelected();
+ if (edit_) {
+ edit_->SetText(hItem->GetText());
+ edit_->Update();
+ edit_->SetSelected();
}
CFWL_EventSelectChanged ev(this, bLButtonUp);
DispatchEvent(&ev);
@@ -391,7 +406,7 @@
case CFWL_Message::Type::kMouse: {
backDefault = false;
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
@@ -407,13 +422,13 @@
backDefault = false;
CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage);
if (IsDropListVisible() &&
- pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown) {
- bool bListKey = pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Up ||
- pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Down ||
- pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return ||
- pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Escape;
+ pKey->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
+ bool bListKey = pKey->key_code_or_char_ == XFA_FWL_VKEY_Up ||
+ pKey->key_code_or_char_ == XFA_FWL_VKEY_Down ||
+ pKey->key_code_or_char_ == XFA_FWL_VKEY_Return ||
+ pKey->key_code_or_char_ == XFA_FWL_VKEY_Escape;
if (bListKey) {
- m_pListBox->GetDelegate()->OnProcessMessage(pMessage);
+ list_box_->GetDelegate()->OnProcessMessage(pMessage);
break;
}
}
@@ -447,60 +462,64 @@
}
void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- if (m_BtnRect.Contains(pMsg->m_pos))
- m_iBtnState = CFWL_PartState::kHovered;
- else
- m_iBtnState = CFWL_PartState::kNormal;
+ if (btn_rect_.Contains(pMsg->pos_)) {
+ btn_state_ = CFWL_PartState::kHovered;
+ } else {
+ btn_state_ = CFWL_PartState::kNormal;
+ }
- RepaintRect(m_BtnRect);
+ RepaintRect(btn_rect_);
}
void CFWL_ComboBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
if (IsDropListVisible()) {
- if (m_BtnRect.Contains(pMsg->m_pos))
+ if (btn_rect_.Contains(pMsg->pos_)) {
HideDropDownList();
+ }
return;
}
- if (!m_ClientRect.Contains(pMsg->m_pos))
+ if (!client_rect_.Contains(pMsg->pos_)) {
return;
+ }
- if (m_pEdit)
+ if (edit_) {
MatchEditText();
+ }
ShowDropDownList();
}
void CFWL_ComboBox::OnFocusGained() {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
- if ((m_pEdit->GetStates() & FWL_STATE_WGT_Focused) == 0) {
- CFWL_MessageSetFocus msg(m_pEdit);
- m_pEdit->GetDelegate()->OnProcessMessage(&msg);
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ if ((edit_->GetStates() & FWL_STATE_WGT_Focused) == 0) {
+ CFWL_MessageSetFocus msg(edit_);
+ edit_->GetDelegate()->OnProcessMessage(&msg);
}
}
void CFWL_ComboBox::OnFocusLost() {
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
HideDropDownList();
CFWL_MessageKillFocus msg(nullptr);
- m_pEdit->GetDelegate()->OnProcessMessage(&msg);
+ edit_->GetDelegate()->OnProcessMessage(&msg);
}
void CFWL_ComboBox::OnKey(CFWL_MessageKey* pMsg) {
- uint32_t dwKeyCode = pMsg->m_dwKeyCodeOrChar;
+ uint32_t dwKeyCode = pMsg->key_code_or_char_;
const bool bUp = dwKeyCode == XFA_FWL_VKEY_Up;
const bool bDown = dwKeyCode == XFA_FWL_VKEY_Down;
if (bUp || bDown) {
- CFWL_ComboList* pComboList = m_pListBox;
+ CFWL_ComboList* pComboList = list_box_;
int32_t iCount = pComboList->CountItems(nullptr);
if (iCount < 1)
return;
bool bMatchEqual = false;
- int32_t iCurSel = m_iCurSel;
- if (m_pEdit) {
- WideString wsText = m_pEdit->GetText();
+ int32_t iCurSel = cur_sel_;
+ if (edit_) {
+ WideString wsText = edit_->GetText();
iCurSel = pComboList->MatchItem(wsText.AsStringView());
if (iCurSel >= 0) {
- CFWL_ListBox::Item* item = m_pListBox->GetSelItem(iCurSel);
+ CFWL_ListBox::Item* item = list_box_->GetSelItem(iCurSel);
bMatchEqual = wsText == (item ? item->GetText() : WideString());
}
}
@@ -514,12 +533,13 @@
else
iCurSel++;
}
- m_iCurSel = iCurSel;
- SyncEditText(m_iCurSel);
+ cur_sel_ = iCurSel;
+ SyncEditText(cur_sel_);
return;
}
- if (m_pEdit)
- m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
+ if (edit_) {
+ edit_->GetDelegate()->OnProcessMessage(pMsg);
+ }
}
void CFWL_ComboBox::GetPopupPos(float fMinHeight,
diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h
index 3f84659..8583556 100644
--- a/xfa/fwl/cfwl_combobox.h
+++ b/xfa/fwl/cfwl_combobox.h
@@ -53,7 +53,7 @@
const CFX_Matrix& matrix) override;
WideString GetTextByIndex(int32_t iIndex) const;
- int32_t GetCurSel() const { return m_iCurSel; }
+ int32_t GetCurSel() const { return cur_sel_; }
void SetCurSel(int32_t iSel);
void AddString(const WideString& wsText);
@@ -63,23 +63,24 @@
void SetEditText(const WideString& wsText);
WideString GetEditText() const;
- bool EditCanUndo() const { return m_pEdit->CanUndo(); }
- bool EditCanRedo() const { return m_pEdit->CanRedo(); }
- bool EditUndo() { return m_pEdit->Undo(); }
- bool EditRedo() { return m_pEdit->Redo(); }
- bool EditCanCopy() const { return m_pEdit->HasSelection(); }
+ bool EditCanUndo() const { return edit_->CanUndo(); }
+ bool EditCanRedo() const { return edit_->CanRedo(); }
+ bool EditUndo() { return edit_->Undo(); }
+ bool EditRedo() { return edit_->Redo(); }
+ bool EditCanCopy() const { return edit_->HasSelection(); }
bool EditCanCut() const {
- if (m_pEdit->GetStyleExts() & FWL_STYLEEXT_EDT_ReadOnly)
+ if (edit_->GetStyleExts() & FWL_STYLEEXT_EDT_ReadOnly) {
return false;
+ }
return EditCanCopy();
}
- bool EditCanSelectAll() const { return m_pEdit->GetTextLength() > 0; }
- std::optional<WideString> EditCopy() const { return m_pEdit->Copy(); }
- std::optional<WideString> EditCut() { return m_pEdit->Cut(); }
- bool EditPaste(const WideString& wsPaste) { return m_pEdit->Paste(wsPaste); }
- void EditSelectAll() { m_pEdit->SelectAll(); }
- void EditDelete() { m_pEdit->ClearText(); }
- void EditDeSelect() { m_pEdit->ClearSelection(); }
+ bool EditCanSelectAll() const { return edit_->GetTextLength() > 0; }
+ std::optional<WideString> EditCopy() const { return edit_->Copy(); }
+ std::optional<WideString> EditCut() { return edit_->Cut(); }
+ bool EditPaste(const WideString& wsPaste) { return edit_->Paste(wsPaste); }
+ void EditSelectAll() { edit_->SelectAll(); }
+ void EditDelete() { edit_->ClearText(); }
+ void EditDeSelect() { edit_->ClearSelection(); }
CFX_RectF GetBBox() const;
void EditModifyStyleExts(uint32_t dwStyleExtsAdded,
@@ -87,10 +88,10 @@
void ShowDropDownList();
void HideDropDownList();
- CFWL_ComboEdit* GetComboEdit() const { return m_pEdit; }
+ CFWL_ComboEdit* GetComboEdit() const { return edit_; }
void ProcessSelChanged(bool bLButtonUp);
- int32_t GetCurrentSelection() const { return m_iCurSel; }
+ int32_t GetCurrentSelection() const { return cur_sel_; }
private:
explicit CFWL_ComboBox(CFWL_App* pApp);
@@ -108,20 +109,20 @@
const CFX_RectF& rtAnchor,
CFX_RectF* pPopupRect);
void OnLButtonUp(CFWL_MessageMouse* pMsg);
- bool IsDropListVisible() const { return m_pListBox->IsVisible(); }
+ bool IsDropListVisible() const { return list_box_->IsVisible(); }
void OnLButtonDown(CFWL_MessageMouse* pMsg);
void OnFocusGained();
void OnFocusLost();
void OnKey(CFWL_MessageKey* pMsg);
void RepaintInflatedListBoxRect();
- CFX_RectF m_ClientRect;
- CFX_RectF m_ContentRect;
- CFX_RectF m_BtnRect;
- cppgc::Member<CFWL_ComboEdit> const m_pEdit;
- cppgc::Member<CFWL_ComboList> const m_pListBox;
- int32_t m_iCurSel = -1;
- Mask<CFWL_PartState> m_iBtnState = CFWL_PartState::kNormal;
+ CFX_RectF client_rect_;
+ CFX_RectF content_rect_;
+ CFX_RectF btn_rect_;
+ cppgc::Member<CFWL_ComboEdit> const edit_;
+ cppgc::Member<CFWL_ComboList> const list_box_;
+ int32_t cur_sel_ = -1;
+ Mask<CFWL_PartState> btn_state_ = CFWL_PartState::kNormal;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_comboedit.cpp b/xfa/fwl/cfwl_comboedit.cpp
index bc52632..e391c23 100644
--- a/xfa/fwl/cfwl_comboedit.cpp
+++ b/xfa/fwl/cfwl_comboedit.cpp
@@ -25,7 +25,7 @@
}
void CFWL_ComboEdit::SetSelected() {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
+ properties_.states_ |= FWL_STATE_WGT_Focused;
SelectAll();
}
@@ -33,19 +33,19 @@
bool backDefault = true;
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus: {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
+ properties_.states_ |= FWL_STATE_WGT_Focused;
backDefault = false;
break;
}
case CFWL_Message::Type::kKillFocus: {
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
backDefault = false;
break;
}
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if ((pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown) &&
- ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0)) {
+ if ((pMsg->cmd_ == CFWL_MessageMouse::MouseCommand::kLeftButtonDown) &&
+ ((properties_.states_ & FWL_STATE_WGT_Focused) == 0)) {
SetSelected();
}
break;
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 4dd75a0..7291883 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -65,7 +65,7 @@
}
CFX_PointF CFWL_ComboList::ClientToOuter(const CFX_PointF& point) {
- return point + CFX_PointF(m_WidgetRect.left, m_WidgetRect.top);
+ return point + CFX_PointF(widget_rect_.left, widget_rect_.top);
}
void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) {
@@ -79,13 +79,13 @@
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowVertScrollBar() && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_pos)) {
- pMsg->m_pos -= rect.TopLeft();
+ if (rect.Contains(pMsg->pos_)) {
+ pMsg->pos_ -= rect.TopLeft();
vertSB->GetDelegate()->OnProcessMessage(pMsg);
return;
}
}
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kMove:
backDefault = false;
OnDropListMouseMove(pMsg);
@@ -121,24 +121,26 @@
}
void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) {
- if (GetRTClient().Contains(pMsg->m_pos)) {
- if (m_bNotifyOwner)
- m_bNotifyOwner = false;
+ if (GetRTClient().Contains(pMsg->pos_)) {
+ if (notify_owner_) {
+ notify_owner_ = false;
+ }
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowVertScrollBar() && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_pos))
+ if (rect.Contains(pMsg->pos_)) {
return;
+ }
}
- CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->m_pos);
+ CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->pos_);
if (!hItem)
return;
ChangeSelected(GetItemIndex(this, hItem));
- } else if (m_bNotifyOwner) {
- pMsg->m_pos = ClientToOuter(pMsg->m_pos);
+ } else if (notify_owner_) {
+ pMsg->pos_ = ClientToOuter(pMsg->pos_);
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
pOuter->GetDelegate()->OnProcessMessage(pMsg);
@@ -146,8 +148,9 @@
}
void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) {
- if (GetRTClient().Contains(pMsg->m_pos))
+ if (GetRTClient().Contains(pMsg->pos_)) {
return;
+ }
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
pOuter->HideDropDownList();
@@ -155,8 +158,8 @@
void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) {
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
- if (m_bNotifyOwner) {
- pMsg->m_pos = ClientToOuter(pMsg->m_pos);
+ if (notify_owner_) {
+ pMsg->pos_ = ClientToOuter(pMsg->pos_);
pOuter->GetDelegate()->OnProcessMessage(pMsg);
return;
}
@@ -164,12 +167,13 @@
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowVertScrollBar() && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_pos))
+ if (rect.Contains(pMsg->pos_)) {
return;
+ }
}
pOuter->HideDropDownList();
- CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->m_pos);
+ CFWL_ListBox::Item* hItem = GetItemAtPoint(pMsg->pos_);
if (hItem)
pOuter->ProcessSelChanged(true);
}
@@ -177,8 +181,8 @@
bool CFWL_ComboList::OnDropListKey(CFWL_MessageKey* pKey) {
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
bool bPropagate = false;
- if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown) {
- uint32_t dwKeyCode = pKey->m_dwKeyCodeOrChar;
+ if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
+ uint32_t dwKeyCode = pKey->key_code_or_char_;
switch (dwKeyCode) {
case XFA_FWL_VKEY_Return:
case XFA_FWL_VKEY_Escape: {
@@ -196,7 +200,7 @@
break;
}
}
- } else if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kChar) {
+ } else if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kChar) {
bPropagate = true;
}
if (bPropagate) {
@@ -208,7 +212,7 @@
}
void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) {
- auto dwKeyCode = static_cast<XFA_FWL_VKEYCODE>(pKey->m_dwKeyCodeOrChar);
+ auto dwKeyCode = static_cast<XFA_FWL_VKEYCODE>(pKey->key_code_or_char_);
switch (dwKeyCode) {
case XFA_FWL_VKEY_Up:
case XFA_FWL_VKEY_Down:
@@ -222,7 +226,7 @@
SetSelection(hItem, hItem, true);
ScrollToVisible(hItem);
- RepaintRect(CFX_RectF(0, 0, m_WidgetRect.width, m_WidgetRect.height));
+ RepaintRect(CFX_RectF(0, 0, widget_rect_.width, widget_rect_.height));
break;
}
default:
diff --git a/xfa/fwl/cfwl_combolist.h b/xfa/fwl/cfwl_combolist.h
index fecb996..58a1653 100644
--- a/xfa/fwl/cfwl_combolist.h
+++ b/xfa/fwl/cfwl_combolist.h
@@ -36,7 +36,7 @@
bool OnDropListKey(CFWL_MessageKey* pKey);
void OnDropListKeyDown(CFWL_MessageKey* pKey);
- bool m_bNotifyOwner = true;
+ bool notify_owner_ = true;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_datetimeedit.cpp b/xfa/fwl/cfwl_datetimeedit.cpp
index a7ff042..0d8ed43 100644
--- a/xfa/fwl/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/cfwl_datetimeedit.cpp
@@ -26,10 +26,11 @@
}
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
- if (pMouse->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown ||
- pMouse->m_dwCmd == CFWL_MessageMouse::MouseCommand::kRightButtonDown) {
- if ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0)
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
+ if (pMouse->cmd_ == CFWL_MessageMouse::MouseCommand::kLeftButtonDown ||
+ pMouse->cmd_ == CFWL_MessageMouse::MouseCommand::kRightButtonDown) {
+ if ((properties_.states_ & FWL_STATE_WGT_Focused) == 0) {
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ }
CFWL_DateTimePicker* pDateTime =
static_cast<CFWL_DateTimePicker*>(GetOuter());
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index f6ad162..8bcedcd 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -28,23 +28,23 @@
: CFWL_Widget(app,
Properties{0, FWL_STYLEEXT_DTP_ShortDateFormat, 0},
nullptr),
- m_pEdit(cppgc::MakeGarbageCollected<CFWL_DateTimeEdit>(
+ edit_(cppgc::MakeGarbageCollected<CFWL_DateTimeEdit>(
app->GetHeap()->GetAllocationHandle(),
app,
Properties(),
this)),
- m_pMonthCal(cppgc::MakeGarbageCollected<CFWL_MonthCalendar>(
+ month_cal_(cppgc::MakeGarbageCollected<CFWL_MonthCalendar>(
app->GetHeap()->GetAllocationHandle(),
app,
Properties{FWL_STYLE_WGT_Popup | FWL_STYLE_WGT_Border, 0,
FWL_STATE_WGT_Invisible},
this)) {
- m_pMonthCal->SetWidgetRect(
- CFX_RectF(0, 0, m_pMonthCal->GetAutosizedWidgetRect().Size()));
+ month_cal_->SetWidgetRect(
+ CFX_RectF(0, 0, month_cal_->GetAutosizedWidgetRect().Size()));
CFWL_NoteDriver* pNoteDriver = GetFWLApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(this, m_pMonthCal);
- pNoteDriver->RegisterEventTarget(this, m_pEdit);
+ pNoteDriver->RegisterEventTarget(this, month_cal_);
+ pNoteDriver->RegisterEventTarget(this, edit_);
}
CFWL_DateTimePicker::~CFWL_DateTimePicker() = default;
@@ -56,8 +56,8 @@
void CFWL_DateTimePicker::Trace(cppgc::Visitor* visitor) const {
CFWL_Widget::Trace(visitor);
- visitor->Trace(m_pEdit);
- visitor->Trace(m_pMonthCal);
+ visitor->Trace(edit_);
+ visitor->Trace(month_cal_);
}
FWL_Type CFWL_DateTimePicker::GetClassID() const {
@@ -68,30 +68,31 @@
if (IsLocked())
return;
- m_ClientRect = GetClientRect();
- m_pEdit->SetWidgetRect(m_ClientRect);
+ client_rect_ = GetClientRect();
+ edit_->SetWidgetRect(client_rect_);
ResetEditAlignment();
- m_pEdit->Update();
+ edit_->Update();
- m_fBtn = GetThemeProvider()->GetScrollBarWidth();
- CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
+ btn_ = GetThemeProvider()->GetScrollBarWidth();
+ CFX_RectF rtMonthCal = month_cal_->GetAutosizedWidgetRect();
CFX_RectF rtPopUp(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
rtMonthCal.width, rtMonthCal.height);
- m_pMonthCal->SetWidgetRect(rtPopUp);
- m_pMonthCal->Update();
+ month_cal_->SetWidgetRect(rtPopUp);
+ month_cal_->Update();
}
FWL_WidgetHit CFWL_DateTimePicker::HitTest(const CFX_PointF& point) {
- CFX_RectF rect(0, 0, m_WidgetRect.width, m_WidgetRect.height);
+ CFX_RectF rect(0, 0, widget_rect_.width, widget_rect_.height);
if (rect.Contains(point))
return FWL_WidgetHit::Edit;
if (NeedsToShowButton())
- rect.width += m_fBtn;
+ rect.width += btn_;
if (rect.Contains(point))
return FWL_WidgetHit::Client;
if (IsMonthCalendarVisible()) {
- if (m_pMonthCal->GetWidgetRect().Contains(point))
+ if (month_cal_->GetWidgetRect().Contains(point)) {
return FWL_WidgetHit::Client;
+ }
}
return FWL_WidgetHit::Unknown;
}
@@ -104,30 +105,31 @@
if (HasBorder())
DrawBorder(pGraphics, CFWL_ThemePart::Part::kBorder, matrix);
- if (!m_BtnRect.IsEmpty())
+ if (!btn_rect_.IsEmpty()) {
DrawDropDownButton(pGraphics, matrix);
+ }
- if (m_pEdit) {
- CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
+ if (edit_) {
+ CFX_RectF rtEdit = edit_->GetWidgetRect();
CFX_Matrix mt(1, 0, 0, 1, rtEdit.left, rtEdit.top);
mt.Concat(matrix);
- m_pEdit->DrawWidget(pGraphics, mt);
+ edit_->DrawWidget(pGraphics, mt);
}
if (!IsMonthCalendarVisible())
return;
- CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
+ CFX_RectF rtMonth = month_cal_->GetWidgetRect();
CFX_Matrix mt(1, 0, 0, 1, rtMonth.left, rtMonth.top);
mt.Concat(matrix);
- m_pMonthCal->DrawWidget(pGraphics, mt);
+ month_cal_->DrawWidget(pGraphics, mt);
}
void CFWL_DateTimePicker::GetCurSel(int32_t& iYear,
int32_t& iMonth,
int32_t& iDay) {
- iYear = m_iYear;
- iMonth = m_iMonth;
- iDay = m_iDay;
+ iYear = year_;
+ iMonth = month_;
+ iDay = day_;
}
void CFWL_DateTimePicker::SetCurSel(int32_t iYear,
@@ -140,64 +142,66 @@
if (iDay <= 0 || iDay >= 32)
return;
- m_iYear = iYear;
- m_iMonth = iMonth;
- m_iDay = iDay;
- m_pMonthCal->SetSelect(iYear, iMonth, iDay);
+ year_ = iYear;
+ month_ = iMonth;
+ day_ = iDay;
+ month_cal_->SetSelect(iYear, iMonth, iDay);
}
void CFWL_DateTimePicker::SetEditText(const WideString& wsText) {
- if (!m_pEdit)
+ if (!edit_) {
return;
+ }
- m_pEdit->SetText(wsText);
- RepaintRect(m_ClientRect);
+ edit_->SetText(wsText);
+ RepaintRect(client_rect_);
CFWL_Event ev(CFWL_Event::Type::EditChanged);
DispatchEvent(&ev);
}
WideString CFWL_DateTimePicker::GetEditText() const {
- return m_pEdit ? m_pEdit->GetText() : WideString();
+ return edit_ ? edit_->GetText() : WideString();
}
size_t CFWL_DateTimePicker::GetEditTextLength() const {
- return m_pEdit ? m_pEdit->GetTextLength() : 0;
+ return edit_ ? edit_->GetTextLength() : 0;
}
CFX_RectF CFWL_DateTimePicker::GetBBox() const {
- CFX_RectF rect = m_WidgetRect;
+ CFX_RectF rect = widget_rect_;
if (NeedsToShowButton())
- rect.width += m_fBtn;
+ rect.width += btn_;
if (!IsMonthCalendarVisible())
return rect;
- CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
- rtMonth.Offset(m_WidgetRect.left, m_WidgetRect.top);
+ CFX_RectF rtMonth = month_cal_->GetWidgetRect();
+ rtMonth.Offset(widget_rect_.left, widget_rect_.top);
rect.Union(rtMonth);
return rect;
}
void CFWL_DateTimePicker::ModifyEditStyleExts(uint32_t dwStyleExtsAdded,
uint32_t dwStyleExtsRemoved) {
- m_pEdit->ModifyStyleExts(dwStyleExtsAdded, dwStyleExtsRemoved);
+ edit_->ModifyStyleExts(dwStyleExtsAdded, dwStyleExtsRemoved);
}
void CFWL_DateTimePicker::DrawDropDownButton(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kDropDownButton, this,
pGraphics);
- param.m_dwStates = m_iBtnState;
- param.m_PartRect = m_BtnRect;
- param.m_matrix = mtMatrix;
+ param.states_ = btn_state_;
+ param.part_rect_ = btn_rect_;
+ param.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(param);
}
WideString CFWL_DateTimePicker::FormatDateString(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_DTP_ShortDateFormat)
+ if (properties_.style_exts_ & FWL_STYLEEXT_DTP_ShortDateFormat) {
return WideString::Format(L"%d-%d-%d", iYear, iMonth, iDay);
+ }
return WideString::Format(L"%d Year %d Month %d Day", iYear, iMonth, iDay);
}
@@ -206,22 +210,23 @@
if (IsMonthCalendarVisible())
return;
- CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
+ CFX_RectF rtMonthCal = month_cal_->GetAutosizedWidgetRect();
float fPopupMin = rtMonthCal.height;
float fPopupMax = rtMonthCal.height;
- CFX_RectF rtAnchor = m_WidgetRect;
+ CFX_RectF rtAnchor = widget_rect_;
rtAnchor.width = rtMonthCal.width;
- rtMonthCal.left = m_ClientRect.left;
+ rtMonthCal.left = client_rect_.left;
rtMonthCal.top = rtAnchor.Height();
GetPopupPos(fPopupMin, fPopupMax, rtAnchor, &rtMonthCal);
- m_pMonthCal->SetWidgetRect(rtMonthCal);
- if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0)
- m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay);
- m_pMonthCal->Update();
- m_pMonthCal->RemoveStates(FWL_STATE_WGT_Invisible);
+ month_cal_->SetWidgetRect(rtMonthCal);
+ if (year_ > 0 && month_ > 0 && day_ > 0) {
+ month_cal_->SetSelect(year_, month_, day_);
+ }
+ month_cal_->Update();
+ month_cal_->RemoveStates(FWL_STATE_WGT_Invisible);
- CFWL_MessageSetFocus msg(m_pMonthCal);
- m_pEdit->GetDelegate()->OnProcessMessage(&msg);
+ CFWL_MessageSetFocus msg(month_cal_);
+ edit_->GetDelegate()->OnProcessMessage(&msg);
RepaintInflatedMonthCalRect();
}
@@ -229,28 +234,29 @@
if (!IsMonthCalendarVisible())
return;
- m_pMonthCal->SetStates(FWL_STATE_WGT_Invisible);
+ month_cal_->SetStates(FWL_STATE_WGT_Invisible);
RepaintInflatedMonthCalRect();
}
void CFWL_DateTimePicker::RepaintInflatedMonthCalRect() {
- CFX_RectF rtInvalidate(0, 0, m_WidgetRect.width, m_WidgetRect.height);
- CFX_RectF rtCal = m_pMonthCal->GetWidgetRect();
+ CFX_RectF rtInvalidate(0, 0, widget_rect_.width, widget_rect_.height);
+ CFX_RectF rtCal = month_cal_->GetWidgetRect();
rtInvalidate.Union(rtCal);
rtInvalidate.Inflate(2, 2);
RepaintRect(rtInvalidate);
}
bool CFWL_DateTimePicker::IsMonthCalendarVisible() const {
- return m_pMonthCal && m_pMonthCal->IsVisible();
+ return month_cal_ && month_cal_->IsVisible();
}
void CFWL_DateTimePicker::ResetEditAlignment() {
- if (!m_pEdit)
+ if (!edit_) {
return;
+ }
uint32_t dwAdd = 0;
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_DTP_EditHAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_DTP_EditHAlignMask) {
case FWL_STYLEEXT_DTP_EditHCenter: {
dwAdd |= FWL_STYLEEXT_EDT_HCenter;
break;
@@ -264,7 +270,7 @@
break;
}
}
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_DTP_EditVAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_DTP_EditVAlignMask) {
case FWL_STYLEEXT_DTP_EditVCenter: {
dwAdd |= FWL_STYLEEXT_EDT_VCenter;
break;
@@ -278,32 +284,33 @@
break;
}
}
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_DTP_EditJustified)
+ if (properties_.style_exts_ & FWL_STYLEEXT_DTP_EditJustified) {
dwAdd |= FWL_STYLEEXT_EDT_Justified;
+ }
- m_pEdit->ModifyStyleExts(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
- FWL_STYLEEXT_EDT_HAlignModeMask |
- FWL_STYLEEXT_EDT_VAlignMask);
+ edit_->ModifyStyleExts(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
+ FWL_STYLEEXT_EDT_HAlignModeMask |
+ FWL_STYLEEXT_EDT_VAlignMask);
}
void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- m_iYear = iYear;
- m_iMonth = iMonth;
- m_iDay = iDay;
- m_pEdit->SetText(FormatDateString(m_iYear, m_iMonth, m_iDay));
- m_pEdit->Update();
- RepaintRect(m_ClientRect);
+ year_ = iYear;
+ month_ = iMonth;
+ day_ = iDay;
+ edit_->SetText(FormatDateString(year_, month_, day_));
+ edit_->Update();
+ RepaintRect(client_rect_);
- CFWL_EventSelectChanged ev(this, m_iYear, m_iMonth, m_iDay);
+ CFWL_EventSelectChanged ev(this, year_, month_, day_);
DispatchEvent(&ev);
}
bool CFWL_DateTimePicker::NeedsToShowButton() const {
- return m_Properties.m_dwStates & FWL_STATE_WGT_Focused ||
- m_pMonthCal->GetStates() & FWL_STATE_WGT_Focused ||
- m_pEdit->GetStates() & FWL_STATE_WGT_Focused;
+ return properties_.states_ & FWL_STATE_WGT_Focused ||
+ month_cal_->GetStates() & FWL_STATE_WGT_Focused ||
+ edit_->GetStates() & FWL_STATE_WGT_Focused;
}
void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) {
@@ -316,7 +323,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMouse->m_dwCmd) {
+ switch (pMouse->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMouse);
break;
@@ -335,8 +342,8 @@
break;
}
case CFWL_Message::Type::kKey: {
- if (m_pEdit->GetStates() & FWL_STATE_WGT_Focused) {
- m_pEdit->GetDelegate()->OnProcessMessage(pMessage);
+ if (edit_->GetStates() & FWL_STATE_WGT_Focused) {
+ edit_->GetDelegate()->OnProcessMessage(pMessage);
return;
}
break;
@@ -355,25 +362,25 @@
}
void CFWL_DateTimePicker::OnFocusGained(CFWL_Message* pMsg) {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
- if (m_pEdit && !(m_pEdit->GetStyleExts() & FWL_STYLEEXT_EDT_ReadOnly)) {
- m_BtnRect =
- CFX_RectF(m_WidgetRect.width, 0, m_fBtn, m_WidgetRect.height - 1);
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ if (edit_ && !(edit_->GetStyleExts() & FWL_STYLEEXT_EDT_ReadOnly)) {
+ btn_rect_ = CFX_RectF(widget_rect_.width, 0, btn_, widget_rect_.height - 1);
}
- CFX_RectF rtInvalidate(m_BtnRect);
- pMsg->SetDstTarget(m_pEdit);
- m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
+ CFX_RectF rtInvalidate(btn_rect_);
+ pMsg->SetDstTarget(edit_);
+ edit_->GetDelegate()->OnProcessMessage(pMsg);
rtInvalidate.Inflate(2, 2);
RepaintRect(rtInvalidate);
}
void CFWL_DateTimePicker::OnFocusLost(CFWL_Message* pMsg) {
- CFX_RectF rtInvalidate(m_BtnRect);
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
- m_BtnRect = CFX_RectF();
+ CFX_RectF rtInvalidate(btn_rect_);
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
+ btn_rect_ = CFX_RectF();
HideMonthCalendar();
- if (m_pEdit->GetStates() & FWL_STATE_WGT_Focused)
- m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
+ if (edit_->GetStates() & FWL_STATE_WGT_Focused) {
+ edit_->GetDelegate()->OnProcessMessage(pMsg);
+ }
rtInvalidate.Inflate(2, 2);
RepaintRect(rtInvalidate);
}
@@ -381,41 +388,44 @@
void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
if (!pMsg)
return;
- if (!m_BtnRect.Contains(pMsg->m_pos))
+ if (!btn_rect_.Contains(pMsg->pos_)) {
return;
+ }
if (IsMonthCalendarVisible()) {
HideMonthCalendar();
return;
}
ShowMonthCalendar();
- m_bLBtnDown = true;
- RepaintRect(m_ClientRect);
+ lbtn_down_ = true;
+ RepaintRect(client_rect_);
}
void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) {
if (!pMsg)
return;
- m_bLBtnDown = false;
- if (m_BtnRect.Contains(pMsg->m_pos))
- m_iBtnState = CFWL_PartState::kHovered;
- else
- m_iBtnState = CFWL_PartState::kNormal;
- RepaintRect(m_BtnRect);
+ lbtn_down_ = false;
+ if (btn_rect_.Contains(pMsg->pos_)) {
+ btn_state_ = CFWL_PartState::kHovered;
+ } else {
+ btn_state_ = CFWL_PartState::kNormal;
+ }
+ RepaintRect(btn_rect_);
}
void CFWL_DateTimePicker::OnMouseMove(CFWL_MessageMouse* pMsg) {
- if (!m_BtnRect.Contains(pMsg->m_pos))
- m_iBtnState = CFWL_PartState::kNormal;
- RepaintRect(m_BtnRect);
+ if (!btn_rect_.Contains(pMsg->pos_)) {
+ btn_state_ = CFWL_PartState::kNormal;
+ }
+ RepaintRect(btn_rect_);
}
void CFWL_DateTimePicker::OnMouseLeave(CFWL_MessageMouse* pMsg) {
if (!pMsg)
return;
- m_iBtnState = CFWL_PartState::kNormal;
- RepaintRect(m_BtnRect);
+ btn_state_ = CFWL_PartState::kNormal;
+ RepaintRect(btn_rect_);
}
void CFWL_DateTimePicker::GetPopupPos(float fMinHeight,
@@ -427,43 +437,43 @@
}
void CFWL_DateTimePicker::ClearText() {
- m_pEdit->ClearText();
+ edit_->ClearText();
}
void CFWL_DateTimePicker::SelectAll() {
- m_pEdit->SelectAll();
+ edit_->SelectAll();
}
void CFWL_DateTimePicker::ClearSelection() {
- m_pEdit->ClearSelection();
+ edit_->ClearSelection();
}
std::optional<WideString> CFWL_DateTimePicker::Copy() {
- return m_pEdit->Copy();
+ return edit_->Copy();
}
std::optional<WideString> CFWL_DateTimePicker::Cut() {
- return m_pEdit->Cut();
+ return edit_->Cut();
}
bool CFWL_DateTimePicker::Paste(const WideString& wsPaste) {
- return m_pEdit->Paste(wsPaste);
+ return edit_->Paste(wsPaste);
}
bool CFWL_DateTimePicker::Undo() {
- return m_pEdit->Undo();
+ return edit_->Undo();
}
bool CFWL_DateTimePicker::Redo() {
- return m_pEdit->Redo();
+ return edit_->Redo();
}
bool CFWL_DateTimePicker::CanUndo() {
- return m_pEdit->CanUndo();
+ return edit_->CanUndo();
}
bool CFWL_DateTimePicker::CanRedo() {
- return m_pEdit->CanRedo();
+ return edit_->CanRedo();
}
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index 74e17bd..6b918f5 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -57,10 +57,10 @@
void SelectAll();
void ClearSelection();
- bool HasSelection() const { return m_pEdit->HasSelection(); }
+ bool HasSelection() const { return edit_->HasSelection(); }
// Returns <start, count> of the selection.
std::pair<size_t, size_t> GetSelection() const {
- return m_pEdit->GetSelection();
+ return edit_->GetSelection();
}
std::optional<WideString> Copy();
std::optional<WideString> Cut();
@@ -71,7 +71,7 @@
bool CanRedo();
CFX_RectF GetBBox() const;
- void SetEditLimit(int32_t nLimit) { m_pEdit->SetLimit(nLimit); }
+ void SetEditLimit(int32_t nLimit) { edit_->SetLimit(nLimit); }
void ModifyEditStyleExts(uint32_t dwStyleExtsAdded,
uint32_t dwStyleExtsRemoved);
@@ -100,16 +100,16 @@
bool NeedsToShowButton() const;
void RepaintInflatedMonthCalRect();
- bool m_bLBtnDown = false;
- Mask<CFWL_PartState> m_iBtnState = CFWL_PartState::kChecked;
- int32_t m_iYear = -1;
- int32_t m_iMonth = -1;
- int32_t m_iDay = -1;
- float m_fBtn = 0.0f;
- CFX_RectF m_BtnRect;
- CFX_RectF m_ClientRect;
- cppgc::Member<CFWL_DateTimeEdit> const m_pEdit;
- cppgc::Member<CFWL_MonthCalendar> const m_pMonthCal;
+ bool lbtn_down_ = false;
+ Mask<CFWL_PartState> btn_state_ = CFWL_PartState::kChecked;
+ int32_t year_ = -1;
+ int32_t month_ = -1;
+ int32_t day_ = -1;
+ float btn_ = 0.0f;
+ CFX_RectF btn_rect_;
+ CFX_RectF client_rect_;
+ cppgc::Member<CFWL_DateTimeEdit> const edit_;
+ cppgc::Member<CFWL_MonthCalendar> const month_cal_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 1bd927d..4fe1153 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -53,23 +53,24 @@
const Properties& properties,
CFWL_Widget* pOuter)
: CFWL_Widget(app, properties, pOuter),
- m_pEditEngine(std::make_unique<CFDE_TextEditEngine>()) {
- m_pEditEngine->SetDelegate(this);
+ edit_engine_(std::make_unique<CFDE_TextEditEngine>()) {
+ edit_engine_->SetDelegate(this);
}
CFWL_Edit::~CFWL_Edit() = default;
void CFWL_Edit::PreFinalize() {
- m_pEditEngine->SetDelegate(nullptr);
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
+ edit_engine_->SetDelegate(nullptr);
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
HideCaret(nullptr);
+ }
CFWL_Widget::PreFinalize();
}
void CFWL_Edit::Trace(cppgc::Visitor* visitor) const {
CFWL_Widget::Trace(visitor);
- visitor->Trace(m_pVertScrollBar);
- visitor->Trace(m_pCaret);
+ visitor->Trace(vert_scroll_bar_);
+ visitor->Trace(caret_);
}
FWL_Type CFWL_Edit::GetClassID() const {
@@ -77,8 +78,8 @@
}
CFX_RectF CFWL_Edit::GetWidgetRect() {
- CFX_RectF rect = m_WidgetRect;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_OuterScrollbar) {
+ CFX_RectF rect = widget_rect_;
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_OuterScrollbar) {
float scrollbarWidth = GetThemeProvider()->GetScrollBarWidth();
if (IsShowVertScrollBar()) {
rect.width += scrollbarWidth;
@@ -90,10 +91,10 @@
CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() {
CFX_RectF rect;
- if (m_pEditEngine->GetLength() > 0) {
- CFX_SizeF size = CalcTextSize(
- m_pEditEngine->GetText(),
- !!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_MultiLine));
+ if (edit_engine_->GetLength() > 0) {
+ CFX_SizeF size =
+ CalcTextSize(edit_engine_->GetText(),
+ !!(properties_.style_exts_ & FWL_STYLEEXT_EDT_MultiLine));
rect = CFX_RectF(0, 0, size);
}
InflateWidgetRect(rect);
@@ -101,8 +102,8 @@
}
void CFWL_Edit::SetStates(uint32_t dwStates) {
- if ((m_Properties.m_dwStates & FWL_STATE_WGT_Invisible) ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)) {
+ if ((properties_.states_ & FWL_STATE_WGT_Invisible) ||
+ (properties_.states_ & FWL_STATE_WGT_Disabled)) {
HideCaret(nullptr);
}
CFWL_Widget::SetStates(dwStates);
@@ -113,8 +114,9 @@
return;
Layout();
- if (m_ClientRect.IsEmpty())
+ if (client_rect_.IsEmpty()) {
return;
+ }
UpdateEditEngine();
UpdateVAlignment();
@@ -123,14 +125,16 @@
}
FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) {
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_OuterScrollbar) {
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowVertScrollBar()) {
- if (m_pVertScrollBar->GetWidgetRect().Contains(point))
+ if (vert_scroll_bar_->GetWidgetRect().Contains(point)) {
return FWL_WidgetHit::VScrollBar;
+ }
}
}
- if (m_ClientRect.Contains(point))
+ if (client_rect_.Contains(point)) {
return FWL_WidgetHit::Edit;
+ }
return FWL_WidgetHit::Unknown;
}
@@ -139,8 +143,9 @@
if (!pGraphics)
return;
- if (m_ClientRect.IsEmpty())
+ if (client_rect_.IsEmpty()) {
return;
+ }
DrawContent(pGraphics, matrix);
if (HasBorder())
@@ -148,103 +153,106 @@
}
void CFWL_Edit::SetText(const WideString& wsText) {
- m_pEditEngine->Clear();
- m_pEditEngine->Insert(0, wsText,
- CFDE_TextEditEngine::RecordOperation::kInsertRecord);
+ edit_engine_->Clear();
+ edit_engine_->Insert(0, wsText,
+ CFDE_TextEditEngine::RecordOperation::kInsertRecord);
}
void CFWL_Edit::SetTextSkipNotify(const WideString& wsText) {
- m_pEditEngine->Clear();
- m_pEditEngine->Insert(0, wsText,
- CFDE_TextEditEngine::RecordOperation::kSkipNotify);
+ edit_engine_->Clear();
+ edit_engine_->Insert(0, wsText,
+ CFDE_TextEditEngine::RecordOperation::kSkipNotify);
}
size_t CFWL_Edit::GetTextLength() const {
- return m_pEditEngine->GetLength();
+ return edit_engine_->GetLength();
}
WideString CFWL_Edit::GetText() const {
- return m_pEditEngine->GetText();
+ return edit_engine_->GetText();
}
void CFWL_Edit::ClearText() {
- m_pEditEngine->Clear();
+ edit_engine_->Clear();
}
void CFWL_Edit::SelectAll() {
- m_pEditEngine->SelectAll();
+ edit_engine_->SelectAll();
}
bool CFWL_Edit::HasSelection() const {
- return m_pEditEngine->HasSelection();
+ return edit_engine_->HasSelection();
}
std::pair<size_t, size_t> CFWL_Edit::GetSelection() const {
- return m_pEditEngine->GetSelection();
+ return edit_engine_->GetSelection();
}
void CFWL_Edit::ClearSelection() {
- return m_pEditEngine->ClearSelection();
+ return edit_engine_->ClearSelection();
}
int32_t CFWL_Edit::GetLimit() const {
- return m_nLimit;
+ return limit_;
}
void CFWL_Edit::SetLimit(int32_t nLimit) {
- m_nLimit = nLimit;
+ limit_ = nLimit;
- if (m_nLimit > 0) {
- m_pEditEngine->SetHasCharacterLimit(true);
- m_pEditEngine->SetCharacterLimit(nLimit);
+ if (limit_ > 0) {
+ edit_engine_->SetHasCharacterLimit(true);
+ edit_engine_->SetCharacterLimit(nLimit);
} else {
- m_pEditEngine->SetHasCharacterLimit(false);
+ edit_engine_->SetHasCharacterLimit(false);
}
}
void CFWL_Edit::SetAliasChar(wchar_t wAlias) {
- m_pEditEngine->SetAliasChar(wAlias);
+ edit_engine_->SetAliasChar(wAlias);
}
std::optional<WideString> CFWL_Edit::Copy() {
- if (!m_pEditEngine->HasSelection())
+ if (!edit_engine_->HasSelection()) {
return std::nullopt;
+ }
- return m_pEditEngine->GetSelectedText();
+ return edit_engine_->GetSelectedText();
}
std::optional<WideString> CFWL_Edit::Cut() {
- if (!m_pEditEngine->HasSelection())
+ if (!edit_engine_->HasSelection()) {
return std::nullopt;
+ }
- WideString cut_text = m_pEditEngine->DeleteSelectedText();
+ WideString cut_text = edit_engine_->DeleteSelectedText();
UpdateCaret();
return cut_text;
}
bool CFWL_Edit::Paste(const WideString& wsPaste) {
- if (m_pEditEngine->HasSelection())
- m_pEditEngine->ReplaceSelectedText(wsPaste);
- else
- m_pEditEngine->Insert(m_CursorPosition, wsPaste);
+ if (edit_engine_->HasSelection()) {
+ edit_engine_->ReplaceSelectedText(wsPaste);
+ } else {
+ edit_engine_->Insert(cursor_position_, wsPaste);
+ }
return true;
}
bool CFWL_Edit::Undo() {
- return CanUndo() && m_pEditEngine->Undo();
+ return CanUndo() && edit_engine_->Undo();
}
bool CFWL_Edit::Redo() {
- return CanRedo() && m_pEditEngine->Redo();
+ return CanRedo() && edit_engine_->Redo();
}
bool CFWL_Edit::CanUndo() {
- return m_pEditEngine->CanUndo();
+ return edit_engine_->CanUndo();
}
bool CFWL_Edit::CanRedo() {
- return m_pEditEngine->CanRedo();
+ return edit_engine_->CanRedo();
}
void CFWL_Edit::NotifyTextFull() {
@@ -253,16 +261,18 @@
}
void CFWL_Edit::OnCaretChanged() {
- if (m_EngineRect.IsEmpty())
+ if (engine_rect_.IsEmpty()) {
return;
- if ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0)
+ }
+ if ((properties_.states_ & FWL_STATE_WGT_Focused) == 0) {
return;
+ }
bool bRepaintContent = UpdateOffset();
UpdateCaret();
CFX_RectF rtInvalid;
bool bRepaintScroll = false;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_MultiLine) {
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_MultiLine) {
CFWL_ScrollBar* pScroll = UpdateScroll();
if (pScroll) {
rtInvalid = pScroll->GetWidgetRect();
@@ -271,7 +281,7 @@
}
if (bRepaintContent || bRepaintScroll) {
if (bRepaintContent)
- rtInvalid.Union(m_EngineRect);
+ rtInvalid.Union(engine_rect_);
RepaintRect(rtInvalid);
}
}
@@ -289,8 +299,9 @@
}
void CFWL_Edit::OnTextChanged() {
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_VAlignMask)
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_VAlignMask) {
UpdateVAlignment();
+ }
LayoutScrollBar();
RepaintRect(GetClientRect());
@@ -307,26 +318,26 @@
}
void CFWL_Edit::SetScrollOffset(float fScrollOffset) {
- m_fScrollOffsetY = fScrollOffset;
+ scroll_offset_y_ = fScrollOffset;
}
void CFWL_Edit::DrawContent(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
DrawContentNonComb(pGraphics, mtMatrix);
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_CombText) {
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_CombText) {
CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
CFGAS_GEPath path;
- const int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1;
- const float fStep = m_EngineRect.width / iLimit;
- float fLeft = m_EngineRect.left + 1;
+ const int32_t iLimit = limit_ > 0 ? limit_ : 1;
+ const float fStep = engine_rect_.width / iLimit;
+ float fLeft = engine_rect_.left + 1;
for (int32_t i = 1; i < iLimit; i++) {
fLeft += fStep;
- path.AddLine(CFX_PointF(fLeft, m_ClientRect.top),
- CFX_PointF(fLeft, m_ClientRect.bottom()));
+ path.AddLine(CFX_PointF(fLeft, client_rect_.top),
+ CFX_PointF(fLeft, client_rect_.bottom()));
}
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kCombTextLine, this,
pGraphics);
- param.m_matrix = mtMatrix;
+ param.matrix_ = mtMatrix;
param.SetPath(&path);
GetThemeProvider()->DrawBackground(param);
}
@@ -335,17 +346,17 @@
void CFWL_Edit::DrawContentNonComb(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
- CFX_RectF rtClip = m_EngineRect;
- float fOffSetX = m_EngineRect.left - m_fScrollOffsetX;
- float fOffSetY = m_EngineRect.top - m_fScrollOffsetY + m_fVAlignOffset;
+ CFX_RectF rtClip = engine_rect_;
+ float fOffSetX = engine_rect_.left - scroll_offset_x_;
+ float fOffSetY = engine_rect_.top - scroll_offset_y_ + valign_offset_;
CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
rtClip = mtMatrix.TransformRect(rtClip);
mt.Concat(mtMatrix);
- bool bShowSel = !!(m_Properties.m_dwStates & FWL_STATE_WGT_Focused);
- if (bShowSel && m_pEditEngine->HasSelection()) {
- auto [sel_start, count] = m_pEditEngine->GetSelection();
- std::vector<CFX_RectF> rects = m_pEditEngine->GetCharacterRectsInRange(
+ bool bShowSel = !!(properties_.states_ & FWL_STATE_WGT_Focused);
+ if (bShowSel && edit_engine_->HasSelection()) {
+ auto [sel_start, count] = edit_engine_->GetSelection();
+ std::vector<CFX_RectF> rects = edit_engine_->GetCharacterRectsInRange(
checked_cast<int32_t>(sel_start), checked_cast<int32_t>(count));
CFGAS_GEPath path;
@@ -358,7 +369,7 @@
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- param.m_matrix = mtMatrix;
+ param.matrix_ = mtMatrix;
param.SetPath(&path);
GetThemeProvider()->DrawBackground(param);
}
@@ -372,7 +383,7 @@
const CFX_Matrix& mt) {
DCHECK(pRenderDev);
- RetainPtr<CFGAS_GEFont> font = m_pEditEngine->GetFont();
+ RetainPtr<CFGAS_GEFont> font = edit_engine_->GetFont();
if (!font)
return;
@@ -387,17 +398,17 @@
}
rtDocClip = mt.GetInverse().TransformRect(rtDocClip);
- for (const FDE_TEXTEDITPIECE& info : m_pEditEngine->GetTextPieces()) {
+ for (const FDE_TEXTEDITPIECE& info : edit_engine_->GetTextPieces()) {
// If this character is outside the clip, skip it.
if (!rtDocClip.IntersectWith(info.rtPiece))
continue;
- std::vector<TextCharPos> char_pos = m_pEditEngine->GetDisplayPos(info);
+ std::vector<TextCharPos> char_pos = edit_engine_->GetDisplayPos(info);
if (char_pos.empty())
continue;
- CFDE_TextOut::DrawString(pRenderDev, m_pEditEngine->GetFontColor(), font,
- char_pos, m_pEditEngine->GetFontSize(), mt);
+ CFDE_TextOut::DrawString(pRenderDev, edit_engine_->GetFontColor(), font,
+ char_pos, edit_engine_->GetFontSize(), mt);
}
}
@@ -407,17 +418,17 @@
}
void CFWL_Edit::UpdateEditParams() {
- m_pEditEngine->SetAvailableWidth(m_EngineRect.width);
- m_pEditEngine->SetCombText(
- !!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_CombText));
+ edit_engine_->SetAvailableWidth(engine_rect_.width);
+ edit_engine_->SetCombText(
+ !!(properties_.style_exts_ & FWL_STYLEEXT_EDT_CombText));
- m_pEditEngine->EnableValidation(
- !!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_Validate));
- m_pEditEngine->EnablePasswordMode(
- !!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_Password));
+ edit_engine_->EnableValidation(
+ !!(properties_.style_exts_ & FWL_STYLEEXT_EDT_Validate));
+ edit_engine_->EnablePasswordMode(
+ !!(properties_.style_exts_ & FWL_STYLEEXT_EDT_Password));
uint32_t alignment = 0;
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_HAlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_EDT_HAlignMask) {
case FWL_STYLEEXT_EDT_HNear: {
alignment |= CFX_TxtLineAlignment_Left;
break;
@@ -433,7 +444,7 @@
default:
break;
}
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_HAlignModeMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_EDT_HAlignModeMask) {
case FWL_STYLEEXT_EDT_Justified: {
alignment |= CFX_TxtLineAlignment_Justified;
break;
@@ -441,63 +452,63 @@
default:
break;
}
- m_pEditEngine->SetAlignment(alignment);
+ edit_engine_->SetAlignment(alignment);
bool auto_hscroll =
- !!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_AutoHScroll);
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_MultiLine) {
- m_pEditEngine->EnableMultiLine(true);
- m_pEditEngine->EnableLineWrap(!auto_hscroll);
- m_pEditEngine->LimitVerticalScroll(
- (m_Properties.m_dwStyles & FWL_STYLE_WGT_VScroll) == 0 &&
- (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_AutoVScroll) == 0);
+ !!(properties_.style_exts_ & FWL_STYLEEXT_EDT_AutoHScroll);
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_MultiLine) {
+ edit_engine_->EnableMultiLine(true);
+ edit_engine_->EnableLineWrap(!auto_hscroll);
+ edit_engine_->LimitVerticalScroll(
+ (properties_.styles_ & FWL_STYLE_WGT_VScroll) == 0 &&
+ (properties_.style_exts_ & FWL_STYLEEXT_EDT_AutoVScroll) == 0);
} else {
- m_pEditEngine->EnableMultiLine(false);
- m_pEditEngine->EnableLineWrap(false);
- m_pEditEngine->LimitVerticalScroll(false);
+ edit_engine_->EnableMultiLine(false);
+ edit_engine_->EnableLineWrap(false);
+ edit_engine_->LimitVerticalScroll(false);
}
- m_pEditEngine->LimitHorizontalScroll(!auto_hscroll);
+ edit_engine_->LimitHorizontalScroll(!auto_hscroll);
IFWL_ThemeProvider* theme = GetThemeProvider();
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
- m_fFontSize = theme->GetFontSize(part);
+ font_size_ = theme->GetFontSize(part);
RetainPtr<CFGAS_GEFont> pFont = theme->GetFont(part);
if (!pFont)
return;
- m_pEditEngine->SetFont(pFont);
- m_pEditEngine->SetFontColor(theme->GetTextColor(part));
- m_pEditEngine->SetFontSize(m_fFontSize);
- m_pEditEngine->SetLineSpace(theme->GetLineHeight(part));
- m_pEditEngine->SetTabWidth(m_fFontSize);
- m_pEditEngine->SetVisibleLineCount(m_EngineRect.height /
- theme->GetLineHeight(part));
+ edit_engine_->SetFont(pFont);
+ edit_engine_->SetFontColor(theme->GetTextColor(part));
+ edit_engine_->SetFontSize(font_size_);
+ edit_engine_->SetLineSpace(theme->GetLineHeight(part));
+ edit_engine_->SetTabWidth(font_size_);
+ edit_engine_->SetVisibleLineCount(engine_rect_.height /
+ theme->GetLineHeight(part));
}
void CFWL_Edit::UpdateEditLayout() {
- m_pEditEngine->Layout();
+ edit_engine_->Layout();
}
bool CFWL_Edit::UpdateOffset() {
- CFX_RectF rtCaret = m_CaretRect;
+ CFX_RectF rtCaret = caret_rect_;
- float fOffSetX = m_EngineRect.left - m_fScrollOffsetX;
- float fOffSetY = m_EngineRect.top - m_fScrollOffsetY + m_fVAlignOffset;
+ float fOffSetX = engine_rect_.left - scroll_offset_x_;
+ float fOffSetY = engine_rect_.top - scroll_offset_y_ + valign_offset_;
rtCaret.Offset(fOffSetX, fOffSetY);
- const CFX_RectF& edit_bounds = m_EngineRect;
+ const CFX_RectF& edit_bounds = engine_rect_;
if (edit_bounds.Contains(rtCaret)) {
- CFX_RectF contents_bounds = m_pEditEngine->GetContentsBoundingBox();
+ CFX_RectF contents_bounds = edit_engine_->GetContentsBoundingBox();
contents_bounds.Offset(fOffSetX, fOffSetY);
- if (contents_bounds.right() < edit_bounds.right() && m_fScrollOffsetX > 0) {
- m_fScrollOffsetX += contents_bounds.right() - edit_bounds.right();
- m_fScrollOffsetX = std::max(m_fScrollOffsetX, 0.0f);
+ if (contents_bounds.right() < edit_bounds.right() && scroll_offset_x_ > 0) {
+ scroll_offset_x_ += contents_bounds.right() - edit_bounds.right();
+ scroll_offset_x_ = std::max(scroll_offset_x_, 0.0f);
}
if (contents_bounds.bottom() < edit_bounds.bottom() &&
- m_fScrollOffsetY > 0) {
- m_fScrollOffsetY += contents_bounds.bottom() - edit_bounds.bottom();
- m_fScrollOffsetY = std::max(m_fScrollOffsetY, 0.0f);
+ scroll_offset_y_ > 0) {
+ scroll_offset_y_ += contents_bounds.bottom() - edit_bounds.bottom();
+ scroll_offset_y_ = std::max(scroll_offset_y_, 0.0f);
}
return false;
}
@@ -513,16 +524,17 @@
if (rtCaret.bottom() > edit_bounds.bottom())
offsetY = rtCaret.bottom() - edit_bounds.bottom();
- m_fScrollOffsetX += offsetX;
- m_fScrollOffsetY += offsetY;
- if (m_fFontSize > m_EngineRect.height)
- m_fScrollOffsetY = 0;
+ scroll_offset_x_ += offsetX;
+ scroll_offset_y_ += offsetY;
+ if (font_size_ > engine_rect_.height) {
+ scroll_offset_y_ = 0;
+ }
return true;
}
bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged) {
- m_fScrollOffsetY += fPosChanged;
+ scroll_offset_y_ += fPosChanged;
return true;
}
@@ -533,27 +545,27 @@
const float fSpaceAbove = pSpace.width >= 0.1f ? pSpace.width : 0.0f;
const float fSpaceBelow = pSpace.height >= 0.1f ? pSpace.height : 0.0f;
float fOffsetY = 0.0f;
- CFX_RectF contents_bounds = m_pEditEngine->GetContentsBoundingBox();
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_VCenter) {
- fOffsetY = (m_EngineRect.height - contents_bounds.height) / 2.0f;
+ CFX_RectF contents_bounds = edit_engine_->GetContentsBoundingBox();
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_VCenter) {
+ fOffsetY = (engine_rect_.height - contents_bounds.height) / 2.0f;
if (fOffsetY < (fSpaceAbove + fSpaceBelow) / 2.0f &&
fSpaceAbove < fSpaceBelow) {
return;
}
fOffsetY += (fSpaceAbove - fSpaceBelow) / 2.0f;
- } else if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_VFar) {
- fOffsetY = (m_EngineRect.height - contents_bounds.height);
+ } else if (properties_.style_exts_ & FWL_STYLEEXT_EDT_VFar) {
+ fOffsetY = (engine_rect_.height - contents_bounds.height);
fOffsetY -= fSpaceBelow;
} else {
fOffsetY += fSpaceAbove;
}
- m_fVAlignOffset = std::max(fOffsetY, 0.0f);
+ valign_offset_ = std::max(fOffsetY, 0.0f);
}
void CFWL_Edit::UpdateCaret() {
- CFX_RectF rtCaret = m_CaretRect;
- rtCaret.Offset(m_EngineRect.left - m_fScrollOffsetX,
- m_EngineRect.top - m_fScrollOffsetY + m_fVAlignOffset);
+ CFX_RectF rtCaret = caret_rect_;
+ rtCaret.Offset(engine_rect_.left - scroll_offset_x_,
+ engine_rect_.top - scroll_offset_y_ + valign_offset_);
CFX_RectF rtClient = GetClientRect();
rtCaret.Intersect(rtClient);
@@ -563,71 +575,72 @@
rtCaret.width = right - rtCaret.left;
}
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused && !rtCaret.IsEmpty())
+ if (properties_.states_ & FWL_STATE_WGT_Focused && !rtCaret.IsEmpty()) {
ShowCaret(&rtCaret);
- else
+ } else {
HideCaret(&rtCaret);
+ }
}
CFWL_ScrollBar* CFWL_Edit::UpdateScroll() {
- bool bShowVert = m_pVertScrollBar && m_pVertScrollBar->IsVisible();
+ bool bShowVert = vert_scroll_bar_ && vert_scroll_bar_->IsVisible();
if (!bShowVert)
return nullptr;
- CFX_RectF contents_bounds = m_pEditEngine->GetContentsBoundingBox();
- CFX_RectF rtScroll = m_pVertScrollBar->GetWidgetRect();
+ CFX_RectF contents_bounds = edit_engine_->GetContentsBoundingBox();
+ CFX_RectF rtScroll = vert_scroll_bar_->GetWidgetRect();
if (rtScroll.height < contents_bounds.height) {
- float fStep = m_pEditEngine->GetLineSpace();
+ float fStep = edit_engine_->GetLineSpace();
float fRange =
- std::max(contents_bounds.height - m_EngineRect.height, fStep);
- m_pVertScrollBar->SetRange(0.0f, fRange);
- float fPos = std::clamp(m_fScrollOffsetY, 0.0f, fRange);
- m_pVertScrollBar->SetPos(fPos);
- m_pVertScrollBar->SetTrackPos(fPos);
- m_pVertScrollBar->SetPageSize(rtScroll.height);
- m_pVertScrollBar->SetStepSize(fStep);
- m_pVertScrollBar->RemoveStates(FWL_STATE_WGT_Disabled);
- m_pVertScrollBar->Update();
- return m_pVertScrollBar;
+ std::max(contents_bounds.height - engine_rect_.height, fStep);
+ vert_scroll_bar_->SetRange(0.0f, fRange);
+ float fPos = std::clamp(scroll_offset_y_, 0.0f, fRange);
+ vert_scroll_bar_->SetPos(fPos);
+ vert_scroll_bar_->SetTrackPos(fPos);
+ vert_scroll_bar_->SetPageSize(rtScroll.height);
+ vert_scroll_bar_->SetStepSize(fStep);
+ vert_scroll_bar_->RemoveStates(FWL_STATE_WGT_Disabled);
+ vert_scroll_bar_->Update();
+ return vert_scroll_bar_;
}
- if ((m_pVertScrollBar->GetStates() & FWL_STATE_WGT_Disabled) == 0) {
- m_pVertScrollBar->SetRange(0, -1);
- m_pVertScrollBar->SetStates(FWL_STATE_WGT_Disabled);
- m_pVertScrollBar->Update();
- return m_pVertScrollBar;
+ if ((vert_scroll_bar_->GetStates() & FWL_STATE_WGT_Disabled) == 0) {
+ vert_scroll_bar_->SetRange(0, -1);
+ vert_scroll_bar_->SetStates(FWL_STATE_WGT_Disabled);
+ vert_scroll_bar_->Update();
+ return vert_scroll_bar_;
}
return nullptr;
}
bool CFWL_Edit::IsShowVertScrollBar() const {
const bool bShow =
- !(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Focused);
- return bShow && (m_Properties.m_dwStyles & FWL_STYLE_WGT_VScroll) &&
- (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_MultiLine) &&
+ !(properties_.style_exts_ & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ||
+ (properties_.states_ & FWL_STATE_WGT_Focused);
+ return bShow && (properties_.styles_ & FWL_STYLE_WGT_VScroll) &&
+ (properties_.style_exts_ & FWL_STYLEEXT_EDT_MultiLine) &&
IsContentHeightOverflow();
}
bool CFWL_Edit::IsContentHeightOverflow() const {
- return m_pEditEngine->GetContentsBoundingBox().height >
- m_EngineRect.height + 1.0f;
+ return edit_engine_->GetContentsBoundingBox().height >
+ engine_rect_.height + 1.0f;
}
void CFWL_Edit::Layout() {
- m_ClientRect = GetClientRect();
- m_EngineRect = m_ClientRect;
+ client_rect_ = GetClientRect();
+ engine_rect_ = client_rect_;
IFWL_ThemeProvider* theme = GetThemeProvider();
float fWidth = theme->GetScrollBarWidth();
if (!GetOuter()) {
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
CFX_RectF pUIMargin = theme->GetUIMargin(part);
- m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
+ engine_rect_.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
} else if (GetOuter()->GetClassID() == FWL_Type::DateTimePicker) {
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, GetOuter());
CFX_RectF pUIMargin = theme->GetUIMargin(part);
- m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
+ engine_rect_.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
}
@@ -636,62 +649,64 @@
InitVerticalScrollBar();
CFX_RectF rtVertScr;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtVertScr = CFX_RectF(m_ClientRect.right() + kEditMargin,
- m_ClientRect.top, fWidth, m_ClientRect.height);
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_OuterScrollbar) {
+ rtVertScr = CFX_RectF(client_rect_.right() + kEditMargin,
+ client_rect_.top, fWidth, client_rect_.height);
} else {
- rtVertScr = CFX_RectF(m_ClientRect.right() - fWidth, m_ClientRect.top,
- fWidth, m_ClientRect.height);
- m_EngineRect.width -= fWidth;
+ rtVertScr = CFX_RectF(client_rect_.right() - fWidth, client_rect_.top,
+ fWidth, client_rect_.height);
+ engine_rect_.width -= fWidth;
}
- m_pVertScrollBar->SetWidgetRect(rtVertScr);
- m_pVertScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
- m_pVertScrollBar->Update();
- } else if (m_pVertScrollBar) {
- m_pVertScrollBar->SetStates(FWL_STATE_WGT_Invisible);
+ vert_scroll_bar_->SetWidgetRect(rtVertScr);
+ vert_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ vert_scroll_bar_->Update();
+ } else if (vert_scroll_bar_) {
+ vert_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
}
}
void CFWL_Edit::LayoutScrollBar() {
- if (!(m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_ShowScrollbarFocus))
+ if (!(properties_.style_exts_ & FWL_STYLEEXT_EDT_ShowScrollbarFocus)) {
return;
+ }
bool bShowVertScrollbar = IsShowVertScrollBar();
IFWL_ThemeProvider* theme = GetThemeProvider();
float fWidth = theme->GetScrollBarWidth();
if (bShowVertScrollbar) {
- if (!m_pVertScrollBar) {
+ if (!vert_scroll_bar_) {
InitVerticalScrollBar();
CFX_RectF rtVertScr;
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtVertScr = CFX_RectF(m_ClientRect.right() + kEditMargin,
- m_ClientRect.top, fWidth, m_ClientRect.height);
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_OuterScrollbar) {
+ rtVertScr = CFX_RectF(client_rect_.right() + kEditMargin,
+ client_rect_.top, fWidth, client_rect_.height);
} else {
- rtVertScr = CFX_RectF(m_ClientRect.right() - fWidth, m_ClientRect.top,
- fWidth, m_ClientRect.height);
+ rtVertScr = CFX_RectF(client_rect_.right() - fWidth, client_rect_.top,
+ fWidth, client_rect_.height);
}
- m_pVertScrollBar->SetWidgetRect(rtVertScr);
- m_pVertScrollBar->Update();
+ vert_scroll_bar_->SetWidgetRect(rtVertScr);
+ vert_scroll_bar_->Update();
}
- m_pVertScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
- } else if (m_pVertScrollBar) {
- m_pVertScrollBar->SetStates(FWL_STATE_WGT_Invisible);
+ vert_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ } else if (vert_scroll_bar_) {
+ vert_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
}
if (bShowVertScrollbar)
UpdateScroll();
}
CFX_PointF CFWL_Edit::DeviceToEngine(const CFX_PointF& pt) {
- return pt + CFX_PointF(m_fScrollOffsetX - m_EngineRect.left,
- m_fScrollOffsetY - m_EngineRect.top - m_fVAlignOffset);
+ return pt + CFX_PointF(scroll_offset_x_ - engine_rect_.left,
+ scroll_offset_y_ - engine_rect_.top - valign_offset_);
}
void CFWL_Edit::InitVerticalScrollBar() {
- if (m_pVertScrollBar)
+ if (vert_scroll_bar_) {
return;
+ }
- m_pVertScrollBar = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
+ vert_scroll_bar_ = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp(),
Properties{0, FWL_STYLEEXT_SCB_Vert,
FWL_STATE_WGT_Disabled | FWL_STATE_WGT_Invisible},
@@ -699,16 +714,16 @@
}
void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
- if (m_pCaret) {
- m_pCaret->ShowCaret();
+ if (caret_) {
+ caret_->ShowCaret();
if (!pRect->IsEmpty())
- m_pCaret->SetWidgetRect(*pRect);
- RepaintRect(m_EngineRect);
+ caret_->SetWidgetRect(*pRect);
+ RepaintRect(engine_rect_);
return;
}
CFWL_Widget* pOuter = this;
- pRect->Offset(m_WidgetRect.left, m_WidgetRect.top);
+ pRect->Offset(widget_rect_.left, widget_rect_.top);
while (pOuter->GetOuter()) {
pOuter = pOuter->GetOuter();
CFX_RectF rtOuter = pOuter->GetWidgetRect();
@@ -724,9 +739,9 @@
}
void CFWL_Edit::HideCaret(CFX_RectF* pRect) {
- if (m_pCaret) {
- m_pCaret->HideCaret();
- RepaintRect(m_EngineRect);
+ if (caret_) {
+ caret_->HideCaret();
+ RepaintRect(engine_rect_);
return;
}
@@ -742,41 +757,44 @@
}
void CFWL_Edit::InitCaret() {
- if (m_pCaret)
+ if (caret_) {
return;
+ }
- m_pCaret = cppgc::MakeGarbageCollected<CFWL_Caret>(
+ caret_ = cppgc::MakeGarbageCollected<CFWL_Caret>(
GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp(), Properties(),
this);
- m_pCaret->SetStates(m_Properties.m_dwStates);
+ caret_->SetStates(properties_.states_);
UpdateCursorRect();
}
void CFWL_Edit::UpdateCursorRect() {
int32_t bidi_level;
- if (m_pEditEngine->CanGenerateCharacterInfo()) {
- std::tie(bidi_level, m_CaretRect) = m_pEditEngine->GetCharacterInfo(
- checked_cast<int32_t>(m_CursorPosition));
+ if (edit_engine_->CanGenerateCharacterInfo()) {
+ std::tie(bidi_level, caret_rect_) =
+ edit_engine_->GetCharacterInfo(checked_cast<int32_t>(cursor_position_));
} else {
bidi_level = 0;
- m_CaretRect = CFX_RectF();
+ caret_rect_ = CFX_RectF();
}
// TODO(dsinclair): This should handle bidi level ...
- m_CaretRect.width = 1.0f;
+ caret_rect_.width = 1.0f;
// TODO(hnakashima): Handle correctly edits with empty text instead of using
// these defaults.
- if (m_CaretRect.height == 0)
- m_CaretRect.height = 8.0f;
+ if (caret_rect_.height == 0) {
+ caret_rect_.height = 8.0f;
+ }
}
void CFWL_Edit::SetCursorPosition(size_t position) {
- if (m_CursorPosition == position)
+ if (cursor_position_ == position) {
return;
+ }
- m_CursorPosition = std::min(position, m_pEditEngine->GetLength());
+ cursor_position_ = std::min(position, edit_engine_->GetLength());
UpdateCursorRect();
OnCaretChanged();
}
@@ -791,7 +809,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
@@ -814,10 +832,11 @@
}
case CFWL_Message::Type::kKey: {
CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage);
- if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown)
+ if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
OnKeyDown(pKey);
- else if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kChar)
+ } else if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kChar) {
OnChar(pKey);
+ }
break;
}
default:
@@ -833,7 +852,7 @@
return;
CFWL_Widget* pSrcTarget = pEvent->GetSrcTarget();
- if ((pSrcTarget == m_pVertScrollBar && m_pVertScrollBar)) {
+ if ((pSrcTarget == vert_scroll_bar_ && vert_scroll_bar_)) {
CFWL_EventScroll* pScrollEvent = static_cast<CFWL_EventScroll*>(pEvent);
OnScroll(static_cast<CFWL_ScrollBar*>(pSrcTarget),
pScrollEvent->GetScrollCode(), pScrollEvent->GetPos());
@@ -846,12 +865,11 @@
}
void CFWL_Edit::DoRButtonDown(CFWL_MessageMouse* pMsg) {
- SetCursorPosition(
- m_pEditEngine->GetIndexForPoint(DeviceToEngine(pMsg->m_pos)));
+ SetCursorPosition(edit_engine_->GetIndexForPoint(DeviceToEngine(pMsg->pos_)));
}
void CFWL_Edit::OnFocusGained() {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
+ properties_.states_ |= FWL_STATE_WGT_Focused;
UpdateVAlignment();
UpdateOffset();
UpdateCaret();
@@ -860,8 +878,8 @@
void CFWL_Edit::OnFocusLost() {
bool bRepaint = false;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused) {
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
HideCaret(nullptr);
if (HasSelection()) {
ClearSelection();
@@ -873,121 +891,124 @@
if (!bRepaint)
return;
- RepaintRect(CFX_RectF(0, 0, m_WidgetRect.width, m_WidgetRect.height));
+ RepaintRect(CFX_RectF(0, 0, widget_rect_.width, widget_rect_.height));
}
void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) {
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
return;
+ }
- m_bLButtonDown = true;
+ lbutton_down_ = true;
SetGrab(true);
bool bRepaint = false;
- if (m_pEditEngine->HasSelection()) {
- m_pEditEngine->ClearSelection();
+ if (edit_engine_->HasSelection()) {
+ edit_engine_->ClearSelection();
bRepaint = true;
}
size_t index_at_click =
- m_pEditEngine->GetIndexForPoint(DeviceToEngine(pMsg->m_pos));
+ edit_engine_->GetIndexForPoint(DeviceToEngine(pMsg->pos_));
- if (index_at_click != m_CursorPosition &&
- !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kShift)) {
- size_t start = std::min(m_CursorPosition, index_at_click);
- size_t end = std::max(m_CursorPosition, index_at_click);
+ if (index_at_click != cursor_position_ &&
+ !!(pMsg->flags_ & XFA_FWL_KeyFlag::kShift)) {
+ size_t start = std::min(cursor_position_, index_at_click);
+ size_t end = std::max(cursor_position_, index_at_click);
- m_pEditEngine->SetSelection(start, end - start);
+ edit_engine_->SetSelection(start, end - start);
bRepaint = true;
} else {
SetCursorPosition(index_at_click);
}
if (bRepaint)
- RepaintRect(m_EngineRect);
+ RepaintRect(engine_rect_);
}
void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- m_bLButtonDown = false;
+ lbutton_down_ = false;
SetGrab(false);
}
void CFWL_Edit::OnButtonDoubleClick(CFWL_MessageMouse* pMsg) {
- size_t click_idx =
- m_pEditEngine->GetIndexForPoint(DeviceToEngine(pMsg->m_pos));
- auto [start_idx, count] = m_pEditEngine->BoundsForWordAt(click_idx);
+ size_t click_idx = edit_engine_->GetIndexForPoint(DeviceToEngine(pMsg->pos_));
+ auto [start_idx, count] = edit_engine_->BoundsForWordAt(click_idx);
- m_pEditEngine->SetSelection(start_idx, count);
- m_CursorPosition = start_idx + count;
- RepaintRect(m_EngineRect);
+ edit_engine_->SetSelection(start_idx, count);
+ cursor_position_ = start_idx + count;
+ RepaintRect(engine_rect_);
}
void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
- bool shift = !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kShift);
- if (!m_bLButtonDown || !shift)
+ bool shift = !!(pMsg->flags_ & XFA_FWL_KeyFlag::kShift);
+ if (!lbutton_down_ || !shift) {
return;
+ }
- size_t old_cursor_pos = m_CursorPosition;
- SetCursorPosition(
- m_pEditEngine->GetIndexForPoint(DeviceToEngine(pMsg->m_pos)));
- if (old_cursor_pos == m_CursorPosition)
+ size_t old_cursor_pos = cursor_position_;
+ SetCursorPosition(edit_engine_->GetIndexForPoint(DeviceToEngine(pMsg->pos_)));
+ if (old_cursor_pos == cursor_position_) {
return;
+ }
- size_t length = m_pEditEngine->GetLength();
- if (m_CursorPosition > length)
+ size_t length = edit_engine_->GetLength();
+ if (cursor_position_ > length) {
SetCursorPosition(length);
+ }
size_t sel_start = 0;
size_t count = 0;
- if (m_pEditEngine->HasSelection())
- std::tie(sel_start, count) = m_pEditEngine->GetSelection();
- else
+ if (edit_engine_->HasSelection()) {
+ std::tie(sel_start, count) = edit_engine_->GetSelection();
+ } else {
sel_start = old_cursor_pos;
+ }
- size_t start_pos = std::min(sel_start, m_CursorPosition);
- size_t end_pos = std::max(sel_start, m_CursorPosition);
- m_pEditEngine->SetSelection(start_pos, end_pos - start_pos);
+ size_t start_pos = std::min(sel_start, cursor_position_);
+ size_t end_pos = std::max(sel_start, cursor_position_);
+ edit_engine_->SetSelection(start_pos, end_pos - start_pos);
}
void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) {
- bool bShift = !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kShift);
- bool bCtrl = !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kCtrl);
+ bool bShift = !!(pMsg->flags_ & XFA_FWL_KeyFlag::kShift);
+ bool bCtrl = !!(pMsg->flags_ & XFA_FWL_KeyFlag::kCtrl);
- size_t sel_start = m_CursorPosition;
- if (m_pEditEngine->HasSelection()) {
- auto [start_idx, count] = m_pEditEngine->GetSelection();
+ size_t sel_start = cursor_position_;
+ if (edit_engine_->HasSelection()) {
+ auto [start_idx, count] = edit_engine_->GetSelection();
sel_start = start_idx;
}
- switch (pMsg->m_dwKeyCodeOrChar) {
+ switch (pMsg->key_code_or_char_) {
case XFA_FWL_VKEY_Left:
- SetCursorPosition(m_pEditEngine->GetIndexLeft(m_CursorPosition));
+ SetCursorPosition(edit_engine_->GetIndexLeft(cursor_position_));
break;
case XFA_FWL_VKEY_Right:
- SetCursorPosition(m_pEditEngine->GetIndexRight(m_CursorPosition));
+ SetCursorPosition(edit_engine_->GetIndexRight(cursor_position_));
break;
case XFA_FWL_VKEY_Up:
- SetCursorPosition(m_pEditEngine->GetIndexUp(m_CursorPosition));
+ SetCursorPosition(edit_engine_->GetIndexUp(cursor_position_));
break;
case XFA_FWL_VKEY_Down:
- SetCursorPosition(m_pEditEngine->GetIndexDown(m_CursorPosition));
+ SetCursorPosition(edit_engine_->GetIndexDown(cursor_position_));
break;
case XFA_FWL_VKEY_Home:
SetCursorPosition(
- bCtrl ? 0 : m_pEditEngine->GetIndexAtStartOfLine(m_CursorPosition));
+ bCtrl ? 0 : edit_engine_->GetIndexAtStartOfLine(cursor_position_));
break;
case XFA_FWL_VKEY_End:
SetCursorPosition(
- bCtrl ? m_pEditEngine->GetLength()
- : m_pEditEngine->GetIndexAtEndOfLine(m_CursorPosition));
+ bCtrl ? edit_engine_->GetLength()
+ : edit_engine_->GetIndexAtEndOfLine(cursor_position_));
break;
case XFA_FWL_VKEY_Delete: {
- if ((m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_ReadOnly) ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)) {
+ if ((properties_.style_exts_ & FWL_STYLEEXT_EDT_ReadOnly) ||
+ (properties_.states_ & FWL_STATE_WGT_Disabled)) {
break;
}
- m_pEditEngine->Delete(m_CursorPosition, 1);
+ edit_engine_->Delete(cursor_position_, 1);
UpdateCaret();
break;
}
@@ -999,25 +1020,25 @@
}
// Update the selection.
- if (bShift && sel_start != m_CursorPosition) {
- m_pEditEngine->SetSelection(std::min(sel_start, m_CursorPosition),
- std::max(sel_start, m_CursorPosition));
- RepaintRect(m_EngineRect);
+ if (bShift && sel_start != cursor_position_) {
+ edit_engine_->SetSelection(std::min(sel_start, cursor_position_),
+ std::max(sel_start, cursor_position_));
+ RepaintRect(engine_rect_);
}
}
void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
- if ((m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_ReadOnly) ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)) {
+ if ((properties_.style_exts_ & FWL_STYLEEXT_EDT_ReadOnly) ||
+ (properties_.states_ & FWL_STATE_WGT_Disabled)) {
return;
}
- wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCodeOrChar);
+ wchar_t c = static_cast<wchar_t>(pMsg->key_code_or_char_);
switch (c) {
case L'\b':
- if (m_CursorPosition > 0) {
- SetCursorPosition(m_CursorPosition - 1);
- m_pEditEngine->Delete(m_CursorPosition, 1);
+ if (cursor_position_ > 0) {
+ SetCursorPosition(cursor_position_ - 1);
+ edit_engine_->Delete(cursor_position_, 1);
UpdateCaret();
}
break;
@@ -1026,21 +1047,22 @@
case 127: // Delete
break;
case L'\t':
- m_pEditEngine->Insert(m_CursorPosition, L"\t");
- SetCursorPosition(m_CursorPosition + 1);
+ edit_engine_->Insert(cursor_position_, L"\t");
+ SetCursorPosition(cursor_position_ + 1);
break;
case L'\r':
- if (m_Properties.m_dwStyleExts & FWL_STYLEEXT_EDT_WantReturn) {
- m_pEditEngine->Insert(m_CursorPosition, L"\n");
- SetCursorPosition(m_CursorPosition + 1);
+ if (properties_.style_exts_ & FWL_STYLEEXT_EDT_WantReturn) {
+ edit_engine_->Insert(cursor_position_, L"\n");
+ SetCursorPosition(cursor_position_ + 1);
}
break;
default: {
- if (pMsg->m_dwFlags & kEditingModifier)
+ if (pMsg->flags_ & kEditingModifier) {
break;
+ }
- m_pEditEngine->Insert(m_CursorPosition, WideString(c));
- SetCursorPosition(m_CursorPosition + 1);
+ edit_engine_->Insert(cursor_position_, WideString(c));
+ SetCursorPosition(cursor_position_ + 1);
break;
}
}
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index 00502dd..a2c529c 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -105,8 +105,8 @@
void ShowCaret(CFX_RectF* pRect);
void HideCaret(CFX_RectF* pRect);
- const CFX_RectF& GetRTClient() const { return m_ClientRect; }
- CFDE_TextEditEngine* GetTxtEdtEngine() { return m_pEditEngine.get(); }
+ const CFX_RectF& GetRTClient() const { return client_rect_; }
+ CFDE_TextEditEngine* GetTxtEdtEngine() { return edit_engine_.get(); }
private:
void RenderText(CFX_RenderDevice* pRenderDev,
@@ -148,22 +148,22 @@
CFWL_EventScroll::Code dwCode,
float fPos);
- CFX_RectF m_ClientRect;
- CFX_RectF m_EngineRect;
- CFX_RectF m_StaticRect;
- CFX_RectF m_CaretRect;
- bool m_bLButtonDown = false;
- int32_t m_nLimit = -1;
- float m_fVAlignOffset = 0.0f;
- float m_fScrollOffsetX = 0.0f;
- float m_fScrollOffsetY = 0.0f;
- float m_fFontSize = 0.0f;
- size_t m_CursorPosition = 0;
- std::unique_ptr<CFDE_TextEditEngine> const m_pEditEngine;
- cppgc::Member<CFWL_ScrollBar> m_pVertScrollBar;
- cppgc::Member<CFWL_Caret> m_pCaret;
- WideString m_wsCache;
- WideString m_wsFont;
+ CFX_RectF client_rect_;
+ CFX_RectF engine_rect_;
+ CFX_RectF static_rect_;
+ CFX_RectF caret_rect_;
+ bool lbutton_down_ = false;
+ int32_t limit_ = -1;
+ float valign_offset_ = 0.0f;
+ float scroll_offset_x_ = 0.0f;
+ float scroll_offset_y_ = 0.0f;
+ float font_size_ = 0.0f;
+ size_t cursor_position_ = 0;
+ std::unique_ptr<CFDE_TextEditEngine> const edit_engine_;
+ cppgc::Member<CFWL_ScrollBar> vert_scroll_bar_;
+ cppgc::Member<CFWL_Caret> caret_;
+ WideString cache_;
+ WideString font_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_event.cpp b/xfa/fwl/cfwl_event.cpp
index 0bb0898..04c9793 100644
--- a/xfa/fwl/cfwl_event.cpp
+++ b/xfa/fwl/cfwl_event.cpp
@@ -8,15 +8,15 @@
namespace pdfium {
-CFWL_Event::CFWL_Event(CFWL_Event::Type type) : m_type(type) {}
+CFWL_Event::CFWL_Event(CFWL_Event::Type type) : type_(type) {}
CFWL_Event::CFWL_Event(Type type, CFWL_Widget* pSrcTarget)
- : m_type(type), m_pSrcTarget(pSrcTarget) {}
+ : type_(type), src_target_(pSrcTarget) {}
CFWL_Event::CFWL_Event(Type type,
CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget)
- : m_type(type), m_pSrcTarget(pSrcTarget), m_pDstTarget(pDstTarget) {}
+ : type_(type), src_target_(pSrcTarget), dst_target_(pDstTarget) {}
CFWL_Event::~CFWL_Event() = default;
diff --git a/xfa/fwl/cfwl_event.h b/xfa/fwl/cfwl_event.h
index 0a72351..c5a619d 100644
--- a/xfa/fwl/cfwl_event.h
+++ b/xfa/fwl/cfwl_event.h
@@ -38,14 +38,14 @@
CFWL_Event(Type type, CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget);
virtual ~CFWL_Event();
- Type GetType() const { return m_type; }
- CFWL_Widget* GetSrcTarget() const { return m_pSrcTarget; }
- CFWL_Widget* GetDstTarget() const { return m_pDstTarget; }
+ Type GetType() const { return type_; }
+ CFWL_Widget* GetSrcTarget() const { return src_target_; }
+ CFWL_Widget* GetDstTarget() const { return dst_target_; }
private:
- const Type m_type;
- UnownedPtr<CFWL_Widget> const m_pSrcTarget;
- UnownedPtr<CFWL_Widget> const m_pDstTarget;
+ const Type type_;
+ UnownedPtr<CFWL_Widget> const src_target_;
+ UnownedPtr<CFWL_Widget> const dst_target_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_eventmouse.cpp b/xfa/fwl/cfwl_eventmouse.cpp
index 2eb0051..742762e 100644
--- a/xfa/fwl/cfwl_eventmouse.cpp
+++ b/xfa/fwl/cfwl_eventmouse.cpp
@@ -11,8 +11,7 @@
CFWL_EventMouse::CFWL_EventMouse(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget,
CFWL_MessageMouse::MouseCommand cmd)
- : CFWL_Event(CFWL_Event::Type::Mouse, pSrcTarget, pDstTarget),
- m_dwCmd(cmd) {}
+ : CFWL_Event(CFWL_Event::Type::Mouse, pSrcTarget, pDstTarget), cmd_(cmd) {}
CFWL_EventMouse::~CFWL_EventMouse() = default;
diff --git a/xfa/fwl/cfwl_eventmouse.h b/xfa/fwl/cfwl_eventmouse.h
index e4ade64..f9e874e 100644
--- a/xfa/fwl/cfwl_eventmouse.h
+++ b/xfa/fwl/cfwl_eventmouse.h
@@ -19,10 +19,10 @@
CFWL_MessageMouse::MouseCommand cmd);
~CFWL_EventMouse() override;
- CFWL_MessageMouse::MouseCommand GetCommand() const { return m_dwCmd; }
+ CFWL_MessageMouse::MouseCommand GetCommand() const { return cmd_; }
private:
- const CFWL_MessageMouse::MouseCommand m_dwCmd;
+ const CFWL_MessageMouse::MouseCommand cmd_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_eventscroll.cpp b/xfa/fwl/cfwl_eventscroll.cpp
index e4f629f..c58e8de 100644
--- a/xfa/fwl/cfwl_eventscroll.cpp
+++ b/xfa/fwl/cfwl_eventscroll.cpp
@@ -12,8 +12,8 @@
Code code,
float pos)
: CFWL_Event(CFWL_Event::Type::Scroll, pSrcTarget),
- m_iScrollCode(code),
- m_fPos(pos) {}
+ scroll_code_(code),
+ pos_(pos) {}
CFWL_EventScroll::~CFWL_EventScroll() = default;
diff --git a/xfa/fwl/cfwl_eventscroll.h b/xfa/fwl/cfwl_eventscroll.h
index 1001b51..95fb526 100644
--- a/xfa/fwl/cfwl_eventscroll.h
+++ b/xfa/fwl/cfwl_eventscroll.h
@@ -29,12 +29,12 @@
CFWL_EventScroll(CFWL_Widget* pSrcTarget, Code code, float pos);
~CFWL_EventScroll() override;
- Code GetScrollCode() const { return m_iScrollCode; }
- float GetPos() const { return m_fPos; }
+ Code GetScrollCode() const { return scroll_code_; }
+ float GetPos() const { return pos_; }
private:
- const Code m_iScrollCode;
- const float m_fPos;
+ const Code scroll_code_;
+ const float pos_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_eventselectchanged.cpp b/xfa/fwl/cfwl_eventselectchanged.cpp
index 760596c..6f855a4 100644
--- a/xfa/fwl/cfwl_eventselectchanged.cpp
+++ b/xfa/fwl/cfwl_eventselectchanged.cpp
@@ -11,20 +11,20 @@
CFWL_EventSelectChanged::CFWL_EventSelectChanged(CFWL_Widget* pSrcTarget,
bool bLButtonUp)
: CFWL_Event(CFWL_Event::Type::SelectChanged, pSrcTarget),
- m_bLButtonUp(bLButtonUp),
- m_iYear(-1),
- m_iMonth(-1),
- m_iDay(-1) {}
+ lbutton_up_(bLButtonUp),
+ year_(-1),
+ month_(-1),
+ day_(-1) {}
CFWL_EventSelectChanged::CFWL_EventSelectChanged(CFWL_Widget* pSrcTarget,
int32_t iYear,
int32_t iMonth,
int32_t iDay)
: CFWL_Event(CFWL_Event::Type::SelectChanged, pSrcTarget),
- m_bLButtonUp(false),
- m_iYear(iYear),
- m_iMonth(iMonth),
- m_iDay(iDay) {}
+ lbutton_up_(false),
+ year_(iYear),
+ month_(iMonth),
+ day_(iDay) {}
CFWL_EventSelectChanged::~CFWL_EventSelectChanged() = default;
diff --git a/xfa/fwl/cfwl_eventselectchanged.h b/xfa/fwl/cfwl_eventselectchanged.h
index 2aa0376..4ecbf2f 100644
--- a/xfa/fwl/cfwl_eventselectchanged.h
+++ b/xfa/fwl/cfwl_eventselectchanged.h
@@ -22,19 +22,19 @@
int32_t iDay);
~CFWL_EventSelectChanged() override;
- bool GetLButtonUp() const { return m_bLButtonUp; }
- int32_t GetYear() const { return m_iYear; }
- int32_t GetMonth() const { return m_iMonth; }
- int32_t GetDay() const { return m_iDay; }
+ bool GetLButtonUp() const { return lbutton_up_; }
+ int32_t GetYear() const { return year_; }
+ int32_t GetMonth() const { return month_; }
+ int32_t GetDay() const { return day_; }
protected:
// Used by ComboBox.
- const bool m_bLButtonUp;
+ const bool lbutton_up_;
// Used by DateTimePIcker
- const int32_t m_iYear;
- const int32_t m_iMonth;
- const int32_t m_iDay;
+ const int32_t year_;
+ const int32_t month_;
+ const int32_t day_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_eventvalidate.cpp b/xfa/fwl/cfwl_eventvalidate.cpp
index 2db1789..e136d63 100644
--- a/xfa/fwl/cfwl_eventvalidate.cpp
+++ b/xfa/fwl/cfwl_eventvalidate.cpp
@@ -10,8 +10,7 @@
CFWL_EventValidate::CFWL_EventValidate(CFWL_Widget* pSrcTarget,
const WideString& wsInsert)
- : CFWL_Event(CFWL_Event::Type::Validate, pSrcTarget),
- m_wsInsert(wsInsert) {}
+ : CFWL_Event(CFWL_Event::Type::Validate, pSrcTarget), insert_(wsInsert) {}
CFWL_EventValidate::~CFWL_EventValidate() = default;
diff --git a/xfa/fwl/cfwl_eventvalidate.h b/xfa/fwl/cfwl_eventvalidate.h
index c1507aa..ade45f7 100644
--- a/xfa/fwl/cfwl_eventvalidate.h
+++ b/xfa/fwl/cfwl_eventvalidate.h
@@ -17,13 +17,13 @@
CFWL_EventValidate(CFWL_Widget* pSrcTarget, const WideString& wsInsert);
~CFWL_EventValidate() override;
- WideString GetInsert() const { return m_wsInsert; }
- bool GetValidate() const { return m_bValidate; }
- void SetValidate(bool bValidate) { m_bValidate = bValidate; }
+ WideString GetInsert() const { return insert_; }
+ bool GetValidate() const { return validate_; }
+ void SetValidate(bool bValidate) { validate_ = bValidate; }
protected:
- const WideString m_wsInsert;
- bool m_bValidate = true;
+ const WideString insert_;
+ bool validate_ = true;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index f7940bb..6f00ed8 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -42,8 +42,8 @@
void CFWL_ListBox::Trace(cppgc::Visitor* visitor) const {
CFWL_Widget::Trace(visitor);
- visitor->Trace(m_pHorzScrollBar);
- visitor->Trace(m_pVertScrollBar);
+ visitor->Trace(horz_scroll_bar_);
+ visitor->Trace(vert_scroll_bar_);
}
FWL_Type CFWL_ListBox::GetClassID() const {
@@ -54,36 +54,37 @@
if (IsLocked())
return;
- switch (m_Properties.m_dwStyleExts & FWL_STYLEEXT_LTB_AlignMask) {
+ switch (properties_.style_exts_ & FWL_STYLEEXT_LTB_AlignMask) {
case FWL_STYLEEXT_LTB_LeftAlign:
- m_iTTOAligns = FDE_TextAlignment::kCenterLeft;
+ ttoaligns_ = FDE_TextAlignment::kCenterLeft;
break;
case FWL_STYLEEXT_LTB_RightAlign:
- m_iTTOAligns = FDE_TextAlignment::kCenterRight;
+ ttoaligns_ = FDE_TextAlignment::kCenterRight;
break;
case FWL_STYLEEXT_LTB_CenterAlign:
default:
- m_iTTOAligns = FDE_TextAlignment::kCenter;
+ ttoaligns_ = FDE_TextAlignment::kCenter;
break;
}
- m_TTOStyles.single_line_ = true;
- m_fScorllBarWidth = GetScrollWidth();
+ tto_styles_.single_line_ = true;
+ scorll_bar_width_ = GetScrollWidth();
CalcSize();
}
FWL_WidgetHit CFWL_ListBox::HitTest(const CFX_PointF& point) {
if (IsShowHorzScrollBar()) {
- CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect();
+ CFX_RectF rect = horz_scroll_bar_->GetWidgetRect();
if (rect.Contains(point))
return FWL_WidgetHit::HScrollBar;
}
if (IsShowVertScrollBar()) {
- CFX_RectF rect = m_pVertScrollBar->GetWidgetRect();
+ CFX_RectF rect = vert_scroll_bar_->GetWidgetRect();
if (rect.Contains(point))
return FWL_WidgetHit::VScrollBar;
}
- if (m_ClientRect.Contains(point))
+ if (client_rect_.Contains(point)) {
return FWL_WidgetHit::Client;
+ }
return FWL_WidgetHit::Unknown;
}
@@ -96,15 +97,16 @@
if (HasBorder())
DrawBorder(pGraphics, CFWL_ThemePart::Part::kBorder, matrix);
- CFX_RectF rtClip(m_ContentRect);
+ CFX_RectF rtClip(content_rect_);
if (IsShowHorzScrollBar())
- rtClip.height -= m_fScorllBarWidth;
+ rtClip.height -= scorll_bar_width_;
if (IsShowVertScrollBar())
- rtClip.width -= m_fScorllBarWidth;
+ rtClip.width -= scorll_bar_width_;
pGraphics->SetClipRect(matrix.TransformRect(rtClip));
- if ((m_Properties.m_dwStyles & FWL_STYLE_WGT_NoBackground) == 0)
+ if ((properties_.styles_ & FWL_STYLE_WGT_NoBackground) == 0) {
DrawBkground(pGraphics, matrix);
+ }
DrawItems(pGraphics, matrix);
}
@@ -211,7 +213,7 @@
}
bool CFWL_ListBox::IsMultiSelection() const {
- return m_Properties.m_dwStyleExts & FWL_STYLEEXT_LTB_MultiSelection;
+ return properties_.style_exts_ & FWL_STYLEEXT_LTB_MultiSelection;
}
void CFWL_ListBox::ClearSelection() {
@@ -266,14 +268,16 @@
}
CFWL_ListBox::Item* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) {
- CFX_PointF pos = point - m_ContentRect.TopLeft();
+ CFX_PointF pos = point - content_rect_.TopLeft();
float fPosX = 0.0f;
- if (m_pHorzScrollBar)
- fPosX = m_pHorzScrollBar->GetPos();
+ if (horz_scroll_bar_) {
+ fPosX = horz_scroll_bar_->GetPos();
+ }
float fPosY = 0.0;
- if (m_pVertScrollBar)
- fPosY = m_pVertScrollBar->GetPos();
+ if (vert_scroll_bar_) {
+ fPosY = vert_scroll_bar_->GetPos();
+ }
int32_t nCount = CountItems(this);
for (int32_t i = 0; i < nCount; i++) {
@@ -290,26 +294,27 @@
}
bool CFWL_ListBox::ScrollToVisible(Item* pItem) {
- if (!m_pVertScrollBar)
+ if (!vert_scroll_bar_) {
return false;
+ }
CFX_RectF rtItem = pItem ? pItem->GetRect() : CFX_RectF();
bool bScroll = false;
- float fPosY = m_pVertScrollBar->GetPos();
- rtItem.Offset(0, -fPosY + m_ContentRect.top);
- if (rtItem.top < m_ContentRect.top) {
- fPosY += rtItem.top - m_ContentRect.top;
+ float fPosY = vert_scroll_bar_->GetPos();
+ rtItem.Offset(0, -fPosY + content_rect_.top);
+ if (rtItem.top < content_rect_.top) {
+ fPosY += rtItem.top - content_rect_.top;
bScroll = true;
- } else if (rtItem.bottom() > m_ContentRect.bottom()) {
- fPosY += rtItem.bottom() - m_ContentRect.bottom();
+ } else if (rtItem.bottom() > content_rect_.bottom()) {
+ fPosY += rtItem.bottom() - content_rect_.bottom();
bScroll = true;
}
if (!bScroll)
return false;
- m_pVertScrollBar->SetPos(fPosY);
- m_pVertScrollBar->SetTrackPos(fPosY);
- RepaintRect(m_ClientRect);
+ vert_scroll_bar_->SetPos(fPosY);
+ vert_scroll_bar_->SetTrackPos(fPosY);
+ RepaintRect(client_rect_);
return true;
}
@@ -320,30 +325,34 @@
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_ClientRect;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = client_rect_;
if (IsShowHorzScrollBar() && IsShowVertScrollBar())
- param.m_pRtData = &m_StaticRect;
+ param.data_rect_ = &static_rect_;
if (!IsEnabled())
- param.m_dwStates = CFWL_PartState::kDisabled;
+ param.states_ = CFWL_PartState::kDisabled;
GetThemeProvider()->DrawBackground(param);
}
void CFWL_ListBox::DrawItems(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
float fPosX = 0.0f;
- if (m_pHorzScrollBar)
- fPosX = m_pHorzScrollBar->GetPos();
+ if (horz_scroll_bar_) {
+ fPosX = horz_scroll_bar_->GetPos();
+ }
float fPosY = 0.0f;
- if (m_pVertScrollBar)
- fPosY = m_pVertScrollBar->GetPos();
+ if (vert_scroll_bar_) {
+ fPosY = vert_scroll_bar_->GetPos();
+ }
- CFX_RectF rtView(m_ContentRect);
- if (m_pHorzScrollBar)
- rtView.height -= m_fScorllBarWidth;
- if (m_pVertScrollBar)
- rtView.width -= m_fScorllBarWidth;
+ CFX_RectF rtView(content_rect_);
+ if (horz_scroll_bar_) {
+ rtView.height -= scorll_bar_width_;
+ }
+ if (vert_scroll_bar_) {
+ rtView.width -= scorll_bar_width_;
+ }
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
@@ -352,11 +361,13 @@
continue;
CFX_RectF rtItem = pItem->GetRect();
- rtItem.Offset(m_ContentRect.left - fPosX, m_ContentRect.top - fPosY);
- if (rtItem.bottom() < m_ContentRect.top)
+ rtItem.Offset(content_rect_.left - fPosX, content_rect_.top - fPosY);
+ if (rtItem.bottom() < content_rect_.top) {
continue;
- if (rtItem.top >= m_ContentRect.bottom())
+ }
+ if (rtItem.top >= content_rect_.bottom()) {
break;
+ }
DrawItem(pGraphics, pItem, i, rtItem, mtMatrix);
}
}
@@ -367,12 +378,13 @@
const CFX_RectF& rtItem,
const CFX_Matrix& mtMatrix) {
Mask<CFWL_PartState> dwPartStates = CFWL_PartState::kNormal;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
dwPartStates = CFWL_PartState::kDisabled;
- else if (pItem && pItem->IsSelected())
+ } else if (pItem && pItem->IsSelected()) {
dwPartStates = CFWL_PartState::kSelected;
+ }
- if ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) && pItem &&
+ if ((properties_.states_ & FWL_STATE_WGT_Focused) && pItem &&
pItem->IsFocused()) {
dwPartStates |= CFWL_PartState::kFocused;
}
@@ -380,16 +392,16 @@
CFX_RectF rtFocus(rtItem); // Must outlive |bg_param|.
CFWL_ThemeBackground bg_param(CFWL_ThemePart::Part::kListItem, this,
pGraphics);
- bg_param.m_dwStates = dwPartStates;
- bg_param.m_matrix = mtMatrix;
- bg_param.m_PartRect = rtItem;
- bg_param.m_bMaximize = true;
- bg_param.m_pRtData = &rtFocus;
- if (m_pVertScrollBar && !m_pHorzScrollBar &&
+ bg_param.states_ = dwPartStates;
+ bg_param.matrix_ = mtMatrix;
+ bg_param.part_rect_ = rtItem;
+ bg_param.maximize_ = true;
+ bg_param.data_rect_ = &rtFocus;
+ if (vert_scroll_bar_ && !horz_scroll_bar_ &&
(dwPartStates & CFWL_PartState::kFocused)) {
- bg_param.m_PartRect.left += 1;
- bg_param.m_PartRect.width -= (m_fScorllBarWidth + 1);
- rtFocus.Deflate(0.5, 0.5, 1 + m_fScorllBarWidth, 1);
+ bg_param.part_rect_.left += 1;
+ bg_param.part_rect_.width -= (scorll_bar_width_ + 1);
+ rtFocus.Deflate(0.5, 0.5, 1 + scorll_bar_width_, 1);
}
IFWL_ThemeProvider* pTheme = GetThemeProvider();
@@ -405,113 +417,114 @@
rtText.Deflate(kItemTextMargin, kItemTextMargin);
CFWL_ThemeText textParam(CFWL_ThemePart::Part::kListItem, this, pGraphics);
- textParam.m_dwStates = dwPartStates;
- textParam.m_matrix = mtMatrix;
- textParam.m_PartRect = rtText;
- textParam.m_wsText = std::move(wsText);
- textParam.m_dwTTOStyles = m_TTOStyles;
- textParam.m_iTTOAlign = m_iTTOAligns;
- textParam.m_bMaximize = true;
+ textParam.states_ = dwPartStates;
+ textParam.matrix_ = mtMatrix;
+ textParam.part_rect_ = rtText;
+ textParam.text_ = std::move(wsText);
+ textParam.tto_styles_ = tto_styles_;
+ textParam.tto_align_ = ttoaligns_;
+ textParam.maximize_ = true;
pTheme->DrawText(textParam);
}
CFX_SizeF CFWL_ListBox::CalcSize() {
- m_ClientRect = GetClientRect();
- m_ContentRect = m_ClientRect;
+ client_rect_ = GetClientRect();
+ content_rect_ = client_rect_;
CFX_RectF rtUIMargin;
if (!GetOuter()) {
CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
CFX_RectF pUIMargin = GetThemeProvider()->GetUIMargin(part);
- m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
+ content_rect_.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
}
float fWidth = GetMaxTextWidth();
fWidth += 2 * kItemTextMargin;
- float fActualWidth = m_ClientRect.width - rtUIMargin.left - rtUIMargin.width;
+ float fActualWidth = client_rect_.width - rtUIMargin.left - rtUIMargin.width;
fWidth = std::max(fWidth, fActualWidth);
- m_fItemHeight = CalcItemHeight();
+ item_height_ = CalcItemHeight();
int32_t iCount = CountItems(this);
CFX_SizeF fs;
for (int32_t i = 0; i < iCount; i++) {
Item* htem = GetItem(this, i);
- UpdateItemSize(htem, fs, fWidth, m_fItemHeight);
+ UpdateItemSize(htem, fs, fWidth, item_height_);
}
- float iHeight = m_ClientRect.height;
+ float iHeight = client_rect_.height;
bool bShowVertScr = false;
bool bShowHorzScr = false;
- if (!bShowVertScr && (m_Properties.m_dwStyles & FWL_STYLE_WGT_VScroll))
+ if (!bShowVertScr && (properties_.styles_ & FWL_STYLE_WGT_VScroll)) {
bShowVertScr = (fs.height > iHeight);
+ }
float fMax = 0.0f;
if (bShowVertScr) {
- if (!m_pVertScrollBar)
+ if (!vert_scroll_bar_) {
InitVerticalScrollBar();
-
- CFX_RectF rtScrollBar(m_ClientRect.right() - m_fScorllBarWidth,
- m_ClientRect.top, m_fScorllBarWidth,
- m_ClientRect.height - 1);
- if (bShowHorzScr)
- rtScrollBar.height -= m_fScorllBarWidth;
-
- m_pVertScrollBar->SetWidgetRect(rtScrollBar);
- fMax = std::max(fs.height - m_ContentRect.height, m_fItemHeight);
-
- m_pVertScrollBar->SetRange(0.0f, fMax);
- m_pVertScrollBar->SetPageSize(rtScrollBar.height * 9 / 10);
- m_pVertScrollBar->SetStepSize(m_fItemHeight);
-
- float fPos = std::clamp(m_pVertScrollBar->GetPos(), 0.0f, fMax);
- m_pVertScrollBar->SetPos(fPos);
- m_pVertScrollBar->SetTrackPos(fPos);
- if ((m_Properties.m_dwStyleExts & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
- 0 ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)) {
- m_pVertScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
}
- m_pVertScrollBar->Update();
- } else if (m_pVertScrollBar) {
- m_pVertScrollBar->SetPos(0);
- m_pVertScrollBar->SetTrackPos(0);
- m_pVertScrollBar->SetStates(FWL_STATE_WGT_Invisible);
+
+ CFX_RectF rtScrollBar(client_rect_.right() - scorll_bar_width_,
+ client_rect_.top, scorll_bar_width_,
+ client_rect_.height - 1);
+ if (bShowHorzScr)
+ rtScrollBar.height -= scorll_bar_width_;
+
+ vert_scroll_bar_->SetWidgetRect(rtScrollBar);
+ fMax = std::max(fs.height - content_rect_.height, item_height_);
+
+ vert_scroll_bar_->SetRange(0.0f, fMax);
+ vert_scroll_bar_->SetPageSize(rtScrollBar.height * 9 / 10);
+ vert_scroll_bar_->SetStepSize(item_height_);
+
+ float fPos = std::clamp(vert_scroll_bar_->GetPos(), 0.0f, fMax);
+ vert_scroll_bar_->SetPos(fPos);
+ vert_scroll_bar_->SetTrackPos(fPos);
+ if ((properties_.style_exts_ & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == 0 ||
+ (properties_.states_ & FWL_STATE_WGT_Focused)) {
+ vert_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ }
+ vert_scroll_bar_->Update();
+ } else if (vert_scroll_bar_) {
+ vert_scroll_bar_->SetPos(0);
+ vert_scroll_bar_->SetTrackPos(0);
+ vert_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
}
if (bShowHorzScr) {
- if (!m_pHorzScrollBar)
+ if (!horz_scroll_bar_) {
InitHorizontalScrollBar();
-
- CFX_RectF rtScrollBar(m_ClientRect.left,
- m_ClientRect.bottom() - m_fScorllBarWidth,
- m_ClientRect.width, m_fScorllBarWidth);
- if (bShowVertScr)
- rtScrollBar.width -= m_fScorllBarWidth;
-
- m_pHorzScrollBar->SetWidgetRect(rtScrollBar);
- fMax = fs.width - rtScrollBar.width;
- m_pHorzScrollBar->SetRange(0.0f, fMax);
- m_pHorzScrollBar->SetPageSize(fWidth * 9 / 10);
- m_pHorzScrollBar->SetStepSize(fWidth / 10);
-
- float fPos = std::clamp(m_pHorzScrollBar->GetPos(), 0.0f, fMax);
- m_pHorzScrollBar->SetPos(fPos);
- m_pHorzScrollBar->SetTrackPos(fPos);
- if ((m_Properties.m_dwStyleExts & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
- 0 ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)) {
- m_pHorzScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
}
- m_pHorzScrollBar->Update();
- } else if (m_pHorzScrollBar) {
- m_pHorzScrollBar->SetPos(0);
- m_pHorzScrollBar->SetTrackPos(0);
- m_pHorzScrollBar->SetStates(FWL_STATE_WGT_Invisible);
+
+ CFX_RectF rtScrollBar(client_rect_.left,
+ client_rect_.bottom() - scorll_bar_width_,
+ client_rect_.width, scorll_bar_width_);
+ if (bShowVertScr)
+ rtScrollBar.width -= scorll_bar_width_;
+
+ horz_scroll_bar_->SetWidgetRect(rtScrollBar);
+ fMax = fs.width - rtScrollBar.width;
+ horz_scroll_bar_->SetRange(0.0f, fMax);
+ horz_scroll_bar_->SetPageSize(fWidth * 9 / 10);
+ horz_scroll_bar_->SetStepSize(fWidth / 10);
+
+ float fPos = std::clamp(horz_scroll_bar_->GetPos(), 0.0f, fMax);
+ horz_scroll_bar_->SetPos(fPos);
+ horz_scroll_bar_->SetTrackPos(fPos);
+ if ((properties_.style_exts_ & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == 0 ||
+ (properties_.states_ & FWL_STATE_WGT_Focused)) {
+ horz_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ }
+ horz_scroll_bar_->Update();
+ } else if (horz_scroll_bar_) {
+ horz_scroll_bar_->SetPos(0);
+ horz_scroll_bar_->SetTrackPos(0);
+ horz_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
}
if (bShowVertScr && bShowHorzScr) {
- m_StaticRect = CFX_RectF(m_ClientRect.right() - m_fScorllBarWidth,
- m_ClientRect.bottom() - m_fScorllBarWidth,
- m_fScorllBarWidth, m_fScorllBarWidth);
+ static_rect_ = CFX_RectF(client_rect_.right() - scorll_bar_width_,
+ client_rect_.bottom() - scorll_bar_width_,
+ scorll_bar_width_, scorll_bar_width_);
}
return fs;
}
@@ -552,36 +565,38 @@
}
void CFWL_ListBox::InitVerticalScrollBar() {
- if (m_pVertScrollBar)
+ if (vert_scroll_bar_) {
return;
+ }
- m_pVertScrollBar = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
+ vert_scroll_bar_ = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp(),
Properties{0, FWL_STYLEEXT_SCB_Vert, FWL_STATE_WGT_Invisible}, this);
}
void CFWL_ListBox::InitHorizontalScrollBar() {
- if (m_pHorzScrollBar)
+ if (horz_scroll_bar_) {
return;
+ }
- m_pHorzScrollBar = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
+ horz_scroll_bar_ = cppgc::MakeGarbageCollected<CFWL_ScrollBar>(
GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp(),
Properties{0, FWL_STYLEEXT_SCB_Horz, FWL_STATE_WGT_Invisible}, this);
}
bool CFWL_ListBox::IsShowVertScrollBar() const {
- return m_pVertScrollBar && m_pVertScrollBar->IsVisible() &&
+ return vert_scroll_bar_ && vert_scroll_bar_->IsVisible() &&
ScrollBarPropertiesPresent();
}
bool CFWL_ListBox::IsShowHorzScrollBar() const {
- return m_pHorzScrollBar && m_pHorzScrollBar->IsVisible() &&
+ return horz_scroll_bar_ && horz_scroll_bar_->IsVisible() &&
ScrollBarPropertiesPresent();
}
bool CFWL_ListBox::ScrollBarPropertiesPresent() const {
- return !(m_Properties.m_dwStyleExts & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ||
- (m_Properties.m_dwStates & FWL_STATE_WGT_Focused);
+ return !(properties_.style_exts_ & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ||
+ (properties_.states_ & FWL_STATE_WGT_Focused);
}
void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) {
@@ -597,7 +612,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
@@ -614,8 +629,9 @@
break;
case CFWL_Message::Type::kKey: {
CFWL_MessageKey* pMsg = static_cast<CFWL_MessageKey*>(pMessage);
- if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown)
+ if (pMsg->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
OnKeyDown(pMsg);
+ }
break;
}
}
@@ -631,8 +647,8 @@
return;
CFWL_Widget* pSrcTarget = pEvent->GetSrcTarget();
- if ((pSrcTarget == m_pVertScrollBar && m_pVertScrollBar) ||
- (pSrcTarget == m_pHorzScrollBar && m_pHorzScrollBar)) {
+ if ((pSrcTarget == vert_scroll_bar_ && vert_scroll_bar_) ||
+ (pSrcTarget == horz_scroll_bar_ && horz_scroll_bar_)) {
CFWL_EventScroll* pScrollEvent = static_cast<CFWL_EventScroll*>(pEvent);
OnScroll(static_cast<CFWL_ScrollBar*>(pSrcTarget),
pScrollEvent->GetScrollCode(), pScrollEvent->GetPos());
@@ -646,45 +662,50 @@
void CFWL_ListBox::OnFocusGained() {
if (GetStyleExts() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) {
- if (m_pVertScrollBar)
- m_pVertScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
- if (m_pHorzScrollBar)
- m_pHorzScrollBar->RemoveStates(FWL_STATE_WGT_Invisible);
+ if (vert_scroll_bar_) {
+ vert_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ }
+ if (horz_scroll_bar_) {
+ horz_scroll_bar_->RemoveStates(FWL_STATE_WGT_Invisible);
+ }
}
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_ListBox::OnFocusLost() {
if (GetStyleExts() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) {
- if (m_pVertScrollBar)
- m_pVertScrollBar->SetStates(FWL_STATE_WGT_Invisible);
- if (m_pHorzScrollBar)
- m_pHorzScrollBar->SetStates(FWL_STATE_WGT_Invisible);
+ if (vert_scroll_bar_) {
+ vert_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
+ }
+ if (horz_scroll_bar_) {
+ horz_scroll_bar_->SetStates(FWL_STATE_WGT_Invisible);
+ }
}
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
- m_bLButtonDown = true;
+ lbutton_down_ = true;
- Item* pItem = GetItemAtPoint(pMsg->m_pos);
+ Item* pItem = GetItemAtPoint(pMsg->pos_);
if (!pItem)
return;
if (IsMultiSelection()) {
- if (pMsg->m_dwFlags & XFA_FWL_KeyFlag::kCtrl) {
+ if (pMsg->flags_ & XFA_FWL_KeyFlag::kCtrl) {
pItem->SetSelected(!pItem->IsSelected());
- m_hAnchor = pItem;
- } else if (pMsg->m_dwFlags & XFA_FWL_KeyFlag::kShift) {
- if (m_hAnchor)
- SetSelection(m_hAnchor, pItem, true);
- else
+ h_anchor_ = pItem;
+ } else if (pMsg->flags_ & XFA_FWL_KeyFlag::kShift) {
+ if (h_anchor_) {
+ SetSelection(h_anchor_, pItem, true);
+ } else {
pItem->SetSelected(true);
+ }
} else {
SetSelection(pItem, pItem, true);
- m_hAnchor = pItem;
+ h_anchor_ = pItem;
}
} else {
SetSelection(pItem, pItem, true);
@@ -693,24 +714,25 @@
SetFocusItem(pItem);
ScrollToVisible(pItem);
SetGrab(true);
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
void CFWL_ListBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- if (!m_bLButtonDown)
+ if (!lbutton_down_) {
return;
+ }
- m_bLButtonDown = false;
+ lbutton_down_ = false;
SetGrab(false);
}
void CFWL_ListBox::OnMouseWheel(CFWL_MessageMouseWheel* pMsg) {
if (IsShowVertScrollBar())
- m_pVertScrollBar->GetDelegate()->OnProcessMessage(pMsg);
+ vert_scroll_bar_->GetDelegate()->OnProcessMessage(pMsg);
}
void CFWL_ListBox::OnKeyDown(CFWL_MessageKey* pMsg) {
- auto dwKeyCode = static_cast<XFA_FWL_VKEYCODE>(pMsg->m_dwKeyCodeOrChar);
+ auto dwKeyCode = static_cast<XFA_FWL_VKEYCODE>(pMsg->key_code_or_char_);
switch (dwKeyCode) {
case XFA_FWL_VKEY_Tab:
case XFA_FWL_VKEY_Up:
@@ -718,8 +740,8 @@
case XFA_FWL_VKEY_Home:
case XFA_FWL_VKEY_End: {
Item* pItem = GetListItem(GetFocusedItem(), dwKeyCode);
- bool bShift = !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kShift);
- bool bCtrl = !!(pMsg->m_dwFlags & XFA_FWL_KeyFlag::kCtrl);
+ bool bShift = !!(pMsg->flags_ & XFA_FWL_KeyFlag::kShift);
+ bool bCtrl = !!(pMsg->flags_ & XFA_FWL_KeyFlag::kCtrl);
OnVK(pItem, bShift, bCtrl);
break;
}
@@ -736,13 +758,14 @@
if (bCtrl) {
// Do nothing.
} else if (bShift) {
- if (m_hAnchor)
- SetSelection(m_hAnchor, pItem, true);
- else
+ if (h_anchor_) {
+ SetSelection(h_anchor_, pItem, true);
+ } else {
pItem->SetSelected(true);
+ }
} else {
SetSelection(pItem, pItem, true);
- m_hAnchor = pItem;
+ h_anchor_ = pItem;
}
} else {
SetSelection(pItem, pItem, true);
@@ -750,7 +773,7 @@
SetFocusItem(pItem);
ScrollToVisible(pItem);
- RepaintRect(CFX_RectF(0, 0, m_WidgetRect.width, m_WidgetRect.height));
+ RepaintRect(CFX_RectF(0, 0, widget_rect_.width, widget_rect_.height));
}
bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar,
@@ -804,47 +827,49 @@
if (iCurPos != fPos) {
pScrollBar->SetPos(fPos);
pScrollBar->SetTrackPos(fPos);
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
return true;
}
int32_t CFWL_ListBox::CountItems(const CFWL_Widget* pWidget) const {
- return fxcrt::CollectionSize<int32_t>(m_ItemArray);
+ return fxcrt::CollectionSize<int32_t>(item_array_);
}
CFWL_ListBox::Item* CFWL_ListBox::GetItem(const CFWL_Widget* pWidget,
int32_t nIndex) const {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return nullptr;
- return m_ItemArray[nIndex].get();
+ return item_array_[nIndex].get();
}
int32_t CFWL_ListBox::GetItemIndex(CFWL_Widget* pWidget, Item* pItem) {
- auto it = std::find_if(m_ItemArray.begin(), m_ItemArray.end(),
+ auto it = std::find_if(item_array_.begin(), item_array_.end(),
[pItem](const std::unique_ptr<Item>& candidate) {
return candidate.get() == pItem;
});
- return it != m_ItemArray.end()
- ? checked_cast<int32_t>(it - m_ItemArray.begin())
+ return it != item_array_.end()
+ ? checked_cast<int32_t>(it - item_array_.begin())
: -1;
}
CFWL_ListBox::Item* CFWL_ListBox::AddString(const WideString& wsAdd) {
- m_ItemArray.push_back(std::make_unique<Item>(wsAdd));
- return m_ItemArray.back().get();
+ item_array_.push_back(std::make_unique<Item>(wsAdd));
+ return item_array_.back().get();
}
void CFWL_ListBox::RemoveAt(int32_t iIndex) {
- if (iIndex < 0 || static_cast<size_t>(iIndex) >= m_ItemArray.size())
+ if (iIndex < 0 || static_cast<size_t>(iIndex) >= item_array_.size()) {
return;
- m_ItemArray.erase(m_ItemArray.begin() + iIndex);
+ }
+ item_array_.erase(item_array_.begin() + iIndex);
}
void CFWL_ListBox::DeleteString(Item* pItem) {
int32_t nIndex = GetItemIndex(this, pItem);
- if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
+ if (nIndex < 0 || static_cast<size_t>(nIndex) >= item_array_.size()) {
return;
+ }
int32_t iSel = nIndex + 1;
if (iSel >= CountItems(this))
@@ -854,14 +879,14 @@
if (item)
item->SetSelected(true);
}
- m_ItemArray.erase(m_ItemArray.begin() + nIndex);
+ item_array_.erase(item_array_.begin() + nIndex);
}
void CFWL_ListBox::DeleteAll() {
- m_ItemArray.clear();
+ item_array_.clear();
}
-CFWL_ListBox::Item::Item(const WideString& text) : m_wsText(text) {}
+CFWL_ListBox::Item::Item(const WideString& text) : text_(text) {}
CFWL_ListBox::Item::~Item() = default;
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 9d8aa17..e4c21bf 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -36,19 +36,19 @@
explicit Item(const WideString& text);
~Item();
- bool IsSelected() const { return m_bIsSelected; }
- void SetSelected(bool enable) { m_bIsSelected = enable; }
- bool IsFocused() const { return m_bIsFocused; }
- void SetFocused(bool enable) { m_bIsFocused = enable; }
- CFX_RectF GetRect() const { return m_ItemRect; }
- void SetRect(const CFX_RectF& rect) { m_ItemRect = rect; }
- WideString GetText() const { return m_wsText; }
+ bool IsSelected() const { return is_selected_; }
+ void SetSelected(bool enable) { is_selected_ = enable; }
+ bool IsFocused() const { return is_focused_; }
+ void SetFocused(bool enable) { is_focused_ = enable; }
+ CFX_RectF GetRect() const { return item_rect_; }
+ void SetRect(const CFX_RectF& rect) { item_rect_ = rect; }
+ WideString GetText() const { return text_; }
private:
- bool m_bIsSelected = false;
- bool m_bIsFocused = false;
- CFX_RectF m_ItemRect;
- const WideString m_wsText;
+ bool is_selected_ = false;
+ bool is_focused_ = false;
+ CFX_RectF item_rect_;
+ const WideString text_;
};
CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
@@ -93,8 +93,8 @@
bool IsShowVertScrollBar() const;
bool IsShowHorzScrollBar() const;
bool ScrollBarPropertiesPresent() const;
- CFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar; }
- const CFX_RectF& GetRTClient() const { return m_ClientRect; }
+ CFWL_ScrollBar* GetVertScrollBar() const { return vert_scroll_bar_; }
+ const CFX_RectF& GetRTClient() const { return client_rect_; }
private:
bool IsMultiSelection() const;
@@ -129,18 +129,18 @@
CFWL_EventScroll::Code dwCode,
float fPos);
- CFX_RectF m_ClientRect;
- CFX_RectF m_StaticRect;
- CFX_RectF m_ContentRect;
- cppgc::Member<CFWL_ScrollBar> m_pHorzScrollBar;
- cppgc::Member<CFWL_ScrollBar> m_pVertScrollBar;
- FDE_TextStyle m_TTOStyles;
- FDE_TextAlignment m_iTTOAligns = FDE_TextAlignment::kTopLeft;
- bool m_bLButtonDown = false;
- float m_fItemHeight = 0.0f;
- float m_fScorllBarWidth = 0.0f;
- std::vector<std::unique_ptr<Item>> m_ItemArray; // Must outlive `m_hAnchor`.
- UnownedPtr<Item> m_hAnchor;
+ CFX_RectF client_rect_;
+ CFX_RectF static_rect_;
+ CFX_RectF content_rect_;
+ cppgc::Member<CFWL_ScrollBar> horz_scroll_bar_;
+ cppgc::Member<CFWL_ScrollBar> vert_scroll_bar_;
+ FDE_TextStyle tto_styles_;
+ FDE_TextAlignment ttoaligns_ = FDE_TextAlignment::kTopLeft;
+ bool lbutton_down_ = false;
+ float item_height_ = 0.0f;
+ float scorll_bar_width_ = 0.0f;
+ std::vector<std::unique_ptr<Item>> item_array_; // Must outlive `h_anchor_`.
+ UnownedPtr<Item> h_anchor_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_message.cpp b/xfa/fwl/cfwl_message.cpp
index a7f78ac..e301e1b 100644
--- a/xfa/fwl/cfwl_message.cpp
+++ b/xfa/fwl/cfwl_message.cpp
@@ -9,7 +9,7 @@
namespace pdfium {
CFWL_Message::CFWL_Message(Type type, CFWL_Widget* pDstTarget)
- : m_type(type), m_pDstTarget(pDstTarget) {}
+ : type_(type), dst_target_(pDstTarget) {}
CFWL_Message::~CFWL_Message() = default;
diff --git a/xfa/fwl/cfwl_message.h b/xfa/fwl/cfwl_message.h
index aa8e198..bd0a9cc 100644
--- a/xfa/fwl/cfwl_message.h
+++ b/xfa/fwl/cfwl_message.h
@@ -23,9 +23,9 @@
virtual ~CFWL_Message();
- Type GetType() const { return m_type; }
- CFWL_Widget* GetDstTarget() const { return m_pDstTarget; }
- void SetDstTarget(CFWL_Widget* pWidget) { m_pDstTarget = pWidget; }
+ Type GetType() const { return type_; }
+ CFWL_Widget* GetDstTarget() const { return dst_target_; }
+ void SetDstTarget(CFWL_Widget* pWidget) { dst_target_ = pWidget; }
protected:
CFWL_Message(Type type, CFWL_Widget* pDstTarget);
@@ -33,8 +33,8 @@
CFWL_Message& operator=(const CFWL_Message& that) = delete;
private:
- const Type m_type;
- UnownedPtr<CFWL_Widget> m_pDstTarget;
+ const Type type_;
+ UnownedPtr<CFWL_Widget> dst_target_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_messagekey.cpp b/xfa/fwl/cfwl_messagekey.cpp
index 65b67df..be2b3c5 100644
--- a/xfa/fwl/cfwl_messagekey.cpp
+++ b/xfa/fwl/cfwl_messagekey.cpp
@@ -13,9 +13,9 @@
Mask<XFA_FWL_KeyFlag> flags,
uint32_t dwKeyCodeOrChar)
: CFWL_Message(CFWL_Message::Type::kKey, pDstTarget),
- m_dwCmd(cmd),
- m_dwFlags(flags),
- m_dwKeyCodeOrChar(dwKeyCodeOrChar) {}
+ cmd_(cmd),
+ flags_(flags),
+ key_code_or_char_(dwKeyCodeOrChar) {}
CFWL_MessageKey::~CFWL_MessageKey() = default;
diff --git a/xfa/fwl/cfwl_messagekey.h b/xfa/fwl/cfwl_messagekey.h
index 20004a1..5bb353e 100644
--- a/xfa/fwl/cfwl_messagekey.h
+++ b/xfa/fwl/cfwl_messagekey.h
@@ -23,9 +23,9 @@
uint32_t dwKeyCodeOrChar);
~CFWL_MessageKey() override;
- const KeyCommand m_dwCmd;
- const Mask<XFA_FWL_KeyFlag> m_dwFlags;
- const uint32_t m_dwKeyCodeOrChar;
+ const KeyCommand cmd_;
+ const Mask<XFA_FWL_KeyFlag> flags_;
+ const uint32_t key_code_or_char_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_messagekillfocus.h b/xfa/fwl/cfwl_messagekillfocus.h
index 7e1eaf1..dfe24f8 100644
--- a/xfa/fwl/cfwl_messagekillfocus.h
+++ b/xfa/fwl/cfwl_messagekillfocus.h
@@ -18,11 +18,11 @@
~CFWL_MessageKillFocus() override;
bool IsFocusedOnWidget(const CFWL_Widget* pWidget) const {
- return pWidget == m_pSetFocus;
+ return pWidget == set_focus_;
}
private:
- UnownedPtr<CFWL_Widget> m_pSetFocus; // Ok, stack-only.
+ UnownedPtr<CFWL_Widget> set_focus_; // Ok, stack-only.
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_messagemouse.cpp b/xfa/fwl/cfwl_messagemouse.cpp
index 1095256..5557d8b 100644
--- a/xfa/fwl/cfwl_messagemouse.cpp
+++ b/xfa/fwl/cfwl_messagemouse.cpp
@@ -13,9 +13,9 @@
Mask<XFA_FWL_KeyFlag> flags,
CFX_PointF pos)
: CFWL_Message(CFWL_Message::Type::kMouse, pDstTarget),
- m_dwCmd(cmd),
- m_dwFlags(flags),
- m_pos(pos) {}
+ cmd_(cmd),
+ flags_(flags),
+ pos_(pos) {}
CFWL_MessageMouse::~CFWL_MessageMouse() = default;
diff --git a/xfa/fwl/cfwl_messagemouse.h b/xfa/fwl/cfwl_messagemouse.h
index fd3383b..8ad3a27 100644
--- a/xfa/fwl/cfwl_messagemouse.h
+++ b/xfa/fwl/cfwl_messagemouse.h
@@ -35,9 +35,9 @@
CFX_PointF pos);
~CFWL_MessageMouse() override;
- const MouseCommand m_dwCmd;
- Mask<XFA_FWL_KeyFlag> m_dwFlags;
- CFX_PointF m_pos;
+ const MouseCommand cmd_;
+ Mask<XFA_FWL_KeyFlag> flags_;
+ CFX_PointF pos_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index ed40d9a..67ea50e 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -111,9 +111,9 @@
if (IsLocked())
return;
- if (!m_bInitialized) {
+ if (!initialized_) {
InitDate();
- m_bInitialized = true;
+ initialized_ = true;
}
ClearDateItem();
ResetDateItem();
@@ -153,47 +153,47 @@
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- params.m_PartRect = m_ClientRect;
- params.m_matrix = mtMatrix;
+ params.part_rect_ = client_rect_;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawHeadBK(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kHeader, this, pGraphics);
- params.m_PartRect = m_HeadRect;
- params.m_matrix = mtMatrix;
+ params.part_rect_ = head_rect_;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawLButton(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kLBtn, this, pGraphics);
- params.m_dwStates = m_iLBtnPartStates;
- params.m_PartRect = m_LBtnRect;
- params.m_matrix = mtMatrix;
+ params.states_ = lbtn_part_states_;
+ params.part_rect_ = lbtn_rect_;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawRButton(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kRBtn, this, pGraphics);
- params.m_dwStates = m_iRBtnPartStates;
- params.m_PartRect = m_RBtnRect;
- params.m_matrix = mtMatrix;
+ params.states_ = rbtn_part_states_;
+ params.part_rect_ = rbtn_rect_;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawCaption(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeText textParam(CFWL_ThemePart::Part::kCaption, this, pGraphics);
- textParam.m_wsText = GetHeadText(m_iCurYear, m_iCurMonth);
- m_HeadSize = CalcTextSize(textParam.m_wsText, false);
+ textParam.text_ = GetHeadText(cur_year_, cur_month_);
+ head_size_ = CalcTextSize(textParam.text_, false);
CalcHeadSize();
- textParam.m_PartRect = m_HeadTextRect;
- textParam.m_dwTTOStyles.single_line_ = true;
- textParam.m_iTTOAlign = FDE_TextAlignment::kCenter;
- textParam.m_matrix = mtMatrix;
+ textParam.part_rect_ = head_text_rect_;
+ textParam.tto_styles_.single_line_ = true;
+ textParam.tto_align_ = FDE_TextAlignment::kCenter;
+ textParam.matrix_ = mtMatrix;
GetThemeProvider()->DrawText(textParam);
}
@@ -201,53 +201,53 @@
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kHSeparator, this,
pGraphics);
- params.m_PartRect = m_HSepRect;
- params.m_matrix = mtMatrix;
+ params.part_rect_ = hsep_rect_;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawDatesInBK(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kDateInBK, this, pGraphics);
- params.m_matrix = mtMatrix;
+ params.matrix_ = mtMatrix;
IFWL_ThemeProvider* pTheme = GetThemeProvider();
- int32_t iCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(date_array_);
for (int32_t j = 0; j < iCount; j++) {
- DATEINFO* pDataInfo = m_DateArray[j].get();
+ DATEINFO* pDataInfo = date_array_[j].get();
if (pDataInfo->bSelected) {
- params.m_dwStates |= CFWL_PartState::kSelected;
+ params.states_ |= CFWL_PartState::kSelected;
if (pDataInfo->bFlagged) {
- params.m_dwStates |= CFWL_PartState::kFlagged;
+ params.states_ |= CFWL_PartState::kFlagged;
}
- } else if (j == m_iHovered - 1) {
- params.m_dwStates |= CFWL_PartState::kHovered;
+ } else if (j == hovered_ - 1) {
+ params.states_ |= CFWL_PartState::kHovered;
} else if (pDataInfo->bFlagged) {
- params.m_dwStates = CFWL_PartState::kFlagged;
+ params.states_ = CFWL_PartState::kFlagged;
pTheme->DrawBackground(params);
}
- params.m_PartRect = pDataInfo->rect;
+ params.part_rect_ = pDataInfo->rect;
pTheme->DrawBackground(params);
- params.m_dwStates = CFWL_PartState::kNormal;
+ params.states_ = CFWL_PartState::kNormal;
}
}
void CFWL_MonthCalendar::DrawWeek(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeText params(CFWL_ThemePart::Part::kWeek, this, pGraphics);
- params.m_iTTOAlign = FDE_TextAlignment::kCenter;
- params.m_dwTTOStyles.single_line_ = true;
- params.m_matrix = mtMatrix;
+ params.tto_align_ = FDE_TextAlignment::kCenter;
+ params.tto_styles_.single_line_ = true;
+ params.matrix_ = mtMatrix;
IFWL_ThemeProvider* pTheme = GetThemeProvider();
CFX_RectF rtDayOfWeek;
for (int32_t i = 0; i < 7; ++i) {
rtDayOfWeek = CFX_RectF(
- m_WeekRect.left + i * (m_CellSize.width + kMonthCalHMargin * 2),
- m_WeekRect.top, m_CellSize);
+ week_rect_.left + i * (cell_size_.width + kMonthCalHMargin * 2),
+ week_rect_.top, cell_size_);
- params.m_PartRect = rtDayOfWeek;
- params.m_wsText = GetAbbreviatedDayOfWeek(i);
+ params.part_rect_ = rtDayOfWeek;
+ params.text_ = GetAbbreviatedDayOfWeek(i);
pTheme->DrawText(params);
}
}
@@ -255,33 +255,34 @@
void CFWL_MonthCalendar::DrawToday(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeText params(CFWL_ThemePart::Part::kToday, this, pGraphics);
- params.m_iTTOAlign = FDE_TextAlignment::kCenterLeft;
- params.m_wsText = GetTodayText(m_iYear, m_iMonth, m_iDay);
- m_TodaySize = CalcTextSize(params.m_wsText, false);
+ params.tto_align_ = FDE_TextAlignment::kCenterLeft;
+ params.text_ = GetTodayText(year_, month_, day_);
+ today_size_ = CalcTextSize(params.text_, false);
CalcTodaySize();
- params.m_PartRect = m_TodayRect;
- params.m_dwTTOStyles.single_line_ = true;
- params.m_matrix = mtMatrix;
+ params.part_rect_ = today_rect_;
+ params.tto_styles_.single_line_ = true;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawText(params);
}
void CFWL_MonthCalendar::DrawDatesIn(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeText params(CFWL_ThemePart::Part::kDatesIn, this, pGraphics);
- params.m_iTTOAlign = FDE_TextAlignment::kCenter;
- params.m_matrix = mtMatrix;
+ params.tto_align_ = FDE_TextAlignment::kCenter;
+ params.matrix_ = mtMatrix;
IFWL_ThemeProvider* pTheme = GetThemeProvider();
- int32_t iCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(date_array_);
for (int32_t j = 0; j < iCount; j++) {
- DATEINFO* pDataInfo = m_DateArray[j].get();
- params.m_wsText = pDataInfo->wsDay;
- params.m_PartRect = pDataInfo->rect;
- params.m_dwStates = pDataInfo->AsPartStateMask();
- if (j + 1 == m_iHovered)
- params.m_dwStates |= CFWL_PartState::kHovered;
+ DATEINFO* pDataInfo = date_array_[j].get();
+ params.text_ = pDataInfo->wsDay;
+ params.part_rect_ = pDataInfo->rect;
+ params.states_ = pDataInfo->AsPartStateMask();
+ if (j + 1 == hovered_) {
+ params.states_ |= CFWL_PartState::kHovered;
+ }
- params.m_dwTTOStyles.single_line_ = true;
+ params.tto_styles_.single_line_ = true;
pTheme->DrawText(params);
}
}
@@ -289,27 +290,29 @@
void CFWL_MonthCalendar::DrawDatesOut(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeText params(CFWL_ThemePart::Part::kDatesOut, this, pGraphics);
- params.m_iTTOAlign = FDE_TextAlignment::kCenter;
- params.m_matrix = mtMatrix;
+ params.tto_align_ = FDE_TextAlignment::kCenter;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawText(params);
}
void CFWL_MonthCalendar::DrawDatesInCircle(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
- if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear)
+ if (month_ != cur_month_ || year_ != cur_year_) {
return;
+ }
- if (m_iDay < 1 || m_iDay > fxcrt::CollectionSize<int32_t>(m_DateArray))
+ if (day_ < 1 || day_ > fxcrt::CollectionSize<int32_t>(date_array_)) {
return;
+ }
- DATEINFO* pDate = m_DateArray[m_iDay - 1].get();
+ DATEINFO* pDate = date_array_[day_ - 1].get();
if (!pDate)
return;
CFWL_ThemeBackground params(CFWL_ThemePart::Part::kDateInCircle, this,
pGraphics);
- params.m_PartRect = pDate->rect;
- params.m_matrix = mtMatrix;
+ params.part_rect_ = pDate->rect;
+ params.matrix_ = mtMatrix;
GetThemeProvider()->DrawBackground(params);
}
@@ -328,12 +331,12 @@
fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width;
fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height;
}
- m_CellSize.width =
+ cell_size_.width =
static_cast<int>(0.5 + (fMaxWeekW >= fDayMaxW ? fMaxWeekW : fDayMaxW));
- m_CellSize.height = fMaxWeekH >= fDayMaxH ? fMaxWeekH : fDayMaxH;
+ cell_size_.height = fMaxWeekH >= fDayMaxH ? fMaxWeekH : fDayMaxH;
CFX_SizeF fs;
- fs.width = m_CellSize.width * kMonthCalColumns +
+ fs.width = cell_size_.width * kMonthCalColumns +
kMonthCalHMargin * kMonthCalColumns * 2 +
kMonthCalHeaderBtnHMargin * 2;
@@ -345,72 +348,72 @@
fMonthMaxH = (fMonthMaxH >= sz.height) ? fMonthMaxH : sz.height;
}
- CFX_SizeF szYear = CalcTextSize(GetHeadText(m_iYear, m_iMonth), false);
+ CFX_SizeF szYear = CalcTextSize(GetHeadText(year_, month_), false);
fMonthMaxH = std::max(fMonthMaxH, szYear.height);
- m_HeadSize = CFX_SizeF(fMonthMaxW + szYear.width, fMonthMaxH);
+ head_size_ = CFX_SizeF(fMonthMaxW + szYear.width, fMonthMaxH);
fMonthMaxW =
- m_HeadSize.width + kMonthCalHeaderBtnHMargin * 2 + m_CellSize.width * 2;
+ head_size_.width + kMonthCalHeaderBtnHMargin * 2 + cell_size_.width * 2;
fs.width = std::max(fs.width, fMonthMaxW);
- m_wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay);
- m_TodaySize = CalcTextSize(m_wsToday, false);
- m_TodaySize.height = (m_TodaySize.height >= m_CellSize.height)
- ? m_TodaySize.height
- : m_CellSize.height;
- fs.height = m_CellSize.width + m_CellSize.height * (kMonthCalRows - 2) +
- m_TodaySize.height + kMonthCalVMargin * kMonthCalRows * 2 +
+ today_ = GetTodayText(year_, month_, day_);
+ today_size_ = CalcTextSize(today_, false);
+ today_size_.height = (today_size_.height >= cell_size_.height)
+ ? today_size_.height
+ : cell_size_.height;
+ fs.height = cell_size_.width + cell_size_.height * (kMonthCalRows - 2) +
+ today_size_.height + kMonthCalVMargin * kMonthCalRows * 2 +
kMonthCalHeaderBtnVMargin * 4;
return fs;
}
void CFWL_MonthCalendar::CalcHeadSize() {
- float fHeadHMargin = (m_ClientRect.width - m_HeadSize.width) / 2;
- float fHeadVMargin = (m_CellSize.width - m_HeadSize.height) / 2;
- m_HeadTextRect = CFX_RectF(m_ClientRect.left + fHeadHMargin,
- m_ClientRect.top + kMonthCalHeaderBtnVMargin +
- kMonthCalVMargin + fHeadVMargin,
- m_HeadSize);
+ float fHeadHMargin = (client_rect_.width - head_size_.width) / 2;
+ float fHeadVMargin = (cell_size_.width - head_size_.height) / 2;
+ head_text_rect_ = CFX_RectF(client_rect_.left + fHeadHMargin,
+ client_rect_.top + kMonthCalHeaderBtnVMargin +
+ kMonthCalVMargin + fHeadVMargin,
+ head_size_);
}
void CFWL_MonthCalendar::CalcTodaySize() {
- m_TodayFlagRect = CFX_RectF(
- m_ClientRect.left + kMonthCalHeaderBtnHMargin + kMonthCalHMargin,
- m_DatesRect.bottom() + kMonthCalHeaderBtnVMargin + kMonthCalVMargin,
- m_CellSize.width, m_TodaySize.height);
- m_TodayRect = CFX_RectF(
- m_ClientRect.left + kMonthCalHeaderBtnHMargin + m_CellSize.width +
+ today_flag_rect_ = CFX_RectF(
+ client_rect_.left + kMonthCalHeaderBtnHMargin + kMonthCalHMargin,
+ dates_rect_.bottom() + kMonthCalHeaderBtnVMargin + kMonthCalVMargin,
+ cell_size_.width, today_size_.height);
+ today_rect_ = CFX_RectF(
+ client_rect_.left + kMonthCalHeaderBtnHMargin + cell_size_.width +
kMonthCalHMargin * 2,
- m_DatesRect.bottom() + kMonthCalHeaderBtnVMargin + kMonthCalVMargin,
- m_TodaySize);
+ dates_rect_.bottom() + kMonthCalHeaderBtnVMargin + kMonthCalVMargin,
+ today_size_);
}
void CFWL_MonthCalendar::Layout() {
- m_ClientRect = GetClientRect();
+ client_rect_ = GetClientRect();
- m_HeadRect = CFX_RectF(
- m_ClientRect.left + kMonthCalHeaderBtnHMargin, m_ClientRect.top,
- m_ClientRect.width - kMonthCalHeaderBtnHMargin * 2,
- m_CellSize.width + (kMonthCalHeaderBtnVMargin + kMonthCalVMargin) * 2);
- m_WeekRect = CFX_RectF(m_ClientRect.left + kMonthCalHeaderBtnHMargin,
- m_HeadRect.bottom(),
- m_ClientRect.width - kMonthCalHeaderBtnHMargin * 2,
- m_CellSize.height + kMonthCalVMargin * 2);
- m_LBtnRect = CFX_RectF(m_ClientRect.left + kMonthCalHeaderBtnHMargin,
- m_ClientRect.top + kMonthCalHeaderBtnVMargin,
- m_CellSize.width, m_CellSize.width);
- m_RBtnRect = CFX_RectF(m_ClientRect.left + m_ClientRect.width -
- kMonthCalHeaderBtnHMargin - m_CellSize.width,
- m_ClientRect.top + kMonthCalHeaderBtnVMargin,
- m_CellSize.width, m_CellSize.width);
- m_HSepRect = CFX_RectF(
- m_ClientRect.left + kMonthCalHeaderBtnHMargin + kMonthCalHMargin,
- m_WeekRect.bottom() - kMonthCalVMargin,
- m_ClientRect.width - (kMonthCalHeaderBtnHMargin + kMonthCalHMargin) * 2,
+ head_rect_ = CFX_RectF(
+ client_rect_.left + kMonthCalHeaderBtnHMargin, client_rect_.top,
+ client_rect_.width - kMonthCalHeaderBtnHMargin * 2,
+ cell_size_.width + (kMonthCalHeaderBtnVMargin + kMonthCalVMargin) * 2);
+ week_rect_ = CFX_RectF(client_rect_.left + kMonthCalHeaderBtnHMargin,
+ head_rect_.bottom(),
+ client_rect_.width - kMonthCalHeaderBtnHMargin * 2,
+ cell_size_.height + kMonthCalVMargin * 2);
+ lbtn_rect_ = CFX_RectF(client_rect_.left + kMonthCalHeaderBtnHMargin,
+ client_rect_.top + kMonthCalHeaderBtnVMargin,
+ cell_size_.width, cell_size_.width);
+ rbtn_rect_ = CFX_RectF(client_rect_.left + client_rect_.width -
+ kMonthCalHeaderBtnHMargin - cell_size_.width,
+ client_rect_.top + kMonthCalHeaderBtnVMargin,
+ cell_size_.width, cell_size_.width);
+ hsep_rect_ = CFX_RectF(
+ client_rect_.left + kMonthCalHeaderBtnHMargin + kMonthCalHMargin,
+ week_rect_.bottom() - kMonthCalVMargin,
+ client_rect_.width - (kMonthCalHeaderBtnHMargin + kMonthCalHMargin) * 2,
kMonthCalHSepHeight);
- m_DatesRect = CFX_RectF(m_ClientRect.left + kMonthCalHeaderBtnHMargin,
- m_WeekRect.bottom(),
- m_ClientRect.width - kMonthCalHeaderBtnHMargin * 2,
- m_CellSize.height * (kMonthCalRows - 3) +
+ dates_rect_ = CFX_RectF(client_rect_.left + kMonthCalHeaderBtnHMargin,
+ week_rect_.bottom(),
+ client_rect_.width - kMonthCalHeaderBtnHMargin * 2,
+ cell_size_.height * (kMonthCalRows - 3) +
kMonthCalVMargin * (kMonthCalRows - 3) * 2);
CalDateItem();
@@ -419,19 +422,19 @@
void CFWL_MonthCalendar::CalDateItem() {
bool bNewWeek = false;
int32_t iWeekOfMonth = 0;
- float fLeft = m_DatesRect.left;
- float fTop = m_DatesRect.top;
- for (const auto& pDateInfo : m_DateArray) {
+ float fLeft = dates_rect_.left;
+ float fTop = dates_rect_.top;
+ for (const auto& pDateInfo : date_array_) {
if (bNewWeek) {
iWeekOfMonth++;
bNewWeek = false;
}
pDateInfo->rect = CFX_RectF(
fLeft +
- pDateInfo->iDayOfWeek * (m_CellSize.width + (kMonthCalHMargin * 2)),
- fTop + iWeekOfMonth * (m_CellSize.height + (kMonthCalVMargin * 2)),
- m_CellSize.width + (kMonthCalHMargin * 2),
- m_CellSize.height + (kMonthCalVMargin * 2));
+ pDateInfo->iDayOfWeek * (cell_size_.width + (kMonthCalHMargin * 2)),
+ fTop + iWeekOfMonth * (cell_size_.height + (kMonthCalVMargin * 2)),
+ cell_size_.width + (kMonthCalHMargin * 2),
+ cell_size_.height + (kMonthCalVMargin * 2));
if (pDateInfo->iDayOfWeek >= 6)
bNewWeek = true;
}
@@ -440,59 +443,60 @@
void CFWL_MonthCalendar::InitDate() {
CFX_DateTime now = CFX_DateTime::Now();
- m_iYear = now.GetYear();
- m_iMonth = now.GetMonth();
- m_iDay = now.GetDay();
- m_iCurYear = m_iYear;
- m_iCurMonth = m_iMonth;
+ year_ = now.GetYear();
+ month_ = now.GetMonth();
+ day_ = now.GetDay();
+ cur_year_ = year_;
+ cur_month_ = month_;
- m_wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay);
- m_wsHead = GetHeadText(m_iCurYear, m_iCurMonth);
- m_dtMin = DATE(1500, 12, 1);
- m_dtMax = DATE(2200, 1, 1);
+ today_ = GetTodayText(year_, month_, day_);
+ head_ = GetHeadText(cur_year_, cur_month_);
+ dt_min_ = DATE(1500, 12, 1);
+ dt_max_ = DATE(2200, 1, 1);
}
void CFWL_MonthCalendar::ClearDateItem() {
- m_DateArray.clear();
+ date_array_.clear();
}
void CFWL_MonthCalendar::ResetDateItem() {
- int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth);
+ int32_t iDays = FX_DaysInMonth(cur_year_, cur_month_);
int32_t iDayOfWeek =
- CFX_DateTime(m_iCurYear, m_iCurMonth, 1, 0, 0, 0, 0).GetDayOfWeek();
+ CFX_DateTime(cur_year_, cur_month_, 1, 0, 0, 0, 0).GetDayOfWeek();
for (int32_t i = 0; i < iDays; ++i, ++iDayOfWeek) {
if (iDayOfWeek >= 7)
iDayOfWeek = 0;
const bool bFlagged =
- m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == i + 1;
- const bool bSelected = Contains(m_SelDayArray, i + 1);
- m_DateArray.push_back(
+ year_ == cur_year_ && month_ == cur_month_ && day_ == i + 1;
+ const bool bSelected = Contains(sel_day_array_, i + 1);
+ date_array_.push_back(
std::make_unique<DATEINFO>(i + 1, iDayOfWeek, bFlagged, bSelected,
WideString::FormatInteger(i + 1)));
}
}
void CFWL_MonthCalendar::NextMonth() {
- int32_t iYear = m_iCurYear;
- int32_t iMonth = m_iCurMonth;
+ int32_t iYear = cur_year_;
+ int32_t iMonth = cur_month_;
if (iMonth >= 12) {
iMonth = 1;
iYear++;
} else {
iMonth++;
}
- DATE dt(m_iCurYear, m_iCurMonth, 1);
- if (!(dt < m_dtMax))
+ DATE dt(cur_year_, cur_month_, 1);
+ if (!(dt < dt_max_)) {
return;
+ }
- m_iCurYear = iYear, m_iCurMonth = iMonth;
- ChangeToMonth(m_iCurYear, m_iCurMonth);
+ cur_year_ = iYear, cur_month_ = iMonth;
+ ChangeToMonth(cur_year_, cur_month_);
}
void CFWL_MonthCalendar::PrevMonth() {
- int32_t iYear = m_iCurYear;
- int32_t iMonth = m_iCurMonth;
+ int32_t iYear = cur_year_;
+ int32_t iMonth = cur_month_;
if (iMonth <= 1) {
iMonth = 12;
iYear--;
@@ -500,58 +504,60 @@
iMonth--;
}
- DATE dt(m_iCurYear, m_iCurMonth, 1);
- if (!(dt > m_dtMin))
+ DATE dt(cur_year_, cur_month_, 1);
+ if (!(dt > dt_min_)) {
return;
+ }
- m_iCurYear = iYear, m_iCurMonth = iMonth;
- ChangeToMonth(m_iCurYear, m_iCurMonth);
+ cur_year_ = iYear, cur_month_ = iMonth;
+ ChangeToMonth(cur_year_, cur_month_);
}
void CFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) {
- m_iCurYear = iYear;
- m_iCurMonth = iMonth;
- m_iHovered = -1;
+ cur_year_ = iYear;
+ cur_month_ = iMonth;
+ hovered_ = -1;
ClearDateItem();
ResetDateItem();
CalDateItem();
- m_wsHead = GetHeadText(m_iCurYear, m_iCurMonth);
+ head_ = GetHeadText(cur_year_, cur_month_);
}
void CFWL_MonthCalendar::RemoveSelDay() {
- int32_t iDatesCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
- for (int32_t iSelDay : m_SelDayArray) {
+ int32_t iDatesCount = fxcrt::CollectionSize<int32_t>(date_array_);
+ for (int32_t iSelDay : sel_day_array_) {
if (iSelDay <= iDatesCount)
- m_DateArray[iSelDay - 1]->bSelected = false;
+ date_array_[iSelDay - 1]->bSelected = false;
}
- m_SelDayArray.clear();
+ sel_day_array_.clear();
}
void CFWL_MonthCalendar::AddSelDay(int32_t iDay) {
DCHECK(iDay > 0);
- if (!Contains(m_SelDayArray, iDay)) {
+ if (!Contains(sel_day_array_, iDay)) {
return;
}
RemoveSelDay();
- if (iDay <= fxcrt::CollectionSize<int32_t>(m_DateArray))
- m_DateArray[iDay - 1]->bSelected = true;
+ if (iDay <= fxcrt::CollectionSize<int32_t>(date_array_)) {
+ date_array_[iDay - 1]->bSelected = true;
+ }
- m_SelDayArray.push_back(iDay);
+ sel_day_array_.push_back(iDay);
}
void CFWL_MonthCalendar::JumpToToday() {
- if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) {
- m_iCurYear = m_iYear;
- m_iCurMonth = m_iMonth;
- ChangeToMonth(m_iYear, m_iMonth);
- AddSelDay(m_iDay);
+ if (year_ != cur_year_ || month_ != cur_month_) {
+ cur_year_ = year_;
+ cur_month_ = month_;
+ ChangeToMonth(year_, month_);
+ AddSelDay(day_);
return;
}
- if (!Contains(m_SelDayArray, m_iDay)) {
- AddSelDay(m_iDay);
+ if (!Contains(sel_day_array_, day_)) {
+ AddSelDay(day_);
}
}
@@ -570,7 +576,7 @@
int32_t CFWL_MonthCalendar::GetDayAtPoint(const CFX_PointF& point) const {
int i = 1; // one-based day values.
- for (const auto& pDateInfo : m_DateArray) {
+ for (const auto& pDateInfo : date_array_) {
if (pDateInfo->rect.Contains(point))
return i;
++i;
@@ -579,10 +585,11 @@
}
CFX_RectF CFWL_MonthCalendar::GetDayRect(int32_t iDay) {
- if (iDay <= 0 || iDay > fxcrt::CollectionSize<int32_t>(m_DateArray))
+ if (iDay <= 0 || iDay > fxcrt::CollectionSize<int32_t>(date_array_)) {
return CFX_RectF();
+ }
- DATEINFO* pDateInfo = m_DateArray[iDay - 1].get();
+ DATEINFO* pDateInfo = date_array_[iDay - 1].get();
return pDateInfo ? pDateInfo->rect : CFX_RectF();
}
@@ -596,7 +603,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMouse->m_dwCmd) {
+ switch (pMouse->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMouse);
break;
@@ -628,50 +635,52 @@
}
void CFWL_MonthCalendar::OnLButtonDown(CFWL_MessageMouse* pMsg) {
- if (m_LBtnRect.Contains(pMsg->m_pos)) {
- m_iLBtnPartStates = CFWL_PartState::kPressed;
+ if (lbtn_rect_.Contains(pMsg->pos_)) {
+ lbtn_part_states_ = CFWL_PartState::kPressed;
PrevMonth();
- RepaintRect(m_ClientRect);
- } else if (m_RBtnRect.Contains(pMsg->m_pos)) {
- m_iRBtnPartStates |= CFWL_PartState::kPressed;
+ RepaintRect(client_rect_);
+ } else if (rbtn_rect_.Contains(pMsg->pos_)) {
+ rbtn_part_states_ |= CFWL_PartState::kPressed;
NextMonth();
- RepaintRect(m_ClientRect);
- } else if (m_TodayRect.Contains(pMsg->m_pos)) {
+ RepaintRect(client_rect_);
+ } else if (today_rect_.Contains(pMsg->pos_)) {
JumpToToday();
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
}
void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- if (m_LBtnRect.Contains(pMsg->m_pos)) {
- m_iLBtnPartStates = CFWL_PartState::kNormal;
- RepaintRect(m_LBtnRect);
+ if (lbtn_rect_.Contains(pMsg->pos_)) {
+ lbtn_part_states_ = CFWL_PartState::kNormal;
+ RepaintRect(lbtn_rect_);
return;
}
- if (m_RBtnRect.Contains(pMsg->m_pos)) {
- m_iRBtnPartStates = CFWL_PartState::kNormal;
- RepaintRect(m_RBtnRect);
+ if (rbtn_rect_.Contains(pMsg->pos_)) {
+ rbtn_part_states_ = CFWL_PartState::kNormal;
+ RepaintRect(rbtn_rect_);
return;
}
- if (m_TodayRect.Contains(pMsg->m_pos))
+ if (today_rect_.Contains(pMsg->pos_)) {
return;
+ }
int32_t iOldSel = 0;
- if (!m_SelDayArray.empty())
- iOldSel = m_SelDayArray[0];
+ if (!sel_day_array_.empty()) {
+ iOldSel = sel_day_array_[0];
+ }
- int32_t iCurSel = GetDayAtPoint(pMsg->m_pos);
+ int32_t iCurSel = GetDayAtPoint(pMsg->pos_);
if (iCurSel > 0) {
- DATEINFO* pDateInfo = m_DateArray[iCurSel - 1].get();
+ DATEINFO* pDateInfo = date_array_[iCurSel - 1].get();
CFX_RectF rtInvalidate(pDateInfo->rect);
- if (iOldSel > 0 && iOldSel <= fxcrt::CollectionSize<int32_t>(m_DateArray)) {
- pDateInfo = m_DateArray[iOldSel - 1].get();
+ if (iOldSel > 0 && iOldSel <= fxcrt::CollectionSize<int32_t>(date_array_)) {
+ pDateInfo = date_array_[iOldSel - 1].get();
rtInvalidate.Union(pDateInfo->rect);
}
AddSelDay(iCurSel);
CFWL_DateTimePicker* pDateTime =
static_cast<CFWL_DateTimePicker*>(GetOuter());
- pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel);
+ pDateTime->ProcessSelChanged(cur_year_, cur_month_, iCurSel);
pDateTime->HideMonthCalendar();
}
}
@@ -679,12 +688,13 @@
void CFWL_MonthCalendar::OnMouseMove(CFWL_MessageMouse* pMsg) {
bool bRepaint = false;
CFX_RectF rtInvalidate;
- if (m_DatesRect.Contains(pMsg->m_pos)) {
- int32_t iHover = GetDayAtPoint(pMsg->m_pos);
- bRepaint = m_iHovered != iHover;
+ if (dates_rect_.Contains(pMsg->pos_)) {
+ int32_t iHover = GetDayAtPoint(pMsg->pos_);
+ bRepaint = hovered_ != iHover;
if (bRepaint) {
- if (m_iHovered > 0)
- rtInvalidate = GetDayRect(m_iHovered);
+ if (hovered_ > 0) {
+ rtInvalidate = GetDayRect(hovered_);
+ }
if (iHover > 0) {
CFX_RectF rtDay = GetDayRect(iHover);
if (rtInvalidate.IsEmpty())
@@ -693,24 +703,25 @@
rtInvalidate.Union(rtDay);
}
}
- m_iHovered = iHover;
+ hovered_ = iHover;
} else {
- bRepaint = m_iHovered > 0;
+ bRepaint = hovered_ > 0;
if (bRepaint)
- rtInvalidate = GetDayRect(m_iHovered);
+ rtInvalidate = GetDayRect(hovered_);
- m_iHovered = -1;
+ hovered_ = -1;
}
if (bRepaint && !rtInvalidate.IsEmpty())
RepaintRect(rtInvalidate);
}
void CFWL_MonthCalendar::OnMouseLeave(CFWL_MessageMouse* pMsg) {
- if (m_iHovered <= 0)
+ if (hovered_ <= 0) {
return;
+ }
- CFX_RectF rtInvalidate = GetDayRect(m_iHovered);
- m_iHovered = -1;
+ CFX_RectF rtInvalidate = GetDayRect(hovered_);
+ hovered_ = -1;
if (!rtInvalidate.IsEmpty())
RepaintRect(rtInvalidate);
}
diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h
index 6575f4c..bd57f0b 100644
--- a/xfa/fwl/cfwl_monthcalendar.h
+++ b/xfa/fwl/cfwl_monthcalendar.h
@@ -129,34 +129,34 @@
void OnMouseMove(CFWL_MessageMouse* pMsg);
void OnMouseLeave(CFWL_MessageMouse* pMsg);
- bool m_bInitialized = false;
- CFX_RectF m_HeadRect;
- CFX_RectF m_WeekRect;
- CFX_RectF m_LBtnRect;
- CFX_RectF m_RBtnRect;
- CFX_RectF m_DatesRect;
- CFX_RectF m_HSepRect;
- CFX_RectF m_HeadTextRect;
- CFX_RectF m_TodayRect;
- CFX_RectF m_TodayFlagRect;
- WideString m_wsHead;
- WideString m_wsToday;
- std::vector<std::unique_ptr<DATEINFO>> m_DateArray;
- int32_t m_iCurYear = 2011;
- int32_t m_iCurMonth = 1;
- int32_t m_iYear = 2011;
- int32_t m_iMonth = 1;
- int32_t m_iDay = 1;
- int32_t m_iHovered = -1;
- Mask<CFWL_PartState> m_iLBtnPartStates = CFWL_PartState::kNormal;
- Mask<CFWL_PartState> m_iRBtnPartStates = CFWL_PartState::kNormal;
- DATE m_dtMin;
- DATE m_dtMax;
- CFX_SizeF m_HeadSize;
- CFX_SizeF m_CellSize;
- CFX_SizeF m_TodaySize;
- std::vector<int32_t> m_SelDayArray;
- CFX_RectF m_ClientRect;
+ bool initialized_ = false;
+ CFX_RectF head_rect_;
+ CFX_RectF week_rect_;
+ CFX_RectF lbtn_rect_;
+ CFX_RectF rbtn_rect_;
+ CFX_RectF dates_rect_;
+ CFX_RectF hsep_rect_;
+ CFX_RectF head_text_rect_;
+ CFX_RectF today_rect_;
+ CFX_RectF today_flag_rect_;
+ WideString head_;
+ WideString today_;
+ std::vector<std::unique_ptr<DATEINFO>> date_array_;
+ int32_t cur_year_ = 2011;
+ int32_t cur_month_ = 1;
+ int32_t year_ = 2011;
+ int32_t month_ = 1;
+ int32_t day_ = 1;
+ int32_t hovered_ = -1;
+ Mask<CFWL_PartState> lbtn_part_states_ = CFWL_PartState::kNormal;
+ Mask<CFWL_PartState> rbtn_part_states_ = CFWL_PartState::kNormal;
+ DATE dt_min_;
+ DATE dt_max_;
+ CFX_SizeF head_size_;
+ CFX_SizeF cell_size_;
+ CFX_SizeF today_size_;
+ std::vector<int32_t> sel_day_array_;
+ CFX_RectF client_rect_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index d65dc38..3f855cd 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -30,20 +30,20 @@
} // namespace
-CFWL_NoteDriver::CFWL_NoteDriver(CFWL_App* pApp) : m_pApp(pApp) {}
+CFWL_NoteDriver::CFWL_NoteDriver(CFWL_App* pApp) : app_(pApp) {}
CFWL_NoteDriver::~CFWL_NoteDriver() = default;
void CFWL_NoteDriver::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pApp);
- visitor->Trace(m_pHover);
- visitor->Trace(m_pFocus);
- visitor->Trace(m_pGrab);
- ContainerTrace(visitor, m_eventTargets);
+ visitor->Trace(app_);
+ visitor->Trace(hover_);
+ visitor->Trace(focus_);
+ visitor->Trace(grab_);
+ ContainerTrace(visitor, event_targets_);
}
void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
- for (const auto& pair : m_eventTargets) {
+ for (const auto& pair : event_targets_) {
if (pair.second->IsValid())
pair.second->ProcessEvent(pNote);
}
@@ -56,11 +56,11 @@
key = g_next_listener_key++;
pListener->SetEventKey(key);
}
- if (!m_eventTargets[key]) {
- m_eventTargets[key] = cppgc::MakeGarbageCollected<Target>(
- m_pApp->GetHeap()->GetAllocationHandle(), pListener);
+ if (!event_targets_[key]) {
+ event_targets_[key] = cppgc::MakeGarbageCollected<Target>(
+ app_->GetHeap()->GetAllocationHandle(), pListener);
}
- m_eventTargets[key]->SetEventSource(pEventSource);
+ event_targets_[key]->SetEventSource(pEventSource);
}
void CFWL_NoteDriver::UnregisterEventTarget(CFWL_Widget* pListener) {
@@ -68,27 +68,34 @@
if (key == 0)
return;
- auto it = m_eventTargets.find(key);
- if (it != m_eventTargets.end())
+ auto it = event_targets_.find(key);
+ if (it != event_targets_.end()) {
it->second->Invalidate();
+ }
}
void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) {
- if (m_pFocus == pNoteTarget)
- m_pFocus = nullptr;
- if (m_pHover == pNoteTarget)
- m_pHover = nullptr;
- if (m_pGrab == pNoteTarget)
- m_pGrab = nullptr;
+ if (focus_ == pNoteTarget) {
+ focus_ = nullptr;
+ }
+ if (hover_ == pNoteTarget) {
+ hover_ = nullptr;
+ }
+ if (grab_ == pNoteTarget) {
+ grab_ = nullptr;
+ }
}
void CFWL_NoteDriver::NotifyTargetDestroy(CFWL_Widget* pNoteTarget) {
- if (m_pFocus == pNoteTarget)
- m_pFocus = nullptr;
- if (m_pHover == pNoteTarget)
- m_pHover = nullptr;
- if (m_pGrab == pNoteTarget)
- m_pGrab = nullptr;
+ if (focus_ == pNoteTarget) {
+ focus_ = nullptr;
+ }
+ if (hover_ == pNoteTarget) {
+ hover_ = nullptr;
+ }
+ if (grab_ == pNoteTarget) {
+ grab_ = nullptr;
+ }
UnregisterEventTarget(pNoteTarget);
}
@@ -143,33 +150,34 @@
bool CFWL_NoteDriver::DoSetFocus(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
- m_pFocus = pMessage->GetDstTarget();
+ focus_ = pMessage->GetDstTarget();
return true;
}
bool CFWL_NoteDriver::DoKillFocus(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
- if (m_pFocus == pMessage->GetDstTarget())
- m_pFocus = nullptr;
+ if (focus_ == pMessage->GetDstTarget()) {
+ focus_ = nullptr;
+ }
return true;
}
bool CFWL_NoteDriver::DoKey(CFWL_Message* pMessage, CFWL_Widget* pMessageForm) {
CFWL_MessageKey* pMsg = static_cast<CFWL_MessageKey*>(pMessage);
#if !BUILDFLAG(IS_APPLE)
- if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown &&
- pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Tab) {
+ if (pMsg->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown &&
+ pMsg->key_code_or_char_ == XFA_FWL_VKEY_Tab) {
return true;
}
#endif
- if (m_pFocus) {
- pMsg->SetDstTarget(m_pFocus.Get());
+ if (focus_) {
+ pMsg->SetDstTarget(focus_.Get());
return true;
}
- if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown &&
- pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return) {
+ if (pMsg->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown &&
+ pMsg->key_code_or_char_ == XFA_FWL_VKEY_Return) {
CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetFWLApp()->GetWidgetMgr();
CFWL_Widget* pDefButton = pWidgetMgr->GetDefaultButton(pMessageForm);
if (pDefButton) {
@@ -183,13 +191,13 @@
bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeave ||
- pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kHover ||
- pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kEnter) {
+ if (pMsg->cmd_ == CFWL_MessageMouse::MouseCommand::kLeave ||
+ pMsg->cmd_ == CFWL_MessageMouse::MouseCommand::kHover ||
+ pMsg->cmd_ == CFWL_MessageMouse::MouseCommand::kEnter) {
return !!pMsg->GetDstTarget();
}
if (pMsg->GetDstTarget() != pMessageForm)
- pMsg->m_pos = pMsg->GetDstTarget()->TransformTo(pMessageForm, pMsg->m_pos);
+ pMsg->pos_ = pMsg->GetDstTarget()->TransformTo(pMessageForm, pMsg->pos_);
if (!DoMouseEx(pMsg, pMessageForm))
pMsg->SetDstTarget(pMessageForm);
return true;
@@ -212,16 +220,17 @@
CFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetFWLApp()->GetWidgetMgr();
CFWL_Widget* pTarget = nullptr;
- if (m_pGrab)
- pTarget = m_pGrab.Get();
+ if (grab_) {
+ pTarget = grab_.Get();
+ }
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
if (!pTarget)
- pTarget = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos);
+ pTarget = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->pos_);
if (!pTarget)
return false;
if (pTarget && pMessageForm != pTarget)
- pMsg->m_pos = pMessageForm->TransformTo(pTarget, pMsg->m_pos);
+ pMsg->pos_ = pMessageForm->TransformTo(pTarget, pMsg->pos_);
pMsg->SetDstTarget(pTarget);
return true;
@@ -229,50 +238,53 @@
void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) {
CFWL_Widget* pTarget = pMessage->GetDstTarget();
- if (pTarget == m_pHover)
+ if (pTarget == hover_) {
return;
+ }
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (m_pHover) {
- CFWL_MessageMouse msLeave(
- m_pHover.Get(), CFWL_MessageMouse::MouseCommand::kLeave,
- Mask<XFA_FWL_KeyFlag>(),
- pTarget->TransformTo(m_pHover.Get(), pMsg->m_pos));
+ if (hover_) {
+ CFWL_MessageMouse msLeave(hover_.Get(),
+ CFWL_MessageMouse::MouseCommand::kLeave,
+ Mask<XFA_FWL_KeyFlag>(),
+ pTarget->TransformTo(hover_.Get(), pMsg->pos_));
DispatchMessage(&msLeave, nullptr);
}
if (pTarget->GetClassID() == FWL_Type::Form) {
- m_pHover = nullptr;
+ hover_ = nullptr;
return;
}
- m_pHover = pTarget;
+ hover_ = pTarget;
CFWL_MessageMouse msHover(pTarget, CFWL_MessageMouse::MouseCommand::kHover,
- Mask<XFA_FWL_KeyFlag>(), pMsg->m_pos);
+ Mask<XFA_FWL_KeyFlag>(), pMsg->pos_);
DispatchMessage(&msHover, nullptr);
}
CFWL_NoteDriver::Target::Target(CFWL_Widget* pListener)
- : m_pListener(pListener) {}
+ : listener_(pListener) {}
CFWL_NoteDriver::Target::~Target() = default;
void CFWL_NoteDriver::Target::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pListener);
- for (auto& widget : m_widgets)
+ visitor->Trace(listener_);
+ for (auto& widget : widgets_) {
visitor->Trace(widget);
+ }
}
void CFWL_NoteDriver::Target::SetEventSource(CFWL_Widget* pSource) {
if (pSource)
- m_widgets.insert(pSource);
+ widgets_.insert(pSource);
}
bool CFWL_NoteDriver::Target::ProcessEvent(CFWL_Event* pEvent) {
- IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate();
+ IFWL_WidgetDelegate* pDelegate = listener_->GetDelegate();
if (!pDelegate)
return false;
- if (!m_widgets.empty() && m_widgets.count(pEvent->GetSrcTarget()) == 0)
+ if (!widgets_.empty() && widgets_.count(pEvent->GetSrcTarget()) == 0) {
return false;
+ }
pDelegate->OnProcessEvent(pEvent);
return true;
}
diff --git a/xfa/fwl/cfwl_notedriver.h b/xfa/fwl/cfwl_notedriver.h
index 1f3f6d8..ad314f4 100644
--- a/xfa/fwl/cfwl_notedriver.h
+++ b/xfa/fwl/cfwl_notedriver.h
@@ -35,7 +35,7 @@
void UnregisterEventTarget(CFWL_Widget* pListener);
void NotifyTargetHide(CFWL_Widget* pNoteTarget);
void NotifyTargetDestroy(CFWL_Widget* pNoteTarget);
- void SetGrab(CFWL_Widget* pGrab) { m_pGrab = pGrab; }
+ void SetGrab(CFWL_Widget* pGrab) { grab_ = pGrab; }
private:
class Target : public cppgc::GarbageCollected<Target> {
@@ -46,13 +46,13 @@
void Trace(cppgc::Visitor* visitor) const;
void SetEventSource(CFWL_Widget* pSource);
bool ProcessEvent(CFWL_Event* pEvent);
- bool IsValid() const { return m_bValid; }
- void Invalidate() { m_bValid = false; }
+ bool IsValid() const { return valid_; }
+ void Invalidate() { valid_ = false; }
private:
- bool m_bValid = true;
- cppgc::Member<CFWL_Widget> const m_pListener;
- std::set<cppgc::Member<CFWL_Widget>> m_widgets;
+ bool valid_ = true;
+ cppgc::Member<CFWL_Widget> const listener_;
+ std::set<cppgc::Member<CFWL_Widget>> widgets_;
};
explicit CFWL_NoteDriver(CFWL_App* pApp);
@@ -66,11 +66,11 @@
bool DoMouseEx(CFWL_Message* pMsg, CFWL_Widget* pMessageForm);
void MouseSecondary(CFWL_Message* pMsg);
- cppgc::Member<CFWL_App> m_pApp;
- cppgc::Member<CFWL_Widget> m_pHover;
- cppgc::Member<CFWL_Widget> m_pFocus;
- cppgc::Member<CFWL_Widget> m_pGrab;
- std::map<uint64_t, cppgc::Member<Target>> m_eventTargets;
+ cppgc::Member<CFWL_App> app_;
+ cppgc::Member<CFWL_Widget> hover_;
+ cppgc::Member<CFWL_Widget> focus_;
+ cppgc::Member<CFWL_Widget> grab_;
+ std::map<uint64_t, cppgc::Member<Target>> event_targets_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_picturebox.cpp b/xfa/fwl/cfwl_picturebox.cpp
index c5c60ac..eebc467 100644
--- a/xfa/fwl/cfwl_picturebox.cpp
+++ b/xfa/fwl/cfwl_picturebox.cpp
@@ -21,7 +21,7 @@
if (IsLocked())
return;
- m_ClientRect = GetClientRect();
+ client_rect_ = GetClientRect();
}
void CFWL_PictureBox::DrawWidget(CFGAS_GEGraphics* pGraphics,
diff --git a/xfa/fwl/cfwl_picturebox.h b/xfa/fwl/cfwl_picturebox.h
index dc00cca..ee98288 100644
--- a/xfa/fwl/cfwl_picturebox.h
+++ b/xfa/fwl/cfwl_picturebox.h
@@ -27,9 +27,9 @@
private:
explicit CFWL_PictureBox(CFWL_App* pApp);
- CFX_RectF m_ClientRect;
- CFX_RectF m_ImageRect;
- CFX_Matrix m_matrix;
+ CFX_RectF client_rect_;
+ CFX_RectF image_rect_;
+ CFX_Matrix matrix_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index fa0fbc4..f8b9662 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -30,7 +30,7 @@
void CFWL_PushButton::SetStates(uint32_t dwStates) {
if (dwStates & FWL_STATE_WGT_Disabled) {
- m_Properties.m_dwStates = FWL_STATE_WGT_Disabled;
+ properties_.states_ = FWL_STATE_WGT_Disabled;
return;
}
CFWL_Widget::SetStates(dwStates);
@@ -40,8 +40,8 @@
if (IsLocked())
return;
- m_ClientRect = GetClientRect();
- m_CaptionRect = m_ClientRect;
+ client_rect_ = GetClientRect();
+ caption_rect_ = client_rect_;
}
void CFWL_PushButton::DrawWidget(CFGAS_GEGraphics* pGraphics,
@@ -59,24 +59,27 @@
const CFX_Matrix& matrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
pGraphics);
- param.m_dwStates = GetPartStates();
- param.m_matrix = matrix;
- param.m_PartRect = m_ClientRect;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
- param.m_pRtData = &m_CaptionRect;
+ param.states_ = GetPartStates();
+ param.matrix_ = matrix;
+ param.part_rect_ = client_rect_;
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
+ param.data_rect_ = &caption_rect_;
+ }
GetThemeProvider()->DrawBackground(param);
}
Mask<CFWL_PartState> CFWL_PushButton::GetPartStates() {
Mask<CFWL_PartState> dwStates = CFWL_PartState::kNormal;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
+ if (properties_.states_ & FWL_STATE_WGT_Focused) {
dwStates |= CFWL_PartState::kFocused;
- if (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
+ }
+ if (properties_.states_ & FWL_STATE_WGT_Disabled) {
dwStates = CFWL_PartState::kDisabled;
- else if (m_Properties.m_dwStates & FWL_STATE_PSB_Pressed)
+ } else if (properties_.states_ & FWL_STATE_PSB_Pressed) {
dwStates |= CFWL_PartState::kPressed;
- else if (m_Properties.m_dwStates & FWL_STATE_PSB_Hovered)
+ } else if (properties_.states_ & FWL_STATE_PSB_Hovered) {
dwStates |= CFWL_PartState::kHovered;
+ }
return dwStates;
}
@@ -93,7 +96,7 @@
break;
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
@@ -113,8 +116,9 @@
}
case CFWL_Message::Type::kKey: {
CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage);
- if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown)
+ if (pKey->cmd_ == CFWL_MessageKey::KeyCommand::kKeyDown) {
OnKeyDown(pKey);
+ }
break;
}
default:
@@ -131,82 +135,84 @@
}
void CFWL_PushButton::OnFocusGained() {
- m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ |= FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnFocusLost() {
- m_Properties.m_dwStates &= ~FWL_STATE_WGT_Focused;
- RepaintRect(m_ClientRect);
+ properties_.states_ &= ~FWL_STATE_WGT_Focused;
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
- m_bBtnDown = true;
- m_Properties.m_dwStates |= FWL_STATE_PSB_Hovered;
- m_Properties.m_dwStates |= FWL_STATE_PSB_Pressed;
- RepaintRect(m_ClientRect);
+ btn_down_ = true;
+ properties_.states_ |= FWL_STATE_PSB_Hovered;
+ properties_.states_ |= FWL_STATE_PSB_Pressed;
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- m_bBtnDown = false;
- if (m_ClientRect.Contains(pMsg->m_pos)) {
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Pressed;
- m_Properties.m_dwStates |= FWL_STATE_PSB_Hovered;
+ btn_down_ = false;
+ if (client_rect_.Contains(pMsg->pos_)) {
+ properties_.states_ &= ~FWL_STATE_PSB_Pressed;
+ properties_.states_ |= FWL_STATE_PSB_Hovered;
} else {
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Hovered;
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Pressed;
+ properties_.states_ &= ~FWL_STATE_PSB_Hovered;
+ properties_.states_ &= ~FWL_STATE_PSB_Pressed;
}
- if (m_ClientRect.Contains(pMsg->m_pos)) {
+ if (client_rect_.Contains(pMsg->pos_)) {
CFWL_Event wmClick(CFWL_Event::Type::Click, this);
DispatchEvent(&wmClick);
}
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
bool bRepaint = false;
- if (m_bBtnDown) {
- if (m_ClientRect.Contains(pMsg->m_pos)) {
- if ((m_Properties.m_dwStates & FWL_STATE_PSB_Pressed) == 0) {
- m_Properties.m_dwStates |= FWL_STATE_PSB_Pressed;
+ if (btn_down_) {
+ if (client_rect_.Contains(pMsg->pos_)) {
+ if ((properties_.states_ & FWL_STATE_PSB_Pressed) == 0) {
+ properties_.states_ |= FWL_STATE_PSB_Pressed;
bRepaint = true;
}
- if (m_Properties.m_dwStates & FWL_STATE_PSB_Hovered) {
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Hovered;
+ if (properties_.states_ & FWL_STATE_PSB_Hovered) {
+ properties_.states_ &= ~FWL_STATE_PSB_Hovered;
bRepaint = true;
}
} else {
- if (m_Properties.m_dwStates & FWL_STATE_PSB_Pressed) {
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Pressed;
+ if (properties_.states_ & FWL_STATE_PSB_Pressed) {
+ properties_.states_ &= ~FWL_STATE_PSB_Pressed;
bRepaint = true;
}
- if ((m_Properties.m_dwStates & FWL_STATE_PSB_Hovered) == 0) {
- m_Properties.m_dwStates |= FWL_STATE_PSB_Hovered;
+ if ((properties_.states_ & FWL_STATE_PSB_Hovered) == 0) {
+ properties_.states_ |= FWL_STATE_PSB_Hovered;
bRepaint = true;
}
}
} else {
- if (!m_ClientRect.Contains(pMsg->m_pos))
+ if (!client_rect_.Contains(pMsg->pos_)) {
return;
- if ((m_Properties.m_dwStates & FWL_STATE_PSB_Hovered) == 0) {
- m_Properties.m_dwStates |= FWL_STATE_PSB_Hovered;
+ }
+ if ((properties_.states_ & FWL_STATE_PSB_Hovered) == 0) {
+ properties_.states_ |= FWL_STATE_PSB_Hovered;
bRepaint = true;
}
}
if (bRepaint)
- RepaintRect(m_ClientRect);
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnMouseLeave(CFWL_MessageMouse* pMsg) {
- m_bBtnDown = false;
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Hovered;
- m_Properties.m_dwStates &= ~FWL_STATE_PSB_Pressed;
- RepaintRect(m_ClientRect);
+ btn_down_ = false;
+ properties_.states_ &= ~FWL_STATE_PSB_Hovered;
+ properties_.states_ &= ~FWL_STATE_PSB_Pressed;
+ RepaintRect(client_rect_);
}
void CFWL_PushButton::OnKeyDown(CFWL_MessageKey* pMsg) {
- if (pMsg->m_dwKeyCodeOrChar != XFA_FWL_VKEY_Return)
+ if (pMsg->key_code_or_char_ != XFA_FWL_VKEY_Return) {
return;
+ }
CFWL_EventMouse wmMouse(this, nullptr,
CFWL_MessageMouse::MouseCommand::kLeftButtonUp);
diff --git a/xfa/fwl/cfwl_pushbutton.h b/xfa/fwl/cfwl_pushbutton.h
index ae665ad..53031bf 100644
--- a/xfa/fwl/cfwl_pushbutton.h
+++ b/xfa/fwl/cfwl_pushbutton.h
@@ -47,9 +47,9 @@
void OnMouseLeave(CFWL_MessageMouse* pMsg);
void OnKeyDown(CFWL_MessageKey* pMsg);
- bool m_bBtnDown = false;
- CFX_RectF m_ClientRect;
- CFX_RectF m_CaptionRect;
+ bool btn_down_ = false;
+ CFX_RectF client_rect_;
+ CFX_RectF caption_rect_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 206b731..322faa2 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -61,10 +61,10 @@
}
void CFWL_ScrollBar::SetTrackPos(float fTrackPos) {
- m_fTrackPos = fTrackPos;
- m_ThumbRect = CalcThumbButtonRect(m_ThumbRect);
- m_MinTrackRect = CalcMinTrackRect(m_MinTrackRect);
- m_MaxTrackRect = CalcMaxTrackRect(m_MaxTrackRect);
+ track_pos_ = fTrackPos;
+ thumb_rect_ = CalcThumbButtonRect(thumb_rect_);
+ min_track_rect_ = CalcMinTrackRect(min_track_rect_);
+ max_track_rect_ = CalcMaxTrackRect(max_track_rect_);
}
bool CFWL_ScrollBar::DoScroll(CFWL_EventScroll::Code dwCode, float fPos) {
@@ -77,11 +77,11 @@
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kUpperTrack, this,
pGraphics);
- param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
- ? CFWL_PartState::kDisabled
- : m_iMaxTrackState;
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_MaxTrackRect;
+ param.states_ = (properties_.states_ & FWL_STATE_WGT_Disabled)
+ ? CFWL_PartState::kDisabled
+ : max_track_state_;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = max_track_rect_;
GetThemeProvider()->DrawBackground(param);
}
@@ -89,84 +89,86 @@
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kLowerTrack, this,
pGraphics);
- param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
- ? CFWL_PartState::kDisabled
- : m_iMinTrackState;
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_MinTrackRect;
+ param.states_ = (properties_.states_ & FWL_STATE_WGT_Disabled)
+ ? CFWL_PartState::kDisabled
+ : min_track_state_;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = min_track_rect_;
GetThemeProvider()->DrawBackground(param);
}
void CFWL_ScrollBar::DrawMaxArrowBtn(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackArrow, this, pGraphics);
- param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
- ? CFWL_PartState::kDisabled
- : m_iMaxButtonState;
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_MaxBtnRect;
- if (param.m_PartRect.height > 0 && param.m_PartRect.width > 0)
+ param.states_ = (properties_.states_ & FWL_STATE_WGT_Disabled)
+ ? CFWL_PartState::kDisabled
+ : max_button_state_;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = max_btn_rect_;
+ if (param.part_rect_.height > 0 && param.part_rect_.width > 0) {
GetThemeProvider()->DrawBackground(param);
+ }
}
void CFWL_ScrollBar::DrawMinArrowBtn(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kForeArrow, this, pGraphics);
- param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
- ? CFWL_PartState::kDisabled
- : m_iMinButtonState;
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_MinBtnRect;
- if (param.m_PartRect.height > 0 && param.m_PartRect.width > 0)
+ param.states_ = (properties_.states_ & FWL_STATE_WGT_Disabled)
+ ? CFWL_PartState::kDisabled
+ : min_button_state_;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = min_btn_rect_;
+ if (param.part_rect_.height > 0 && param.part_rect_.width > 0) {
GetThemeProvider()->DrawBackground(param);
+ }
}
void CFWL_ScrollBar::DrawThumb(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(CFWL_ThemePart::Part::kThumb, this, pGraphics);
- param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
- ? CFWL_PartState::kDisabled
- : m_iThumbButtonState;
- param.m_matrix = mtMatrix;
- param.m_PartRect = m_ThumbRect;
+ param.states_ = (properties_.states_ & FWL_STATE_WGT_Disabled)
+ ? CFWL_PartState::kDisabled
+ : thumb_button_state_;
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = thumb_rect_;
GetThemeProvider()->DrawBackground(param);
}
void CFWL_ScrollBar::Layout() {
- m_ClientRect = GetClientRect();
+ client_rect_ = GetClientRect();
CalcButtonLen();
- m_MinBtnRect = CalcMinButtonRect();
- m_MaxBtnRect = CalcMaxButtonRect();
- m_ThumbRect = CalcThumbButtonRect(m_ThumbRect);
- m_MinTrackRect = CalcMinTrackRect(m_MinTrackRect);
- m_MaxTrackRect = CalcMaxTrackRect(m_MaxTrackRect);
+ min_btn_rect_ = CalcMinButtonRect();
+ max_btn_rect_ = CalcMaxButtonRect();
+ thumb_rect_ = CalcThumbButtonRect(thumb_rect_);
+ min_track_rect_ = CalcMinTrackRect(min_track_rect_);
+ max_track_rect_ = CalcMaxTrackRect(max_track_rect_);
}
void CFWL_ScrollBar::CalcButtonLen() {
- m_fButtonLen = IsVertical() ? m_ClientRect.width : m_ClientRect.height;
- float fLength = IsVertical() ? m_ClientRect.height : m_ClientRect.width;
- if (fLength < m_fButtonLen * 2) {
- m_fButtonLen = fLength / 2;
- m_bMinSize = true;
+ button_len_ = IsVertical() ? client_rect_.width : client_rect_.height;
+ float fLength = IsVertical() ? client_rect_.height : client_rect_.width;
+ if (fLength < button_len_ * 2) {
+ button_len_ = fLength / 2;
+ min_size_ = true;
} else {
- m_bMinSize = false;
+ min_size_ = false;
}
}
CFX_RectF CFWL_ScrollBar::CalcMinButtonRect() {
if (IsVertical())
- return CFX_RectF(m_ClientRect.TopLeft(), m_ClientRect.width, m_fButtonLen);
- return CFX_RectF(m_ClientRect.TopLeft(), m_fButtonLen, m_ClientRect.height);
+ return CFX_RectF(client_rect_.TopLeft(), client_rect_.width, button_len_);
+ return CFX_RectF(client_rect_.TopLeft(), button_len_, client_rect_.height);
}
CFX_RectF CFWL_ScrollBar::CalcMaxButtonRect() {
if (IsVertical()) {
- return CFX_RectF(m_ClientRect.left, m_ClientRect.bottom() - m_fButtonLen,
- m_ClientRect.width, m_fButtonLen);
+ return CFX_RectF(client_rect_.left, client_rect_.bottom() - button_len_,
+ client_rect_.width, button_len_);
}
- return CFX_RectF(m_ClientRect.right() - m_fButtonLen, m_ClientRect.top,
- m_fButtonLen, m_ClientRect.height);
+ return CFX_RectF(client_rect_.right() - button_len_, client_rect_.top,
+ button_len_, client_rect_.height);
}
CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) {
@@ -174,25 +176,25 @@
if (!IsEnabled())
return rect;
- if (m_bMinSize) {
+ if (min_size_) {
rect.left = rtThumb.left;
rect.top = rtThumb.top;
return rect;
}
- float fRange = m_fRangeMax - m_fRangeMin;
+ float fRange = range_max_ - range_min_;
if (fRange < 0) {
if (IsVertical()) {
- return CFX_RectF(m_ClientRect.left, m_MaxBtnRect.bottom(),
- m_ClientRect.width, 0);
+ return CFX_RectF(client_rect_.left, max_btn_rect_.bottom(),
+ client_rect_.width, 0);
}
- return CFX_RectF(m_MaxBtnRect.right(), m_ClientRect.top, 0,
- m_ClientRect.height);
+ return CFX_RectF(max_btn_rect_.right(), client_rect_.top, 0,
+ client_rect_.height);
}
- CFX_RectF rtClient = m_ClientRect;
+ CFX_RectF rtClient = client_rect_;
float fLength = IsVertical() ? rtClient.height : rtClient.width;
- float fSize = m_fButtonLen;
+ float fSize = button_len_;
fLength -= fSize * 2.0f;
if (fLength < fSize)
fLength = 0.0f;
@@ -201,11 +203,11 @@
fThumbSize = std::max(fThumbSize, kMinThumbSize);
float fDiff = std::max(fLength - fThumbSize, 0.0f);
- float fTrackPos = std::clamp(m_fTrackPos, m_fRangeMin, m_fRangeMax);
+ float fTrackPos = std::clamp(track_pos_, range_min_, range_max_);
if (!fRange)
return rect;
- float iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange;
+ float iPos = fSize + fDiff * (fTrackPos - range_min_) / fRange;
rect.left = rtClient.left;
rect.top = rtClient.top;
if (IsVertical()) {
@@ -222,78 +224,79 @@
CFX_RectF CFWL_ScrollBar::CalcMinTrackRect(const CFX_RectF& rtMinRect) {
CFX_RectF rect;
- if (m_bMinSize) {
+ if (min_size_) {
rect.left = rtMinRect.left;
rect.top = rtMinRect.top;
return rect;
}
- rect.left = m_ClientRect.left;
- rect.top = m_ClientRect.top;
+ rect.left = client_rect_.left;
+ rect.top = client_rect_.top;
if (IsVertical()) {
- rect.width = m_ClientRect.width;
- rect.height = (m_ThumbRect.top + m_ThumbRect.bottom()) / 2;
+ rect.width = client_rect_.width;
+ rect.height = (thumb_rect_.top + thumb_rect_.bottom()) / 2;
} else {
- rect.width = (m_ThumbRect.left + m_ThumbRect.right()) / 2;
- rect.height = m_ClientRect.height;
+ rect.width = (thumb_rect_.left + thumb_rect_.right()) / 2;
+ rect.height = client_rect_.height;
}
return rect;
}
CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) {
- if (m_bMinSize)
+ if (min_size_) {
return CFX_RectF(rtMaxRect.TopLeft(), 0, 0);
-
- if (IsVertical()) {
- float iy = (m_ThumbRect.top + m_ThumbRect.bottom()) / 2;
- return CFX_RectF(m_ClientRect.left, iy, m_ClientRect.width,
- m_ClientRect.bottom() - iy);
}
- float ix = (m_ThumbRect.left + m_ThumbRect.right()) / 2;
- return CFX_RectF(ix, m_ClientRect.top, m_ClientRect.height - ix,
- m_ClientRect.height);
+ if (IsVertical()) {
+ float iy = (thumb_rect_.top + thumb_rect_.bottom()) / 2;
+ return CFX_RectF(client_rect_.left, iy, client_rect_.width,
+ client_rect_.bottom() - iy);
+ }
+
+ float ix = (thumb_rect_.left + thumb_rect_.right()) / 2;
+ return CFX_RectF(ix, client_rect_.top, client_rect_.height - ix,
+ client_rect_.height);
}
float CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
- CFX_PointF diff = point - m_cpTrackPoint;
- float fRange = m_fRangeMax - m_fRangeMin;
+ CFX_PointF diff = point - track_point_;
+ float fRange = range_max_ - range_min_;
float fPos;
if (IsVertical()) {
fPos = fRange * diff.y /
- (m_MaxBtnRect.top - m_MinBtnRect.bottom() - m_ThumbRect.height);
+ (max_btn_rect_.top - min_btn_rect_.bottom() - thumb_rect_.height);
} else {
fPos = fRange * diff.x /
- (m_MaxBtnRect.left - m_MinBtnRect.right() - m_ThumbRect.width);
+ (max_btn_rect_.left - min_btn_rect_.right() - thumb_rect_.width);
}
- fPos += m_fLastTrackPos;
- return std::clamp(fPos, m_fRangeMin, m_fRangeMax);
+ fPos += last_track_pos_;
+ return std::clamp(fPos, range_min_, range_max_);
}
bool CFWL_ScrollBar::SendEvent() {
- if (m_iMinButtonState == CFWL_PartState::kPressed) {
- DoScroll(CFWL_EventScroll::Code::StepBackward, m_fTrackPos);
+ if (min_button_state_ == CFWL_PartState::kPressed) {
+ DoScroll(CFWL_EventScroll::Code::StepBackward, track_pos_);
return false;
}
- if (m_iMaxButtonState == CFWL_PartState::kPressed) {
- DoScroll(CFWL_EventScroll::Code::StepForward, m_fTrackPos);
+ if (max_button_state_ == CFWL_PartState::kPressed) {
+ DoScroll(CFWL_EventScroll::Code::StepForward, track_pos_);
return false;
}
- if (m_iMinTrackState == CFWL_PartState::kPressed) {
- DoScroll(CFWL_EventScroll::Code::PageBackward, m_fTrackPos);
- return m_ThumbRect.Contains(m_cpTrackPoint);
+ if (min_track_state_ == CFWL_PartState::kPressed) {
+ DoScroll(CFWL_EventScroll::Code::PageBackward, track_pos_);
+ return thumb_rect_.Contains(track_point_);
}
- if (m_iMaxTrackState == CFWL_PartState::kPressed) {
- DoScroll(CFWL_EventScroll::Code::PageForward, m_fTrackPos);
- return m_ThumbRect.Contains(m_cpTrackPoint);
+ if (max_track_state_ == CFWL_PartState::kPressed) {
+ DoScroll(CFWL_EventScroll::Code::PageForward, track_pos_);
+ return thumb_rect_.Contains(track_point_);
}
- if (m_iMouseWheel) {
- CFWL_EventScroll::Code dwCode = m_iMouseWheel < 0
+ if (mouse_wheel_) {
+ CFWL_EventScroll::Code dwCode = mouse_wheel_ < 0
? CFWL_EventScroll::Code::StepForward
: CFWL_EventScroll::Code::StepBackward;
- DoScroll(dwCode, m_fTrackPos);
+ DoScroll(dwCode, track_pos_);
}
return true;
}
@@ -308,15 +311,15 @@
CFWL_Message::Type type = pMessage->GetType();
if (type == CFWL_Message::Type::kMouse) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
+ switch (pMsg->cmd_) {
case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
- OnLButtonDown(pMsg->m_pos);
+ OnLButtonDown(pMsg->pos_);
break;
case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
- OnLButtonUp(pMsg->m_pos);
+ OnLButtonUp(pMsg->pos_);
break;
case CFWL_MessageMouse::MouseCommand::kMove:
- OnMouseMove(pMsg->m_pos);
+ OnMouseMove(pMsg->pos_);
break;
case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave();
@@ -339,59 +342,60 @@
if (!IsEnabled())
return;
- m_bMouseDown = true;
+ mouse_down_ = true;
SetGrab(true);
- m_cpTrackPoint = point;
- m_fLastTrackPos = m_fTrackPos;
- if (m_MinBtnRect.Contains(point))
- DoMouseDown(0, m_MinBtnRect, &m_iMinButtonState, point);
- else if (m_ThumbRect.Contains(point))
- DoMouseDown(1, m_ThumbRect, &m_iThumbButtonState, point);
- else if (m_MaxBtnRect.Contains(point))
- DoMouseDown(2, m_MaxBtnRect, &m_iMaxButtonState, point);
- else if (m_MinTrackRect.Contains(point))
- DoMouseDown(3, m_MinTrackRect, &m_iMinTrackState, point);
- else
- DoMouseDown(4, m_MaxTrackRect, &m_iMaxTrackState, point);
+ track_point_ = point;
+ last_track_pos_ = track_pos_;
+ if (min_btn_rect_.Contains(point)) {
+ DoMouseDown(0, min_btn_rect_, &min_button_state_, point);
+ } else if (thumb_rect_.Contains(point)) {
+ DoMouseDown(1, thumb_rect_, &thumb_button_state_, point);
+ } else if (max_btn_rect_.Contains(point)) {
+ DoMouseDown(2, max_btn_rect_, &max_button_state_, point);
+ } else if (min_track_rect_.Contains(point)) {
+ DoMouseDown(3, min_track_rect_, &min_track_state_, point);
+ } else {
+ DoMouseDown(4, max_track_rect_, &max_track_state_, point);
+ }
if (!SendEvent()) {
- m_pTimer = std::make_unique<CFX_Timer>(GetFWLApp()->GetTimerHandler(), this,
- kScrollbarElapsedMsecs);
+ timer_ = std::make_unique<CFX_Timer>(GetFWLApp()->GetTimerHandler(), this,
+ kScrollbarElapsedMsecs);
}
}
void CFWL_ScrollBar::OnLButtonUp(const CFX_PointF& point) {
- m_pTimer.reset();
- m_bMouseDown = false;
- DoMouseUp(0, m_MinBtnRect, &m_iMinButtonState, point);
- DoMouseUp(1, m_ThumbRect, &m_iThumbButtonState, point);
- DoMouseUp(2, m_MaxBtnRect, &m_iMaxButtonState, point);
- DoMouseUp(3, m_MinTrackRect, &m_iMinTrackState, point);
- DoMouseUp(4, m_MaxTrackRect, &m_iMaxTrackState, point);
+ timer_.reset();
+ mouse_down_ = false;
+ DoMouseUp(0, min_btn_rect_, &min_button_state_, point);
+ DoMouseUp(1, thumb_rect_, &thumb_button_state_, point);
+ DoMouseUp(2, max_btn_rect_, &max_button_state_, point);
+ DoMouseUp(3, min_track_rect_, &min_track_state_, point);
+ DoMouseUp(4, max_track_rect_, &max_track_state_, point);
SetGrab(false);
}
void CFWL_ScrollBar::OnMouseMove(const CFX_PointF& point) {
- DoMouseMove(0, m_MinBtnRect, &m_iMinButtonState, point);
- DoMouseMove(1, m_ThumbRect, &m_iThumbButtonState, point);
- DoMouseMove(2, m_MaxBtnRect, &m_iMaxButtonState, point);
- DoMouseMove(3, m_MinTrackRect, &m_iMinTrackState, point);
- DoMouseMove(4, m_MaxTrackRect, &m_iMaxTrackState, point);
+ DoMouseMove(0, min_btn_rect_, &min_button_state_, point);
+ DoMouseMove(1, thumb_rect_, &thumb_button_state_, point);
+ DoMouseMove(2, max_btn_rect_, &max_button_state_, point);
+ DoMouseMove(3, min_track_rect_, &min_track_state_, point);
+ DoMouseMove(4, max_track_rect_, &max_track_state_, point);
}
void CFWL_ScrollBar::OnMouseLeave() {
- DoMouseLeave(0, m_MinBtnRect, &m_iMinButtonState);
- DoMouseLeave(1, m_ThumbRect, &m_iThumbButtonState);
- DoMouseLeave(2, m_MaxBtnRect, &m_iMaxButtonState);
- DoMouseLeave(3, m_MinTrackRect, &m_iMinTrackState);
- DoMouseLeave(4, m_MaxTrackRect, &m_iMaxTrackState);
+ DoMouseLeave(0, min_btn_rect_, &min_button_state_);
+ DoMouseLeave(1, thumb_rect_, &thumb_button_state_);
+ DoMouseLeave(2, max_btn_rect_, &max_button_state_);
+ DoMouseLeave(3, min_track_rect_, &min_track_state_);
+ DoMouseLeave(4, max_track_rect_, &max_track_state_);
}
void CFWL_ScrollBar::OnMouseWheel(const CFX_Vector& delta) {
- m_iMouseWheel = delta.y;
+ mouse_wheel_ = delta.y;
SendEvent();
- m_iMouseWheel = 0;
+ mouse_wheel_ = 0;
}
void CFWL_ScrollBar::DoMouseDown(int32_t iItem,
@@ -418,14 +422,14 @@
*pState = iNewState;
RepaintRect(rtItem);
- OnScroll(CFWL_EventScroll::Code::EndScroll, m_fTrackPos);
+ OnScroll(CFWL_EventScroll::Code::EndScroll, track_pos_);
}
void CFWL_ScrollBar::DoMouseMove(int32_t iItem,
const CFX_RectF& rtItem,
CFWL_PartState* pState,
const CFX_PointF& point) {
- if (!m_bMouseDown) {
+ if (!mouse_down_) {
CFWL_PartState iNewState = rtItem.Contains(point) ? CFWL_PartState::kHovered
: CFWL_PartState::kNormal;
if (*pState == iNewState)
@@ -434,9 +438,9 @@
*pState = iNewState;
RepaintRect(rtItem);
} else if ((2 == iItem) &&
- (m_iThumbButtonState == CFWL_PartState::kPressed)) {
- m_fTrackPos = GetTrackPointPos(point);
- OnScroll(CFWL_EventScroll::Code::TrackPos, m_fTrackPos);
+ (thumb_button_state_ == CFWL_PartState::kPressed)) {
+ track_pos_ = GetTrackPointPos(point);
+ OnScroll(CFWL_EventScroll::Code::TrackPos, track_pos_);
}
}
@@ -461,9 +465,9 @@
}
void CFWL_ScrollBar::OnTimerFired() {
- m_pTimer.reset();
+ timer_.reset();
if (!SendEvent()) {
- m_pTimer =
+ timer_ =
std::make_unique<CFX_Timer>(GetFWLApp()->GetTimerHandler(), this, 0);
}
}
diff --git a/xfa/fwl/cfwl_scrollbar.h b/xfa/fwl/cfwl_scrollbar.h
index 9af8517..41d7137 100644
--- a/xfa/fwl/cfwl_scrollbar.h
+++ b/xfa/fwl/cfwl_scrollbar.h
@@ -41,19 +41,19 @@
void OnTimerFired() override;
void GetRange(float* fMin, float* fMax) const {
- *fMin = m_fRangeMin;
- *fMax = m_fRangeMax;
+ *fMin = range_min_;
+ *fMax = range_max_;
}
void SetRange(float fMin, float fMax) {
- m_fRangeMin = fMin;
- m_fRangeMax = fMax;
+ range_min_ = fMin;
+ range_max_ = fMax;
}
- float GetPageSize() const { return m_fPageSize; }
- void SetPageSize(float fPageSize) { m_fPageSize = fPageSize; }
- float GetStepSize() const { return m_fStepSize; }
- void SetStepSize(float fStepSize) { m_fStepSize = fStepSize; }
- float GetPos() const { return m_fPos; }
- void SetPos(float fPos) { m_fPos = fPos; }
+ float GetPageSize() const { return page_size_; }
+ void SetPageSize(float fPageSize) { page_size_ = fPageSize; }
+ float GetStepSize() const { return step_size_; }
+ void SetStepSize(float fStepSize) { step_size_ = fStepSize; }
+ float GetPos() const { return pos_; }
+ void SetPos(float fPos) { pos_ = fPos; }
void SetTrackPos(float fTrackPos);
private:
@@ -103,30 +103,30 @@
const CFX_RectF& rtItem,
CFWL_PartState* pState);
- float m_fRangeMin = 0.0f;
- float m_fRangeMax = -1.0f;
- float m_fPageSize = 0.0f;
- float m_fStepSize = 0.0f;
- float m_fPos = 0.0f;
- float m_fTrackPos = 0.0f;
- CFWL_PartState m_iMinButtonState = CFWL_PartState::kNormal;
- CFWL_PartState m_iMaxButtonState = CFWL_PartState::kNormal;
- CFWL_PartState m_iThumbButtonState = CFWL_PartState::kNormal;
- CFWL_PartState m_iMinTrackState = CFWL_PartState::kNormal;
- CFWL_PartState m_iMaxTrackState = CFWL_PartState::kNormal;
- float m_fLastTrackPos = 0.0f;
- CFX_PointF m_cpTrackPoint;
- int32_t m_iMouseWheel = 0;
- float m_fButtonLen = 0.0f;
- bool m_bMouseDown = false;
- bool m_bMinSize = false;
- CFX_RectF m_ClientRect;
- CFX_RectF m_ThumbRect;
- CFX_RectF m_MinBtnRect;
- CFX_RectF m_MaxBtnRect;
- CFX_RectF m_MinTrackRect;
- CFX_RectF m_MaxTrackRect;
- std::unique_ptr<CFX_Timer> m_pTimer;
+ float range_min_ = 0.0f;
+ float range_max_ = -1.0f;
+ float page_size_ = 0.0f;
+ float step_size_ = 0.0f;
+ float pos_ = 0.0f;
+ float track_pos_ = 0.0f;
+ CFWL_PartState min_button_state_ = CFWL_PartState::kNormal;
+ CFWL_PartState max_button_state_ = CFWL_PartState::kNormal;
+ CFWL_PartState thumb_button_state_ = CFWL_PartState::kNormal;
+ CFWL_PartState min_track_state_ = CFWL_PartState::kNormal;
+ CFWL_PartState max_track_state_ = CFWL_PartState::kNormal;
+ float last_track_pos_ = 0.0f;
+ CFX_PointF track_point_;
+ int32_t mouse_wheel_ = 0;
+ float button_len_ = 0.0f;
+ bool mouse_down_ = false;
+ bool min_size_ = false;
+ CFX_RectF client_rect_;
+ CFX_RectF thumb_rect_;
+ CFX_RectF min_btn_rect_;
+ CFX_RectF max_btn_rect_;
+ CFX_RectF min_track_rect_;
+ CFX_RectF max_track_rect_;
+ std::unique_ptr<CFX_Timer> timer_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_themebackground.cpp b/xfa/fwl/cfwl_themebackground.cpp
index b883a04..66554f3 100644
--- a/xfa/fwl/cfwl_themebackground.cpp
+++ b/xfa/fwl/cfwl_themebackground.cpp
@@ -11,7 +11,7 @@
CFWL_ThemeBackground::CFWL_ThemeBackground(Part iPart,
CFWL_Widget* pWidget,
CFGAS_GEGraphics* pGraphics)
- : CFWL_ThemePart(iPart, pWidget), m_pGraphics(pGraphics) {}
+ : CFWL_ThemePart(iPart, pWidget), graphics_(pGraphics) {}
CFWL_ThemeBackground::~CFWL_ThemeBackground() = default;
diff --git a/xfa/fwl/cfwl_themebackground.h b/xfa/fwl/cfwl_themebackground.h
index b376078..91ae1a2 100644
--- a/xfa/fwl/cfwl_themebackground.h
+++ b/xfa/fwl/cfwl_themebackground.h
@@ -25,13 +25,13 @@
CFGAS_GEGraphics* pGraphics);
~CFWL_ThemeBackground();
- CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics; }
- const CFGAS_GEPath* GetPath() const { return m_pPath; }
- void SetPath(const CFGAS_GEPath* pPath) { m_pPath = pPath; }
+ CFGAS_GEGraphics* GetGraphics() const { return graphics_; }
+ const CFGAS_GEPath* GetPath() const { return path_; }
+ void SetPath(const CFGAS_GEPath* pPath) { path_ = pPath; }
private:
- UnownedPtr<const CFGAS_GEPath> m_pPath;
- UnownedPtr<CFGAS_GEGraphics> const m_pGraphics;
+ UnownedPtr<const CFGAS_GEPath> path_;
+ UnownedPtr<CFGAS_GEGraphics> const graphics_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_themepart.cpp b/xfa/fwl/cfwl_themepart.cpp
index 70cafbb..5a58188 100644
--- a/xfa/fwl/cfwl_themepart.cpp
+++ b/xfa/fwl/cfwl_themepart.cpp
@@ -9,17 +9,20 @@
namespace pdfium {
CFWL_ThemePart::CFWL_ThemePart(Part iPart, CFWL_Widget* pWidget)
- : m_iPart(iPart), m_pWidget(pWidget) {}
+ : part_(iPart), widget_(pWidget) {}
CFWL_ThemePart::~CFWL_ThemePart() = default;
FWLTHEME_STATE CFWL_ThemePart::GetThemeState() const {
- if (m_dwStates & CFWL_PartState::kDisabled)
+ if (states_ & CFWL_PartState::kDisabled) {
return FWLTHEME_STATE::kDisable;
- if (m_dwStates & CFWL_PartState::kPressed)
+ }
+ if (states_ & CFWL_PartState::kPressed) {
return FWLTHEME_STATE::kPressed;
- if (m_dwStates & CFWL_PartState::kHovered)
+ }
+ if (states_ & CFWL_PartState::kHovered) {
return FWLTHEME_STATE::kHover;
+ }
return FWLTHEME_STATE::kNormal;
}
diff --git a/xfa/fwl/cfwl_themepart.h b/xfa/fwl/cfwl_themepart.h
index cf271a0..c08f965 100644
--- a/xfa/fwl/cfwl_themepart.h
+++ b/xfa/fwl/cfwl_themepart.h
@@ -89,20 +89,20 @@
CFWL_ThemePart(Part iPart, CFWL_Widget* pWidget);
~CFWL_ThemePart();
- Part GetPart() const { return m_iPart; }
- CFWL_Widget* GetWidget() const { return m_pWidget; }
+ Part GetPart() const { return part_; }
+ CFWL_Widget* GetWidget() const { return widget_; }
FWLTHEME_STATE GetThemeState() const;
- CFX_Matrix m_matrix;
- CFX_RectF m_PartRect;
- UnownedPtr<const CFX_RectF> m_pRtData;
- Mask<CFWL_PartState> m_dwStates = CFWL_PartState::kNormal;
- bool m_bMaximize = false;
- bool m_bStaticBackground = false;
+ CFX_Matrix matrix_;
+ CFX_RectF part_rect_;
+ UnownedPtr<const CFX_RectF> data_rect_;
+ Mask<CFWL_PartState> states_ = CFWL_PartState::kNormal;
+ bool maximize_ = false;
+ bool static_background_ = false;
private:
- const Part m_iPart;
- UnownedPtr<CFWL_Widget> const m_pWidget;
+ const Part part_;
+ UnownedPtr<CFWL_Widget> const widget_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_themetext.cpp b/xfa/fwl/cfwl_themetext.cpp
index ce65a11..82f09a2 100644
--- a/xfa/fwl/cfwl_themetext.cpp
+++ b/xfa/fwl/cfwl_themetext.cpp
@@ -11,7 +11,7 @@
CFWL_ThemeText::CFWL_ThemeText(Part iPart,
CFWL_Widget* pWidget,
CFGAS_GEGraphics* pGraphics)
- : CFWL_ThemePart(iPart, pWidget), m_pGraphics(pGraphics) {}
+ : CFWL_ThemePart(iPart, pWidget), graphics_(pGraphics) {}
CFWL_ThemeText::~CFWL_ThemeText() = default;
diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h
index 2b06c8c..05f8462 100644
--- a/xfa/fwl/cfwl_themetext.h
+++ b/xfa/fwl/cfwl_themetext.h
@@ -24,14 +24,14 @@
CFWL_ThemeText(Part iPart, CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics);
~CFWL_ThemeText();
- CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics; }
+ CFGAS_GEGraphics* GetGraphics() const { return graphics_; }
- FDE_TextAlignment m_iTTOAlign = FDE_TextAlignment::kTopLeft;
- FDE_TextStyle m_dwTTOStyles;
- WideString m_wsText;
+ FDE_TextAlignment tto_align_ = FDE_TextAlignment::kTopLeft;
+ FDE_TextStyle tto_styles_;
+ WideString text_;
private:
- UnownedPtr<CFGAS_GEGraphics> const m_pGraphics;
+ UnownedPtr<CFGAS_GEGraphics> const graphics_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index f0d4d9a..89e8b13 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -42,11 +42,11 @@
CFWL_Widget::CFWL_Widget(CFWL_App* app,
const Properties& properties,
CFWL_Widget* pOuter)
- : m_Properties(properties),
- m_pFWLApp(app),
- m_pWidgetMgr(app->GetWidgetMgr()),
- m_pOuter(pOuter) {
- m_pWidgetMgr->InsertWidget(m_pOuter, this);
+ : properties_(properties),
+ fwlapp_(app),
+ widget_mgr_(app->GetWidgetMgr()),
+ outer_(pOuter) {
+ widget_mgr_->InsertWidget(outer_, this);
}
CFWL_Widget::~CFWL_Widget() = default;
@@ -54,15 +54,15 @@
void CFWL_Widget::PreFinalize() {
CHECK(!IsLocked()); // Prefer hard stop to UaF.
NotifyDriver();
- m_pWidgetMgr->RemoveWidget(this);
+ widget_mgr_->RemoveWidget(this);
}
void CFWL_Widget::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pAdapterIface);
- visitor->Trace(m_pFWLApp);
- visitor->Trace(m_pWidgetMgr);
- visitor->Trace(m_pDelegate);
- visitor->Trace(m_pOuter);
+ visitor->Trace(adapter_iface_);
+ visitor->Trace(fwlapp_);
+ visitor->Trace(widget_mgr_);
+ visitor->Trace(delegate_);
+ visitor->Trace(outer_);
}
bool CFWL_Widget::IsForm() const {
@@ -74,7 +74,7 @@
}
CFX_RectF CFWL_Widget::GetWidgetRect() {
- return m_WidgetRect;
+ return widget_rect_;
}
void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) {
@@ -86,7 +86,7 @@
}
void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
- m_WidgetRect = rect;
+ widget_rect_ = rect;
}
CFX_RectF CFWL_Widget::GetClientRect() {
@@ -95,14 +95,14 @@
void CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
uint32_t dwStylesRemoved) {
- m_Properties.m_dwStyles &= ~dwStylesRemoved;
- m_Properties.m_dwStyles |= dwStylesAdded;
+ properties_.styles_ &= ~dwStylesRemoved;
+ properties_.styles_ |= dwStylesAdded;
}
void CFWL_Widget::ModifyStyleExts(uint32_t dwStyleExtsAdded,
uint32_t dwStyleExtsRemoved) {
- m_Properties.m_dwStyleExts &= ~dwStyleExtsRemoved;
- m_Properties.m_dwStyleExts |= dwStyleExtsAdded;
+ properties_.style_exts_ &= ~dwStyleExtsRemoved;
+ properties_.style_exts_ |= dwStyleExtsAdded;
}
static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr,
@@ -117,7 +117,7 @@
}
void CFWL_Widget::SetStates(uint32_t dwStates) {
- m_Properties.m_dwStates |= dwStates;
+ properties_.states_ |= dwStates;
if (IsVisible())
return;
@@ -134,7 +134,7 @@
}
void CFWL_Widget::RemoveStates(uint32_t dwStates) {
- m_Properties.m_dwStates &= ~dwStates;
+ properties_.states_ &= ~dwStates;
}
FWL_WidgetHit CFWL_Widget::HitTest(const CFX_PointF& point) {
@@ -179,28 +179,28 @@
}
bool CFWL_Widget::IsEnabled() const {
- return (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled) == 0;
+ return (properties_.states_ & FWL_STATE_WGT_Disabled) == 0;
}
bool CFWL_Widget::HasBorder() const {
- return !!(m_Properties.m_dwStyles & FWL_STYLE_WGT_Border);
+ return !!(properties_.styles_ & FWL_STYLE_WGT_Border);
}
bool CFWL_Widget::IsVisible() const {
- return !(m_Properties.m_dwStates & FWL_STATE_WGT_Invisible);
+ return !(properties_.states_ & FWL_STATE_WGT_Invisible);
}
bool CFWL_Widget::IsOverLapper() const {
- return (m_Properties.m_dwStyles & FWL_STYLE_WGT_WindowTypeMask) ==
+ return (properties_.styles_ & FWL_STYLE_WGT_WindowTypeMask) ==
FWL_STYLE_WGT_OverLapper;
}
bool CFWL_Widget::IsPopup() const {
- return !!(m_Properties.m_dwStyles & FWL_STYLE_WGT_Popup);
+ return !!(properties_.styles_ & FWL_STYLE_WGT_Popup);
}
bool CFWL_Widget::IsChild() const {
- return !!(m_Properties.m_dwStyles & FWL_STYLE_WGT_Child);
+ return !!(properties_.styles_ & FWL_STYLE_WGT_Child);
}
CFWL_Widget* CFWL_Widget::GetOutmost() const {
@@ -211,7 +211,7 @@
}
CFX_RectF CFWL_Widget::GetEdgeRect() const {
- CFX_RectF rtEdge(0, 0, m_WidgetRect.width, m_WidgetRect.height);
+ CFX_RectF rtEdge(0, 0, widget_rect_.width, widget_rect_.height);
if (HasBorder())
rtEdge.Deflate(GetCXBorderSize(), GetCYBorderSize());
return rtEdge;
@@ -226,18 +226,18 @@
}
CFX_RectF CFWL_Widget::GetRelativeRect() const {
- return CFX_RectF(0, 0, m_WidgetRect.width, m_WidgetRect.height);
+ return CFX_RectF(0, 0, widget_rect_.width, widget_rect_.height);
}
CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText, bool bMultiLine) {
CFWL_ThemeText calPart(CFWL_ThemePart::Part::kNone, this, nullptr);
- calPart.m_wsText = wsText;
+ calPart.text_ = wsText;
if (bMultiLine)
- calPart.m_dwTTOStyles.line_wrap_ = true;
+ calPart.tto_styles_.line_wrap_ = true;
else
- calPart.m_dwTTOStyles.single_line_ = true;
+ calPart.tto_styles_.single_line_ = true;
- calPart.m_iTTOAlign = FDE_TextAlignment::kTopLeft;
+ calPart.tto_align_ = FDE_TextAlignment::kTopLeft;
float fWidth = bMultiLine ? kCalcMultiLineDefWidth : kCalcWidth;
CFX_RectF rect(0, 0, fWidth, kCalcHeight);
GetThemeProvider()->CalcTextRect(calPart, &rect);
@@ -249,9 +249,9 @@
FDE_TextAlignment iTTOAlign,
CFX_RectF* pRect) {
CFWL_ThemeText calPart(CFWL_ThemePart::Part::kNone, this, nullptr);
- calPart.m_wsText = wsText;
- calPart.m_dwTTOStyles = dwTTOStyles;
- calPart.m_iTTOAlign = iTTOAlign;
+ calPart.text_ = wsText;
+ calPart.tto_styles_ = dwTTOStyles;
+ calPart.tto_align_ = iTTOAlign;
GetThemeProvider()->CalcTextRect(calPart, pRect);
}
@@ -266,8 +266,8 @@
}
void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
- if (m_pOuter) {
- m_pOuter->GetDelegate()->OnProcessEvent(pEvent);
+ if (outer_) {
+ outer_->GetDelegate()->OnProcessEvent(pEvent);
return;
}
CFWL_NoteDriver* pNoteDriver = GetFWLApp()->GetNoteDriver();
@@ -275,15 +275,15 @@
}
void CFWL_Widget::RepaintRect(const CFX_RectF& pRect) {
- m_pWidgetMgr->RepaintWidget(this, pRect);
+ widget_mgr_->RepaintWidget(this, pRect);
}
void CFWL_Widget::DrawBackground(CFGAS_GEGraphics* pGraphics,
CFWL_ThemePart::Part iPartBk,
const CFX_Matrix& mtMatrix) {
CFWL_ThemeBackground param(iPartBk, this, pGraphics);
- param.m_matrix = mtMatrix;
- param.m_PartRect = GetRelativeRect();
+ param.matrix_ = mtMatrix;
+ param.part_rect_ = GetRelativeRect();
GetThemeProvider()->DrawBackground(param);
}
@@ -291,8 +291,8 @@
CFWL_ThemePart::Part iPartBorder,
const CFX_Matrix& matrix) {
CFWL_ThemeBackground param(iPartBorder, this, pGraphics);
- param.m_matrix = matrix;
- param.m_PartRect = GetRelativeRect();
+ param.matrix_ = matrix;
+ param.part_rect_ = GetRelativeRect();
GetThemeProvider()->DrawBackground(param);
}
@@ -305,7 +305,7 @@
if (pParent == this)
return CFX_SizeF();
- CFX_SizeF szRet(m_WidgetRect.left, m_WidgetRect.top);
+ CFX_SizeF szRet(widget_rect_.left, widget_rect_.top);
CFWL_WidgetMgr* pWidgetMgr = GetFWLApp()->GetWidgetMgr();
CFWL_Widget* pDstWidget = GetParent();
while (pDstWidget && pDstWidget != pParent) {
@@ -334,7 +334,7 @@
switch (pMessage->GetType()) {
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsgMouse = static_cast<CFWL_MessageMouse*>(pMessage);
- CFWL_EventMouse evt(pWidget, pWidget, pMsgMouse->m_dwCmd);
+ CFWL_EventMouse evt(pWidget, pWidget, pMsgMouse->cmd_);
pWidget->DispatchEvent(&evt);
break;
}
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index ec68939..953432d 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -81,9 +81,9 @@
class Properties {
public:
- uint32_t m_dwStyles = FWL_STYLE_WGT_Child; // Mask of FWL_STYLE_*_*.
- uint32_t m_dwStyleExts = 0; // Mask of FWL_STYLEEXT_*_*.
- uint32_t m_dwStates = 0; // Mask of FWL_STATE_*_*.
+ uint32_t styles_ = FWL_STYLE_WGT_Child; // Mask of FWL_STYLE_*_*.
+ uint32_t style_exts_ = 0; // Mask of FWL_STYLEEXT_*_*.
+ uint32_t states_ = 0; // Mask of FWL_STATE_*_*.
};
class ScopedUpdateLock {
@@ -129,38 +129,38 @@
bool IsPopup() const;
bool IsChild() const;
- CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr; }
- CFWL_Widget* GetOuter() const { return m_pOuter; }
+ CFWL_WidgetMgr* GetWidgetMgr() const { return widget_mgr_; }
+ CFWL_Widget* GetOuter() const { return outer_; }
CFWL_Widget* GetOutmost() const;
void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved);
- uint32_t GetStyleExts() const { return m_Properties.m_dwStyleExts; }
- uint32_t GetStates() const { return m_Properties.m_dwStates; }
+ uint32_t GetStyleExts() const { return properties_.style_exts_; }
+ uint32_t GetStates() const { return properties_.states_; }
CFX_PointF TransformTo(CFWL_Widget* pWidget, const CFX_PointF& point);
CFX_Matrix GetMatrix() const;
IFWL_ThemeProvider* GetThemeProvider() const;
- void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; }
+ void SetDelegate(IFWL_WidgetDelegate* delegate) { delegate_ = delegate; }
IFWL_WidgetDelegate* GetDelegate() {
- return m_pDelegate ? m_pDelegate.Get() : this;
+ return delegate_ ? delegate_.Get() : this;
}
const IFWL_WidgetDelegate* GetDelegate() const {
- return m_pDelegate ? m_pDelegate.Get() : this;
+ return delegate_ ? delegate_.Get() : this;
}
- CFWL_App* GetFWLApp() const { return m_pFWLApp; }
- uint64_t GetEventKey() const { return m_nEventKey; }
- void SetEventKey(uint64_t key) { m_nEventKey = key; }
+ CFWL_App* GetFWLApp() const { return fwlapp_; }
+ uint64_t GetEventKey() const { return event_key_; }
+ void SetEventKey(uint64_t key) { event_key_ = key; }
- AdapterIface* GetAdapterIface() const { return m_pAdapterIface; }
- void SetAdapterIface(AdapterIface* pItem) { m_pAdapterIface = pItem; }
+ AdapterIface* GetAdapterIface() const { return adapter_iface_; }
+ void SetAdapterIface(AdapterIface* pItem) { adapter_iface_ = pItem; }
void RepaintRect(const CFX_RectF& pRect);
protected:
CFWL_Widget(CFWL_App* app, const Properties& properties, CFWL_Widget* pOuter);
bool IsEnabled() const;
- bool IsLocked() const { return m_iLock > 0; }
+ bool IsLocked() const { return lock_ > 0; }
bool HasBorder() const;
CFX_RectF GetEdgeRect() const;
float GetCXBorderSize() const;
@@ -178,17 +178,17 @@
CFWL_ThemePart::Part iPartBorder,
const CFX_Matrix& pMatrix);
- Properties m_Properties;
- CFX_RectF m_WidgetRect;
+ Properties properties_;
+ CFX_RectF widget_rect_;
private:
- void LockUpdate() { m_iLock++; }
+ void LockUpdate() { lock_++; }
void UnlockUpdate() {
if (IsLocked())
- m_iLock--;
+ lock_--;
}
- CFWL_Widget* GetParent() const { return m_pWidgetMgr->GetParentWidget(this); }
+ CFWL_Widget* GetParent() const { return widget_mgr_->GetParentWidget(this); }
CFX_SizeF GetOffsetFromParent(CFWL_Widget* pParent);
void DrawBackground(CFGAS_GEGraphics* pGraphics,
CFWL_ThemePart::Part iPartBk,
@@ -196,13 +196,13 @@
void NotifyDriver();
bool IsParent(CFWL_Widget* pParent);
- int32_t m_iLock = 0;
- uint64_t m_nEventKey = 0;
- cppgc::Member<AdapterIface> m_pAdapterIface;
- cppgc::Member<CFWL_App> const m_pFWLApp;
- cppgc::Member<CFWL_WidgetMgr> const m_pWidgetMgr;
- cppgc::Member<IFWL_WidgetDelegate> m_pDelegate;
- cppgc::Member<CFWL_Widget> const m_pOuter;
+ int32_t lock_ = 0;
+ uint64_t event_key_ = 0;
+ cppgc::Member<AdapterIface> adapter_iface_;
+ cppgc::Member<CFWL_App> const fwlapp_;
+ cppgc::Member<CFWL_WidgetMgr> const widget_mgr_;
+ cppgc::Member<IFWL_WidgetDelegate> delegate_;
+ cppgc::Member<CFWL_Widget> const outer_;
};
} // namespace pdfium
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 554b729..92f93e3 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -17,18 +17,18 @@
namespace pdfium {
CFWL_WidgetMgr::CFWL_WidgetMgr(AdapterIface* pAdapter, CFWL_App* pApp)
- : m_pAdapter(pAdapter), m_pApp(pApp) {
- DCHECK(m_pAdapter);
- m_mapWidgetItem[nullptr] = cppgc::MakeGarbageCollected<Item>(
+ : adapter_(pAdapter), app_(pApp) {
+ DCHECK(adapter_);
+ map_widget_item_[nullptr] = cppgc::MakeGarbageCollected<Item>(
pApp->GetHeap()->GetAllocationHandle(), nullptr);
}
CFWL_WidgetMgr::~CFWL_WidgetMgr() = default;
void CFWL_WidgetMgr::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pApp);
- visitor->Trace(m_pAdapter);
- ContainerTrace(visitor, m_mapWidgetItem);
+ visitor->Trace(app_);
+ visitor->Trace(adapter_);
+ ContainerTrace(visitor, map_widget_item_);
}
CFWL_Widget* CFWL_WidgetMgr::GetParentWidget(const CFWL_Widget* pWidget) const {
@@ -88,7 +88,7 @@
pNative = pOuter;
pOuter = pOuter->GetOuter();
}
- m_pAdapter->RepaintWidget(pNative);
+ adapter_->RepaintWidget(pNative);
}
void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild) {
@@ -113,7 +113,7 @@
RemoveWidget(pItem->GetFirstChild()->pWidget);
pItem->RemoveSelfIfParented();
- m_mapWidgetItem.erase(pWidget);
+ map_widget_item_.erase(pWidget);
}
CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
@@ -162,15 +162,15 @@
CFWL_WidgetMgr::Item* CFWL_WidgetMgr::GetWidgetMgrItem(
const CFWL_Widget* pWidget) const {
- auto it = m_mapWidgetItem.find(pWidget);
- return it != m_mapWidgetItem.end() ? it->second : nullptr;
+ auto it = map_widget_item_.find(pWidget);
+ return it != map_widget_item_.end() ? it->second : nullptr;
}
CFWL_WidgetMgr::Item* CFWL_WidgetMgr::CreateWidgetMgrItem(
CFWL_Widget* pWidget) {
auto* pItem = cppgc::MakeGarbageCollected<Item>(
- m_pApp->GetHeap()->GetAllocationHandle(), pWidget);
- m_mapWidgetItem[pWidget] = pItem;
+ app_->GetHeap()->GetAllocationHandle(), pWidget);
+ map_widget_item_[pWidget] = pItem;
return pItem;
}
@@ -179,8 +179,7 @@
float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF* pPopupRect) const {
- m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor,
- pPopupRect);
+ adapter_->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, pPopupRect);
}
void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) {
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 2f0efd6..6d9028c 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -95,10 +95,10 @@
CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& mtMatrix);
- cppgc::Member<AdapterIface> const m_pAdapter;
- cppgc::Member<CFWL_App> const m_pApp;
+ cppgc::Member<AdapterIface> const adapter_;
+ cppgc::Member<CFWL_App> const app_;
std::map<cppgc::Member<const CFWL_Widget>, cppgc::Member<Item>>
- m_mapWidgetItem;
+ map_widget_item_;
};
} // namespace pdfium
diff --git a/xfa/fwl/ifwl_themeprovider.cpp b/xfa/fwl/ifwl_themeprovider.cpp
index 686032e..0bae463 100644
--- a/xfa/fwl/ifwl_themeprovider.cpp
+++ b/xfa/fwl/ifwl_themeprovider.cpp
@@ -22,69 +22,69 @@
namespace pdfium {
IFWL_ThemeProvider::IFWL_ThemeProvider(cppgc::Heap* pHeap)
- : m_pCheckBoxTP(cppgc::MakeGarbageCollected<CFWL_CheckBoxTP>(
+ : check_box_tp_(cppgc::MakeGarbageCollected<CFWL_CheckBoxTP>(
pHeap->GetAllocationHandle())),
- m_pListBoxTP(cppgc::MakeGarbageCollected<CFWL_ListBoxTP>(
+ list_box_tp_(cppgc::MakeGarbageCollected<CFWL_ListBoxTP>(
pHeap->GetAllocationHandle())),
- m_pPictureBoxTP(cppgc::MakeGarbageCollected<CFWL_PictureBoxTP>(
+ picture_box_tp_(cppgc::MakeGarbageCollected<CFWL_PictureBoxTP>(
pHeap->GetAllocationHandle())),
- m_pSrollBarTP(cppgc::MakeGarbageCollected<CFWL_ScrollBarTP>(
+ sroll_bar_tp_(cppgc::MakeGarbageCollected<CFWL_ScrollBarTP>(
pHeap->GetAllocationHandle())),
- m_pEditTP(cppgc::MakeGarbageCollected<CFWL_EditTP>(
+ edit_tp_(cppgc::MakeGarbageCollected<CFWL_EditTP>(
pHeap->GetAllocationHandle())),
- m_pComboBoxTP(cppgc::MakeGarbageCollected<CFWL_ComboBoxTP>(
+ combo_box_tp_(cppgc::MakeGarbageCollected<CFWL_ComboBoxTP>(
pHeap->GetAllocationHandle())),
- m_pMonthCalendarTP(cppgc::MakeGarbageCollected<CFWL_MonthCalendarTP>(
+ month_calendar_tp_(cppgc::MakeGarbageCollected<CFWL_MonthCalendarTP>(
pHeap->GetAllocationHandle())),
- m_pDateTimePickerTP(cppgc::MakeGarbageCollected<CFWL_DateTimePickerTP>(
+ date_time_picker_tp_(cppgc::MakeGarbageCollected<CFWL_DateTimePickerTP>(
pHeap->GetAllocationHandle())),
- m_pPushButtonTP(cppgc::MakeGarbageCollected<CFWL_PushButtonTP>(
+ push_button_tp_(cppgc::MakeGarbageCollected<CFWL_PushButtonTP>(
pHeap->GetAllocationHandle())),
- m_pCaretTP(cppgc::MakeGarbageCollected<CFWL_CaretTP>(
+ caret_tp_(cppgc::MakeGarbageCollected<CFWL_CaretTP>(
pHeap->GetAllocationHandle())),
- m_pBarcodeTP(cppgc::MakeGarbageCollected<CFWL_BarcodeTP>(
+ barcode_tp_(cppgc::MakeGarbageCollected<CFWL_BarcodeTP>(
pHeap->GetAllocationHandle())) {}
IFWL_ThemeProvider::~IFWL_ThemeProvider() = default;
void IFWL_ThemeProvider::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pCheckBoxTP);
- visitor->Trace(m_pListBoxTP);
- visitor->Trace(m_pPictureBoxTP);
- visitor->Trace(m_pSrollBarTP);
- visitor->Trace(m_pEditTP);
- visitor->Trace(m_pComboBoxTP);
- visitor->Trace(m_pMonthCalendarTP);
- visitor->Trace(m_pDateTimePickerTP);
- visitor->Trace(m_pPushButtonTP);
- visitor->Trace(m_pCaretTP);
- visitor->Trace(m_pBarcodeTP);
+ visitor->Trace(check_box_tp_);
+ visitor->Trace(list_box_tp_);
+ visitor->Trace(picture_box_tp_);
+ visitor->Trace(sroll_bar_tp_);
+ visitor->Trace(edit_tp_);
+ visitor->Trace(combo_box_tp_);
+ visitor->Trace(month_calendar_tp_);
+ visitor->Trace(date_time_picker_tp_);
+ visitor->Trace(push_button_tp_);
+ visitor->Trace(caret_tp_);
+ visitor->Trace(barcode_tp_);
}
CFWL_WidgetTP* IFWL_ThemeProvider::GetTheme(const CFWL_Widget* pWidget) const {
switch (pWidget->GetClassID()) {
case FWL_Type::CheckBox:
- return m_pCheckBoxTP;
+ return check_box_tp_;
case FWL_Type::ListBox:
- return m_pListBoxTP;
+ return list_box_tp_;
case FWL_Type::PictureBox:
- return m_pPictureBoxTP;
+ return picture_box_tp_;
case FWL_Type::ScrollBar:
- return m_pSrollBarTP;
+ return sroll_bar_tp_;
case FWL_Type::Edit:
- return m_pEditTP;
+ return edit_tp_;
case FWL_Type::ComboBox:
- return m_pComboBoxTP;
+ return combo_box_tp_;
case FWL_Type::MonthCalendar:
- return m_pMonthCalendarTP;
+ return month_calendar_tp_;
case FWL_Type::DateTimePicker:
- return m_pDateTimePickerTP;
+ return date_time_picker_tp_;
case FWL_Type::PushButton:
- return m_pPushButtonTP;
+ return push_button_tp_;
case FWL_Type::Caret:
- return m_pCaretTP;
+ return caret_tp_;
case FWL_Type::Barcode:
- return m_pBarcodeTP;
+ return barcode_tp_;
default:
return nullptr;
}
diff --git a/xfa/fwl/ifwl_themeprovider.h b/xfa/fwl/ifwl_themeprovider.h
index 10c12e3..ccb3675 100644
--- a/xfa/fwl/ifwl_themeprovider.h
+++ b/xfa/fwl/ifwl_themeprovider.h
@@ -53,17 +53,17 @@
CFWL_WidgetTP* GetTheme(const CFWL_Widget* pWidget) const;
private:
- cppgc::Member<CFWL_WidgetTP> m_pCheckBoxTP;
- cppgc::Member<CFWL_WidgetTP> m_pListBoxTP;
- cppgc::Member<CFWL_WidgetTP> m_pPictureBoxTP;
- cppgc::Member<CFWL_WidgetTP> m_pSrollBarTP;
- cppgc::Member<CFWL_WidgetTP> m_pEditTP;
- cppgc::Member<CFWL_WidgetTP> m_pComboBoxTP;
- cppgc::Member<CFWL_WidgetTP> m_pMonthCalendarTP;
- cppgc::Member<CFWL_WidgetTP> m_pDateTimePickerTP;
- cppgc::Member<CFWL_WidgetTP> m_pPushButtonTP;
- cppgc::Member<CFWL_WidgetTP> m_pCaretTP;
- cppgc::Member<CFWL_WidgetTP> m_pBarcodeTP;
+ cppgc::Member<CFWL_WidgetTP> check_box_tp_;
+ cppgc::Member<CFWL_WidgetTP> list_box_tp_;
+ cppgc::Member<CFWL_WidgetTP> picture_box_tp_;
+ cppgc::Member<CFWL_WidgetTP> sroll_bar_tp_;
+ cppgc::Member<CFWL_WidgetTP> edit_tp_;
+ cppgc::Member<CFWL_WidgetTP> combo_box_tp_;
+ cppgc::Member<CFWL_WidgetTP> month_calendar_tp_;
+ cppgc::Member<CFWL_WidgetTP> date_time_picker_tp_;
+ cppgc::Member<CFWL_WidgetTP> push_button_tp_;
+ cppgc::Member<CFWL_WidgetTP> caret_tp_;
+ cppgc::Member<CFWL_WidgetTP> barcode_tp_;
};
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index 7f0c0cb..1b4f649 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -19,11 +19,11 @@
void CFWL_BarcodeTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder:
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
case CFWL_ThemePart::Part::kBackground:
- FillBackground(pParams.GetGraphics(), pParams.m_PartRect,
- pParams.m_matrix);
+ FillBackground(pParams.GetGraphics(), pParams.part_rect_,
+ pParams.matrix_);
break;
default:
break;
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index e7a24cf..b3867a2 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -22,11 +22,12 @@
void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBackground: {
- if (!(pParams.m_dwStates & CFWL_PartState::kHightLight))
+ if (!(pParams.states_ & CFWL_PartState::kHightLight)) {
return;
+ }
- DrawCaretBK(pParams.GetGraphics(), pParams.m_dwStates, pParams.m_PartRect,
- pParams.m_matrix);
+ DrawCaretBK(pParams.GetGraphics(), pParams.states_, pParams.part_rect_,
+ pParams.matrix_);
break;
}
default:
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 73436e5..1b50a93 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -42,9 +42,9 @@
void CFWL_CheckBoxTP::DrawText(const CFWL_ThemeText& pParams) {
EnsureTTOInitialized(pParams.GetWidget()->GetThemeProvider());
- m_pTextOut->SetTextColor(pParams.m_dwStates & CFWL_PartState::kDisabled
- ? FWLTHEME_CAPACITY_TextDisColor
- : FWLTHEME_CAPACITY_TextColor);
+ text_out_->SetTextColor(pParams.states_ & CFWL_PartState::kDisabled
+ ? FWLTHEME_CAPACITY_TextDisColor
+ : FWLTHEME_CAPACITY_TextColor);
CFWL_WidgetTP::DrawText(pParams);
}
@@ -53,7 +53,7 @@
FX_ARGB argbFill,
const CFX_Matrix& matrix) {
EnsureCheckPathInitialized(rtSign.width);
- DCHECK(m_pCheckPath);
+ DCHECK(check_path_);
CFX_Matrix mt;
mt.Translate(rtSign.left, rtSign.top);
@@ -61,7 +61,7 @@
CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
- pGraphics->FillPath(*m_pCheckPath, CFX_FillRenderOptions::FillType::kWinding,
+ pGraphics->FillPath(*check_path_, CFX_FillRenderOptions::FillType::kWinding,
mt);
}
@@ -156,10 +156,11 @@
}
void CFWL_CheckBoxTP::EnsureCheckPathInitialized(float fCheckLen) {
- if (m_pCheckPath)
+ if (check_path_) {
return;
+ }
- m_pCheckPath = std::make_unique<CFGAS_GEPath>();
+ check_path_ = std::make_unique<CFGAS_GEPath>();
float fWidth = kSignPath;
float fHeight = -kSignPath;
@@ -181,42 +182,42 @@
CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
- m_pCheckPath->MoveTo(pt1);
+ check_path_->MoveTo(pt1);
CFX_PointF p1 = ScaleBezierPoint(pt12 - pt1);
CFX_PointF p2 = ScaleBezierPoint(pt21 - pt2);
- m_pCheckPath->BezierTo(pt1 + p1, pt2 + p2, pt2);
+ check_path_->BezierTo(pt1 + p1, pt2 + p2, pt2);
p1 = ScaleBezierPoint(pt23 - pt2);
p2 = ScaleBezierPoint(pt32 - pt3);
- m_pCheckPath->BezierTo(pt2 + p1, pt3 + p2, pt3);
+ check_path_->BezierTo(pt2 + p1, pt3 + p2, pt3);
p1 = ScaleBezierPoint(pt34 - pt3);
p2 = ScaleBezierPoint(pt43 - pt4);
- m_pCheckPath->BezierTo(pt3 + p1, pt4 + p2, pt4);
+ check_path_->BezierTo(pt3 + p1, pt4 + p2, pt4);
p1 = ScaleBezierPoint(pt45 - pt4);
p2 = ScaleBezierPoint(pt54 - pt5);
- m_pCheckPath->BezierTo(pt4 + p1, pt5 + p2, pt5);
+ check_path_->BezierTo(pt4 + p1, pt5 + p2, pt5);
p1 = ScaleBezierPoint(pt51 - pt5);
p2 = ScaleBezierPoint(pt15 - pt1);
- m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1);
+ check_path_->BezierTo(pt5 + p1, pt1 + p2, pt1);
float fScale = fCheckLen / kSignPath;
CFX_Matrix mt;
mt.Scale(fScale, fScale);
- m_pCheckPath->TransformBy(mt);
+ check_path_->TransformBy(mt);
}
void CFWL_CheckBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
if (pParams.GetPart() != CFWL_ThemePart::Part::kCheckBox)
return;
- if ((pParams.m_dwStates & CFWL_PartState::kChecked) ||
- (pParams.m_dwStates & CFWL_PartState::kNeutral)) {
+ if ((pParams.states_ & CFWL_PartState::kChecked) ||
+ (pParams.states_ & CFWL_PartState::kNeutral)) {
DrawCheckSign(pParams.GetWidget(), pParams.GetGraphics(),
- pParams.m_PartRect, pParams.m_dwStates, pParams.m_matrix);
+ pParams.part_rect_, pParams.states_, pParams.matrix_);
}
}
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
index a4a72f6..6896e49 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -63,7 +63,7 @@
void EnsureCheckPathInitialized(float fCheckLen);
- std::unique_ptr<CFGAS_GEPath> m_pCheckPath;
+ std::unique_ptr<CFGAS_GEPath> check_path_;
};
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index af3c81c..b46fb66 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -22,31 +22,32 @@
void CFWL_ComboBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder: {
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackground: {
CFGAS_GEPath path;
- const CFX_RectF& rect = pParams.m_PartRect;
+ const CFX_RectF& rect = pParams.part_rect_;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
FX_ARGB argb_color;
- if (pParams.m_dwStates & CFWL_PartState::kSelected)
+ if (pParams.states_ & CFWL_PartState::kSelected) {
argb_color = FWLTHEME_COLOR_BKSelected;
- else if (pParams.m_dwStates & CFWL_PartState::kDisabled)
+ } else if (pParams.states_ & CFWL_PartState::kDisabled) {
argb_color = FWLTHEME_COLOR_EDGERB1;
- else
+ } else {
argb_color = 0xFFFFFFFF;
+ }
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
pParams.GetGraphics()->SetFillColor(CFGAS_GEColor(argb_color));
pParams.GetGraphics()->FillPath(
- path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix);
+ path, CFX_FillRenderOptions::FillType::kWinding, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kDropDownButton: {
- DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect,
+ DrawArrowBtn(pParams.GetGraphics(), pParams.part_rect_,
FWLTHEME_DIRECTION::kDown, pParams.GetThemeState(),
- pParams.m_matrix);
+ pParams.matrix_);
break;
}
default:
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index 0e93b86..a88e831 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -19,12 +19,12 @@
const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder:
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
case CFWL_ThemePart::Part::kDropDownButton:
- DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect,
+ DrawArrowBtn(pParams.GetGraphics(), pParams.part_rect_,
FWLTHEME_DIRECTION::kDown, pParams.GetThemeState(),
- pParams.m_matrix);
+ pParams.matrix_);
break;
default:
break;
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 11424ad..7ec8cc4 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -22,7 +22,7 @@
void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder: {
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackground: {
@@ -33,23 +33,24 @@
pGraphics->SetFillColor(CFGAS_GEColor(FWLTHEME_COLOR_BKSelected));
pGraphics->FillPath(*pParamsPath,
CFX_FillRenderOptions::FillType::kWinding,
- pParams.m_matrix);
+ pParams.matrix_);
} else {
CFGAS_GEPath path;
- path.AddRectangle(pParams.m_PartRect.left, pParams.m_PartRect.top,
- pParams.m_PartRect.width, pParams.m_PartRect.height);
+ path.AddRectangle(pParams.part_rect_.left, pParams.part_rect_.top,
+ pParams.part_rect_.width, pParams.part_rect_.height);
CFGAS_GEColor cr(FWLTHEME_COLOR_Background);
- if (!pParams.m_bStaticBackground) {
- if (pParams.m_dwStates & CFWL_PartState::kDisabled)
+ if (!pParams.static_background_) {
+ if (pParams.states_ & CFWL_PartState::kDisabled) {
cr = CFGAS_GEColor(FWLTHEME_COLOR_EDGERB1);
- else if (pParams.m_dwStates & CFWL_PartState::kReadOnly)
+ } else if (pParams.states_ & CFWL_PartState::kReadOnly) {
cr = CFGAS_GEColor(ArgbEncode(255, 236, 233, 216));
- else
+ } else {
cr = CFGAS_GEColor(0xFFFFFFFF);
+ }
}
pGraphics->SetFillColor(cr);
pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding,
- pParams.m_matrix);
+ pParams.matrix_);
}
break;
}
@@ -63,7 +64,7 @@
pParams.GetGraphics()->SetLineWidth(fWidth);
const CFGAS_GEPath* pParamsPath = pParams.GetPath();
if (pParamsPath)
- pParams.GetGraphics()->StrokePath(*pParamsPath, pParams.m_matrix);
+ pParams.GetGraphics()->StrokePath(*pParamsPath, pParams.matrix_);
break;
}
default:
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 42308ef..077d643 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -23,32 +23,32 @@
void CFWL_ListBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder: {
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackground: {
FillSolidRect(pParams.GetGraphics(), ArgbEncode(255, 255, 255, 255),
- pParams.m_PartRect, pParams.m_matrix);
- if (pParams.m_pRtData) {
+ pParams.part_rect_, pParams.matrix_);
+ if (pParams.data_rect_) {
FillSolidRect(pParams.GetGraphics(), FWLTHEME_COLOR_Background,
- *pParams.m_pRtData, pParams.m_matrix);
+ *pParams.data_rect_, pParams.matrix_);
}
break;
}
case CFWL_ThemePart::Part::kListItem: {
- DrawListBoxItem(pParams.GetGraphics(), pParams.m_dwStates,
- pParams.m_PartRect, pParams.m_pRtData, pParams.m_matrix);
+ DrawListBoxItem(pParams.GetGraphics(), pParams.states_,
+ pParams.part_rect_, pParams.data_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kCheck: {
uint32_t color = 0xFF000000;
- if (pParams.m_dwStates == CFWL_PartState::kChecked) {
+ if (pParams.states_ == CFWL_PartState::kChecked) {
color = 0xFFFF0000;
- } else if (pParams.m_dwStates == CFWL_PartState::kNormal) {
+ } else if (pParams.states_ == CFWL_PartState::kNormal) {
color = 0xFF0000FF;
}
- FillSolidRect(pParams.GetGraphics(), color, pParams.m_PartRect,
- pParams.m_matrix);
+ FillSolidRect(pParams.GetGraphics(), color, pParams.part_rect_,
+ pParams.matrix_);
break;
}
default:
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index c0421c6..d3579bc 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -37,47 +37,47 @@
void CFWL_MonthCalendarTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder: {
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackground: {
- DrawTotalBK(pParams, pParams.m_matrix);
+ DrawTotalBK(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kHeader: {
- DrawHeadBk(pParams, pParams.m_matrix);
+ DrawHeadBk(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kLBtn: {
- DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect,
+ DrawArrowBtn(pParams.GetGraphics(), pParams.part_rect_,
FWLTHEME_DIRECTION::kLeft, pParams.GetThemeState(),
- pParams.m_matrix);
+ pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kRBtn: {
- DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect,
+ DrawArrowBtn(pParams.GetGraphics(), pParams.part_rect_,
FWLTHEME_DIRECTION::kRight, pParams.GetThemeState(),
- pParams.m_matrix);
+ pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kHSeparator: {
- DrawHSeparator(pParams, pParams.m_matrix);
+ DrawHSeparator(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kDatesIn: {
- DrawDatesInBK(pParams, pParams.m_matrix);
+ DrawDatesInBK(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kTodayCircle: {
- DrawTodayCircle(pParams, pParams.m_matrix);
+ DrawTodayCircle(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kDateInCircle: {
- DrawDatesInCircle(pParams, pParams.m_matrix);
+ DrawDatesInCircle(pParams, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kWeekNumSep: {
- DrawWeekNumSep(pParams, pParams.m_matrix);
+ DrawWeekNumSep(pParams, pParams.matrix_);
break;
}
default:
@@ -88,14 +88,14 @@
void CFWL_MonthCalendarTP::DrawText(const CFWL_ThemeText& pParams) {
EnsureTTOInitialized(pParams.GetWidget()->GetThemeProvider());
if (pParams.GetPart() == CFWL_ThemePart::Part::kDatesIn &&
- !(pParams.m_dwStates & CFWL_PartState::kFlagged) &&
- (pParams.m_dwStates & Mask<CFWL_PartState>{CFWL_PartState::kHovered,
- CFWL_PartState::kSelected})) {
- m_pTextOut->SetTextColor(0xFFFFFFFF);
+ !(pParams.states_ & CFWL_PartState::kFlagged) &&
+ (pParams.states_ & Mask<CFWL_PartState>{CFWL_PartState::kHovered,
+ CFWL_PartState::kSelected})) {
+ text_out_->SetTextColor(0xFFFFFFFF);
} else if (pParams.GetPart() == CFWL_ThemePart::Part::kCaption) {
- m_pTextOut->SetTextColor(kCaptionColor);
+ text_out_->SetTextColor(kCaptionColor);
} else {
- m_pTextOut->SetTextColor(0xFF000000);
+ text_out_->SetTextColor(0xFF000000);
}
CFWL_WidgetTP::DrawText(pParams);
}
@@ -103,7 +103,7 @@
void CFWL_MonthCalendarTP::DrawTotalBK(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtTotal(pParams.m_PartRect);
+ CFX_RectF rtTotal(pParams.part_rect_);
path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height);
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
@@ -115,7 +115,7 @@
void CFWL_MonthCalendarTP::DrawHeadBk(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtHead = pParams.m_PartRect;
+ CFX_RectF rtHead = pParams.part_rect_;
path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height);
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
@@ -127,14 +127,14 @@
void CFWL_MonthCalendarTP::DrawLButton(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtLBtn = pParams.m_PartRect;
+ CFX_RectF rtLBtn = pParams.part_rect_;
path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height);
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
pParams.GetGraphics()->SetStrokeColor(
CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243)));
pParams.GetGraphics()->StrokePath(path, matrix);
- if (pParams.m_dwStates & CFWL_PartState::kPressed) {
+ if (pParams.states_ & CFWL_PartState::kPressed) {
pParams.GetGraphics()->SetFillColor(
CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242)));
pParams.GetGraphics()->FillPath(
@@ -162,14 +162,14 @@
void CFWL_MonthCalendarTP::DrawRButton(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtRBtn = pParams.m_PartRect;
+ CFX_RectF rtRBtn = pParams.part_rect_;
path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height);
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
pParams.GetGraphics()->SetStrokeColor(
CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243)));
pParams.GetGraphics()->StrokePath(path, matrix);
- if (pParams.m_dwStates & CFWL_PartState::kPressed) {
+ if (pParams.states_ & CFWL_PartState::kPressed) {
pParams.GetGraphics()->SetFillColor(
CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242)));
pParams.GetGraphics()->FillPath(
@@ -197,7 +197,7 @@
void CFWL_MonthCalendarTP::DrawHSeparator(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtHSep = pParams.m_PartRect;
+ CFX_RectF rtHSep = pParams.part_rect_;
path.MoveTo(CFX_PointF(rtHSep.left, rtHSep.top + rtHSep.height / 2));
path.LineTo(CFX_PointF(rtHSep.right(), rtHSep.top + rtHSep.height / 2));
@@ -209,7 +209,7 @@
void CFWL_MonthCalendarTP::DrawWeekNumSep(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtWeekSep = pParams.m_PartRect;
+ CFX_RectF rtWeekSep = pParams.part_rect_;
path.MoveTo(rtWeekSep.TopLeft());
path.LineTo(rtWeekSep.BottomLeft());
@@ -221,18 +221,18 @@
void CFWL_MonthCalendarTP::DrawDatesInBK(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEGraphics::StateRestorer restorer(pParams.GetGraphics());
- if (pParams.m_dwStates & CFWL_PartState::kSelected) {
+ if (pParams.states_ & CFWL_PartState::kSelected) {
CFGAS_GEPath path;
- CFX_RectF rtSelDay = pParams.m_PartRect;
+ CFX_RectF rtSelDay = pParams.part_rect_;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
pParams.GetGraphics()->SetFillColor(
CFGAS_GEColor(kDatesSelectedBackgroundColor));
pParams.GetGraphics()->FillPath(
path, CFX_FillRenderOptions::FillType::kWinding, matrix);
- } else if (pParams.m_dwStates & CFWL_PartState::kHovered) {
+ } else if (pParams.states_ & CFWL_PartState::kHovered) {
CFGAS_GEPath path;
- CFX_RectF rtSelDay = pParams.m_PartRect;
+ CFX_RectF rtSelDay = pParams.part_rect_;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
pParams.GetGraphics()->SetFillColor(
@@ -246,7 +246,7 @@
const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtSelDay = pParams.m_PartRect;
+ CFX_RectF rtSelDay = pParams.part_rect_;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
@@ -258,7 +258,7 @@
void CFWL_MonthCalendarTP::DrawTodayCircle(const CFWL_ThemeBackground& pParams,
const CFX_Matrix& matrix) {
CFGAS_GEPath path;
- CFX_RectF rtTodayCircle = pParams.m_PartRect;
+ CFX_RectF rtTodayCircle = pParams.part_rect_;
path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width,
rtTodayCircle.height);
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index 7abaa9b..fb1c116 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -19,7 +19,7 @@
void CFWL_PictureBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder:
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
default:
break;
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index eb6dbca..9a20539 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -22,7 +22,7 @@
} // namespace
-CFWL_PushButtonTP::CFWL_PushButtonTP() : m_pThemeData(new PBThemeData) {
+CFWL_PushButtonTP::CFWL_PushButtonTP() : theme_data_(new PBThemeData) {
SetThemeData();
}
@@ -31,11 +31,11 @@
void CFWL_PushButtonTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kBorder: {
- DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
+ DrawBorder(pParams.GetGraphics(), pParams.part_rect_, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackground: {
- const CFX_RectF& rect = pParams.m_PartRect;
+ const CFX_RectF& rect = pParams.part_rect_;
float fRight = rect.right();
float fBottom = rect.bottom();
@@ -64,23 +64,23 @@
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
- int32_t iColor = GetColorID(pParams.m_dwStates);
- FillSolidRect(pGraphics, m_pThemeData->clrEnd[iColor], rect,
- pParams.m_matrix);
+ int32_t iColor = GetColorID(pParams.states_);
+ FillSolidRect(pGraphics, theme_data_->clrEnd[iColor], rect,
+ pParams.matrix_);
- pGraphics->SetStrokeColor(CFGAS_GEColor(m_pThemeData->clrBorder[iColor]));
- pGraphics->StrokePath(strokePath, pParams.m_matrix);
+ pGraphics->SetStrokeColor(CFGAS_GEColor(theme_data_->clrBorder[iColor]));
+ pGraphics->StrokePath(strokePath, pParams.matrix_);
fillPath.Clear();
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
- pGraphics->SetFillColor(CFGAS_GEColor(m_pThemeData->clrFill[iColor]));
+ pGraphics->SetFillColor(CFGAS_GEColor(theme_data_->clrFill[iColor]));
pGraphics->FillPath(fillPath, CFX_FillRenderOptions::FillType::kWinding,
- pParams.m_matrix);
- if (pParams.m_dwStates & CFWL_PartState::kFocused) {
+ pParams.matrix_);
+ if (pParams.states_ & CFWL_PartState::kFocused) {
rtInner.Inflate(1, 1, 0, 0);
- DrawFocus(pGraphics, rtInner, pParams.m_matrix);
+ DrawFocus(pGraphics, rtInner, pParams.matrix_);
}
break;
}
@@ -90,26 +90,26 @@
}
void CFWL_PushButtonTP::SetThemeData() {
- m_pThemeData->clrBorder[0] = ArgbEncode(255, 0, 60, 116);
- m_pThemeData->clrBorder[1] = ArgbEncode(255, 0, 60, 116);
- m_pThemeData->clrBorder[2] = ArgbEncode(255, 0, 60, 116);
- m_pThemeData->clrBorder[3] = ArgbEncode(255, 0, 60, 116);
- m_pThemeData->clrBorder[4] = ArgbEncode(255, 201, 199, 186);
- m_pThemeData->clrStart[0] = ArgbEncode(255, 255, 255, 255);
- m_pThemeData->clrStart[1] = ArgbEncode(255, 209, 204, 193);
- m_pThemeData->clrStart[2] = ArgbEncode(255, 255, 240, 207);
- m_pThemeData->clrStart[3] = ArgbEncode(255, 206, 231, 255);
- m_pThemeData->clrStart[4] = ArgbEncode(255, 245, 244, 234);
- m_pThemeData->clrEnd[0] = ArgbEncode(255, 214, 208, 197);
- m_pThemeData->clrEnd[1] = ArgbEncode(255, 242, 241, 238);
- m_pThemeData->clrEnd[2] = ArgbEncode(255, 229, 151, 0);
- m_pThemeData->clrEnd[3] = ArgbEncode(255, 105, 130, 238);
- m_pThemeData->clrEnd[4] = ArgbEncode(255, 245, 244, 234);
- m_pThemeData->clrFill[0] = ArgbEncode(255, 255, 255, 255);
- m_pThemeData->clrFill[1] = ArgbEncode(255, 226, 225, 218);
- m_pThemeData->clrFill[2] = ArgbEncode(255, 255, 255, 255);
- m_pThemeData->clrFill[3] = ArgbEncode(255, 255, 255, 255);
- m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234);
+ theme_data_->clrBorder[0] = ArgbEncode(255, 0, 60, 116);
+ theme_data_->clrBorder[1] = ArgbEncode(255, 0, 60, 116);
+ theme_data_->clrBorder[2] = ArgbEncode(255, 0, 60, 116);
+ theme_data_->clrBorder[3] = ArgbEncode(255, 0, 60, 116);
+ theme_data_->clrBorder[4] = ArgbEncode(255, 201, 199, 186);
+ theme_data_->clrStart[0] = ArgbEncode(255, 255, 255, 255);
+ theme_data_->clrStart[1] = ArgbEncode(255, 209, 204, 193);
+ theme_data_->clrStart[2] = ArgbEncode(255, 255, 240, 207);
+ theme_data_->clrStart[3] = ArgbEncode(255, 206, 231, 255);
+ theme_data_->clrStart[4] = ArgbEncode(255, 245, 244, 234);
+ theme_data_->clrEnd[0] = ArgbEncode(255, 214, 208, 197);
+ theme_data_->clrEnd[1] = ArgbEncode(255, 242, 241, 238);
+ theme_data_->clrEnd[2] = ArgbEncode(255, 229, 151, 0);
+ theme_data_->clrEnd[3] = ArgbEncode(255, 105, 130, 238);
+ theme_data_->clrEnd[4] = ArgbEncode(255, 245, 244, 234);
+ theme_data_->clrFill[0] = ArgbEncode(255, 255, 255, 255);
+ theme_data_->clrFill[1] = ArgbEncode(255, 226, 225, 218);
+ theme_data_->clrFill[2] = ArgbEncode(255, 255, 255, 255);
+ theme_data_->clrFill[3] = ArgbEncode(255, 255, 255, 255);
+ theme_data_->clrFill[4] = ArgbEncode(255, 245, 244, 234);
}
int32_t CFWL_PushButtonTP::GetColorID(Mask<CFWL_PartState> dwStates) const {
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
index 59b9793..1573307 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.h
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -37,7 +37,7 @@
int32_t GetColorID(Mask<CFWL_PartState> dwStates) const;
void SetThemeData();
- std::unique_ptr<PBThemeData> m_pThemeData;
+ std::unique_ptr<PBThemeData> theme_data_;
};
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 59eb7cf..1a97321 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -17,7 +17,7 @@
namespace pdfium {
CFWL_ScrollBarTP::CFWL_ScrollBarTP()
- : m_pThemeData(std::make_unique<SBThemeData>()) {
+ : theme_data_(std::make_unique<SBThemeData>()) {
SetThemeData();
}
@@ -29,31 +29,31 @@
bool bVert = !!pWidget->GetStyleExts();
switch (pParams.GetPart()) {
case CFWL_ThemePart::Part::kForeArrow: {
- DrawMaxMinBtn(pGraphics, pParams.m_PartRect,
+ DrawMaxMinBtn(pGraphics, pParams.part_rect_,
bVert ? FWLTHEME_DIRECTION::kUp : FWLTHEME_DIRECTION::kLeft,
- pParams.GetThemeState(), pParams.m_matrix);
+ pParams.GetThemeState(), pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kBackArrow: {
DrawMaxMinBtn(
- pGraphics, pParams.m_PartRect,
+ pGraphics, pParams.part_rect_,
bVert ? FWLTHEME_DIRECTION::kDown : FWLTHEME_DIRECTION::kRight,
- pParams.GetThemeState(), pParams.m_matrix);
+ pParams.GetThemeState(), pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kThumb: {
- DrawThumbBtn(pGraphics, pParams.m_PartRect, bVert,
- pParams.GetThemeState(), pParams.m_matrix);
+ DrawThumbBtn(pGraphics, pParams.part_rect_, bVert,
+ pParams.GetThemeState(), pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kLowerTrack: {
- DrawTrack(pGraphics, pParams.m_PartRect, bVert, pParams.GetThemeState(),
- true, pParams.m_matrix);
+ DrawTrack(pGraphics, pParams.part_rect_, bVert, pParams.GetThemeState(),
+ true, pParams.matrix_);
break;
}
case CFWL_ThemePart::Part::kUpperTrack: {
- DrawTrack(pGraphics, pParams.m_PartRect, bVert, pParams.GetThemeState(),
- false, pParams.m_matrix);
+ DrawTrack(pGraphics, pParams.part_rect_, bVert, pParams.GetThemeState(),
+ false, pParams.matrix_);
break;
}
default:
@@ -79,14 +79,14 @@
return;
FillSolidRect(pGraphics,
- m_pThemeData->clrBtnBK[static_cast<size_t>(eState) - 1], rect,
+ theme_data_->clrBtnBK[static_cast<size_t>(eState) - 1], rect,
matrix);
CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
CFGAS_GEPath path;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
pGraphics->SetStrokeColor(CFGAS_GEColor(
- m_pThemeData->clrBtnBorder[static_cast<size_t>(eState) - 1]));
+ theme_data_->clrBtnBorder[static_cast<size_t>(eState) - 1]));
pGraphics->StrokePath(path, matrix);
}
@@ -117,7 +117,7 @@
path.Clear();
path.AddRectangle(rect.left + 1, rect.top, rect.width - 2, rect.height);
}
- FillSolidRect(pGraphics, m_pThemeData->clrTrackBKEnd, rect, matrix);
+ FillSolidRect(pGraphics, theme_data_->clrTrackBKEnd, rect, matrix);
}
void CFWL_ScrollBarTP::DrawMaxMinBtn(CFGAS_GEGraphics* pGraphics,
@@ -135,16 +135,16 @@
}
void CFWL_ScrollBarTP::SetThemeData() {
- m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236);
- m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251);
- m_pThemeData->clrBtnBK[0] = ArgbEncode(0xff, 182, 205, 251);
- m_pThemeData->clrBtnBK[1] = ArgbEncode(0xff, 204, 225, 255);
- m_pThemeData->clrBtnBK[2] = ArgbEncode(0xff, 146, 179, 249);
- m_pThemeData->clrBtnBK[3] = ArgbEncode(0xff, 141, 157, 115);
- m_pThemeData->clrBtnBorder[0] = ArgbEncode(0xff, 148, 176, 221);
- m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254);
- m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211);
- m_pThemeData->clrBtnBorder[3] = ArgbEncode(0xff, 236, 233, 216);
+ theme_data_->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236);
+ theme_data_->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251);
+ theme_data_->clrBtnBK[0] = ArgbEncode(0xff, 182, 205, 251);
+ theme_data_->clrBtnBK[1] = ArgbEncode(0xff, 204, 225, 255);
+ theme_data_->clrBtnBK[2] = ArgbEncode(0xff, 146, 179, 249);
+ theme_data_->clrBtnBK[3] = ArgbEncode(0xff, 141, 157, 115);
+ theme_data_->clrBtnBorder[0] = ArgbEncode(0xff, 148, 176, 221);
+ theme_data_->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254);
+ theme_data_->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211);
+ theme_data_->clrBtnBorder[3] = ArgbEncode(0xff, 236, 233, 216);
}
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h
index ab24197..9eb3940 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.h
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -51,7 +51,7 @@
const CFX_Matrix& matrix);
void SetThemeData();
- std::unique_ptr<SBThemeData> const m_pThemeData;
+ std::unique_ptr<SBThemeData> const theme_data_;
};
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 253b62a..40190b9 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -33,51 +33,54 @@
void CFWL_WidgetTP::DrawText(const CFWL_ThemeText& pParams) {
EnsureTTOInitialized(pParams.GetWidget()->GetThemeProvider());
- if (pParams.m_wsText.IsEmpty())
+ if (pParams.text_.IsEmpty()) {
return;
+ }
CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
- m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
+ text_out_->SetStyles(pParams.tto_styles_);
+ text_out_->SetAlignment(pParams.tto_align_);
- CFX_Matrix matrix = pParams.m_matrix;
+ CFX_Matrix matrix = pParams.matrix_;
matrix.Concat(*pGraphics->GetMatrix());
- m_pTextOut->SetMatrix(matrix);
- m_pTextOut->DrawLogicText(pGraphics->GetRenderDevice(), pParams.m_wsText,
- pParams.m_PartRect);
+ text_out_->SetMatrix(matrix);
+ text_out_->DrawLogicText(pGraphics->GetRenderDevice(), pParams.text_,
+ pParams.part_rect_);
}
void CFWL_WidgetTP::InitializeArrowColorData() {
- if (m_pColorData)
+ if (color_data_) {
return;
+ }
- m_pColorData = std::make_unique<CColorData>();
- m_pColorData->clrBorder[0] = ArgbEncode(255, 202, 216, 249);
- m_pColorData->clrBorder[1] = ArgbEncode(255, 171, 190, 233);
- m_pColorData->clrBorder[2] = ArgbEncode(255, 135, 147, 219);
- m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153);
- m_pColorData->clrStart[0] = ArgbEncode(255, 225, 234, 254);
- m_pColorData->clrStart[1] = ArgbEncode(255, 253, 255, 255);
- m_pColorData->clrStart[2] = ArgbEncode(255, 110, 142, 241);
- m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251);
- m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
- m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
- m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
- m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
- m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
+ color_data_ = std::make_unique<CColorData>();
+ color_data_->clrBorder[0] = ArgbEncode(255, 202, 216, 249);
+ color_data_->clrBorder[1] = ArgbEncode(255, 171, 190, 233);
+ color_data_->clrBorder[2] = ArgbEncode(255, 135, 147, 219);
+ color_data_->clrBorder[3] = ArgbEncode(255, 172, 168, 153);
+ color_data_->clrStart[0] = ArgbEncode(255, 225, 234, 254);
+ color_data_->clrStart[1] = ArgbEncode(255, 253, 255, 255);
+ color_data_->clrStart[2] = ArgbEncode(255, 110, 142, 241);
+ color_data_->clrStart[3] = ArgbEncode(255, 254, 254, 251);
+ color_data_->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
+ color_data_->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
+ color_data_->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
+ color_data_->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
+ color_data_->clrSign[0] = ArgbEncode(255, 77, 97, 133);
+ color_data_->clrSign[1] = ArgbEncode(255, 77, 97, 133);
+ color_data_->clrSign[2] = ArgbEncode(255, 77, 97, 133);
+ color_data_->clrSign[3] = ArgbEncode(255, 128, 128, 128);
}
void CFWL_WidgetTP::EnsureTTOInitialized(IFWL_ThemeProvider* pProvider) {
- if (m_pTextOut)
+ if (text_out_) {
return;
+ }
- m_pTextOut = std::make_unique<CFDE_TextOut>();
- m_pTextOut->SetFont(pProvider->GetFWLFont());
- m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
- m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
+ text_out_ = std::make_unique<CFDE_TextOut>();
+ text_out_->SetFont(pProvider->GetFWLFont());
+ text_out_->SetFontSize(FWLTHEME_CAPACITY_FontSize);
+ text_out_->SetTextColor(FWLTHEME_CAPACITY_TextColor);
}
void CFWL_WidgetTP::DrawBorder(CFGAS_GEGraphics* pGraphics,
@@ -185,14 +188,13 @@
FWLTHEME_STATE eState,
const CFX_Matrix& matrix) {
InitializeArrowColorData();
- FillSolidRect(pGraphics,
- m_pColorData->clrEnd[static_cast<size_t>(eState) - 1], rect,
- matrix);
+ FillSolidRect(pGraphics, color_data_->clrEnd[static_cast<size_t>(eState) - 1],
+ rect, matrix);
CFGAS_GEPath path;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
pGraphics->SetStrokeColor(
- CFGAS_GEColor(m_pColorData->clrBorder[static_cast<size_t>(eState) - 1]));
+ CFGAS_GEColor(color_data_->clrBorder[static_cast<size_t>(eState) - 1]));
pGraphics->StrokePath(path, matrix);
}
@@ -204,7 +206,7 @@
DrawBtn(pGraphics, rect, eState, matrix);
InitializeArrowColorData();
DrawArrow(pGraphics, rect, eDict,
- m_pColorData->clrSign[static_cast<size_t>(eState) - 1], matrix);
+ color_data_->clrSign[static_cast<size_t>(eState) - 1], matrix);
}
} // namespace pdfium
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 7c11730..9bd32ed 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -77,8 +77,8 @@
FWLTHEME_STATE eState,
const CFX_Matrix& matrix);
- std::unique_ptr<CFDE_TextOut> m_pTextOut;
- std::unique_ptr<CColorData> m_pColorData;
+ std::unique_ptr<CFDE_TextOut> text_out_;
+ std::unique_ptr<CColorData> color_data_;
};
} // namespace pdfium
diff --git a/xfa/fxfa/cxfa_eventparam.cpp b/xfa/fxfa/cxfa_eventparam.cpp
index abb82be..b77fc56 100644
--- a/xfa/fxfa/cxfa_eventparam.cpp
+++ b/xfa/fxfa/cxfa_eventparam.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/cxfa_eventparam.h"
-CXFA_EventParam::CXFA_EventParam(XFA_EVENTTYPE type) : m_eType(type) {}
+CXFA_EventParam::CXFA_EventParam(XFA_EVENTTYPE type) : type_(type) {}
CXFA_EventParam::CXFA_EventParam(const CXFA_EventParam& other) = default;
@@ -19,6 +19,6 @@
default;
WideString CXFA_EventParam::GetNewText() const {
- return m_wsPrevText.First(m_iSelStart) + m_wsChange +
- m_wsPrevText.Last(m_wsPrevText.GetLength() - m_iSelEnd);
+ return prev_text_.First(sel_start_) + change_ +
+ prev_text_.Last(prev_text_.GetLength() - sel_end_);
}
diff --git a/xfa/fxfa/cxfa_eventparam.h b/xfa/fxfa/cxfa_eventparam.h
index 3888045..9fddd23 100644
--- a/xfa/fxfa/cxfa_eventparam.h
+++ b/xfa/fxfa/cxfa_eventparam.h
@@ -57,25 +57,25 @@
WideString GetNewText() const;
- XFA_EVENTTYPE m_eType;
- bool m_bCancelAction = false;
- bool m_bKeyDown = false;
- bool m_bModifier = false;
- bool m_bReenter = false;
- bool m_bShift = false;
- bool m_bIsFormReady = false;
- bool m_bTargeted = true;
- int32_t m_iCommitKey = 0;
- int32_t m_iSelEnd = 0;
- int32_t m_iSelStart = 0;
- WideString m_wsResult;
- WideString m_wsChange;
- WideString m_wsFullText;
- WideString m_wsNewContentType;
- WideString m_wsPrevContentType;
- WideString m_wsPrevText;
- WideString m_wsSoapFaultCode;
- WideString m_wsSoapFaultString;
+ XFA_EVENTTYPE type_;
+ bool cancel_action_ = false;
+ bool key_down_ = false;
+ bool modifier_ = false;
+ bool reenter_ = false;
+ bool shift_ = false;
+ bool is_form_ready_ = false;
+ bool targeted_ = true;
+ int32_t commit_key_ = 0;
+ int32_t sel_end_ = 0;
+ int32_t sel_start_ = 0;
+ WideString result_;
+ WideString change_;
+ WideString full_text_;
+ WideString new_content_type_;
+ WideString prev_content_type_;
+ WideString prev_text_;
+ WideString soap_fault_code_;
+ WideString soap_fault_string_;
};
#endif // XFA_FXFA_CXFA_EVENTPARAM_H_
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 7a79f7d..4ac5ea6 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -14,21 +14,21 @@
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_fwltheme.h"
-CXFA_FFApp::CXFA_FFApp(CallbackIface* pProvider) : m_pProvider(pProvider) {
+CXFA_FFApp::CXFA_FFApp(CallbackIface* pProvider) : provider_(pProvider) {
// Ensure fully initialized before making objects based on |this|.
- m_pXFAFontMgr = cppgc::MakeGarbageCollected<CXFA_FontMgr>(
+ xfafont_mgr_ = cppgc::MakeGarbageCollected<CXFA_FontMgr>(
GetHeap()->GetAllocationHandle());
- m_pFWLApp = cppgc::MakeGarbageCollected<CFWL_App>(
+ fwlapp_ = cppgc::MakeGarbageCollected<CFWL_App>(
GetHeap()->GetAllocationHandle(), this);
}
CXFA_FFApp::~CXFA_FFApp() = default;
void CXFA_FFApp::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pXFAFontMgr);
- visitor->Trace(m_pAdapterWidgetMgr);
- visitor->Trace(m_pFWLTheme);
- visitor->Trace(m_pFWLApp);
+ visitor->Trace(xfafont_mgr_);
+ visitor->Trace(adapter_widget_mgr_);
+ visitor->Trace(fwltheme_);
+ visitor->Trace(fwlapp_);
}
bool CXFA_FFApp::LoadFWLTheme(CXFA_FFDoc* doc) {
@@ -37,26 +37,26 @@
if (!fwl_theme->LoadCalendarFont(doc))
return false;
- m_pFWLTheme = fwl_theme;
+ fwltheme_ = fwl_theme;
return true;
}
CFWL_WidgetMgr::AdapterIface* CXFA_FFApp::GetWidgetMgrAdapter() {
- if (!m_pAdapterWidgetMgr) {
- m_pAdapterWidgetMgr = cppgc::MakeGarbageCollected<CXFA_FWLAdapterWidgetMgr>(
+ if (!adapter_widget_mgr_) {
+ adapter_widget_mgr_ = cppgc::MakeGarbageCollected<CXFA_FWLAdapterWidgetMgr>(
GetHeap()->GetAllocationHandle());
}
- return m_pAdapterWidgetMgr;
+ return adapter_widget_mgr_;
}
CFX_Timer::HandlerIface* CXFA_FFApp::GetTimerHandler() {
- return m_pProvider->GetTimerHandler();
+ return provider_->GetTimerHandler();
}
IFWL_ThemeProvider* CXFA_FFApp::GetThemeProvider() {
- return m_pFWLTheme;
+ return fwltheme_;
}
cppgc::Heap* CXFA_FFApp::GetHeap() {
- return m_pProvider->GetGCHeap();
+ return provider_->GetGCHeap();
}
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 642973f..9afd732 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -142,19 +142,19 @@
cppgc::Heap* GetHeap() override;
bool LoadFWLTheme(CXFA_FFDoc* doc);
- CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
- CallbackIface* GetAppProvider() const { return m_pProvider; }
- CFWL_App* GetFWLApp() const { return m_pFWLApp; }
- CXFA_FontMgr* GetXFAFontMgr() const { return m_pXFAFontMgr; }
+ CFWL_WidgetMgr* GetFWLWidgetMgr() const { return fwlapp_->GetWidgetMgr(); }
+ CallbackIface* GetAppProvider() const { return provider_; }
+ CFWL_App* GetFWLApp() const { return fwlapp_; }
+ CXFA_FontMgr* GetXFAFontMgr() const { return xfafont_mgr_; }
private:
explicit CXFA_FFApp(CallbackIface* pProvider);
- UnownedPtr<CallbackIface> const m_pProvider;
- cppgc::Member<CXFA_FontMgr> m_pXFAFontMgr;
- cppgc::Member<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr;
- cppgc::Member<pdfium::CXFA_FWLTheme> m_pFWLTheme;
- cppgc::Member<CFWL_App> m_pFWLApp;
+ UnownedPtr<CallbackIface> const provider_;
+ cppgc::Member<CXFA_FontMgr> xfafont_mgr_;
+ cppgc::Member<CXFA_FWLAdapterWidgetMgr> adapter_widget_mgr_;
+ cppgc::Member<pdfium::CXFA_FWLTheme> fwltheme_;
+ cppgc::Member<CFWL_App> fwlapp_;
};
#endif // XFA_FXFA_CXFA_FFAPP_H_
diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp
index 071f479..fbd28ff 100644
--- a/xfa/fxfa/cxfa_ffarc.cpp
+++ b/xfa/fxfa/cxfa_ffarc.cpp
@@ -19,12 +19,12 @@
if (!HasVisibleStatus())
return;
- CXFA_Value* value = m_pNode->GetFormValueIfExists();
+ CXFA_Value* value = node_->GetFormValueIfExists();
if (!value)
return;
CFX_RectF rtArc = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
XFA_RectWithoutMargin(&rtArc, margin);
CFX_Matrix mtRotate = GetRotateMatrix();
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 2cd8d37..f79081d 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -148,12 +148,12 @@
CFWL_NoteDriver* pNoteDriver = pFWLBarcode->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pFWLBarcode, pFWLBarcode);
- m_pOldDelegate = pFWLBarcode->GetDelegate();
+ old_delegate_ = pFWLBarcode->GetDelegate();
pFWLBarcode->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pFWLBarcode);
- pFWLBarcode->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
+ pFWLBarcode->SetText(node_->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
@@ -170,7 +170,7 @@
mtRotate.Concat(matrix);
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- DrawBorder(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate);
+ DrawBorder(pGS, node_->GetUIBorder(), uirect_, mtRotate);
RenderCaption(pGS, mtRotate);
CFX_RectF rtWidget = GetNormalWidget()->GetWidgetRect();
@@ -249,7 +249,7 @@
if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
return false;
if (command == CFWL_MessageMouse::MouseCommand::kLeftButtonDown &&
- !m_pNode->IsOpenAccess()) {
+ !node_->IsOpenAccess()) {
return false;
}
return CXFA_FFTextEdit::AcceptsFocusOnButtonDown(dwFlags, point, command);
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index f662a79..983181c 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -32,7 +32,7 @@
void CXFA_FFCheckButton::Trace(cppgc::Visitor* visitor) const {
CXFA_FFField::Trace(visitor);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(old_delegate_);
visitor->Trace(button_);
}
@@ -46,15 +46,16 @@
CFWL_NoteDriver* pNoteDriver = pCheckBox->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pCheckBox, pCheckBox);
- m_pOldDelegate = pCheckBox->GetDelegate();
+ old_delegate_ = pCheckBox->GetDelegate();
pCheckBox->SetDelegate(this);
- if (m_pNode->IsRadioButton())
+ if (node_->IsRadioButton()) {
pCheckBox->ModifyStyleExts(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF);
+ }
{
CFWL_Widget::ScopedUpdateLock update_lock(pCheckBox);
UpdateWidgetProperty();
- SetFWLCheckState(m_pNode->GetCheckState());
+ SetFWLCheckState(node_->GetCheckState());
}
return CXFA_FFField::LoadWidget();
@@ -65,7 +66,7 @@
if (!pCheckBox)
return;
- pCheckBox->SetBoxSize(m_pNode->GetCheckButtonSize());
+ pCheckBox->SetBoxSize(node_->GetCheckButtonSize());
uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross;
switch (button_->GetMark()) {
case XFA_AttributeValue::Check:
@@ -100,16 +101,16 @@
void CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- float fCheckSize = m_pNode->GetCheckButtonSize();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ float fCheckSize = node_->GetCheckButtonSize();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
CFX_RectF rtWidget = GetRectWithoutRotate();
XFA_RectWithoutMargin(&rtWidget, margin);
XFA_AttributeValue iCapPlacement = XFA_AttributeValue::Unknown;
float fCapReserve = 0;
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
if (caption && caption->IsVisible()) {
- m_CaptionRect = rtWidget;
+ caption_rect_ = rtWidget;
iCapPlacement = caption->GetPlacementType();
fCapReserve = caption->GetReserve();
if (fCapReserve <= 0) {
@@ -124,41 +125,41 @@
XFA_AttributeValue iHorzAlign = XFA_AttributeValue::Left;
XFA_AttributeValue iVertAlign = XFA_AttributeValue::Top;
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (para) {
iHorzAlign = para->GetHorizontalAlign();
iVertAlign = para->GetVerticalAlign();
}
- m_UIRect = rtWidget;
+ uirect_ = rtWidget;
CXFA_Margin* captionMargin = caption ? caption->GetMarginIfExists() : nullptr;
switch (iCapPlacement) {
case XFA_AttributeValue::Left: {
- m_CaptionRect.width = fCapReserve;
+ caption_rect_.width = fCapReserve;
CapLeftRightPlacement(captionMargin);
- m_UIRect.width -= fCapReserve;
- m_UIRect.left += fCapReserve;
+ uirect_.width -= fCapReserve;
+ uirect_.left += fCapReserve;
break;
}
case XFA_AttributeValue::Top: {
- m_CaptionRect.height = fCapReserve;
- XFA_RectWithoutMargin(&m_CaptionRect, captionMargin);
- m_UIRect.height -= fCapReserve;
- m_UIRect.top += fCapReserve;
+ caption_rect_.height = fCapReserve;
+ XFA_RectWithoutMargin(&caption_rect_, captionMargin);
+ uirect_.height -= fCapReserve;
+ uirect_.top += fCapReserve;
break;
}
case XFA_AttributeValue::Right: {
- m_CaptionRect.left = m_CaptionRect.right() - fCapReserve;
- m_CaptionRect.width = fCapReserve;
+ caption_rect_.left = caption_rect_.right() - fCapReserve;
+ caption_rect_.width = fCapReserve;
CapLeftRightPlacement(captionMargin);
- m_UIRect.width -= fCapReserve;
+ uirect_.width -= fCapReserve;
break;
}
case XFA_AttributeValue::Bottom: {
- m_CaptionRect.top = m_CaptionRect.bottom() - fCapReserve;
- m_CaptionRect.height = fCapReserve;
- XFA_RectWithoutMargin(&m_CaptionRect, captionMargin);
- m_UIRect.height -= fCapReserve;
+ caption_rect_.top = caption_rect_.bottom() - fCapReserve;
+ caption_rect_.height = fCapReserve;
+ XFA_RectWithoutMargin(&caption_rect_, captionMargin);
+ uirect_.height -= fCapReserve;
break;
}
case XFA_AttributeValue::Inline:
@@ -169,26 +170,26 @@
}
if (iHorzAlign == XFA_AttributeValue::Center)
- m_UIRect.left += (m_UIRect.width - fCheckSize) / 2;
+ uirect_.left += (uirect_.width - fCheckSize) / 2;
else if (iHorzAlign == XFA_AttributeValue::Right)
- m_UIRect.left = m_UIRect.right() - fCheckSize;
+ uirect_.left = uirect_.right() - fCheckSize;
if (iVertAlign == XFA_AttributeValue::Middle)
- m_UIRect.top += (m_UIRect.height - fCheckSize) / 2;
+ uirect_.top += (uirect_.height - fCheckSize) / 2;
else if (iVertAlign == XFA_AttributeValue::Bottom)
- m_UIRect.top = m_UIRect.bottom() - fCheckSize;
+ uirect_.top = uirect_.bottom() - fCheckSize;
- m_UIRect.width = fCheckSize;
- m_UIRect.height = fCheckSize;
+ uirect_.width = fCheckSize;
+ uirect_.height = fCheckSize;
AddUIMargin(iCapPlacement);
- m_CheckBoxRect = m_UIRect;
- CXFA_Border* borderUI = m_pNode->GetUIBorder();
+ check_box_rect_ = uirect_;
+ CXFA_Border* borderUI = node_->GetUIBorder();
if (borderUI) {
CXFA_Margin* borderMargin = borderUI->GetMarginIfExists();
- XFA_RectWithoutMargin(&m_UIRect, borderMargin);
+ XFA_RectWithoutMargin(&uirect_, borderMargin);
}
- m_UIRect.Normalize();
+ uirect_.Normalize();
LayoutCaption();
SetFWLRect();
if (GetNormalWidget())
@@ -197,36 +198,37 @@
void CXFA_FFCheckButton::CapLeftRightPlacement(
const CXFA_Margin* captionMargin) {
- XFA_RectWithoutMargin(&m_CaptionRect, captionMargin);
- if (m_CaptionRect.height < 0)
- m_CaptionRect.top += m_CaptionRect.height;
- if (m_CaptionRect.width < 0) {
- m_CaptionRect.left += m_CaptionRect.width;
- m_CaptionRect.width = -m_CaptionRect.width;
+ XFA_RectWithoutMargin(&caption_rect_, captionMargin);
+ if (caption_rect_.height < 0) {
+ caption_rect_.top += caption_rect_.height;
+ }
+ if (caption_rect_.width < 0) {
+ caption_rect_.left += caption_rect_.width;
+ caption_rect_.width = -caption_rect_.width;
}
}
void CXFA_FFCheckButton::AddUIMargin(XFA_AttributeValue iCapPlacement) {
- CFX_RectF rtUIMargin = m_pNode->GetUIMargin();
- m_UIRect.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2;
+ CFX_RectF rtUIMargin = node_->GetUIMargin();
+ uirect_.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2;
float fLeftAddRight = rtUIMargin.left + rtUIMargin.width;
float fTopAddBottom = rtUIMargin.top + rtUIMargin.height;
- if (m_UIRect.width < fLeftAddRight) {
+ if (uirect_.width < fLeftAddRight) {
if (iCapPlacement == XFA_AttributeValue::Right ||
iCapPlacement == XFA_AttributeValue::Left) {
- m_UIRect.left -= fLeftAddRight - m_UIRect.width;
+ uirect_.left -= fLeftAddRight - uirect_.width;
} else {
- m_UIRect.left -= 2 * (fLeftAddRight - m_UIRect.width);
+ uirect_.left -= 2 * (fLeftAddRight - uirect_.width);
}
- m_UIRect.width += 2 * (fLeftAddRight - m_UIRect.width);
+ uirect_.width += 2 * (fLeftAddRight - uirect_.width);
}
- if (m_UIRect.height < fTopAddBottom) {
+ if (uirect_.height < fTopAddBottom) {
if (iCapPlacement == XFA_AttributeValue::Right)
- m_UIRect.left -= fTopAddBottom - m_UIRect.height;
+ uirect_.left -= fTopAddBottom - uirect_.height;
- m_UIRect.top -= fTopAddBottom - m_UIRect.height;
- m_UIRect.height += 2 * (fTopAddBottom - m_UIRect.height);
+ uirect_.top -= fTopAddBottom - uirect_.height;
+ uirect_.height += 2 * (fTopAddBottom - uirect_.height);
}
}
@@ -240,12 +242,12 @@
mtRotate.Concat(matrix);
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- DrawBorderWithFlag(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate,
+ DrawBorderWithFlag(pGS, node_->GetUIBorder(), uirect_, mtRotate,
button_->IsRound());
RenderCaption(pGS, mtRotate);
DrawHighlight(pGS, mtRotate, highlight,
button_->IsRound() ? kRoundShape : kSquareShape);
- CFX_Matrix mt(1, 0, 0, 1, m_CheckBoxRect.left, m_CheckBoxRect.top);
+ CFX_Matrix mt(1, 0, 0, 1, check_box_rect_.left, check_box_rect_.top);
mt.Concat(mtRotate);
GetApp()->GetFWLWidgetMgr()->OnDrawWidget(GetNormalWidget(), pGS, mt);
}
@@ -273,13 +275,13 @@
}
bool CXFA_FFCheckButton::CommitData() {
- m_pNode->SetCheckState(FWLState2XFAState());
+ node_->SetCheckState(FWLState2XFAState());
return true;
}
bool CXFA_FFCheckButton::IsDataChanged() {
XFA_CheckState eCheckState = FWLState2XFAState();
- return m_pNode->GetCheckState() != eCheckState;
+ return node_->GetCheckState() != eCheckState;
}
void CXFA_FFCheckButton::SetFWLCheckState(XFA_CheckState eCheckState) {
@@ -295,12 +297,12 @@
if (!GetNormalWidget()) {
return;
}
- SetFWLCheckState(m_pNode->GetCheckState());
+ SetFWLCheckState(node_->GetCheckState());
GetNormalWidget()->Update();
}
void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) {
@@ -308,36 +310,35 @@
switch (pEvent->GetType()) {
case CFWL_Event::Type::CheckStateChanged: {
CXFA_EventParam eParam(XFA_EVENT_Change);
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
- CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists();
+ eParam.prev_text_ = node_->GetValue(XFA_ValuePicture::kRaw);
+ CXFA_Node* exclNode = node_->GetExclGroupIfExists();
if (ProcessCommittedData()) {
if (exclNode) {
- m_pDocView->AddValidateNode(exclNode);
- m_pDocView->AddCalculateNode(exclNode);
+ doc_view_->AddValidateNode(exclNode);
+ doc_view_->AddCalculateNode(exclNode);
exclNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change,
&eParam);
}
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change,
- &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
} else {
- SetFWLCheckState(m_pNode->GetCheckState());
+ SetFWLCheckState(node_->GetCheckState());
}
if (exclNode) {
exclNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Click,
&eParam);
}
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Click, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Click, &eParam);
break;
}
default:
break;
}
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
}
void CXFA_FFCheckButton::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, matrix);
+ old_delegate_->OnDrawWidget(pGraphics, matrix);
}
FormFieldType CXFA_FFCheckButton::GetFormFieldType() {
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h
index 2bc14d8..1595991 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.h
+++ b/xfa/fxfa/cxfa_ffcheckbutton.h
@@ -49,9 +49,9 @@
void AddUIMargin(XFA_AttributeValue iCapPlacement);
XFA_CheckState FWLState2XFAState();
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
cppgc::Member<CXFA_CheckButton> const button_;
- CFX_RectF m_CheckBoxRect;
+ CFX_RectF check_box_rect_;
};
#endif // XFA_FXFA_CXFA_FFCHECKBUTTON_H_
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index ea236eb..977d754 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -36,7 +36,7 @@
void CXFA_FFComboBox::Trace(cppgc::Visitor* visitor) const {
CXFA_FFDropDown::Trace(visitor);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(old_delegate_);
}
CXFA_FFComboBox* CXFA_FFComboBox::AsComboBox() {
@@ -64,17 +64,18 @@
CFWL_NoteDriver* pNoteDriver = pComboBox->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pComboBox, pComboBox);
- m_pOldDelegate = pComboBox->GetDelegate();
+ old_delegate_ = pComboBox->GetDelegate();
pComboBox->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pComboBox);
- for (const auto& label : m_pNode->GetChoiceListItems(false))
+ for (const auto& label : node_->GetChoiceListItems(false)) {
pComboBox->AddString(label);
+ }
- std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
+ std::vector<int32_t> iSelArray = node_->GetSelectedItems();
if (iSelArray.empty())
- pComboBox->SetEditText(m_pNode->GetValue(XFA_ValuePicture::kRaw));
+ pComboBox->SetEditText(node_->GetValue(XFA_ValuePicture::kRaw));
else
pComboBox->SetCurSel(iSelArray.front());
@@ -92,19 +93,20 @@
uint32_t dwExtendedStyle = 0;
uint32_t dwEditStyles = FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= UpdateUIProperty();
- if (m_pNode->IsChoiceListAllowTextEntry()) {
+ if (node_->IsChoiceListAllowTextEntry()) {
dwEditStyles &= ~FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_CMB_DropDown;
}
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_CMB_ReadOnly;
}
dwExtendedStyle |= GetAlignment();
GetNormalWidget()->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
- if (!m_pNode->IsHorizontalScrollPolicyOff())
+ if (!node_->IsHorizontalScrollPolicyOff()) {
dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
+ }
pComboBox->EditModifyStyleExts(dwEditStyles, 0xFFFFFFFF);
}
@@ -130,22 +132,23 @@
}
bool CXFA_FFComboBox::CommitData() {
- return m_pNode->SetValue(XFA_ValuePicture::kRaw, m_wsNewValue);
+ return node_->SetValue(XFA_ValuePicture::kRaw, new_value_);
}
bool CXFA_FFComboBox::IsDataChanged() {
WideString wsText = GetCurrentText();
- if (m_pNode->GetValue(XFA_ValuePicture::kRaw) == wsText)
+ if (node_->GetValue(XFA_ValuePicture::kRaw) == wsText) {
return false;
+ }
- m_wsNewValue = std::move(wsText);
+ new_value_ = std::move(wsText);
return true;
}
void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) {
- pParam->m_eType = XFA_EVENT_Change;
- pParam->m_wsPrevText = ToComboBox(GetNormalWidget())->GetEditText();
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, pParam);
+ pParam->type_ = XFA_EVENT_Change;
+ pParam->prev_text_ = ToComboBox(GetNormalWidget())->GetEditText();
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, pParam);
}
WideString CXFA_FFComboBox::GetCurrentText() const {
@@ -155,13 +158,13 @@
if (iCursel >= 0) {
WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel);
if (wsSel == wsText)
- wsText = m_pNode->GetChoiceListItem(iCursel, true).value_or(L"");
+ wsText = node_->GetChoiceListItem(iCursel, true).value_or(L"");
}
return wsText;
}
uint32_t CXFA_FFComboBox::GetAlignment() {
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (!para)
return 0;
@@ -205,23 +208,23 @@
if (!pComboBox)
return;
- std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
+ std::vector<int32_t> iSelArray = node_->GetSelectedItems();
if (!iSelArray.empty()) {
pComboBox->SetCurSel(iSelArray.front());
} else {
pComboBox->SetCurSel(-1);
- pComboBox->SetEditText(m_pNode->GetValue(XFA_ValuePicture::kRaw));
+ pComboBox->SetEditText(node_->GetValue(XFA_ValuePicture::kRaw));
}
pComboBox->Update();
}
bool CXFA_FFComboBox::CanUndo() {
- return m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditCanUndo();
}
bool CXFA_FFComboBox::CanRedo() {
- return m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditCanRedo();
}
@@ -230,12 +233,12 @@
}
bool CXFA_FFComboBox::CanCut() {
- return m_pNode->IsOpenAccess() && m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsOpenAccess() && node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditCanCut();
}
bool CXFA_FFComboBox::CanPaste() {
- return m_pNode->IsChoiceListAllowTextEntry() && m_pNode->IsOpenAccess();
+ return node_->IsChoiceListAllowTextEntry() && node_->IsOpenAccess();
}
bool CXFA_FFComboBox::CanSelectAll() {
@@ -243,12 +246,12 @@
}
bool CXFA_FFComboBox::Undo() {
- return m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditUndo();
}
bool CXFA_FFComboBox::Redo() {
- return m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditRedo();
}
@@ -257,14 +260,15 @@
}
std::optional<WideString> CXFA_FFComboBox::Cut() {
- if (!m_pNode->IsChoiceListAllowTextEntry())
+ if (!node_->IsChoiceListAllowTextEntry()) {
return std::nullopt;
+ }
return ToComboBox(GetNormalWidget())->EditCut();
}
bool CXFA_FFComboBox::Paste(const WideString& wsPaste) {
- return m_pNode->IsChoiceListAllowTextEntry() &&
+ return node_->IsChoiceListAllowTextEntry() &&
ToComboBox(GetNormalWidget())->EditPaste(wsPaste);
}
@@ -313,31 +317,32 @@
void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget,
const WideString& wsChanged) {
CXFA_EventParam eParam(XFA_EVENT_Unknown);
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
- eParam.m_wsChange = wsChanged;
+ eParam.prev_text_ = node_->GetValue(XFA_ValuePicture::kRaw);
+ eParam.change_ = wsChanged;
FWLEventSelChange(&eParam);
}
void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) {
CXFA_EventParam eParam(XFA_EVENT_Unknown);
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
+ eParam.prev_text_ = node_->GetValue(XFA_ValuePicture::kRaw);
FWLEventSelChange(&eParam);
- if (m_pNode->IsChoiceListCommitOnSelect() && bLButtonUp)
- m_pDocView->SetFocusNode(nullptr);
+ if (node_->IsChoiceListCommitOnSelect() && bLButtonUp) {
+ doc_view_->SetFocusNode(nullptr);
+ }
}
void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) {
CXFA_EventParam eParam(XFA_EVENT_PreOpen);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::PreOpen, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::PreOpen, &eParam);
}
void CXFA_FFComboBox::OnPostOpen(CFWL_Widget* pWidget) {
CXFA_EventParam eParam(XFA_EVENT_PostOpen);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::PostOpen, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::PostOpen, &eParam);
}
void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) {
@@ -364,10 +369,10 @@
default:
break;
}
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
}
void CXFA_FFComboBox::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, matrix);
+ old_delegate_->OnDrawWidget(pGraphics, matrix);
}
diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h
index 8cfb954..6295e70 100644
--- a/xfa/fxfa/cxfa_ffcombobox.h
+++ b/xfa/fxfa/cxfa_ffcombobox.h
@@ -77,8 +77,8 @@
void FWLEventSelChange(CXFA_EventParam* pParam);
WideString GetCurrentText() const;
- WideString m_wsNewValue;
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ WideString new_value_;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
};
#endif // XFA_FXFA_CXFA_FFCOMBOBOX_H_
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index ca5dac6..34dbb72 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -51,20 +51,20 @@
CFWL_NoteDriver* pNoteDriver = pWidget->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = pWidget->GetDelegate();
+ old_delegate_ = pWidget->GetDelegate();
pWidget->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- WideString wsText = m_pNode->GetValue(XFA_ValuePicture::kDisplay);
+ WideString wsText = node_->GetValue(XFA_ValuePicture::kDisplay);
pWidget->SetEditText(wsText);
- CXFA_Value* value = m_pNode->GetFormValueIfExists();
+ CXFA_Value* value = node_->GetFormValueIfExists();
if (value) {
switch (value->GetChildValueClassID()) {
case XFA_Element::Date: {
if (!wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode.Get());
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(node_.Get());
CFX_DateTime date = lcValue.GetDate();
if (date.IsSet())
pWidget->SetCurSel(date.GetYear(), date.GetMonth(),
@@ -92,21 +92,23 @@
GetNormalWidget()->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
uint32_t dwEditStyles = 0;
- std::optional<int32_t> numCells = m_pNode->GetNumberOfCells();
+ std::optional<int32_t> numCells = node_->GetNumberOfCells();
if (numCells.has_value() && numCells.value() > 0) {
dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
pPicker->SetEditLimit(numCells.value());
}
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive())
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
- if (!m_pNode->IsHorizontalScrollPolicyOff())
+ }
+ if (!node_->IsHorizontalScrollPolicyOff()) {
dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
+ }
pPicker->ModifyEditStyleExts(dwEditStyles, 0xFFFFFFFF);
}
uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (!para)
return 0;
@@ -145,10 +147,11 @@
bool CXFA_FFDateTimeEdit::CommitData() {
CFWL_DateTimePicker* pPicker = GetPickerWidget();
- if (!m_pNode->SetValue(XFA_ValuePicture::kEdit, pPicker->GetEditText()))
+ if (!node_->SetValue(XFA_ValuePicture::kEdit, pPicker->GetEditText())) {
return false;
+ }
- GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
+ GetDoc()->GetDocView()->UpdateUIDisplay(node_.Get(), this);
return true;
}
@@ -160,11 +163,11 @@
if (IsFocused())
eType = XFA_ValuePicture::kEdit;
- WideString wsText = m_pNode->GetValue(eType);
+ WideString wsText = node_->GetValue(eType);
CFWL_DateTimePicker* pPicker = GetPickerWidget();
pPicker->SetEditText(wsText);
if (IsFocused() && !wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode.Get());
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(node_.Get());
CFX_DateTime date = lcValue.GetDate();
if (lcValue.IsValid()) {
if (date.IsSet())
@@ -179,20 +182,20 @@
return true;
WideString wsText = GetPickerWidget()->GetEditText();
- return m_pNode->GetValue(XFA_ValuePicture::kEdit) != wsText;
+ return node_->GetValue(XFA_ValuePicture::kEdit) != wsText;
}
void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- WideString wsPicture = m_pNode->GetPictureContent(XFA_ValuePicture::kEdit);
+ WideString wsPicture = node_->GetPictureContent(XFA_ValuePicture::kEdit);
CXFA_LocaleValue date(CXFA_LocaleValue::ValueType::kDate,
GetDoc()->GetXFADoc()->GetLocaleMgr());
date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
WideString wsDate;
- date.FormatPatterns(wsDate, wsPicture, m_pNode->GetLocale(),
+ date.FormatPatterns(wsDate, wsPicture, node_->GetLocale(),
XFA_ValuePicture::kEdit);
CFWL_DateTimePicker* pPicker = GetPickerWidget();
@@ -201,9 +204,9 @@
GetDoc()->SetFocusWidget(nullptr);
CXFA_EventParam eParam(XFA_EVENT_Unknown);
- eParam.m_eType = XFA_EVENT_Change;
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
+ eParam.type_ = XFA_EVENT_Change;
+ eParam.prev_text_ = node_->GetValue(XFA_ValuePicture::kRaw);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
}
void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index f1d35f06..fb43953 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -58,16 +58,16 @@
CallbackIface* pDocEnvironment,
CPDF_Document* pPDFDoc,
cppgc::Heap* pHeap)
- : m_pDocEnvironment(pDocEnvironment),
- m_pPDFDoc(pPDFDoc),
- m_pHeap(pHeap),
- m_pApp(pApp),
- m_pNotify(cppgc::MakeGarbageCollected<CXFA_FFNotify>(
+ : doc_environment_(pDocEnvironment),
+ pdfdoc_(pPDFDoc),
+ heap_(pHeap),
+ app_(pApp),
+ notify_(cppgc::MakeGarbageCollected<CXFA_FFNotify>(
pHeap->GetAllocationHandle(),
this)),
- m_pDocument(cppgc::MakeGarbageCollected<CXFA_Document>(
+ document_(cppgc::MakeGarbageCollected<CXFA_Document>(
pHeap->GetAllocationHandle(),
- m_pNotify,
+ notify_,
pHeap,
cppgc::MakeGarbageCollected<CXFA_LayoutProcessor>(
pHeap->GetAllocationHandle(),
@@ -76,52 +76,54 @@
CXFA_FFDoc::~CXFA_FFDoc() = default;
void CXFA_FFDoc::PreFinalize() {
- if (m_DocView)
- m_DocView->RunDocClose();
+ if (doc_view_) {
+ doc_view_->RunDocClose();
+ }
- if (m_pDocument)
- m_pDocument->ClearLayoutData();
+ if (document_) {
+ document_->ClearLayoutData();
+ }
}
void CXFA_FFDoc::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pApp);
- visitor->Trace(m_pNotify);
- visitor->Trace(m_pDocument);
- visitor->Trace(m_DocView);
+ visitor->Trace(app_);
+ visitor->Trace(notify_);
+ visitor->Trace(document_);
+ visitor->Trace(doc_view_);
}
bool CXFA_FFDoc::BuildDoc(CFX_XMLDocument* pXML) {
DCHECK(pXML);
- CXFA_DocumentBuilder builder(m_pDocument);
+ CXFA_DocumentBuilder builder(document_);
if (!builder.BuildDocument(pXML, XFA_PacketType::Xdp))
return false;
- m_pDocument->SetRoot(builder.GetRootNode());
+ document_->SetRoot(builder.GetRootNode());
return true;
}
CXFA_FFDocView* CXFA_FFDoc::CreateDocView() {
- if (!m_DocView) {
- m_DocView = cppgc::MakeGarbageCollected<CXFA_FFDocView>(
- m_pHeap->GetAllocationHandle(), this);
+ if (!doc_view_) {
+ doc_view_ = cppgc::MakeGarbageCollected<CXFA_FFDocView>(
+ heap_->GetAllocationHandle(), this);
}
- return m_DocView;
+ return doc_view_;
}
void CXFA_FFDoc::SetChangeMark() {
- m_pDocEnvironment->SetChangeMark(this);
+ doc_environment_->SetChangeMark(this);
}
void CXFA_FFDoc::InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rt) {
- m_pDocEnvironment->InvalidateRect(pPageView, rt);
+ doc_environment_->InvalidateRect(pPageView, rt);
}
void CXFA_FFDoc::DisplayCaret(CXFA_FFWidget* hWidget,
bool bVisible,
const CFX_RectF* pRtAnchor) {
- return m_pDocEnvironment->DisplayCaret(hWidget, bVisible, pRtAnchor);
+ return doc_environment_->DisplayCaret(hWidget, bVisible, pRtAnchor);
}
bool CXFA_FFDoc::GetPopupPos(CXFA_FFWidget* hWidget,
@@ -129,105 +131,105 @@
float fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF* pPopupRect) const {
- return m_pDocEnvironment->GetPopupPos(hWidget, fMinPopup, fMaxPopup, rtAnchor,
- pPopupRect);
+ return doc_environment_->GetPopupPos(hWidget, fMinPopup, fMaxPopup, rtAnchor,
+ pPopupRect);
}
bool CXFA_FFDoc::PopupMenu(CXFA_FFWidget* hWidget, const CFX_PointF& ptPopup) {
- return m_pDocEnvironment->PopupMenu(hWidget, ptPopup);
+ return doc_environment_->PopupMenu(hWidget, ptPopup);
}
void CXFA_FFDoc::OnPageViewEvent(CXFA_FFPageView* pPageView,
PageViewEvent eEvent) {
- m_pDocEnvironment->OnPageViewEvent(pPageView, eEvent);
+ doc_environment_->OnPageViewEvent(pPageView, eEvent);
}
void CXFA_FFDoc::WidgetPostAdd(CXFA_FFWidget* hWidget) {
- m_pDocEnvironment->WidgetPostAdd(hWidget);
+ doc_environment_->WidgetPostAdd(hWidget);
}
void CXFA_FFDoc::WidgetPreRemove(CXFA_FFWidget* hWidget) {
- m_pDocEnvironment->WidgetPreRemove(hWidget);
+ doc_environment_->WidgetPreRemove(hWidget);
}
int32_t CXFA_FFDoc::CountPages() const {
- return m_pDocEnvironment->CountPages(this);
+ return doc_environment_->CountPages(this);
}
int32_t CXFA_FFDoc::GetCurrentPage() const {
- return m_pDocEnvironment->GetCurrentPage(this);
+ return doc_environment_->GetCurrentPage(this);
}
void CXFA_FFDoc::SetCurrentPage(int32_t iCurPage) {
- m_pDocEnvironment->SetCurrentPage(this, iCurPage);
+ doc_environment_->SetCurrentPage(this, iCurPage);
}
bool CXFA_FFDoc::IsCalculationsEnabled() const {
- return m_pDocEnvironment->IsCalculationsEnabled(this);
+ return doc_environment_->IsCalculationsEnabled(this);
}
void CXFA_FFDoc::SetCalculationsEnabled(bool bEnabled) {
- return m_pDocEnvironment->SetCalculationsEnabled(this, bEnabled);
+ return doc_environment_->SetCalculationsEnabled(this, bEnabled);
}
WideString CXFA_FFDoc::GetTitle() const {
- return m_pDocEnvironment->GetTitle(this);
+ return doc_environment_->GetTitle(this);
}
void CXFA_FFDoc::SetTitle(const WideString& wsTitle) {
- m_pDocEnvironment->SetTitle(this, wsTitle);
+ doc_environment_->SetTitle(this, wsTitle);
}
void CXFA_FFDoc::ExportData(const WideString& wsFilePath, bool bXDP) {
- m_pDocEnvironment->ExportData(this, wsFilePath, bXDP);
+ doc_environment_->ExportData(this, wsFilePath, bXDP);
}
void CXFA_FFDoc::GotoURL(const WideString& bsURL) {
- m_pDocEnvironment->GotoURL(this, bsURL);
+ doc_environment_->GotoURL(this, bsURL);
}
bool CXFA_FFDoc::IsValidationsEnabled() const {
- return m_pDocEnvironment->IsValidationsEnabled(this);
+ return doc_environment_->IsValidationsEnabled(this);
}
void CXFA_FFDoc::SetValidationsEnabled(bool bEnabled) {
- m_pDocEnvironment->SetValidationsEnabled(this, bEnabled);
+ doc_environment_->SetValidationsEnabled(this, bEnabled);
}
void CXFA_FFDoc::SetFocusWidget(CXFA_FFWidget* hWidget) {
- m_pDocEnvironment->SetFocusWidget(this, hWidget);
+ doc_environment_->SetFocusWidget(this, hWidget);
}
void CXFA_FFDoc::Print(int32_t nStartPage,
int32_t nEndPage,
Mask<XFA_PrintOpt> dwOptions) {
- m_pDocEnvironment->Print(this, nStartPage, nEndPage, dwOptions);
+ doc_environment_->Print(this, nStartPage, nEndPage, dwOptions);
}
FX_ARGB CXFA_FFDoc::GetHighlightColor() const {
- return m_pDocEnvironment->GetHighlightColor(this);
+ return doc_environment_->GetHighlightColor(this);
}
IJS_Runtime* CXFA_FFDoc::GetIJSRuntime() const {
- return m_pDocEnvironment->GetIJSRuntime(this);
+ return doc_environment_->GetIJSRuntime(this);
}
CFX_XMLDocument* CXFA_FFDoc::GetXMLDocument() const {
- return m_pDocEnvironment->GetXMLDoc();
+ return doc_environment_->GetXMLDoc();
}
RetainPtr<IFX_SeekableReadStream> CXFA_FFDoc::OpenLinkedFile(
const WideString& wsLink) {
- return m_pDocEnvironment->OpenLinkedFile(this, wsLink);
+ return doc_environment_->OpenLinkedFile(this, wsLink);
}
CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) {
- return m_DocView && m_DocView->GetLayoutProcessor() == pLayout ? m_DocView
+ return doc_view_ && doc_view_->GetLayoutProcessor() == pLayout ? doc_view_
: nullptr;
}
CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
- return m_DocView;
+ return doc_view_;
}
bool CXFA_FFDoc::OpenDoc(CFX_XMLDocument* pXML) {
@@ -236,9 +238,9 @@
// At this point we've got an XFA document and we want to always return
// true to signify the load succeeded.
- m_pPDFFontMgr = std::make_unique<CFGAS_PDFFontMgr>(GetPDFDoc());
- m_FormType = FormType::kXFAForeground;
- CXFA_Node* pConfig = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));
+ pdffont_mgr_ = std::make_unique<CFGAS_PDFFontMgr>(GetPDFDoc());
+ form_type_ = FormType::kXFAForeground;
+ CXFA_Node* pConfig = ToNode(document_->GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig)
return true;
@@ -260,7 +262,7 @@
WideString wsType = pDynamicRender->JSObject()->GetContent(false);
if (wsType.EqualsASCII("required"))
- m_FormType = FormType::kXFAFull;
+ form_type_ = FormType::kXFAFull;
return true;
}
@@ -268,24 +270,25 @@
RetainPtr<CFGAS_GEFont> CXFA_FFDoc::GetPDFFont(const WideString& family,
uint32_t styles,
bool strict) {
- if (!m_pPDFFontMgr)
+ if (!pdffont_mgr_) {
return nullptr;
+ }
- return m_pPDFFontMgr->GetFont(family, styles, strict);
+ return pdffont_mgr_->GetFont(family, styles, strict);
}
RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage(WideStringView wsName,
int32_t& iImageXDpi,
int32_t& iImageYDpi) {
uint32_t dwHash = FX_HashCode_GetW(wsName);
- auto it = m_HashToDibDpiMap.find(dwHash);
- if (it != m_HashToDibDpiMap.end()) {
+ auto it = hash_to_dib_dpi_map_.find(dwHash);
+ if (it != hash_to_dib_dpi_map_.end()) {
iImageXDpi = it->second.iImageXDpi;
iImageYDpi = it->second.iImageYDpi;
return it->second.pDibSource.As<CFX_DIBitmap>();
}
- auto name_tree = CPDF_NameTree::Create(m_pPDFDoc, "XFAImages");
+ auto name_tree = CPDF_NameTree::Create(pdfdoc_, "XFAImages");
size_t count = name_tree ? name_tree->GetCount() : 0;
if (count == 0)
return nullptr;
@@ -315,7 +318,7 @@
pdfium::MakeRetain<CFX_ReadOnlySpanStream>(pAcc->GetSpan());
RetainPtr<CFX_DIBitmap> pDibSource = XFA_LoadImageFromBuffer(
std::move(pImageFileRead), FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
- m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
+ hash_to_dib_dpi_map_[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
return pDibSource;
}
diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h
index b5f2c45..3e0eb22 100644
--- a/xfa/fxfa/cxfa_ffdoc.h
+++ b/xfa/fxfa/cxfa_ffdoc.h
@@ -162,11 +162,11 @@
RetainPtr<IFX_SeekableReadStream> OpenLinkedFile(const WideString& wsLink);
CXFA_FFDocView* CreateDocView();
- FormType GetFormType() const { return m_FormType; }
- cppgc::Heap* GetHeap() const { return m_pHeap; }
- CXFA_Document* GetXFADoc() const { return m_pDocument; }
- CXFA_FFApp* GetApp() const { return m_pApp; }
- CPDF_Document* GetPDFDoc() const { return m_pPDFDoc; }
+ FormType GetFormType() const { return form_type_; }
+ cppgc::Heap* GetHeap() const { return heap_; }
+ CXFA_Document* GetXFADoc() const { return document_; }
+ CXFA_FFApp* GetApp() const { return app_; }
+ CPDF_Document* GetPDFDoc() const { return pdfdoc_; }
CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
CXFA_FFDocView* GetDocView();
RetainPtr<CFGAS_GEFont> GetPDFFont(const WideString& family,
@@ -186,16 +186,16 @@
cppgc::Heap* pHeap);
bool BuildDoc(CFX_XMLDocument* pXML);
- UnownedPtr<CallbackIface> const m_pDocEnvironment;
- UnownedPtr<CPDF_Document> const m_pPDFDoc;
- UnownedPtr<cppgc::Heap> const m_pHeap;
- cppgc::Member<CXFA_FFApp> const m_pApp;
- cppgc::Member<CXFA_FFNotify> m_pNotify;
- cppgc::Member<CXFA_Document> m_pDocument;
- cppgc::Member<CXFA_FFDocView> m_DocView;
- std::unique_ptr<CFGAS_PDFFontMgr> m_pPDFFontMgr;
- std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap;
- FormType m_FormType = FormType::kXFAForeground;
+ UnownedPtr<CallbackIface> const doc_environment_;
+ UnownedPtr<CPDF_Document> const pdfdoc_;
+ UnownedPtr<cppgc::Heap> const heap_;
+ cppgc::Member<CXFA_FFApp> const app_;
+ cppgc::Member<CXFA_FFNotify> notify_;
+ cppgc::Member<CXFA_Document> document_;
+ cppgc::Member<CXFA_FFDocView> doc_view_;
+ std::unique_ptr<CFGAS_PDFFontMgr> pdffont_mgr_;
+ std::map<uint32_t, FX_IMAGEDIB_AND_DPI> hash_to_dib_dpi_map_;
+ FormType form_type_ = FormType::kXFAForeground;
};
#endif // XFA_FXFA_CXFA_FFDOC_H_
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 451b218..dd9b9b7 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -80,29 +80,29 @@
kXFAEventActivityData};
CXFA_FFDocView::UpdateScope::UpdateScope(CXFA_FFDocView* pDocView)
- : m_pDocView(pDocView) {
- m_pDocView->LockUpdate();
+ : doc_view_(pDocView) {
+ doc_view_->LockUpdate();
}
CXFA_FFDocView::UpdateScope::~UpdateScope() {
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
+ doc_view_->UnlockUpdate();
+ doc_view_->UpdateDocView();
}
-CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
+CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc) : doc_(pDoc) {}
CXFA_FFDocView::~CXFA_FFDocView() = default;
void CXFA_FFDocView::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDoc);
- visitor->Trace(m_pWidgetHandler);
- visitor->Trace(m_pFocusNode);
- visitor->Trace(m_pFocusWidget);
- ContainerTrace(visitor, m_ValidateNodes);
- ContainerTrace(visitor, m_CalculateNodes);
- ContainerTrace(visitor, m_NewAddedNodes);
- ContainerTrace(visitor, m_BindItems);
- ContainerTrace(visitor, m_IndexChangedSubforms);
+ visitor->Trace(doc_);
+ visitor->Trace(widget_handler_);
+ visitor->Trace(focus_node_);
+ visitor->Trace(focus_widget_);
+ ContainerTrace(visitor, validate_nodes_);
+ ContainerTrace(visitor, calculate_nodes_);
+ ContainerTrace(visitor, new_added_nodes_);
+ ContainerTrace(visitor, bind_items_);
+ ContainerTrace(visitor, index_changed_subforms_);
}
void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
@@ -112,16 +112,16 @@
}
int32_t CXFA_FFDocView::StartLayout() {
- m_iStatus = LayoutStatus::kStart;
- m_pDoc->GetXFADoc()->DoProtoMerge();
- m_pDoc->GetXFADoc()->DoDataMerge();
+ status_ = LayoutStatus::kStart;
+ doc_->GetXFADoc()->DoProtoMerge();
+ doc_->GetXFADoc()->DoDataMerge();
int32_t iStatus = GetLayoutProcessor()->StartLayout();
if (iStatus < 0)
return iStatus;
CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(doc_->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem)
return iStatus;
@@ -130,7 +130,7 @@
InitValidate(pRootItem);
ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true);
- m_iStatus = LayoutStatus::kStart;
+ status_ = LayoutStatus::kStart;
return iStatus;
}
@@ -139,13 +139,13 @@
if (iStatus != 100)
return iStatus;
- m_iStatus = LayoutStatus::kDoing;
+ status_ = LayoutStatus::kDoing;
return iStatus;
}
void CXFA_FFDocView::StopLayout() {
CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(doc_->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem)
return;
@@ -176,27 +176,28 @@
if (RunLayout())
ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true);
- m_CalculateNodes.clear();
- if (m_pFocusNode && !m_pFocusWidget)
- SetFocusNode(m_pFocusNode);
+ calculate_nodes_.clear();
+ if (focus_node_ && !focus_widget_) {
+ SetFocusNode(focus_node_);
+ }
- m_iStatus = LayoutStatus::kEnd;
+ status_ = LayoutStatus::kEnd;
}
void CXFA_FFDocView::AddNullTestMsg(const WideString& msg) {
- m_NullTestMsgArray.push_back(msg);
+ null_test_msg_array_.push_back(msg);
}
void CXFA_FFDocView::ShowNullTestMsg() {
- int32_t iCount = fxcrt::CollectionSize<int32_t>(m_NullTestMsgArray);
- CXFA_FFApp* pApp = m_pDoc->GetApp();
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(null_test_msg_array_);
+ CXFA_FFApp* pApp = doc_->GetApp();
CXFA_FFApp::CallbackIface* pAppProvider = pApp->GetAppProvider();
if (pAppProvider && iCount) {
int32_t remaining = iCount > 7 ? iCount - 7 : 0;
iCount -= remaining;
WideString wsMsg;
for (int32_t i = 0; i < iCount; i++)
- wsMsg += m_NullTestMsgArray[i] + L"\n";
+ wsMsg += null_test_msg_array_[i] + L"\n";
if (remaining > 0) {
wsMsg += L"\n" + WideString::Format(
@@ -208,7 +209,7 @@
static_cast<uint32_t>(AlertIcon::kStatus),
static_cast<uint32_t>(AlertButton::kOK));
}
- m_NullTestMsgArray.clear();
+ null_test_msg_array_.clear();
}
void CXFA_FFDocView::UpdateDocView() {
@@ -216,9 +217,9 @@
return;
LockUpdate();
- while (!m_NewAddedNodes.empty()) {
- CXFA_Node* pNode = m_NewAddedNodes.front();
- m_NewAddedNodes.pop_front();
+ while (!new_added_nodes_.empty()) {
+ CXFA_Node* pNode = new_added_nodes_.front();
+ new_added_nodes_.pop_front();
InitCalculate(pNode);
InitValidate(pNode);
ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true);
@@ -230,11 +231,12 @@
ShowNullTestMsg();
- if (RunLayout() && m_bLayoutEvent)
+ if (RunLayout() && layout_event_) {
RunEventLayoutReady();
+ }
- m_bLayoutEvent = false;
- m_CalculateNodes.clear();
+ layout_event_ = false;
+ calculate_nodes_.clear();
UnlockUpdate();
}
@@ -268,7 +270,7 @@
}
CXFA_LayoutProcessor* CXFA_FFDocView::GetLayoutProcessor() const {
- return CXFA_LayoutProcessor::FromDocument(m_pDoc->GetXFADoc());
+ return CXFA_LayoutProcessor::FromDocument(doc_->GetXFADoc());
}
bool CXFA_FFDocView::ResetSingleNodeData(CXFA_Node* pNode) {
@@ -288,7 +290,7 @@
}
void CXFA_FFDocView::ResetNode(CXFA_Node* pNode) {
- m_bLayoutEvent = true;
+ layout_event_ = true;
bool bChanged = false;
CXFA_Node* pFormNode = nullptr;
if (pNode) {
@@ -310,7 +312,7 @@
}
}
if (bChanged)
- m_pDoc->SetChangeMark();
+ doc_->SetChangeMark();
}
CXFA_FFWidget* CXFA_FFDocView::GetWidgetForNode(CXFA_Node* node) {
@@ -319,30 +321,34 @@
}
CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
- if (!m_pWidgetHandler) {
- m_pWidgetHandler = cppgc::MakeGarbageCollected<CXFA_FFWidgetHandler>(
- m_pDoc->GetHeap()->GetAllocationHandle(), this);
+ if (!widget_handler_) {
+ widget_handler_ = cppgc::MakeGarbageCollected<CXFA_FFWidgetHandler>(
+ doc_->GetHeap()->GetAllocationHandle(), this);
}
- return m_pWidgetHandler;
+ return widget_handler_;
}
bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* pNewFocus) {
- if (pNewFocus == m_pFocusWidget)
+ if (pNewFocus == focus_widget_) {
return false;
+ }
- if (m_pFocusWidget) {
- CXFA_ContentLayoutItem* pItem = m_pFocusWidget->GetLayoutItem();
+ if (focus_widget_) {
+ CXFA_ContentLayoutItem* pItem = focus_widget_->GetLayoutItem();
if (pItem->TestStatusBits(XFA_WidgetStatus::kVisible) &&
!pItem->TestStatusBits(XFA_WidgetStatus::kFocused)) {
- if (!m_pFocusWidget->IsLoaded())
- m_pFocusWidget->LoadWidget();
- if (!m_pFocusWidget->OnSetFocus(m_pFocusWidget))
- m_pFocusWidget.Clear();
+ if (!focus_widget_->IsLoaded()) {
+ focus_widget_->LoadWidget();
+ }
+ if (!focus_widget_->OnSetFocus(focus_widget_)) {
+ focus_widget_.Clear();
+ }
}
}
- if (m_pFocusWidget) {
- if (!m_pFocusWidget->OnKillFocus(pNewFocus))
+ if (focus_widget_) {
+ if (!focus_widget_->OnKillFocus(pNewFocus)) {
return false;
+ }
}
if (pNewFocus) {
@@ -350,17 +356,18 @@
XFA_WidgetStatus::kVisible)) {
if (!pNewFocus->IsLoaded())
pNewFocus->LoadWidget();
- if (!pNewFocus->OnSetFocus(m_pFocusWidget))
+ if (!pNewFocus->OnSetFocus(focus_widget_)) {
pNewFocus = nullptr;
+ }
}
}
if (pNewFocus) {
CXFA_Node* node = pNewFocus->GetNode();
- m_pFocusNode = node->IsWidgetReady() ? node : nullptr;
- m_pFocusWidget = pNewFocus;
+ focus_node_ = node->IsWidgetReady() ? node : nullptr;
+ focus_widget_ = pNewFocus;
} else {
- m_pFocusNode.Clear();
- m_pFocusWidget.Clear();
+ focus_node_.Clear();
+ focus_widget_.Clear();
}
return true;
}
@@ -370,30 +377,33 @@
if (!SetFocus(pNewFocus))
return;
- m_pFocusNode = node;
- if (m_iStatus != LayoutStatus::kEnd)
+ focus_node_ = node;
+ if (status_ != LayoutStatus::kEnd) {
return;
+ }
- m_pDoc->SetFocusWidget(m_pFocusWidget);
+ doc_->SetFocusWidget(focus_widget_);
}
void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
- if (m_pFocusNode != pWidget->GetNode())
+ if (focus_node_ != pWidget->GetNode()) {
return;
+ }
- m_pFocusNode.Clear();
- m_pFocusWidget.Clear();
+ focus_node_.Clear();
+ focus_widget_.Clear();
}
static XFA_EventError XFA_ProcessEvent(CXFA_FFDocView* pDocView,
CXFA_Node* pNode,
CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
+ if (!pParam || pParam->type_ == XFA_EVENT_Unknown) {
return XFA_EventError::kNotExist;
+ }
if (pNode && pNode->GetElementType() == XFA_Element::Draw)
return XFA_EventError::kNotExist;
- switch (pParam->m_eType) {
+ switch (pParam->type_) {
case XFA_EVENT_Calculate:
return pNode->ProcessCalculate(pDocView);
case XFA_EVENT_Validate:
@@ -409,7 +419,7 @@
return pNode->ExecuteScript(pDocView, calc->GetScriptIfExists(), pParam);
}
default:
- return pNode->ProcessEvent(pDocView, kXFAEventActivity[pParam->m_eType],
+ return pNode->ProcessEvent(pDocView, kXFAEventActivity[pParam->type_],
pParam);
}
}
@@ -431,7 +441,7 @@
return XFA_EventError::kNotExist;
CXFA_EventParam eParam(eEventType);
- eParam.m_bIsFormReady = bIsFormReady;
+ eParam.is_form_ready_ = bIsFormReady;
return XFA_ProcessEvent(this, pFormNode, &eParam);
}
@@ -452,7 +462,7 @@
return iRet;
CXFA_EventParam eParam(eEventType);
- eParam.m_bIsFormReady = bIsFormReady;
+ eParam.is_form_ready_ = bIsFormReady;
XFA_EventErrorAccumulate(&iRet, XFA_ProcessEvent(this, pFormNode, &eParam));
return iRet;
@@ -463,7 +473,7 @@
if (!IsValidXMLNameString(wsName)) {
return nullptr;
}
- CFXJSE_Engine* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
+ CFXJSE_Engine* pScriptContext = doc_->GetXFADoc()->GetScriptContext();
CXFA_Node* pRefNode = nullptr;
if (pRefWidget) {
CXFA_Node* node = pRefWidget->GetNode();
@@ -490,38 +500,38 @@
void CXFA_FFDocView::OnPageViewEvent(CXFA_ViewLayoutItem* pSender,
CXFA_FFDoc::PageViewEvent eEvent) {
CXFA_FFPageView* pFFPageView = pSender ? pSender->GetPageView() : nullptr;
- m_pDoc->OnPageViewEvent(pFFPageView, eEvent);
+ doc_->OnPageViewEvent(pFFPageView, eEvent);
}
void CXFA_FFDocView::InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rtInvalidate) {
- m_pDoc->InvalidateRect(pPageView, rtInvalidate);
+ doc_->InvalidateRect(pPageView, rtInvalidate);
}
bool CXFA_FFDocView::RunLayout() {
LockUpdate();
- m_bInLayoutStatus = true;
+ in_layout_status_ = true;
CXFA_LayoutProcessor* pProcessor = GetLayoutProcessor();
if (!pProcessor->IncrementLayout() && pProcessor->StartLayout() < 100) {
pProcessor->DoLayout();
UnlockUpdate();
- m_bInLayoutStatus = false;
- m_pDoc->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
+ in_layout_status_ = false;
+ doc_->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
return true;
}
- m_bInLayoutStatus = false;
- m_pDoc->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
+ in_layout_status_ = false;
+ doc_->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
UnlockUpdate();
return false;
}
void CXFA_FFDocView::RunSubformIndexChange() {
std::set<CXFA_Node*> seen;
- while (!m_IndexChangedSubforms.empty()) {
- CXFA_Node* pSubformNode = m_IndexChangedSubforms.front();
- m_IndexChangedSubforms.pop_front();
+ while (!index_changed_subforms_.empty()) {
+ CXFA_Node* pSubformNode = index_changed_subforms_.front();
+ index_changed_subforms_.pop_front();
bool bInserted = seen.insert(pSubformNode).second;
if (!bInserted || !pSubformNode->IsWidgetReady())
continue;
@@ -532,18 +542,19 @@
}
void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) {
- m_NewAddedNodes.push_back(pNode);
+ new_added_nodes_.push_back(pNode);
InitLayout(pNode);
}
void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Subform* pNode) {
- if (!pdfium::Contains(m_IndexChangedSubforms, pNode))
- m_IndexChangedSubforms.push_back(pNode);
+ if (!pdfium::Contains(index_changed_subforms_, pNode)) {
+ index_changed_subforms_.push_back(pNode);
+ }
}
void CXFA_FFDocView::RunDocClose() {
CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(doc_->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem)
return;
@@ -552,9 +563,9 @@
void CXFA_FFDocView::AddCalculateNode(CXFA_Node* node) {
CXFA_Node* pCurrentNode =
- !m_CalculateNodes.empty() ? m_CalculateNodes.back() : nullptr;
+ !calculate_nodes_.empty() ? calculate_nodes_.back() : nullptr;
if (pCurrentNode != node)
- m_CalculateNodes.push_back(node);
+ calculate_nodes_.push_back(node);
}
void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
@@ -569,8 +580,8 @@
}
size_t CXFA_FFDocView::RunCalculateRecursive(size_t index) {
- while (index < m_CalculateNodes.size()) {
- CXFA_Node* node = m_CalculateNodes[index];
+ while (index < calculate_nodes_.size()) {
+ CXFA_Node* node = calculate_nodes_[index];
AddCalculateNodeNotify(node);
size_t recurse = node->JSObject()->GetCalcRecursionCount() + 1;
@@ -588,22 +599,26 @@
}
XFA_EventError CXFA_FFDocView::RunCalculateWidgets() {
- if (!m_pDoc->IsCalculationsEnabled())
+ if (!doc_->IsCalculationsEnabled()) {
return XFA_EventError::kDisabled;
+ }
- if (!m_CalculateNodes.empty())
+ if (!calculate_nodes_.empty()) {
RunCalculateRecursive(0);
+ }
- for (CXFA_Node* node : m_CalculateNodes)
+ for (CXFA_Node* node : calculate_nodes_) {
node->JSObject()->SetCalcRecursionCount(0);
+ }
- m_CalculateNodes.clear();
+ calculate_nodes_.clear();
return XFA_EventError::kSuccess;
}
void CXFA_FFDocView::AddValidateNode(CXFA_Node* node) {
- if (!pdfium::Contains(m_ValidateNodes, node))
- m_ValidateNodes.push_back(node);
+ if (!pdfium::Contains(validate_nodes_, node)) {
+ validate_nodes_.push_back(node);
+ }
}
void CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
@@ -618,20 +633,22 @@
}
void CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
- if (!m_pDoc->IsValidationsEnabled())
+ if (!doc_->IsValidationsEnabled()) {
return;
+ }
ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true);
- m_ValidateNodes.clear();
+ validate_nodes_.clear();
}
void CXFA_FFDocView::RunValidate() {
- if (!m_pDoc->IsValidationsEnabled())
+ if (!doc_->IsValidationsEnabled()) {
return;
+ }
- while (!m_ValidateNodes.empty()) {
- CXFA_Node* node = m_ValidateNodes.front();
- m_ValidateNodes.pop_front();
+ while (!validate_nodes_.empty()) {
+ CXFA_Node* node = validate_nodes_.front();
+ validate_nodes_.pop_front();
if (!node->HasRemovedChildren())
node->ProcessValidate(this, 0);
}
@@ -639,7 +656,7 @@
bool CXFA_FFDocView::RunEventLayoutReady() {
CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(doc_->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pRootItem)
return false;
@@ -649,9 +666,9 @@
}
void CXFA_FFDocView::RunBindItems() {
- while (!m_BindItems.empty()) {
- CXFA_BindItems* item = m_BindItems.front();
- m_BindItems.pop_front();
+ while (!bind_items_.empty()) {
+ CXFA_BindItems* item = bind_items_.front();
+ bind_items_.pop_front();
if (item->HasRemovedChildren())
continue;
@@ -716,15 +733,16 @@
}
void CXFA_FFDocView::SetChangeMark() {
- if (m_iStatus != LayoutStatus::kEnd)
+ if (status_ != LayoutStatus::kEnd) {
return;
+ }
- m_pDoc->SetChangeMark();
+ doc_->SetChangeMark();
}
CXFA_Node* CXFA_FFDocView::GetRootSubform() {
CXFA_Node* pFormPacketNode =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ ToNode(doc_->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
if (!pFormPacketNode)
return nullptr;
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index a846b22..a575e3d 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -41,7 +41,7 @@
~UpdateScope();
private:
- UnownedPtr<CXFA_FFDocView> const m_pDocView;
+ UnownedPtr<CXFA_FFDocView> const doc_view_;
};
CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
@@ -49,14 +49,14 @@
void Trace(cppgc::Visitor* visitor) const;
- CXFA_FFDoc* GetDoc() const { return m_pDoc; }
+ CXFA_FFDoc* GetDoc() const { return doc_; }
int32_t StartLayout();
int32_t DoLayout();
void StopLayout();
- void SetLayoutEvent() { m_bLayoutEvent = true; }
- bool InLayoutStatus() const { return m_bInLayoutStatus; }
- LayoutStatus GetLayoutStatus() const { return m_iStatus; }
+ void SetLayoutEvent() { layout_event_ = true; }
+ bool InLayoutStatus() const { return in_layout_status_; }
+ LayoutStatus GetLayoutStatus() const { return status_; }
void UpdateDocView();
void UpdateUIDisplay(CXFA_Node* pNode, CXFA_FFWidget* pExcept);
@@ -67,7 +67,7 @@
void ResetNode(CXFA_Node* pNode);
CXFA_Node* GetRootSubform();
CXFA_FFWidgetHandler* GetWidgetHandler();
- CXFA_FFWidget* GetFocusWidget() const { return m_pFocusWidget; }
+ CXFA_FFWidget* GetFocusWidget() const { return focus_widget_; }
bool SetFocus(CXFA_FFWidget* pNewFocus);
CXFA_FFWidget* GetWidgetForNode(CXFA_Node* node);
CXFA_FFWidget* GetWidgetByName(const WideString& wsName,
@@ -75,8 +75,8 @@
CXFA_LayoutProcessor* GetLayoutProcessor() const;
void OnPageViewEvent(CXFA_ViewLayoutItem* pSender,
CXFA_FFDoc::PageViewEvent eEvent);
- void LockUpdate() { m_iLock++; }
- void UnlockUpdate() { m_iLock--; }
+ void LockUpdate() { lock_++; }
+ void UnlockUpdate() { lock_--; }
void InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rtInvalidate);
void RunDocClose();
@@ -91,7 +91,7 @@
bool RunLayout();
void AddNewFormNode(CXFA_Node* pNode);
void AddIndexChangedSubform(CXFA_Subform* pNode);
- CXFA_Node* GetFocusNode() const { return m_pFocusNode; }
+ CXFA_Node* GetFocusNode() const { return focus_node_; }
void SetFocusNode(CXFA_Node* pNode);
void DeleteLayoutItem(CXFA_FFWidget* pWidget);
XFA_EventError ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
@@ -99,7 +99,7 @@
bool bIsFormReady,
bool bRecursive);
- void AddBindItem(CXFA_BindItems* item) { m_BindItems.push_back(item); }
+ void AddBindItem(CXFA_BindItems* item) { bind_items_.push_back(item); }
void AddNullTestMsg(const WideString& msg);
private:
@@ -113,26 +113,26 @@
void ShowNullTestMsg();
bool ResetSingleNodeData(CXFA_Node* pNode);
- bool IsUpdateLocked() const { return m_iLock > 0; }
+ bool IsUpdateLocked() const { return lock_ > 0; }
void InitValidate(CXFA_Node* pNode);
void RunValidate();
XFA_EventError RunCalculateWidgets();
void RunSubformIndexChange();
- cppgc::Member<CXFA_FFDoc> const m_pDoc;
- cppgc::Member<CXFA_FFWidgetHandler> m_pWidgetHandler;
- cppgc::Member<CXFA_Node> m_pFocusNode;
- cppgc::Member<CXFA_FFWidget> m_pFocusWidget;
- std::list<cppgc::Member<CXFA_Node>> m_ValidateNodes;
- std::vector<cppgc::Member<CXFA_Node>> m_CalculateNodes;
- std::list<cppgc::Member<CXFA_BindItems>> m_BindItems;
- std::list<cppgc::Member<CXFA_Node>> m_NewAddedNodes;
- std::list<cppgc::Member<CXFA_Subform>> m_IndexChangedSubforms;
- std::vector<WideString> m_NullTestMsgArray;
- bool m_bLayoutEvent = false;
- bool m_bInLayoutStatus = false;
- LayoutStatus m_iStatus = LayoutStatus::kNone;
- int32_t m_iLock = 0;
+ cppgc::Member<CXFA_FFDoc> const doc_;
+ cppgc::Member<CXFA_FFWidgetHandler> widget_handler_;
+ cppgc::Member<CXFA_Node> focus_node_;
+ cppgc::Member<CXFA_FFWidget> focus_widget_;
+ std::list<cppgc::Member<CXFA_Node>> validate_nodes_;
+ std::vector<cppgc::Member<CXFA_Node>> calculate_nodes_;
+ std::list<cppgc::Member<CXFA_BindItems>> bind_items_;
+ std::list<cppgc::Member<CXFA_Node>> new_added_nodes_;
+ std::list<cppgc::Member<CXFA_Subform>> index_changed_subforms_;
+ std::vector<WideString> null_test_msg_array_;
+ bool layout_event_ = false;
+ bool in_layout_status_ = false;
+ LayoutStatus status_ = LayoutStatus::kNone;
+ int32_t lock_ = 0;
};
#endif // XFA_FXFA_CXFA_FFDOCVIEW_H_
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index e23ca50..72557fd 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -59,20 +59,20 @@
void CXFA_FFField::Trace(cppgc::Visitor* visitor) const {
CXFA_FFWidget::Trace(visitor);
- visitor->Trace(m_pNormalWidget);
+ visitor->Trace(normal_widget_);
}
CFX_RectF CXFA_FFField::GetBBox(FocusOption focus) {
if (focus == kDoNotDrawFocus)
return CXFA_FFWidget::GetBBox(kDoNotDrawFocus);
- switch (m_pNode->GetFFWidgetType()) {
+ switch (node_->GetFFWidgetType()) {
case XFA_FFWidgetType::kButton:
case XFA_FFWidgetType::kCheckButton:
case XFA_FFWidgetType::kImageEdit:
case XFA_FFWidgetType::kSignature:
case XFA_FFWidgetType::kChoiceList:
- return GetRotateMatrix().TransformRect(m_UIRect);
+ return GetRotateMatrix().TransformRect(uirect_);
default:
return CFX_RectF();
}
@@ -88,7 +88,7 @@
mtRotate.Concat(matrix);
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- DrawBorder(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate);
+ DrawBorder(pGS, node_->GetUIBorder(), uirect_, mtRotate);
RenderCaption(pGS, mtRotate);
DrawHighlight(pGS, mtRotate, highlight, kSquareShape);
@@ -105,31 +105,30 @@
if (highlight == kNoHighlight)
return;
- if (m_UIRect.IsEmpty() || !GetDoc()->GetXFADoc()->IsInteractive() ||
- !m_pNode->IsOpenAccess()) {
+ if (uirect_.IsEmpty() || !GetDoc()->GetXFADoc()->IsInteractive() ||
+ !node_->IsOpenAccess()) {
return;
}
pGS->SetFillColor(CFGAS_GEColor(GetDoc()->GetHighlightColor()));
CFGAS_GEPath path;
if (shape == kRoundShape)
- path.AddEllipse(m_UIRect);
+ path.AddEllipse(uirect_);
else
- path.AddRectangle(m_UIRect.left, m_UIRect.top, m_UIRect.width,
- m_UIRect.height);
+ path.AddRectangle(uirect_.left, uirect_.top, uirect_.width, uirect_.height);
pGS->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, pMatrix);
}
CFWL_Widget* CXFA_FFField::GetNormalWidget() {
- return m_pNormalWidget;
+ return normal_widget_;
}
const CFWL_Widget* CXFA_FFField::GetNormalWidget() const {
- return m_pNormalWidget;
+ return normal_widget_;
}
void CXFA_FFField::SetNormalWidget(CFWL_Widget* widget) {
- m_pNormalWidget = widget;
+ normal_widget_ = widget;
}
bool CXFA_FFField::IsLoaded() {
@@ -137,13 +136,13 @@
}
bool CXFA_FFField::LoadWidget() {
- m_pNode->LoadCaption(GetDoc());
+ node_->LoadCaption(GetDoc());
PerformLayout();
return true;
}
void CXFA_FFField::SetEditScrollOffset() {
- XFA_FFWidgetType eType = m_pNode->GetFFWidgetType();
+ XFA_FFWidgetType eType = node_->GetFFWidgetType();
if (eType != XFA_FFWidgetType::kTextEdit &&
eType != XFA_FFWidgetType::kNumericEdit &&
eType != XFA_FFWidgetType::kPasswordEdit) {
@@ -154,10 +153,10 @@
CXFA_ContentLayoutItem* pItem = GetLayoutItem()->GetPrev();
CXFA_FFField* pPrev = pItem ? ToField(pItem->GetFFWidget()) : nullptr;
if (pPrev)
- fScrollOffset = -(m_pNode->GetUIMargin().top);
+ fScrollOffset = -(node_->GetUIMargin().top);
while (pPrev) {
- fScrollOffset += pPrev->m_UIRect.height;
+ fScrollOffset += pPrev->uirect_.height;
pItem = pPrev->GetLayoutItem()->GetPrev();
pPrev = pItem ? ToField(pItem->GetFFWidget()) : nullptr;
}
@@ -177,7 +176,7 @@
void CXFA_FFField::CapPlacement() {
CFX_RectF rtWidget = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
if (margin) {
CXFA_ContentLayoutItem* pItem = GetLayoutItem();
float fLeftInset = margin->GetLeftInset();
@@ -198,14 +197,14 @@
XFA_AttributeValue iCapPlacement = XFA_AttributeValue::Unknown;
float fCapReserve = 0;
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
if (caption && !caption->IsHidden()) {
iCapPlacement = caption->GetPlacementType();
if ((iCapPlacement == XFA_AttributeValue::Top &&
GetLayoutItem()->GetPrev()) ||
(iCapPlacement == XFA_AttributeValue::Bottom &&
GetLayoutItem()->GetNext())) {
- m_CaptionRect = CFX_RectF();
+ caption_rect_ = CFX_RectF();
} else {
fCapReserve = caption->GetReserve();
if (iCapPlacement == XFA_AttributeValue::Top ||
@@ -216,19 +215,19 @@
}
CXFA_ContentLayoutItem* pItem = GetLayoutItem();
if (!pItem->GetPrev() && !pItem->GetNext()) {
- m_CaptionRect = rtWidget;
+ caption_rect_ = rtWidget;
} else {
pItem = pItem->GetFirst();
- m_CaptionRect = pItem->GetAbsoluteRect();
+ caption_rect_ = pItem->GetAbsoluteRect();
pItem = pItem->GetNext();
while (pItem) {
- m_CaptionRect.height += pItem->GetAbsoluteRect().Height();
+ caption_rect_.height += pItem->GetAbsoluteRect().Height();
pItem = pItem->GetNext();
}
- XFA_RectWithoutMargin(&m_CaptionRect, margin);
+ XFA_RectWithoutMargin(&caption_rect_, margin);
}
- CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout();
+ CXFA_TextLayout* pCapTextLayout = node_->GetCaptionTextLayout();
if (fCapReserve <= 0 && pCapTextLayout) {
CFX_SizeF minSize;
CFX_SizeF maxSize;
@@ -243,35 +242,35 @@
}
}
- m_UIRect = rtWidget;
+ uirect_ = rtWidget;
CXFA_Margin* capMargin = caption ? caption->GetMarginIfExists() : nullptr;
switch (iCapPlacement) {
case XFA_AttributeValue::Left: {
- m_CaptionRect.width = fCapReserve;
+ caption_rect_.width = fCapReserve;
CapLeftRightPlacement(capMargin, rtWidget, iCapPlacement);
- m_UIRect.width -= fCapReserve;
- m_UIRect.left += fCapReserve;
+ uirect_.width -= fCapReserve;
+ uirect_.left += fCapReserve;
break;
}
case XFA_AttributeValue::Top: {
- m_CaptionRect.height = fCapReserve;
+ caption_rect_.height = fCapReserve;
CapTopBottomPlacement(capMargin, rtWidget, iCapPlacement);
- m_UIRect.top += fCapReserve;
- m_UIRect.height -= fCapReserve;
+ uirect_.top += fCapReserve;
+ uirect_.height -= fCapReserve;
break;
}
case XFA_AttributeValue::Right: {
- m_CaptionRect.left = m_CaptionRect.right() - fCapReserve;
- m_CaptionRect.width = fCapReserve;
+ caption_rect_.left = caption_rect_.right() - fCapReserve;
+ caption_rect_.width = fCapReserve;
CapLeftRightPlacement(capMargin, rtWidget, iCapPlacement);
- m_UIRect.width -= fCapReserve;
+ uirect_.width -= fCapReserve;
break;
}
case XFA_AttributeValue::Bottom: {
- m_CaptionRect.top = m_CaptionRect.bottom() - fCapReserve;
- m_CaptionRect.height = fCapReserve;
+ caption_rect_.top = caption_rect_.bottom() - fCapReserve;
+ caption_rect_.height = fCapReserve;
CapTopBottomPlacement(capMargin, rtWidget, iCapPlacement);
- m_UIRect.height -= fCapReserve;
+ uirect_.height -= fCapReserve;
break;
}
case XFA_AttributeValue::Inline:
@@ -280,65 +279,67 @@
break;
}
- CXFA_Border* borderUI = m_pNode->GetUIBorder();
+ CXFA_Border* borderUI = node_->GetUIBorder();
if (borderUI) {
CXFA_Margin* borderMargin = borderUI->GetMarginIfExists();
- XFA_RectWithoutMargin(&m_UIRect, borderMargin);
+ XFA_RectWithoutMargin(&uirect_, borderMargin);
}
- m_UIRect.Normalize();
+ uirect_.Normalize();
}
void CXFA_FFField::CapTopBottomPlacement(const CXFA_Margin* margin,
const CFX_RectF& rtWidget,
XFA_AttributeValue iCapPlacement) {
- CFX_RectF rtUIMargin = m_pNode->GetUIMargin();
- m_CaptionRect.left += rtUIMargin.left;
+ CFX_RectF rtUIMargin = node_->GetUIMargin();
+ caption_rect_.left += rtUIMargin.left;
if (margin) {
- XFA_RectWithoutMargin(&m_CaptionRect, margin);
- if (m_CaptionRect.height < 0)
- m_CaptionRect.top += m_CaptionRect.height;
+ XFA_RectWithoutMargin(&caption_rect_, margin);
+ if (caption_rect_.height < 0) {
+ caption_rect_.top += caption_rect_.height;
+ }
}
float fWidth = rtUIMargin.left + rtUIMargin.width;
- float fHeight = m_CaptionRect.height + rtUIMargin.top + rtUIMargin.height;
+ float fHeight = caption_rect_.height + rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width)
- m_UIRect.width += fWidth - rtWidget.width;
+ uirect_.width += fWidth - rtWidget.width;
- if (fHeight == kDefaultUIHeight && m_UIRect.height < kMinUIHeight) {
- m_UIRect.height = kMinUIHeight;
- m_CaptionRect.top += rtUIMargin.top + rtUIMargin.height;
+ if (fHeight == kDefaultUIHeight && uirect_.height < kMinUIHeight) {
+ uirect_.height = kMinUIHeight;
+ caption_rect_.top += rtUIMargin.top + rtUIMargin.height;
} else if (fHeight > rtWidget.height) {
- m_UIRect.height += fHeight - rtWidget.height;
+ uirect_.height += fHeight - rtWidget.height;
if (iCapPlacement == XFA_AttributeValue::Bottom)
- m_CaptionRect.top += fHeight - rtWidget.height;
+ caption_rect_.top += fHeight - rtWidget.height;
}
}
void CXFA_FFField::CapLeftRightPlacement(const CXFA_Margin* margin,
const CFX_RectF& rtWidget,
XFA_AttributeValue iCapPlacement) {
- CFX_RectF rtUIMargin = m_pNode->GetUIMargin();
- m_CaptionRect.top += rtUIMargin.top;
- m_CaptionRect.height -= rtUIMargin.top;
+ CFX_RectF rtUIMargin = node_->GetUIMargin();
+ caption_rect_.top += rtUIMargin.top;
+ caption_rect_.height -= rtUIMargin.top;
if (margin) {
- XFA_RectWithoutMargin(&m_CaptionRect, margin);
- if (m_CaptionRect.height < 0)
- m_CaptionRect.top += m_CaptionRect.height;
+ XFA_RectWithoutMargin(&caption_rect_, margin);
+ if (caption_rect_.height < 0) {
+ caption_rect_.top += caption_rect_.height;
+ }
}
- float fWidth = m_CaptionRect.width + rtUIMargin.left + rtUIMargin.width;
+ float fWidth = caption_rect_.width + rtUIMargin.left + rtUIMargin.width;
float fHeight = rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width) {
- m_UIRect.width += fWidth - rtWidget.width;
+ uirect_.width += fWidth - rtWidget.width;
if (iCapPlacement == XFA_AttributeValue::Right)
- m_CaptionRect.left += fWidth - rtWidget.width;
+ caption_rect_.left += fWidth - rtWidget.width;
}
- if (fHeight == kDefaultUIHeight && m_UIRect.height < kMinUIHeight) {
- m_UIRect.height = kMinUIHeight;
- m_CaptionRect.top += rtUIMargin.top + rtUIMargin.height;
+ if (fHeight == kDefaultUIHeight && uirect_.height < kMinUIHeight) {
+ uirect_.height = kMinUIHeight;
+ caption_rect_.top += rtUIMargin.top + rtUIMargin.height;
} else if (fHeight > rtWidget.height) {
- m_UIRect.height += fHeight - rtWidget.height;
+ uirect_.height += fHeight - rtWidget.height;
}
}
@@ -348,7 +349,7 @@
}
uint32_t CXFA_FFField::UpdateUIProperty() {
- CXFA_Node* pUiNode = m_pNode->GetUIChildNode();
+ CXFA_Node* pUiNode = node_->GetUIChildNode();
if (pUiNode && pUiNode->GetElementType() == XFA_Element::DefaultUi)
return FWL_STYLEEXT_EDT_ReadOnly;
return 0;
@@ -358,10 +359,10 @@
if (!GetNormalWidget())
return;
- CFX_RectF rtUi = m_UIRect;
+ CFX_RectF rtUi = uirect_;
rtUi.width = std::max(rtUi.width, 1.0f);
if (!GetDoc()->GetXFADoc()->IsInteractive()) {
- float fFontSize = m_pNode->GetFontSize();
+ float fFontSize = node_->GetFontSize();
rtUi.height = std::max(rtUi.height, fFontSize);
}
GetNormalWidget()->SetWidgetRect(rtUi);
@@ -401,8 +402,9 @@
CFWL_MessageMouse::MouseCommand command) {
if (!GetNormalWidget())
return false;
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive())
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
+ }
if (!PtInActiveRect(point))
return false;
@@ -551,8 +553,9 @@
return true;
if (!GetNormalWidget())
return false;
- if (!m_pNode->IsOpenAccess())
+ if (!node_->IsOpenAccess()) {
return false;
+ }
CFWL_MessageKey msg(GetNormalWidget(), CFWL_MessageKey::KeyCommand::kChar,
dwFlags, dwChar);
@@ -566,8 +569,9 @@
return FWL_WidgetHit::Client;
if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (m_CaptionRect.Contains(point))
+ if (caption_rect_.Contains(point)) {
return FWL_WidgetHit::Titlebar;
+ }
return FWL_WidgetHit::Border;
}
@@ -577,44 +581,45 @@
}
void CXFA_FFField::LayoutCaption() {
- CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout();
+ CXFA_TextLayout* pCapTextLayout = node_->GetCaptionTextLayout();
if (!pCapTextLayout)
return;
- float fHeight = pCapTextLayout->Layout(m_CaptionRect.Size());
- m_CaptionRect.height = std::max(m_CaptionRect.height, fHeight);
+ float fHeight = pCapTextLayout->Layout(caption_rect_.Size());
+ caption_rect_.height = std::max(caption_rect_.height, fHeight);
}
void CXFA_FFField::RenderCaption(CFGAS_GEGraphics* pGS,
const CFX_Matrix& pMatrix) {
- CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout();
+ CXFA_TextLayout* pCapTextLayout = node_->GetCaptionTextLayout();
if (!pCapTextLayout)
return;
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
if (!caption || !caption->IsVisible())
return;
if (!pCapTextLayout->IsLoaded())
- pCapTextLayout->Layout(m_CaptionRect.Size());
+ pCapTextLayout->Layout(caption_rect_.Size());
- CFX_RectF rtClip = m_CaptionRect;
+ CFX_RectF rtClip = caption_rect_;
rtClip.Intersect(GetRectWithoutRotate());
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_Matrix mt(1, 0, 0, 1, m_CaptionRect.left, m_CaptionRect.top);
+ CFX_Matrix mt(1, 0, 0, 1, caption_rect_.left, caption_rect_.top);
rtClip = pMatrix.TransformRect(rtClip);
mt.Concat(pMatrix);
pCapTextLayout->DrawString(pRenderDevice, mt, rtClip, 0);
}
bool CXFA_FFField::ProcessCommittedData() {
- if (!m_pNode->IsOpenAccess())
+ if (!node_->IsOpenAccess()) {
return false;
+ }
if (!IsDataChanged())
return false;
- m_pDocView->SetChangeMark();
- m_pDocView->AddValidateNode(m_pNode.Get());
+ doc_view_->SetChangeMark();
+ doc_view_->AddValidateNode(node_.Get());
if (CalculateOverride() != 1)
return false;
@@ -622,9 +627,9 @@
}
int32_t CXFA_FFField::CalculateOverride() {
- CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists();
+ CXFA_Node* exclNode = node_->GetExclGroupIfExists();
if (!exclNode || !exclNode->IsWidgetReady())
- return CalculateNode(m_pNode.Get());
+ return CalculateNode(node_.Get());
if (CalculateNode(exclNode) == 0)
return 0;
@@ -726,26 +731,25 @@
CFWL_MessageMouse::MouseCommand cmd = event->GetCommand();
if (cmd == CFWL_MessageMouse::MouseCommand::kEnter) {
CXFA_EventParam eParam(XFA_EVENT_MouseEnter);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseEnter,
- &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseEnter,
+ &eParam);
} else if (cmd == CFWL_MessageMouse::MouseCommand::kLeave) {
CXFA_EventParam eParam(XFA_EVENT_MouseExit);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseExit,
- &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseExit,
+ &eParam);
} else if (cmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown) {
CXFA_EventParam eParam(XFA_EVENT_MouseDown);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseDown,
- &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseDown,
+ &eParam);
} else if (cmd == CFWL_MessageMouse::MouseCommand::kLeftButtonUp) {
CXFA_EventParam eParam(XFA_EVENT_MouseUp);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseUp,
- &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseUp, &eParam);
}
break;
}
case CFWL_Event::Type::Click: {
CXFA_EventParam eParam(XFA_EVENT_Click);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Click, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Click, &eParam);
break;
}
default:
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h
index f252017..e26b49e 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -106,11 +106,11 @@
XFA_AttributeValue iCapPlacement);
void SetEditScrollOffset();
- CFX_RectF m_UIRect;
- CFX_RectF m_CaptionRect;
+ CFX_RectF uirect_;
+ CFX_RectF caption_rect_;
private:
- cppgc::Member<CFWL_Widget> m_pNormalWidget;
+ cppgc::Member<CFWL_Widget> normal_widget_;
};
inline CXFA_FFDropDown* ToDropDown(CXFA_FFField* field) {
diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp
index bc1a67f..63954d6d 100644
--- a/xfa/fxfa/cxfa_ffimage.cpp
+++ b/xfa/fxfa/cxfa_ffimage.cpp
@@ -52,18 +52,18 @@
return;
CFX_RectF rtImage = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
XFA_RectWithoutMargin(&rtImage, margin);
XFA_AttributeValue iHorzAlign = XFA_AttributeValue::Left;
XFA_AttributeValue iVertAlign = XFA_AttributeValue::Top;
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (para) {
iHorzAlign = para->GetHorizontalAlign();
iVertAlign = para->GetVerticalAlign();
}
- auto* value = m_pNode->GetFormValueIfExists();
+ auto* value = node_->GetFormValueIfExists();
if (!value)
return;
@@ -72,6 +72,6 @@
return;
XFA_DrawImage(pGS, rtImage, mtRotate, std::move(pDIBitmap),
- image->GetAspect(), m_pNode->GetLayoutImageDpi(), iHorzAlign,
+ image->GetAspect(), node_->GetLayoutImageDpi(), iHorzAlign,
iVertAlign);
}
diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp
index ba97f79..6297cc4 100644
--- a/xfa/fxfa/cxfa_ffimageedit.cpp
+++ b/xfa/fxfa/cxfa_ffimageedit.cpp
@@ -30,12 +30,12 @@
CXFA_FFImageEdit::~CXFA_FFImageEdit() = default;
void CXFA_FFImageEdit::PreFinalize() {
- m_pNode->SetEditImage(nullptr);
+ node_->SetEditImage(nullptr);
}
void CXFA_FFImageEdit::Trace(cppgc::Visitor* visitor) const {
CXFA_FFField::Trace(visitor);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(old_delegate_);
}
bool CXFA_FFImageEdit::LoadWidget() {
@@ -48,12 +48,13 @@
CFWL_NoteDriver* pNoteDriver = pPictureBox->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pPictureBox, pPictureBox);
- m_pOldDelegate = pPictureBox->GetDelegate();
+ old_delegate_ = pPictureBox->GetDelegate();
pPictureBox->SetDelegate(this);
CXFA_FFField::LoadWidget();
- if (!m_pNode->GetEditImage())
+ if (!node_->GetEditImage()) {
UpdateFWLData();
+ }
return true;
}
@@ -68,23 +69,23 @@
mtRotate.Concat(matrix);
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- DrawBorder(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate);
+ DrawBorder(pGS, node_->GetUIBorder(), uirect_, mtRotate);
RenderCaption(pGS, mtRotate);
- RetainPtr<CFX_DIBitmap> pDIBitmap = m_pNode->GetEditImage();
+ RetainPtr<CFX_DIBitmap> pDIBitmap = node_->GetEditImage();
if (!pDIBitmap)
return;
CFX_RectF rtImage = GetNormalWidget()->GetWidgetRect();
XFA_AttributeValue iHorzAlign = XFA_AttributeValue::Left;
XFA_AttributeValue iVertAlign = XFA_AttributeValue::Top;
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (para) {
iHorzAlign = para->GetHorizontalAlign();
iVertAlign = para->GetVerticalAlign();
}
XFA_AttributeValue iAspect = XFA_AttributeValue::Fit;
- CXFA_Value* value = m_pNode->GetFormValueIfExists();
+ CXFA_Value* value = node_->GetFormValueIfExists();
if (value) {
CXFA_Image* image = value->GetImageIfExists();
if (image)
@@ -92,7 +93,7 @@
}
XFA_DrawImage(pGS, rtImage, mtRotate, std::move(pDIBitmap), iAspect,
- m_pNode->GetEditImageDpi(), iHorzAlign, iVertAlign);
+ node_->GetEditImageDpi(), iHorzAlign, iVertAlign);
}
bool CXFA_FFImageEdit::AcceptsFocusOnButtonDown(
@@ -102,8 +103,9 @@
if (command != CFWL_MessageMouse::MouseCommand::kLeftButtonDown)
return CXFA_FFField::AcceptsFocusOnButtonDown(dwFlags, point, command);
- if (!m_pNode->IsOpenAccess())
+ if (!node_->IsOpenAccess()) {
return false;
+ }
if (!PtInActiveRect(point))
return false;
@@ -124,8 +126,8 @@
if (!GetNormalWidget())
return;
- CFX_RectF rtUIMargin = m_pNode->GetUIMargin();
- CFX_RectF rtImage(m_UIRect);
+ CFX_RectF rtUIMargin = node_->GetUIMargin();
+ CFX_RectF rtImage(uirect_);
rtImage.Deflate(rtUIMargin.left, rtUIMargin.top, rtUIMargin.width,
rtUIMargin.height);
GetNormalWidget()->SetWidgetRect(rtImage);
@@ -136,22 +138,22 @@
}
void CXFA_FFImageEdit::UpdateFWLData() {
- m_pNode->SetEditImage(nullptr);
- m_pNode->LoadEditImage(GetDoc());
+ node_->SetEditImage(nullptr);
+ node_->LoadEditImage(GetDoc());
}
void CXFA_FFImageEdit::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFImageEdit::OnProcessEvent(pdfium::CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
}
void CXFA_FFImageEdit::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, matrix);
+ old_delegate_->OnDrawWidget(pGraphics, matrix);
}
FormFieldType CXFA_FFImageEdit::GetFormFieldType() {
diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h
index ae9affa..f6fab71 100644
--- a/xfa/fxfa/cxfa_ffimageedit.h
+++ b/xfa/fxfa/cxfa_ffimageedit.h
@@ -45,7 +45,7 @@
void UpdateFWLData() override;
bool CommitData() override;
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
};
#endif // XFA_FXFA_CXFA_FFIMAGEEDIT_H_
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index 792db31..12e350b 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -85,7 +85,7 @@
if (!HasVisibleStatus())
return;
- CXFA_Value* value = m_pNode->GetFormValueIfExists();
+ CXFA_Value* value = node_->GetFormValueIfExists();
if (!value)
return;
@@ -111,7 +111,7 @@
mtRotate.Concat(matrix);
CFX_RectF rtLine = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
XFA_RectWithoutMargin(&rtLine, margin);
GetRectFromHand(rtLine, line ? line->GetHand() : XFA_AttributeValue::Left,
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 76ab86b..8142a9f 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -41,7 +41,7 @@
void CXFA_FFListBox::Trace(cppgc::Visitor* visitor) const {
CXFA_FFDropDown::Trace(visitor);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(old_delegate_);
}
bool CXFA_FFListBox::LoadWidget() {
@@ -57,13 +57,13 @@
CFWL_NoteDriver* pNoteDriver = pListBox->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pListBox, pListBox);
- m_pOldDelegate = pListBox->GetDelegate();
+ old_delegate_ = pListBox->GetDelegate();
pListBox->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pListBox);
- std::vector<WideString> displayables = m_pNode->GetChoiceListItems(false);
- std::vector<WideString> settables = m_pNode->GetChoiceListItems(true);
+ std::vector<WideString> displayables = node_->GetChoiceListItems(false);
+ std::vector<WideString> settables = node_->GetChoiceListItems(true);
if (displayables.size() > settables.size())
displayables.resize(settables.size());
@@ -71,13 +71,15 @@
pListBox->AddString(label);
uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
- if (m_pNode->IsChoiceListMultiSelect())
+ if (node_->IsChoiceListMultiSelect()) {
dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
+ }
dwExtendedStyle |= GetAlignment();
pListBox->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
- for (int32_t selected : m_pNode->GetSelectedItems())
+ for (int32_t selected : node_->GetSelectedItems()) {
pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true);
+ }
}
return CXFA_FFField::LoadWidget();
@@ -97,12 +99,12 @@
for (int32_t i = 0; i < iSels; ++i)
iSelArray.push_back(pListBox->GetSelIndex(i));
- m_pNode->SetSelectedItems(iSelArray, true, false, true);
+ node_->SetSelectedItems(iSelArray, true, false, true);
return true;
}
bool CXFA_FFListBox::IsDataChanged() {
- std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
+ std::vector<int32_t> iSelArray = node_->GetSelectedItems();
int32_t iOldSels = fxcrt::CollectionSize<int32_t>(iSelArray);
auto* pListBox = ToListBox(GetNormalWidget());
int32_t iSels = pListBox->CountSelItems();
@@ -118,7 +120,7 @@
}
uint32_t CXFA_FFListBox::GetAlignment() {
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (!para)
return 0;
@@ -148,7 +150,7 @@
if (!pListBox)
return;
- std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
+ std::vector<int32_t> iSelArray = node_->GetSelectedItems();
std::vector<CFWL_ListBox::Item*> selItemArray(iSelArray.size());
std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
[pListBox](int32_t val) { return pListBox->GetSelItem(val); });
@@ -162,8 +164,8 @@
void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) {
CXFA_EventParam eParam(XFA_EVENT_Change);
- eParam.m_wsPrevText = m_pNode->GetValue(XFA_ValuePicture::kRaw);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
+ eParam.prev_text_ = node_->GetValue(XFA_ValuePicture::kRaw);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
}
void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) {
@@ -191,7 +193,7 @@
}
void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
@@ -203,12 +205,12 @@
default:
break;
}
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
}
void CXFA_FFListBox::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, matrix);
+ old_delegate_->OnDrawWidget(pGraphics, matrix);
}
FormFieldType CXFA_FFListBox::GetFormFieldType() {
diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h
index 6431e5d..5312c66 100644
--- a/xfa/fxfa/cxfa_fflistbox.h
+++ b/xfa/fxfa/cxfa_fflistbox.h
@@ -46,7 +46,7 @@
uint32_t GetAlignment();
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
};
#endif // XFA_FXFA_CXFA_FFLISTBOX_H_
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 3630910..0ca8c78 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -43,17 +43,17 @@
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_passwordedit.h"
-CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
+CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : doc_(pDoc) {}
CXFA_FFNotify::~CXFA_FFNotify() = default;
void CXFA_FFNotify::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDoc);
+ visitor->Trace(doc_);
}
void CXFA_FFNotify::OnPageViewEvent(CXFA_ViewLayoutItem* pSender,
CXFA_FFDoc::PageViewEvent eEvent) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout());
+ CXFA_FFDocView* pDocView = doc_->GetDocView(pSender->GetLayout());
if (pDocView)
pDocView->OnPageViewEvent(pSender, eEvent);
}
@@ -64,7 +64,7 @@
if (pSender->GetFFWidgetType() != XFA_FFWidgetType::kChoiceList)
return;
- CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
+ CXFA_FFWidget* pWidget = doc_->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
if (pWidget->IsLoaded())
ToDropDown(ToField(pWidget))->InsertItem(wsLabel, iIndex);
@@ -76,7 +76,7 @@
if (pSender->GetFFWidgetType() != XFA_FFWidgetType::kChoiceList)
return;
- CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
+ CXFA_FFWidget* pWidget = doc_->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
if (pWidget->IsLoaded())
ToDropDown(ToField(pWidget))->DeleteItem(iIndex);
@@ -87,10 +87,9 @@
if (pNode->GetElementType() != XFA_Element::PageArea)
return nullptr;
- auto* pLayout = CXFA_LayoutProcessor::FromDocument(m_pDoc->GetXFADoc());
+ auto* pLayout = CXFA_LayoutProcessor::FromDocument(doc_->GetXFADoc());
return cppgc::MakeGarbageCollected<CXFA_FFPageView>(
- m_pDoc->GetHeap()->GetAllocationHandle(), m_pDoc->GetDocView(pLayout),
- pNode);
+ doc_->GetHeap()->GetAllocationHandle(), doc_->GetDocView(pLayout), pNode);
}
CXFA_FFWidget* CXFA_FFNotify::OnCreateContentLayoutItem(CXFA_Node* pNode) {
@@ -109,7 +108,7 @@
return nullptr;
pWidget = cppgc::MakeGarbageCollected<CXFA_FFBarcode>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode, child);
+ doc_->GetHeap()->GetAllocationHandle(), pNode, child);
break;
}
case XFA_FFWidgetType::kButton: {
@@ -118,7 +117,7 @@
return nullptr;
pWidget = cppgc::MakeGarbageCollected<CXFA_FFPushButton>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode, child);
+ doc_->GetHeap()->GetAllocationHandle(), pNode, child);
break;
}
case XFA_FFWidgetType::kCheckButton: {
@@ -127,30 +126,30 @@
return nullptr;
pWidget = cppgc::MakeGarbageCollected<CXFA_FFCheckButton>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode, child);
+ doc_->GetHeap()->GetAllocationHandle(), pNode, child);
break;
}
case XFA_FFWidgetType::kChoiceList: {
if (pNode->IsListBox()) {
pWidget = cppgc::MakeGarbageCollected<CXFA_FFListBox>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
} else {
pWidget = cppgc::MakeGarbageCollected<CXFA_FFComboBox>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
}
break;
}
case XFA_FFWidgetType::kDateTimeEdit:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFDateTimeEdit>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kImageEdit:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFImageEdit>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kNumericEdit:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFNumericEdit>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kPasswordEdit: {
auto* child = CXFA_PasswordEdit::FromNode(pNode->GetUIChildNode());
@@ -158,66 +157,66 @@
return nullptr;
pWidget = cppgc::MakeGarbageCollected<CXFA_FFPasswordEdit>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode, child);
+ doc_->GetHeap()->GetAllocationHandle(), pNode, child);
break;
}
case XFA_FFWidgetType::kSignature:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFSignature>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kTextEdit:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFTextEdit>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kArc:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFArc>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kLine:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFLine>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kRectangle:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFRectangle>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kText:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFText>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kImage:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFImage>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kSubform:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFWidget>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kExclGroup:
pWidget = cppgc::MakeGarbageCollected<CXFA_FFExclGroup>(
- m_pDoc->GetHeap()->GetAllocationHandle(), pNode);
+ doc_->GetHeap()->GetAllocationHandle(), pNode);
break;
case XFA_FFWidgetType::kNone:
return nullptr;
}
- auto* pLayout = CXFA_LayoutProcessor::FromDocument(m_pDoc->GetXFADoc());
- pWidget->SetDocView(m_pDoc->GetDocView(pLayout));
+ auto* pLayout = CXFA_LayoutProcessor::FromDocument(doc_->GetXFADoc());
+ pWidget->SetDocView(doc_->GetDocView(pLayout));
return pWidget;
}
void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
float* pCalcWidth,
float* pCalcHeight) {
- pItem->StartWidgetLayout(m_pDoc.Get(), pCalcWidth, pCalcHeight);
+ pItem->StartWidgetLayout(doc_.Get(), pCalcWidth, pCalcHeight);
}
bool CXFA_FFNotify::RunScript(CXFA_Script* script, CXFA_Node* item) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return false;
CXFA_EventParam EventParam(XFA_EVENT_Unknown);
- EventParam.m_bTargeted = false;
+ EventParam.targeted_ = false;
CXFA_Node::BoolScriptResult result =
item->ExecuteBoolScript(pDocView, script, &EventParam);
@@ -230,7 +229,7 @@
XFA_EVENTTYPE eEventType,
bool bIsFormReady,
bool bRecursive) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return XFA_EventError::kNotExist;
return pDocView->ExecEventActivityByDeepFirst(pFormNode, eEventType,
@@ -238,7 +237,7 @@
}
void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -247,12 +246,12 @@
}
CXFA_FFApp::CallbackIface* CXFA_FFNotify::GetAppProvider() {
- return m_pDoc->GetApp()->GetAppProvider();
+ return doc_->GetApp()->GetAppProvider();
}
void CXFA_FFNotify::HandleWidgetEvent(CXFA_Node* pNode,
CXFA_EventParam* pParam) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -264,7 +263,7 @@
}
void CXFA_FFNotify::OpenDropDownList(CXFA_Node* pNode) {
- auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(m_pDoc->GetXFADoc());
+ auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(doc_->GetXFADoc());
CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
if (!pLayoutItem)
return;
@@ -286,12 +285,12 @@
if (!pComboBox)
return;
- CXFA_FFDocView::UpdateScope scope(m_pDoc->GetDocView());
+ CXFA_FFDocView::UpdateScope scope(doc_->GetDocView());
pComboBox->OpenDropDownList();
}
void CXFA_FFNotify::ResetData(CXFA_Node* pNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -299,13 +298,13 @@
}
CXFA_FFDocView::LayoutStatus CXFA_FFNotify::GetLayoutStatus() {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
return pDocView ? pDocView->GetLayoutStatus()
: CXFA_FFDocView::LayoutStatus::kNone;
}
void CXFA_FFNotify::RunNodeInitialize(CXFA_Node* pNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -313,7 +312,7 @@
}
void CXFA_FFNotify::RunSubformIndexChange(CXFA_Subform* pSubformNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -321,19 +320,19 @@
}
CXFA_Node* CXFA_FFNotify::GetFocusWidgetNode() {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
return pDocView ? pDocView->GetFocusNode() : nullptr;
}
void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
pDocView->SetFocusNode(pNode);
}
void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -362,13 +361,13 @@
if (!pSender->IsFormContainer())
return;
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
if (pDocView->GetLayoutStatus() != CXFA_FFDocView::LayoutStatus::kEnd)
return;
- CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
+ CXFA_FFWidget* pWidget = doc_->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
if (pWidget->IsLoaded())
pWidget->InvalidateRect();
@@ -379,7 +378,7 @@
XFA_Attribute eAttr,
CXFA_Node* pParentNode,
CXFA_Node* pWidgetNode) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -416,18 +415,18 @@
pDocView->AddCalculateNodeNotify(pSender);
if (eType == XFA_Element::Value || bIsContainerNode) {
if (bIsContainerNode) {
- m_pDoc->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
+ doc_->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
pDocView->AddCalculateNode(pWidgetNode);
pDocView->AddValidateNode(pWidgetNode);
} else if (pWidgetNode->GetParent()->GetElementType() ==
XFA_Element::ExclGroup) {
- m_pDoc->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
+ doc_->GetDocView()->UpdateUIDisplay(pWidgetNode, nullptr);
}
return;
}
}
- CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pWidgetNode);
+ CXFA_FFWidget* pWidget = doc_->GetDocView()->GetWidgetForNode(pWidgetNode);
for (; pWidget; pWidget = pWidget->GetNextFFWidget()) {
if (!pWidget->IsLoaded())
continue;
@@ -440,14 +439,14 @@
}
void CXFA_FFNotify::OnContainerChanged() {
- m_pDoc->GetXFADoc()->GetLayoutProcessor()->SetHasChangedContainer();
+ doc_->GetXFADoc()->GetLayoutProcessor()->SetHasChangedContainer();
}
void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) {
if (!pSender->IsFormContainer())
return;
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -455,11 +454,11 @@
!pDocView->InLayoutStatus() &&
pDocView->GetLayoutStatus() == CXFA_FFDocView::LayoutStatus::kEnd;
if (bLayoutReady)
- m_pDoc->SetChangeMark();
+ doc_->SetChangeMark();
}
void CXFA_FFNotify::OnChildRemoved() {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ CXFA_FFDocView* pDocView = doc_->GetDocView();
if (!pDocView)
return;
@@ -467,14 +466,14 @@
!pDocView->InLayoutStatus() &&
pDocView->GetLayoutStatus() == CXFA_FFDocView::LayoutStatus::kEnd;
if (bLayoutReady)
- m_pDoc->SetChangeMark();
+ doc_->SetChangeMark();
}
void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
CXFA_LayoutItem* pSender,
int32_t iPageIdx,
Mask<XFA_WidgetStatus> dwStatus) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
+ CXFA_FFDocView* pDocView = doc_->GetDocView(pLayout);
if (!pDocView)
return;
@@ -492,7 +491,7 @@
dwStatus.TestAll(
{XFA_WidgetStatus::kVisible, XFA_WidgetStatus::kViewable})) {
pWidget->SetPageView(pNewPageView);
- m_pDoc->WidgetPostAdd(pWidget);
+ doc_->WidgetPostAdd(pWidget);
}
if (pDocView->GetLayoutStatus() != CXFA_FFDocView::LayoutStatus::kEnd ||
!(dwStatus & XFA_WidgetStatus::kVisible)) {
@@ -509,7 +508,7 @@
void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout,
CXFA_LayoutItem* pSender) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
+ CXFA_FFDocView* pDocView = doc_->GetDocView(pLayout);
if (!pDocView)
return;
@@ -518,6 +517,6 @@
return;
pDocView->DeleteLayoutItem(pWidget);
- m_pDoc->WidgetPreRemove(pWidget);
+ doc_->WidgetPreRemove(pWidget);
pWidget->InvalidateRect();
}
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index ff0ef84..33e9e76 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -68,7 +68,7 @@
bool bIsFormReady,
bool bRecursive);
void AddCalcValidate(CXFA_Node* pNode);
- CXFA_FFDoc* GetFFDoc() const { return m_pDoc; }
+ CXFA_FFDoc* GetFFDoc() const { return doc_; }
CXFA_FFApp::CallbackIface* GetAppProvider();
void HandleWidgetEvent(CXFA_Node* pNode, CXFA_EventParam* pParam);
void OpenDropDownList(CXFA_Node* pNode);
@@ -82,7 +82,7 @@
private:
explicit CXFA_FFNotify(CXFA_FFDoc* pDoc);
- cppgc::Member<CXFA_FFDoc> const m_pDoc;
+ cppgc::Member<CXFA_FFDoc> const doc_;
};
#endif // XFA_FXFA_CXFA_FFNOTIFY_H_
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index 6f971b6..c101012 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -31,12 +31,12 @@
CFWL_NoteDriver* pNoteDriver = pWidget->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = pWidget->GetDelegate();
+ old_delegate_ = pWidget->GetDelegate();
pWidget->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- pWidget->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
+ pWidget->SetText(node_->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
@@ -52,17 +52,19 @@
FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
FWL_STYLEEXT_EDT_Validate | FWL_STYLEEXT_EDT_Number;
dwExtendedStyle |= UpdateUIProperty();
- if (!m_pNode->IsHorizontalScrollPolicyOff())
+ if (!node_->IsHorizontalScrollPolicyOff()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
+ }
- std::optional<int32_t> numCells = m_pNode->GetNumberOfCells();
+ std::optional<int32_t> numCells = node_->GetNumberOfCells();
if (numCells.has_value() && numCells.value() > 0) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
pWidget->SetLimit(numCells.value());
}
dwExtendedStyle |= GetAlignment();
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive())
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
+ }
GetNormalWidget()->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
}
@@ -78,14 +80,13 @@
bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
const WideString& wsText) {
- WideString wsPattern = m_pNode->GetPictureContent(XFA_ValuePicture::kEdit);
+ WideString wsPattern = node_->GetPictureContent(XFA_ValuePicture::kEdit);
if (!wsPattern.IsEmpty())
return true;
WideString wsFormat;
- CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pNode.Get());
- widgetValue.GetNumericFormat(wsFormat, m_pNode->GetLeadDigits(),
- m_pNode->GetFracDigits());
- return widgetValue.ValidateNumericTemp(wsText, wsFormat,
- m_pNode->GetLocale());
+ CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(node_.Get());
+ widgetValue.GetNumericFormat(wsFormat, node_->GetLeadDigits(),
+ node_->GetFracDigits());
+ return widgetValue.ValidateNumericTemp(wsText, wsFormat, node_->GetLocale());
}
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 7673af7..6b6734a 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -150,7 +150,7 @@
public:
CXFA_TabParam() = default;
explicit CXFA_TabParam(CXFA_FFWidget* pWidget)
- : m_pItem(pWidget->GetLayoutItem()) {}
+ : item_(pWidget->GetLayoutItem()) {}
CXFA_TabParam(const CXFA_TabParam&) = delete;
CXFA_TabParam(CXFA_TabParam&&) noexcept = default;
~CXFA_TabParam() = default;
@@ -158,21 +158,21 @@
CXFA_TabParam& operator=(const CXFA_TabParam&) = delete;
CXFA_TabParam& operator=(CXFA_TabParam&&) noexcept = default;
- CXFA_FFWidget* GetWidget() const { return m_pItem->GetFFWidget(); }
+ CXFA_FFWidget* GetWidget() const { return item_->GetFFWidget(); }
const std::vector<cppgc::Persistent<CXFA_ContentLayoutItem>>& GetChildren()
const {
- return m_Children;
+ return children_;
}
- void ClearChildren() { m_Children.clear(); }
+ void ClearChildren() { children_.clear(); }
void AppendTabParam(const CXFA_TabParam* pParam) {
- m_Children.push_back(pParam->m_pItem);
- m_Children.insert(m_Children.end(), pParam->m_Children.begin(),
- pParam->m_Children.end());
+ children_.push_back(pParam->item_);
+ children_.insert(children_.end(), pParam->children_.begin(),
+ pParam->children_.end());
}
private:
- cppgc::Persistent<CXFA_ContentLayoutItem> m_pItem;
- std::vector<cppgc::Persistent<CXFA_ContentLayoutItem>> m_Children;
+ cppgc::Persistent<CXFA_ContentLayoutItem> item_;
+ std::vector<cppgc::Persistent<CXFA_ContentLayoutItem>> children_;
};
void OrderContainer(CXFA_LayoutItemIterator* sIterator,
@@ -230,18 +230,18 @@
} // namespace
CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
- : m_pPageArea(pPageArea), m_pDocView(pDocView) {}
+ : page_area_(pPageArea), doc_view_(pDocView) {}
CXFA_FFPageView::~CXFA_FFPageView() = default;
void CXFA_FFPageView::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pPageArea);
- visitor->Trace(m_pDocView);
- visitor->Trace(m_pLayoutItem);
+ visitor->Trace(page_area_);
+ visitor->Trace(doc_view_);
+ visitor->Trace(layout_item_);
}
CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
- return m_pDocView;
+ return doc_view_;
}
CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
@@ -271,18 +271,18 @@
CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(
CXFA_FFPageView* pPageView,
Mask<XFA_WidgetStatus> dwFilter)
- : m_sIterator(pPageView->GetLayoutItem()),
- m_dwFilter(dwFilter),
- m_bIgnoreRelevant(IsDocVersionBelow205(GetDocForPageView(pPageView))) {}
+ : s_iterator_(pPageView->GetLayoutItem()),
+ filter_(dwFilter),
+ ignore_relevant_(IsDocVersionBelow205(GetDocForPageView(pPageView))) {}
CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() = default;
CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() {
- m_sIterator.Reset();
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
+ s_iterator_.Reset();
+ for (CXFA_LayoutItem* pLayoutItem = s_iterator_.GetCurrent(); pLayoutItem;
+ pLayoutItem = s_iterator_.MoveToNext()) {
CXFA_FFWidget* hWidget = FilteredLoadedWidgetFromLayoutItem(
- pLayoutItem, m_dwFilter, m_bIgnoreRelevant);
+ pLayoutItem, filter_, ignore_relevant_);
if (hWidget)
return hWidget;
}
@@ -290,15 +290,15 @@
}
CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() {
- m_sIterator.SetCurrent(nullptr);
+ s_iterator_.SetCurrent(nullptr);
return MoveToPrevious();
}
CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
+ for (CXFA_LayoutItem* pLayoutItem = s_iterator_.MoveToNext(); pLayoutItem;
+ pLayoutItem = s_iterator_.MoveToNext()) {
CXFA_FFWidget* hWidget = FilteredLoadedWidgetFromLayoutItem(
- pLayoutItem, m_dwFilter, m_bIgnoreRelevant);
+ pLayoutItem, filter_, ignore_relevant_);
if (hWidget)
return hWidget;
}
@@ -306,10 +306,10 @@
}
CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToPrev()) {
+ for (CXFA_LayoutItem* pLayoutItem = s_iterator_.MoveToPrev(); pLayoutItem;
+ pLayoutItem = s_iterator_.MoveToPrev()) {
CXFA_FFWidget* hWidget = FilteredLoadedWidgetFromLayoutItem(
- pLayoutItem, m_dwFilter, m_bIgnoreRelevant);
+ pLayoutItem, filter_, ignore_relevant_);
if (hWidget)
return hWidget;
}
@@ -317,20 +317,20 @@
}
CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() {
- CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent();
+ CXFA_LayoutItem* pLayoutItem = s_iterator_.GetCurrent();
return pLayoutItem ? CXFA_FFWidget::FromLayoutItem(pLayoutItem) : nullptr;
}
bool CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* pWidget) {
- return pWidget && m_sIterator.SetCurrent(pWidget->GetLayoutItem());
+ return pWidget && s_iterator_.SetCurrent(pWidget->GetLayoutItem());
}
CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator(
CXFA_FFPageView* pPageView,
Mask<XFA_WidgetStatus> dwFilter)
- : m_pPageViewLayout(pPageView->GetLayoutItem()),
- m_dwFilter(dwFilter),
- m_bIgnoreRelevant(IsDocVersionBelow205(GetDocForPageView(pPageView))) {
+ : page_view_layout_(pPageView->GetLayoutItem()),
+ filter_(dwFilter),
+ ignore_relevant_(IsDocVersionBelow205(GetDocForPageView(pPageView))) {
CreateTabOrderWidgetArray();
}
@@ -338,73 +338,74 @@
default;
void CXFA_FFTabOrderPageWidgetIterator::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pPageViewLayout);
- ContainerTrace(visitor, m_TabOrderWidgetArray);
+ visitor->Trace(page_view_layout_);
+ ContainerTrace(visitor, tab_order_widget_array_);
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
- for (int32_t i = 0; i < fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray);
- i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
- true, m_bIgnoreRelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget]->GetFFWidget();
+ for (int32_t i = 0;
+ i < fxcrt::CollectionSize<int32_t>(tab_order_widget_array_); i++) {
+ if (PageWidgetFilter(tab_order_widget_array_[i]->GetFFWidget(), filter_,
+ true, ignore_relevant_)) {
+ cur_widget_ = i;
+ return tab_order_widget_array_[cur_widget_]->GetFFWidget();
}
}
return nullptr;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
- for (int32_t i = fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
+ for (int32_t i = fxcrt::CollectionSize<int32_t>(tab_order_widget_array_) - 1;
i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
- true, m_bIgnoreRelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget]->GetFFWidget();
+ if (PageWidgetFilter(tab_order_widget_array_[i]->GetFFWidget(), filter_,
+ true, ignore_relevant_)) {
+ cur_widget_ = i;
+ return tab_order_widget_array_[cur_widget_]->GetFFWidget();
}
}
return nullptr;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
- for (int32_t i = m_iCurWidget + 1;
- i < fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
- true, m_bIgnoreRelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget]->GetFFWidget();
+ for (int32_t i = cur_widget_ + 1;
+ i < fxcrt::CollectionSize<int32_t>(tab_order_widget_array_); i++) {
+ if (PageWidgetFilter(tab_order_widget_array_[i]->GetFFWidget(), filter_,
+ true, ignore_relevant_)) {
+ cur_widget_ = i;
+ return tab_order_widget_array_[cur_widget_]->GetFFWidget();
}
}
- m_iCurWidget = -1;
+ cur_widget_ = -1;
return nullptr;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
- for (int32_t i = m_iCurWidget - 1; i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
- true, m_bIgnoreRelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget]->GetFFWidget();
+ for (int32_t i = cur_widget_ - 1; i >= 0; i--) {
+ if (PageWidgetFilter(tab_order_widget_array_[i]->GetFFWidget(), filter_,
+ true, ignore_relevant_)) {
+ cur_widget_ = i;
+ return tab_order_widget_array_[cur_widget_]->GetFFWidget();
}
}
- m_iCurWidget = -1;
+ cur_widget_ = -1;
return nullptr;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() {
- return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget]->GetFFWidget()
- : nullptr;
+ return cur_widget_ >= 0 ? tab_order_widget_array_[cur_widget_]->GetFFWidget()
+ : nullptr;
}
bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
CXFA_FFWidget* hWidget) {
- auto it = std::find(m_TabOrderWidgetArray.begin(),
- m_TabOrderWidgetArray.end(), hWidget->GetLayoutItem());
- if (it == m_TabOrderWidgetArray.end())
+ auto it = std::find(tab_order_widget_array_.begin(),
+ tab_order_widget_array_.end(), hWidget->GetLayoutItem());
+ if (it == tab_order_widget_array_.end()) {
return false;
+ }
- m_iCurWidget =
- pdfium::checked_cast<int32_t>(it - m_TabOrderWidgetArray.begin());
+ cur_widget_ =
+ pdfium::checked_cast<int32_t>(it - tab_order_widget_array_.begin());
return true;
}
@@ -431,7 +432,7 @@
}
void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
- m_TabOrderWidgetArray.clear();
+ tab_order_widget_array_.clear();
const std::vector<CXFA_ContentLayoutItem*> items =
CreateSpaceOrderLayoutItems();
@@ -439,9 +440,9 @@
return;
CXFA_ContentLayoutItem* item = items[0];
- while (m_TabOrderWidgetArray.size() < items.size()) {
- if (!pdfium::Contains(m_TabOrderWidgetArray, item)) {
- m_TabOrderWidgetArray.emplace_back(item);
+ while (tab_order_widget_array_.size() < items.size()) {
+ if (!pdfium::Contains(tab_order_widget_array_, item)) {
+ tab_order_widget_array_.emplace_back(item);
CXFA_Node* node = item->GetFFWidget()->GetNode();
if (node->GetFFWidgetType() == XFA_FFWidgetType::kExclGroup) {
auto it = std::find(items.begin(), items.end(), item);
@@ -450,8 +451,9 @@
CXFA_FFWidget* radio = items[index % items.size()]->GetFFWidget();
if (radio->GetNode()->GetExclGroupIfExists() != node)
break;
- if (!pdfium::Contains(m_TabOrderWidgetArray, item))
- m_TabOrderWidgetArray.emplace_back(radio->GetLayoutItem());
+ if (!pdfium::Contains(tab_order_widget_array_, item)) {
+ tab_order_widget_array_.emplace_back(radio->GetLayoutItem());
+ }
++index;
}
}
@@ -470,7 +472,7 @@
std::vector<CXFA_ContentLayoutItem*>
CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderLayoutItems() {
std::vector<CXFA_ContentLayoutItem*> items;
- CXFA_LayoutItemIterator sIterator(m_pPageViewLayout.Get());
+ CXFA_LayoutItemIterator sIterator(page_view_layout_.Get());
CXFA_TabParam tabparam;
bool bCurrentItem = false;
bool bContentArea = false;
diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h
index 32dd1d9..b6a09c4 100644
--- a/xfa/fxfa/cxfa_ffpageview.h
+++ b/xfa/fxfa/cxfa_ffpageview.h
@@ -30,8 +30,8 @@
void Trace(cppgc::Visitor* visitor) const;
- CXFA_ViewLayoutItem* GetLayoutItem() const { return m_pLayoutItem; }
- void SetLayoutItem(CXFA_ViewLayoutItem* pItem) { m_pLayoutItem = pItem; }
+ CXFA_ViewLayoutItem* GetLayoutItem() const { return layout_item_; }
+ void SetLayoutItem(CXFA_ViewLayoutItem* pItem) { layout_item_ = pItem; }
CXFA_FFDocView* GetDocView() const;
CFX_RectF GetPageViewRect() const;
@@ -44,9 +44,9 @@
private:
CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
- cppgc::Member<CXFA_Node> const m_pPageArea;
- cppgc::Member<CXFA_FFDocView> const m_pDocView;
- cppgc::Member<CXFA_ViewLayoutItem> m_pLayoutItem;
+ cppgc::Member<CXFA_Node> const page_area_;
+ cppgc::Member<CXFA_FFDocView> const doc_view_;
+ cppgc::Member<CXFA_ViewLayoutItem> layout_item_;
};
class CXFA_FFPageWidgetIterator final : public CXFA_FFWidget::IteratorIface {
@@ -66,9 +66,9 @@
bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
private:
- CXFA_LayoutItemIterator m_sIterator;
- const Mask<XFA_WidgetStatus> m_dwFilter;
- const bool m_bIgnoreRelevant;
+ CXFA_LayoutItemIterator s_iterator_;
+ const Mask<XFA_WidgetStatus> filter_;
+ const bool ignore_relevant_;
};
class CXFA_FFTabOrderPageWidgetIterator final
@@ -98,11 +98,11 @@
void CreateTabOrderWidgetArray();
std::vector<CXFA_ContentLayoutItem*> CreateSpaceOrderLayoutItems();
- cppgc::Member<CXFA_ViewLayoutItem> const m_pPageViewLayout;
- std::vector<cppgc::Member<CXFA_ContentLayoutItem>> m_TabOrderWidgetArray;
- const Mask<XFA_WidgetStatus> m_dwFilter;
- int32_t m_iCurWidget = -1;
- const bool m_bIgnoreRelevant;
+ cppgc::Member<CXFA_ViewLayoutItem> const page_view_layout_;
+ std::vector<cppgc::Member<CXFA_ContentLayoutItem>> tab_order_widget_array_;
+ const Mask<XFA_WidgetStatus> filter_;
+ int32_t cur_widget_ = -1;
+ const bool ignore_relevant_;
};
#endif // XFA_FXFA_CXFA_FFPAGEVIEW_H_
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp
index 4862b46..42f191c 100644
--- a/xfa/fxfa/cxfa_ffpasswordedit.cpp
+++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp
@@ -35,12 +35,12 @@
CFWL_NoteDriver* pNoteDriver = pWidget->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
- m_pOldDelegate = pWidget->GetDelegate();
+ old_delegate_ = pWidget->GetDelegate();
pWidget->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pWidget);
- pWidget->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
+ pWidget->SetText(node_->GetValue(XFA_ValuePicture::kDisplay));
UpdateWidgetProperty();
}
@@ -60,10 +60,12 @@
WideString password = password_node_->GetPasswordChar();
if (!password.IsEmpty())
pWidget->SetAliasChar(password[0]);
- if (!m_pNode->IsHorizontalScrollPolicyOff())
+ if (!node_->IsHorizontalScrollPolicyOff()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive())
+ }
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
+ }
dwExtendedStyle |= GetAlignment();
GetNormalWidget()->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 9f29b25..30a4ee9 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -32,11 +32,11 @@
void CXFA_FFPushButton::Trace(cppgc::Visitor* visitor) const {
CXFA_FFField::Trace(visitor);
- visitor->Trace(m_pRolloverTextLayout);
- visitor->Trace(m_pDownTextLayout);
- visitor->Trace(m_pRollProvider);
- visitor->Trace(m_pDownProvider);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(rollover_text_layout_);
+ visitor->Trace(down_text_layout_);
+ visitor->Trace(roll_provider_);
+ visitor->Trace(down_provider_);
+ visitor->Trace(old_delegate_);
visitor->Trace(button_);
}
@@ -63,7 +63,7 @@
CFWL_PushButton* pPushButton = cppgc::MakeGarbageCollected<CFWL_PushButton>(
GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp());
- m_pOldDelegate = pPushButton->GetDelegate();
+ old_delegate_ = pPushButton->GetDelegate();
pPushButton->SetDelegate(this);
SetNormalWidget(pPushButton);
pPushButton->SetAdapterIface(this);
@@ -102,15 +102,15 @@
CXFA_FFWidget::PerformLayout();
CFX_RectF rtWidget = GetRectWithoutRotate();
- m_UIRect = rtWidget;
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ uirect_ = rtWidget;
+ CXFA_Margin* margin = node_->GetMarginIfExists();
XFA_RectWithoutMargin(&rtWidget, margin);
- m_CaptionRect = rtWidget;
+ caption_rect_ = rtWidget;
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
CXFA_Margin* captionMargin = caption ? caption->GetMarginIfExists() : nullptr;
- XFA_RectWithoutMargin(&m_CaptionRect, captionMargin);
+ XFA_RectWithoutMargin(&caption_rect_, captionMargin);
LayoutHighlightCaption();
SetFWLRect();
@@ -120,7 +120,7 @@
}
float CXFA_FFPushButton::GetLineWidth() {
- CXFA_Border* border = m_pNode->GetBorderIfExists();
+ CXFA_Border* border = node_->GetBorderIfExists();
if (border && border->GetPresence() == XFA_AttributeValue::Visible) {
CXFA_Edge* edge = border->GetEdgeIfExists(0);
return edge ? edge->GetThickness() : 0;
@@ -137,63 +137,67 @@
}
void CXFA_FFPushButton::LoadHighlightCaption() {
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
if (!caption || caption->IsHidden())
return;
- if (m_pNode->HasButtonRollover()) {
- if (!m_pRollProvider) {
- m_pRollProvider = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
- GetDoc()->GetHeap()->GetAllocationHandle(), m_pNode.Get(),
+ if (node_->HasButtonRollover()) {
+ if (!roll_provider_) {
+ roll_provider_ = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
+ GetDoc()->GetHeap()->GetAllocationHandle(), node_.Get(),
CXFA_TextProvider::Type::kRollover);
}
- m_pRolloverTextLayout = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
- GetDoc()->GetHeap()->GetAllocationHandle(), GetDoc(), m_pRollProvider);
+ rollover_text_layout_ = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
+ GetDoc()->GetHeap()->GetAllocationHandle(), GetDoc(), roll_provider_);
}
- if (m_pNode->HasButtonDown()) {
- if (!m_pDownProvider) {
- m_pDownProvider = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
- GetDoc()->GetHeap()->GetAllocationHandle(), m_pNode.Get(),
+ if (node_->HasButtonDown()) {
+ if (!down_provider_) {
+ down_provider_ = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
+ GetDoc()->GetHeap()->GetAllocationHandle(), node_.Get(),
CXFA_TextProvider::Type::kDown);
}
- m_pDownTextLayout = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
- GetDoc()->GetHeap()->GetAllocationHandle(), GetDoc(), m_pDownProvider);
+ down_text_layout_ = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
+ GetDoc()->GetHeap()->GetAllocationHandle(), GetDoc(), down_provider_);
}
}
void CXFA_FFPushButton::LayoutHighlightCaption() {
- CFX_SizeF sz(m_CaptionRect.width, m_CaptionRect.height);
+ CFX_SizeF sz(caption_rect_.width, caption_rect_.height);
LayoutCaption();
- if (m_pRolloverTextLayout)
- m_pRolloverTextLayout->Layout(sz);
- if (m_pDownTextLayout)
- m_pDownTextLayout->Layout(sz);
+ if (rollover_text_layout_) {
+ rollover_text_layout_->Layout(sz);
+ }
+ if (down_text_layout_) {
+ down_text_layout_->Layout(sz);
+ }
}
void CXFA_FFPushButton::RenderHighlightCaption(CFGAS_GEGraphics* pGS,
CFX_Matrix* pMatrix) {
- CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout();
- CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
+ CXFA_TextLayout* pCapTextLayout = node_->GetCaptionTextLayout();
+ CXFA_Caption* caption = node_->GetCaptionIfExists();
if (!caption || !caption->IsVisible())
return;
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_RectF rtClip = m_CaptionRect;
+ CFX_RectF rtClip = caption_rect_;
rtClip.Intersect(GetRectWithoutRotate());
- CFX_Matrix mt(1, 0, 0, 1, m_CaptionRect.left, m_CaptionRect.top);
+ CFX_Matrix mt(1, 0, 0, 1, caption_rect_.left, caption_rect_.top);
if (pMatrix) {
rtClip = pMatrix->TransformRect(rtClip);
mt.Concat(*pMatrix);
}
uint32_t dwState = GetNormalWidget()->GetStates();
- if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) &&
+ if (down_text_layout_ && (dwState & FWL_STATE_PSB_Pressed) &&
(dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip, 0))
+ if (down_text_layout_->DrawString(pRenderDevice, mt, rtClip, 0)) {
return;
- } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip, 0))
+ }
+ } else if (rollover_text_layout_ && (dwState & FWL_STATE_PSB_Hovered)) {
+ if (rollover_text_layout_->DrawString(pRenderDevice, mt, rtClip, 0)) {
return;
+ }
}
if (pCapTextLayout)
@@ -201,11 +205,11 @@
}
void CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFPushButton::OnProcessEvent(pdfium::CFWL_Event* pEvent) {
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
CXFA_FFField::OnProcessEvent(pEvent);
}
diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h
index 6ad8a98..938ef42 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.h
+++ b/xfa/fxfa/cxfa_ffpushbutton.h
@@ -48,11 +48,11 @@
FX_ARGB GetLineColor();
FX_ARGB GetFillColor();
- cppgc::Member<CXFA_TextLayout> m_pRolloverTextLayout;
- cppgc::Member<CXFA_TextLayout> m_pDownTextLayout;
- cppgc::Member<CXFA_TextProvider> m_pRollProvider;
- cppgc::Member<CXFA_TextProvider> m_pDownProvider;
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ cppgc::Member<CXFA_TextLayout> rollover_text_layout_;
+ cppgc::Member<CXFA_TextLayout> down_text_layout_;
+ cppgc::Member<CXFA_TextProvider> roll_provider_;
+ cppgc::Member<CXFA_TextProvider> down_provider_;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
cppgc::Member<CXFA_Button> const button_;
};
diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp
index 860c816..9c5386e 100644
--- a/xfa/fxfa/cxfa_ffrectangle.cpp
+++ b/xfa/fxfa/cxfa_ffrectangle.cpp
@@ -19,12 +19,12 @@
if (!HasVisibleStatus())
return;
- CXFA_Value* value = m_pNode->GetFormValueIfExists();
+ CXFA_Value* value = node_->GetFormValueIfExists();
if (!value)
return;
CFX_RectF rect = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
XFA_RectWithoutMargin(&rect, margin);
CFX_Matrix mtRotate = GetRotateMatrix();
diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp
index 5d888ad..8a22aca 100644
--- a/xfa/fxfa/cxfa_ffsignature.cpp
+++ b/xfa/fxfa/cxfa_ffsignature.cpp
@@ -33,7 +33,7 @@
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- DrawBorder(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate);
+ DrawBorder(pGS, node_->GetUIBorder(), uirect_, mtRotate);
RenderCaption(pGS, mtRotate);
DrawHighlight(pGS, mtRotate, highlight, kSquareShape);
}
@@ -109,8 +109,9 @@
return FWL_WidgetHit::Client;
if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (m_CaptionRect.Contains(point))
+ if (caption_rect_.Contains(point)) {
return FWL_WidgetHit::Titlebar;
+ }
return FWL_WidgetHit::Client;
}
diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp
index fd8f861..601ff70 100644
--- a/xfa/fxfa/cxfa_fftext.cpp
+++ b/xfa/fxfa/cxfa_fftext.cpp
@@ -31,13 +31,13 @@
CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
- CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout();
+ CXFA_TextLayout* pTextLayout = node_->GetTextLayout();
if (!pTextLayout)
return;
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
CFX_RectF rtText = GetRectWithoutRotate();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
if (margin) {
CXFA_ContentLayoutItem* pItem = GetLayoutItem();
if (!pItem->GetPrev() && !pItem->GetNext()) {
@@ -63,13 +63,13 @@
}
bool CXFA_FFText::IsLoaded() {
- CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout();
+ CXFA_TextLayout* pTextLayout = node_->GetTextLayout();
return pTextLayout && !pTextLayout->HasBlock();
}
void CXFA_FFText::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout();
+ CXFA_TextLayout* pTextLayout = node_->GetTextLayout();
if (!pTextLayout || !pTextLayout->HasBlock()) {
return;
}
@@ -81,7 +81,7 @@
pItem = pItem->GetFirst();
while (pItem) {
CFX_RectF rtText = pItem->GetAbsoluteRect();
- CXFA_Margin* margin = m_pNode->GetMarginIfExists();
+ CXFA_Margin* margin = node_->GetMarginIfExists();
if (margin) {
if (!pItem->GetPrev())
rtText.height -= margin->GetTopInset();
@@ -138,7 +138,7 @@
}
WideString CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
- CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout();
+ CXFA_TextLayout* pTextLayout = node_->GetTextLayout();
if (!pTextLayout)
return WideString();
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index ba39219..9e62bc2 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -45,7 +45,7 @@
void CXFA_FFTextEdit::Trace(cppgc::Visitor* visitor) const {
CXFA_FFField::Trace(visitor);
- visitor->Trace(m_pOldDelegate);
+ visitor->Trace(old_delegate_);
}
bool CXFA_FFTextEdit::LoadWidget() {
@@ -59,13 +59,13 @@
CFWL_NoteDriver* pNoteDriver = pFWLEdit->GetFWLApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pFWLEdit, pFWLEdit);
- m_pOldDelegate = pFWLEdit->GetDelegate();
+ old_delegate_ = pFWLEdit->GetDelegate();
pFWLEdit->SetDelegate(this);
{
CFWL_Widget::ScopedUpdateLock update_lock(pFWLEdit);
UpdateWidgetProperty();
- pFWLEdit->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
+ pFWLEdit->SetText(node_->GetValue(XFA_ValuePicture::kDisplay));
}
return CXFA_FFField::LoadWidget();
@@ -80,25 +80,25 @@
uint32_t dwExtendedStyle =
FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar;
dwExtendedStyle |= UpdateUIProperty();
- if (m_pNode->IsMultiLine()) {
+ if (node_->IsMultiLine()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn;
- if (!m_pNode->IsVerticalScrollPolicyOff()) {
+ if (!node_->IsVerticalScrollPolicyOff()) {
dwStyle |= FWL_STYLE_WGT_VScroll;
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
}
- } else if (!m_pNode->IsHorizontalScrollPolicyOff()) {
+ } else if (!node_->IsHorizontalScrollPolicyOff()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
}
- if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
+ if (!node_->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
}
- auto [eType, iMaxChars] = m_pNode->GetMaxChars();
+ auto [eType, iMaxChars] = node_->GetMaxChars();
if (eType == XFA_Element::ExData)
iMaxChars = 0;
- std::optional<int32_t> numCells = m_pNode->GetNumberOfCells();
+ std::optional<int32_t> numCells = node_->GetNumberOfCells();
if (!numCells.has_value()) {
pWidget->SetLimit(iMaxChars);
} else if (numCells == 0) {
@@ -119,7 +119,7 @@
const CFX_PointF& point,
CFWL_MessageMouse::MouseCommand command) {
if (command == CFWL_MessageMouse::MouseCommand::kRightButtonDown &&
- !m_pNode->IsOpenAccess()) {
+ !node_->IsOpenAccess()) {
return false;
}
if (!PtInActiveRect(point))
@@ -201,8 +201,8 @@
bool CXFA_FFTextEdit::CommitData() {
WideString wsText = ToEdit(GetNormalWidget())->GetText();
- if (m_pNode->SetValue(XFA_ValuePicture::kEdit, wsText)) {
- GetDoc()->GetDocView()->UpdateUIDisplay(m_pNode.Get(), this);
+ if (node_->SetValue(XFA_ValuePicture::kEdit, wsText)) {
+ GetDoc()->GetDocView()->UpdateUIDisplay(node_.Get(), this);
return true;
}
ValidateNumberField(wsText);
@@ -230,7 +230,7 @@
}
uint32_t CXFA_FFTextEdit::GetAlignment() {
- CXFA_Para* para = m_pNode->GetParaIfExists();
+ CXFA_Para* para = node_->GetParaIfExists();
if (!para)
return 0;
@@ -277,19 +277,19 @@
eType = XFA_ValuePicture::kEdit;
bool bUpdate = false;
- if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kTextEdit &&
- !m_pNode->GetNumberOfCells().has_value()) {
- auto [elementType, iMaxChars] = m_pNode->GetMaxChars();
+ if (node_->GetFFWidgetType() == XFA_FFWidgetType::kTextEdit &&
+ !node_->GetNumberOfCells().has_value()) {
+ auto [elementType, iMaxChars] = node_->GetMaxChars();
if (elementType == XFA_Element::ExData)
iMaxChars = eType == XFA_ValuePicture::kEdit ? iMaxChars : 0;
if (pEdit->GetLimit() != iMaxChars) {
pEdit->SetLimit(iMaxChars);
bUpdate = true;
}
- } else if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kBarcode) {
+ } else if (node_->GetFFWidgetType() == XFA_FFWidgetType::kBarcode) {
int32_t nDataLen = 0;
if (eType == XFA_ValuePicture::kEdit) {
- nDataLen = static_cast<CXFA_Barcode*>(m_pNode->GetUIChildNode())
+ nDataLen = static_cast<CXFA_Barcode*>(node_->GetUIChildNode())
->GetDataLength()
.value_or(0);
}
@@ -297,7 +297,7 @@
pEdit->SetLimit(nDataLen);
bUpdate = true;
}
- WideString wsText = m_pNode->GetValue(eType);
+ WideString wsText = node_->GetValue(eType);
WideString wsOldText = pEdit->GetText();
if (wsText != wsOldText || (eType == XFA_ValuePicture::kEdit && bUpdate)) {
pEdit->SetTextSkipNotify(wsText);
@@ -313,27 +313,27 @@
GetLayoutItem()->SetStatusBits(XFA_WidgetStatus::kTextEditValueChanged);
CXFA_EventParam eParam(XFA_EVENT_Change);
- eParam.m_wsChange = event->GetChangeText();
- eParam.m_wsPrevText = event->GetPreviousText();
- eParam.m_iSelStart = static_cast<int32_t>(event->GetSelectionStart());
- eParam.m_iSelEnd = static_cast<int32_t>(event->GetSelectionEnd());
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
+ eParam.change_ = event->GetChangeText();
+ eParam.prev_text_ = event->GetPreviousText();
+ eParam.sel_start_ = static_cast<int32_t>(event->GetSelectionStart());
+ eParam.sel_end_ = static_cast<int32_t>(event->GetSelectionEnd());
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Change, &eParam);
// Copy the data back out of the EventParam and into the TextChanged event so
// it can propagate back to the calling widget.
- event->SetCancelled(eParam.m_bCancelAction);
- event->SetChangeText(eParam.m_wsChange);
- event->SetSelectionStart(static_cast<size_t>(eParam.m_iSelStart));
- event->SetSelectionEnd(static_cast<size_t>(eParam.m_iSelEnd));
+ event->SetCancelled(eParam.cancel_action_);
+ event->SetChangeText(eParam.change_);
+ event->SetSelectionStart(static_cast<size_t>(eParam.sel_start_));
+ event->SetSelectionEnd(static_cast<size_t>(eParam.sel_end_));
}
void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
CXFA_EventParam eParam(XFA_EVENT_Full);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Full, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Full, &eParam);
}
void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
- m_pOldDelegate->OnProcessMessage(pMessage);
+ old_delegate_->OnProcessMessage(pMessage);
}
void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
@@ -349,12 +349,12 @@
default:
break;
}
- m_pOldDelegate->OnProcessEvent(pEvent);
+ old_delegate_->OnProcessEvent(pEvent);
}
void CXFA_FFTextEdit::OnDrawWidget(CFGAS_GEGraphics* pGraphics,
const CFX_Matrix& matrix) {
- m_pOldDelegate->OnDrawWidget(pGraphics, matrix);
+ old_delegate_->OnDrawWidget(pGraphics, matrix);
}
bool CXFA_FFTextEdit::CanUndo() {
diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h
index bdbfe5c..7d1cef1 100644
--- a/xfa/fxfa/cxfa_fftextedit.h
+++ b/xfa/fxfa/cxfa_fftextedit.h
@@ -78,7 +78,7 @@
explicit CXFA_FFTextEdit(CXFA_Node* pNode);
uint32_t GetAlignment();
- cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
+ cppgc::Member<IFWL_WidgetDelegate> old_delegate_;
private:
bool CommitData() override;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 057d280..f933421 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -192,15 +192,15 @@
return GetFFWidget(ToContentLayoutItem(pLayoutItem));
}
-CXFA_FFWidget::CXFA_FFWidget(CXFA_Node* node) : m_pNode(node) {}
+CXFA_FFWidget::CXFA_FFWidget(CXFA_Node* node) : node_(node) {}
CXFA_FFWidget::~CXFA_FFWidget() = default;
void CXFA_FFWidget::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pLayoutItem);
- visitor->Trace(m_pDocView);
- visitor->Trace(m_pPageView);
- visitor->Trace(m_pNode);
+ visitor->Trace(layout_item_);
+ visitor->Trace(doc_view_);
+ visitor->Trace(page_view_);
+ visitor->Trace(node_);
}
CFWL_App* CXFA_FFWidget::GetFWLApp() const {
@@ -214,19 +214,19 @@
const CFX_RectF& CXFA_FFWidget::GetWidgetRect() const {
if (!GetLayoutItem()->TestStatusBits(XFA_WidgetStatus::kRectCached))
RecacheWidgetRect();
- return m_WidgetRect;
+ return widget_rect_;
}
const CFX_RectF& CXFA_FFWidget::RecacheWidgetRect() const {
GetLayoutItem()->SetStatusBits(XFA_WidgetStatus::kRectCached);
- m_WidgetRect = GetLayoutItem()->GetAbsoluteRect();
- return m_WidgetRect;
+ widget_rect_ = GetLayoutItem()->GetAbsoluteRect();
+ return widget_rect_;
}
CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
CFX_RectF rtWidget = GetWidgetRect();
float fValue = 0;
- switch (m_pNode->GetRotate()) {
+ switch (node_->GetRotate()) {
case 90:
rtWidget.top = rtWidget.bottom();
fValue = rtWidget.width;
@@ -258,9 +258,10 @@
}
CFX_RectF CXFA_FFWidget::GetBBox(FocusOption focus) {
- if (focus == kDrawFocus || !m_pPageView)
+ if (focus == kDrawFocus || !page_view_) {
return CFX_RectF();
- return m_pPageView->GetPageViewRect();
+ }
+ return page_view_->GetPageViewRect();
}
void CXFA_FFWidget::RenderWidget(CFGAS_GEGraphics* pGS,
@@ -269,7 +270,7 @@
if (!HasVisibleStatus())
return;
- CXFA_Border* border = m_pNode->GetBorderIfExists();
+ CXFA_Border* border = node_->GetBorderIfExists();
if (!border)
return;
@@ -281,7 +282,7 @@
}
bool CXFA_FFWidget::IsLoaded() {
- return !!m_pPageView;
+ return !!page_view_;
}
bool CXFA_FFWidget::LoadWidget() {
@@ -332,7 +333,7 @@
void CXFA_FFWidget::InvalidateRect() {
CFX_RectF rtWidget = GetBBox(kDoNotDrawFocus);
rtWidget.Inflate(2, 2);
- m_pDocView->InvalidateRect(m_pPageView.Get(), rtWidget);
+ doc_view_->InvalidateRect(page_view_.Get(), rtWidget);
}
bool CXFA_FFWidget::OnMouseEnter() {
@@ -400,7 +401,7 @@
GetLayoutItem()->SetStatusBits(XFA_WidgetStatus::kFocused);
CXFA_EventParam eParam(XFA_EVENT_Enter);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Enter, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Enter, &eParam);
return true;
}
@@ -506,7 +507,7 @@
}
CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
- int32_t iRotate = m_pNode->GetRotate();
+ int32_t iRotate = node_->GetRotate();
if (!iRotate)
return CFX_Matrix();
@@ -565,7 +566,7 @@
}
CXFA_LayoutItem* CXFA_FFWidget::GetParent() {
- CXFA_Node* pParentNode = m_pNode->GetParent();
+ CXFA_Node* pParentNode = node_->GetParent();
if (!pParentNode)
return nullptr;
@@ -579,8 +580,9 @@
CXFA_Node* pChildNode = pWidget->GetNode();
while (pChildNode) {
- if (pChildNode == m_pNode)
+ if (pChildNode == node_) {
return true;
+ }
pChildNode = pChildNode->GetParent();
}
@@ -592,7 +594,7 @@
}
CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
- return m_pDocView->GetDoc();
+ return doc_view_->GetDoc();
}
CXFA_FFApp* CXFA_FFWidget::GetApp() {
@@ -614,7 +616,7 @@
return;
}
CXFA_EventParam eParam(XFA_EVENT_Exit);
- m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::Exit, &eParam);
+ node_->ProcessEvent(GetDocView(), XFA_AttributeValue::Exit, &eParam);
}
bool CXFA_FFWidget::IsButtonDown() {
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index de416b3..5ae5a77 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -158,13 +158,13 @@
virtual WideString GetText();
virtual FormFieldType GetFormFieldType();
- CXFA_Node* GetNode() const { return m_pNode; }
- CXFA_ContentLayoutItem* GetLayoutItem() const { return m_pLayoutItem; }
- void SetLayoutItem(CXFA_ContentLayoutItem* pItem) { m_pLayoutItem = pItem; }
- CXFA_FFPageView* GetPageView() const { return m_pPageView; }
- void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
- CXFA_FFDocView* GetDocView() const { return m_pDocView; }
- void SetDocView(CXFA_FFDocView* pDocView) { m_pDocView = pDocView; }
+ CXFA_Node* GetNode() const { return node_; }
+ CXFA_ContentLayoutItem* GetLayoutItem() const { return layout_item_; }
+ void SetLayoutItem(CXFA_ContentLayoutItem* pItem) { layout_item_ = pItem; }
+ CXFA_FFPageView* GetPageView() const { return page_view_; }
+ void SetPageView(CXFA_FFPageView* pPageView) { page_view_ = pPageView; }
+ CXFA_FFDocView* GetDocView() const { return doc_view_; }
+ void SetDocView(CXFA_FFDocView* pDocView) { doc_view_ = pDocView; }
CXFA_FFWidget* GetNextFFWidget() const;
const CFX_RectF& GetWidgetRect() const;
@@ -209,11 +209,11 @@
bool IsButtonDown();
void SetButtonDown(bool bSet);
- cppgc::Member<CXFA_ContentLayoutItem> m_pLayoutItem;
- cppgc::Member<CXFA_FFDocView> m_pDocView;
- cppgc::Member<CXFA_FFPageView> m_pPageView;
- cppgc::Member<CXFA_Node> const m_pNode;
- mutable CFX_RectF m_WidgetRect;
+ cppgc::Member<CXFA_ContentLayoutItem> layout_item_;
+ cppgc::Member<CXFA_FFDocView> doc_view_;
+ cppgc::Member<CXFA_FFPageView> page_view_;
+ cppgc::Member<CXFA_Node> const node_;
+ mutable CFX_RectF widget_rect_;
};
inline CXFA_FFField* ToField(CXFA_FFWidget* widget) {
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 6992e57..022e994 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -21,36 +21,37 @@
#include "xfa/fxfa/parser/cxfa_validate.h"
CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView)
- : m_pDocView(pDocView) {}
+ : doc_view_(pDocView) {}
CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() = default;
void CXFA_FFWidgetHandler::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDocView);
+ visitor->Trace(doc_view_);
}
bool CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) {
- CXFA_FFDocView::UpdateScope scope(m_pDocView);
+ CXFA_FFDocView::UpdateScope scope(doc_view_);
return hWidget->OnMouseEnter();
}
bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) {
- CXFA_FFDocView::UpdateScope scope(m_pDocView);
+ CXFA_FFDocView::UpdateScope scope(doc_view_);
return hWidget->OnMouseExit();
}
bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
Mask<XFA_FWL_KeyFlag> dwFlags,
const CFX_PointF& point) {
- CXFA_FFDocView::UpdateScope scope(m_pDocView);
+ CXFA_FFDocView::UpdateScope scope(doc_view_);
if (!hWidget->AcceptsFocusOnButtonDown(
dwFlags, hWidget->Rotate2Normal(point),
CFWL_MessageMouse::MouseCommand::kLeftButtonDown)) {
return false;
}
// May re-enter JS.
- if (m_pDocView->SetFocus(hWidget))
- m_pDocView->GetDoc()->SetFocusWidget(hWidget);
+ if (doc_view_->SetFocus(hWidget)) {
+ doc_view_->GetDoc()->SetFocusWidget(hWidget);
+ }
return hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point));
}
@@ -58,8 +59,8 @@
bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
Mask<XFA_FWL_KeyFlag> dwFlags,
const CFX_PointF& point) {
- CXFA_FFDocView::UpdateScope scope(m_pDocView);
- m_pDocView->SetLayoutEvent();
+ CXFA_FFDocView::UpdateScope scope(doc_view_);
+ doc_view_->SetLayoutEvent();
return hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point));
}
@@ -91,8 +92,8 @@
return false;
}
// May re-enter JS.
- if (m_pDocView->SetFocus(hWidget)) {
- m_pDocView->GetDoc()->SetFocusWidget(hWidget);
+ if (doc_view_->SetFocus(hWidget)) {
+ doc_view_->GetDoc()->SetFocusWidget(hWidget);
}
return hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point));
}
@@ -113,7 +114,7 @@
XFA_FWL_VKEYCODE dwKeyCode,
Mask<XFA_FWL_KeyFlag> dwFlags) {
bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags);
- m_pDocView->UpdateDocView();
+ doc_view_->UpdateDocView();
return bRet;
}
@@ -207,17 +208,19 @@
XFA_EventError CXFA_FFWidgetHandler::ProcessEvent(CXFA_Node* pNode,
CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
+ if (!pParam || pParam->type_ == XFA_EVENT_Unknown) {
return XFA_EventError::kNotExist;
+ }
if (!pNode || pNode->GetElementType() == XFA_Element::Draw)
return XFA_EventError::kNotExist;
- switch (pParam->m_eType) {
+ switch (pParam->type_) {
case XFA_EVENT_Calculate:
- return pNode->ProcessCalculate(m_pDocView.Get());
+ return pNode->ProcessCalculate(doc_view_.Get());
case XFA_EVENT_Validate:
- if (m_pDocView->GetDoc()->IsValidationsEnabled())
- return pNode->ProcessValidate(m_pDocView.Get(), 0);
+ if (doc_view_->GetDoc()->IsValidationsEnabled()) {
+ return pNode->ProcessValidate(doc_view_.Get(), 0);
+ }
return XFA_EventError::kDisabled;
case XFA_EVENT_InitCalculate: {
CXFA_Calculate* calc = pNode->GetCalculateIfExists();
@@ -225,12 +228,12 @@
return XFA_EventError::kNotExist;
if (pNode->IsUserInteractive())
return XFA_EventError::kDisabled;
- return pNode->ExecuteScript(m_pDocView.Get(), calc->GetScriptIfExists(),
+ return pNode->ExecuteScript(doc_view_.Get(), calc->GetScriptIfExists(),
pParam);
}
default:
break;
}
- return pNode->ProcessEvent(m_pDocView.Get(),
- kXFAEventActivity[pParam->m_eType], pParam);
+ return pNode->ProcessEvent(doc_view_.Get(), kXFAEventActivity[pParam->type_],
+ pParam);
}
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h
index e7a9e9f..67783b0 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.h
+++ b/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -90,7 +90,7 @@
private:
explicit CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
- cppgc::Member<CXFA_FFDocView> m_pDocView;
+ cppgc::Member<CXFA_FFDocView> doc_view_;
};
#endif // XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 98691fc..4115b6b 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -25,9 +25,10 @@
const WideString& wsFontFamily,
uint32_t dwFontStyles) {
auto key = std::make_pair(wsFontFamily, dwFontStyles);
- auto iter = m_FontMap.find(key);
- if (iter != m_FontMap.end())
+ auto iter = font_map_.find(key);
+ if (iter != font_map_.end()) {
return iter->second;
+ }
WideString wsEnglishName = FGAS_FontNameToEnglishName(wsFontFamily);
RetainPtr<CFGAS_GEFont> pFont =
@@ -51,6 +52,6 @@
if (!pFont)
return nullptr;
- m_FontMap[key] = pFont;
+ font_map_[key] = pFont;
return pFont;
}
diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h
index 3191a90..c7dad73 100644
--- a/xfa/fxfa/cxfa_fontmgr.h
+++ b/xfa/fxfa/cxfa_fontmgr.h
@@ -31,7 +31,7 @@
private:
CXFA_FontMgr();
- std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> m_FontMap;
+ std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> font_map_;
};
#endif // XFA_FXFA_CXFA_FONTMGR_H_
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 215bef0..817dae3 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -53,33 +53,35 @@
CXFA_FWLTheme::CXFA_FWLTheme(cppgc::Heap* pHeap, CXFA_FFApp* pApp)
: IFWL_ThemeProvider(pHeap),
- m_pTextOut(std::make_unique<CFDE_TextOut>()),
- m_pApp(pApp) {}
+ text_out_(std::make_unique<CFDE_TextOut>()),
+ app_(pApp) {}
CXFA_FWLTheme::~CXFA_FWLTheme() = default;
void CXFA_FWLTheme::PreFinalize() {
- m_pTextOut.reset();
+ text_out_.reset();
}
void CXFA_FWLTheme::Trace(cppgc::Visitor* visitor) const {
IFWL_ThemeProvider::Trace(visitor);
- visitor->Trace(m_pApp);
+ visitor->Trace(app_);
}
bool CXFA_FWLTheme::LoadCalendarFont(CXFA_FFDoc* doc) {
- if (m_pCalendarFont)
+ if (calendar_font_) {
return true;
-
- for (const wchar_t* font : kFWLThemeCalFonts) {
- m_pCalendarFont = m_pApp->GetXFAFontMgr()->GetFont(doc, font, 0);
- if (m_pCalendarFont)
- return true;
}
- m_pCalendarFont = CFGAS_GEModule::Get()->GetFontMgr()->GetFontByCodePage(
+ for (const wchar_t* font : kFWLThemeCalFonts) {
+ calendar_font_ = app_->GetXFAFontMgr()->GetFont(doc, font, 0);
+ if (calendar_font_) {
+ return true;
+ }
+ }
+
+ calendar_font_ = CFGAS_GEModule::Get()->GetFontMgr()->GetFontByCodePage(
FX_CodePage::kMSWin_WesternEuropean, 0, nullptr);
- return !!m_pCalendarFont;
+ return !!calendar_font_;
}
void CXFA_FWLTheme::DrawBackground(const CFWL_ThemeBackground& pParams) {
@@ -87,39 +89,38 @@
}
void CXFA_FWLTheme::DrawText(const CFWL_ThemeText& pParams) {
- if (pParams.m_wsText.IsEmpty())
+ if (pParams.text_.IsEmpty()) {
return;
+ }
if (pParams.GetWidget()->GetClassID() == FWL_Type::MonthCalendar) {
CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.GetWidget());
if (!pWidget)
return;
- m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
- m_pTextOut->SetFont(m_pCalendarFont);
- m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
- m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
+ text_out_->SetStyles(pParams.tto_styles_);
+ text_out_->SetAlignment(pParams.tto_align_);
+ text_out_->SetFont(calendar_font_);
+ text_out_->SetFontSize(FWLTHEME_CAPACITY_FontSize);
+ text_out_->SetTextColor(FWLTHEME_CAPACITY_TextColor);
if ((pParams.GetPart() == CFWL_ThemePart::Part::kDatesIn) &&
- !(pParams.m_dwStates & CFWL_PartState::kFlagged) &&
- (pParams.m_dwStates &
- Mask<CFWL_PartState>{CFWL_PartState::kHovered,
- CFWL_PartState::kSelected})) {
- m_pTextOut->SetTextColor(0xFF888888);
+ !(pParams.states_ & CFWL_PartState::kFlagged) &&
+ (pParams.states_ & Mask<CFWL_PartState>{CFWL_PartState::kHovered,
+ CFWL_PartState::kSelected})) {
+ text_out_->SetTextColor(0xFF888888);
}
if (pParams.GetPart() == CFWL_ThemePart::Part::kCaption)
- m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255));
+ text_out_->SetTextColor(ArgbEncode(0xff, 0, 153, 255));
CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
- CFX_Matrix mtPart = pParams.m_matrix;
+ CFX_Matrix mtPart = pParams.matrix_;
const CFX_Matrix* pMatrix = pGraphics->GetMatrix();
if (pMatrix)
mtPart.Concat(*pMatrix);
- m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams.m_wsText,
- pParams.m_PartRect);
+ text_out_->SetMatrix(mtPart);
+ text_out_->DrawLogicText(pRenderDevice, pParams.text_, pParams.part_rect_);
return;
}
CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.GetWidget());
@@ -129,19 +130,18 @@
CXFA_Node* pNode = pWidget->GetNode();
CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
- m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
- m_pTextOut->SetFont(pNode->GetFGASFont(pWidget->GetDoc()));
- m_pTextOut->SetFontSize(pNode->GetFontSize());
- m_pTextOut->SetTextColor(pNode->GetTextColor());
- CFX_Matrix mtPart = pParams.m_matrix;
+ text_out_->SetStyles(pParams.tto_styles_);
+ text_out_->SetAlignment(pParams.tto_align_);
+ text_out_->SetFont(pNode->GetFGASFont(pWidget->GetDoc()));
+ text_out_->SetFontSize(pNode->GetFontSize());
+ text_out_->SetTextColor(pNode->GetTextColor());
+ CFX_Matrix mtPart = pParams.matrix_;
const CFX_Matrix* pMatrix = pGraphics->GetMatrix();
if (pMatrix)
mtPart.Concat(*pMatrix);
- m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams.m_wsText,
- pParams.m_PartRect);
+ text_out_->SetMatrix(mtPart);
+ text_out_->DrawLogicText(pRenderDevice, pParams.text_, pParams.part_rect_);
}
CFX_RectF CXFA_FWLTheme::GetUIMargin(const CFWL_ThemePart& pThemePart) const {
@@ -193,10 +193,11 @@
}
RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFWLFont() {
- if (!m_pFWLFont)
- m_pFWLFont = CFGAS_GEFont::LoadFont(L"Helvetica", 0, FX_CodePage::kDefANSI);
+ if (!fwlfont_) {
+ fwlfont_ = CFGAS_GEFont::LoadFont(L"Helvetica", 0, FX_CodePage::kDefANSI);
+ }
- return m_pFWLFont;
+ return fwlfont_;
}
float CXFA_FWLTheme::GetLineHeight(const CFWL_ThemePart& pThemePart) const {
@@ -236,22 +237,22 @@
return;
if (pParams.GetWidget()->GetClassID() == FWL_Type::MonthCalendar) {
- m_pTextOut->SetFont(m_pCalendarFont);
- m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
- m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
- m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
- m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams.m_wsText.AsStringView(), pRect);
+ text_out_->SetFont(calendar_font_);
+ text_out_->SetFontSize(FWLTHEME_CAPACITY_FontSize);
+ text_out_->SetTextColor(FWLTHEME_CAPACITY_TextColor);
+ text_out_->SetAlignment(pParams.tto_align_);
+ text_out_->SetStyles(pParams.tto_styles_);
+ text_out_->CalcLogicSize(pParams.text_.AsStringView(), pRect);
return;
}
CXFA_Node* pNode = pWidget->GetNode();
- m_pTextOut->SetFont(pNode->GetFGASFont(pWidget->GetDoc()));
- m_pTextOut->SetFontSize(pNode->GetFontSize());
- m_pTextOut->SetTextColor(pNode->GetTextColor());
- m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
- m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams.m_wsText.AsStringView(), pRect);
+ text_out_->SetFont(pNode->GetFGASFont(pWidget->GetDoc()));
+ text_out_->SetFontSize(pNode->GetFontSize());
+ text_out_->SetTextColor(pNode->GetTextColor());
+ text_out_->SetAlignment(pParams.tto_align_);
+ text_out_->SetStyles(pParams.tto_styles_);
+ text_out_->CalcLogicSize(pParams.text_.AsStringView(), pRect);
}
} // namespace pdfium
diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h
index e1a2619..3a4752a 100644
--- a/xfa/fxfa/cxfa_fwltheme.h
+++ b/xfa/fxfa/cxfa_fwltheme.h
@@ -55,12 +55,12 @@
private:
CXFA_FWLTheme(cppgc::Heap* pHeap, CXFA_FFApp* pApp);
- std::unique_ptr<CFDE_TextOut> m_pTextOut;
- RetainPtr<CFGAS_GEFont> m_pFWLFont;
- RetainPtr<CFGAS_GEFont> m_pCalendarFont;
- cppgc::Member<CXFA_FFApp> const m_pApp;
- WideString m_wsResource;
- CFX_RectF m_Rect;
+ std::unique_ptr<CFDE_TextOut> text_out_;
+ RetainPtr<CFGAS_GEFont> fwlfont_;
+ RetainPtr<CFGAS_GEFont> calendar_font_;
+ cppgc::Member<CXFA_FFApp> const app_;
+ WideString resource_;
+ CFX_RectF rect_;
};
} // namespace pdfium
diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp
index b78764c..5a84352 100644
--- a/xfa/fxfa/cxfa_imagerenderer.cpp
+++ b/xfa/fxfa/cxfa_imagerenderer.cpp
@@ -17,13 +17,13 @@
CXFA_ImageRenderer::CXFA_ImageRenderer(CFX_RenderDevice* device,
RetainPtr<CFX_DIBitmap> bitmap,
const CFX_Matrix& image_to_device)
- : m_ImageMatrix(image_to_device),
- m_pDevice(device),
- m_pBitmap(std::move(bitmap)) {
+ : image_matrix_(image_to_device),
+ device_(device),
+ bitmap_(std::move(bitmap)) {
// Assume this always draws into CFX_DefaultRenderDevice.
- CHECK(m_pDevice);
- CHECK(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);
- CHECK(m_pBitmap);
+ CHECK(device_);
+ CHECK(device_->GetRenderCaps() & FXRC_GET_BITS);
+ CHECK(bitmap_);
}
CXFA_ImageRenderer::~CXFA_ImageRenderer() = default;
@@ -31,23 +31,23 @@
bool CXFA_ImageRenderer::Start() {
FXDIB_ResampleOptions options;
options.bInterpolateBilinear = true;
- RenderDeviceDriverIface::StartResult result = m_pDevice->StartDIBits(
- m_pBitmap, /*alpha=*/1.0f, /*argb=*/0, m_ImageMatrix, options);
+ RenderDeviceDriverIface::StartResult result = device_->StartDIBits(
+ bitmap_, /*alpha=*/1.0f, /*argb=*/0, image_matrix_, options);
if (result.result == RenderDeviceDriverIface::Result::kFailure) {
return false;
}
CHECK_EQ(result.result, RenderDeviceDriverIface::Result::kSuccess);
- m_DeviceHandle = std::move(result.agg_image_renderer);
- if (!m_DeviceHandle) {
+ device_handle_ = std::move(result.agg_image_renderer);
+ if (!device_handle_) {
return false;
}
- m_State = State::kStarted;
+ state_ = State::kStarted;
return true;
}
bool CXFA_ImageRenderer::Continue() {
- CHECK_EQ(m_State, State::kStarted);
- return m_pDevice->ContinueDIBits(m_DeviceHandle.get(), nullptr);
+ CHECK_EQ(state_, State::kStarted);
+ return device_->ContinueDIBits(device_handle_.get(), nullptr);
}
diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h
index 46c97da..afb7e14 100644
--- a/xfa/fxfa/cxfa_imagerenderer.h
+++ b/xfa/fxfa/cxfa_imagerenderer.h
@@ -31,11 +31,11 @@
private:
enum class State : bool { kInitial = 0, kStarted };
- State m_State = State::kInitial;
- const CFX_Matrix m_ImageMatrix;
- UnownedPtr<CFX_RenderDevice> const m_pDevice;
- RetainPtr<CFX_DIBitmap> const m_pBitmap;
- std::unique_ptr<CFX_AggImageRenderer> m_DeviceHandle;
+ State state_ = State::kInitial;
+ const CFX_Matrix image_matrix_;
+ UnownedPtr<CFX_RenderDevice> const device_;
+ RetainPtr<CFX_DIBitmap> const bitmap_;
+ std::unique_ptr<CFX_AggImageRenderer> device_handle_;
};
#endif // XFA_FXFA_CXFA_IMAGERENDERER_H_
diff --git a/xfa/fxfa/cxfa_readynodeiterator.cpp b/xfa/fxfa/cxfa_readynodeiterator.cpp
index d8d6b82..4e4cde8 100644
--- a/xfa/fxfa/cxfa_readynodeiterator.cpp
+++ b/xfa/fxfa/cxfa_readynodeiterator.cpp
@@ -9,23 +9,24 @@
#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ReadyNodeIterator::CXFA_ReadyNodeIterator(CXFA_Node* pTravelRoot)
- : m_ContentIterator(pTravelRoot) {}
+ : content_iterator_(pTravelRoot) {}
CXFA_ReadyNodeIterator::~CXFA_ReadyNodeIterator() = default;
CXFA_Node* CXFA_ReadyNodeIterator::MoveToNext() {
- CXFA_Node* pItem = m_pCurNode ? m_ContentIterator.MoveToNext()
- : m_ContentIterator.GetCurrent();
+ CXFA_Node* pItem = cur_node_ ? content_iterator_.MoveToNext()
+ : content_iterator_.GetCurrent();
while (pItem) {
- m_pCurNode = pItem->IsWidgetReady() ? pItem : nullptr;
- if (m_pCurNode)
- return m_pCurNode;
- pItem = m_ContentIterator.MoveToNext();
+ cur_node_ = pItem->IsWidgetReady() ? pItem : nullptr;
+ if (cur_node_) {
+ return cur_node_;
+ }
+ pItem = content_iterator_.MoveToNext();
}
return nullptr;
}
void CXFA_ReadyNodeIterator::SkipTree() {
- m_ContentIterator.SkipChildrenAndMoveToNext();
- m_pCurNode = nullptr;
+ content_iterator_.SkipChildrenAndMoveToNext();
+ cur_node_ = nullptr;
}
diff --git a/xfa/fxfa/cxfa_readynodeiterator.h b/xfa/fxfa/cxfa_readynodeiterator.h
index cc45b80..cd3e7e6 100644
--- a/xfa/fxfa/cxfa_readynodeiterator.h
+++ b/xfa/fxfa/cxfa_readynodeiterator.h
@@ -24,8 +24,8 @@
void SkipTree();
private:
- CXFA_ContainerIterator m_ContentIterator;
- UnownedPtr<CXFA_Node> m_pCurNode; // Ok, stack-only.
+ CXFA_ContainerIterator content_iterator_;
+ UnownedPtr<CXFA_Node> cur_node_; // Ok, stack-only.
};
#endif // XFA_FXFA_CXFA_READYNODEITERATOR_H_
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index ef9fa02..d84a216 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -87,31 +87,31 @@
CXFA_TextLayout::CXFA_TextLayout(CXFA_FFDoc* doc,
CXFA_TextProvider* pTextProvider)
- : m_pDoc(doc),
- m_pTextProvider(pTextProvider),
- m_pTextParser(cppgc::MakeGarbageCollected<CXFA_TextParser>(
+ : doc_(doc),
+ text_provider_(pTextProvider),
+ text_parser_(cppgc::MakeGarbageCollected<CXFA_TextParser>(
doc->GetHeap()->GetAllocationHandle())) {
- DCHECK(m_pTextProvider);
+ DCHECK(text_provider_);
}
CXFA_TextLayout::~CXFA_TextLayout() = default;
void CXFA_TextLayout::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDoc);
- visitor->Trace(m_pTextProvider);
- visitor->Trace(m_pTextDataNode);
- visitor->Trace(m_pTextParser);
- visitor->Trace(m_pLoader);
+ visitor->Trace(doc_);
+ visitor->Trace(text_provider_);
+ visitor->Trace(text_data_node_);
+ visitor->Trace(text_parser_);
+ visitor->Trace(loader_);
}
void CXFA_TextLayout::Unload() {
- m_pieceLines.clear();
- m_pBreak.reset();
+ piece_lines_.clear();
+ break_.reset();
}
WideString CXFA_TextLayout::GetLinkURLAtPoint(const CFX_PointF& point) {
- for (const auto& pPieceLine : m_pieceLines) {
- for (const auto& pPiece : pPieceLine->m_textPieces) {
+ for (const auto& pPieceLine : piece_lines_) {
+ for (const auto& pPiece : pPieceLine->text_pieces_) {
if (pPiece->pLinkData && pPiece->rtPiece.Contains(point))
return pPiece->pLinkData->GetLinkURL();
}
@@ -120,18 +120,20 @@
}
void CXFA_TextLayout::GetTextDataNode() {
- CXFA_Node* pNode = m_pTextProvider->GetTextNode(&m_bRichText);
- if (pNode && m_bRichText)
- m_pTextParser->Reset();
+ CXFA_Node* pNode = text_provider_->GetTextNode(&rich_text_);
+ if (pNode && rich_text_) {
+ text_parser_->Reset();
+ }
- m_pTextDataNode = pNode;
+ text_data_node_ = pNode;
}
CFX_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
- if (!m_bRichText)
+ if (!rich_text_) {
return nullptr;
+ }
- CFX_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode();
+ CFX_XMLNode* pXMLRoot = text_data_node_->GetXMLMappingNode();
if (!pXMLRoot)
return nullptr;
@@ -154,14 +156,13 @@
auto pBreak = std::make_unique<CFGAS_RTFBreak>(dwStyle);
pBreak->SetLineBreakTolerance(1);
- pBreak->SetFont(
- m_pTextParser->GetFont(m_pDoc.Get(), m_pTextProvider, nullptr));
- pBreak->SetFontSize(m_pTextParser->GetFontSize(m_pTextProvider, nullptr));
+ pBreak->SetFont(text_parser_->GetFont(doc_.Get(), text_provider_, nullptr));
+ pBreak->SetFontSize(text_parser_->GetFontSize(text_provider_, nullptr));
return pBreak;
}
void CXFA_TextLayout::InitBreak(float fLineWidth) {
- CXFA_Para* para = m_pTextProvider->GetParaIfExists();
+ CXFA_Para* para = text_provider_->GetParaIfExists();
float fStart = 0;
float fStartPos = 0;
if (para) {
@@ -185,10 +186,10 @@
default:
NOTREACHED();
}
- m_pBreak->SetAlignment(iAlign);
+ break_->SetAlignment(iAlign);
fStart = para->GetMarginLeft();
- if (m_pTextProvider->IsCheckButtonAndAutoWidth()) {
+ if (text_provider_->IsCheckButtonAndAutoWidth()) {
if (iAlign != CFGAS_RTFBreak::LineAlignment::Left)
fLineWidth -= para->GetMarginRight();
} else {
@@ -203,22 +204,21 @@
fStartPos += fIndent;
}
- m_pBreak->SetLineBoundary(fStart, fLineWidth);
- m_pBreak->SetLineStartPos(fStartPos);
+ break_->SetLineBoundary(fStart, fLineWidth);
+ break_->SetLineStartPos(fStartPos);
- CXFA_Font* font = m_pTextProvider->GetFontIfExists();
+ CXFA_Font* font = text_provider_->GetFontIfExists();
if (font) {
- m_pBreak->SetHorizontalScale(
+ break_->SetHorizontalScale(
static_cast<int32_t>(font->GetHorizontalScale()));
- m_pBreak->SetVerticalScale(static_cast<int32_t>(font->GetVerticalScale()));
- m_pBreak->SetCharSpace(font->GetLetterSpacing());
+ break_->SetVerticalScale(static_cast<int32_t>(font->GetVerticalScale()));
+ break_->SetCharSpace(font->GetLetterSpacing());
}
- float fFontSize = m_pTextParser->GetFontSize(m_pTextProvider, nullptr);
- m_pBreak->SetFontSize(fFontSize);
- m_pBreak->SetFont(
- m_pTextParser->GetFont(m_pDoc.Get(), m_pTextProvider, nullptr));
- m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
+ float fFontSize = text_parser_->GetFontSize(text_provider_, nullptr);
+ break_->SetFontSize(fFontSize);
+ break_->SetFont(text_parser_->GetFont(doc_.Get(), text_provider_, nullptr));
+ break_->SetLineBreakTolerance(fFontSize * 0.2f);
}
void CXFA_TextLayout::InitBreak(CFX_CSSComputedStyle* pStyle,
@@ -250,7 +250,7 @@
default:
break;
}
- m_pBreak->SetAlignment(iAlign);
+ break_->SetAlignment(iAlign);
float fStart = 0;
const CFX_CSSRect* pRect = pStyle->GetMarginWidth();
@@ -281,82 +281,86 @@
pStyle->SetMarginWidth(pNewRect);
}
}
- m_pBreak->SetLineBoundary(fStart, fLineWidth);
+ break_->SetLineBoundary(fStart, fLineWidth);
float fIndent = pStyle->GetTextIndent().GetValue();
if (fIndent > 0)
fStart += fIndent;
- m_pBreak->SetLineStartPos(fStart);
- m_pBreak->SetTabWidth(m_pTextParser->GetTabInterval(pStyle));
- if (!m_pTabstopContext)
- m_pTabstopContext = std::make_unique<CXFA_TextTabstopsContext>();
- m_pTextParser->GetTabstops(pStyle, m_pTabstopContext.get());
- for (const auto& stop : m_pTabstopContext->m_tabstops)
- m_pBreak->AddPositionedTab(stop.fTabstops);
+ break_->SetLineStartPos(fStart);
+ break_->SetTabWidth(text_parser_->GetTabInterval(pStyle));
+ if (!tabstop_context_) {
+ tabstop_context_ = std::make_unique<CXFA_TextTabstopsContext>();
+ }
+ text_parser_->GetTabstops(pStyle, tabstop_context_.get());
+ for (const auto& stop : tabstop_context_->tabstops_) {
+ break_->AddPositionedTab(stop.fTabstops);
+ }
}
- float fFontSize = m_pTextParser->GetFontSize(m_pTextProvider, pStyle);
- m_pBreak->SetFontSize(fFontSize);
- m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
- m_pBreak->SetFont(
- m_pTextParser->GetFont(m_pDoc.Get(), m_pTextProvider, pStyle));
- m_pBreak->SetHorizontalScale(
- m_pTextParser->GetHorScale(m_pTextProvider, pStyle, pXMLNode));
- m_pBreak->SetVerticalScale(
- m_pTextParser->GetVerScale(m_pTextProvider, pStyle));
- m_pBreak->SetCharSpace(pStyle->GetLetterSpacing().GetValue());
+ float fFontSize = text_parser_->GetFontSize(text_provider_, pStyle);
+ break_->SetFontSize(fFontSize);
+ break_->SetLineBreakTolerance(fFontSize * 0.2f);
+ break_->SetFont(text_parser_->GetFont(doc_.Get(), text_provider_, pStyle));
+ break_->SetHorizontalScale(
+ text_parser_->GetHorScale(text_provider_, pStyle, pXMLNode));
+ break_->SetVerticalScale(text_parser_->GetVerScale(text_provider_, pStyle));
+ break_->SetCharSpace(pStyle->GetLetterSpacing().GetValue());
}
float CXFA_TextLayout::GetLayoutHeight() {
- if (!m_pLoader)
+ if (!loader_) {
return 0;
+ }
- if (m_pLoader->lineHeights.empty() && m_pLoader->fWidth > 0) {
- CFX_SizeF szMax(m_pLoader->fWidth, m_pLoader->fHeight);
- m_pLoader->bSaveLineHeight = true;
- m_pLoader->fLastPos = 0;
+ if (loader_->lineHeights.empty() && loader_->fWidth > 0) {
+ CFX_SizeF szMax(loader_->fWidth, loader_->fHeight);
+ loader_->bSaveLineHeight = true;
+ loader_->fLastPos = 0;
CFX_SizeF szDef = CalcSize(szMax, szMax);
- m_pLoader->bSaveLineHeight = false;
+ loader_->bSaveLineHeight = false;
return szDef.height;
}
- float fHeight = m_pLoader->fHeight;
+ float fHeight = loader_->fHeight;
if (fHeight < 0.1f) {
fHeight = 0;
- for (float value : m_pLoader->lineHeights)
+ for (float value : loader_->lineHeights) {
fHeight += value;
+ }
}
return fHeight;
}
float CXFA_TextLayout::StartLayout(float fWidth) {
- if (!m_pLoader)
- m_pLoader = cppgc::MakeGarbageCollected<LoaderContext>(
- m_pDoc->GetHeap()->GetAllocationHandle());
+ if (!loader_) {
+ loader_ = cppgc::MakeGarbageCollected<LoaderContext>(
+ doc_->GetHeap()->GetAllocationHandle());
+ }
if (fWidth < 0 ||
- (m_pLoader->fWidth > -1 && fabs(fWidth - m_pLoader->fWidth) > 0)) {
- m_pLoader->lineHeights.clear();
- m_Blocks.clear();
+ (loader_->fWidth > -1 && fabs(fWidth - loader_->fWidth) > 0)) {
+ loader_->lineHeights.clear();
+ blocks_.clear();
Unload();
- m_pLoader->fStartLineOffset = 0;
+ loader_->fStartLineOffset = 0;
}
- m_pLoader->fWidth = fWidth;
+ loader_->fWidth = fWidth;
if (fWidth >= 0)
return fWidth;
CFX_SizeF szMax;
- m_pLoader->bSaveLineHeight = true;
- m_pLoader->fLastPos = 0;
+ loader_->bSaveLineHeight = true;
+ loader_->fLastPos = 0;
CFX_SizeF szDef = CalcSize(szMax, szMax);
- m_pLoader->bSaveLineHeight = false;
+ loader_->bSaveLineHeight = false;
return szDef.width;
}
float CXFA_TextLayout::DoLayout(float fTextHeight) {
- if (!m_pLoader)
+ if (!loader_) {
return fTextHeight;
+ }
UpdateLoaderHeight(fTextHeight);
return fTextHeight;
@@ -365,57 +369,62 @@
float CXFA_TextLayout::DoSplitLayout(size_t szBlockIndex,
float fCalcHeight,
float fTextHeight) {
- if (!m_pLoader)
+ if (!loader_) {
return fCalcHeight;
+ }
UpdateLoaderHeight(fTextHeight);
if (fCalcHeight < 0)
return fCalcHeight;
- m_bHasBlock = true;
- if (m_Blocks.empty() && m_pLoader->fHeight > 0) {
+ has_block_ = true;
+ if (blocks_.empty() && loader_->fHeight > 0) {
float fHeight = fTextHeight - GetLayoutHeight();
if (fHeight > 0) {
- XFA_AttributeValue iAlign = m_pTextParser->GetVAlign(m_pTextProvider);
+ XFA_AttributeValue iAlign = text_parser_->GetVAlign(text_provider_);
if (iAlign == XFA_AttributeValue::Middle)
fHeight /= 2.0f;
else if (iAlign != XFA_AttributeValue::Bottom)
fHeight = 0;
- m_pLoader->fStartLineOffset = fHeight;
+ loader_->fStartLineOffset = fHeight;
}
}
- float fLinePos = m_pLoader->fStartLineOffset;
+ float fLinePos = loader_->fStartLineOffset;
size_t szLineIndex = 0;
- if (!m_Blocks.empty()) {
- if (szBlockIndex < m_Blocks.size())
- szLineIndex = m_Blocks[szBlockIndex].szIndex;
- else
+ if (!blocks_.empty()) {
+ if (szBlockIndex < blocks_.size()) {
+ szLineIndex = blocks_[szBlockIndex].szIndex;
+ } else {
szLineIndex = GetNextIndexFromLastBlockData();
- for (size_t i = 0;
- i < std::min(szBlockIndex, m_pLoader->blockHeights.size()); ++i) {
- fLinePos -= m_pLoader->blockHeights[i].fHeight;
+ }
+ for (size_t i = 0; i < std::min(szBlockIndex, loader_->blockHeights.size());
+ ++i) {
+ fLinePos -= loader_->blockHeights[i].fHeight;
}
}
- if (szLineIndex >= m_pLoader->lineHeights.size())
+ if (szLineIndex >= loader_->lineHeights.size()) {
return fCalcHeight;
+ }
- if (m_pLoader->lineHeights[szLineIndex] - fCalcHeight > kHeightTolerance)
+ if (loader_->lineHeights[szLineIndex] - fCalcHeight > kHeightTolerance) {
return 0;
+ }
- for (size_t i = szLineIndex; i < m_pLoader->lineHeights.size(); ++i) {
- float fLineHeight = m_pLoader->lineHeights[i];
+ for (size_t i = szLineIndex; i < loader_->lineHeights.size(); ++i) {
+ float fLineHeight = loader_->lineHeights[i];
if (fLinePos + fLineHeight - fCalcHeight <= kHeightTolerance) {
fLinePos += fLineHeight;
continue;
}
- if (szBlockIndex < m_Blocks.size())
- m_Blocks[szBlockIndex] = {szLineIndex, i - szLineIndex};
- else
- m_Blocks.push_back({szLineIndex, i - szLineIndex});
+ if (szBlockIndex < blocks_.size()) {
+ blocks_[szBlockIndex] = {szLineIndex, i - szLineIndex};
+ } else {
+ blocks_.push_back({szLineIndex, i - szLineIndex});
+ }
if (i != szLineIndex)
return fLinePos;
@@ -423,11 +432,11 @@
if (fCalcHeight > fLinePos)
return fCalcHeight;
- if (szBlockIndex < m_pLoader->blockHeights.size() &&
- m_pLoader->blockHeights[szBlockIndex].szBlockIndex == szBlockIndex) {
- m_pLoader->blockHeights[szBlockIndex].fHeight = fCalcHeight;
+ if (szBlockIndex < loader_->blockHeights.size() &&
+ loader_->blockHeights[szBlockIndex].szBlockIndex == szBlockIndex) {
+ loader_->blockHeights[szBlockIndex].fHeight = fCalcHeight;
} else {
- m_pLoader->blockHeights.push_back({szBlockIndex, fCalcHeight});
+ loader_->blockHeights.push_back({szBlockIndex, fCalcHeight});
}
return fCalcHeight;
}
@@ -435,18 +444,19 @@
}
size_t CXFA_TextLayout::CountBlocks() const {
- size_t szCount = m_Blocks.size();
+ size_t szCount = blocks_.size();
return szCount > 0 ? szCount : 1;
}
size_t CXFA_TextLayout::GetNextIndexFromLastBlockData() const {
- return m_Blocks.back().szIndex + m_Blocks.back().szLength;
+ return blocks_.back().szIndex + blocks_.back().szLength;
}
void CXFA_TextLayout::UpdateLoaderHeight(float fTextHeight) {
- m_pLoader->fHeight = fTextHeight;
- if (m_pLoader->fHeight < 0)
- m_pLoader->fHeight = GetLayoutHeight();
+ loader_->fHeight = fTextHeight;
+ if (loader_->fHeight < 0) {
+ loader_->fHeight = GetLayoutHeight();
+ }
}
CFX_SizeF CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
@@ -455,16 +465,16 @@
if (width < 1)
width = 0xFFFF;
- m_pBreak = CreateBreak(false);
+ break_ = CreateBreak(false);
float fLinePos = 0;
- m_iLines = 0;
- m_fMaxWidth = 0;
+ lines_ = 0;
+ max_width_ = 0;
Loader(width, &fLinePos, false);
if (fLinePos < 0.1f)
- fLinePos = m_pTextParser->GetFontSize(m_pTextProvider, nullptr);
+ fLinePos = text_parser_->GetFontSize(text_provider_, nullptr);
- m_pTabstopContext.reset();
- return CFX_SizeF(m_fMaxWidth, fLinePos);
+ tabstop_context_.reset();
+ return CFX_SizeF(max_width_, fLinePos);
}
float CXFA_TextLayout::Layout(const CFX_SizeF& size) {
@@ -472,67 +482,71 @@
return 0.f;
Unload();
- m_pBreak = CreateBreak(true);
- if (m_pLoader) {
- m_pLoader->iTotalLines = -1;
- m_pLoader->nCharIdx = 0;
+ break_ = CreateBreak(true);
+ if (loader_) {
+ loader_->iTotalLines = -1;
+ loader_->nCharIdx = 0;
}
- m_iLines = 0;
+ lines_ = 0;
float fLinePos = 0;
Loader(size.width, &fLinePos, true);
UpdateAlign(size.height, fLinePos);
- m_pTabstopContext.reset();
+ tabstop_context_.reset();
return fLinePos;
}
bool CXFA_TextLayout::LayoutInternal(size_t szBlockIndex) {
DCHECK(szBlockIndex < CountBlocks());
- if (!m_pLoader || m_pLoader->fWidth < 1)
+ if (!loader_ || loader_->fWidth < 1) {
return false;
+ }
- m_pLoader->iTotalLines = -1;
- m_iLines = 0;
+ loader_->iTotalLines = -1;
+ lines_ = 0;
float fLinePos = 0;
CXFA_Node* pNode = nullptr;
- CFX_SizeF szText(m_pLoader->fWidth, m_pLoader->fHeight);
- if (szBlockIndex < m_pLoader->blockHeights.size())
+ CFX_SizeF szText(loader_->fWidth, loader_->fHeight);
+ if (szBlockIndex < loader_->blockHeights.size()) {
return true;
- if (szBlockIndex == m_pLoader->blockHeights.size()) {
+ }
+ if (szBlockIndex == loader_->blockHeights.size()) {
Unload();
- m_pBreak = CreateBreak(true);
- fLinePos = m_pLoader->fStartLineOffset;
- for (size_t i = 0; i < m_pLoader->blockHeights.size(); ++i)
- fLinePos -= m_pLoader->blockHeights[i].fHeight;
+ break_ = CreateBreak(true);
+ fLinePos = loader_->fStartLineOffset;
+ for (size_t i = 0; i < loader_->blockHeights.size(); ++i) {
+ fLinePos -= loader_->blockHeights[i].fHeight;
+ }
- m_pLoader->nCharIdx = 0;
- if (!m_Blocks.empty()) {
- m_pLoader->iTotalLines =
- pdfium::checked_cast<int32_t>(m_Blocks[szBlockIndex].szLength);
+ loader_->nCharIdx = 0;
+ if (!blocks_.empty()) {
+ loader_->iTotalLines =
+ pdfium::checked_cast<int32_t>(blocks_[szBlockIndex].szLength);
}
Loader(szText.width, &fLinePos, true);
- if (m_Blocks.empty() && m_pLoader->fStartLineOffset < 0.1f)
+ if (blocks_.empty() && loader_->fStartLineOffset < 0.1f) {
UpdateAlign(szText.height, fLinePos);
- } else if (m_pTextDataNode) {
- if (!m_Blocks.empty() && szBlockIndex < m_Blocks.size() - 1) {
- m_pLoader->iTotalLines =
- pdfium::checked_cast<int32_t>(m_Blocks[szBlockIndex].szLength);
}
- m_pBreak->Reset();
- if (m_bRichText) {
+ } else if (text_data_node_) {
+ if (!blocks_.empty() && szBlockIndex < blocks_.size() - 1) {
+ loader_->iTotalLines =
+ pdfium::checked_cast<int32_t>(blocks_[szBlockIndex].szLength);
+ }
+ break_->Reset();
+ if (rich_text_) {
CFX_XMLNode* pContainerNode = GetXMLContainerNode();
if (!pContainerNode)
return true;
- const CFX_XMLNode* pXMLNode = m_pLoader->pXMLNode;
+ const CFX_XMLNode* pXMLNode = loader_->pXMLNode;
if (!pXMLNode)
return true;
const CFX_XMLNode* pSaveXMLNode = pXMLNode;
for (; pXMLNode; pXMLNode = pXMLNode->GetNextSibling()) {
if (!LoadRichText(pXMLNode, szText.width, &fLinePos,
- m_pLoader->pParentStyle, true, nullptr, true, false,
+ loader_->pParentStyle, true, nullptr, true, false,
0)) {
break;
}
@@ -542,7 +556,7 @@
if (pXMLNode == pContainerNode)
break;
if (!LoadRichText(pXMLNode, szText.width, &fLinePos,
- m_pLoader->pParentStyle, true, nullptr, false, false,
+ loader_->pParentStyle, true, nullptr, false, false,
0)) {
break;
}
@@ -552,14 +566,14 @@
continue;
for (; pXMLNode; pXMLNode = pXMLNode->GetNextSibling()) {
if (!LoadRichText(pXMLNode, szText.width, &fLinePos,
- m_pLoader->pParentStyle, true, nullptr, true, false,
+ loader_->pParentStyle, true, nullptr, true, false,
0)) {
break;
}
}
}
} else {
- pNode = m_pLoader->pNode.Get();
+ pNode = loader_->pNode.Get();
if (!pNode)
return true;
LoadText(pNode, szText.width, &fLinePos, true);
@@ -569,18 +583,20 @@
}
void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, size_t szBlockIndex) {
- if (!m_pLoader)
+ if (!loader_) {
return;
+ }
- if (m_pLoader->lineHeights.empty())
+ if (loader_->lineHeights.empty()) {
return;
+ }
- float fLinePos = m_pLoader->fStartLineOffset;
+ float fLinePos = loader_->fStartLineOffset;
size_t szLineIndex = 0;
if (szBlockIndex > 0) {
- if (szBlockIndex <= m_pLoader->blockHeights.size()) {
+ if (szBlockIndex <= loader_->blockHeights.size()) {
for (size_t i = 0; i < szBlockIndex; ++i)
- fLinePos -= m_pLoader->blockHeights[i].fHeight;
+ fLinePos -= loader_->blockHeights[i].fHeight;
} else {
fLinePos = 0;
}
@@ -588,16 +604,16 @@
}
size_t i;
- for (i = szLineIndex; i < m_pLoader->lineHeights.size(); ++i) {
- float fLineHeight = m_pLoader->lineHeights[i];
+ for (i = szLineIndex; i < loader_->lineHeights.size(); ++i) {
+ float fLineHeight = loader_->lineHeights[i];
if (fLinePos + fLineHeight - rtText.height > kHeightTolerance) {
- m_Blocks.push_back({szLineIndex, i - szLineIndex});
+ blocks_.push_back({szLineIndex, i - szLineIndex});
return;
}
fLinePos += fLineHeight;
}
if (i > szLineIndex)
- m_Blocks.push_back({szLineIndex, i - szLineIndex});
+ blocks_.push_back({szLineIndex, i - szLineIndex});
}
bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
@@ -610,40 +626,42 @@
pFxDevice->SaveState();
pFxDevice->SetClip_Rect(rtClip.GetOuterRect());
- if (m_pieceLines.empty()) {
+ if (piece_lines_.empty()) {
size_t szBlockCount = CountBlocks();
for (size_t i = 0; i < szBlockCount; ++i)
LayoutInternal(i);
- m_pTabstopContext.reset();
- m_pLoader.Clear();
+ tabstop_context_.reset();
+ loader_.Clear();
}
std::vector<TextCharPos> char_pos(1);
size_t szLineStart = 0;
- size_t szPieceLines = m_pieceLines.size();
- if (!m_Blocks.empty()) {
- if (szBlockIndex < m_Blocks.size()) {
- szLineStart = m_Blocks[szBlockIndex].szIndex;
- szPieceLines = m_Blocks[szBlockIndex].szLength;
+ size_t szPieceLines = piece_lines_.size();
+ if (!blocks_.empty()) {
+ if (szBlockIndex < blocks_.size()) {
+ szLineStart = blocks_[szBlockIndex].szIndex;
+ szPieceLines = blocks_[szBlockIndex].szLength;
} else {
szPieceLines = 0;
}
}
for (size_t i = 0; i < szPieceLines; ++i) {
- if (i + szLineStart >= m_pieceLines.size())
+ if (i + szLineStart >= piece_lines_.size()) {
break;
+ }
- PieceLine* pPieceLine = m_pieceLines[i + szLineStart].get();
- for (size_t j = 0; j < pPieceLine->m_textPieces.size(); ++j) {
- const TextPiece* pPiece = pPieceLine->m_textPieces[j].get();
+ PieceLine* pPieceLine = piece_lines_[i + szLineStart].get();
+ for (size_t j = 0; j < pPieceLine->text_pieces_.size(); ++j) {
+ const TextPiece* pPiece = pPieceLine->text_pieces_[j].get();
int32_t iChars = pPiece->iChars;
if (fxcrt::CollectionSize<int32_t>(char_pos) < iChars)
char_pos.resize(iChars);
RenderString(pFxDevice, pPieceLine, j, char_pos, mtDoc2Device);
}
- for (size_t j = 0; j < pPieceLine->m_textPieces.size(); ++j)
+ for (size_t j = 0; j < pPieceLine->text_pieces_.size(); ++j) {
RenderPath(pFxDevice, pPieceLine, j, char_pos, mtDoc2Device);
+ }
}
pFxDevice->RestoreState(false);
return szPieceLines > 0;
@@ -654,7 +672,7 @@
if (fHeight < 0.1f)
return;
- switch (m_pTextParser->GetVAlign(m_pTextProvider)) {
+ switch (text_parser_->GetVAlign(text_provider_)) {
case XFA_AttributeValue::Middle:
fHeight /= 2.0f;
break;
@@ -664,9 +682,10 @@
return;
}
- for (const auto& pPieceLine : m_pieceLines) {
- for (const auto& pPiece : pPieceLine->m_textPieces)
+ for (const auto& pPieceLine : piece_lines_) {
+ for (const auto& pPiece : pPieceLine->text_pieces_) {
pPiece->rtPiece.top += fHeight;
+ }
}
}
@@ -674,11 +693,12 @@
float* pLinePos,
bool bSavePieces) {
GetTextDataNode();
- if (!m_pTextDataNode)
+ if (!text_data_node_) {
return;
+ }
- if (!m_bRichText) {
- LoadText(m_pTextDataNode, textWidth, pLinePos, bSavePieces);
+ if (!rich_text_) {
+ LoadText(text_data_node_, textWidth, pLinePos, bSavePieces);
return;
}
@@ -686,10 +706,11 @@
if (!pXMLContainer)
return;
- if (!m_pTextParser->IsParsed())
- m_pTextParser->DoParse(pXMLContainer, m_pTextProvider);
+ if (!text_parser_->IsParsed()) {
+ text_parser_->DoParse(pXMLContainer, text_provider_);
+ }
- auto pRootStyle = m_pTextParser->CreateRootStyle(m_pTextProvider);
+ auto pRootStyle = text_parser_->CreateRootStyle(text_provider_);
LoadRichText(pXMLContainer, textWidth, pLinePos, std::move(pRootStyle),
bSavePieces, nullptr, true, false, 0);
}
@@ -700,7 +721,7 @@
bool bSavePieces) {
InitBreak(textWidth);
- CXFA_Para* para = m_pTextProvider->GetParaIfExists();
+ CXFA_Para* para = text_provider_->GetParaIfExists();
float fSpaceAbove = 0;
if (para) {
fSpaceAbove = para->GetSpaceAbove();
@@ -722,10 +743,11 @@
WideString wsText = pNode->JSObject()->GetContent(false);
wsText.TrimBack(L" ");
bool bRet = AppendChar(wsText, pLinePos, fSpaceAbove, bSavePieces);
- if (bRet && m_pLoader)
- m_pLoader->pNode = pNode;
- else
+ if (bRet && loader_) {
+ loader_->pNode = pNode;
+ } else {
EndBreak(CFGAS_Char::BreakType::kParagraph, pLinePos, bSavePieces);
+ }
}
bool CXFA_TextLayout::LoadRichText(const CFX_XMLNode* pXMLNode,
@@ -741,7 +763,7 @@
return false;
CXFA_TextParser::Context* pContext =
- m_pTextParser->GetParseContextFromMap(pXMLNode);
+ text_parser_->GetParseContextFromMap(pXMLNode);
CFX_CSSDisplay eDisplay = CFX_CSSDisplay::None;
bool bContentNode = false;
float fSpaceBelow = 0;
@@ -770,7 +792,7 @@
return true;
}
- pStyle = m_pTextParser->ComputeStyle(pXMLNode, pParentStyle);
+ pStyle = text_parser_->ComputeStyle(pXMLNode, pParentStyle);
InitBreak(bContentNode ? pParentStyle.Get() : pStyle.Get(), eDisplay,
textWidth, pXMLNode, pParentStyle.Get());
if ((eDisplay == CFX_CSSDisplay::Block ||
@@ -792,9 +814,9 @@
pLinkData = pdfium::MakeRetain<CFGAS_LinkUserData>(wsLinkContent);
}
- int32_t iTabCount = m_pTextParser->CountTabs(
+ int32_t iTabCount = text_parser_->CountTabs(
bContentNode ? pParentStyle.Get() : pStyle.Get());
- bool bSpaceRun = m_pTextParser->IsSpaceRun(
+ bool bSpaceRun = text_parser_->IsSpaceRun(
bContentNode ? pParentStyle.Get() : pStyle.Get());
WideString wsText;
if (bContentNode && iTabCount == 0) {
@@ -814,7 +836,7 @@
wsText += L'\t';
} else {
std::optional<WideString> obj =
- m_pTextParser->GetEmbeddedObj(m_pTextProvider, pXMLNode);
+ text_parser_->GetEmbeddedObj(text_provider_, pXMLNode);
if (obj.has_value())
wsText = obj.value();
}
@@ -823,37 +845,38 @@
if (!wsText.IsEmpty() && bContentNode && !bSpaceRun)
ProcessText(&wsText);
- if (m_pLoader) {
- if (wsText.GetLength() > 0 && m_pLoader->bFilterSpace) {
+ if (loader_) {
+ if (wsText.GetLength() > 0 && loader_->bFilterSpace) {
wsText.TrimFront(L" ");
}
if (CFX_CSSDisplay::Block == eDisplay) {
- m_pLoader->bFilterSpace = true;
+ loader_->bFilterSpace = true;
} else if (CFX_CSSDisplay::Inline == eDisplay &&
- m_pLoader->bFilterSpace) {
- m_pLoader->bFilterSpace = false;
+ loader_->bFilterSpace) {
+ loader_->bFilterSpace = false;
} else if (wsText.GetLength() > 0 && wsText.Back() == 0x20) {
- m_pLoader->bFilterSpace = true;
+ loader_->bFilterSpace = true;
} else if (wsText.GetLength() != 0) {
- m_pLoader->bFilterSpace = false;
+ loader_->bFilterSpace = false;
}
}
if (wsText.GetLength() > 0) {
- if (!m_pLoader || m_pLoader->nCharIdx == 0) {
+ if (!loader_ || loader_->nCharIdx == 0) {
auto pUserData = pdfium::MakeRetain<CFGAS_TextUserData>(
bContentNode ? pParentStyle : pStyle, pLinkData);
- m_pBreak->SetUserData(pUserData);
+ break_->SetUserData(pUserData);
}
if (AppendChar(wsText, pLinePos, 0, bSavePieces)) {
- if (m_pLoader)
- m_pLoader->bFilterSpace = false;
+ if (loader_) {
+ loader_->bFilterSpace = false;
+ }
if (!IsEnd(bSavePieces))
return true;
- if (m_pLoader && m_pLoader->iTotalLines > -1) {
- m_pLoader->pXMLNode = pXMLNode;
- m_pLoader->pParentStyle = pParentStyle;
+ if (loader_ && loader_->iTotalLines > -1) {
+ loader_->pXMLNode = pXMLNode;
+ loader_->pParentStyle = pParentStyle;
}
return false;
}
@@ -871,9 +894,9 @@
return false;
}
- if (m_pLoader) {
+ if (loader_) {
if (CFX_CSSDisplay::Block == eDisplay)
- m_pLoader->bFilterSpace = true;
+ loader_->bFilterSpace = true;
}
if (bCurLi)
EndBreak(CFGAS_Char::BreakType::kLine, pLinePos, bSavePieces);
@@ -891,15 +914,16 @@
EndBreak(dwStatus, pLinePos, bSavePieces);
if (eDisplay == CFX_CSSDisplay::Block) {
*pLinePos += fSpaceBelow;
- if (m_pTabstopContext)
- m_pTabstopContext->RemoveAll();
+ if (tabstop_context_) {
+ tabstop_context_->RemoveAll();
+ }
}
if (!IsEnd(bSavePieces))
return true;
- if (m_pLoader && m_pLoader->iTotalLines > -1) {
- m_pLoader->pXMLNode = pXMLNode->GetNextSibling();
- m_pLoader->pParentStyle = pParentStyle;
+ if (loader_ && loader_->iTotalLines > -1) {
+ loader_->pXMLNode = pXMLNode->GetNextSibling();
+ loader_->pParentStyle = pParentStyle;
}
return false;
}
@@ -909,28 +933,31 @@
float fSpaceAbove,
bool bSavePieces) {
CFGAS_Char::BreakType dwStatus = CFGAS_Char::BreakType::kNone;
- size_t iChar = m_pLoader ? m_pLoader->nCharIdx : 0;
+ size_t iChar = loader_ ? loader_->nCharIdx : 0;
size_t iLength = wsText.GetLength();
for (size_t i = iChar; i < iLength; i++) {
wchar_t wch = wsText[i];
if (wch == 0xA0)
wch = 0x20;
- dwStatus = m_pBreak->AppendChar(wch);
+ dwStatus = break_->AppendChar(wch);
if (dwStatus != CFGAS_Char::BreakType::kNone &&
dwStatus != CFGAS_Char::BreakType::kPiece) {
AppendTextLine(dwStatus, pLinePos, bSavePieces, false);
if (IsEnd(bSavePieces)) {
- if (m_pLoader)
- m_pLoader->nCharIdx = i;
+ if (loader_) {
+ loader_->nCharIdx = i;
+ }
return true;
}
- if (dwStatus == CFGAS_Char::BreakType::kParagraph && m_bRichText)
+ if (dwStatus == CFGAS_Char::BreakType::kParagraph && rich_text_) {
*pLinePos += fSpaceAbove;
+ }
}
}
- if (m_pLoader)
- m_pLoader->nCharIdx = 0;
+ if (loader_) {
+ loader_->nCharIdx = 0;
+ }
return false;
}
@@ -938,15 +965,16 @@
bool CXFA_TextLayout::IsEnd(bool bSavePieces) {
if (!bSavePieces)
return false;
- if (m_pLoader && m_pLoader->iTotalLines > 0)
- return m_iLines >= m_pLoader->iTotalLines;
+ if (loader_ && loader_->iTotalLines > 0) {
+ return lines_ >= loader_->iTotalLines;
+ }
return false;
}
void CXFA_TextLayout::EndBreak(CFGAS_Char::BreakType dwStatus,
float* pLinePos,
bool bSavePieces) {
- dwStatus = m_pBreak->EndBreak(dwStatus);
+ dwStatus = break_->EndBreak(dwStatus);
if (dwStatus != CFGAS_Char::BreakType::kNone &&
dwStatus != CFGAS_Char::BreakType::kPiece)
AppendTextLine(dwStatus, pLinePos, bSavePieces, true);
@@ -957,33 +985,35 @@
if (!pStyle || !pPieceLine)
return;
- if (!m_pTabstopContext || m_pTabstopContext->m_tabstops.empty())
+ if (!tabstop_context_ || tabstop_context_->tabstops_.empty()) {
return;
+ }
- int32_t iPieces = fxcrt::CollectionSize<int32_t>(pPieceLine->m_textPieces);
+ int32_t iPieces = fxcrt::CollectionSize<int32_t>(pPieceLine->text_pieces_);
if (iPieces == 0)
return;
- TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
- int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex;
- int32_t iCount = m_pTextParser->CountTabs(pStyle);
- if (!fxcrt::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
+ TextPiece* pPiece = pPieceLine->text_pieces_[iPieces - 1].get();
+ int32_t& iTabstopsIndex = tabstop_context_->tab_index_;
+ int32_t iCount = text_parser_->CountTabs(pStyle);
+ if (!fxcrt::IndexInBounds(tabstop_context_->tabstops_, iTabstopsIndex)) {
return;
+ }
if (iCount > 0) {
iTabstopsIndex++;
- m_pTabstopContext->m_bHasTabstops = true;
+ tabstop_context_->has_tabstops_ = true;
float fRight = 0;
if (iPieces > 1) {
- const TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get();
+ const TextPiece* p = pPieceLine->text_pieces_[iPieces - 2].get();
fRight = p->rtPiece.right();
}
- m_pTabstopContext->m_fTabWidth =
+ tabstop_context_->tab_width_ =
pPiece->rtPiece.width + pPiece->rtPiece.left - fRight;
} else if (iTabstopsIndex > -1) {
float fLeft = 0;
- if (m_pTabstopContext->m_bHasTabstops) {
- uint32_t dwAlign = m_pTabstopContext->m_tabstops[iTabstopsIndex].dwAlign;
+ if (tabstop_context_->has_tabstops_) {
+ uint32_t dwAlign = tabstop_context_->tabstops_[iTabstopsIndex].dwAlign;
if (dwAlign == FX_HashCode_GetW(L"center")) {
fLeft = pPiece->rtPiece.width / 2.0f;
} else if (dwAlign == FX_HashCode_GetW(L"right") ||
@@ -998,12 +1028,11 @@
fLeft += pPiece->Widths[i] / 20000.0f;
}
}
- m_pTabstopContext->m_fLeft =
- std::min(fLeft, m_pTabstopContext->m_fTabWidth);
- m_pTabstopContext->m_bHasTabstops = false;
- m_pTabstopContext->m_fTabWidth = 0;
+ tabstop_context_->left_ = std::min(fLeft, tabstop_context_->tab_width_);
+ tabstop_context_->has_tabstops_ = false;
+ tabstop_context_->tab_width_ = 0;
}
- pPiece->rtPiece.left -= m_pTabstopContext->m_fLeft;
+ pPiece->rtPiece.left -= tabstop_context_->left_;
}
}
@@ -1011,7 +1040,7 @@
float* pLinePos,
bool bSavePieces,
bool bEndBreak) {
- int32_t iPieces = m_pBreak->CountBreakPieces();
+ int32_t iPieces = break_->CountBreakPieces();
if (iPieces < 1)
return;
@@ -1019,18 +1048,19 @@
if (bSavePieces) {
auto pNew = std::make_unique<PieceLine>();
PieceLine* pPieceLine = pNew.get();
- m_pieceLines.push_back(std::move(pNew));
- if (m_pTabstopContext)
- m_pTabstopContext->Reset();
+ piece_lines_.push_back(std::move(pNew));
+ if (tabstop_context_) {
+ tabstop_context_->Reset();
+ }
float fLineStep = 0;
float fBaseLine = 0;
int32_t i = 0;
for (i = 0; i < iPieces; i++) {
- const CFGAS_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
+ const CFGAS_BreakPiece* pPiece = break_->GetBreakPieceUnstable(i);
const CFGAS_TextUserData* pUserData = pPiece->GetUserData();
if (pUserData)
- pStyle = pUserData->m_pStyle;
+ pStyle = pUserData->style_;
float fVerScale = pPiece->GetVerticalScale() / 100.0f;
auto pTP = std::make_unique<TextPiece>();
@@ -1041,37 +1071,36 @@
pTP->iHorScale = pPiece->GetHorizontalScale();
pTP->iVerScale = pPiece->GetVerticalScale();
pTP->iUnderline =
- m_pTextParser->GetUnderline(m_pTextProvider, pStyle.Get());
+ text_parser_->GetUnderline(text_provider_, pStyle.Get());
pTP->iPeriod =
- m_pTextParser->GetUnderlinePeriod(m_pTextProvider, pStyle.Get());
+ text_parser_->GetUnderlinePeriod(text_provider_, pStyle.Get());
pTP->iLineThrough =
- m_pTextParser->GetLinethrough(m_pTextProvider, pStyle.Get());
- pTP->dwColor = m_pTextParser->GetColor(m_pTextProvider, pStyle.Get());
+ text_parser_->GetLinethrough(text_provider_, pStyle.Get());
+ pTP->dwColor = text_parser_->GetColor(text_provider_, pStyle.Get());
pTP->pFont =
- m_pTextParser->GetFont(m_pDoc.Get(), m_pTextProvider, pStyle.Get());
- pTP->fFontSize =
- m_pTextParser->GetFontSize(m_pTextProvider, pStyle.Get());
+ text_parser_->GetFont(doc_.Get(), text_provider_, pStyle.Get());
+ pTP->fFontSize = text_parser_->GetFontSize(text_provider_, pStyle.Get());
pTP->rtPiece.left = pPiece->GetStartPos() / 20000.0f;
pTP->rtPiece.width = pPiece->GetWidth() / 20000.0f;
pTP->rtPiece.height =
static_cast<float>(pPiece->GetFontSize()) * fVerScale / 20.0f;
float fBaseLineTemp =
- m_pTextParser->GetBaseline(m_pTextProvider, pStyle.Get());
+ text_parser_->GetBaseline(text_provider_, pStyle.Get());
pTP->rtPiece.top = fBaseLineTemp;
- float fLineHeight = m_pTextParser->GetLineHeight(
- m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
+ float fLineHeight = text_parser_->GetLineHeight(
+ text_provider_, pStyle.Get(), lines_ == 0, fVerScale);
if (fBaseLineTemp > 0) {
float fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height;
if (fLineHeight < fLineHeightTmp)
fLineHeight = fLineHeightTmp;
}
fLineStep = std::max(fLineStep, fLineHeight);
- pTP->pLinkData = pUserData ? pUserData->m_pLinkData : nullptr;
- pPieceLine->m_textPieces.push_back(std::move(pTP));
+ pTP->pLinkData = pUserData ? pUserData->link_data_ : nullptr;
+ pPieceLine->text_pieces_.push_back(std::move(pTP));
DoTabstops(pStyle.Get(), pPieceLine);
}
- for (const auto& pTP : pPieceLine->m_textPieces) {
+ for (const auto& pTP : pPieceLine->text_pieces_) {
float& fTop = pTP->rtPiece.top;
float fBaseLineTemp = fTop;
fTop = *pLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp;
@@ -1082,15 +1111,14 @@
float fLineStep = 0;
float fLineWidth = 0;
for (int32_t i = 0; i < iPieces; i++) {
- const CFGAS_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
+ const CFGAS_BreakPiece* pPiece = break_->GetBreakPieceUnstable(i);
const CFGAS_TextUserData* pUserData = pPiece->GetUserData();
if (pUserData)
- pStyle = pUserData->m_pStyle;
+ pStyle = pUserData->style_;
float fVerScale = pPiece->GetVerticalScale() / 100.0f;
- float fBaseLine =
- m_pTextParser->GetBaseline(m_pTextProvider, pStyle.Get());
- float fLineHeight = m_pTextParser->GetLineHeight(
- m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
+ float fBaseLine = text_parser_->GetBaseline(text_provider_, pStyle.Get());
+ float fLineHeight = text_parser_->GetLineHeight(
+ text_provider_, pStyle.Get(), lines_ == 0, fVerScale);
if (fBaseLine > 0) {
float fLineHeightTmp =
fBaseLine +
@@ -1103,19 +1131,19 @@
fLineWidth += pPiece->GetWidth() / 20000.0f;
}
*pLinePos += fLineStep;
- m_fMaxWidth = std::max(m_fMaxWidth, fLineWidth);
- if (m_pLoader && m_pLoader->bSaveLineHeight) {
- float fHeight = *pLinePos - m_pLoader->fLastPos;
- m_pLoader->fLastPos = *pLinePos;
- m_pLoader->lineHeights.push_back(fHeight);
+ max_width_ = std::max(max_width_, fLineWidth);
+ if (loader_ && loader_->bSaveLineHeight) {
+ float fHeight = *pLinePos - loader_->fLastPos;
+ loader_->fLastPos = *pLinePos;
+ loader_->lineHeights.push_back(fHeight);
}
}
- m_pBreak->ClearBreakPieces();
+ break_->ClearBreakPieces();
if (dwStatus == CFGAS_Char::BreakType::kParagraph) {
- m_pBreak->Reset();
+ break_->Reset();
if (!pStyle && bEndBreak) {
- CXFA_Para* para = m_pTextProvider->GetParaIfExists();
+ CXFA_Para* para = text_provider_->GetParaIfExists();
if (para) {
float fStartPos = para->GetMarginLeft();
float fIndent = para->GetTextIndent();
@@ -1126,7 +1154,7 @@
if (fSpaceBelow < 0.1f)
fSpaceBelow = 0;
- m_pBreak->SetLineStartPos(fStartPos);
+ break_->SetLineStartPos(fStartPos);
*pLinePos += fSpaceBelow;
}
}
@@ -1142,9 +1170,9 @@
if (fTextIndent < 0)
fStart -= fTextIndent;
- m_pBreak->SetLineStartPos(fStart);
+ break_->SetLineStartPos(fStart);
}
- m_iLines++;
+ lines_++;
}
void CXFA_TextLayout::RenderString(CFX_RenderDevice* pDevice,
@@ -1152,14 +1180,14 @@
size_t szPiece,
pdfium::span<TextCharPos> pCharPos,
const CFX_Matrix& mtDoc2Device) {
- const TextPiece* pPiece = pPieceLine->m_textPieces[szPiece].get();
+ const TextPiece* pPiece = pPieceLine->text_pieces_[szPiece].get();
size_t szCount = GetDisplayPos(pPiece, pCharPos);
if (szCount > 0) {
CFDE_TextOut::DrawString(pDevice, pPiece->dwColor, pPiece->pFont,
pCharPos.first(szCount), pPiece->fFontSize,
mtDoc2Device);
}
- pPieceLine->m_charCounts.push_back(szCount);
+ pPieceLine->char_counts_.push_back(szCount);
}
void CXFA_TextLayout::RenderPath(CFX_RenderDevice* pDevice,
@@ -1167,7 +1195,7 @@
size_t szPiece,
pdfium::span<TextCharPos> pCharPos,
const CFX_Matrix& mtDoc2Device) {
- const TextPiece* pPiece = pPieceLine->m_textPieces[szPiece].get();
+ const TextPiece* pPiece = pPieceLine->text_pieces_[szPiece].get();
bool bNoUnderline = pPiece->iUnderline < 1 || pPiece->iUnderline > 2;
bool bNoLineThrough = pPiece->iLineThrough < 1 || pPiece->iLineThrough > 2;
if (bNoUnderline && bNoLineThrough)
@@ -1220,7 +1248,7 @@
size_t szPieceNext = szPiece;
while (szPiecePrev > 0) {
szPiecePrev--;
- if (pPieceLine->m_charCounts[szPiecePrev] > 0) {
+ if (pPieceLine->char_counts_[szPiecePrev] > 0) {
bHasCount = true;
break;
}
@@ -1229,9 +1257,9 @@
return;
bHasCount = false;
- while (szPieceNext + 1 < pPieceLine->m_textPieces.size()) {
+ while (szPieceNext + 1 < pPieceLine->text_pieces_.size()) {
++szPieceNext;
- if (pPieceLine->m_charCounts[szPieceNext] > 0) {
+ if (pPieceLine->char_counts_[szPieceNext] > 0) {
bHasCount = true;
break;
}
@@ -1241,14 +1269,14 @@
float fOrgX = 0.0f;
float fEndX = 0.0f;
- pPiece = pPieceLine->m_textPieces[szPiecePrev].get();
+ pPiece = pPieceLine->text_pieces_[szPiecePrev].get();
szChars = GetDisplayPos(pPiece, pCharPos);
if (szChars < 1)
return;
fOrgX = pCharPos[szChars - 1].m_Origin.x +
pCharPos[szChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f;
- pPiece = pPieceLine->m_textPieces[szPieceNext].get();
+ pPiece = pPieceLine->text_pieces_[szPieceNext].get();
szChars = GetDisplayPos(pPiece, pCharPos);
if (szChars < 1)
return;
@@ -1284,5 +1312,5 @@
if (!pPiece || pPiece->iChars < 1) {
return 0;
}
- return m_pBreak->GetDisplayPos(pPiece, pCharPos);
+ return break_->GetDisplayPos(pPiece, pCharPos);
}
diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h
index 4cf1328..83f8d8a 100644
--- a/xfa/fxfa/cxfa_textlayout.h
+++ b/xfa/fxfa/cxfa_textlayout.h
@@ -58,11 +58,11 @@
const CFX_Matrix& mtDoc2Device,
const CFX_RectF& rtClip,
size_t szBlockIndex);
- bool IsLoaded() const { return !m_pieceLines.empty(); }
+ bool IsLoaded() const { return !piece_lines_.empty(); }
void Unload();
- bool HasBlock() const { return m_bHasBlock; }
- void ClearBlocks() { m_Blocks.clear(); }
- void ResetHasBlock() { m_bHasBlock = false; }
+ bool HasBlock() const { return has_block_; }
+ void ClearBlocks() { blocks_.clear(); }
+ void ResetHasBlock() { has_block_ = false; }
// Returns empty string when no link is present.
WideString GetLinkURLAtPoint(const CFX_PointF& point);
@@ -85,8 +85,8 @@
PieceLine();
~PieceLine();
- std::vector<std::unique_ptr<TextPiece>> m_textPieces;
- std::vector<size_t> m_charCounts;
+ std::vector<std::unique_ptr<TextPiece>> text_pieces_;
+ std::vector<size_t> char_counts_;
};
struct BlockData {
@@ -175,19 +175,19 @@
size_t GetNextIndexFromLastBlockData() const;
void UpdateLoaderHeight(float fTextHeight);
- bool m_bHasBlock = false;
- bool m_bRichText = false;
- int32_t m_iLines = 0;
- float m_fMaxWidth = 0;
- std::vector<BlockData> m_Blocks;
- cppgc::Member<CXFA_FFDoc> const m_pDoc;
- cppgc::Member<CXFA_TextProvider> const m_pTextProvider;
- cppgc::Member<CXFA_Node> m_pTextDataNode;
- cppgc::Member<CXFA_TextParser> m_pTextParser;
- cppgc::Member<LoaderContext> m_pLoader;
- std::unique_ptr<CFGAS_RTFBreak> m_pBreak;
- std::vector<std::unique_ptr<PieceLine>> m_pieceLines;
- std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext;
+ bool has_block_ = false;
+ bool rich_text_ = false;
+ int32_t lines_ = 0;
+ float max_width_ = 0;
+ std::vector<BlockData> blocks_;
+ cppgc::Member<CXFA_FFDoc> const doc_;
+ cppgc::Member<CXFA_TextProvider> const text_provider_;
+ cppgc::Member<CXFA_Node> text_data_node_;
+ cppgc::Member<CXFA_TextParser> text_parser_;
+ cppgc::Member<LoaderContext> loader_;
+ std::unique_ptr<CFGAS_RTFBreak> break_;
+ std::vector<std::unique_ptr<PieceLine>> piece_lines_;
+ std::unique_ptr<CXFA_TextTabstopsContext> tabstop_context_;
};
#endif // XFA_FXFA_CXFA_TEXTLAYOUT_H_
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 363ac63..33a402a 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -62,28 +62,29 @@
CXFA_TextParser::~CXFA_TextParser() = default;
void CXFA_TextParser::Reset() {
- m_mapXMLNodeToParseContext.clear();
- m_bParsed = false;
+ map_xmlnode_to_parse_context_.clear();
+ parsed_ = false;
}
void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
if (!pTextProvider)
return;
- if (!m_pSelector) {
- m_pSelector = std::make_unique<CFX_CSSStyleSelector>();
+ if (!selector_) {
+ selector_ = std::make_unique<CFX_CSSStyleSelector>();
CXFA_Font* font = pTextProvider->GetFontIfExists();
- m_pSelector->SetDefaultFontSize(font ? font->GetFontSize() : 10.0f);
+ selector_->SetDefaultFontSize(font ? font->GetFontSize() : 10.0f);
}
- if (m_cssInitialized)
+ if (css_initialized_) {
return;
+ }
- m_cssInitialized = true;
+ css_initialized_ = true;
auto uaSheet = LoadDefaultSheetStyle();
- m_pSelector->SetUAStyleSheet(std::move(uaSheet));
- m_pSelector->UpdateStyleIndex();
+ selector_->SetUAStyleSheet(std::move(uaSheet));
+ selector_->UpdateStyleIndex();
}
std::unique_ptr<CFX_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
@@ -108,7 +109,7 @@
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_TextProvider* pTextProvider) {
CXFA_Para* para = pTextProvider->GetParaIfExists();
- auto pStyle = m_pSelector->CreateComputedStyle(nullptr);
+ auto pStyle = selector_->CreateComputedStyle(nullptr);
float fLineHeight = 0;
float fFontSize = 10;
@@ -175,7 +176,7 @@
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateStyle(
const CFX_CSSComputedStyle* pParentStyle) {
- auto pNewStyle = m_pSelector->CreateComputedStyle(pParentStyle);
+ auto pNewStyle = selector_->CreateComputedStyle(pParentStyle);
DCHECK(pNewStyle);
if (!pParentStyle)
return pNewStyle;
@@ -197,9 +198,10 @@
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
const CFX_XMLNode* pXMLNode,
RetainPtr<const CFX_CSSComputedStyle> pParentStyle) {
- auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
- if (it == m_mapXMLNodeToParseContext.end())
+ auto it = map_xmlnode_to_parse_context_.find(pXMLNode);
+ if (it == map_xmlnode_to_parse_context_.end()) {
return nullptr;
+ }
Context* pContext = it->second.get();
if (!pContext)
@@ -208,22 +210,24 @@
pContext->SetParentStyle(pParentStyle);
auto tagProvider = ParseTagInfo(pXMLNode);
- if (tagProvider->m_bContent)
+ if (tagProvider->content_) {
return nullptr;
+ }
auto pStyle = CreateStyle(pParentStyle);
- m_pSelector->ComputeStyle(pContext->GetDecls(),
- tagProvider->GetAttribute(L"style"),
- tagProvider->GetAttribute(L"align"), pStyle.Get());
+ selector_->ComputeStyle(pContext->GetDecls(),
+ tagProvider->GetAttribute(L"style"),
+ tagProvider->GetAttribute(L"align"), pStyle.Get());
return pStyle;
}
void CXFA_TextParser::DoParse(const CFX_XMLNode* pXMLContainer,
CXFA_TextProvider* pTextProvider) {
- if (!pXMLContainer || !pTextProvider || m_bParsed)
+ if (!pXMLContainer || !pTextProvider || parsed_) {
return;
+ }
- m_bParsed = true;
+ parsed_ = true;
InitCSSData(pTextProvider);
auto pRootStyle = CreateRootStyle(pTextProvider);
ParseRichText(pXMLContainer, pRootStyle.Get());
@@ -235,21 +239,21 @@
return;
auto tagProvider = ParseTagInfo(pXMLNode);
- if (!tagProvider->m_bTagAvailable)
+ if (!tagProvider->tag_available_) {
return;
+ }
RetainPtr<CFX_CSSComputedStyle> pNewStyle;
if (!(tagProvider->GetTagName().EqualsASCII("body") &&
tagProvider->GetTagName().EqualsASCII("html"))) {
auto pTextContext = std::make_unique<Context>();
CFX_CSSDisplay eDisplay = CFX_CSSDisplay::Inline;
- if (!tagProvider->m_bContent) {
- auto declArray =
- m_pSelector->MatchDeclarations(tagProvider->GetTagName());
+ if (!tagProvider->content_) {
+ auto declArray = selector_->MatchDeclarations(tagProvider->GetTagName());
pNewStyle = CreateStyle(pParentStyle);
- m_pSelector->ComputeStyle(declArray, tagProvider->GetAttribute(L"style"),
- tagProvider->GetAttribute(L"align"),
- pNewStyle.Get());
+ selector_->ComputeStyle(declArray, tagProvider->GetAttribute(L"style"),
+ tagProvider->GetAttribute(L"align"),
+ pNewStyle.Get());
if (!declArray.empty())
pTextContext->SetDecls(std::move(declArray));
@@ -257,7 +261,7 @@
eDisplay = pNewStyle->GetDisplay();
}
pTextContext->SetDisplay(eDisplay);
- m_mapXMLNodeToParseContext[pXMLNode] = std::move(pTextContext);
+ map_xmlnode_to_parse_context_[pXMLNode] = std::move(pTextContext);
}
for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild;
@@ -294,7 +298,7 @@
if (pXMLElement) {
WideString wsName = pXMLElement->GetLocalTagName();
tagProvider->SetTagName(wsName);
- tagProvider->m_bTagAvailable = TagValidate(wsName);
+ tagProvider->tag_available_ = TagValidate(wsName);
WideString wsValue = pXMLElement->GetAttribute(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
@@ -302,8 +306,8 @@
return tagProvider;
}
if (pXMLNode->GetType() == CFX_XMLNode::Type::kText) {
- tagProvider->m_bTagAvailable = true;
- tagProvider->m_bContent = true;
+ tagProvider->tag_available_ = true;
+ tagProvider->content_ = true;
}
return tagProvider;
}
@@ -389,8 +393,8 @@
return wsValue.GetInteger();
while (pXMLNode) {
- auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
- if (it != m_mapXMLNodeToParseContext.end()) {
+ auto it = map_xmlnode_to_parse_context_.find(pXMLNode);
+ if (it != map_xmlnode_to_parse_context_.end()) {
Context* pContext = it->second.get();
if (pContext && pContext->GetParentStyle() &&
pContext->GetParentStyle()->GetCustomStyle(
@@ -537,8 +541,8 @@
CXFA_TextParser::Context* CXFA_TextParser::GetParseContextFromMap(
const CFX_XMLNode* pXMLNode) {
- auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
- return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr;
+ auto it = map_xmlnode_to_parse_context_.find(pXMLNode);
+ return it != map_xmlnode_to_parse_context_.end() ? it->second.get() : nullptr;
}
bool CXFA_TextParser::GetTabstops(const CFX_CSSComputedStyle* pStyle,
@@ -640,7 +644,7 @@
void CXFA_TextParser::Context::SetParentStyle(
RetainPtr<const CFX_CSSComputedStyle> style) {
- m_pParentStyle = std::move(style);
+ parent_style_ = std::move(style);
}
void CXFA_TextParser::Context::SetDecls(
diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h
index 651afe6..839cc7a 100644
--- a/xfa/fxfa/cxfa_textparser.h
+++ b/xfa/fxfa/cxfa_textparser.h
@@ -41,11 +41,11 @@
void SetParentStyle(RetainPtr<const CFX_CSSComputedStyle> style);
RetainPtr<const CFX_CSSComputedStyle> GetParentStyle() const {
- return m_pParentStyle;
+ return parent_style_;
}
- void SetDisplay(CFX_CSSDisplay eDisplay) { m_eDisplay = eDisplay; }
- CFX_CSSDisplay GetDisplay() const { return m_eDisplay; }
+ void SetDisplay(CFX_CSSDisplay eDisplay) { display_ = eDisplay; }
+ CFX_CSSDisplay GetDisplay() const { return display_; }
void SetDecls(std::vector<const CFX_CSSDeclaration*>&& decl);
const std::vector<const CFX_CSSDeclaration*>& GetDecls() const {
@@ -53,8 +53,8 @@
}
private:
- RetainPtr<const CFX_CSSComputedStyle> m_pParentStyle;
- CFX_CSSDisplay m_eDisplay = CFX_CSSDisplay::None;
+ RetainPtr<const CFX_CSSComputedStyle> parent_style_;
+ CFX_CSSDisplay display_ = CFX_CSSDisplay::None;
std::vector<const CFX_CSSDeclaration*> decls_;
};
@@ -73,7 +73,7 @@
const CFX_XMLNode* pXMLNode,
RetainPtr<const CFX_CSSComputedStyle> pParentStyle);
- bool IsParsed() const { return m_bParsed; }
+ bool IsParsed() const { return parsed_; }
XFA_AttributeValue GetVAlign(CXFA_TextProvider* pTextProvider) const;
@@ -126,23 +126,23 @@
TagProvider();
~TagProvider();
- WideString GetTagName() { return m_wsTagName; }
+ WideString GetTagName() { return tag_name_; }
- void SetTagName(const WideString& wsName) { m_wsTagName = wsName; }
+ void SetTagName(const WideString& wsName) { tag_name_ = wsName; }
void SetAttribute(const WideString& wsAttr, const WideString& wsValue) {
- m_Attributes.insert({wsAttr, wsValue});
+ attributes_.insert({wsAttr, wsValue});
}
WideString GetAttribute(const WideString& wsAttr) {
- return m_Attributes[wsAttr];
+ return attributes_[wsAttr];
}
- bool m_bTagAvailable = false;
- bool m_bContent = false;
+ bool tag_available_ = false;
+ bool content_ = false;
private:
- WideString m_wsTagName;
- std::map<WideString, WideString> m_Attributes;
+ WideString tag_name_;
+ std::map<WideString, WideString> attributes_;
};
// static
@@ -155,11 +155,11 @@
RetainPtr<CFX_CSSComputedStyle> CreateStyle(
const CFX_CSSComputedStyle* pParentStyle);
- bool m_bParsed = false;
- bool m_cssInitialized = false;
- std::unique_ptr<CFX_CSSStyleSelector> m_pSelector;
+ bool parsed_ = false;
+ bool css_initialized_ = false;
+ std::unique_ptr<CFX_CSSStyleSelector> selector_;
std::map<const CFX_XMLNode*, std::unique_ptr<Context>>
- m_mapXMLNodeToParseContext;
+ map_xmlnode_to_parse_context_;
};
#endif // XFA_FXFA_CXFA_TEXTPARSER_H_
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 41be55b..b0a0687 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -33,21 +33,21 @@
#include "xfa/fxfa/parser/xfa_utils.h"
CXFA_TextProvider::CXFA_TextProvider(CXFA_Node* pNode, Type eType)
- : m_pNode(pNode), m_eType(eType) {
- DCHECK(m_pNode);
+ : node_(pNode), type_(eType) {
+ DCHECK(node_);
}
CXFA_TextProvider::~CXFA_TextProvider() = default;
void CXFA_TextProvider::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pNode);
+ visitor->Trace(node_);
}
CXFA_Node* CXFA_TextProvider::GetTextNode(bool* bRichText) {
*bRichText = false;
- if (m_eType == Type::kText) {
+ if (type_ == Type::kText) {
CXFA_Value* pValueNode =
- m_pNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
+ node_->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
if (!pValueNode)
return nullptr;
@@ -64,9 +64,9 @@
return pChildNode;
}
- if (m_eType == Type::kCaption) {
+ if (type_ == Type::kCaption) {
CXFA_Caption* pCaptionNode =
- m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
+ node_->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
if (!pCaptionNode)
return nullptr;
@@ -89,18 +89,19 @@
}
CXFA_Items* pItemNode =
- m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
+ node_->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
if (!pItemNode)
return nullptr;
CXFA_Node* pNode = pItemNode->GetFirstChild();
while (pNode) {
WideString wsName = pNode->JSObject()->GetCData(XFA_Attribute::Name);
- if (m_eType == Type::kRollover && wsName.EqualsASCII("rollover")) {
+ if (type_ == Type::kRollover && wsName.EqualsASCII("rollover")) {
return pNode;
}
- if (m_eType == Type::kDown && wsName.EqualsASCII("down"))
+ if (type_ == Type::kDown && wsName.EqualsASCII("down")) {
return pNode;
+ }
pNode = pNode->GetNextSibling();
}
@@ -108,37 +109,41 @@
}
CXFA_Para* CXFA_TextProvider::GetParaIfExists() {
- if (m_eType == Type::kText)
- return m_pNode->GetParaIfExists();
+ if (type_ == Type::kText) {
+ return node_->GetParaIfExists();
+ }
CXFA_Caption* pNode =
- m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
+ node_->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
return pNode->GetChild<CXFA_Para>(0, XFA_Element::Para, false);
}
CXFA_Font* CXFA_TextProvider::GetFontIfExists() {
- if (m_eType == Type::kText)
- return m_pNode->GetFontIfExists();
+ if (type_ == Type::kText) {
+ return node_->GetFontIfExists();
+ }
CXFA_Caption* pNode =
- m_pNode->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
+ node_->GetChild<CXFA_Caption>(0, XFA_Element::Caption, false);
CXFA_Font* font = pNode->GetChild<CXFA_Font>(0, XFA_Element::Font, false);
- return font ? font : m_pNode->GetFontIfExists();
+ return font ? font : node_->GetFontIfExists();
}
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() const {
- if (m_pNode->GetFFWidgetType() != XFA_FFWidgetType::kCheckButton)
+ if (node_->GetFFWidgetType() != XFA_FFWidgetType::kCheckButton) {
return false;
- return !m_pNode->TryWidth().has_value();
+ }
+ return !node_->TryWidth().has_value();
}
std::optional<WideString> CXFA_TextProvider::GetEmbeddedObj(
const WideString& wsAttr) const {
- if (m_eType != Type::kText)
+ if (type_ != Type::kText) {
return std::nullopt;
+ }
- CXFA_Node* pParent = m_pNode->GetParent();
- CXFA_Document* pDocument = m_pNode->GetDocument();
+ CXFA_Node* pParent = node_->GetParent();
+ CXFA_Document* pDocument = node_->GetDocument();
CXFA_Node* pIDNode = nullptr;
if (pParent)
pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView());
diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h
index 414b24d..a998701 100644
--- a/xfa/fxfa/cxfa_textprovider.h
+++ b/xfa/fxfa/cxfa_textprovider.h
@@ -43,8 +43,8 @@
private:
CXFA_TextProvider(CXFA_Node* pNode, Type eType);
- cppgc::Member<CXFA_Node> m_pNode;
- const Type m_eType;
+ cppgc::Member<CXFA_Node> node_;
+ const Type type_;
};
#endif // XFA_FXFA_CXFA_TEXTPROVIDER_H_
diff --git a/xfa/fxfa/cxfa_texttabstopscontext.cpp b/xfa/fxfa/cxfa_texttabstopscontext.cpp
index 9590a26..9c3ec43 100644
--- a/xfa/fxfa/cxfa_texttabstopscontext.cpp
+++ b/xfa/fxfa/cxfa_texttabstopscontext.cpp
@@ -17,17 +17,17 @@
tabstop.dwAlign = dwAlign;
tabstop.fTabstops = fTabstops;
- auto it = std::lower_bound(m_tabstops.begin(), m_tabstops.end(), tabstop);
- m_tabstops.insert(it, tabstop);
+ auto it = std::lower_bound(tabstops_.begin(), tabstops_.end(), tabstop);
+ tabstops_.insert(it, tabstop);
}
void CXFA_TextTabstopsContext::RemoveAll() {
- m_tabstops.clear();
+ tabstops_.clear();
}
void CXFA_TextTabstopsContext::Reset() {
- m_iTabIndex = -1;
- m_bHasTabstops = false;
- m_fTabWidth = 0;
- m_fLeft = 0;
+ tab_index_ = -1;
+ has_tabstops_ = false;
+ tab_width_ = 0;
+ left_ = 0;
}
diff --git a/xfa/fxfa/cxfa_texttabstopscontext.h b/xfa/fxfa/cxfa_texttabstopscontext.h
index ae2f86c..1bbdbcc 100644
--- a/xfa/fxfa/cxfa_texttabstopscontext.h
+++ b/xfa/fxfa/cxfa_texttabstopscontext.h
@@ -29,11 +29,11 @@
void RemoveAll();
void Reset();
- int32_t m_iTabIndex = -1;
- bool m_bHasTabstops = false;
- float m_fTabWidth = 0.0f;
- float m_fLeft = 0.0f;
- std::vector<XFA_TABSTOPS> m_tabstops;
+ int32_t tab_index_ = -1;
+ bool has_tabstops_ = false;
+ float tab_width_ = 0.0f;
+ float left_ = 0.0f;
+ std::vector<XFA_TABSTOPS> tabstops_;
};
#endif // XFA_FXFA_CXFA_TEXTTABSTOPSCONTEXT_H_
diff --git a/xfa/fxfa/formcalc/cxfa_fmexpression.cpp b/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
index 09825e3..c85e3a8 100644
--- a/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmexpression.cpp
@@ -47,8 +47,8 @@
const size_t kBuiltInFuncsMaxLen = 12;
struct XFA_FMSOMMethod {
- const wchar_t* m_wsSomMethodName; // Ok, POD struct.
- uint32_t m_dParameters;
+ const wchar_t* som_method_name_; // Ok, POD struct.
+ uint32_t parameters_;
};
const XFA_FMSOMMethod kFMSomMethods[] = {
@@ -89,7 +89,7 @@
void CXFA_FMExpression::Trace(cppgc::Visitor* visitor) const {}
-CXFA_FMSimpleExpression::CXFA_FMSimpleExpression(XFA_FM_TOKEN op) : m_op(op) {}
+CXFA_FMSimpleExpression::CXFA_FMSimpleExpression(XFA_FM_TOKEN op) : op_(op) {}
CXFA_FMSimpleExpression::~CXFA_FMSimpleExpression() = default;
@@ -97,14 +97,14 @@
XFA_FM_TOKEN op,
CXFA_FMSimpleExpression* pExp1,
CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMSimpleExpression(op), m_pExp1(pExp1), m_pExp2(pExp2) {}
+ : CXFA_FMSimpleExpression(op), exp_1_(pExp1), exp_2_(pExp2) {}
CXFA_FMChainableExpression::~CXFA_FMChainableExpression() = default;
void CXFA_FMChainableExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMSimpleExpression::Trace(visitor);
- visitor->Trace(m_pExp1);
- visitor->Trace(m_pExp2);
+ visitor->Trace(exp_1_);
+ visitor->Trace(exp_2_);
}
CXFA_FMNullExpression::CXFA_FMNullExpression()
@@ -123,7 +123,7 @@
}
CXFA_FMNumberExpression::CXFA_FMNumberExpression(WideString wsNumber)
- : CXFA_FMSimpleExpression(TOKnumber), m_wsNumber(std::move(wsNumber)) {}
+ : CXFA_FMSimpleExpression(TOKnumber), number_(std::move(wsNumber)) {}
CXFA_FMNumberExpression::~CXFA_FMNumberExpression() = default;
@@ -133,12 +133,12 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- *js << m_wsNumber;
+ *js << number_;
return !CXFA_IsTooBig(*js);
}
CXFA_FMStringExpression::CXFA_FMStringExpression(WideString wsString)
- : CXFA_FMSimpleExpression(TOKstring), m_wsString(std::move(wsString)) {}
+ : CXFA_FMSimpleExpression(TOKstring), string_(std::move(wsString)) {}
CXFA_FMStringExpression::~CXFA_FMStringExpression() = default;
@@ -148,7 +148,7 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- WideString tempStr(m_wsString);
+ WideString tempStr(string_);
if (tempStr.GetLength() <= 2) {
*js << tempStr;
return !CXFA_IsTooBig(*js);
@@ -179,7 +179,7 @@
CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression(
WideString wsIdentifier)
: CXFA_FMSimpleExpression(TOKidentifier),
- m_wsIdentifier(std::move(wsIdentifier)) {}
+ identifier_(std::move(wsIdentifier)) {}
CXFA_FMIdentifierExpression::~CXFA_FMIdentifierExpression() = default;
@@ -189,26 +189,27 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- if (m_wsIdentifier.EqualsASCII("$"))
+ if (identifier_.EqualsASCII("$")) {
*js << "this";
- else if (m_wsIdentifier.EqualsASCII("!"))
+ } else if (identifier_.EqualsASCII("!")) {
*js << "xfa.datasets";
- else if (m_wsIdentifier.EqualsASCII("$data"))
+ } else if (identifier_.EqualsASCII("$data")) {
*js << "xfa.datasets.data";
- else if (m_wsIdentifier.EqualsASCII("$event"))
+ } else if (identifier_.EqualsASCII("$event")) {
*js << "xfa.event";
- else if (m_wsIdentifier.EqualsASCII("$form"))
+ } else if (identifier_.EqualsASCII("$form")) {
*js << "xfa.form";
- else if (m_wsIdentifier.EqualsASCII("$host"))
+ } else if (identifier_.EqualsASCII("$host")) {
*js << "xfa.host";
- else if (m_wsIdentifier.EqualsASCII("$layout"))
+ } else if (identifier_.EqualsASCII("$layout")) {
*js << "xfa.layout";
- else if (m_wsIdentifier.EqualsASCII("$template"))
+ } else if (identifier_.EqualsASCII("$template")) {
*js << "xfa.template";
- else if (m_wsIdentifier[0] == L'!')
- *js << "pfm__excl__" << m_wsIdentifier.Last(m_wsIdentifier.GetLength() - 1);
- else
- *js << m_wsIdentifier;
+ } else if (identifier_[0] == L'!') {
+ *js << "pfm__excl__" << identifier_.Last(identifier_.GetLength() - 1);
+ } else {
+ *js << identifier_;
+ }
return !CXFA_IsTooBig(*js);
}
@@ -259,7 +260,7 @@
XFA_FM_TOKEN op,
CXFA_FMSimpleExpression* pExp1,
CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMChainableExpression(op, pExp1, pExp2), m_OpName(opName) {}
+ : CXFA_FMChainableExpression(op, pExp1, pExp2), op_name_(opName) {}
CXFA_FMBinExpression::~CXFA_FMBinExpression() = default;
@@ -269,7 +270,7 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- *js << "pfm_rt." << m_OpName << "(";
+ *js << "pfm_rt." << op_name_ << "(";
if (!GetFirstExpression()->ToJavaScript(js, ReturnType::kInferred))
return false;
*js << ", ";
@@ -369,13 +370,13 @@
CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(const WideString& opName,
XFA_FM_TOKEN op,
CXFA_FMSimpleExpression* pExp)
- : CXFA_FMSimpleExpression(op), m_OpName(opName), m_pExp(pExp) {}
+ : CXFA_FMSimpleExpression(op), op_name_(opName), exp_(pExp) {}
CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() = default;
void CXFA_FMUnaryExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMSimpleExpression::Trace(visitor);
- visitor->Trace(m_pExp);
+ visitor->Trace(exp_);
}
bool CXFA_FMUnaryExpression::ToJavaScript(WideTextBuffer* js,
@@ -384,9 +385,10 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- *js << "pfm_rt." << m_OpName << "(";
- if (!m_pExp->ToJavaScript(js, ReturnType::kInferred))
+ *js << "pfm_rt." << op_name_ << "(";
+ if (!exp_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ")";
return !CXFA_IsTooBig(*js);
}
@@ -411,16 +413,16 @@
std::vector<cppgc::Member<CXFA_FMSimpleExpression>>&& pArguments,
bool bIsSomMethod)
: CXFA_FMSimpleExpression(TOKcall),
- m_pExp(pExp),
- m_Arguments(std::move(pArguments)),
- m_bIsSomMethod(bIsSomMethod) {}
+ exp_(pExp),
+ arguments_(std::move(pArguments)),
+ is_som_method_(bIsSomMethod) {}
CXFA_FMCallExpression::~CXFA_FMCallExpression() = default;
void CXFA_FMCallExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMSimpleExpression::Trace(visitor);
- visitor->Trace(m_pExp);
- ContainerTrace(visitor, m_Arguments);
+ visitor->Trace(exp_);
+ ContainerTrace(visitor, arguments_);
}
bool CXFA_FMCallExpression::IsBuiltInFunc(WideTextBuffer* funcName) const {
@@ -447,11 +449,11 @@
const XFA_FMSOMMethod* result = std::lower_bound(
std::begin(kFMSomMethods), std::end(kFMSomMethods), methodName,
[](const XFA_FMSOMMethod iter, const WideString& val) {
- return val.Compare(iter.m_wsSomMethodName) > 0;
+ return val.Compare(iter.som_method_name_) > 0;
});
if (result != std::end(kFMSomMethods) &&
- methodName == result->m_wsSomMethodName) {
- return result->m_dParameters;
+ methodName == result->som_method_name_) {
+ return result->parameters_;
}
return 0;
}
@@ -463,14 +465,15 @@
return false;
WideTextBuffer funcName;
- if (!m_pExp->ToJavaScript(&funcName, ReturnType::kInferred))
+ if (!exp_->ToJavaScript(&funcName, ReturnType::kInferred)) {
return false;
+ }
- if (m_bIsSomMethod) {
+ if (is_som_method_) {
*js << funcName << "(";
uint32_t methodPara = IsMethodWithObjParam(funcName.MakeString());
if (methodPara > 0) {
- for (size_t i = 0; i < m_Arguments.size(); ++i) {
+ for (size_t i = 0; i < arguments_.size(); ++i) {
// Currently none of our expressions use objects for a parameter over
// the 6th. Make sure we don't overflow the shift when doing this
// check. If we ever need more the 32 object params we can revisit.
@@ -481,20 +484,23 @@
*js << "val";
*js << "(";
- if (!m_Arguments[i]->ToJavaScript(js, ReturnType::kInferred))
+ if (!arguments_[i]->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ")";
- if (i + 1 < m_Arguments.size())
+ if (i + 1 < arguments_.size()) {
*js << ", ";
+ }
}
} else {
- for (const auto& expr : m_Arguments) {
+ for (const auto& expr : arguments_) {
*js << "pfm_rt.get_val(";
if (!expr->ToJavaScript(js, ReturnType::kInferred))
return false;
*js << ")";
- if (expr != m_Arguments.back())
+ if (expr != arguments_.back()) {
*js << ", ";
+ }
}
}
*js << ")";
@@ -524,10 +530,11 @@
*js << "(";
if (isExistsFunc) {
*js << "\n(\nfunction ()\n{\ntry\n{\n";
- if (!m_Arguments.empty()) {
+ if (!arguments_.empty()) {
*js << "return ";
- if (!m_Arguments[0]->ToJavaScript(js, ReturnType::kInferred))
+ if (!arguments_[0]->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ";\n}\n";
} else {
*js << "return 0;\n}\n";
@@ -535,11 +542,12 @@
*js << "catch(accessExceptions)\n";
*js << "{\nreturn 0;\n}\n}\n).call(this)\n";
} else {
- for (const auto& expr : m_Arguments) {
+ for (const auto& expr : arguments_) {
if (!expr->ToJavaScript(js, ReturnType::kInferred))
return false;
- if (expr != m_Arguments.back())
+ if (expr != arguments_.back()) {
*js << ", ";
+ }
}
}
*js << ")";
@@ -555,7 +563,7 @@
WideString wsIdentifier,
CXFA_FMSimpleExpression* pIndexExp)
: CXFA_FMChainableExpression(op, pAccessor, pIndexExp),
- m_wsIdentifier(std::move(wsIdentifier)) {}
+ identifier_(std::move(wsIdentifier)) {}
CXFA_FMDotAccessorExpression::~CXFA_FMDotAccessorExpression() = default;
@@ -585,13 +593,13 @@
}
*js << "\", ";
if (GetOperatorToken() == TOKdotscream)
- *js << "\"#" << m_wsIdentifier << "\", ";
+ *js << "\"#" << identifier_ << "\", ";
else if (GetOperatorToken() == TOKdotstar)
*js << "\"*\", ";
else if (GetOperatorToken() == TOKcall)
*js << "\"\", ";
else
- *js << "\"" << m_wsIdentifier << "\", ";
+ *js << "\"" << identifier_ << "\", ";
CXFA_FMSimpleExpression* exp2 = GetSecondExpression();
if (!exp2->ToJavaScript(js, ReturnType::kInferred))
@@ -606,15 +614,15 @@
CXFA_FMSimpleExpression* pIndexExp,
bool bIsStarIndex)
: CXFA_FMSimpleExpression(TOKlbracket),
- m_pExp(pIndexExp),
- m_accessorIndex(accessorIndex),
- m_bIsStarIndex(bIsStarIndex) {}
+ exp_(pIndexExp),
+ accessor_index_(accessorIndex),
+ is_star_index_(bIsStarIndex) {}
CXFA_FMIndexExpression::~CXFA_FMIndexExpression() = default;
void CXFA_FMIndexExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMSimpleExpression::Trace(visitor);
- visitor->Trace(m_pExp);
+ visitor->Trace(exp_);
}
bool CXFA_FMIndexExpression::ToJavaScript(WideTextBuffer* js,
@@ -623,7 +631,7 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- switch (m_accessorIndex) {
+ switch (accessor_index_) {
case AccessorIndex::kNoIndex:
*js << "0";
break;
@@ -637,13 +645,15 @@
*js << "3";
break;
}
- if (m_bIsStarIndex)
+ if (is_star_index_) {
return !CXFA_IsTooBig(*js);
+ }
*js << ", ";
- if (m_pExp) {
- if (!m_pExp->ToJavaScript(js, ReturnType::kInferred))
+ if (exp_) {
+ if (!exp_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
} else {
*js << "0";
}
@@ -656,7 +666,7 @@
WideString wsIdentifier,
CXFA_FMSimpleExpression* pIndexExp)
: CXFA_FMChainableExpression(op, pAccessor, pIndexExp),
- m_wsIdentifier(std::move(wsIdentifier)) {}
+ identifier_(std::move(wsIdentifier)) {}
CXFA_FMDotDotAccessorExpression::~CXFA_FMDotDotAccessorExpression() = default;
@@ -678,7 +688,7 @@
}
CXFA_FMSimpleExpression* exp2 = GetSecondExpression();
- *js << "\", \"" << m_wsIdentifier << "\", ";
+ *js << "\", \"" << identifier_ << "\", ";
if (!exp2->ToJavaScript(js, ReturnType::kInferred))
return false;
*js << ")";
@@ -718,17 +728,17 @@
WideString wsName,
std::vector<WideString>&& arguments,
std::vector<cppgc::Member<CXFA_FMExpression>>&& expressions)
- : m_wsName(std::move(wsName)),
- m_pArguments(std::move(arguments)),
- m_pExpressions(std::move(expressions)) {
- DCHECK(!m_wsName.IsEmpty());
+ : name_(std::move(wsName)),
+ arguments_(std::move(arguments)),
+ expressions_(std::move(expressions)) {
+ DCHECK(!name_.IsEmpty());
}
CXFA_FMFunctionDefinition::~CXFA_FMFunctionDefinition() = default;
void CXFA_FMFunctionDefinition::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- ContainerTrace(visitor, m_pExpressions);
+ ContainerTrace(visitor, expressions_);
}
bool CXFA_FMFunctionDefinition::ToJavaScript(WideTextBuffer* js,
@@ -737,22 +747,24 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- if (m_wsName.IsEmpty())
+ if (name_.IsEmpty()) {
return false;
+ }
- *js << "function " << IdentifierToName(m_wsName) << "(";
- for (const auto& identifier : m_pArguments) {
- if (identifier != m_pArguments.front())
+ *js << "function " << IdentifierToName(name_) << "(";
+ for (const auto& identifier : arguments_) {
+ if (identifier != arguments_.front()) {
*js << ", ";
+ }
*js << IdentifierToName(identifier);
}
*js << ") {\n";
*js << "var pfm_ret = null;\n";
- for (const auto& expr : m_pExpressions) {
- ReturnType ret_type = expr == m_pExpressions.back() ? ReturnType::kImplied
- : ReturnType::kInferred;
+ for (const auto& expr : expressions_) {
+ ReturnType ret_type = expr == expressions_.back() ? ReturnType::kImplied
+ : ReturnType::kInferred;
if (!expr->ToJavaScript(js, ret_type))
return false;
}
@@ -811,13 +823,13 @@
CXFA_FMVarExpression::CXFA_FMVarExpression(WideString wsName,
CXFA_FMSimpleExpression* pInit)
- : m_wsName(std::move(wsName)), m_pInit(pInit) {}
+ : name_(std::move(wsName)), init_(pInit) {}
CXFA_FMVarExpression::~CXFA_FMVarExpression() = default;
void CXFA_FMVarExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pInit);
+ visitor->Trace(init_);
}
bool CXFA_FMVarExpression::ToJavaScript(WideTextBuffer* js,
@@ -826,11 +838,12 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- WideString tempName = IdentifierToName(m_wsName);
+ WideString tempName = IdentifierToName(name_);
*js << "var " << tempName << " = ";
- if (m_pInit) {
- if (!m_pInit->ToJavaScript(js, ReturnType::kInferred))
+ if (init_) {
+ if (!init_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ";\n";
*js << tempName << " = pfm_rt.var_filter(" << tempName << ");\n";
@@ -845,13 +858,13 @@
}
CXFA_FMExpExpression::CXFA_FMExpExpression(CXFA_FMSimpleExpression* pExpression)
- : m_pExpression(pExpression) {}
+ : expression_(pExpression) {}
CXFA_FMExpExpression::~CXFA_FMExpExpression() = default;
void CXFA_FMExpExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pExpression);
+ visitor->Trace(expression_);
}
bool CXFA_FMExpExpression::ToJavaScript(WideTextBuffer* js,
@@ -861,32 +874,36 @@
return false;
if (type == ReturnType::kInferred) {
- bool ret = m_pExpression->ToJavaScript(js, ReturnType::kInferred);
- if (m_pExpression->GetOperatorToken() != TOKassign)
+ bool ret = expression_->ToJavaScript(js, ReturnType::kInferred);
+ if (expression_->GetOperatorToken() != TOKassign) {
*js << ";\n";
+ }
return ret;
}
- if (m_pExpression->GetOperatorToken() == TOKassign)
- return m_pExpression->ToJavaScript(js, ReturnType::kImplied);
+ if (expression_->GetOperatorToken() == TOKassign) {
+ return expression_->ToJavaScript(js, ReturnType::kImplied);
+ }
- if (m_pExpression->GetOperatorToken() == TOKstar ||
- m_pExpression->GetOperatorToken() == TOKdotstar ||
- m_pExpression->GetOperatorToken() == TOKdotscream ||
- m_pExpression->GetOperatorToken() == TOKdotdot ||
- m_pExpression->GetOperatorToken() == TOKdot) {
+ if (expression_->GetOperatorToken() == TOKstar ||
+ expression_->GetOperatorToken() == TOKdotstar ||
+ expression_->GetOperatorToken() == TOKdotscream ||
+ expression_->GetOperatorToken() == TOKdotdot ||
+ expression_->GetOperatorToken() == TOKdot) {
*js << "pfm_ret = pfm_rt.get_val(";
- if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
+ if (!expression_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ");\n";
return !CXFA_IsTooBig(*js);
}
*js << "pfm_ret = ";
- if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
+ if (!expression_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ";\n";
return !CXFA_IsTooBig(*js);
@@ -894,13 +911,13 @@
CXFA_FMBlockExpression::CXFA_FMBlockExpression(
std::vector<cppgc::Member<CXFA_FMExpression>>&& pExpressionList)
- : m_ExpressionList(std::move(pExpressionList)) {}
+ : expression_list_(std::move(pExpressionList)) {}
CXFA_FMBlockExpression::~CXFA_FMBlockExpression() = default;
void CXFA_FMBlockExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- ContainerTrace(visitor, m_ExpressionList);
+ ContainerTrace(visitor, expression_list_);
}
bool CXFA_FMBlockExpression::ToJavaScript(WideTextBuffer* js,
@@ -910,12 +927,12 @@
return false;
*js << "{\n";
- for (const auto& expr : m_ExpressionList) {
+ for (const auto& expr : expression_list_) {
if (type == ReturnType::kInferred) {
if (!expr->ToJavaScript(js, ReturnType::kInferred))
return false;
} else {
- ReturnType ret_type = expr == m_ExpressionList.back()
+ ReturnType ret_type = expr == expression_list_.back()
? ReturnType::kImplied
: ReturnType::kInferred;
if (!expr->ToJavaScript(js, ret_type))
@@ -928,13 +945,13 @@
}
CXFA_FMDoExpression::CXFA_FMDoExpression(CXFA_FMExpression* pList)
- : m_pList(pList) {}
+ : list_(pList) {}
CXFA_FMDoExpression::~CXFA_FMDoExpression() = default;
void CXFA_FMDoExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pList);
+ visitor->Trace(list_);
}
bool CXFA_FMDoExpression::ToJavaScript(WideTextBuffer* js,
@@ -943,7 +960,7 @@
if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
return false;
- return m_pList->ToJavaScript(js, type);
+ return list_->ToJavaScript(js, type);
}
CXFA_FMIfExpression::CXFA_FMIfExpression(
@@ -951,21 +968,21 @@
CXFA_FMExpression* pIfExpression,
std::vector<cppgc::Member<CXFA_FMIfExpression>>&& pElseIfExpressions,
CXFA_FMExpression* pElseExpression)
- : m_pExpression(pExpression),
- m_pIfExpression(pIfExpression),
- m_pElseIfExpressions(std::move(pElseIfExpressions)),
- m_pElseExpression(pElseExpression) {
- DCHECK(m_pExpression);
+ : expression_(pExpression),
+ if_expression_(pIfExpression),
+ else_if_expressions_(std::move(pElseIfExpressions)),
+ else_expression_(pElseExpression) {
+ DCHECK(expression_);
}
CXFA_FMIfExpression::~CXFA_FMIfExpression() = default;
void CXFA_FMIfExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pExpression);
- visitor->Trace(m_pIfExpression);
- ContainerTrace(visitor, m_pElseIfExpressions);
- visitor->Trace(m_pElseExpression);
+ visitor->Trace(expression_);
+ visitor->Trace(if_expression_);
+ ContainerTrace(visitor, else_if_expressions_);
+ visitor->Trace(else_expression_);
}
bool CXFA_FMIfExpression::ToJavaScript(WideTextBuffer* js,
@@ -978,30 +995,33 @@
*js << "pfm_ret = 0;\n";
*js << "if (pfm_rt.get_val(";
- if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
+ if (!expression_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << "))\n";
if (CXFA_IsTooBig(*js))
return false;
- if (m_pIfExpression) {
- if (!m_pIfExpression->ToJavaScript(js, type))
+ if (if_expression_) {
+ if (!if_expression_->ToJavaScript(js, type)) {
return false;
+ }
if (CXFA_IsTooBig(*js))
return false;
}
- for (auto& expr : m_pElseIfExpressions) {
+ for (auto& expr : else_if_expressions_) {
*js << "else ";
if (!expr->ToJavaScript(js, ReturnType::kInferred))
return false;
}
- if (m_pElseExpression) {
+ if (else_expression_) {
*js << "else ";
- if (!m_pElseExpression->ToJavaScript(js, type))
+ if (!else_expression_->ToJavaScript(js, type)) {
return false;
+ }
}
return !CXFA_IsTooBig(*js);
}
@@ -1009,14 +1029,14 @@
CXFA_FMWhileExpression::CXFA_FMWhileExpression(
CXFA_FMSimpleExpression* pCondition,
CXFA_FMExpression* pExpression)
- : m_pCondition(pCondition), m_pExpression(pExpression) {}
+ : condition_(pCondition), expression_(pExpression) {}
CXFA_FMWhileExpression::~CXFA_FMWhileExpression() = default;
void CXFA_FMWhileExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pCondition);
- visitor->Trace(m_pExpression);
+ visitor->Trace(condition_);
+ visitor->Trace(expression_);
}
bool CXFA_FMWhileExpression::ToJavaScript(WideTextBuffer* js,
@@ -1029,15 +1049,17 @@
*js << "pfm_ret = 0;\n";
*js << "while (";
- if (!m_pCondition->ToJavaScript(js, ReturnType::kInferred))
+ if (!condition_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ")\n";
if (CXFA_IsTooBig(*js))
return false;
- if (!m_pExpression->ToJavaScript(js, type))
+ if (!expression_->ToJavaScript(js, type)) {
return false;
+ }
return !CXFA_IsTooBig(*js);
}
@@ -1076,21 +1098,21 @@
int32_t iDirection,
CXFA_FMSimpleExpression* pStep,
CXFA_FMExpression* pList)
- : m_wsVariant(std::move(wsVariant)),
- m_bDirection(iDirection == 1),
- m_pAssignment(pAssignment),
- m_pAccessor(pAccessor),
- m_pStep(pStep),
- m_pList(pList) {}
+ : variant_(std::move(wsVariant)),
+ direction_(iDirection == 1),
+ assignment_(pAssignment),
+ accessor_(pAccessor),
+ step_(pStep),
+ list_(pList) {}
CXFA_FMForExpression::~CXFA_FMForExpression() = default;
void CXFA_FMForExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- visitor->Trace(m_pAssignment);
- visitor->Trace(m_pAccessor);
- visitor->Trace(m_pStep);
- visitor->Trace(m_pList);
+ visitor->Trace(assignment_);
+ visitor->Trace(accessor_);
+ visitor->Trace(step_);
+ visitor->Trace(list_);
}
bool CXFA_FMForExpression::ToJavaScript(WideTextBuffer* js,
@@ -1104,25 +1126,28 @@
*js << "{\n";
- WideString tmpName = IdentifierToName(m_wsVariant);
+ WideString tmpName = IdentifierToName(variant_);
*js << "var " << tmpName << " = null;\n";
*js << "for (" << tmpName << " = pfm_rt.get_val(";
- if (!m_pAssignment->ToJavaScript(js, ReturnType::kInferred))
+ if (!assignment_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << "); ";
- *js << tmpName << (m_bDirection ? kLessEqual : kGreaterEqual);
+ *js << tmpName << (direction_ ? kLessEqual : kGreaterEqual);
*js << "pfm_rt.get_val(";
- if (!m_pAccessor->ToJavaScript(js, ReturnType::kInferred))
+ if (!accessor_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << "); ";
- *js << tmpName << (m_bDirection ? kPlusEqual : kMinusEqual);
- if (m_pStep) {
+ *js << tmpName << (direction_ ? kPlusEqual : kMinusEqual);
+ if (step_) {
*js << "pfm_rt.get_val(";
- if (!m_pStep->ToJavaScript(js, ReturnType::kInferred))
+ if (!step_->ToJavaScript(js, ReturnType::kInferred)) {
return false;
+ }
*js << ")";
} else {
*js << "1";
@@ -1131,8 +1156,9 @@
if (CXFA_IsTooBig(*js))
return false;
- if (!m_pList->ToJavaScript(js, type))
+ if (!list_->ToJavaScript(js, type)) {
return false;
+ }
*js << "}\n";
return !CXFA_IsTooBig(*js);
@@ -1142,16 +1168,16 @@
WideString wsIdentifier,
std::vector<cppgc::Member<CXFA_FMSimpleExpression>>&& pAccessors,
CXFA_FMExpression* pList)
- : m_wsIdentifier(std::move(wsIdentifier)),
- m_pAccessors(std::move(pAccessors)),
- m_pList(pList) {}
+ : identifier_(std::move(wsIdentifier)),
+ accessors_(std::move(pAccessors)),
+ list_(pList) {}
CXFA_FMForeachExpression::~CXFA_FMForeachExpression() = default;
void CXFA_FMForeachExpression::Trace(cppgc::Visitor* visitor) const {
CXFA_FMExpression::Trace(visitor);
- ContainerTrace(visitor, m_pAccessors);
- visitor->Trace(m_pList);
+ ContainerTrace(visitor, accessors_);
+ visitor->Trace(list_);
}
bool CXFA_FMForeachExpression::ToJavaScript(WideTextBuffer* js,
@@ -1165,22 +1191,24 @@
*js << "{\n";
- WideString tmpName = IdentifierToName(m_wsIdentifier);
+ WideString tmpName = IdentifierToName(identifier_);
*js << "var " << tmpName << " = null;\n";
*js << "var pfm_ary = pfm_rt.concat_obj(";
- for (const auto& expr : m_pAccessors) {
+ for (const auto& expr : accessors_) {
if (!expr->ToJavaScript(js, ReturnType::kInferred))
return false;
- if (expr != m_pAccessors.back())
+ if (expr != accessors_.back()) {
*js << ", ";
+ }
}
*js << ");\n";
*js << "var pfm_ary_idx = 0;\n";
*js << "while(pfm_ary_idx < pfm_ary.length)\n{\n";
*js << tmpName << " = pfm_ary[pfm_ary_idx++];\n";
- if (!m_pList->ToJavaScript(js, type))
+ if (!list_->ToJavaScript(js, type)) {
return false;
+ }
*js << "}\n"; // while
*js << "}\n"; // block
diff --git a/xfa/fxfa/formcalc/cxfa_fmexpression.h b/xfa/fxfa/formcalc/cxfa_fmexpression.h
index f53da0b..a304c9c 100644
--- a/xfa/fxfa/formcalc/cxfa_fmexpression.h
+++ b/xfa/fxfa/formcalc/cxfa_fmexpression.h
@@ -34,13 +34,13 @@
public:
~CXFA_FMSimpleExpression() override;
- XFA_FM_TOKEN GetOperatorToken() const { return m_op; }
+ XFA_FM_TOKEN GetOperatorToken() const { return op_; }
protected:
explicit CXFA_FMSimpleExpression(XFA_FM_TOKEN op);
private:
- const XFA_FM_TOKEN m_op;
+ const XFA_FM_TOKEN op_;
};
class CXFA_FMChainableExpression : public CXFA_FMSimpleExpression {
@@ -53,12 +53,12 @@
CXFA_FMSimpleExpression* pExp1,
CXFA_FMSimpleExpression* pExp2);
- CXFA_FMSimpleExpression* GetFirstExpression() const { return m_pExp1; }
- CXFA_FMSimpleExpression* GetSecondExpression() const { return m_pExp2; }
+ CXFA_FMSimpleExpression* GetFirstExpression() const { return exp_1_; }
+ CXFA_FMSimpleExpression* GetSecondExpression() const { return exp_2_; }
private:
- cppgc::Member<CXFA_FMSimpleExpression> m_pExp1;
- cppgc::Member<CXFA_FMSimpleExpression> m_pExp2;
+ cppgc::Member<CXFA_FMSimpleExpression> exp_1_;
+ cppgc::Member<CXFA_FMSimpleExpression> exp_2_;
};
class CXFA_FMNullExpression final : public CXFA_FMSimpleExpression {
@@ -82,7 +82,7 @@
private:
explicit CXFA_FMNumberExpression(WideString wsNumber);
- WideString m_wsNumber;
+ WideString number_;
};
class CXFA_FMStringExpression final : public CXFA_FMSimpleExpression {
@@ -95,7 +95,7 @@
private:
explicit CXFA_FMStringExpression(WideString wsString);
- WideString m_wsString;
+ WideString string_;
};
class CXFA_FMIdentifierExpression final : public CXFA_FMSimpleExpression {
@@ -108,7 +108,7 @@
private:
explicit CXFA_FMIdentifierExpression(WideString wsIdentifier);
- WideString m_wsIdentifier;
+ WideString identifier_;
};
class CXFA_FMAssignExpression final : public CXFA_FMChainableExpression {
@@ -137,7 +137,7 @@
CXFA_FMSimpleExpression* pExp2);
private:
- WideString m_OpName;
+ WideString op_name_;
};
class CXFA_FMLogicalOrExpression final : public CXFA_FMBinExpression {
@@ -285,8 +285,8 @@
CXFA_FMSimpleExpression* pExp);
private:
- WideString m_OpName;
- cppgc::Member<CXFA_FMSimpleExpression> m_pExp;
+ WideString op_name_;
+ cppgc::Member<CXFA_FMSimpleExpression> exp_;
};
class CXFA_FMPosExpression final : public CXFA_FMUnaryExpression {
@@ -333,9 +333,9 @@
std::vector<cppgc::Member<CXFA_FMSimpleExpression>>&& pArguments,
bool bIsSomMethod);
- cppgc::Member<CXFA_FMSimpleExpression> m_pExp;
- std::vector<cppgc::Member<CXFA_FMSimpleExpression>> m_Arguments;
- bool m_bIsSomMethod;
+ cppgc::Member<CXFA_FMSimpleExpression> exp_;
+ std::vector<cppgc::Member<CXFA_FMSimpleExpression>> arguments_;
+ bool is_som_method_;
};
class CXFA_FMDotAccessorExpression final : public CXFA_FMChainableExpression {
@@ -351,7 +351,7 @@
WideString wsIdentifier,
CXFA_FMSimpleExpression* pIndexExp);
- WideString m_wsIdentifier;
+ WideString identifier_;
};
class CXFA_FMIndexExpression final : public CXFA_FMSimpleExpression {
@@ -374,9 +374,9 @@
CXFA_FMSimpleExpression* pIndexExp,
bool bIsStarIndex);
- cppgc::Member<CXFA_FMSimpleExpression> m_pExp;
- AccessorIndex m_accessorIndex;
- bool m_bIsStarIndex;
+ cppgc::Member<CXFA_FMSimpleExpression> exp_;
+ AccessorIndex accessor_index_;
+ bool is_star_index_;
};
class CXFA_FMDotDotAccessorExpression final
@@ -393,7 +393,7 @@
WideString wsIdentifier,
CXFA_FMSimpleExpression* pIndexExp);
- WideString m_wsIdentifier;
+ WideString identifier_;
};
class CXFA_FMMethodCallExpression final : public CXFA_FMChainableExpression {
@@ -422,9 +422,9 @@
std::vector<WideString>&& arguments,
std::vector<cppgc::Member<CXFA_FMExpression>>&& expressions);
- const WideString m_wsName;
- std::vector<WideString> const m_pArguments;
- std::vector<cppgc::Member<CXFA_FMExpression>> const m_pExpressions;
+ const WideString name_;
+ std::vector<WideString> const arguments_;
+ std::vector<cppgc::Member<CXFA_FMExpression>> const expressions_;
};
class CXFA_FMVarExpression final : public CXFA_FMExpression {
@@ -438,8 +438,8 @@
private:
CXFA_FMVarExpression(WideString wsName, CXFA_FMSimpleExpression* pInit);
- WideString const m_wsName;
- cppgc::Member<CXFA_FMSimpleExpression> const m_pInit;
+ WideString const name_;
+ cppgc::Member<CXFA_FMSimpleExpression> const init_;
};
class CXFA_FMExpExpression final : public CXFA_FMExpression {
@@ -453,7 +453,7 @@
private:
explicit CXFA_FMExpExpression(CXFA_FMSimpleExpression* pExpression);
- cppgc::Member<CXFA_FMSimpleExpression> const m_pExpression;
+ cppgc::Member<CXFA_FMSimpleExpression> const expression_;
};
class CXFA_FMBlockExpression final : public CXFA_FMExpression {
@@ -468,7 +468,7 @@
CXFA_FMBlockExpression(
std::vector<cppgc::Member<CXFA_FMExpression>>&& pExpressionList);
- std::vector<cppgc::Member<CXFA_FMExpression>> const m_ExpressionList;
+ std::vector<cppgc::Member<CXFA_FMExpression>> const expression_list_;
};
class CXFA_FMDoExpression final : public CXFA_FMExpression {
@@ -482,7 +482,7 @@
private:
explicit CXFA_FMDoExpression(CXFA_FMExpression* pList);
- cppgc::Member<CXFA_FMExpression> const m_pList;
+ cppgc::Member<CXFA_FMExpression> const list_;
};
class CXFA_FMIfExpression final : public CXFA_FMExpression {
@@ -500,10 +500,10 @@
std::vector<cppgc::Member<CXFA_FMIfExpression>>&& pElseIfExpressions,
CXFA_FMExpression* pElseExpression);
- cppgc::Member<CXFA_FMSimpleExpression> const m_pExpression;
- cppgc::Member<CXFA_FMExpression> const m_pIfExpression;
- std::vector<cppgc::Member<CXFA_FMIfExpression>> const m_pElseIfExpressions;
- cppgc::Member<CXFA_FMExpression> const m_pElseExpression;
+ cppgc::Member<CXFA_FMSimpleExpression> const expression_;
+ cppgc::Member<CXFA_FMExpression> const if_expression_;
+ std::vector<cppgc::Member<CXFA_FMIfExpression>> const else_if_expressions_;
+ cppgc::Member<CXFA_FMExpression> const else_expression_;
};
class CXFA_FMWhileExpression final : public CXFA_FMExpression {
@@ -518,8 +518,8 @@
CXFA_FMWhileExpression(CXFA_FMSimpleExpression* pCodition,
CXFA_FMExpression* pExpression);
- cppgc::Member<CXFA_FMSimpleExpression> const m_pCondition;
- cppgc::Member<CXFA_FMExpression> const m_pExpression;
+ cppgc::Member<CXFA_FMSimpleExpression> const condition_;
+ cppgc::Member<CXFA_FMExpression> const expression_;
};
class CXFA_FMBreakExpression final : public CXFA_FMExpression {
@@ -560,12 +560,12 @@
CXFA_FMSimpleExpression* pStep,
CXFA_FMExpression* pList);
- const WideString m_wsVariant;
- const bool m_bDirection;
- cppgc::Member<CXFA_FMSimpleExpression> const m_pAssignment;
- cppgc::Member<CXFA_FMSimpleExpression> const m_pAccessor;
- cppgc::Member<CXFA_FMSimpleExpression> const m_pStep;
- cppgc::Member<CXFA_FMExpression> const m_pList;
+ const WideString variant_;
+ const bool direction_;
+ cppgc::Member<CXFA_FMSimpleExpression> const assignment_;
+ cppgc::Member<CXFA_FMSimpleExpression> const accessor_;
+ cppgc::Member<CXFA_FMSimpleExpression> const step_;
+ cppgc::Member<CXFA_FMExpression> const list_;
};
class CXFA_FMForeachExpression final : public CXFA_FMExpression {
@@ -583,9 +583,9 @@
std::vector<cppgc::Member<CXFA_FMSimpleExpression>>&& pAccessors,
CXFA_FMExpression* pList);
- const WideString m_wsIdentifier;
- std::vector<cppgc::Member<CXFA_FMSimpleExpression>> const m_pAccessors;
- cppgc::Member<CXFA_FMExpression> const m_pList;
+ const WideString identifier_;
+ std::vector<cppgc::Member<CXFA_FMSimpleExpression>> const accessors_;
+ cppgc::Member<CXFA_FMExpression> const list_;
};
class CXFA_FMAST : public cppgc::GarbageCollected<CXFA_FMAST> {
diff --git a/xfa/fxfa/formcalc/cxfa_fmlexer.cpp b/xfa/fxfa/formcalc/cxfa_fmlexer.cpp
index 82a6e23..e83261d 100644
--- a/xfa/fxfa/formcalc/cxfa_fmlexer.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmlexer.cpp
@@ -38,8 +38,8 @@
}
struct XFA_FMKeyword {
- XFA_FM_TOKEN m_type;
- const char* m_keyword; // Raw, POD struct.
+ XFA_FM_TOKEN type_;
+ const char* keyword_; // Raw, POD struct.
};
const XFA_FMKeyword kKeyWords[] = {
@@ -86,10 +86,10 @@
const XFA_FMKeyword* result =
std::find_if(std::begin(kKeyWords), std::end(kKeyWords),
[str](const XFA_FMKeyword& iter) {
- return str.EqualsASCII(iter.m_keyword);
+ return str.EqualsASCII(iter.keyword_);
});
- if (result != std::end(kKeyWords) && str.EqualsASCII(result->m_keyword)) {
- return result->m_type;
+ if (result != std::end(kKeyWords) && str.EqualsASCII(result->keyword_)) {
+ return result->type_;
}
return TOKidentifier;
}
@@ -98,36 +98,37 @@
CXFA_FMLexer::Token::Token() = default;
-CXFA_FMLexer::Token::Token(XFA_FM_TOKEN token) : m_type(token) {}
+CXFA_FMLexer::Token::Token(XFA_FM_TOKEN token) : type_(token) {}
CXFA_FMLexer::Token::Token(XFA_FM_TOKEN token, WideStringView str)
- : m_type(token), m_string(str) {}
+ : type_(token), string_(str) {}
CXFA_FMLexer::Token::Token(const Token& that) = default;
CXFA_FMLexer::Token::~Token() = default;
CXFA_FMLexer::CXFA_FMLexer(WideStringView wsFormCalc)
- : m_spInput(wsFormCalc.span()) {}
+ : input_(wsFormCalc.span()) {}
CXFA_FMLexer::~CXFA_FMLexer() = default;
CXFA_FMLexer::Token CXFA_FMLexer::NextToken() {
- if (m_bLexerError)
+ if (lexer_error_) {
return Token();
+ }
- while (!IsComplete() && m_spInput[m_nCursor]) {
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ while (!IsComplete() && input_[cursor_]) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- switch (m_spInput[m_nCursor]) {
+ switch (input_[cursor_]) {
case '\n':
- ++m_nCursor;
+ ++cursor_;
break;
case '\r':
- ++m_nCursor;
+ ++cursor_;
break;
case ';':
AdvanceForComment();
@@ -146,129 +147,135 @@
case '9':
return AdvanceForNumber();
case '=':
- ++m_nCursor;
- if (m_nCursor >= m_spInput.size())
+ ++cursor_;
+ if (cursor_ >= input_.size()) {
return Token(TOKassign);
+ }
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (m_spInput[m_nCursor] == '=') {
- ++m_nCursor;
+ if (input_[cursor_] == '=') {
+ ++cursor_;
return Token(TOKeq);
}
return Token(TOKassign);
case '<':
- ++m_nCursor;
- if (m_nCursor >= m_spInput.size())
+ ++cursor_;
+ if (cursor_ >= input_.size()) {
return Token(TOKlt);
+ }
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (m_spInput[m_nCursor] == '=') {
- ++m_nCursor;
+ if (input_[cursor_] == '=') {
+ ++cursor_;
return Token(TOKle);
}
- if (m_spInput[m_nCursor] == '>') {
- ++m_nCursor;
+ if (input_[cursor_] == '>') {
+ ++cursor_;
return Token(TOKne);
}
return Token(TOKlt);
case '>':
- ++m_nCursor;
- if (m_nCursor >= m_spInput.size())
+ ++cursor_;
+ if (cursor_ >= input_.size()) {
return Token(TOKgt);
+ }
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (m_spInput[m_nCursor] == '=') {
- ++m_nCursor;
+ if (input_[cursor_] == '=') {
+ ++cursor_;
return Token(TOKge);
}
return Token(TOKgt);
case ',':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKcomma);
case '(':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKlparen);
case ')':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKrparen);
case '[':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKlbracket);
case ']':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKrbracket);
case '&':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKand);
case '|':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKor);
case '+':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKplus);
case '-':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKminus);
case '*':
- ++m_nCursor;
+ ++cursor_;
return Token(TOKmul);
case '/': {
- ++m_nCursor;
- if (m_nCursor >= m_spInput.size())
+ ++cursor_;
+ if (cursor_ >= input_.size()) {
return Token(TOKdiv);
+ }
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (m_spInput[m_nCursor] != '/')
+ if (input_[cursor_] != '/') {
return Token(TOKdiv);
+ }
AdvanceForComment();
break;
}
case '.':
- ++m_nCursor;
- if (m_nCursor >= m_spInput.size())
+ ++cursor_;
+ if (cursor_ >= input_.size()) {
return Token(TOKdot);
+ }
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (m_spInput[m_nCursor] == '.') {
- ++m_nCursor;
+ if (input_[cursor_] == '.') {
+ ++cursor_;
return Token(TOKdotdot);
}
- if (m_spInput[m_nCursor] == '*') {
- ++m_nCursor;
+ if (input_[cursor_] == '*') {
+ ++cursor_;
return Token(TOKdotstar);
}
- if (m_spInput[m_nCursor] == '#') {
- ++m_nCursor;
+ if (input_[cursor_] == '#') {
+ ++cursor_;
return Token(TOKdotscream);
}
- if (FXSYS_IsDecimalDigit(m_spInput[m_nCursor])) {
- --m_nCursor;
+ if (FXSYS_IsDecimalDigit(input_[cursor_])) {
+ --cursor_;
return AdvanceForNumber();
}
return Token(TOKdot);
default:
- if (IsWhitespaceCharacter(m_spInput[m_nCursor])) {
- ++m_nCursor;
+ if (IsWhitespaceCharacter(input_[cursor_])) {
+ ++cursor_;
break;
}
- if (!IsInitialIdentifierCharacter(m_spInput[m_nCursor])) {
+ if (!IsInitialIdentifierCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
@@ -281,46 +288,48 @@
CXFA_FMLexer::Token CXFA_FMLexer::AdvanceForNumber() {
// This will set end to the character after the end of the number.
size_t used_length = 0;
- if (m_nCursor < m_spInput.size()) {
- FXSYS_wcstof(WideStringView(m_spInput.subspan(m_nCursor)), &used_length);
+ if (cursor_ < input_.size()) {
+ FXSYS_wcstof(WideStringView(input_.subspan(cursor_)), &used_length);
}
- size_t end = m_nCursor + used_length;
+ size_t end = cursor_ + used_length;
if (used_length == 0 ||
- (end < m_spInput.size() && FXSYS_iswalpha(m_spInput[end]))) {
+ (end < input_.size() && FXSYS_iswalpha(input_[end]))) {
RaiseError();
return Token();
}
- WideStringView str(m_spInput.subspan(m_nCursor, end - m_nCursor));
- m_nCursor = end;
+ WideStringView str(input_.subspan(cursor_, end - cursor_));
+ cursor_ = end;
return Token(TOKnumber, str);
}
CXFA_FMLexer::Token CXFA_FMLexer::AdvanceForString() {
- size_t start = m_nCursor;
- ++m_nCursor;
- while (!IsComplete() && m_spInput[m_nCursor]) {
- if (!IsFormCalcCharacter(m_spInput[m_nCursor]))
+ size_t start = cursor_;
+ ++cursor_;
+ while (!IsComplete() && input_[cursor_]) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
break;
+ }
- if (m_spInput[m_nCursor] == '"') {
+ if (input_[cursor_] == '"') {
// Check for escaped "s, i.e. "".
- ++m_nCursor;
+ ++cursor_;
// If the end of the input has been reached it was not escaped.
- if (m_nCursor >= m_spInput.size()) {
- return Token(TOKstring, WideStringView(m_spInput.subspan(
- start, m_nCursor - start)));
+ if (cursor_ >= input_.size()) {
+ return Token(TOKstring,
+ WideStringView(input_.subspan(start, cursor_ - start)));
}
// If the next character is not a " then the end of the string has been
// found.
- if (m_spInput[m_nCursor] != '"') {
- if (!IsFormCalcCharacter(m_spInput[m_nCursor]))
+ if (input_[cursor_] != '"') {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
break;
+ }
- return Token(TOKstring, WideStringView(m_spInput.subspan(
- start, m_nCursor - start)));
+ return Token(TOKstring,
+ WideStringView(input_.subspan(start, cursor_ - start)));
}
}
- ++m_nCursor;
+ ++cursor_;
}
// Didn't find the end of the string.
@@ -329,38 +338,39 @@
}
CXFA_FMLexer::Token CXFA_FMLexer::AdvanceForIdentifier() {
- size_t start = m_nCursor;
- ++m_nCursor;
- while (!IsComplete() && m_spInput[m_nCursor]) {
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ size_t start = cursor_;
+ ++cursor_;
+ while (!IsComplete() && input_[cursor_]) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return Token();
}
- if (!IsIdentifierCharacter(m_spInput[m_nCursor]))
+ if (!IsIdentifierCharacter(input_[cursor_])) {
break;
+ }
- ++m_nCursor;
+ ++cursor_;
}
- WideStringView str(m_spInput.subspan(start, m_nCursor - start));
+ WideStringView str(input_.subspan(start, cursor_ - start));
return Token(TokenizeIdentifier(str), str);
}
void CXFA_FMLexer::AdvanceForComment() {
- ++m_nCursor;
- while (!IsComplete() && m_spInput[m_nCursor]) {
- if (!IsFormCalcCharacter(m_spInput[m_nCursor])) {
+ ++cursor_;
+ while (!IsComplete() && input_[cursor_]) {
+ if (!IsFormCalcCharacter(input_[cursor_])) {
RaiseError();
return;
}
- if (m_spInput[m_nCursor] == L'\r') {
- ++m_nCursor;
+ if (input_[cursor_] == L'\r') {
+ ++cursor_;
return;
}
- if (m_spInput[m_nCursor] == L'\n') {
- ++m_nCursor;
+ if (input_[cursor_] == L'\n') {
+ ++cursor_;
return;
}
- ++m_nCursor;
+ ++cursor_;
}
}
diff --git a/xfa/fxfa/formcalc/cxfa_fmlexer.h b/xfa/fxfa/formcalc/cxfa_fmlexer.h
index bf4314a..058efca 100644
--- a/xfa/fxfa/formcalc/cxfa_fmlexer.h
+++ b/xfa/fxfa/formcalc/cxfa_fmlexer.h
@@ -94,19 +94,19 @@
Token(const Token& that);
~Token();
- XFA_FM_TOKEN GetType() const { return m_type; }
- WideStringView GetString() const { return m_string; }
+ XFA_FM_TOKEN GetType() const { return type_; }
+ WideStringView GetString() const { return string_; }
private:
- XFA_FM_TOKEN m_type = TOKreserver;
- WideStringView m_string;
+ XFA_FM_TOKEN type_ = TOKreserver;
+ WideStringView string_;
};
explicit CXFA_FMLexer(WideStringView wsFormcalc);
~CXFA_FMLexer();
Token NextToken();
- bool IsComplete() const { return m_nCursor >= m_spInput.size(); }
+ bool IsComplete() const { return cursor_ >= input_.size(); }
private:
Token AdvanceForNumber();
@@ -114,11 +114,11 @@
Token AdvanceForIdentifier();
void AdvanceForComment();
- void RaiseError() { m_bLexerError = true; }
+ void RaiseError() { lexer_error_ = true; }
- pdfium::raw_span<const wchar_t> m_spInput;
- size_t m_nCursor = 0;
- bool m_bLexerError = false;
+ pdfium::raw_span<const wchar_t> input_;
+ size_t cursor_ = 0;
+ bool lexer_error_ = false;
};
#endif // XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
diff --git a/xfa/fxfa/formcalc/cxfa_fmparser.cpp b/xfa/fxfa/formcalc/cxfa_fmparser.cpp
index cc8e7fc..a7bb0f5 100644
--- a/xfa/fxfa/formcalc/cxfa_fmparser.cpp
+++ b/xfa/fxfa/formcalc/cxfa_fmparser.cpp
@@ -21,12 +21,12 @@
} // namespace
CXFA_FMParser::CXFA_FMParser(cppgc::Heap* pHeap, CXFA_FMLexer* pLexer)
- : m_heap(pHeap), m_lexer(pLexer), m_max_parse_depth(kMaxParseDepth) {}
+ : heap_(pHeap), lexer_(pLexer), max_parse_depth_(kMaxParseDepth) {}
CXFA_FMParser::~CXFA_FMParser() = default;
CXFA_FMAST* CXFA_FMParser::Parse() {
- m_token = m_lexer->NextToken();
+ token_ = lexer_->NextToken();
if (HasError())
return nullptr;
@@ -35,10 +35,11 @@
return nullptr;
// We failed to parse all of the input so something has gone wrong.
- if (!m_lexer->IsComplete())
+ if (!lexer_->IsComplete()) {
return nullptr;
+ }
- return cppgc::MakeGarbageCollected<CXFA_FMAST>(m_heap->GetAllocationHandle(),
+ return cppgc::MakeGarbageCollected<CXFA_FMAST>(heap_->GetAllocationHandle(),
std::move(expressions));
}
@@ -46,9 +47,10 @@
if (HasError())
return false;
- m_token = m_lexer->NextToken();
- while (!HasError() && m_token.GetType() == TOKreserver)
- m_token = m_lexer->NextToken();
+ token_ = lexer_->NextToken();
+ while (!HasError() && token_.GetType() == TOKreserver) {
+ token_ = lexer_->NextToken();
+ }
return !HasError();
}
@@ -56,41 +58,41 @@
if (HasError())
return false;
- if (m_token.GetType() != op) {
- m_error = true;
+ if (token_.GetType() != op) {
+ error_ = true;
return false;
}
return NextToken();
}
bool CXFA_FMParser::IncrementParseDepthAndCheck() {
- return ++m_parse_depth < m_max_parse_depth;
+ return ++parse_depth_ < max_parse_depth_;
}
std::vector<cppgc::Member<CXFA_FMExpression>>
CXFA_FMParser::ParseExpressionList() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return std::vector<cppgc::Member<CXFA_FMExpression>>();
std::vector<cppgc::Member<CXFA_FMExpression>> expressions;
while (!HasError()) {
- if (m_token.GetType() == TOKeof || m_token.GetType() == TOKendfunc ||
- m_token.GetType() == TOKendif || m_token.GetType() == TOKelseif ||
- m_token.GetType() == TOKelse || m_token.GetType() == TOKendwhile ||
- m_token.GetType() == TOKendfor || m_token.GetType() == TOKend ||
- m_token.GetType() == TOKendfunc || m_token.GetType() == TOKreserver) {
+ if (token_.GetType() == TOKeof || token_.GetType() == TOKendfunc ||
+ token_.GetType() == TOKendif || token_.GetType() == TOKelseif ||
+ token_.GetType() == TOKelse || token_.GetType() == TOKendwhile ||
+ token_.GetType() == TOKendfor || token_.GetType() == TOKend ||
+ token_.GetType() == TOKendfunc || token_.GetType() == TOKreserver) {
break;
}
CXFA_FMExpression* expr =
- m_token.GetType() == TOKfunc ? ParseFunction() : ParseExpression();
+ token_.GetType() == TOKfunc ? ParseFunction() : ParseExpression();
if (!expr) {
- m_error = true;
+ error_ = true;
return std::vector<cppgc::Member<CXFA_FMExpression>>();
}
if (expressions.size() >= kMaxExpressionListSize) {
- m_error = true;
+ error_ = true;
return std::vector<cppgc::Member<CXFA_FMExpression>>();
}
expressions.push_back(expr);
@@ -102,15 +104,16 @@
// ParamterList := (Not actually defined in the grammar) .....
// (Identifier (',' Identifier)*)?
CXFA_FMExpression* CXFA_FMParser::ParseFunction() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKfunc))
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString ident(m_token.GetString());
+ WideString ident(token_.GetString());
if (!NextToken())
return nullptr;
if (!CheckThenNext(TOKlparen))
@@ -119,18 +122,21 @@
std::vector<WideString> arguments;
bool last_was_comma = false;
while (true) {
- if (m_token.GetType() == TOKrparen)
+ if (token_.GetType() == TOKrparen) {
break;
- if (m_token.GetType() != TOKidentifier)
+ }
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
last_was_comma = false;
- arguments.emplace_back(m_token.GetString());
+ arguments.emplace_back(token_.GetString());
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKcomma)
+ if (token_.GetType() != TOKcomma) {
continue;
+ }
last_was_comma = true;
if (!NextToken())
@@ -142,14 +148,15 @@
return nullptr;
std::vector<cppgc::Member<CXFA_FMExpression>> expressions;
- if (m_token.GetType() != TOKendfunc)
+ if (token_.GetType() != TOKendfunc) {
expressions = ParseExpressionList();
+ }
if (!CheckThenNext(TOKendfunc))
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMFunctionDefinition>(
- m_heap->GetAllocationHandle(), std::move(ident), std::move(arguments),
+ heap_->GetAllocationHandle(), std::move(ident), std::move(arguments),
std::move(expressions));
}
@@ -157,12 +164,12 @@
// ForEachExpression | AssignmentExpression |
// DeclarationExpression | SimpleExpression
CXFA_FMExpression* CXFA_FMParser::ParseExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
CXFA_FMExpression* expr = nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKvar:
expr = ParseDeclarationExpression();
break;
@@ -193,13 +200,13 @@
break;
case TOKbreak:
expr = cppgc::MakeGarbageCollected<CXFA_FMBreakExpression>(
- m_heap->GetAllocationHandle());
+ heap_->GetAllocationHandle());
if (!NextToken())
return nullptr;
break;
case TOKcontinue:
expr = cppgc::MakeGarbageCollected<CXFA_FMContinueExpression>(
- m_heap->GetAllocationHandle());
+ heap_->GetAllocationHandle());
if (!NextToken())
return nullptr;
break;
@@ -213,19 +220,20 @@
// 'Func' Identifier '(' ParameterList ')' do ExpressionList 'EndFunc'
// TODO(dsinclair): We appear to be handling the 'func' case elsewhere.
CXFA_FMExpression* CXFA_FMParser::ParseDeclarationExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
- if (!NextToken() || m_token.GetType() != TOKidentifier)
+ if (!NextToken() || token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString ident(m_token.GetString());
+ WideString ident(token_.GetString());
if (!NextToken())
return nullptr;
CXFA_FMSimpleExpression* expr = nullptr;
- if (m_token.GetType() == TOKassign) {
+ if (token_.GetType() == TOKassign) {
if (!NextToken())
return nullptr;
@@ -235,7 +243,7 @@
}
return cppgc::MakeGarbageCollected<CXFA_FMVarExpression>(
- m_heap->GetAllocationHandle(), std::move(ident), expr);
+ heap_->GetAllocationHandle(), std::move(ident), expr);
}
// SimpleExpression := LogicalOrExpression
@@ -248,7 +256,7 @@
// Exp := SimpleExpression ( '=' SimpleExpression )?
CXFA_FMExpression* CXFA_FMParser::ParseExpExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -256,7 +264,7 @@
if (!pExp1)
return nullptr;
- if (m_token.GetType() == TOKassign) {
+ if (token_.GetType() == TOKassign) {
if (!NextToken())
return nullptr;
@@ -265,16 +273,16 @@
return nullptr;
pExp1 = cppgc::MakeGarbageCollected<CXFA_FMAssignExpression>(
- m_heap->GetAllocationHandle(), TOKassign, pExp1, pExp2);
+ heap_->GetAllocationHandle(), TOKassign, pExp1, pExp2);
}
return cppgc::MakeGarbageCollected<CXFA_FMExpExpression>(
- m_heap->GetAllocationHandle(), pExp1);
+ heap_->GetAllocationHandle(), pExp1);
}
// LogicalOr := LogicalAndExpression |
// LogicalOrExpression LogicalOrOperator LogicalAndExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseLogicalOrExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -286,7 +294,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKor:
case TOKksor: {
if (!NextToken())
@@ -295,7 +303,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMLogicalOrExpression>(
- m_heap->GetAllocationHandle(), TOKor, e1, e2);
+ heap_->GetAllocationHandle(), TOKor, e1, e2);
break;
}
default:
@@ -307,7 +315,7 @@
// LogicalAnd := EqualityExpression |
// LogicalAndExpression LogicalAndOperator EqualityExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseLogicalAndExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -319,7 +327,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKand:
case TOKksand: {
if (!NextToken())
@@ -328,7 +336,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMLogicalAndExpression>(
- m_heap->GetAllocationHandle(), TOKand, e1, e2);
+ heap_->GetAllocationHandle(), TOKand, e1, e2);
break;
}
default:
@@ -340,7 +348,7 @@
// Equality := RelationExpression |
// EqualityExpression EqulaityOperator RelationalExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseEqualityExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -352,7 +360,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKeq:
case TOKkseq: {
if (!NextToken())
@@ -361,7 +369,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMEqualExpression>(
- m_heap->GetAllocationHandle(), TOKeq, e1, e2);
+ heap_->GetAllocationHandle(), TOKeq, e1, e2);
break;
}
case TOKne:
@@ -372,7 +380,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMNotEqualExpression>(
- m_heap->GetAllocationHandle(), TOKne, e1, e2);
+ heap_->GetAllocationHandle(), TOKne, e1, e2);
break;
}
default:
@@ -384,7 +392,7 @@
// Relational := AdditiveExpression |
// RelationalExpression RelationalOperator AdditiveExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseRelationalExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -396,7 +404,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKlt:
case TOKkslt: {
if (!NextToken())
@@ -405,7 +413,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMLtExpression>(
- m_heap->GetAllocationHandle(), TOKlt, e1, e2);
+ heap_->GetAllocationHandle(), TOKlt, e1, e2);
break;
}
case TOKgt:
@@ -416,7 +424,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMGtExpression>(
- m_heap->GetAllocationHandle(), TOKgt, e1, e2);
+ heap_->GetAllocationHandle(), TOKgt, e1, e2);
break;
}
case TOKle:
@@ -427,7 +435,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMLeExpression>(
- m_heap->GetAllocationHandle(), TOKle, e1, e2);
+ heap_->GetAllocationHandle(), TOKle, e1, e2);
break;
}
case TOKge:
@@ -438,7 +446,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMGeExpression>(
- m_heap->GetAllocationHandle(), TOKge, e1, e2);
+ heap_->GetAllocationHandle(), TOKge, e1, e2);
break;
}
default:
@@ -450,7 +458,7 @@
// Additive := MultiplicativeExpression |
// AdditiveExpression AdditiveOperator MultiplicativeExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseAdditiveExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -462,7 +470,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKplus: {
if (!NextToken())
return nullptr;
@@ -470,7 +478,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMPlusExpression>(
- m_heap->GetAllocationHandle(), TOKplus, e1, e2);
+ heap_->GetAllocationHandle(), TOKplus, e1, e2);
break;
}
case TOKminus: {
@@ -480,7 +488,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMMinusExpression>(
- m_heap->GetAllocationHandle(), TOKminus, e1, e2);
+ heap_->GetAllocationHandle(), TOKminus, e1, e2);
break;
}
default:
@@ -492,7 +500,7 @@
// Multiplicative := UnaryExpression |
// MultiplicateExpression MultiplicativeOperator UnaryExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseMultiplicativeExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -504,7 +512,7 @@
if (!IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKmul: {
if (!NextToken())
return nullptr;
@@ -512,7 +520,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMMulExpression>(
- m_heap->GetAllocationHandle(), TOKmul, e1, e2);
+ heap_->GetAllocationHandle(), TOKmul, e1, e2);
break;
}
case TOKdiv: {
@@ -522,7 +530,7 @@
if (!e2)
return nullptr;
e1 = cppgc::MakeGarbageCollected<CXFA_FMDivExpression>(
- m_heap->GetAllocationHandle(), TOKdiv, e1, e2);
+ heap_->GetAllocationHandle(), TOKdiv, e1, e2);
break;
}
default:
@@ -533,11 +541,11 @@
// Unary := PrimaryExpression | UnaryOperator UnaryExpression
CXFA_FMSimpleExpression* CXFA_FMParser::ParseUnaryExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKplus: {
if (!NextToken())
return nullptr;
@@ -545,7 +553,7 @@
if (!expr)
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMPosExpression>(
- m_heap->GetAllocationHandle(), expr);
+ heap_->GetAllocationHandle(), expr);
}
case TOKminus: {
if (!NextToken())
@@ -554,7 +562,7 @@
if (!expr)
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMNegExpression>(
- m_heap->GetAllocationHandle(), expr);
+ heap_->GetAllocationHandle(), expr);
}
case TOKksnot: {
if (!NextToken())
@@ -563,7 +571,7 @@
if (!expr)
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMNotExpression>(
- m_heap->GetAllocationHandle(), expr);
+ heap_->GetAllocationHandle(), expr);
}
default:
return ParsePrimaryExpression();
@@ -573,7 +581,7 @@
// Primary := Literal | FunctionCall | Accessor ('.*' )? |
// '(' SimpleExpression ')'
CXFA_FMSimpleExpression* CXFA_FMParser::ParsePrimaryExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -581,17 +589,17 @@
if (expr)
return NextToken() ? expr : nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKidentifier: {
- WideString wsIdentifier(m_token.GetString());
+ WideString wsIdentifier(token_.GetString());
if (!NextToken())
return nullptr;
- if (m_token.GetType() == TOKlbracket) {
+ if (token_.GetType() == TOKlbracket) {
CXFA_FMSimpleExpression* s = ParseIndexExpression();
if (!s)
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), nullptr, TOKdot,
+ heap_->GetAllocationHandle(), nullptr, TOKdot,
std::move(wsIdentifier), s);
if (!expr)
return nullptr;
@@ -599,7 +607,7 @@
return nullptr;
} else {
expr = cppgc::MakeGarbageCollected<CXFA_FMIdentifierExpression>(
- m_heap->GetAllocationHandle(), wsIdentifier);
+ heap_->GetAllocationHandle(), wsIdentifier);
}
break;
}
@@ -617,16 +625,16 @@
// Literal := String | Number | Null
CXFA_FMSimpleExpression* CXFA_FMParser::ParseLiteral() {
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKnumber:
return cppgc::MakeGarbageCollected<CXFA_FMNumberExpression>(
- m_heap->GetAllocationHandle(), WideString(m_token.GetString()));
+ heap_->GetAllocationHandle(), WideString(token_.GetString()));
case TOKstring:
return cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
- m_heap->GetAllocationHandle(), WideString(m_token.GetString()));
+ heap_->GetAllocationHandle(), WideString(token_.GetString()));
case TOKnull:
return cppgc::MakeGarbageCollected<CXFA_FMNullExpression>(
- m_heap->GetAllocationHandle());
+ heap_->GetAllocationHandle());
default:
return nullptr;
}
@@ -636,7 +644,7 @@
// I believe this is parsing the accessor ( '.' | '..' | '.#' )
CXFA_FMSimpleExpression* CXFA_FMParser::ParsePostExpression(
CXFA_FMSimpleExpression* expr) {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -649,7 +657,7 @@
if (expr_count > kMaxPostExpressions)
return nullptr;
- switch (m_token.GetType()) {
+ switch (token_.GetType()) {
case TOKlparen: {
std::optional<std::vector<cppgc::Member<CXFA_FMSimpleExpression>>>
expressions = ParseArgumentList();
@@ -657,31 +665,33 @@
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMCallExpression>(
- m_heap->GetAllocationHandle(), expr, std::move(expressions.value()),
+ heap_->GetAllocationHandle(), expr, std::move(expressions.value()),
false);
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKlbracket)
+ if (token_.GetType() != TOKlbracket) {
continue;
+ }
CXFA_FMSimpleExpression* s = ParseIndexExpression();
if (!s)
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKcall, WideString(), s);
+ heap_->GetAllocationHandle(), expr, TOKcall, WideString(), s);
break;
}
case TOKdot: {
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString tempStr(m_token.GetString());
+ WideString tempStr(token_.GetString());
if (!NextToken())
return nullptr;
- if (m_token.GetType() == TOKlparen) {
+ if (token_.GetType() == TOKlparen) {
std::optional<std::vector<cppgc::Member<CXFA_FMSimpleExpression>>>
expressions = ParseArgumentList();
if (!expressions.has_value())
@@ -689,37 +699,38 @@
auto* pIdentifier =
cppgc::MakeGarbageCollected<CXFA_FMIdentifierExpression>(
- m_heap->GetAllocationHandle(), std::move(tempStr));
+ heap_->GetAllocationHandle(), std::move(tempStr));
auto* pExpCall = cppgc::MakeGarbageCollected<CXFA_FMCallExpression>(
- m_heap->GetAllocationHandle(), pIdentifier,
+ heap_->GetAllocationHandle(), pIdentifier,
std::move(expressions.value()), true);
expr = cppgc::MakeGarbageCollected<CXFA_FMMethodCallExpression>(
- m_heap->GetAllocationHandle(), expr, pExpCall);
+ heap_->GetAllocationHandle(), expr, pExpCall);
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKlbracket)
+ if (token_.GetType() != TOKlbracket) {
continue;
+ }
CXFA_FMSimpleExpression* s = ParseIndexExpression();
if (!s)
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKcall, WideString(), s);
- } else if (m_token.GetType() == TOKlbracket) {
+ heap_->GetAllocationHandle(), expr, TOKcall, WideString(), s);
+ } else if (token_.GetType() == TOKlbracket) {
CXFA_FMSimpleExpression* s = ParseIndexExpression();
if (!s)
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
+ heap_->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
s);
} else {
auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
+ heap_->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
subexpr);
continue;
}
@@ -728,27 +739,28 @@
case TOKdotdot: {
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString tempStr(m_token.GetString());
+ WideString tempStr(token_.GetString());
if (!NextToken())
return nullptr;
- if (m_token.GetType() == TOKlbracket) {
+ if (token_.GetType() == TOKlbracket) {
CXFA_FMSimpleExpression* s = ParseIndexExpression();
if (!s)
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdotdot,
- std::move(tempStr), s);
+ heap_->GetAllocationHandle(), expr, TOKdotdot, std::move(tempStr),
+ s);
} else {
auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
expr = cppgc::MakeGarbageCollected<CXFA_FMDotDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdotdot,
- std::move(tempStr), subexpr);
+ heap_->GetAllocationHandle(), expr, TOKdotdot, std::move(tempStr),
+ subexpr);
continue;
}
break;
@@ -756,19 +768,20 @@
case TOKdotscream: {
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString tempStr(m_token.GetString());
+ WideString tempStr(token_.GetString());
if (!NextToken())
return nullptr;
- if (m_token.GetType() != TOKlbracket) {
+ if (token_.GetType() != TOKlbracket) {
auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdotscream,
+ heap_->GetAllocationHandle(), expr, TOKdotscream,
std::move(tempStr), subexpr);
continue;
}
@@ -778,16 +791,16 @@
return nullptr;
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdotscream,
+ heap_->GetAllocationHandle(), expr, TOKdotscream,
std::move(tempStr), s);
break;
}
case TOKdotstar: {
auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
- m_heap->GetAllocationHandle(), expr, TOKdotstar, L"*", subexpr);
+ heap_->GetAllocationHandle(), expr, TOKdotstar, L"*", subexpr);
break;
}
default:
@@ -802,17 +815,19 @@
// between '(' and ')'
std::optional<std::vector<cppgc::Member<CXFA_FMSimpleExpression>>>
CXFA_FMParser::ParseArgumentList() {
- if (m_token.GetType() != TOKlparen || !NextToken())
+ if (token_.GetType() != TOKlparen || !NextToken()) {
return std::nullopt;
+ }
std::vector<cppgc::Member<CXFA_FMSimpleExpression>> expressions;
bool first_arg = true;
- while (m_token.GetType() != TOKrparen) {
+ while (token_.GetType() != TOKrparen) {
if (first_arg) {
first_arg = false;
} else {
- if (m_token.GetType() != TOKcomma || !NextToken())
+ if (token_.GetType() != TOKcomma || !NextToken()) {
return std::nullopt;
+ }
}
CXFA_FMSimpleExpression* exp = ParseSimpleExpression();
@@ -829,33 +844,34 @@
// Index := '[' ('*' | '+' SimpleExpression | '-' SimpleExpression) ']'
CXFA_FMSimpleExpression* CXFA_FMParser::ParseIndexExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKlbracket))
return nullptr;
- if (m_token.GetType() == TOKmul) {
+ if (token_.GetType() == TOKmul) {
auto* pExp = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
CXFA_FMIndexExpression::AccessorIndex::kNoRelativeIndex, nullptr, true);
if (!pExp || !NextToken())
return nullptr;
// TODO(dsinclair): This should CheckThenNext(TOKrbracket) but need to clean
// up the callsites.
- if (m_token.GetType() != TOKrbracket)
+ if (token_.GetType() != TOKrbracket) {
return nullptr;
+ }
return pExp;
}
CXFA_FMIndexExpression::AccessorIndex accessorIndex =
CXFA_FMIndexExpression::AccessorIndex::kNoRelativeIndex;
- if (m_token.GetType() == TOKplus) {
+ if (token_.GetType() == TOKplus) {
accessorIndex = CXFA_FMIndexExpression::AccessorIndex::kPositiveIndex;
if (!NextToken())
return nullptr;
- } else if (m_token.GetType() == TOKminus) {
+ } else if (token_.GetType() == TOKminus) {
accessorIndex = CXFA_FMIndexExpression::AccessorIndex::kNegativeIndex;
if (!NextToken())
return nullptr;
@@ -864,23 +880,25 @@
CXFA_FMSimpleExpression* s = ParseSimpleExpression();
if (!s)
return nullptr;
- if (m_token.GetType() != TOKrbracket)
+ if (token_.GetType() != TOKrbracket) {
return nullptr;
+ }
return cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
- m_heap->GetAllocationHandle(), accessorIndex, s, false);
+ heap_->GetAllocationHandle(), accessorIndex, s, false);
}
// Paren := '(' SimpleExpression ')'
CXFA_FMSimpleExpression* CXFA_FMParser::ParseParenExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKlparen))
return nullptr;
- if (m_token.GetType() == TOKrparen)
+ if (token_.GetType() == TOKrparen) {
return nullptr;
+ }
CXFA_FMSimpleExpression* pExp1 = ParseSimpleExpression();
if (!pExp1)
@@ -896,7 +914,7 @@
// ('else' ExpressionList)?
// 'endif'
CXFA_FMExpression* CXFA_FMParser::ParseIfExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
@@ -910,10 +928,10 @@
return nullptr;
auto* pIfExpressions = cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), ParseExpressionList());
+ heap_->GetAllocationHandle(), ParseExpressionList());
std::vector<cppgc::Member<CXFA_FMIfExpression>> pElseIfExpressions;
- while (m_token.GetType() == TOKelseif) {
+ while (token_.GetType() == TOKelseif) {
if (!NextToken())
return nullptr;
@@ -926,31 +944,31 @@
auto elseIfExprs = ParseExpressionList();
pElseIfExpressions.push_back(
cppgc::MakeGarbageCollected<CXFA_FMIfExpression>(
- m_heap->GetAllocationHandle(), elseIfCondition,
+ heap_->GetAllocationHandle(), elseIfCondition,
cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), std::move(elseIfExprs)),
+ heap_->GetAllocationHandle(), std::move(elseIfExprs)),
std::vector<cppgc::Member<CXFA_FMIfExpression>>(), nullptr));
}
CXFA_FMExpression* pElseExpression = nullptr;
- if (m_token.GetType() == TOKelse) {
+ if (token_.GetType() == TOKelse) {
if (!NextToken())
return nullptr;
pElseExpression = cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), ParseExpressionList());
+ heap_->GetAllocationHandle(), ParseExpressionList());
}
if (!CheckThenNext(TOKendif))
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMIfExpression>(
- m_heap->GetAllocationHandle(), pCondition, pIfExpressions,
+ heap_->GetAllocationHandle(), pCondition, pIfExpressions,
std::move(pElseIfExpressions), pElseExpression);
}
// While := 'while' '(' SimpleExpression ')' 'do' ExpressionList 'endwhile'
CXFA_FMExpression* CXFA_FMParser::ParseWhileExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKwhile))
@@ -965,9 +983,9 @@
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMWhileExpression>(
- m_heap->GetAllocationHandle(), pCondition,
+ heap_->GetAllocationHandle(), pCondition,
cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), std::move(exprs)));
+ heap_->GetAllocationHandle(), std::move(exprs)));
}
// For := 'for' Assignment 'upto' Accessor ('step' SimpleExpression)?
@@ -975,15 +993,16 @@
// 'for' Assignment 'downto' Accessor ('step' SimpleExpression)?
// 'do' ExpressionList 'endfor'
CXFA_FMExpression* CXFA_FMParser::ParseForExpression() {
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKfor))
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString wsVariant(m_token.GetString());
+ WideString wsVariant(token_.GetString());
if (!NextToken())
return nullptr;
if (!CheckThenNext(TOKassign))
@@ -994,12 +1013,13 @@
return nullptr;
int32_t iDirection = 0;
- if (m_token.GetType() == TOKupto)
+ if (token_.GetType() == TOKupto) {
iDirection = 1;
- else if (m_token.GetType() == TOKdownto)
+ } else if (token_.GetType() == TOKdownto) {
iDirection = -1;
- else
+ } else {
return nullptr;
+ }
if (!NextToken())
return nullptr;
@@ -1009,7 +1029,7 @@
return nullptr;
CXFA_FMSimpleExpression* pStep = nullptr;
- if (m_token.GetType() == TOKstep) {
+ if (token_.GetType() == TOKstep) {
if (!NextToken())
return nullptr;
pStep = ParseSimpleExpression();
@@ -1024,39 +1044,42 @@
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMForExpression>(
- m_heap->GetAllocationHandle(), wsVariant, pAssignment, pAccessor,
+ heap_->GetAllocationHandle(), wsVariant, pAssignment, pAccessor,
iDirection, pStep,
cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), std::move(exprs)));
+ heap_->GetAllocationHandle(), std::move(exprs)));
}
// Foreach := 'foreach' Identifier 'in' '(' ArgumentList ')'
// 'do' ExpressionList 'endfor'
CXFA_FMExpression* CXFA_FMParser::ParseForeachExpression() {
- if (m_token.GetType() != TOKforeach)
+ if (token_.GetType() != TOKforeach) {
return nullptr;
+ }
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKforeach))
return nullptr;
- if (m_token.GetType() != TOKidentifier)
+ if (token_.GetType() != TOKidentifier) {
return nullptr;
+ }
- WideString wsIdentifier(m_token.GetString());
+ WideString wsIdentifier(token_.GetString());
if (!NextToken() || !CheckThenNext(TOKin) || !CheckThenNext(TOKlparen))
return nullptr;
std::vector<cppgc::Member<CXFA_FMSimpleExpression>> pArgumentList;
- while (m_token.GetType() != TOKrparen) {
+ while (token_.GetType() != TOKrparen) {
CXFA_FMSimpleExpression* s = ParseSimpleExpression();
if (!s)
return nullptr;
pArgumentList.push_back(s);
- if (m_token.GetType() != TOKcomma)
+ if (token_.GetType() != TOKcomma) {
break;
+ }
if (!NextToken())
return nullptr;
}
@@ -1071,18 +1094,19 @@
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMForeachExpression>(
- m_heap->GetAllocationHandle(), std::move(wsIdentifier),
+ heap_->GetAllocationHandle(), std::move(wsIdentifier),
std::move(pArgumentList),
cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), std::move(exprs)));
+ heap_->GetAllocationHandle(), std::move(exprs)));
}
// Block := 'do' ExpressionList 'end'
CXFA_FMExpression* CXFA_FMParser::ParseDoExpression() {
- if (m_token.GetType() != TOKdo)
+ if (token_.GetType() != TOKdo) {
return nullptr;
+ }
- AutoRestorer<unsigned long> restorer(&m_parse_depth);
+ AutoRestorer<unsigned long> restorer(&parse_depth_);
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
if (!CheckThenNext(TOKdo))
@@ -1093,11 +1117,11 @@
return nullptr;
return cppgc::MakeGarbageCollected<CXFA_FMDoExpression>(
- m_heap->GetAllocationHandle(),
+ heap_->GetAllocationHandle(),
cppgc::MakeGarbageCollected<CXFA_FMBlockExpression>(
- m_heap->GetAllocationHandle(), std::move(exprs)));
+ heap_->GetAllocationHandle(), std::move(exprs)));
}
bool CXFA_FMParser::HasError() const {
- return m_error || m_token.GetType() == TOKreserver;
+ return error_ || token_.GetType() == TOKreserver;
}
diff --git a/xfa/fxfa/formcalc/cxfa_fmparser.h b/xfa/fxfa/formcalc/cxfa_fmparser.h
index f4251eb..22002c3 100644
--- a/xfa/fxfa/formcalc/cxfa_fmparser.h
+++ b/xfa/fxfa/formcalc/cxfa_fmparser.h
@@ -30,7 +30,7 @@
bool HasError() const;
void SetMaxParseDepthForTest(unsigned long max_depth) {
- m_max_parse_depth = max_depth;
+ max_parse_depth_ = max_depth;
}
private:
@@ -64,12 +64,12 @@
std::optional<std::vector<cppgc::Member<CXFA_FMSimpleExpression>>>
ParseArgumentList();
- UnownedPtr<cppgc::Heap> const m_heap;
- UNOWNED_PTR_EXCLUSION CXFA_FMLexer* const m_lexer; // Stack allocated.
- CXFA_FMLexer::Token m_token;
- bool m_error = false;
- unsigned long m_parse_depth = 0;
- unsigned long m_max_parse_depth;
+ UnownedPtr<cppgc::Heap> const heap_;
+ UNOWNED_PTR_EXCLUSION CXFA_FMLexer* const lexer_; // Stack allocated.
+ CXFA_FMLexer::Token token_;
+ bool error_ = false;
+ unsigned long parse_depth_ = 0;
+ unsigned long max_parse_depth_;
};
#endif // XFA_FXFA_FORMCALC_CXFA_FMPARSER_H_
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutitem.cpp b/xfa/fxfa/layout/cxfa_contentlayoutitem.cpp
index 4af6c30..a7e46cd 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutitem.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutitem.cpp
@@ -14,18 +14,19 @@
CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode,
CXFA_FFWidget* pWidget)
- : CXFA_LayoutItem(pNode, kContentItem), m_pFFWidget(pWidget) {
- if (m_pFFWidget)
- m_pFFWidget->SetLayoutItem(this);
+ : CXFA_LayoutItem(pNode, kContentItem), ffwidget_(pWidget) {
+ if (ffwidget_) {
+ ffwidget_->SetLayoutItem(this);
+ }
}
CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() = default;
void CXFA_ContentLayoutItem::Trace(cppgc::Visitor* visitor) const {
CXFA_LayoutItem::Trace(visitor);
- visitor->Trace(m_pPrev);
- visitor->Trace(m_pNext);
- visitor->Trace(m_pFFWidget);
+ visitor->Trace(prev_);
+ visitor->Trace(next_);
+ visitor->Trace(ffwidget_);
}
CXFA_ContentLayoutItem* CXFA_ContentLayoutItem::GetFirst() {
@@ -47,32 +48,35 @@
void CXFA_ContentLayoutItem::InsertAfter(CXFA_ContentLayoutItem* pItem) {
CHECK_NE(this, pItem);
pItem->RemoveSelf();
- pItem->m_pNext = m_pNext;
- pItem->m_pPrev = this;
- m_pNext = pItem;
- if (pItem->m_pNext)
- pItem->m_pNext->m_pPrev = pItem;
+ pItem->next_ = next_;
+ pItem->prev_ = this;
+ next_ = pItem;
+ if (pItem->next_) {
+ pItem->next_->prev_ = pItem;
+ }
}
void CXFA_ContentLayoutItem::RemoveSelf() {
- if (m_pNext)
- m_pNext->m_pPrev = m_pPrev;
- if (m_pPrev)
- m_pPrev->m_pNext = m_pNext;
+ if (next_) {
+ next_->prev_ = prev_;
+ }
+ if (prev_) {
+ prev_->next_ = next_;
+ }
}
CFX_RectF CXFA_ContentLayoutItem::GetRelativeRect() const {
- return CFX_RectF(m_sPos, m_sSize);
+ return CFX_RectF(s_pos_, s_size_);
}
CFX_RectF CXFA_ContentLayoutItem::GetAbsoluteRect() const {
- CFX_PointF sPos = m_sPos;
- CFX_SizeF sSize = m_sSize;
+ CFX_PointF sPos = s_pos_;
+ CFX_SizeF sSize = s_size_;
for (CXFA_LayoutItem* pLayoutItem = GetParent(); pLayoutItem;
pLayoutItem = pLayoutItem->GetParent()) {
if (CXFA_ContentLayoutItem* pContent = pLayoutItem->AsContentLayoutItem()) {
- sPos += pContent->m_sPos;
+ sPos += pContent->s_pos_;
CXFA_Margin* pMarginNode =
pContent->GetFormNode()->GetFirstChildByClass<CXFA_Margin>(
XFA_Element::Margin);
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutitem.h b/xfa/fxfa/layout/cxfa_contentlayoutitem.h
index 8131d0d..6124289 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutitem.h
+++ b/xfa/fxfa/layout/cxfa_contentlayoutitem.h
@@ -22,37 +22,37 @@
void Trace(cppgc::Visitor* visitor) const override;
- CXFA_FFWidget* GetFFWidget() { return m_pFFWidget; }
+ CXFA_FFWidget* GetFFWidget() { return ffwidget_; }
CXFA_ContentLayoutItem* GetFirst();
CXFA_ContentLayoutItem* GetLast();
- CXFA_ContentLayoutItem* GetPrev() const { return m_pPrev; }
- CXFA_ContentLayoutItem* GetNext() const { return m_pNext; }
+ CXFA_ContentLayoutItem* GetPrev() const { return prev_; }
+ CXFA_ContentLayoutItem* GetNext() const { return next_; }
void InsertAfter(CXFA_ContentLayoutItem* pNext);
CFX_RectF GetRelativeRect() const;
CFX_RectF GetAbsoluteRect() const;
size_t GetIndex() const;
- void SetStatusBits(Mask<XFA_WidgetStatus> val) { m_dwStatus |= val; }
- void ClearStatusBits(Mask<XFA_WidgetStatus> val) { m_dwStatus &= ~val; }
+ void SetStatusBits(Mask<XFA_WidgetStatus> val) { status_ |= val; }
+ void ClearStatusBits(Mask<XFA_WidgetStatus> val) { status_ &= ~val; }
- // TRUE if all (not any) bits set in |val| are set in |m_dwStatus|.
+ // TRUE if all (not any) bits set in |val| are set in |status_|.
bool TestStatusBits(Mask<XFA_WidgetStatus> val) const {
- return m_dwStatus.TestAll(val);
+ return status_.TestAll(val);
}
- CFX_PointF m_sPos;
- CFX_SizeF m_sSize;
+ CFX_PointF s_pos_;
+ CFX_SizeF s_size_;
private:
CXFA_ContentLayoutItem(CXFA_Node* pNode, CXFA_FFWidget* pFFWidget);
void RemoveSelf();
- mutable Mask<XFA_WidgetStatus> m_dwStatus;
- cppgc::Member<CXFA_ContentLayoutItem> m_pPrev;
- cppgc::Member<CXFA_ContentLayoutItem> m_pNext;
- cppgc::Member<CXFA_FFWidget> const m_pFFWidget;
+ mutable Mask<XFA_WidgetStatus> status_;
+ cppgc::Member<CXFA_ContentLayoutItem> prev_;
+ cppgc::Member<CXFA_ContentLayoutItem> next_;
+ cppgc::Member<CXFA_FFWidget> const ffwidget_;
};
inline CXFA_FFWidget* GetFFWidget(CXFA_ContentLayoutItem* item) {
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index e5ecd3c..ac836bd 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -75,9 +75,9 @@
case XFA_Element::ExclGroup:
case XFA_Element::SubformSet: {
if (*pWidth < -kXFALayoutPrecision)
- *pWidth = pLayoutItem->m_sSize.width;
+ *pWidth = pLayoutItem->s_size_.width;
if (*pHeight < -kXFALayoutPrecision)
- *pHeight = pLayoutItem->m_sSize.height;
+ *pHeight = pLayoutItem->s_size_.height;
break;
}
case XFA_Element::Draw:
@@ -211,7 +211,7 @@
bContainerWidthAutoSize ? FLT_MAX
: containerSize.width - inset.left - inset.right;
const float fContentCurrentHeight =
- pLayoutRow->m_sSize.height - inset.top - inset.bottom;
+ pLayoutRow->s_size_.height - inset.top - inset.bottom;
float fContentCalculatedWidth = 0;
float fContentCalculatedHeight = 0;
@@ -249,13 +249,13 @@
nColSpan != static_cast<size_t>(nOriginalColSpan)) {
fColSpanWidth = bMetWholeRowCell ? 0
: std::max(fColSpanWidth,
- pLayoutChild->m_sSize.height);
+ pLayoutChild->s_size_.height);
}
if (nOriginalColSpan == -1)
bMetWholeRowCell = true;
- pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0);
- pLayoutChild->m_sSize.width = fColSpanWidth;
+ pLayoutChild->s_pos_ = CFX_PointF(fCurrentColX, 0);
+ pLayoutChild->s_size_.width = fColSpanWidth;
if (!pLayoutChild->GetFormNode()->PresenceRequiresSpace())
continue;
@@ -263,10 +263,10 @@
nCurrentColIdx += nColSpan;
float fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight;
UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight);
- pLayoutChild->m_sSize.height = fNewHeight;
+ pLayoutChild->s_size_.height = fNewHeight;
if (bContainerHeightAutoSize) {
fContentCalculatedHeight =
- std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height);
+ std::max(fContentCalculatedHeight, pLayoutChild->s_size_.height);
}
}
@@ -277,10 +277,10 @@
if (!pLayoutChild)
continue;
- UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width,
+ UpdateWidgetSize(pLayoutChild, &pLayoutChild->s_size_.width,
&fContentCalculatedHeight);
- float fOldChildHeight = pLayoutChild->m_sSize.height;
- pLayoutChild->m_sSize.height = fContentCalculatedHeight;
+ float fOldChildHeight = pLayoutChild->s_size_.height;
+ pLayoutChild->s_size_.height = fContentCalculatedHeight;
CXFA_Para* pParaNode =
pLayoutChild->GetFormNode()->GetFirstChildByClass<CXFA_Para>(
XFA_Element::Para);
@@ -308,7 +308,7 @@
pInnerIter; pInnerIter = pInnerIter->GetNextSibling()) {
CXFA_ContentLayoutItem* pInnerChild = pInnerIter->AsContentLayoutItem();
if (pInnerChild)
- pInnerChild->m_sPos.y += fOffHeight;
+ pInnerChild->s_pos_.y += fOffHeight;
}
}
}
@@ -333,12 +333,12 @@
if (!pLayoutChild)
continue;
- pLayoutChild->m_sPos.x = fContentCalculatedWidth -
- pLayoutChild->m_sPos.x -
- pLayoutChild->m_sSize.width;
+ pLayoutChild->s_pos_.x = fContentCalculatedWidth -
+ pLayoutChild->s_pos_.x -
+ pLayoutChild->s_size_.width;
}
}
- pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize(
+ pLayoutRow->s_size_ = CalculateContainerComponentSizeFromContentSize(
pLayoutRow->GetFormNode(), bContainerWidthAutoSize,
fContentCalculatedWidth, bContainerHeightAutoSize,
fContentCalculatedHeight, containerSize);
@@ -483,7 +483,7 @@
bool bCalculateMargin) {
CXFA_Node* pFormNode = pLayoutItem->GetFormNode();
if (*fProposedSplitPos <= fCurVerticalOffset + kXFALayoutPrecision ||
- *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height -
+ *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->s_size_.height -
kXFALayoutPrecision) {
return false;
}
@@ -529,7 +529,7 @@
continue;
float fChildOffset =
- fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y;
+ fCurVerticalOffset + fCurTopMargin + pChildItem->s_pos_.y;
bool bChange = false;
if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos,
&bChange, bCalculateMargin)) {
@@ -633,30 +633,30 @@
cppgc::Heap* pHeap,
CXFA_Node* pNode,
CXFA_ViewLayoutProcessor* pViewLayoutProcessor)
- : m_pHeap(pHeap),
- m_pFormNode(pNode),
- m_pViewLayoutProcessor(pViewLayoutProcessor) {
+ : heap_(pHeap),
+ form_node_(pNode),
+ view_layout_processor_(pViewLayoutProcessor) {
DCHECK(GetFormNode());
DCHECK(GetFormNode()->IsContainerNode() ||
GetFormNode()->GetElementType() == XFA_Element::Form);
- m_pOldLayoutItem =
+ old_layout_item_ =
ToContentLayoutItem(GetFormNode()->JSObject()->GetLayoutItem());
}
CXFA_ContentLayoutProcessor::~CXFA_ContentLayoutProcessor() = default;
void CXFA_ContentLayoutProcessor::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pFormNode);
- visitor->Trace(m_pCurChildNode);
- visitor->Trace(m_pKeepHeadNode);
- visitor->Trace(m_pKeepTailNode);
- visitor->Trace(m_pLayoutItem);
- visitor->Trace(m_pOldLayoutItem);
- visitor->Trace(m_pViewLayoutProcessor);
- visitor->Trace(m_pCurChildPreprocessor);
- ContainerTrace(visitor, m_ArrayKeepItems);
- ContainerTrace(visitor, m_PendingNodes);
- ContainerTrace(visitor, m_PendingNodesCount);
+ visitor->Trace(form_node_);
+ visitor->Trace(cur_child_node_);
+ visitor->Trace(keep_head_node_);
+ visitor->Trace(keep_tail_node_);
+ visitor->Trace(layout_item_);
+ visitor->Trace(old_layout_item_);
+ visitor->Trace(view_layout_processor_);
+ visitor->Trace(cur_child_preprocessor_);
+ ContainerTrace(visitor, array_keep_items_);
+ ContainerTrace(visitor, pending_nodes_);
+ ContainerTrace(visitor, pending_nodes_count_);
}
CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::CreateContentLayoutItem(
@@ -664,9 +664,9 @@
if (!pFormNode)
return nullptr;
- if (m_pOldLayoutItem) {
- CXFA_ContentLayoutItem* pLayoutItem = m_pOldLayoutItem;
- m_pOldLayoutItem = m_pOldLayoutItem->GetNext();
+ if (old_layout_item_) {
+ CXFA_ContentLayoutItem* pLayoutItem = old_layout_item_;
+ old_layout_item_ = old_layout_item_->GetNext();
return pLayoutItem;
}
CXFA_FFNotify* pNotify = pFormNode->GetDocument()->GetNotify();
@@ -685,13 +685,13 @@
}
float CXFA_ContentLayoutProcessor::FindSplitPos(float fProposedSplitPos) {
- DCHECK(m_pLayoutItem);
+ DCHECK(layout_item_);
auto value = GetFormNode()->JSObject()->TryEnum(XFA_Attribute::Layout, true);
XFA_AttributeValue eLayout = value.value_or(XFA_AttributeValue::Position);
bool bCalculateMargin = eLayout != XFA_AttributeValue::Position;
while (fProposedSplitPos > kXFALayoutPrecision) {
bool bAppChange = false;
- if (!FindLayoutItemSplitPos(m_pLayoutItem.Get(), 0, &fProposedSplitPos,
+ if (!FindLayoutItemSplitPos(layout_item_.Get(), 0, &fProposedSplitPos,
&bAppChange, bCalculateMargin)) {
break;
}
@@ -722,26 +722,26 @@
}
CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr;
- if (m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->GetFormNode() == pLayoutItem->GetFormNode()) {
- pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem(
+ if (cur_child_preprocessor_ &&
+ cur_child_preprocessor_->GetFormNode() == pLayoutItem->GetFormNode()) {
+ pSecondLayoutItem = cur_child_preprocessor_->CreateContentLayoutItem(
pLayoutItem->GetFormNode());
} else {
pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->GetFormNode());
}
- pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x;
- pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width;
- pSecondLayoutItem->m_sPos.y = 0;
- pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos;
- pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height;
+ pSecondLayoutItem->s_pos_.x = pLayoutItem->s_pos_.x;
+ pSecondLayoutItem->s_size_.width = pLayoutItem->s_size_.width;
+ pSecondLayoutItem->s_pos_.y = 0;
+ pSecondLayoutItem->s_size_.height = pLayoutItem->s_size_.height - fSplitPos;
+ pLayoutItem->s_size_.height -= pSecondLayoutItem->s_size_.height;
if (pLayoutItem->GetFirstChild())
- pSecondLayoutItem->m_sSize.height += fCurTopMargin;
+ pSecondLayoutItem->s_size_.height += fCurTopMargin;
bool bOrphanedItem = false;
if (pSecondParent) {
pSecondParent->AppendLastChild(pSecondLayoutItem);
if (fCurTopMargin > 0 && pLayoutItem->GetFirstChild()) {
- pSecondParent->m_sSize.height += fCurTopMargin;
+ pSecondParent->s_size_.height += fCurTopMargin;
for (CXFA_LayoutItem* pParentIter = pSecondParent->GetParent();
pParentIter; pParentIter = pParentIter->GetParent()) {
CXFA_ContentLayoutItem* pContentItem =
@@ -749,7 +749,7 @@
if (!pContentItem)
continue;
- pContentItem->m_sSize.height += fCurTopMargin;
+ pContentItem->s_size_.height += fCurTopMargin;
}
}
} else if (pLayoutItem->GetParent()) {
@@ -772,40 +772,41 @@
float fAddMarginHeight = 0;
std::vector<CXFA_ContentLayoutItem*> keepLayoutItems;
for (CXFA_ContentLayoutItem* pChildItem : children) {
- if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin +
+ if (fSplitPos <= fCurTopMargin + pChildItem->s_pos_.y + fCurBottomMargin +
kXFALayoutPrecision) {
if (!ExistContainerKeep(pChildItem->GetFormNode(), true)) {
- pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin;
- pChildItem->m_sPos.y += lHeightForKeep;
- pChildItem->m_sPos.y += fAddMarginHeight;
+ pChildItem->s_pos_.y -= fSplitPos - fCurBottomMargin;
+ pChildItem->s_pos_.y += lHeightForKeep;
+ pChildItem->s_pos_.y += fAddMarginHeight;
pSecondLayoutItem->AppendLastChild(pChildItem);
continue;
}
if (lHeightForKeep < kXFALayoutPrecision) {
for (CXFA_ContentLayoutItem* pPreItem : keepLayoutItems) {
pLayoutItem->RemoveChild(pPreItem);
- pPreItem->m_sPos.y -= fSplitPos;
- if (pPreItem->m_sPos.y < 0)
- pPreItem->m_sPos.y = 0;
- if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) {
- pPreItem->m_sPos.y = lHeightForKeep;
- lHeightForKeep += pPreItem->m_sSize.height;
- pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height;
+ pPreItem->s_pos_.y -= fSplitPos;
+ if (pPreItem->s_pos_.y < 0) {
+ pPreItem->s_pos_.y = 0;
+ }
+ if (pPreItem->s_pos_.y + pPreItem->s_size_.height > lHeightForKeep) {
+ pPreItem->s_pos_.y = lHeightForKeep;
+ lHeightForKeep += pPreItem->s_size_.height;
+ pSecondLayoutItem->s_size_.height += pPreItem->s_size_.height;
if (pSecondParent)
- pSecondParent->m_sSize.height += pPreItem->m_sSize.height;
+ pSecondParent->s_size_.height += pPreItem->s_size_.height;
}
pSecondLayoutItem->AppendLastChild(pPreItem);
}
}
- pChildItem->m_sPos.y -= fSplitPos;
- pChildItem->m_sPos.y += lHeightForKeep;
- pChildItem->m_sPos.y += fAddMarginHeight;
+ pChildItem->s_pos_.y -= fSplitPos;
+ pChildItem->s_pos_.y += lHeightForKeep;
+ pChildItem->s_pos_.y += fAddMarginHeight;
pSecondLayoutItem->AppendLastChild(pChildItem);
continue;
}
if (fSplitPos + kXFALayoutPrecision >= fCurTopMargin + fCurBottomMargin +
- pChildItem->m_sPos.y +
- pChildItem->m_sSize.height) {
+ pChildItem->s_pos_.y +
+ pChildItem->s_size_.height) {
pLayoutItem->AppendLastChild(pChildItem);
if (ExistContainerKeep(pChildItem->GetFormNode(), false))
keepLayoutItems.push_back(pChildItem);
@@ -814,11 +815,11 @@
continue;
}
- float fOldHeight = pSecondLayoutItem->m_sSize.height;
+ float fOldHeight = pSecondLayoutItem->s_size_.height;
SplitLayoutItem(
pChildItem, pSecondLayoutItem,
- fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y);
- fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight;
+ fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->s_pos_.y);
+ fAddMarginHeight = pSecondLayoutItem->s_size_.height - fOldHeight;
pLayoutItem->AppendLastChild(pChildItem);
}
if (bOrphanedItem)
@@ -826,27 +827,28 @@
}
void CXFA_ContentLayoutProcessor::SplitLayoutItem(float fSplitPos) {
- DCHECK(m_pLayoutItem);
- SplitLayoutItem(m_pLayoutItem.Get(), nullptr, fSplitPos);
+ DCHECK(layout_item_);
+ SplitLayoutItem(layout_item_.Get(), nullptr, fSplitPos);
}
CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::ExtractLayoutItem() {
- CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem;
+ CXFA_ContentLayoutItem* pLayoutItem = layout_item_;
if (pLayoutItem) {
- m_pLayoutItem = ToContentLayoutItem(pLayoutItem->GetNextSibling());
+ layout_item_ = ToContentLayoutItem(pLayoutItem->GetNextSibling());
pLayoutItem->RemoveSelfIfParented();
}
- if (m_nCurChildNodeStage != Stage::kDone || !m_pOldLayoutItem)
+ if (cur_child_node_stage_ != Stage::kDone || !old_layout_item_) {
return pLayoutItem;
+ }
CXFA_FFNotify* pNotify =
- m_pOldLayoutItem->GetFormNode()->GetDocument()->GetNotify();
+ old_layout_item_->GetFormNode()->GetDocument()->GetNotify();
auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(
- m_pOldLayoutItem->GetFormNode()->GetDocument());
+ old_layout_item_->GetFormNode()->GetDocument());
- while (m_pOldLayoutItem) {
- CXFA_ContentLayoutItem* pToDeleteItem = m_pOldLayoutItem;
- m_pOldLayoutItem = pToDeleteItem->GetNext();
+ while (old_layout_item_) {
+ CXFA_ContentLayoutItem* pToDeleteItem = old_layout_item_;
+ old_layout_item_ = pToDeleteItem->GetNext();
if (pToDeleteItem == pLayoutItem)
break;
pNotify->OnLayoutItemRemoving(pDocLayout, pToDeleteItem);
@@ -856,8 +858,8 @@
}
void CXFA_ContentLayoutProcessor::GotoNextContainerNodeSimple() {
- std::tie(m_nCurChildNodeStage, m_pCurChildNode) = GotoNextContainerNode(
- m_nCurChildNodeStage, GetFormNode(), m_pCurChildNode);
+ std::tie(cur_child_node_stage_, cur_child_node_) = GotoNextContainerNode(
+ cur_child_node_stage_, GetFormNode(), cur_child_node_);
}
std::pair<CXFA_ContentLayoutProcessor::Stage, CXFA_Node*>
@@ -948,23 +950,24 @@
const bool bNextKeep = ExistContainerKeep(*pNextContainer, false);
if (bNextKeep && !bCanSplit) {
- if (!m_bIsProcessKeep && !m_bKeepBreakFinish) {
- m_pKeepHeadNode = *pNextContainer;
- m_bIsProcessKeep = true;
+ if (!is_process_keep_ && !keep_break_finish_) {
+ keep_head_node_ = *pNextContainer;
+ is_process_keep_ = true;
}
return std::nullopt;
}
- if (!m_bIsProcessKeep || !m_pKeepHeadNode) {
- if (m_bKeepBreakFinish)
+ if (!is_process_keep_ || !keep_head_node_) {
+ if (keep_break_finish_) {
*pLastKeepNode = true;
- m_bKeepBreakFinish = false;
+ }
+ keep_break_finish_ = false;
return std::nullopt;
}
- m_pKeepTailNode = *pNextContainer;
- if (m_bKeepBreakFinish) {
- *pNextContainer = m_pKeepHeadNode;
+ keep_tail_node_ = *pNextContainer;
+ if (keep_break_finish_) {
+ *pNextContainer = keep_head_node_;
ProcessKeepNodesEnd();
return std::nullopt;
}
@@ -972,7 +975,7 @@
std::optional<Stage> ret =
FindBreakBeforeNode((*pNextContainer)->GetFirstChild(), pCurActionNode);
if (!ret.has_value()) {
- *pNextContainer = m_pKeepHeadNode;
+ *pNextContainer = keep_head_node_;
ProcessKeepNodesEnd();
return std::nullopt;
}
@@ -984,8 +987,8 @@
CXFA_ContentLayoutProcessor::ProcessKeepNodesForBreakBefore(
CXFA_Node** pCurActionNode,
CXFA_Node* pContainerNode) {
- if (m_pKeepTailNode == pContainerNode) {
- *pCurActionNode = m_pKeepHeadNode;
+ if (keep_tail_node_ == pContainerNode) {
+ *pCurActionNode = keep_head_node_;
ProcessKeepNodesEnd();
return Stage::kContainer;
}
@@ -1053,10 +1056,11 @@
void CXFA_ContentLayoutProcessor::DoLayoutPositionedContainer(
Context* pContext) {
- if (m_pLayoutItem)
+ if (layout_item_) {
return;
+ }
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
auto value = GetFormNode()->JSObject()->TryEnum(XFA_Attribute::Layout, true);
bool bIgnoreXY = value.value_or(XFA_AttributeValue::Position) !=
XFA_AttributeValue::Position;
@@ -1069,37 +1073,41 @@
float fContentCalculatedHeight = 0;
float fHiddenContentCalculatedWidth = 0;
float fHiddenContentCalculatedHeight = 0;
- if (!m_pCurChildNode)
+ if (!cur_child_node_) {
GotoNextContainerNodeSimple();
+ }
int32_t iColIndex = 0;
- for (; m_pCurChildNode; GotoNextContainerNodeSimple()) {
- if (m_nCurChildNodeStage != Stage::kContainer)
+ for (; cur_child_node_; GotoNextContainerNodeSimple()) {
+ if (cur_child_node_stage_ != Stage::kContainer) {
continue;
- if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
+ }
+ if (cur_child_node_->GetElementType() == XFA_Element::Variables) {
continue;
+ }
auto* pProcessor = cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
- GetHeap()->GetAllocationHandle(), GetHeap(), m_pCurChildNode,
- m_pViewLayoutProcessor);
+ GetHeap()->GetAllocationHandle(), GetHeap(), cur_child_node_,
+ view_layout_processor_);
- if (pContext && pContext->m_prgSpecifiedColumnWidths) {
+ if (pContext && pContext->prg_specified_column_widths_) {
int32_t iColSpan =
- m_pCurChildNode->JSObject()->GetInteger(XFA_Attribute::ColSpan);
+ cur_child_node_->JSObject()->GetInteger(XFA_Attribute::ColSpan);
if (iColSpan <= fxcrt::CollectionSize<int32_t>(
- *pContext->m_prgSpecifiedColumnWidths) -
+ *pContext->prg_specified_column_widths_) -
iColIndex) {
- pContext->m_fCurColumnWidth = 0.0f;
+ pContext->cur_column_width_ = 0.0f;
if (iColSpan == -1) {
iColSpan = fxcrt::CollectionSize<int32_t>(
- *pContext->m_prgSpecifiedColumnWidths);
+ *pContext->prg_specified_column_widths_);
}
for (int32_t i = 0; iColIndex + i < iColSpan; ++i) {
- pContext->m_fCurColumnWidth.value() +=
- (*pContext->m_prgSpecifiedColumnWidths)[iColIndex + i];
+ pContext->cur_column_width_.value() +=
+ (*pContext->prg_specified_column_widths_)[iColIndex + i];
}
- if (pContext->m_fCurColumnWidth.value() == 0)
- pContext->m_fCurColumnWidth.reset();
+ if (pContext->cur_column_width_.value() == 0) {
+ pContext->cur_column_width_.reset();
+ }
iColIndex += iColSpan >= 0 ? iColSpan : 0;
}
@@ -1111,12 +1119,13 @@
CFX_SizeF size = pProcessor->GetCurrentComponentSize();
bool bChangeParentSize = false;
- if (m_pCurChildNode->PresenceRequiresSpace())
+ if (cur_child_node_->PresenceRequiresSpace()) {
bChangeParentSize = true;
+ }
CFX_PointF absolutePos;
if (!bIgnoreXY)
- absolutePos = CalculatePositionedContainerPos(m_pCurChildNode, size);
+ absolutePos = CalculatePositionedContainerPos(cur_child_node_, size);
pProcessor->SetCurrentComponentPos(absolutePos);
if (bContainerWidthAutoSize) {
@@ -1126,7 +1135,7 @@
std::max(fContentCalculatedWidth, fChildSuppliedWidth);
} else {
if (fHiddenContentCalculatedWidth < fChildSuppliedWidth &&
- m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
+ cur_child_node_->GetElementType() != XFA_Element::Subform) {
fHiddenContentCalculatedWidth = fChildSuppliedWidth;
}
}
@@ -1139,12 +1148,12 @@
std::max(fContentCalculatedHeight, fChildSuppliedHeight);
} else {
if (fHiddenContentCalculatedHeight < fChildSuppliedHeight &&
- m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
+ cur_child_node_->GetElementType() != XFA_Element::Subform) {
fHiddenContentCalculatedHeight = fChildSuppliedHeight;
}
}
}
- m_pLayoutItem->AppendLastChild(pProcessor->ExtractLayoutItem());
+ layout_item_->AppendLastChild(pProcessor->ExtractLayoutItem());
}
XFA_VERSION eVersion = GetFormNode()->GetDocument()->GetCurVersionMode();
@@ -1161,14 +1170,15 @@
void CXFA_ContentLayoutProcessor::DoLayoutTableContainer(
CXFA_Node* pLayoutNode) {
- if (m_pLayoutItem)
+ if (layout_item_) {
return;
+ }
if (!pLayoutNode)
pLayoutNode = GetFormNode();
- DCHECK(!m_pCurChildNode);
+ DCHECK(!cur_child_node_);
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
bool bContainerWidthAutoSize = true;
bool bContainerHeightAutoSize = true;
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
@@ -1197,34 +1207,36 @@
if (width.IsEmpty())
continue;
- m_rgSpecifiedColumnWidths.push_back(
+ rg_specified_column_widths_.push_back(
CXFA_Measurement(width.AsStringView()).ToUnit(XFA_Unit::Pt));
}
}
int32_t iSpecifiedColumnCount =
- fxcrt::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
+ fxcrt::CollectionSize<int32_t>(rg_specified_column_widths_);
Context layoutContext;
- layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
+ layoutContext.prg_specified_column_widths_ = &rg_specified_column_widths_;
Context* pLayoutContext =
iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
- if (!m_pCurChildNode)
+ if (!cur_child_node_) {
GotoNextContainerNodeSimple();
+ }
- for (; m_pCurChildNode; GotoNextContainerNodeSimple()) {
- layoutContext.m_fCurColumnWidth.reset();
- if (m_nCurChildNodeStage != Stage::kContainer)
+ for (; cur_child_node_; GotoNextContainerNodeSimple()) {
+ layoutContext.cur_column_width_.reset();
+ if (cur_child_node_stage_ != Stage::kContainer) {
continue;
+ }
auto* pProcessor = cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
- GetHeap()->GetAllocationHandle(), GetHeap(), m_pCurChildNode,
- m_pViewLayoutProcessor);
+ GetHeap()->GetAllocationHandle(), GetHeap(), cur_child_node_,
+ view_layout_processor_);
pProcessor->DoLayoutInternal(false, FLT_MAX, FLT_MAX, pLayoutContext);
if (!pProcessor->HasLayoutItem())
continue;
- m_pLayoutItem->AppendLastChild(pProcessor->ExtractLayoutItem());
+ layout_item_->AppendLastChild(pProcessor->ExtractLayoutItem());
}
int32_t iRowCount = 0;
@@ -1233,7 +1245,7 @@
std::vector<CXFA_ContentLayoutItem*> rgRowItems;
std::vector<int32_t> rgRowItemsSpan;
std::vector<float> rgRowItemsWidth;
- for (CXFA_LayoutItem* pIter = m_pLayoutItem->GetFirstChild(); pIter;
+ for (CXFA_LayoutItem* pIter = layout_item_->GetFirstChild(); pIter;
pIter = pIter->GetNextSibling()) {
CXFA_ContentLayoutItem* pLayoutChild = pIter->AsContentLayoutItem();
if (!pLayoutChild)
@@ -1258,7 +1270,7 @@
pRowLayoutCell->GetFormNode()->JSObject()->GetInteger(
XFA_Attribute::ColSpan);
rgRowItemsSpan.push_back(iColSpan);
- rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width);
+ rgRowItemsWidth.push_back(pRowLayoutCell->s_size_.width);
}
}
@@ -1283,7 +1295,7 @@
pNewCell ? pNewCell->GetFormNode()->JSObject()->GetInteger(
XFA_Attribute::ColSpan)
: 0;
- rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0;
+ rgRowItemsWidth[i] = pNewCell ? pNewCell->s_size_.width : 0;
}
CXFA_ContentLayoutItem* pCell = rgRowItems[i];
if (!pCell)
@@ -1294,16 +1306,18 @@
continue;
if (iColCount >= iSpecifiedColumnCount) {
- int32_t c = iColCount + 1 -
- fxcrt::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
+ int32_t c =
+ iColCount + 1 -
+ fxcrt::CollectionSize<int32_t>(rg_specified_column_widths_);
for (int32_t j = 0; j < c; j++)
- m_rgSpecifiedColumnWidths.push_back(0);
+ rg_specified_column_widths_.push_back(0);
}
- if (m_rgSpecifiedColumnWidths[iColCount] < kXFALayoutPrecision)
+ if (rg_specified_column_widths_[iColCount] < kXFALayoutPrecision) {
bAutoCol = true;
+ }
if (bAutoCol &&
- m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) {
- m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i];
+ rg_specified_column_widths_[iColCount] < rgRowItemsWidth[i]) {
+ rg_specified_column_widths_[iColCount] = rgRowItemsWidth[i];
}
}
@@ -1311,8 +1325,9 @@
continue;
float fFinalColumnWidth = 0.0f;
- if (fxcrt::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount))
- fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount];
+ if (fxcrt::IndexInBounds(rg_specified_column_widths_, iColCount)) {
+ fFinalColumnWidth = rg_specified_column_widths_[iColCount];
+ }
for (int32_t i = 0; i < iRowCount; ++i) {
if (!rgRowItems[i])
@@ -1325,7 +1340,7 @@
}
float fCurrentRowY = 0;
- for (CXFA_LayoutItem* pIter = m_pLayoutItem->GetFirstChild(); pIter;
+ for (CXFA_LayoutItem* pIter = layout_item_->GetFirstChild(); pIter;
pIter = pIter->GetNextSibling()) {
CXFA_ContentLayoutItem* pLayoutChild = pIter->AsContentLayoutItem();
if (!pLayoutChild || !pLayoutChild->GetFormNode()->PresenceRequiresSpace())
@@ -1337,35 +1352,35 @@
XFA_Attribute::Layout);
if (eSubformLayout == XFA_AttributeValue::Row ||
eSubformLayout == XFA_AttributeValue::Rl_row) {
- RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths,
+ RelocateTableRowCells(pLayoutChild, rg_specified_column_widths_,
eSubformLayout);
}
}
- pLayoutChild->m_sPos.y = fCurrentRowY;
+ pLayoutChild->s_pos_.y = fCurrentRowY;
if (bContainerWidthAutoSize) {
- pLayoutChild->m_sPos.x = 0;
+ pLayoutChild->s_pos_.x = 0;
} else {
switch (pLayoutChild->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeValue::Center:
- pLayoutChild->m_sPos.x =
- (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2;
+ pLayoutChild->s_pos_.x =
+ (fContentWidthLimit - pLayoutChild->s_size_.width) / 2;
break;
case XFA_AttributeValue::Right:
- pLayoutChild->m_sPos.x =
- fContentWidthLimit - pLayoutChild->m_sSize.width;
+ pLayoutChild->s_pos_.x =
+ fContentWidthLimit - pLayoutChild->s_size_.width;
break;
case XFA_AttributeValue::Left:
default:
- pLayoutChild->m_sPos.x = 0;
+ pLayoutChild->s_pos_.x = 0;
break;
}
}
if (bContainerWidthAutoSize) {
float fChildSuppliedWidth =
- pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width;
+ pLayoutChild->s_pos_.x + pLayoutChild->s_size_.width;
if (fContentWidthLimit < FLT_MAX &&
fContentWidthLimit > fChildSuppliedWidth) {
fChildSuppliedWidth = fContentWidthLimit;
@@ -1373,7 +1388,7 @@
fContentCalculatedWidth =
std::max(fContentCalculatedWidth, fChildSuppliedWidth);
}
- fCurrentRowY += pLayoutChild->m_sSize.height;
+ fCurrentRowY += pLayoutChild->s_size_.height;
}
if (bContainerHeightAutoSize)
@@ -1390,27 +1405,28 @@
if (!pTrailerItem)
return false;
- float fWidth = pTrailerItem->m_sSize.width;
+ float fWidth = pTrailerItem->s_size_.width;
XFA_AttributeValue eLayout =
GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
- return eLayout == XFA_AttributeValue::Tb || m_fWidthLimit <= fWidth;
+ return eLayout == XFA_AttributeValue::Tb || width_limit_ <= fWidth;
}
float CXFA_ContentLayoutProcessor::InsertKeepLayoutItems() {
- if (m_ArrayKeepItems.empty())
+ if (array_keep_items_.empty()) {
return 0;
+ }
- if (!m_pLayoutItem) {
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
- m_pLayoutItem->m_sSize.clear();
+ if (!layout_item_) {
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
+ layout_item_->s_size_.clear();
}
float fTotalHeight = 0;
- for (const auto& item : pdfium::Reversed(m_ArrayKeepItems)) {
+ for (const auto& item : pdfium::Reversed(array_keep_items_)) {
AddLeaderAfterSplit(item);
- fTotalHeight += item->m_sSize.height;
+ fTotalHeight += item->s_size_.height;
}
- m_ArrayKeepItems.clear();
+ array_keep_items_.clear();
return fTotalHeight;
}
@@ -1428,22 +1444,24 @@
if (!pChildProcessor)
return false;
- if (m_pCurChildNode->GetIntact() == XFA_AttributeValue::None &&
- pChildProcessor->m_bHasAvailHeight)
+ if (cur_child_node_->GetIntact() == XFA_AttributeValue::None &&
+ pChildProcessor->has_avail_height_) {
return false;
+ }
- if (!ExistContainerKeep(m_pCurChildNode, true))
+ if (!ExistContainerKeep(cur_child_node_, true)) {
return false;
+ }
CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize();
std::vector<CXFA_ContentLayoutItem*> keepLayoutItems;
- if (JudgePutNextPage(m_pLayoutItem.Get(), childSize.height,
+ if (JudgePutNextPage(layout_item_.Get(), childSize.height,
&keepLayoutItems)) {
- m_ArrayKeepItems.clear();
+ array_keep_items_.clear();
for (CXFA_ContentLayoutItem* item : keepLayoutItems) {
- m_pLayoutItem->RemoveChild(item);
- *fContentCurRowY -= item->m_sSize.height;
- m_ArrayKeepItems.push_back(item);
+ layout_item_->RemoveChild(item);
+ *fContentCurRowY -= item->s_size_.height;
+ array_keep_items_.push_back(item);
}
*bAddedItemInRow = true;
*bForceEndPage = true;
@@ -1475,14 +1493,14 @@
if (ExistContainerKeep(pChildLayoutItem->GetFormNode(), false)) {
pKeepItems->push_back(pChildLayoutItem);
- fItemsHeight += pChildLayoutItem->m_sSize.height;
+ fItemsHeight += pChildLayoutItem->s_size_.height;
} else {
pKeepItems->clear();
fItemsHeight = 0;
}
}
fItemsHeight += fChildHeight;
- return m_pViewLayoutProcessor->GetNextAvailContentHeight(fItemsHeight);
+ return view_layout_processor_->GetNextAvailContentHeight(fItemsHeight);
}
void CXFA_ContentLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
@@ -1533,9 +1551,10 @@
float fRealHeight,
Context* pContext,
bool bRootForceTb) {
- m_bHasAvailHeight = true;
- if (m_pCurChildPreprocessor)
- m_pCurChildPreprocessor->m_ePreProcessRs = Result::kDone;
+ has_avail_height_ = true;
+ if (cur_child_preprocessor_) {
+ cur_child_preprocessor_->pre_process_rs_ = Result::kDone;
+ }
bool bContainerWidthAutoSize = true;
bool bContainerHeightAutoSize = true;
@@ -1553,39 +1572,40 @@
: container_size.width - inset.left - inset.right;
float fAvailHeight = fHeightLimit - inset.top - inset.bottom;
if (fAvailHeight < 0)
- m_bHasAvailHeight = false;
+ has_avail_height_ = false;
fRealHeight = fRealHeight - inset.top - inset.bottom;
CFX_SizeF calculated_size;
float fContentCurRowY = 0;
CXFA_ContentLayoutItem* pLastChild = nullptr;
- if (m_pLayoutItem) {
+ if (layout_item_) {
pLastChild = FindLastContentLayoutItem(eFlowStrategy);
calculated_size = CalculateLayoutItemSize(pLastChild);
fContentCurRowY =
- pLastChild ? pLastChild->m_sPos.y : calculated_size.height;
+ pLastChild ? pLastChild->s_pos_.y : calculated_size.height;
}
fContentCurRowY += InsertKeepLayoutItems();
- if (m_nCurChildNodeStage == Stage::kNone)
+ if (cur_child_node_stage_ == Stage::kNone) {
GotoNextContainerNodeSimple();
+ }
fContentCurRowY += InsertPendingItems(GetFormNode());
- if (m_pCurChildPreprocessor && m_nCurChildNodeStage == Stage::kContainer) {
- if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) {
- m_pKeepHeadNode = m_pCurChildNode;
- m_bIsProcessKeep = true;
- m_nCurChildNodeStage = Stage::kKeep;
+ if (cur_child_preprocessor_ && cur_child_node_stage_ == Stage::kContainer) {
+ if (ExistContainerKeep(cur_child_preprocessor_->GetFormNode(), false)) {
+ keep_head_node_ = cur_child_node_;
+ is_process_keep_ = true;
+ cur_child_node_stage_ = Stage::kKeep;
}
}
bool bForceEndPage = false;
bool bBreakDone = false;
bool bIsManualBreak = false;
- while (m_nCurChildNodeStage != Stage::kDone) {
+ while (cur_child_node_stage_ != Stage::kDone) {
float fContentCurRowHeight = 0;
float fContentCurRowAvailWidth = fContentWidthLimit;
- m_fWidthLimit = fContentCurRowAvailWidth;
+ width_limit_ = fContentCurRowAvailWidth;
std::array<ContentLayoutItemVector, 3> rgCurLineLayoutItems;
uint8_t uCurHAlignState =
(eFlowStrategy != XFA_AttributeValue::Rl_tb ? 0 : 2);
@@ -1595,15 +1615,15 @@
CXFA_ContentLayoutItem* pLayoutNext = pNext->AsContentLayoutItem();
if (!pLayoutNext)
continue;
- if (!pLayoutNext->GetNextSibling() && m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->GetFormNode() ==
+ if (!pLayoutNext->GetNextSibling() && cur_child_preprocessor_ &&
+ cur_child_preprocessor_->GetFormNode() ==
pLayoutNext->GetFormNode()) {
- if (m_pCurChildPreprocessor->m_pLayoutItem &&
- m_pCurChildPreprocessor->m_pLayoutItem != pLayoutNext) {
+ if (cur_child_preprocessor_->layout_item_ &&
+ cur_child_preprocessor_->layout_item_ != pLayoutNext) {
pLayoutNext->InsertAfter(
- m_pCurChildPreprocessor->m_pLayoutItem.Get());
+ cur_child_preprocessor_->layout_item_.Get());
}
- m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext;
+ cur_child_preprocessor_->layout_item_ = pLayoutNext;
break;
}
uint8_t uHAlign =
@@ -1617,9 +1637,10 @@
uCurHAlignState = uHAlign;
}
if (pLayoutNext->GetFormNode()->PresenceRequiresSpace()) {
- if (pLayoutNext->m_sSize.height > fContentCurRowHeight)
- fContentCurRowHeight = pLayoutNext->m_sSize.height;
- fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width;
+ if (pLayoutNext->s_size_.height > fContentCurRowHeight) {
+ fContentCurRowHeight = pLayoutNext->s_size_.height;
+ }
+ fContentCurRowAvailWidth -= pLayoutNext->s_size_.width;
}
}
@@ -1633,25 +1654,26 @@
pLastChild = nullptr;
}
- while (m_pCurChildNode) {
+ while (cur_child_node_) {
CXFA_ContentLayoutProcessor* pProcessor = nullptr;
bool bAddedItemInRow = false;
fContentCurRowY += InsertPendingItems(GetFormNode());
- switch (m_nCurChildNodeStage) {
+ switch (cur_child_node_stage_) {
case Stage::kKeep:
case Stage::kNone:
break;
case Stage::kBreakBefore: {
- for (auto& item : m_ArrayKeepItems) {
- m_pLayoutItem->RemoveChild(item);
- calculated_size.height -= item->m_sSize.height;
+ for (auto& item : array_keep_items_) {
+ layout_item_->RemoveChild(item);
+ calculated_size.height -= item->s_size_.height;
}
- if (!bUseBreakControl || !m_pViewLayoutProcessor)
+ if (!bUseBreakControl || !view_layout_processor_) {
break;
+ }
std::optional<CXFA_ViewLayoutProcessor::BreakData> break_data =
- m_pViewLayoutProcessor->ProcessBreakBefore(m_pCurChildNode);
+ view_layout_processor_->ProcessBreakBefore(cur_child_node_);
if (!break_data.has_value() || !break_data.value().bCreatePage ||
GetFormNode()->GetElementType() == XFA_Element::Form) {
break;
@@ -1665,7 +1687,7 @@
if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
if (GetFormNode()->GetParent()->GetElementType() ==
XFA_Element::Form &&
- !m_pLayoutItem) {
+ !layout_item_) {
AddPendingNode(pTrailerNode, true);
} else {
auto* pTempProcessor =
@@ -1688,11 +1710,12 @@
goto SuspendAndCreateNewRow;
}
case Stage::kBreakAfter: {
- if (!bUseBreakControl || !m_pViewLayoutProcessor)
+ if (!bUseBreakControl || !view_layout_processor_) {
break;
+ }
std::optional<CXFA_ViewLayoutProcessor::BreakData> break_data =
- m_pViewLayoutProcessor->ProcessBreakAfter(m_pCurChildNode);
+ view_layout_processor_->ProcessBreakAfter(cur_child_node_);
if (!break_data.has_value() ||
GetFormNode()->GetElementType() == XFA_Element::Form) {
break;
@@ -1744,23 +1767,24 @@
if (bCreatePage) {
bForceEndPage = true;
bIsManualBreak = true;
- if (m_nCurChildNodeStage == Stage::kDone)
+ if (cur_child_node_stage_ == Stage::kDone) {
bBreakDone = true;
+ }
}
goto SuspendAndCreateNewRow;
}
case Stage::kBookendLeader: {
- if (m_pCurChildPreprocessor) {
- pProcessor = m_pCurChildPreprocessor.Get();
- m_pCurChildPreprocessor = nullptr;
- } else if (m_pViewLayoutProcessor) {
+ if (cur_child_preprocessor_) {
+ pProcessor = cur_child_preprocessor_.Get();
+ cur_child_preprocessor_ = nullptr;
+ } else if (view_layout_processor_) {
CXFA_Node* pLeaderNode =
- m_pViewLayoutProcessor->ProcessBookendLeader(m_pCurChildNode);
+ view_layout_processor_->ProcessBookendLeader(cur_child_node_);
if (pLeaderNode) {
pProcessor =
cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
GetHeap()->GetAllocationHandle(), GetHeap(), pLeaderNode,
- m_pViewLayoutProcessor);
+ view_layout_processor_);
}
}
@@ -1781,17 +1805,17 @@
break;
}
case Stage::kBookendTrailer: {
- if (m_pCurChildPreprocessor) {
- pProcessor = m_pCurChildPreprocessor;
- m_pCurChildPreprocessor.Clear();
- } else if (m_pViewLayoutProcessor) {
+ if (cur_child_preprocessor_) {
+ pProcessor = cur_child_preprocessor_;
+ cur_child_preprocessor_.Clear();
+ } else if (view_layout_processor_) {
CXFA_Node* pTrailerNode =
- m_pViewLayoutProcessor->ProcessBookendTrailer(m_pCurChildNode);
+ view_layout_processor_->ProcessBookendTrailer(cur_child_node_);
if (pTrailerNode) {
pProcessor =
cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
GetHeap()->GetAllocationHandle(), GetHeap(), pTrailerNode,
- m_pViewLayoutProcessor);
+ view_layout_processor_);
}
}
if (pProcessor) {
@@ -1811,30 +1835,32 @@
break;
}
case Stage::kContainer: {
- DCHECK(m_pCurChildNode->IsContainerNode());
- if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
+ DCHECK(cur_child_node_->IsContainerNode());
+ if (cur_child_node_->GetElementType() == XFA_Element::Variables) {
break;
+ }
if (fContentCurRowY >= fHeightLimit + kXFALayoutPrecision &&
- m_pCurChildNode->PresenceRequiresSpace()) {
+ cur_child_node_->PresenceRequiresSpace()) {
bForceEndPage = true;
goto SuspendAndCreateNewRow;
}
- if (!m_pCurChildNode->IsContainerNode())
+ if (!cur_child_node_->IsContainerNode()) {
break;
+ }
bool bNewRow = false;
- if (m_pCurChildPreprocessor) {
- pProcessor = m_pCurChildPreprocessor;
- m_pCurChildPreprocessor.Clear();
+ if (cur_child_preprocessor_) {
+ pProcessor = cur_child_preprocessor_;
+ cur_child_preprocessor_.Clear();
bNewRow = true;
} else {
pProcessor =
cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
GetHeap()->GetAllocationHandle(), GetHeap(),
- m_pCurChildNode, m_pViewLayoutProcessor);
+ cur_child_node_, view_layout_processor_);
}
- pProcessor->InsertPendingItems(m_pCurChildNode);
+ pProcessor->InsertPendingItems(cur_child_node_);
Result rs = InsertFlowedItem(
pProcessor, bContainerWidthAutoSize, bContainerHeightAutoSize,
container_size.height, eFlowStrategy, &uCurHAlignState,
@@ -1853,7 +1879,7 @@
goto SuspendAndCreateNewRow;
case Result::kDone:
fContentCurRowY +=
- pProcessor->InsertPendingItems(m_pCurChildNode);
+ pProcessor->InsertPendingItems(cur_child_node_);
pProcessor = nullptr;
break;
}
@@ -1868,7 +1894,7 @@
continue;
SuspendAndCreateNewRow:
if (pProcessor) {
- m_pCurChildPreprocessor = pProcessor;
+ cur_child_preprocessor_ = pProcessor;
pProcessor = nullptr;
}
break;
@@ -1879,13 +1905,13 @@
&calculated_size.width, &calculated_size.height,
&fContentCurRowY, fContentCurRowHeight,
fContentWidthLimit, bRootForceTb);
- m_fWidthLimit = fContentCurRowAvailWidth;
+ width_limit_ = fContentCurRowAvailWidth;
if (bForceEndPage)
break;
}
bool bRetValue =
- m_nCurChildNodeStage == Stage::kDone && m_PendingNodes.empty();
+ cur_child_node_stage_ == Stage::kDone && pending_nodes_.empty();
if (bBreakDone)
bRetValue = false;
@@ -1893,17 +1919,18 @@
GetFormNode(), bContainerWidthAutoSize, calculated_size.width,
bContainerHeightAutoSize, calculated_size.height, container_size);
- if (container_size.height >= kXFALayoutPrecision || m_pLayoutItem ||
+ if (container_size.height >= kXFALayoutPrecision || layout_item_ ||
bRetValue) {
- if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
+ if (!layout_item_) {
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
+ }
container_size.height = std::max(container_size.height, 0.f);
SetCurrentComponentSize(container_size);
if (bForceEndPage)
- m_fUsedSize = 0;
+ used_size_ = 0;
else
- m_fUsedSize += m_pLayoutItem->m_sSize.height;
+ used_size_ += layout_item_->s_size_.height;
}
if (bRetValue)
@@ -1930,7 +1957,7 @@
for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) {
nTotalLength++;
if (rgCurLineLayoutItems[i][j]->GetFormNode()->PresenceRequiresSpace())
- fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width;
+ fGroupWidths[i] += rgCurLineLayoutItems[i][j]->s_size_.width;
}
}
if (!nTotalLength) {
@@ -1940,94 +1967,95 @@
}
return false;
}
- if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
+ if (!layout_item_) {
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
+ }
if (eFlowStrategy != XFA_AttributeValue::Rl_tb) {
float fCurPos;
fCurPos = 0;
for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
if (bRootForceTb) {
- rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[0][j]->s_pos_ = CalculatePositionedContainerPos(
rgCurLineLayoutItems[0][j]->GetFormNode(),
- rgCurLineLayoutItems[0][j]->m_sSize);
+ rgCurLineLayoutItems[0][j]->s_size_);
} else {
- rgCurLineLayoutItems[0][j]->m_sPos =
+ rgCurLineLayoutItems[0][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
if (rgCurLineLayoutItems[0][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width;
+ fCurPos += rgCurLineLayoutItems[0][j]->s_size_.width;
}
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[0][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[0][j]);
+ last_row_width_ = fCurPos;
}
fCurPos = (fContentWidthLimit + fGroupWidths[0] - fGroupWidths[1] -
fGroupWidths[2]) /
2;
for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
if (bRootForceTb) {
- rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[1][j]->s_pos_ = CalculatePositionedContainerPos(
rgCurLineLayoutItems[1][j]->GetFormNode(),
- rgCurLineLayoutItems[1][j]->m_sSize);
+ rgCurLineLayoutItems[1][j]->s_size_);
} else {
- rgCurLineLayoutItems[1][j]->m_sPos =
+ rgCurLineLayoutItems[1][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
if (rgCurLineLayoutItems[1][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width;
+ fCurPos += rgCurLineLayoutItems[1][j]->s_size_.width;
}
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[1][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[1][j]);
+ last_row_width_ = fCurPos;
}
fCurPos = fContentWidthLimit - fGroupWidths[2];
for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
if (bRootForceTb) {
- rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[2][j]->s_pos_ = CalculatePositionedContainerPos(
rgCurLineLayoutItems[2][j]->GetFormNode(),
- rgCurLineLayoutItems[2][j]->m_sSize);
+ rgCurLineLayoutItems[2][j]->s_size_);
} else {
- rgCurLineLayoutItems[2][j]->m_sPos =
+ rgCurLineLayoutItems[2][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
if (rgCurLineLayoutItems[2][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width;
+ fCurPos += rgCurLineLayoutItems[2][j]->s_size_.width;
}
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[2][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[2][j]);
+ last_row_width_ = fCurPos;
}
} else {
float fCurPos;
fCurPos = fGroupWidths[0];
for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
if (rgCurLineLayoutItems[0][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width;
+ fCurPos -= rgCurLineLayoutItems[0][j]->s_size_.width;
- rgCurLineLayoutItems[0][j]->m_sPos =
+ rgCurLineLayoutItems[0][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[0][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[0][j]);
+ last_row_width_ = fCurPos;
}
fCurPos = (fContentWidthLimit + fGroupWidths[0] + fGroupWidths[1] -
fGroupWidths[2]) /
2;
for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
if (rgCurLineLayoutItems[1][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width;
+ fCurPos -= rgCurLineLayoutItems[1][j]->s_size_.width;
- rgCurLineLayoutItems[1][j]->m_sPos =
+ rgCurLineLayoutItems[1][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[1][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[1][j]);
+ last_row_width_ = fCurPos;
}
fCurPos = fContentWidthLimit;
for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
if (rgCurLineLayoutItems[2][j]->GetFormNode()->PresenceRequiresSpace())
- fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width;
+ fCurPos -= rgCurLineLayoutItems[2][j]->s_size_.width;
- rgCurLineLayoutItems[2][j]->m_sPos =
+ rgCurLineLayoutItems[2][j]->s_pos_ =
CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AppendLastChild(rgCurLineLayoutItems[2][j]);
- m_fLastRowWidth = fCurPos;
+ layout_item_->AppendLastChild(rgCurLineLayoutItems[2][j]);
+ last_row_width_ = fCurPos;
}
}
- m_fLastRowY = *fContentCurRowY;
+ last_row_y_ = *fContentCurRowY;
*fContentCurRowY += fContentCurRowHeight;
if (bContainerWidthAutoSize) {
float fChildSuppliedWidth = fGroupWidths[0];
@@ -2059,13 +2087,15 @@
}
void CXFA_ContentLayoutProcessor::DoLayoutField() {
- if (m_pLayoutItem)
+ if (layout_item_) {
return;
+ }
- DCHECK(!m_pCurChildNode);
- m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
- if (!m_pLayoutItem)
+ DCHECK(!cur_child_node_);
+ layout_item_ = CreateContentLayoutItem(GetFormNode());
+ if (!layout_item_) {
return;
+ }
CXFA_Document* pDocument = GetFormNode()->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
@@ -2113,18 +2143,18 @@
case XFA_AttributeValue::Rl_row:
default:
DoLayoutPositionedContainer(pContext);
- m_nCurChildNodeStage = Stage::kDone;
+ cur_child_node_stage_ = Stage::kDone;
return Result::kDone;
case XFA_AttributeValue::Table:
DoLayoutTableContainer(pLayoutNode);
- m_nCurChildNodeStage = Stage::kDone;
+ cur_child_node_stage_ = Stage::kDone;
return Result::kDone;
}
}
case XFA_Element::Draw:
case XFA_Element::Field:
DoLayoutField();
- m_nCurChildNodeStage = Stage::kDone;
+ cur_child_node_stage_ = Stage::kDone;
return Result::kDone;
case XFA_Element::ContentArea:
default:
@@ -2133,17 +2163,17 @@
}
CFX_SizeF CXFA_ContentLayoutProcessor::GetCurrentComponentSize() {
- return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height);
+ return CFX_SizeF(layout_item_->s_size_.width, layout_item_->s_size_.height);
}
void CXFA_ContentLayoutProcessor::SetCurrentComponentPos(
const CFX_PointF& pos) {
- m_pLayoutItem->m_sPos = pos;
+ layout_item_->s_pos_ = pos;
}
void CXFA_ContentLayoutProcessor::SetCurrentComponentSize(
const CFX_SizeF& size) {
- m_pLayoutItem->m_sSize = size;
+ layout_item_->s_size_ = size;
}
bool CXFA_ContentLayoutProcessor::JudgeLeaderOrTrailerForOccur(
@@ -2164,11 +2194,11 @@
if (iMax < 0)
return true;
- int32_t iCount = m_PendingNodesCount[pTemplate];
+ int32_t iCount = pending_nodes_count_[pTemplate];
if (iCount >= iMax)
return false;
- m_PendingNodesCount[pTemplate] = iCount + 1;
+ pending_nodes_count_[pTemplate] = iCount + 1;
return true;
}
@@ -2179,7 +2209,7 @@
switch (eLayout) {
case XFA_AttributeValue::Row:
case XFA_AttributeValue::Rl_row:
- RelocateTableRowCells(pLayoutItem, m_rgSpecifiedColumnWidths, eLayout);
+ RelocateTableRowCells(pLayoutItem, rg_specified_column_widths_, eLayout);
break;
default:
break;
@@ -2193,7 +2223,7 @@
if (!pTrailerLayoutItem)
return;
- float fHeight = pTrailerLayoutItem->m_sSize.height;
+ float fHeight = pTrailerLayoutItem->s_size_.height;
if (bUseInherited) {
float fNewSplitPos = 0;
if (fSplitPos - fHeight > kXFALayoutPrecision)
@@ -2208,10 +2238,10 @@
GetFormNode()->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
CFX_FloatRect inset = GetMarginInset(pMargin);
if (!IsAddNewRowForTrailer(pTrailerLayoutItem)) {
- pTrailerLayoutItem->m_sPos.y = m_fLastRowY;
- pTrailerLayoutItem->m_sPos.x = m_fLastRowWidth;
- m_pLayoutItem->m_sSize.width += pTrailerLayoutItem->m_sSize.width;
- m_pLayoutItem->AppendLastChild(pTrailerLayoutItem);
+ pTrailerLayoutItem->s_pos_.y = last_row_y_;
+ pTrailerLayoutItem->s_pos_.x = last_row_width_;
+ layout_item_->s_size_.width += pTrailerLayoutItem->s_size_.width;
+ layout_item_->AppendLastChild(pTrailerLayoutItem);
return;
}
@@ -2221,31 +2251,30 @@
if (fNewSplitPos > kXFALayoutPrecision) {
SplitLayoutItem(fNewSplitPos);
- pTrailerLayoutItem->m_sPos.y = fNewSplitPos - inset.top - inset.bottom;
+ pTrailerLayoutItem->s_pos_.y = fNewSplitPos - inset.top - inset.bottom;
} else {
- pTrailerLayoutItem->m_sPos.y = fSplitPos - inset.top - inset.bottom;
+ pTrailerLayoutItem->s_pos_.y = fSplitPos - inset.top - inset.bottom;
}
switch (pTrailerLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeValue::Right:
- pTrailerLayoutItem->m_sPos.x = m_pLayoutItem->m_sSize.width -
- inset.right -
- pTrailerLayoutItem->m_sSize.width;
+ pTrailerLayoutItem->s_pos_.x = layout_item_->s_size_.width - inset.right -
+ pTrailerLayoutItem->s_size_.width;
break;
case XFA_AttributeValue::Center:
- pTrailerLayoutItem->m_sPos.x =
- (m_pLayoutItem->m_sSize.width - inset.left - inset.right -
- pTrailerLayoutItem->m_sSize.width) /
+ pTrailerLayoutItem->s_pos_.x =
+ (layout_item_->s_size_.width - inset.left - inset.right -
+ pTrailerLayoutItem->s_size_.width) /
2;
break;
case XFA_AttributeValue::Left:
default:
- pTrailerLayoutItem->m_sPos.x = inset.left;
+ pTrailerLayoutItem->s_pos_.x = inset.left;
break;
}
- m_pLayoutItem->m_sSize.height += fHeight;
- m_pLayoutItem->AppendLastChild(pTrailerLayoutItem);
+ layout_item_->s_size_.height += fHeight;
+ layout_item_->AppendLastChild(pTrailerLayoutItem);
}
void CXFA_ContentLayoutProcessor::AddLeaderAfterSplit(
@@ -2263,69 +2292,71 @@
XFA_Attribute::RightInset, XFA_Unit::Pt);
}
- float fHeight = pLeaderLayoutItem->m_sSize.height;
- for (CXFA_LayoutItem* pIter = m_pLayoutItem->GetFirstChild(); pIter;
+ float fHeight = pLeaderLayoutItem->s_size_.height;
+ for (CXFA_LayoutItem* pIter = layout_item_->GetFirstChild(); pIter;
pIter = pIter->GetNextSibling()) {
CXFA_ContentLayoutItem* pContentItem = pIter->AsContentLayoutItem();
if (!pContentItem)
continue;
- pContentItem->m_sPos.y += fHeight;
+ pContentItem->s_pos_.y += fHeight;
}
- pLeaderLayoutItem->m_sPos.y = 0;
+ pLeaderLayoutItem->s_pos_.y = 0;
switch (pLeaderLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeValue::Right:
- pLeaderLayoutItem->m_sPos.x = m_pLayoutItem->m_sSize.width - fRightInset -
- pLeaderLayoutItem->m_sSize.width;
+ pLeaderLayoutItem->s_pos_.x = layout_item_->s_size_.width - fRightInset -
+ pLeaderLayoutItem->s_size_.width;
break;
case XFA_AttributeValue::Center:
- pLeaderLayoutItem->m_sPos.x =
- (m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset -
- pLeaderLayoutItem->m_sSize.width) /
+ pLeaderLayoutItem->s_pos_.x =
+ (layout_item_->s_size_.width - fLeftInset - fRightInset -
+ pLeaderLayoutItem->s_size_.width) /
2;
break;
case XFA_AttributeValue::Left:
default:
- pLeaderLayoutItem->m_sPos.x = fLeftInset;
+ pLeaderLayoutItem->s_pos_.x = fLeftInset;
break;
}
- m_pLayoutItem->m_sSize.height += fHeight;
- m_pLayoutItem->AppendLastChild(pLeaderLayoutItem);
+ layout_item_->s_size_.height += fHeight;
+ layout_item_->AppendLastChild(pLeaderLayoutItem);
}
void CXFA_ContentLayoutProcessor::AddPendingNode(CXFA_Node* pPendingNode,
bool bBreakPending) {
- m_PendingNodes.push_back(pPendingNode);
- m_bBreakPending = bBreakPending;
+ pending_nodes_.push_back(pPendingNode);
+ break_pending_ = bBreakPending;
}
float CXFA_ContentLayoutProcessor::InsertPendingItems(
CXFA_Node* pCurChildNode) {
float fTotalHeight = 0;
- if (m_PendingNodes.empty())
+ if (pending_nodes_.empty()) {
return fTotalHeight;
-
- if (!m_pLayoutItem) {
- m_pLayoutItem = CreateContentLayoutItem(pCurChildNode);
- m_pLayoutItem->m_sSize.clear();
}
- while (!m_PendingNodes.empty()) {
+ if (!layout_item_) {
+ layout_item_ = CreateContentLayoutItem(pCurChildNode);
+ layout_item_->s_size_.clear();
+ }
+
+ while (!pending_nodes_.empty()) {
auto* pPendingProcessor =
cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
- GetHeap()->GetAllocationHandle(), GetHeap(), m_PendingNodes.front(),
+ GetHeap()->GetAllocationHandle(), GetHeap(), pending_nodes_.front(),
nullptr);
- m_PendingNodes.pop_front();
+ pending_nodes_.pop_front();
pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX);
CXFA_ContentLayoutItem* pPendingLayoutItem = nullptr;
if (pPendingProcessor->HasLayoutItem())
pPendingLayoutItem = pPendingProcessor->ExtractLayoutItem();
if (pPendingLayoutItem) {
AddLeaderAfterSplit(pPendingLayoutItem);
- if (m_bBreakPending)
- fTotalHeight += pPendingLayoutItem->m_sSize.height;
+ if (break_pending_) {
+ fTotalHeight += pPendingLayoutItem->s_size_.height;
+ }
}
}
return fTotalHeight;
@@ -2353,7 +2384,7 @@
bool bNewRow) {
bool bTakeSpace = pProcessor->GetFormNode()->PresenceRequiresSpace();
uint8_t uHAlign = HAlignEnumToInt(
- m_pCurChildNode->JSObject()->GetEnum(XFA_Attribute::HAlign));
+ cur_child_node_->JSObject()->GetEnum(XFA_Attribute::HAlign));
if (bContainerWidthAutoSize)
uHAlign = 0;
@@ -2383,27 +2414,27 @@
bool bUseInherited = false;
Context layoutContext;
- if (m_pViewLayoutProcessor) {
+ if (view_layout_processor_) {
CXFA_Node* pOverflowNode =
- m_pViewLayoutProcessor->QueryOverflow(GetFormNode());
+ view_layout_processor_->QueryOverflow(GetFormNode());
if (pOverflowNode) {
- layoutContext.m_pOverflowNode = pOverflowNode;
- layoutContext.m_pOverflowProcessor = this;
+ layoutContext.overflow_node_ = pOverflowNode;
+ layoutContext.overflow_processor_ = this;
pLayoutContext = &layoutContext;
}
}
Result eRetValue = Result::kDone;
- if (!bNewRow || pProcessor->m_ePreProcessRs == Result::kDone) {
+ if (!bNewRow || pProcessor->pre_process_rs_ == Result::kDone) {
eRetValue = pProcessor->DoLayoutInternal(
bTakeSpace && bUseBreakControl,
bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
bIsTransHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
pLayoutContext);
- pProcessor->m_ePreProcessRs = eRetValue;
+ pProcessor->pre_process_rs_ = eRetValue;
} else {
- eRetValue = pProcessor->m_ePreProcessRs;
- pProcessor->m_ePreProcessRs = Result::kDone;
+ eRetValue = pProcessor->pre_process_rs_;
+ pProcessor->pre_process_rs_ = Result::kDone;
}
if (!pProcessor->HasLayoutItem())
return eRetValue;
@@ -2424,16 +2455,16 @@
CXFA_Node* pFormNode = nullptr;
CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr;
bool bIsAddTrailerHeight = false;
- if (m_pViewLayoutProcessor &&
+ if (view_layout_processor_ &&
pProcessor->GetFormNode()->GetIntact() == XFA_AttributeValue::None) {
pFormNode =
- m_pViewLayoutProcessor->QueryOverflow(pProcessor->GetFormNode());
- if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
- pFormNode = pLayoutContext->m_pOverflowNode;
+ view_layout_processor_->QueryOverflow(pProcessor->GetFormNode());
+ if (!pFormNode && pLayoutContext && pLayoutContext->overflow_processor_) {
+ pFormNode = pLayoutContext->overflow_node_;
bUseInherited = true;
}
std::optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
- m_pViewLayoutProcessor->ProcessOverflow(pFormNode, false);
+ view_layout_processor_->ProcessOverflow(pFormNode, false);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
@@ -2455,7 +2486,7 @@
? IsAddNewRowForTrailer(pTrailerLayoutItem)
: pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem);
if (bIsAddTrailerHeight) {
- childSize.height += pTrailerLayoutItem->m_sSize.height;
+ childSize.height += pTrailerLayoutItem->s_size_.height;
bIsAddTrailerHeight = true;
}
}
@@ -2466,19 +2497,19 @@
*fContentCurRowY + childSize.height <=
fAvailHeight + kXFALayoutPrecision ||
(!bContainerHeightAutoSize &&
- m_fUsedSize + fAvailHeight + kXFALayoutPrecision >= fContainerHeight)) {
+ used_size_ + fAvailHeight + kXFALayoutPrecision >= fContainerHeight)) {
if (!bTakeSpace || eRetValue == Result::kDone) {
- if (pProcessor->m_bUseInherited) {
+ if (pProcessor->use_inherited_) {
if (pTrailerLayoutItem)
pProcessor->AddTrailerBeforeSplit(childSize.height,
pTrailerLayoutItem, false);
if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
pProcessor->AddPendingNode(pOverflowLeaderNode, false);
- pProcessor->m_bUseInherited = false;
+ pProcessor->use_inherited_ = false;
} else {
if (bIsAddTrailerHeight)
- childSize.height -= pTrailerLayoutItem->m_sSize.height;
+ childSize.height -= pTrailerLayoutItem->s_size_.height;
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
pOverflowTrailerNode,
@@ -2489,9 +2520,9 @@
pProcessor->ExtractLayoutItem();
if (ExistContainerKeep(pProcessor->GetFormNode(), false) &&
pProcessor->GetFormNode()->GetIntact() == XFA_AttributeValue::None) {
- m_ArrayKeepItems.push_back(pChildLayoutItem);
+ array_keep_items_.push_back(pChildLayoutItem);
} else {
- m_ArrayKeepItems.clear();
+ array_keep_items_.clear();
}
rgCurLineLayoutItems[uHAlign].push_back(pChildLayoutItem);
*bAddedItemInRow = true;
@@ -2504,7 +2535,7 @@
}
if (eRetValue == Result::kPageFullBreak) {
- if (pProcessor->m_bUseInherited) {
+ if (pProcessor->use_inherited_) {
if (pTrailerLayoutItem) {
pProcessor->AddTrailerBeforeSplit(childSize.height,
pTrailerLayoutItem, false);
@@ -2512,10 +2543,10 @@
if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
pProcessor->AddPendingNode(pOverflowLeaderNode, false);
- pProcessor->m_bUseInherited = false;
+ pProcessor->use_inherited_ = false;
} else {
if (bIsAddTrailerHeight)
- childSize.height -= pTrailerLayoutItem->m_sSize.height;
+ childSize.height -= pTrailerLayoutItem->s_size_.height;
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
pOverflowTrailerNode,
@@ -2556,9 +2587,9 @@
return Result::kPageFullBreak;
}
- if (m_pViewLayoutProcessor && !pProcessor->m_bUseInherited &&
+ if (view_layout_processor_ && !pProcessor->use_inherited_ &&
eRetValue != Result::kPageFullBreak) {
- m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
+ view_layout_processor_->ProcessOverflow(pFormNode, true);
}
if (pTrailerLayoutItem && bIsAddTrailerHeight) {
pProcessor->AddTrailerBeforeSplit(fSplitPos, pTrailerLayoutItem,
@@ -2571,9 +2602,9 @@
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
pOverflowTrailerNode, pTrailerLayoutItem,
pFormNode);
- m_bUseInherited = true;
+ use_inherited_ = true;
} else {
- CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->GetFirstChild();
+ CXFA_LayoutItem* firstChild = pProcessor->layout_item_->GetFirstChild();
if (firstChild && !firstChild->GetNextSibling() &&
firstChild->GetFormNode()->IsLayoutGeneratedNode()) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
@@ -2585,7 +2616,7 @@
}
}
- if (pProcessor->m_pLayoutItem->GetNextSibling()) {
+ if (pProcessor->layout_item_->GetNextSibling()) {
childSize = pProcessor->GetCurrentComponentSize();
rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem());
*bAddedItemInRow = true;
@@ -2600,19 +2631,19 @@
if (*fContentCurRowY <= kXFALayoutPrecision) {
childSize = pProcessor->GetCurrentComponentSize();
- if (pProcessor->m_pViewLayoutProcessor->GetNextAvailContentHeight(
+ if (pProcessor->view_layout_processor_->GetNextAvailContentHeight(
childSize.height)) {
- if (m_pViewLayoutProcessor) {
+ if (view_layout_processor_) {
if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
+ pFormNode = pLayoutContext->overflow_processor_->GetFormNode();
- m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
+ view_layout_processor_->ProcessOverflow(pFormNode, true);
}
if (bUseInherited) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
pOverflowTrailerNode,
pTrailerLayoutItem, pFormNode);
- m_bUseInherited = true;
+ use_inherited_ = true;
}
return Result::kPageFullBreak;
}
@@ -2633,9 +2664,9 @@
pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
if (pProcessor->GetFormNode()->GetIntact() == XFA_AttributeValue::None &&
eLayout == XFA_AttributeValue::Tb) {
- if (m_pViewLayoutProcessor) {
+ if (view_layout_processor_) {
std::optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
- m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
+ view_layout_processor_->ProcessOverflow(pFormNode, true);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
@@ -2653,10 +2684,10 @@
return Result::kPageFullBreak;
if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
- if (m_pViewLayoutProcessor) {
+ pFormNode = pLayoutContext->overflow_processor_->GetFormNode();
+ if (view_layout_processor_) {
std::optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
- m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
+ view_layout_processor_->ProcessOverflow(pFormNode, true);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
@@ -2665,7 +2696,7 @@
if (bUseInherited) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode,
pTrailerLayoutItem, pFormNode);
- m_bUseInherited = true;
+ use_inherited_ = true;
}
return Result::kPageFullBreak;
}
@@ -2673,8 +2704,9 @@
std::optional<CXFA_ContentLayoutProcessor::Stage>
CXFA_ContentLayoutProcessor::HandleKeep(CXFA_Node* pBreakAfterNode,
CXFA_Node** pCurActionNode) {
- if (m_bKeepBreakFinish)
+ if (keep_break_finish_) {
return std::nullopt;
+ }
return FindBreakAfterNode(pBreakAfterNode, pCurActionNode);
}
@@ -2704,14 +2736,15 @@
return std::nullopt;
CXFA_Node* pBreakBeforeNode = (*pCurActionNode)->GetNextSibling();
- if (!m_bKeepBreakFinish) {
+ if (!keep_break_finish_) {
std::optional<Stage> ret =
FindBreakBeforeNode(pBreakBeforeNode, pCurActionNode);
if (ret.has_value())
return ret.value();
}
- if (m_bIsProcessKeep)
+ if (is_process_keep_) {
return ProcessKeepNodesForBreakBefore(pCurActionNode, pChildContainer);
+ }
*pCurActionNode = pChildContainer;
return Stage::kContainer;
@@ -2752,14 +2785,14 @@
if (ret.has_value())
return ret.value();
- if (!m_bKeepBreakFinish && !bLastKeep) {
+ if (!keep_break_finish_ && !bLastKeep) {
ret = FindBreakBeforeNode(pNextChildContainer->GetFirstChild(),
pCurActionNode);
if (ret.has_value())
return ret.value();
}
*pCurActionNode = pNextChildContainer;
- return m_bIsProcessKeep ? Stage::kKeep : Stage::kContainer;
+ return is_process_keep_ ? Stage::kKeep : Stage::kContainer;
}
std::optional<CXFA_ContentLayoutProcessor::Stage>
@@ -2782,10 +2815,10 @@
}
void CXFA_ContentLayoutProcessor::ProcessKeepNodesEnd() {
- m_bKeepBreakFinish = true;
- m_pKeepHeadNode = nullptr;
- m_pKeepTailNode = nullptr;
- m_bIsProcessKeep = false;
+ keep_break_finish_ = true;
+ keep_head_node_ = nullptr;
+ keep_tail_node_ = nullptr;
+ is_process_keep_ = false;
}
void CXFA_ContentLayoutProcessor::AdjustContainerSpecifiedSize(
@@ -2793,14 +2826,14 @@
CFX_SizeF* pSize,
bool* pContainerWidthAutoSize,
bool* pContainerHeightAutoSize) {
- if (pContext && pContext->m_fCurColumnWidth.has_value()) {
- pSize->width = pContext->m_fCurColumnWidth.value();
+ if (pContext && pContext->cur_column_width_.has_value()) {
+ pSize->width = pContext->cur_column_width_.value();
*pContainerWidthAutoSize = false;
}
if (*pContainerHeightAutoSize)
return;
- pSize->height -= m_fUsedSize;
+ pSize->height -= used_size_;
CXFA_Node* pParentNode = GetFormNode()->GetParent();
bool bFocrTb = false;
if (!pParentNode ||
@@ -2818,18 +2851,19 @@
CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::FindLastContentLayoutItem(
XFA_AttributeValue eFlowStrategy) {
- if (m_nCurChildNodeStage == Stage::kDone ||
+ if (cur_child_node_stage_ == Stage::kDone ||
eFlowStrategy == XFA_AttributeValue::Tb) {
return nullptr;
}
CXFA_ContentLayoutItem* pLastChild =
- ToContentLayoutItem(m_pLayoutItem->GetFirstChild());
+ ToContentLayoutItem(layout_item_->GetFirstChild());
for (CXFA_LayoutItem* pNext = pLastChild; pNext;
pNext = pNext->GetNextSibling()) {
CXFA_ContentLayoutItem* pContentNext = pNext->AsContentLayoutItem();
- if (pContentNext && pContentNext->m_sPos.y != pLastChild->m_sPos.y)
+ if (pContentNext && pContentNext->s_pos_.y != pLastChild->s_pos_.y) {
pLastChild = pContentNext;
+ }
}
return pLastChild;
}
@@ -2837,14 +2871,14 @@
CFX_SizeF CXFA_ContentLayoutProcessor::CalculateLayoutItemSize(
const CXFA_ContentLayoutItem* pLastChild) {
CFX_SizeF size;
- for (CXFA_LayoutItem* pChild = m_pLayoutItem->GetFirstChild();
+ for (CXFA_LayoutItem* pChild = layout_item_->GetFirstChild();
pChild != pLastChild; pChild = pChild->GetNextSibling()) {
CXFA_ContentLayoutItem* pLayout = pChild->AsContentLayoutItem();
if (!pLayout || !pLayout->GetFormNode()->PresenceRequiresSpace())
continue;
- float fWidth = pLayout->m_sPos.x + pLayout->m_sSize.width;
- float fHeight = pLayout->m_sPos.y + pLayout->m_sSize.height;
+ float fWidth = pLayout->s_pos_.x + pLayout->s_size_.width;
+ float fHeight = pLayout->s_pos_.y + pLayout->s_size_.height;
size.width = std::max(size.width, fWidth);
size.height = std::max(size.height, fHeight);
}
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
index f11e3c5..31fcce7 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
@@ -57,12 +57,12 @@
~CXFA_ContentLayoutProcessor();
void Trace(cppgc::Visitor* visitor) const;
- cppgc::Heap* GetHeap() const { return m_pHeap; }
+ cppgc::Heap* GetHeap() const { return heap_; }
Result DoLayout(bool bUseBreakControl, float fHeightLimit, float fRealHeight);
void DoLayoutPageArea(CXFA_ViewLayoutItem* pPageAreaLayoutItem);
- CXFA_Node* GetFormNode() { return m_pFormNode; }
+ CXFA_Node* GetFormNode() { return form_node_; }
CXFA_ContentLayoutItem* ExtractLayoutItem();
private:
@@ -73,10 +73,10 @@
Context();
~Context();
- std::optional<float> m_fCurColumnWidth;
- UnownedPtr<std::vector<float>> m_prgSpecifiedColumnWidths;
- UnownedPtr<CXFA_ContentLayoutProcessor> m_pOverflowProcessor; // OK, stack
- UnownedPtr<CXFA_Node> m_pOverflowNode; // Ok, stack
+ std::optional<float> cur_column_width_;
+ UnownedPtr<std::vector<float>> prg_specified_column_widths_;
+ UnownedPtr<CXFA_ContentLayoutProcessor> overflow_processor_; // OK, stack
+ UnownedPtr<CXFA_Node> overflow_node_; // Ok, stack
};
using ContentLayoutItemVector =
@@ -92,7 +92,7 @@
Context* pContext);
CFX_SizeF GetCurrentComponentSize();
- bool HasLayoutItem() const { return !!m_pLayoutItem; }
+ bool HasLayoutItem() const { return !!layout_item_; }
void SplitLayoutItem(float fSplitPos);
float FindSplitPos(float fProposedSplitPos);
bool ProcessKeepForSplit(CXFA_ContentLayoutProcessor* pChildProcessor,
@@ -215,30 +215,30 @@
XFA_AttributeValue eFlowStrategy);
CFX_SizeF CalculateLayoutItemSize(const CXFA_ContentLayoutItem* pLayoutChild);
- Stage m_nCurChildNodeStage = Stage::kNone;
- Result m_ePreProcessRs = Result::kDone;
- bool m_bBreakPending = true;
- bool m_bUseInherited = false;
- bool m_bKeepBreakFinish = false;
- bool m_bIsProcessKeep = false;
- bool m_bHasAvailHeight = true;
- float m_fUsedSize = 0;
- float m_fLastRowWidth = 0;
- float m_fLastRowY = 0;
- float m_fWidthLimit = 0;
- UnownedPtr<cppgc::Heap> m_pHeap;
- cppgc::Member<CXFA_Node> const m_pFormNode;
- cppgc::Member<CXFA_Node> m_pCurChildNode;
- cppgc::Member<CXFA_Node> m_pKeepHeadNode;
- cppgc::Member<CXFA_Node> m_pKeepTailNode;
- cppgc::Member<CXFA_ContentLayoutItem> m_pLayoutItem;
- cppgc::Member<CXFA_ContentLayoutItem> m_pOldLayoutItem;
- cppgc::Member<CXFA_ViewLayoutProcessor> m_pViewLayoutProcessor;
- cppgc::Member<CXFA_ContentLayoutProcessor> m_pCurChildPreprocessor;
- std::vector<float> m_rgSpecifiedColumnWidths;
- std::vector<cppgc::Member<CXFA_ContentLayoutItem>> m_ArrayKeepItems;
- std::list<cppgc::Member<CXFA_Node>> m_PendingNodes;
- std::map<cppgc::Member<CXFA_Node>, int32_t> m_PendingNodesCount;
+ Stage cur_child_node_stage_ = Stage::kNone;
+ Result pre_process_rs_ = Result::kDone;
+ bool break_pending_ = true;
+ bool use_inherited_ = false;
+ bool keep_break_finish_ = false;
+ bool is_process_keep_ = false;
+ bool has_avail_height_ = true;
+ float used_size_ = 0;
+ float last_row_width_ = 0;
+ float last_row_y_ = 0;
+ float width_limit_ = 0;
+ UnownedPtr<cppgc::Heap> heap_;
+ cppgc::Member<CXFA_Node> const form_node_;
+ cppgc::Member<CXFA_Node> cur_child_node_;
+ cppgc::Member<CXFA_Node> keep_head_node_;
+ cppgc::Member<CXFA_Node> keep_tail_node_;
+ cppgc::Member<CXFA_ContentLayoutItem> layout_item_;
+ cppgc::Member<CXFA_ContentLayoutItem> old_layout_item_;
+ cppgc::Member<CXFA_ViewLayoutProcessor> view_layout_processor_;
+ cppgc::Member<CXFA_ContentLayoutProcessor> cur_child_preprocessor_;
+ std::vector<float> rg_specified_column_widths_;
+ std::vector<cppgc::Member<CXFA_ContentLayoutItem>> array_keep_items_;
+ std::list<cppgc::Member<CXFA_Node>> pending_nodes_;
+ std::map<cppgc::Member<CXFA_Node>, int32_t> pending_nodes_count_;
};
#endif // XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/layout/cxfa_layoutitem.cpp b/xfa/fxfa/layout/cxfa_layoutitem.cpp
index 9b7dcca..e068b55 100644
--- a/xfa/fxfa/layout/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/layout/cxfa_layoutitem.cpp
@@ -34,22 +34,23 @@
}
CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, ItemType type)
- : m_ItemType(type), m_pFormNode(pNode) {}
+ : item_type_(type), form_node_(pNode) {}
CXFA_LayoutItem::~CXFA_LayoutItem() = default;
void CXFA_LayoutItem::PreFinalize() {
- if (!m_pFormNode)
+ if (!form_node_) {
return;
+ }
- auto* pJSObj = m_pFormNode->JSObject();
+ auto* pJSObj = form_node_->JSObject();
if (pJSObj && pJSObj->GetLayoutItem() == this)
pJSObj->SetLayoutItem(nullptr);
}
void CXFA_LayoutItem::Trace(cppgc::Visitor* visitor) const {
GCedTreeNode<CXFA_LayoutItem>::Trace(visitor);
- visitor->Trace(m_pFormNode);
+ visitor->Trace(form_node_);
}
CXFA_ViewLayoutItem* CXFA_LayoutItem::AsViewLayoutItem() {
@@ -75,13 +76,14 @@
const CXFA_ViewLayoutItem* CXFA_LayoutItem::GetPage() const {
for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode;
pCurNode = pCurNode->GetParent()) {
- if (pCurNode->m_pFormNode->GetElementType() == XFA_Element::PageArea)
+ if (pCurNode->form_node_->GetElementType() == XFA_Element::PageArea) {
return pCurNode->AsViewLayoutItem();
+ }
}
return nullptr;
}
void CXFA_LayoutItem::SetFormNode(CXFA_Node* pNode) {
// Not in header, assignment requires complete type, not just forward decl.
- m_pFormNode = pNode;
+ form_node_ = pNode;
}
diff --git a/xfa/fxfa/layout/cxfa_layoutitem.h b/xfa/fxfa/layout/cxfa_layoutitem.h
index e372196..0b782b9 100644
--- a/xfa/fxfa/layout/cxfa_layoutitem.h
+++ b/xfa/fxfa/layout/cxfa_layoutitem.h
@@ -29,15 +29,15 @@
// GCedTreeNode:
void Trace(cppgc::Visitor* visitor) const override;
- bool IsViewLayoutItem() const { return m_ItemType == kViewItem; }
- bool IsContentLayoutItem() const { return m_ItemType == kContentItem; }
+ bool IsViewLayoutItem() const { return item_type_ == kViewItem; }
+ bool IsContentLayoutItem() const { return item_type_ == kContentItem; }
CXFA_ViewLayoutItem* AsViewLayoutItem();
const CXFA_ViewLayoutItem* AsViewLayoutItem() const;
CXFA_ContentLayoutItem* AsContentLayoutItem();
const CXFA_ContentLayoutItem* AsContentLayoutItem() const;
const CXFA_ViewLayoutItem* GetPage() const;
- CXFA_Node* GetFormNode() const { return m_pFormNode; }
+ CXFA_Node* GetFormNode() const { return form_node_; }
void SetFormNode(CXFA_Node* pNode);
protected:
@@ -45,8 +45,8 @@
CXFA_LayoutItem(CXFA_Node* pNode, ItemType type);
private:
- const ItemType m_ItemType;
- cppgc::Member<CXFA_Node> m_pFormNode;
+ const ItemType item_type_;
+ cppgc::Member<CXFA_Node> form_node_;
};
inline CXFA_ViewLayoutItem* ToViewLayoutItem(CXFA_LayoutItem* item) {
diff --git a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
index 5ad17b8..c907335 100644
--- a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
@@ -26,19 +26,18 @@
return static_cast<CXFA_LayoutProcessor*>(pXFADoc->GetLayoutProcessor());
}
-CXFA_LayoutProcessor::CXFA_LayoutProcessor(cppgc::Heap* pHeap)
- : m_pHeap(pHeap) {}
+CXFA_LayoutProcessor::CXFA_LayoutProcessor(cppgc::Heap* pHeap) : heap_(pHeap) {}
CXFA_LayoutProcessor::~CXFA_LayoutProcessor() = default;
void CXFA_LayoutProcessor::Trace(cppgc::Visitor* visitor) const {
CXFA_Document::LayoutProcessorIface::Trace(visitor);
- visitor->Trace(m_pViewLayoutProcessor);
- visitor->Trace(m_pContentLayoutProcessor);
+ visitor->Trace(view_layout_processor_);
+ visitor->Trace(content_layout_processor_);
}
void CXFA_LayoutProcessor::SetForceRelayout() {
- m_bNeedLayout = true;
+ need_layout_ = true;
}
int32_t CXFA_LayoutProcessor::StartLayout() {
@@ -46,8 +45,8 @@
}
int32_t CXFA_LayoutProcessor::RestartLayout() {
- m_pContentLayoutProcessor = nullptr;
- m_nProgressCounter = 0;
+ content_layout_processor_ = nullptr;
+ progress_counter_ = 0;
CXFA_Node* pFormPacketNode =
ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form));
if (!pFormPacketNode)
@@ -58,77 +57,80 @@
if (!pFormRoot)
return -1;
- if (!m_pViewLayoutProcessor) {
- m_pViewLayoutProcessor =
+ if (!view_layout_processor_) {
+ view_layout_processor_ =
cppgc::MakeGarbageCollected<CXFA_ViewLayoutProcessor>(
GetHeap()->GetAllocationHandle(), GetHeap(), this);
}
- if (!m_pViewLayoutProcessor->InitLayoutPage(pFormRoot))
+ if (!view_layout_processor_->InitLayoutPage(pFormRoot)) {
return -1;
+ }
- if (!m_pViewLayoutProcessor->PrepareFirstPage(pFormRoot))
+ if (!view_layout_processor_->PrepareFirstPage(pFormRoot)) {
return -1;
+ }
- m_pContentLayoutProcessor =
+ content_layout_processor_ =
cppgc::MakeGarbageCollected<CXFA_ContentLayoutProcessor>(
GetHeap()->GetAllocationHandle(), GetHeap(), pFormRoot,
- m_pViewLayoutProcessor);
- m_nProgressCounter = 1;
+ view_layout_processor_);
+ progress_counter_ = 1;
return 0;
}
int32_t CXFA_LayoutProcessor::DoLayout() {
- if (m_nProgressCounter < 1)
+ if (progress_counter_ < 1) {
return -1;
+ }
CXFA_ContentLayoutProcessor::Result eStatus;
- CXFA_Node* pFormNode = m_pContentLayoutProcessor->GetFormNode();
+ CXFA_Node* pFormNode = content_layout_processor_->GetFormNode();
float fPosX =
pFormNode->JSObject()->GetMeasureInUnit(XFA_Attribute::X, XFA_Unit::Pt);
float fPosY =
pFormNode->JSObject()->GetMeasureInUnit(XFA_Attribute::Y, XFA_Unit::Pt);
do {
- float fAvailHeight = m_pViewLayoutProcessor->GetAvailHeight();
+ float fAvailHeight = view_layout_processor_->GetAvailHeight();
eStatus =
- m_pContentLayoutProcessor->DoLayout(true, fAvailHeight, fAvailHeight);
+ content_layout_processor_->DoLayout(true, fAvailHeight, fAvailHeight);
if (eStatus != CXFA_ContentLayoutProcessor::Result::kDone)
- m_nProgressCounter++;
+ progress_counter_++;
CXFA_ContentLayoutItem* pLayoutItem =
- m_pContentLayoutProcessor->ExtractLayoutItem();
+ content_layout_processor_->ExtractLayoutItem();
if (pLayoutItem)
- pLayoutItem->m_sPos = CFX_PointF(fPosX, fPosY);
+ pLayoutItem->s_pos_ = CFX_PointF(fPosX, fPosY);
- m_pViewLayoutProcessor->SubmitContentItem(pLayoutItem, eStatus);
+ view_layout_processor_->SubmitContentItem(pLayoutItem, eStatus);
} while (eStatus != CXFA_ContentLayoutProcessor::Result::kDone);
if (eStatus == CXFA_ContentLayoutProcessor::Result::kDone) {
- m_pViewLayoutProcessor->FinishPaginatedPageSets();
- m_pViewLayoutProcessor->SyncLayoutData();
- m_bHasChangedContainers = false;
- m_bNeedLayout = false;
+ view_layout_processor_->FinishPaginatedPageSets();
+ view_layout_processor_->SyncLayoutData();
+ has_changed_containers_ = false;
+ need_layout_ = false;
}
return 100 *
(eStatus == CXFA_ContentLayoutProcessor::Result::kDone
- ? m_nProgressCounter
- : m_nProgressCounter - 1) /
- m_nProgressCounter;
+ ? progress_counter_
+ : progress_counter_ - 1) /
+ progress_counter_;
}
bool CXFA_LayoutProcessor::IncrementLayout() {
- if (m_bNeedLayout) {
+ if (need_layout_) {
RestartLayout();
return DoLayout() == 100;
}
- return !m_bHasChangedContainers;
+ return !has_changed_containers_;
}
int32_t CXFA_LayoutProcessor::CountPages() const {
- return m_pViewLayoutProcessor ? m_pViewLayoutProcessor->GetPageCount() : 0;
+ return view_layout_processor_ ? view_layout_processor_->GetPageCount() : 0;
}
CXFA_ViewLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const {
- return m_pViewLayoutProcessor ? m_pViewLayoutProcessor->GetPage(index)
+ return view_layout_processor_ ? view_layout_processor_->GetPage(index)
: nullptr;
}
@@ -137,9 +139,9 @@
}
void CXFA_LayoutProcessor::SetHasChangedContainer() {
- m_bHasChangedContainers = true;
+ has_changed_containers_ = true;
}
bool CXFA_LayoutProcessor::NeedLayout() const {
- return m_bNeedLayout || m_bHasChangedContainers;
+ return need_layout_ || has_changed_containers_;
}
diff --git a/xfa/fxfa/layout/cxfa_layoutprocessor.h b/xfa/fxfa/layout/cxfa_layoutprocessor.h
index 8029891..2b0b399 100644
--- a/xfa/fxfa/layout/cxfa_layoutprocessor.h
+++ b/xfa/fxfa/layout/cxfa_layoutprocessor.h
@@ -46,25 +46,25 @@
CXFA_ViewLayoutItem* GetPage(int32_t index) const;
CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem);
CXFA_ContentLayoutProcessor* GetRootContentLayoutProcessor() const {
- return m_pContentLayoutProcessor;
+ return content_layout_processor_;
}
CXFA_ViewLayoutProcessor* GetLayoutPageMgr() const {
- return m_pViewLayoutProcessor;
+ return view_layout_processor_;
}
private:
explicit CXFA_LayoutProcessor(cppgc::Heap* pHeap);
- cppgc::Heap* GetHeap() { return m_pHeap; }
+ cppgc::Heap* GetHeap() { return heap_; }
bool NeedLayout() const;
int32_t RestartLayout();
- UnownedPtr<cppgc::Heap> const m_pHeap;
- cppgc::Member<CXFA_ViewLayoutProcessor> m_pViewLayoutProcessor;
- cppgc::Member<CXFA_ContentLayoutProcessor> m_pContentLayoutProcessor;
- uint32_t m_nProgressCounter = 0;
- bool m_bHasChangedContainers = false;
- bool m_bNeedLayout = true;
+ UnownedPtr<cppgc::Heap> const heap_;
+ cppgc::Member<CXFA_ViewLayoutProcessor> view_layout_processor_;
+ cppgc::Member<CXFA_ContentLayoutProcessor> content_layout_processor_;
+ uint32_t progress_counter_ = 0;
+ bool has_changed_containers_ = false;
+ bool need_layout_ = true;
};
#endif // XFA_FXFA_LAYOUT_CXFA_LAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp b/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
index 2269bc5..538c3b1 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
@@ -16,17 +16,18 @@
CXFA_ViewLayoutItem::CXFA_ViewLayoutItem(CXFA_Node* pNode,
CXFA_FFPageView* pPageView)
- : CXFA_LayoutItem(pNode, kViewItem), m_pFFPageView(pPageView) {
- if (m_pFFPageView)
- m_pFFPageView->SetLayoutItem(this);
+ : CXFA_LayoutItem(pNode, kViewItem), ffpage_view_(pPageView) {
+ if (ffpage_view_) {
+ ffpage_view_->SetLayoutItem(this);
+ }
}
CXFA_ViewLayoutItem::~CXFA_ViewLayoutItem() = default;
void CXFA_ViewLayoutItem::Trace(cppgc::Visitor* visitor) const {
CXFA_LayoutItem::Trace(visitor);
- visitor->Trace(m_pOldSubform);
- visitor->Trace(m_pFFPageView);
+ visitor->Trace(old_subform_);
+ visitor->Trace(ffpage_view_);
}
CXFA_LayoutProcessor* CXFA_ViewLayoutItem::GetLayout() const {
@@ -61,5 +62,5 @@
}
void CXFA_ViewLayoutItem::SetOldSubform(CXFA_Node* pSubform) {
- m_pOldSubform = pSubform;
+ old_subform_ = pSubform;
}
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutitem.h b/xfa/fxfa/layout/cxfa_viewlayoutitem.h
index 17ff635..76cc52f 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutitem.h
+++ b/xfa/fxfa/layout/cxfa_viewlayoutitem.h
@@ -22,19 +22,19 @@
void Trace(cppgc::Visitor* visitor) const override;
- CXFA_FFPageView* GetPageView() const { return m_pFFPageView; }
+ CXFA_FFPageView* GetPageView() const { return ffpage_view_; }
CXFA_LayoutProcessor* GetLayout() const;
int32_t GetPageIndex() const;
CFX_SizeF GetPageSize() const;
CXFA_Node* GetMasterPage() const;
- CXFA_Node* GetOldSubform() const { return m_pOldSubform; }
+ CXFA_Node* GetOldSubform() const { return old_subform_; }
void SetOldSubform(CXFA_Node* pSubform);
private:
CXFA_ViewLayoutItem(CXFA_Node* pNode, CXFA_FFPageView* pPageView);
- cppgc::Member<CXFA_FFPageView> const m_pFFPageView;
- cppgc::Member<CXFA_Node> m_pOldSubform;
+ cppgc::Member<CXFA_FFPageView> const ffpage_view_;
+ cppgc::Member<CXFA_Node> old_subform_;
};
#endif // XFA_FXFA_LAYOUT_CXFA_VIEWLAYOUTITEM_H_
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index 764b54c..9387b9d 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -265,7 +265,7 @@
pChild = pChild->GetNextSibling()) {
const CXFA_ContentLayoutItem* pContent = pChild->AsContentLayoutItem();
if (pContent)
- fHeight += pContent->m_sSize.height;
+ fHeight += pContent->s_size_.height;
}
return fHeight;
}
@@ -337,9 +337,9 @@
CXFA_ViewLayoutProcessor::CXFA_ViewLayoutProcessor(
cppgc::Heap* pHeap,
CXFA_LayoutProcessor* pLayoutProcessor)
- : m_pHeap(pHeap),
- m_pLayoutProcessor(pLayoutProcessor),
- m_CurrentViewRecordIter(m_ProposedViewRecords.end()) {}
+ : heap_(pHeap),
+ layout_processor_(pLayoutProcessor),
+ current_view_record_iter_(proposed_view_records_.end()) {}
CXFA_ViewLayoutProcessor::~CXFA_ViewLayoutProcessor() = default;
@@ -354,18 +354,19 @@
}
void CXFA_ViewLayoutProcessor::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pLayoutProcessor);
- visitor->Trace(m_pPageSetNode);
- visitor->Trace(m_pCurPageArea);
- visitor->Trace(m_pPageSetRootLayoutItem);
- visitor->Trace(m_pPageSetCurLayoutItem);
- ContainerTrace(visitor, m_ProposedViewRecords);
+ visitor->Trace(layout_processor_);
+ visitor->Trace(page_set_node_);
+ visitor->Trace(cur_page_area_);
+ visitor->Trace(page_set_root_layout_item_);
+ visitor->Trace(page_set_cur_layout_item_);
+ ContainerTrace(visitor, proposed_view_records_);
- if (m_CurrentViewRecordIter != m_ProposedViewRecords.end())
- visitor->Trace(*m_CurrentViewRecordIter);
+ if (current_view_record_iter_ != proposed_view_records_.end()) {
+ visitor->Trace(*current_view_record_iter_);
+ }
- ContainerTrace(visitor, m_PageArray);
- ContainerTrace(visitor, m_pPageSetMap);
+ ContainerTrace(visitor, page_array_);
+ ContainerTrace(visitor, page_set_map_);
}
bool CXFA_ViewLayoutProcessor::InitLayoutPage(CXFA_Node* pFormNode) {
@@ -374,28 +375,29 @@
if (!pTemplateNode)
return false;
- m_pPageSetNode = pTemplateNode->JSObject()->GetOrCreateProperty<CXFA_PageSet>(
+ page_set_node_ = pTemplateNode->JSObject()->GetOrCreateProperty<CXFA_PageSet>(
0, XFA_Element::PageSet);
- DCHECK(m_pPageSetNode);
+ DCHECK(page_set_node_);
- if (m_pPageSetRootLayoutItem) {
- m_pPageSetRootLayoutItem->RemoveSelfIfParented();
+ if (page_set_root_layout_item_) {
+ page_set_root_layout_item_->RemoveSelfIfParented();
} else {
- m_pPageSetRootLayoutItem = cppgc::MakeGarbageCollected<CXFA_ViewLayoutItem>(
- GetHeap()->GetAllocationHandle(), m_pPageSetNode, nullptr);
+ page_set_root_layout_item_ =
+ cppgc::MakeGarbageCollected<CXFA_ViewLayoutItem>(
+ GetHeap()->GetAllocationHandle(), page_set_node_, nullptr);
}
- m_pPageSetCurLayoutItem = m_pPageSetRootLayoutItem;
- m_pPageSetNode->JSObject()->SetLayoutItem(m_pPageSetRootLayoutItem.Get());
+ page_set_cur_layout_item_ = page_set_root_layout_item_;
+ page_set_node_->JSObject()->SetLayoutItem(page_set_root_layout_item_.Get());
XFA_AttributeValue eRelation =
- m_pPageSetNode->JSObject()->GetEnum(XFA_Attribute::Relation);
+ page_set_node_->JSObject()->GetEnum(XFA_Attribute::Relation);
if (eRelation != XFA_AttributeValue::Unknown)
- m_ePageSetMode = eRelation;
+ page_set_mode_ = eRelation;
InitPageSetMap();
CXFA_Node* pPageArea = nullptr;
int32_t iCount = 0;
- for (pPageArea = m_pPageSetNode->GetFirstChild(); pPageArea;
+ for (pPageArea = page_set_node_->GetFirstChild(); pPageArea;
pPageArea = pPageArea->GetNextSibling()) {
if (pPageArea->GetElementType() != XFA_Element::PageArea)
continue;
@@ -411,14 +413,14 @@
CXFA_Document* pDocument = pTemplateNode->GetDocument();
pPageArea =
- m_pPageSetNode->GetChild<CXFA_Node>(0, XFA_Element::PageArea, false);
+ page_set_node_->GetChild<CXFA_Node>(0, XFA_Element::PageArea, false);
if (!pPageArea) {
- pPageArea = pDocument->CreateNode(m_pPageSetNode->GetPacketType(),
+ pPageArea = pDocument->CreateNode(page_set_node_->GetPacketType(),
XFA_Element::PageArea);
if (!pPageArea)
return false;
- m_pPageSetNode->InsertChildAndNotify(pPageArea, nullptr);
+ page_set_node_->InsertChildAndNotify(pPageArea, nullptr);
pPageArea->SetInitializedFlagAndNotify();
}
CXFA_ContentArea* pContentArea =
@@ -496,8 +498,9 @@
}
bool CXFA_ViewLayoutProcessor::AppendNewPage(bool bFirstTemPage) {
- if (m_CurrentViewRecordIter != GetTailPosition())
+ if (current_view_record_iter_ != GetTailPosition()) {
return true;
+ }
CXFA_Node* pPageNode = GetNextAvailPageArea(nullptr, nullptr, false, false);
if (!pPageNode)
@@ -536,15 +539,15 @@
return;
pViewRecord->pCurContentArea->AppendLastChild(pContentLayoutItem);
- m_bCreateOverFlowPage = false;
+ create_over_flow_page_ = false;
}
if (eStatus != CXFA_ContentLayoutProcessor::Result::kDone) {
if (eStatus == CXFA_ContentLayoutProcessor::Result::kPageFullBreak &&
- m_CurrentViewRecordIter == GetTailPosition()) {
+ current_view_record_iter_ == GetTailPosition()) {
AppendNewPage(false);
}
- m_CurrentViewRecordIter = GetTailPosition();
- m_pCurPageArea = GetCurrentViewRecord()->pCurPageArea->GetFormNode();
+ current_view_record_iter_ = GetTailPosition();
+ cur_page_area_ = GetCurrentViewRecord()->pCurPageArea->GetFormNode();
}
}
@@ -561,13 +564,14 @@
XFA_Attribute::H, XFA_Unit::Pt);
if (fAvailHeight >= kXFALayoutPrecision)
return fAvailHeight;
- if (m_CurrentViewRecordIter == m_ProposedViewRecords.begin())
+ if (current_view_record_iter_ == proposed_view_records_.begin()) {
return 0.0f;
+ }
return FLT_MAX;
}
void CXFA_ViewLayoutProcessor::AppendNewRecord(CXFA_ViewRecord* pNewRecord) {
- m_ProposedViewRecords.emplace_back(pNewRecord);
+ proposed_view_records_.emplace_back(pNewRecord);
}
CXFA_ViewLayoutProcessor::CXFA_ViewRecord*
@@ -578,14 +582,14 @@
GetHeap()->GetAllocationHandle());
if (!HasCurrentViewRecord()) {
CXFA_Node* pPageSet = pPageNode->GetParent();
- if (pPageSet == m_pPageSetNode) {
- pNewRecord->pCurPageSet = m_pPageSetRootLayoutItem;
+ if (pPageSet == page_set_node_) {
+ pNewRecord->pCurPageSet = page_set_root_layout_item_;
} else {
auto* pPageSetLayoutItem =
cppgc::MakeGarbageCollected<CXFA_ViewLayoutItem>(
GetHeap()->GetAllocationHandle(), pPageSet, nullptr);
pPageSet->JSObject()->SetLayoutItem(pPageSetLayoutItem);
- m_pPageSetRootLayoutItem->AppendLastChild(pPageSetLayoutItem);
+ page_set_root_layout_item_->AppendLastChild(pPageSetLayoutItem);
pNewRecord->pCurPageSet = pPageSetLayoutItem;
}
AppendNewRecord(pNewRecord);
@@ -600,13 +604,13 @@
CXFA_Node* pPageSet = pPageNode->GetParent();
if (!bCreateNew) {
- if (pPageSet == m_pPageSetNode) {
- pNewRecord->pCurPageSet = m_pPageSetCurLayoutItem;
+ if (pPageSet == page_set_node_) {
+ pNewRecord->pCurPageSet = page_set_cur_layout_item_;
} else {
CXFA_ViewLayoutItem* pParentLayoutItem =
ToViewLayoutItem(pPageSet->JSObject()->GetLayoutItem());
if (!pParentLayoutItem)
- pParentLayoutItem = m_pPageSetCurLayoutItem;
+ pParentLayoutItem = page_set_cur_layout_item_;
pNewRecord->pCurPageSet = pParentLayoutItem;
}
AppendNewRecord(pNewRecord);
@@ -625,14 +629,14 @@
GetHeap()->GetAllocationHandle(), pPageSet, nullptr);
pPageSet->JSObject()->SetLayoutItem(pPageSetLayoutItem);
if (!pParentPageSetLayout) {
- CXFA_ViewLayoutItem* pPrePageSet = m_pPageSetRootLayoutItem;
+ CXFA_ViewLayoutItem* pPrePageSet = page_set_root_layout_item_;
while (pPrePageSet->GetNextSibling())
pPrePageSet = pPrePageSet->GetNextSibling()->AsViewLayoutItem();
if (pPrePageSet->GetParent()) {
pPrePageSet->GetParent()->InsertAfter(pPageSetLayoutItem, pPrePageSet);
}
- m_pPageSetCurLayoutItem = pPageSetLayoutItem;
+ page_set_cur_layout_item_ = pPageSetLayoutItem;
} else {
pParentPageSetLayout->AppendLastChild(pPageSetLayoutItem);
}
@@ -649,7 +653,7 @@
if (pCurrentRecord)
*pNewRecord = *pCurrentRecord;
else
- pNewRecord->pCurPageSet = m_pPageSetRootLayoutItem;
+ pNewRecord->pCurPageSet = page_set_root_layout_item_;
AppendNewRecord(pNewRecord);
return pNewRecord;
}
@@ -658,18 +662,18 @@
CXFA_ViewRecord* pNewRecord,
CXFA_Node* pNewPageArea) {
CXFA_ViewLayoutItem* pNewPageAreaLayoutItem = nullptr;
- if (fxcrt::IndexInBounds(m_PageArray, m_nAvailPages)) {
- CXFA_ViewLayoutItem* pViewItem = m_PageArray[m_nAvailPages];
+ if (fxcrt::IndexInBounds(page_array_, avail_pages_)) {
+ CXFA_ViewLayoutItem* pViewItem = page_array_[avail_pages_];
pViewItem->SetFormNode(pNewPageArea);
- m_nAvailPages++;
+ avail_pages_++;
pNewPageAreaLayoutItem = pViewItem;
} else {
CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetNotify();
auto* pViewItem = cppgc::MakeGarbageCollected<CXFA_ViewLayoutItem>(
GetHeap()->GetAllocationHandle(), pNewPageArea,
pNotify->OnCreateViewLayoutItem(pNewPageArea));
- m_PageArray.push_back(pViewItem);
- m_nAvailPages++;
+ page_array_.push_back(pViewItem);
+ avail_pages_++;
pNotify->OnPageViewEvent(pViewItem,
CXFA_FFDoc::PageViewEvent::kPostRemoved);
pNewPageAreaLayoutItem = pViewItem;
@@ -694,7 +698,7 @@
void CXFA_ViewLayoutProcessor::FinishPaginatedPageSets() {
for (CXFA_ViewLayoutItem* pRootPageSetLayoutItem =
- m_pPageSetRootLayoutItem.Get();
+ page_set_root_layout_item_.Get();
pRootPageSetLayoutItem; pRootPageSetLayoutItem = ToViewLayoutItem(
pRootPageSetLayoutItem->GetNextSibling())) {
PageSetIterator sIterator(pRootPageSetLayoutItem);
@@ -719,20 +723,21 @@
}
int32_t CXFA_ViewLayoutProcessor::GetPageCount() const {
- return fxcrt::CollectionSize<int32_t>(m_PageArray);
+ return fxcrt::CollectionSize<int32_t>(page_array_);
}
CXFA_ViewLayoutItem* CXFA_ViewLayoutProcessor::GetPage(int32_t index) const {
- if (!fxcrt::IndexInBounds(m_PageArray, index))
+ if (!fxcrt::IndexInBounds(page_array_, index)) {
return nullptr;
- return m_PageArray[index].Get();
+ }
+ return page_array_[index].Get();
}
int32_t CXFA_ViewLayoutProcessor::GetPageIndex(
const CXFA_ViewLayoutItem* pPage) const {
- auto it = std::find(m_PageArray.begin(), m_PageArray.end(), pPage);
- return it != m_PageArray.end()
- ? pdfium::checked_cast<int32_t>(it - m_PageArray.begin())
+ auto it = std::find(page_array_.begin(), page_array_.end(), pPage);
+ return it != page_array_.end()
+ ? pdfium::checked_cast<int32_t>(it - page_array_.begin())
: -1;
}
@@ -805,7 +810,7 @@
WideString wsTarget =
pCurNode->JSObject()->GetCData(XFA_Attribute::Target);
- CXFA_Node* pTarget = ResolveBreakTarget(m_pPageSetNode, true, &wsTarget);
+ CXFA_Node* pTarget = ResolveBreakTarget(page_set_node_, true, &wsTarget);
wsBreakTrailer = pCurNode->JSObject()->GetCData(XFA_Attribute::Trailer);
wsBreakLeader = pCurNode->JSObject()->GetCData(XFA_Attribute::Leader);
ret.pLeader = ResolveBreakTarget(pContainer, true, &wsBreakLeader);
@@ -816,8 +821,8 @@
ret.bCreatePage = true;
break;
}
- if (!m_ProposedViewRecords.empty() &&
- m_CurrentViewRecordIter == m_ProposedViewRecords.begin() &&
+ if (!proposed_view_records_.empty() &&
+ current_view_record_iter_ == proposed_view_records_.begin() &&
eType == XFA_Element::BreakBefore) {
CXFA_Node* pParentNode = pFormNode->GetContainerParent();
if (!pParentNode ||
@@ -838,7 +843,7 @@
pCurNode->JSObject()->GetInteger(XFA_Attribute::StartNew) != 0;
WideString wsTarget = pCurNode->JSObject()->GetCData(
bBefore ? XFA_Attribute::BeforeTarget : XFA_Attribute::AfterTarget);
- CXFA_Node* pTarget = ResolveBreakTarget(m_pPageSetNode, true, &wsTarget);
+ CXFA_Node* pTarget = ResolveBreakTarget(page_set_node_, true, &wsTarget);
if (RunBreak(bBefore ? XFA_Element::BreakBefore : XFA_Element::BreakAfter,
pCurNode->JSObject()->GetEnum(
bBefore ? XFA_Attribute::Before : XFA_Attribute::After),
@@ -956,11 +961,11 @@
return false;
}
- if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) {
+ if (!wsOverflowTarget.IsEmpty() && bCreatePage && !create_over_flow_page_) {
CXFA_Node* pTarget =
- ResolveBreakTarget(m_pPageSetNode, true, &wsOverflowTarget);
+ ResolveBreakTarget(page_set_node_, true, &wsOverflowTarget);
if (pTarget) {
- m_bCreateOverFlowPage = true;
+ create_over_flow_page_ = true;
switch (pTarget->GetElementType()) {
case XFA_Element::PageArea:
RunBreak(XFA_Element::Overflow, XFA_AttributeValue::PageArea,
@@ -989,11 +994,11 @@
WideString wsOverflowTarget =
pOverflowNode->JSObject()->GetCData(XFA_Attribute::Target);
- if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) {
+ if (!wsOverflowTarget.IsEmpty() && bCreatePage && !create_over_flow_page_) {
CXFA_Node* pTarget =
- ResolveBreakTarget(m_pPageSetNode, true, &wsOverflowTarget);
+ ResolveBreakTarget(page_set_node_, true, &wsOverflowTarget);
if (pTarget) {
- m_bCreateOverFlowPage = true;
+ create_over_flow_page_ = true;
switch (pTarget->GetElementType()) {
case XFA_Element::PageArea:
RunBreak(XFA_Element::Overflow, XFA_AttributeValue::PageArea, pTarget,
@@ -1124,9 +1129,10 @@
bool bQuery) {
int32_t iPageSetCount = 0;
if (!pStartChild && !bQuery) {
- auto it = m_pPageSetMap.find(pPageSet);
- if (it != m_pPageSetMap.end())
+ auto it = page_set_map_.find(pPageSet);
+ if (it != page_set_map_.end()) {
iPageSetCount = it->second;
+ }
int32_t iMax = -1;
CXFA_Node* pOccurNode =
pPageSet->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
@@ -1165,8 +1171,8 @@
}
AddContentAreaLayoutItem(pNewRecord, pTargetContentArea);
}
- m_pCurPageArea = pCurrentNode;
- m_nCurPageCount = 1;
+ cur_page_area_ = pCurrentNode;
+ cur_page_count_ = 1;
bRes = true;
break;
}
@@ -1184,7 +1190,7 @@
}
}
if (!pStartChild && bRes && !bQuery)
- m_pPageSetMap[pPageSet] = ++iPageSetCount;
+ page_set_map_[pPageSet] = ++iPageSetCount;
return bRes;
}
@@ -1215,7 +1221,7 @@
if (ePreferredPosition == XFA_AttributeValue::Last) {
if (eCurPagePosition != ePreferredPosition)
continue;
- if (m_ePageSetMode == XFA_AttributeValue::SimplexPaginated ||
+ if (page_set_mode_ == XFA_AttributeValue::SimplexPaginated ||
pCurrentNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven) ==
XFA_AttributeValue::Any) {
pPreferredPageArea = pCurrentNode;
@@ -1231,7 +1237,7 @@
if (ePreferredPosition == XFA_AttributeValue::Only) {
if (eCurPagePosition != ePreferredPosition)
continue;
- if (m_ePageSetMode != XFA_AttributeValue::DuplexPaginated ||
+ if (page_set_mode_ != XFA_AttributeValue::DuplexPaginated ||
pCurrentNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven) ==
XFA_AttributeValue::Any) {
pPreferredPageArea = pCurrentNode;
@@ -1292,13 +1298,14 @@
}
AddContentAreaLayoutItem(pNewRecord, pTargetContentArea);
}
- m_pCurPageArea = pCurPageArea;
+ cur_page_area_ = pCurPageArea;
return true;
}
bool CXFA_ViewLayoutProcessor::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) {
- if (m_ePageSetMode != XFA_AttributeValue::DuplexPaginated)
+ if (page_set_mode_ != XFA_AttributeValue::DuplexPaginated) {
return true;
+ }
std::optional<XFA_AttributeValue> ret =
pPageArea->JSObject()->TryEnum(XFA_Attribute::OddOrEven, true);
@@ -1314,65 +1321,66 @@
CXFA_Node* pTargetContentArea,
bool bNewPage,
bool bQuery) {
- if (!m_pCurPageArea) {
- FindPageAreaFromPageSet(m_pPageSetNode, nullptr, pTargetPageArea,
+ if (!cur_page_area_) {
+ FindPageAreaFromPageSet(page_set_node_, nullptr, pTargetPageArea,
pTargetContentArea, bNewPage, bQuery);
- return m_pCurPageArea;
+ return cur_page_area_;
}
- if (!pTargetPageArea || pTargetPageArea == m_pCurPageArea) {
+ if (!pTargetPageArea || pTargetPageArea == cur_page_area_) {
if (!bNewPage && GetNextContentArea(pTargetContentArea))
- return m_pCurPageArea;
+ return cur_page_area_;
if (IsPageSetRootOrderedOccurrence()) {
int32_t iMax = -1;
CXFA_Node* pOccurNode =
- m_pCurPageArea->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
+ cur_page_area_->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
std::optional<int32_t> ret =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret.has_value())
iMax = ret.value();
}
- if ((iMax < 0 || m_nCurPageCount < iMax)) {
+ if ((iMax < 0 || cur_page_count_ < iMax)) {
if (!bQuery) {
- CXFA_ViewRecord* pNewRecord = CreateViewRecord(m_pCurPageArea, false);
- AddPageAreaLayoutItem(pNewRecord, m_pCurPageArea);
+ CXFA_ViewRecord* pNewRecord = CreateViewRecord(cur_page_area_, false);
+ AddPageAreaLayoutItem(pNewRecord, cur_page_area_);
if (!pTargetContentArea) {
pTargetContentArea =
- m_pCurPageArea->GetFirstChildByClass<CXFA_ContentArea>(
+ cur_page_area_->GetFirstChildByClass<CXFA_ContentArea>(
XFA_Element::ContentArea);
}
AddContentAreaLayoutItem(pNewRecord, pTargetContentArea);
}
- m_nCurPageCount++;
- return m_pCurPageArea;
+ cur_page_count_++;
+ return cur_page_area_;
}
}
}
if (!bQuery && IsPageSetRootOrderedOccurrence())
- CreateMinPageRecord(m_pCurPageArea, false, true);
- if (FindPageAreaFromPageSet(m_pCurPageArea->GetParent(), m_pCurPageArea,
+ CreateMinPageRecord(cur_page_area_, false, true);
+ if (FindPageAreaFromPageSet(cur_page_area_->GetParent(), cur_page_area_,
pTargetPageArea, pTargetContentArea, bNewPage,
bQuery)) {
- return m_pCurPageArea;
+ return cur_page_area_;
}
- CXFA_Node* pPageSet = m_pCurPageArea->GetParent();
+ CXFA_Node* pPageSet = cur_page_area_->GetParent();
while (pPageSet) {
if (FindPageAreaFromPageSet(pPageSet, nullptr, pTargetPageArea,
pTargetContentArea, bNewPage, bQuery)) {
- return m_pCurPageArea;
+ return cur_page_area_;
}
if (!bQuery && IsPageSetRootOrderedOccurrence())
CreateMinPageSetRecord(pPageSet, false);
if (FindPageAreaFromPageSet(nullptr, pPageSet, pTargetPageArea,
pTargetContentArea, bNewPage, bQuery)) {
- return m_pCurPageArea;
+ return cur_page_area_;
}
- if (pPageSet == m_pPageSetNode)
+ if (pPageSet == page_set_node_) {
break;
+ }
pPageSet = pPageSet->GetParent();
}
@@ -1388,8 +1396,9 @@
if (!pContentArea)
return false;
} else {
- if (pContentArea->GetParent() != m_pCurPageArea)
+ if (pContentArea->GetParent() != cur_page_area_) {
return false;
+ }
std::optional<CXFA_ViewLayoutItem*> pContentAreaLayout =
CheckContentAreaNotUsed(GetCurrentViewRecord()->pCurPageArea.Get(),
@@ -1415,14 +1424,14 @@
if (!IsPageSetRootOrderedOccurrence())
return;
- CXFA_NodeIterator sIterator(m_pPageSetNode);
+ CXFA_NodeIterator sIterator(page_set_node_);
for (CXFA_Node* pPageSetNode = sIterator.GetCurrent(); pPageSetNode;
pPageSetNode = sIterator.MoveToNext()) {
if (pPageSetNode->GetElementType() == XFA_Element::PageSet) {
XFA_AttributeValue eRelation =
pPageSetNode->JSObject()->GetEnum(XFA_Attribute::Relation);
if (eRelation == XFA_AttributeValue::OrderedOccurrence)
- m_pPageSetMap[pPageSetNode] = 0;
+ page_set_map_[pPageSetNode] = 0;
}
}
}
@@ -1453,7 +1462,7 @@
int32_t i = 0;
if (bCreateLast)
- i = m_nCurPageCount;
+ i = cur_page_count_;
for (; i < iMin; i++) {
CXFA_ViewRecord* pNewRecord = CreateViewRecordSimple();
@@ -1465,9 +1474,10 @@
void CXFA_ViewLayoutProcessor::CreateMinPageSetRecord(CXFA_Node* pPageSet,
bool bCreateAll) {
- auto it = m_pPageSetMap.find(pPageSet);
- if (it == m_pPageSetMap.end())
+ auto it = page_set_map_.find(pPageSet);
+ if (it == page_set_map_.end()) {
return;
+ }
int32_t iCurSetCount = it->second;
if (bCreateAll)
@@ -1492,7 +1502,7 @@
CreateMinPageSetRecord(node, true);
}
}
- m_pPageSetMap[pPageSet] = iMin.value();
+ page_set_map_[pPageSet] = iMin.value();
}
void CXFA_ViewLayoutProcessor::CreateNextMinRecord(CXFA_Node* pRecordNode) {
@@ -1509,16 +1519,18 @@
}
void CXFA_ViewLayoutProcessor::ProcessLastPageSet() {
- if (!m_pCurPageArea)
+ if (!cur_page_area_) {
return;
+ }
- CreateMinPageRecord(m_pCurPageArea, false, true);
- CreateNextMinRecord(m_pCurPageArea);
- CXFA_Node* pPageSet = m_pCurPageArea->GetParent();
+ CreateMinPageRecord(cur_page_area_, false, true);
+ CreateNextMinRecord(cur_page_area_);
+ CXFA_Node* pPageSet = cur_page_area_->GetParent();
while (pPageSet) {
CreateMinPageSetRecord(pPageSet, false);
- if (pPageSet == m_pPageSetNode)
+ if (pPageSet == page_set_node_) {
break;
+ }
CreateNextMinRecord(pPageSet);
pPageSet = pPageSet->GetParent();
@@ -1553,20 +1565,20 @@
iMax = ret.value();
}
if (ret.has_value()) {
- if (m_nCurPageCount == iMax) {
- CXFA_Node* pSrcPage = m_pCurPageArea;
- int32_t nSrcPageCount = m_nCurPageCount;
+ if (cur_page_count_ == iMax) {
+ CXFA_Node* pSrcPage = cur_page_area_;
+ int32_t nSrcPageCount = cur_page_count_;
auto psSrcIter = GetTailPosition();
CXFA_Node* pNextPage =
GetNextAvailPageArea(nullptr, nullptr, false, true);
- m_pCurPageArea = pSrcPage;
- m_nCurPageCount = nSrcPageCount;
+ cur_page_area_ = pSrcPage;
+ cur_page_count_ = nSrcPageCount;
CXFA_ViewRecord* pPrevRecord = psSrcIter->Get();
++psSrcIter;
- while (psSrcIter != m_ProposedViewRecords.end()) {
+ while (psSrcIter != proposed_view_records_.end()) {
auto psSaveIter = psSrcIter++;
RemoveLayoutRecord(psSaveIter->Get(), pPrevRecord);
- m_ProposedViewRecords.erase(psSaveIter);
+ proposed_view_records_.erase(psSaveIter);
}
if (pNextPage) {
CXFA_Node* pContentArea =
@@ -1595,20 +1607,21 @@
}
void CXFA_ViewLayoutProcessor::ClearData() {
- if (!m_pPageSetNode)
+ if (!page_set_node_) {
return;
+ }
- m_ProposedViewRecords.clear();
- m_CurrentViewRecordIter = m_ProposedViewRecords.end();
- m_pCurPageArea = nullptr;
- m_nCurPageCount = 0;
- m_bCreateOverFlowPage = false;
- m_pPageSetMap.clear();
+ proposed_view_records_.clear();
+ current_view_record_iter_ = proposed_view_records_.end();
+ cur_page_area_ = nullptr;
+ cur_page_count_ = 0;
+ create_over_flow_page_ = false;
+ page_set_map_.clear();
}
void CXFA_ViewLayoutProcessor::SaveLayoutItemChildren(
CXFA_LayoutItem* pParentLayoutItem) {
- CXFA_Document* pDocument = m_pPageSetNode->GetDocument();
+ CXFA_Document* pDocument = page_set_node_->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(pDocument);
CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->GetFirstChild();
@@ -1652,7 +1665,7 @@
}
void CXFA_ViewLayoutProcessor::MergePageSetContents() {
- CXFA_Document* pDocument = m_pPageSetNode->GetDocument();
+ CXFA_Document* pDocument = page_set_node_->GetDocument();
pDocument->SetPendingNodesUnusedAndUnbound();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
@@ -1844,7 +1857,7 @@
if (type != XFA_Element::PageArea)
continue;
- m_pLayoutProcessor->GetRootContentLayoutProcessor()->DoLayoutPageArea(
+ layout_processor_->GetRootContentLayoutProcessor()->DoLayoutPageArea(
pViewItem);
}
}
@@ -1853,7 +1866,7 @@
void CXFA_ViewLayoutProcessor::SyncLayoutData() {
MergePageSetContents();
LayoutPageSetContents();
- CXFA_FFNotify* pNotify = m_pPageSetNode->GetDocument()->GetNotify();
+ CXFA_FFNotify* pNotify = page_set_node_->GetDocument()->GetNotify();
int32_t nPageIdx = -1;
for (CXFA_ViewLayoutItem* pRootLayoutItem = GetRootLayoutItem();
pRootLayoutItem;
@@ -1886,31 +1899,32 @@
bool bVisible = presence == XFA_AttributeValue::Visible;
Mask<XFA_WidgetStatus> dwRelevantChild =
GetRelevant(pContentItem->GetFormNode(), dwRelevant);
- SyncContainer(pNotify, m_pLayoutProcessor, pContentItem,
- dwRelevantChild, bVisible, nPageIdx);
+ SyncContainer(pNotify, layout_processor_, pContentItem, dwRelevantChild,
+ bVisible, nPageIdx);
pChildLayoutItem = iterator.SkipChildrenAndMoveToNext();
}
}
}
- int32_t nPage = fxcrt::CollectionSize<int32_t>(m_PageArray);
- for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
- CXFA_ViewLayoutItem* pPage = m_PageArray[i];
- m_PageArray.erase(m_PageArray.begin() + i);
+ int32_t nPage = fxcrt::CollectionSize<int32_t>(page_array_);
+ for (int32_t i = nPage - 1; i >= avail_pages_; i--) {
+ CXFA_ViewLayoutItem* pPage = page_array_[i];
+ page_array_.erase(page_array_.begin() + i);
pNotify->OnPageViewEvent(pPage, CXFA_FFDoc::PageViewEvent::kPostRemoved);
}
ClearData();
}
void CXFA_ViewLayoutProcessor::PrepareLayout() {
- m_pPageSetCurLayoutItem = nullptr;
- m_ePageSetMode = XFA_AttributeValue::OrderedOccurrence;
- m_nAvailPages = 0;
+ page_set_cur_layout_item_ = nullptr;
+ page_set_mode_ = XFA_AttributeValue::OrderedOccurrence;
+ avail_pages_ = 0;
ClearData();
- if (!m_pPageSetRootLayoutItem)
+ if (!page_set_root_layout_item_) {
return;
+ }
- CXFA_ViewLayoutItem* pRootLayoutItem = m_pPageSetRootLayoutItem;
+ CXFA_ViewLayoutItem* pRootLayoutItem = page_set_root_layout_item_;
if (pRootLayoutItem &&
pRootLayoutItem->GetFormNode()->GetPacketType() == XFA_PacketType::Form) {
CXFA_Document* const pRootDocument =
@@ -1919,10 +1933,10 @@
pRootDocument->ClearPendingNodes();
if (pPageSetFormNode->HasRemovedChildren()) {
XFA_ReleaseLayoutItem(pRootLayoutItem);
- m_pPageSetRootLayoutItem = nullptr;
+ page_set_root_layout_item_ = nullptr;
pRootLayoutItem = nullptr;
pPageSetFormNode = nullptr;
- m_PageArray.clear();
+ page_array_.clear();
}
while (pPageSetFormNode) {
CXFA_Node* pNextPageSet =
@@ -1934,14 +1948,14 @@
pPageSetFormNode = pNextPageSet;
}
}
- pRootLayoutItem = m_pPageSetRootLayoutItem;
+ pRootLayoutItem = page_set_root_layout_item_;
CXFA_ViewLayoutItem* pNextLayout = nullptr;
for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) {
pNextLayout = ToViewLayoutItem(pRootLayoutItem->GetNextSibling());
SaveLayoutItemChildren(pRootLayoutItem);
pRootLayoutItem->RemoveSelfIfParented();
}
- m_pPageSetRootLayoutItem = nullptr;
+ page_set_root_layout_item_ = nullptr;
}
void CXFA_ViewLayoutProcessor::ProcessSimplexOrDuplexPageSets(
@@ -1964,7 +1978,7 @@
return;
}
- CXFA_Node* pNode = m_pCurPageArea;
+ CXFA_Node* pNode = cur_page_area_;
XFA_AttributeValue eCurChoice =
pNode->JSObject()->GetEnum(XFA_Attribute::PagePosition);
if (eCurChoice == XFA_AttributeValue::Last) {
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
index 1c65e00..389f15d 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
@@ -51,7 +51,7 @@
void PreFinalize();
void Trace(cppgc::Visitor* visitor) const;
- cppgc::Heap* GetHeap() const { return m_pHeap; }
+ cppgc::Heap* GetHeap() const { return heap_; }
bool InitLayoutPage(CXFA_Node* pFormNode);
bool PrepareFirstPage(CXFA_Node* pRootSubform);
@@ -65,7 +65,7 @@
CXFA_ViewLayoutItem* GetPage(int32_t index) const;
int32_t GetPageIndex(const CXFA_ViewLayoutItem* pPage) const;
CXFA_ViewLayoutItem* GetRootLayoutItem() const {
- return m_pPageSetRootLayoutItem;
+ return page_set_root_layout_item_;
}
std::optional<BreakData> ProcessBreakBefore(const CXFA_Node* pBreakNode);
std::optional<BreakData> ProcessBreakAfter(const CXFA_Node* pBreakNode);
@@ -98,20 +98,20 @@
void RemoveLayoutRecord(CXFA_ViewRecord* pNewRecord,
CXFA_ViewRecord* pPrevRecord);
bool HasCurrentViewRecord() const {
- return m_CurrentViewRecordIter != m_ProposedViewRecords.end();
+ return current_view_record_iter_ != proposed_view_records_.end();
}
CXFA_ViewRecord* GetCurrentViewRecord() {
- return HasCurrentViewRecord() ? m_CurrentViewRecordIter->Get() : nullptr;
+ return HasCurrentViewRecord() ? current_view_record_iter_->Get() : nullptr;
}
const CXFA_ViewRecord* GetCurrentViewRecord() const {
- return HasCurrentViewRecord() ? m_CurrentViewRecordIter->Get() : nullptr;
+ return HasCurrentViewRecord() ? current_view_record_iter_->Get() : nullptr;
}
void ResetToFirstViewRecord() {
- m_CurrentViewRecordIter = m_ProposedViewRecords.begin();
+ current_view_record_iter_ = proposed_view_records_.begin();
}
std::list<cppgc::Member<CXFA_ViewRecord>>::iterator GetTailPosition() {
- auto iter = m_ProposedViewRecords.end();
- return !m_ProposedViewRecords.empty() ? std::prev(iter) : iter;
+ auto iter = proposed_view_records_.end();
+ return !proposed_view_records_.empty() ? std::prev(iter) : iter;
}
void AppendNewRecord(CXFA_ViewRecord* pNewRecord);
CXFA_ViewRecord* CreateViewRecord(CXFA_Node* pPageNode, bool bCreateNew);
@@ -172,7 +172,7 @@
void InitPageSetMap();
void ProcessLastPageSet();
bool IsPageSetRootOrderedOccurrence() const {
- return m_ePageSetMode == XFA_AttributeValue::OrderedOccurrence;
+ return page_set_mode_ == XFA_AttributeValue::OrderedOccurrence;
}
void ClearData();
void MergePageSetContents();
@@ -182,20 +182,20 @@
void ProcessSimplexOrDuplexPageSets(CXFA_ViewLayoutItem* pPageSetLayoutItem,
bool bIsSimplex);
- UnownedPtr<cppgc::Heap> m_pHeap;
- cppgc::Member<CXFA_LayoutProcessor> m_pLayoutProcessor;
- cppgc::Member<CXFA_Node> m_pPageSetNode;
- cppgc::Member<CXFA_Node> m_pCurPageArea;
- cppgc::Member<CXFA_ViewLayoutItem> m_pPageSetRootLayoutItem;
- cppgc::Member<CXFA_ViewLayoutItem> m_pPageSetCurLayoutItem;
- std::list<cppgc::Member<CXFA_ViewRecord>> m_ProposedViewRecords;
- std::list<cppgc::Member<CXFA_ViewRecord>>::iterator m_CurrentViewRecordIter;
- int32_t m_nAvailPages = 0;
- int32_t m_nCurPageCount = 0;
- XFA_AttributeValue m_ePageSetMode = XFA_AttributeValue::OrderedOccurrence;
- bool m_bCreateOverFlowPage = false;
- std::map<cppgc::Member<CXFA_Node>, int32_t> m_pPageSetMap;
- std::vector<cppgc::Member<CXFA_ViewLayoutItem>> m_PageArray;
+ UnownedPtr<cppgc::Heap> heap_;
+ cppgc::Member<CXFA_LayoutProcessor> layout_processor_;
+ cppgc::Member<CXFA_Node> page_set_node_;
+ cppgc::Member<CXFA_Node> cur_page_area_;
+ cppgc::Member<CXFA_ViewLayoutItem> page_set_root_layout_item_;
+ cppgc::Member<CXFA_ViewLayoutItem> page_set_cur_layout_item_;
+ std::list<cppgc::Member<CXFA_ViewRecord>> proposed_view_records_;
+ std::list<cppgc::Member<CXFA_ViewRecord>>::iterator current_view_record_iter_;
+ int32_t avail_pages_ = 0;
+ int32_t cur_page_count_ = 0;
+ XFA_AttributeValue page_set_mode_ = XFA_AttributeValue::OrderedOccurrence;
+ bool create_over_flow_page_ = false;
+ std::map<cppgc::Member<CXFA_Node>, int32_t> page_set_map_;
+ std::vector<cppgc::Member<CXFA_ViewLayoutItem>> page_array_;
};
#endif // XFA_FXFA_LAYOUT_CXFA_VIEWLAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.cpp b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
index 81f987a..342873a 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.cpp
@@ -19,46 +19,48 @@
void CXFA_ArrayNodeList::Trace(cppgc::Visitor* visitor) const {
CXFA_TreeList::Trace(visitor);
- ContainerTrace(visitor, m_array);
+ ContainerTrace(visitor, array_);
}
void CXFA_ArrayNodeList::SetArrayNodeList(
const std::vector<CXFA_Node*>& srcArray) {
if (!srcArray.empty()) {
- m_array =
+ array_ =
std::vector<cppgc::Member<CXFA_Node>>(srcArray.begin(), srcArray.end());
}
}
size_t CXFA_ArrayNodeList::GetLength() {
- return m_array.size();
+ return array_.size();
}
bool CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
- m_array.push_back(pNode);
+ array_.push_back(pNode);
return true;
}
bool CXFA_ArrayNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
if (!pBeforeNode) {
- m_array.push_back(pNewNode);
+ array_.push_back(pNewNode);
return true;
}
- auto it = std::find(m_array.begin(), m_array.end(), pBeforeNode);
- if (it == m_array.end())
+ auto it = std::find(array_.begin(), array_.end(), pBeforeNode);
+ if (it == array_.end()) {
return false;
+ }
- m_array.insert(it, pNewNode);
+ array_.insert(it, pNewNode);
return true;
}
void CXFA_ArrayNodeList::Remove(CXFA_Node* pNode) {
- auto it = std::find(m_array.begin(), m_array.end(), pNode);
- if (it != m_array.end())
- m_array.erase(it);
+ auto it = std::find(array_.begin(), array_.end(), pNode);
+ if (it != array_.end()) {
+ array_.erase(it);
+ }
}
CXFA_Node* CXFA_ArrayNodeList::Item(size_t index) {
- return index < m_array.size() ? m_array[index] : nullptr;
+ return index < array_.size() ? array_[index] : nullptr;
}
diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.h b/xfa/fxfa/parser/cxfa_arraynodelist.h
index 4c532d4..ca40ea0 100644
--- a/xfa/fxfa/parser/cxfa_arraynodelist.h
+++ b/xfa/fxfa/parser/cxfa_arraynodelist.h
@@ -35,7 +35,7 @@
private:
explicit CXFA_ArrayNodeList(CXFA_Document* pDocument);
- std::vector<cppgc::Member<CXFA_Node>> m_array;
+ std::vector<cppgc::Member<CXFA_Node>> array_;
};
#endif // XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index 93c9168..b2ea509 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -10,54 +10,57 @@
CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
CXFA_Node* pAttachNode)
- : CXFA_TreeList(pDocument), m_pAttachNode(pAttachNode) {}
+ : CXFA_TreeList(pDocument), attach_node_(pAttachNode) {}
CXFA_AttachNodeList::~CXFA_AttachNodeList() = default;
void CXFA_AttachNodeList::Trace(cppgc::Visitor* visitor) const {
CXFA_TreeList::Trace(visitor);
- visitor->Trace(m_pAttachNode);
+ visitor->Trace(attach_node_);
}
size_t CXFA_AttachNodeList::GetLength() {
- return m_pAttachNode->CountChildren(
+ return attach_node_->CountChildren(
XFA_Element::Unknown,
- m_pAttachNode->GetElementType() == XFA_Element::Subform);
+ attach_node_->GetElementType() == XFA_Element::Subform);
}
bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
- if (pNode->IsAncestorOf(m_pAttachNode))
+ if (pNode->IsAncestorOf(attach_node_)) {
return false;
+ }
CXFA_Node* pParent = pNode->GetParent();
if (pParent)
pParent->RemoveChildAndNotify(pNode, true);
- m_pAttachNode->InsertChildAndNotify(pNode, nullptr);
+ attach_node_->InsertChildAndNotify(pNode, nullptr);
return true;
}
bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
- if (pNewNode->IsAncestorOf(m_pAttachNode))
+ if (pNewNode->IsAncestorOf(attach_node_)) {
return false;
+ }
- if (pBeforeNode && pBeforeNode->GetParent() != m_pAttachNode)
+ if (pBeforeNode && pBeforeNode->GetParent() != attach_node_) {
return false;
+ }
CXFA_Node* pParent = pNewNode->GetParent();
if (pParent)
pParent->RemoveChildAndNotify(pNewNode, true);
- m_pAttachNode->InsertChildAndNotify(pNewNode, pBeforeNode);
+ attach_node_->InsertChildAndNotify(pNewNode, pBeforeNode);
return true;
}
void CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
- m_pAttachNode->RemoveChildAndNotify(pNode, true);
+ attach_node_->RemoveChildAndNotify(pNode, true);
}
CXFA_Node* CXFA_AttachNodeList::Item(size_t index) {
- return m_pAttachNode->GetChild<CXFA_Node>(
+ return attach_node_->GetChild<CXFA_Node>(
index, XFA_Element::Unknown,
- m_pAttachNode->GetElementType() == XFA_Element::Subform);
+ attach_node_->GetElementType() == XFA_Element::Subform);
}
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.h b/xfa/fxfa/parser/cxfa_attachnodelist.h
index 4afff96..5f956bc 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.h
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.h
@@ -31,7 +31,7 @@
private:
CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
- cppgc::Member<CXFA_Node> const m_pAttachNode;
+ cppgc::Member<CXFA_Node> const attach_node_;
};
#endif // XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 7141441..ac66463 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -1288,9 +1288,10 @@
notify_(notify),
node_owner_(cppgc::MakeGarbageCollected<CXFA_NodeOwner>(
heap->GetAllocationHandle())),
- m_pLayoutProcessor(pLayout) {
- if (m_pLayoutProcessor)
- m_pLayoutProcessor->SetDocument(this);
+ layout_processor_(pLayout) {
+ if (layout_processor_) {
+ layout_processor_->SetDocument(this);
+ }
}
CXFA_Document::~CXFA_Document() = default;
@@ -1298,29 +1299,29 @@
void CXFA_Document::Trace(cppgc::Visitor* visitor) const {
visitor->Trace(notify_);
visitor->Trace(node_owner_);
- visitor->Trace(m_pRootNode);
- visitor->Trace(m_pLocaleMgr);
- visitor->Trace(m_pLayoutProcessor);
- visitor->Trace(m_pScriptDataWindow);
- visitor->Trace(m_pScriptEvent);
- visitor->Trace(m_pScriptHost);
- visitor->Trace(m_pScriptLog);
- visitor->Trace(m_pScriptLayout);
- visitor->Trace(m_pScriptSignature);
- ContainerTrace(visitor, m_rgGlobalBinding);
- ContainerTrace(visitor, m_pPendingPageSet);
+ visitor->Trace(root_node_);
+ visitor->Trace(locale_mgr_);
+ visitor->Trace(layout_processor_);
+ visitor->Trace(script_data_window_);
+ visitor->Trace(script_event_);
+ visitor->Trace(script_host_);
+ visitor->Trace(script_log_);
+ visitor->Trace(script_layout_);
+ visitor->Trace(script_signature_);
+ ContainerTrace(visitor, rg_global_binding_);
+ ContainerTrace(visitor, pending_page_set_);
}
void CXFA_Document::ClearLayoutData() {
- m_pLayoutProcessor = nullptr;
- m_pScriptContext.reset();
- m_pLocaleMgr.Clear();
- m_pScriptDataWindow = nullptr;
- m_pScriptEvent = nullptr;
- m_pScriptHost = nullptr;
- m_pScriptLog = nullptr;
- m_pScriptLayout = nullptr;
- m_pScriptSignature = nullptr;
+ layout_processor_ = nullptr;
+ script_context_.reset();
+ locale_mgr_.Clear();
+ script_data_window_ = nullptr;
+ script_event_ = nullptr;
+ script_host_ = nullptr;
+ script_log_ = nullptr;
+ script_layout_ = nullptr;
+ script_signature_ = nullptr;
}
CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) {
@@ -1361,45 +1362,50 @@
: nullptr;
}
case XFA_HASHCODE_DataWindow: {
- if (!m_pScriptDataWindow)
- m_pScriptDataWindow = cppgc::MakeGarbageCollected<CScript_DataWindow>(
+ if (!script_data_window_) {
+ script_data_window_ = cppgc::MakeGarbageCollected<CScript_DataWindow>(
GetHeap()->GetAllocationHandle(), this);
- return m_pScriptDataWindow;
+ }
+ return script_data_window_;
}
case XFA_HASHCODE_Event: {
- if (!m_pScriptEvent)
- m_pScriptEvent = cppgc::MakeGarbageCollected<CScript_EventPseudoModel>(
+ if (!script_event_) {
+ script_event_ = cppgc::MakeGarbageCollected<CScript_EventPseudoModel>(
GetHeap()->GetAllocationHandle(), this);
- return m_pScriptEvent;
+ }
+ return script_event_;
}
case XFA_HASHCODE_Host: {
- if (!m_pScriptHost)
- m_pScriptHost = cppgc::MakeGarbageCollected<CScript_HostPseudoModel>(
+ if (!script_host_) {
+ script_host_ = cppgc::MakeGarbageCollected<CScript_HostPseudoModel>(
GetHeap()->GetAllocationHandle(), this);
- return m_pScriptHost;
+ }
+ return script_host_;
}
case XFA_HASHCODE_Log: {
- if (!m_pScriptLog)
- m_pScriptLog = cppgc::MakeGarbageCollected<CScript_LogPseudoModel>(
+ if (!script_log_) {
+ script_log_ = cppgc::MakeGarbageCollected<CScript_LogPseudoModel>(
GetHeap()->GetAllocationHandle(), this);
- return m_pScriptLog;
+ }
+ return script_log_;
}
case XFA_HASHCODE_Signature: {
- if (!m_pScriptSignature)
- m_pScriptSignature =
+ if (!script_signature_) {
+ script_signature_ =
cppgc::MakeGarbageCollected<CScript_SignaturePseudoModel>(
GetHeap()->GetAllocationHandle(), this);
- return m_pScriptSignature;
+ }
+ return script_signature_;
}
case XFA_HASHCODE_Layout: {
- if (!m_pScriptLayout)
- m_pScriptLayout =
- cppgc::MakeGarbageCollected<CScript_LayoutPseudoModel>(
- GetHeap()->GetAllocationHandle(), this);
- return m_pScriptLayout;
+ if (!script_layout_) {
+ script_layout_ = cppgc::MakeGarbageCollected<CScript_LayoutPseudoModel>(
+ GetHeap()->GetAllocationHandle(), this);
+ }
+ return script_layout_;
}
default:
- return m_pRootNode->GetFirstChildByName(dwNodeNameHash);
+ return root_node_->GetFirstChildByName(dwNodeNameHash);
}
}
@@ -1412,8 +1418,9 @@
}
bool CXFA_Document::IsInteractive() {
- if (m_Interactive.has_value())
- return m_Interactive.value();
+ if (interactive_.has_value()) {
+ return interactive_.value();
+ }
CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig)
@@ -1435,18 +1442,18 @@
WideString wsInteractive = pFormFiller->JSObject()->GetContent(false);
bool bInteractive = wsInteractive.EqualsASCII("1");
- m_Interactive = bInteractive;
+ interactive_ = bInteractive;
return bInteractive;
}
CXFA_LocaleMgr* CXFA_Document::GetLocaleMgr() {
- if (!m_pLocaleMgr) {
- m_pLocaleMgr = cppgc::MakeGarbageCollected<CXFA_LocaleMgr>(
+ if (!locale_mgr_) {
+ locale_mgr_ = cppgc::MakeGarbageCollected<CXFA_LocaleMgr>(
heap_->GetAllocationHandle(), heap_,
ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
GetNotify()->GetAppProvider()->GetLanguage());
}
- return m_pLocaleMgr;
+ return locale_mgr_;
}
cppgc::Heap* CXFA_Document::GetHeap() const {
@@ -1454,21 +1461,21 @@
}
CFXJSE_Engine* CXFA_Document::InitScriptContext(CJS_Runtime* fxjs_runtime) {
- DCHECK(!m_pScriptContext);
- m_pScriptContext = std::make_unique<CFXJSE_Engine>(this, fxjs_runtime);
- return m_pScriptContext.get();
+ DCHECK(!script_context_);
+ script_context_ = std::make_unique<CFXJSE_Engine>(this, fxjs_runtime);
+ return script_context_.get();
}
CFXJSE_Engine* CXFA_Document::GetScriptContext() const {
- DCHECK(m_pScriptContext);
- return m_pScriptContext.get();
+ DCHECK(script_context_);
+ return script_context_.get();
}
XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
const WideString& wsTemplateNS) {
XFA_VERSION eVersion = ParseXFAVersion(wsTemplateNS);
if (eVersion != XFA_VERSION_UNKNOWN)
- m_eCurVersionMode = eVersion;
+ cur_version_mode_ = eVersion;
return eVersion;
}
@@ -1561,7 +1568,7 @@
CXFA_Node* pProtoNode = nullptr;
if (!wsSOM.IsEmpty()) {
std::optional<CFXJSE_Engine::ResolveResult> maybeResult =
- m_pScriptContext->ResolveObjects(
+ script_context_->ResolveObjects(
pUseHrefNode, wsSOM,
Mask<XFA_ResolveFlag>{
XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kAttributes,
@@ -1685,8 +1692,8 @@
CreateNode(XFA_PacketType::Datasets, XFA_Element::DataModel);
pDatasetsRoot->JSObject()->SetCData(XFA_Attribute::Name, L"datasets");
- m_pRootNode->GetXMLMappingNode()->AppendLastChild(pDatasetsXMLNode);
- m_pRootNode->InsertChildAndNotify(pDatasetsRoot, nullptr);
+ root_node_->GetXMLMappingNode()->AppendLastChild(pDatasetsXMLNode);
+ root_node_->InsertChildAndNotify(pDatasetsRoot, nullptr);
pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode);
}
@@ -1735,7 +1742,7 @@
pDataRoot->GetFirstChildByClass<CXFA_DataGroup>(XFA_Element::DataGroup);
uint32_t dwNameHash = pDataTopLevel ? pDataTopLevel->GetNameHash() : 0;
CXFA_Template* pTemplateRoot =
- m_pRootNode->GetFirstChildByClass<CXFA_Template>(XFA_Element::Template);
+ root_node_->GetFirstChildByClass<CXFA_Template>(XFA_Element::Template);
if (!pTemplateRoot)
return;
@@ -1751,7 +1758,7 @@
return;
CXFA_Form* pFormRoot =
- m_pRootNode->GetFirstChildByClass<CXFA_Form>(XFA_Element::Form);
+ root_node_->GetFirstChildByClass<CXFA_Form>(XFA_Element::Form);
bool bEmptyForm = false;
if (!pFormRoot) {
bEmptyForm = true;
@@ -1759,7 +1766,7 @@
CreateNode(XFA_PacketType::Form, XFA_Element::Form));
DCHECK(pFormRoot);
pFormRoot->JSObject()->SetCData(XFA_Attribute::Name, L"form");
- m_pRootNode->InsertChildAndNotify(pFormRoot, nullptr);
+ root_node_->InsertChildAndNotify(pFormRoot, nullptr);
} else {
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
sIterator(pFormRoot);
@@ -1810,7 +1817,7 @@
CXFA_PageSet* pPageSetNode =
pSubformSetNode->GetFirstChildByClass<CXFA_PageSet>(XFA_Element::PageSet);
while (pPageSetNode) {
- m_pPendingPageSet.push_back(pPageSetNode);
+ pending_page_set_.push_back(pPageSetNode);
CXFA_PageSet* pNextPageSetNode =
pPageSetNode->GetNextSameClassSibling<CXFA_PageSet>(
XFA_Element::PageSet);
@@ -1851,39 +1858,39 @@
pFormRoot->SetBindingNode(nullptr);
}
- m_rgGlobalBinding.clear();
+ rg_global_binding_.clear();
DoDataMerge();
GetLayoutProcessor()->SetForceRelayout();
}
CXFA_Node* CXFA_Document::GetGlobalBinding(uint32_t dwNameHash) {
- auto it = m_rgGlobalBinding.find(dwNameHash);
- return it != m_rgGlobalBinding.end() ? it->second : nullptr;
+ auto it = rg_global_binding_.find(dwNameHash);
+ return it != rg_global_binding_.end() ? it->second : nullptr;
}
void CXFA_Document::RegisterGlobalBinding(uint32_t dwNameHash,
CXFA_Node* pDataNode) {
- m_rgGlobalBinding[dwNameHash] = pDataNode;
+ rg_global_binding_[dwNameHash] = pDataNode;
}
size_t CXFA_Document::GetPendingNodesCount() const {
- return m_pPendingPageSet.size();
+ return pending_page_set_.size();
}
CXFA_Node* CXFA_Document::GetPendingNodeAtIndex(size_t index) const {
- return m_pPendingPageSet[index];
+ return pending_page_set_[index];
}
void CXFA_Document::AppendPendingNode(CXFA_Node* node) {
- m_pPendingPageSet.push_back(node);
+ pending_page_set_.push_back(node);
}
void CXFA_Document::ClearPendingNodes() {
- m_pPendingPageSet.clear();
+ pending_page_set_.clear();
}
void CXFA_Document::SetPendingNodesUnusedAndUnbound() {
- for (CXFA_Node* pPageNode : m_pPendingPageSet) {
+ for (CXFA_Node* pPageNode : pending_page_set_) {
CXFA_NodeIterator sIterator(pPageNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
@@ -1904,5 +1911,5 @@
CXFA_Document::LayoutProcessorIface::~LayoutProcessorIface() = default;
void CXFA_Document::LayoutProcessorIface::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDocument);
+ visitor->Trace(document_);
}
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 9be9b24..f4db7fc 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -74,11 +74,11 @@
virtual void SetForceRelayout() = 0;
virtual void SetHasChangedContainer() = 0;
- void SetDocument(CXFA_Document* pDocument) { m_pDocument = pDocument; }
- CXFA_Document* GetDocument() const { return m_pDocument; }
+ void SetDocument(CXFA_Document* pDocument) { document_ = pDocument; }
+ CXFA_Document* GetDocument() const { return document_; }
private:
- cppgc::Member<CXFA_Document> m_pDocument;
+ cppgc::Member<CXFA_Document> document_;
};
CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
@@ -86,7 +86,7 @@
void Trace(cppgc::Visitor* visitor) const;
- bool HasScriptContext() const { return !!m_pScriptContext; }
+ bool HasScriptContext() const { return !!script_context_; }
CFXJSE_Engine* InitScriptContext(CJS_Runtime* fxjs_runtime);
// Only safe to call in situations where the context is known to exist,
@@ -104,20 +104,18 @@
CXFA_Node* GetNotBindNode(
pdfium::span<cppgc::Member<CXFA_Object>> arrayNodes) const;
- LayoutProcessorIface* GetLayoutProcessor() const {
- return m_pLayoutProcessor;
- }
- CXFA_Node* GetRoot() const { return m_pRootNode; }
- void SetRoot(CXFA_Node* pNewRoot) { m_pRootNode = pNewRoot; }
+ LayoutProcessorIface* GetLayoutProcessor() const { return layout_processor_; }
+ CXFA_Node* GetRoot() const { return root_node_; }
+ void SetRoot(CXFA_Node* pNewRoot) { root_node_ = pNewRoot; }
- bool is_strict_scoping() const { return m_bStrictScoping; }
- void set_is_strict_scoping() { m_bStrictScoping = true; }
+ bool is_strict_scoping() const { return strict_scoping_; }
+ void set_is_strict_scoping() { strict_scoping_ = true; }
- bool is_scripting() const { return m_bScripting; }
- void set_is_scripting() { m_bScripting = true; }
+ bool is_scripting() const { return scripting_; }
+ void set_is_scripting() { scripting_ = true; }
bool IsInteractive();
- XFA_VERSION GetCurVersionMode() const { return m_eCurVersionMode; }
+ XFA_VERSION GetCurVersionMode() const { return cur_version_mode_; }
XFA_VERSION RecognizeXFAVersionNumber(const WideString& wsTemplateNS);
FormType GetFormType() const;
@@ -164,24 +162,24 @@
LayoutProcessorIface* pLayout);
UnownedPtr<cppgc::Heap> heap_;
- std::unique_ptr<CFXJSE_Engine> m_pScriptContext;
+ std::unique_ptr<CFXJSE_Engine> script_context_;
cppgc::Member<CXFA_FFNotify> const notify_;
cppgc::Member<CXFA_NodeOwner> const node_owner_;
- cppgc::Member<CXFA_Node> m_pRootNode;
- cppgc::Member<LayoutProcessorIface> m_pLayoutProcessor;
- cppgc::Member<CXFA_LocaleMgr> m_pLocaleMgr;
- cppgc::Member<CScript_DataWindow> m_pScriptDataWindow;
- cppgc::Member<CScript_EventPseudoModel> m_pScriptEvent;
- cppgc::Member<CScript_HostPseudoModel> m_pScriptHost;
- cppgc::Member<CScript_LogPseudoModel> m_pScriptLog;
- cppgc::Member<CScript_LayoutPseudoModel> m_pScriptLayout;
- cppgc::Member<CScript_SignaturePseudoModel> m_pScriptSignature;
- std::map<uint32_t, cppgc::Member<CXFA_Node>> m_rgGlobalBinding;
- std::vector<cppgc::Member<CXFA_Node>> m_pPendingPageSet;
- XFA_VERSION m_eCurVersionMode = XFA_VERSION_DEFAULT;
- std::optional<bool> m_Interactive;
- bool m_bStrictScoping = false;
- bool m_bScripting = false;
+ cppgc::Member<CXFA_Node> root_node_;
+ cppgc::Member<LayoutProcessorIface> layout_processor_;
+ cppgc::Member<CXFA_LocaleMgr> locale_mgr_;
+ cppgc::Member<CScript_DataWindow> script_data_window_;
+ cppgc::Member<CScript_EventPseudoModel> script_event_;
+ cppgc::Member<CScript_HostPseudoModel> script_host_;
+ cppgc::Member<CScript_LogPseudoModel> script_log_;
+ cppgc::Member<CScript_LayoutPseudoModel> script_layout_;
+ cppgc::Member<CScript_SignaturePseudoModel> script_signature_;
+ std::map<uint32_t, cppgc::Member<CXFA_Node>> rg_global_binding_;
+ std::vector<cppgc::Member<CXFA_Node>> pending_page_set_;
+ XFA_VERSION cur_version_mode_ = XFA_VERSION_DEFAULT;
+ std::optional<bool> interactive_;
+ bool strict_scoping_ = false;
+ bool scripting_ = false;
};
#endif // XFA_FXFA_PARSER_CXFA_DOCUMENT_H_
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 27738a8..d9aa778 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1128,15 +1128,15 @@
CXFA_LocaleMgr::CXFA_LocaleMgr(cppgc::Heap* pHeap,
CXFA_Node* pLocaleSet,
WideString wsDeflcid)
- : m_pHeap(pHeap),
- m_pDefLocale(GetLocaleByName(wsDeflcid)),
- m_eDeflcid(GetLanguageID(wsDeflcid)) {
+ : heap_(pHeap),
+ def_locale_(GetLocaleByName(wsDeflcid)),
+ deflcid_(GetLanguageID(wsDeflcid)) {
if (!pLocaleSet)
return;
for (CXFA_Node* pNodeLocale = pLocaleSet->GetFirstChild(); pNodeLocale;
pNodeLocale = pNodeLocale->GetNextSibling()) {
- m_LocaleArray.push_back(cppgc::MakeGarbageCollected<CXFA_NodeLocale>(
+ locale_array_.push_back(cppgc::MakeGarbageCollected<CXFA_NodeLocale>(
pHeap->GetAllocationHandle(), pNodeLocale));
}
}
@@ -1144,76 +1144,79 @@
CXFA_LocaleMgr::~CXFA_LocaleMgr() = default;
void CXFA_LocaleMgr::Trace(cppgc::Visitor* visitor) const {
- ContainerTrace(visitor, m_LocaleArray);
- ContainerTrace(visitor, m_XMLLocaleArray);
- visitor->Trace(m_pDefLocale);
+ ContainerTrace(visitor, locale_array_);
+ ContainerTrace(visitor, xmllocale_array_);
+ visitor->Trace(def_locale_);
}
GCedLocaleIface* CXFA_LocaleMgr::GetDefLocale() {
- if (m_pDefLocale)
- return m_pDefLocale;
+ if (def_locale_) {
+ return def_locale_;
+ }
- if (!m_LocaleArray.empty())
- return m_LocaleArray[0];
+ if (!locale_array_.empty()) {
+ return locale_array_[0];
+ }
- if (!m_XMLLocaleArray.empty())
- return m_XMLLocaleArray[0];
+ if (!xmllocale_array_.empty()) {
+ return xmllocale_array_[0];
+ }
- CXFA_XMLLocale* pLocale = GetLocale(m_eDeflcid);
+ CXFA_XMLLocale* pLocale = GetLocale(deflcid_);
if (pLocale)
- m_XMLLocaleArray.push_back(pLocale);
+ xmllocale_array_.push_back(pLocale);
- m_pDefLocale = pLocale;
- return m_pDefLocale;
+ def_locale_ = pLocale;
+ return def_locale_;
}
CXFA_XMLLocale* CXFA_LocaleMgr::GetLocale(LangID lcid) {
switch (lcid) {
case LangID::k_zh_CN:
- return GetLocaleFromBuffer(m_pHeap, k_zhCN_Locale);
+ return GetLocaleFromBuffer(heap_, k_zhCN_Locale);
case LangID::k_zh_TW:
- return GetLocaleFromBuffer(m_pHeap, k_zhTW_Locale);
+ return GetLocaleFromBuffer(heap_, k_zhTW_Locale);
case LangID::k_zh_HK:
- return GetLocaleFromBuffer(m_pHeap, k_zhHK_Locale);
+ return GetLocaleFromBuffer(heap_, k_zhHK_Locale);
case LangID::k_ja_JP:
- return GetLocaleFromBuffer(m_pHeap, k_jaJP_Locale);
+ return GetLocaleFromBuffer(heap_, k_jaJP_Locale);
case LangID::k_ko_KR:
- return GetLocaleFromBuffer(m_pHeap, k_koKR_Locale);
+ return GetLocaleFromBuffer(heap_, k_koKR_Locale);
case LangID::k_en_GB:
- return GetLocaleFromBuffer(m_pHeap, k_enGB_Locale);
+ return GetLocaleFromBuffer(heap_, k_enGB_Locale);
case LangID::k_es_LA:
- return GetLocaleFromBuffer(m_pHeap, k_esLA_Locale);
+ return GetLocaleFromBuffer(heap_, k_esLA_Locale);
case LangID::k_es_ES:
- return GetLocaleFromBuffer(m_pHeap, k_esES_Locale);
+ return GetLocaleFromBuffer(heap_, k_esES_Locale);
case LangID::k_de_DE:
- return GetLocaleFromBuffer(m_pHeap, k_deDE_Loacale);
+ return GetLocaleFromBuffer(heap_, k_deDE_Loacale);
case LangID::k_fr_FR:
- return GetLocaleFromBuffer(m_pHeap, k_frFR_Locale);
+ return GetLocaleFromBuffer(heap_, k_frFR_Locale);
case LangID::k_it_IT:
- return GetLocaleFromBuffer(m_pHeap, k_itIT_Locale);
+ return GetLocaleFromBuffer(heap_, k_itIT_Locale);
case LangID::k_pt_BR:
- return GetLocaleFromBuffer(m_pHeap, k_ptBR_Locale);
+ return GetLocaleFromBuffer(heap_, k_ptBR_Locale);
case LangID::k_nl_NL:
- return GetLocaleFromBuffer(m_pHeap, k_nlNL_Locale);
+ return GetLocaleFromBuffer(heap_, k_nlNL_Locale);
case LangID::k_ru_RU:
- return GetLocaleFromBuffer(m_pHeap, k_ruRU_Locale);
+ return GetLocaleFromBuffer(heap_, k_ruRU_Locale);
case LangID::k_en_US:
- return GetLocaleFromBuffer(m_pHeap, k_enUS_Locale);
+ return GetLocaleFromBuffer(heap_, k_enUS_Locale);
}
}
GCedLocaleIface* CXFA_LocaleMgr::GetLocaleByName(
const WideString& wsLocaleName) {
- for (size_t i = 0; i < m_LocaleArray.size(); i++) {
- GCedLocaleIface* pLocale = m_LocaleArray[i];
+ for (size_t i = 0; i < locale_array_.size(); i++) {
+ GCedLocaleIface* pLocale = locale_array_[i];
if (pLocale->GetName() == wsLocaleName)
return pLocale;
}
if (wsLocaleName.GetLength() < 2)
return nullptr;
- for (size_t i = 0; i < m_XMLLocaleArray.size(); i++) {
- GCedLocaleIface* pLocale = m_XMLLocaleArray[i];
+ for (size_t i = 0; i < xmllocale_array_.size(); i++) {
+ GCedLocaleIface* pLocale = xmllocale_array_[i];
if (pLocale->GetName() == wsLocaleName)
return pLocale;
}
@@ -1222,23 +1225,24 @@
if (!pLocale)
return nullptr;
- m_XMLLocaleArray.push_back(pLocale);
+ xmllocale_array_.push_back(pLocale);
return pLocale;
}
void CXFA_LocaleMgr::SetDefLocale(GCedLocaleIface* pLocale) {
- m_pDefLocale = pLocale;
+ def_locale_ = pLocale;
}
std::optional<WideString> CXFA_LocaleMgr::GetConfigLocaleName(
CXFA_Node* pConfig) const {
- if (m_bConfigLocaleCached)
- return m_wsConfigLocale;
+ if (config_locale_cached_) {
+ return config_locale_;
+ }
- DCHECK(!m_wsConfigLocale.has_value());
- m_bConfigLocaleCached = true;
+ DCHECK(!config_locale_.has_value());
+ config_locale_cached_ = true;
if (!pConfig)
- return m_wsConfigLocale;
+ return config_locale_;
CXFA_Node* pChildConfig =
pConfig->GetFirstChildByClass<CXFA_Acrobat>(XFA_Element::Acrobat);
@@ -1246,24 +1250,24 @@
pChildConfig =
pConfig->GetFirstChildByClass<CXFA_Present>(XFA_Element::Present);
if (!pChildConfig)
- return m_wsConfigLocale;
+ return config_locale_;
}
CXFA_Common* pCommon =
pChildConfig->GetFirstChildByClass<CXFA_Common>(XFA_Element::Common);
if (!pCommon)
- return m_wsConfigLocale;
+ return config_locale_;
CXFA_Locale* pLocale =
pCommon->GetFirstChildByClass<CXFA_Locale>(XFA_Element::Locale);
if (!pLocale)
- return m_wsConfigLocale;
+ return config_locale_;
std::optional<WideString> wsMaybeLocale =
pLocale->JSObject()->TryCData(XFA_Attribute::Value, false);
if (!wsMaybeLocale.has_value() || wsMaybeLocale.value().IsEmpty())
- return m_wsConfigLocale;
+ return config_locale_;
- m_wsConfigLocale = wsMaybeLocale;
- return m_wsConfigLocale;
+ config_locale_ = wsMaybeLocale;
+ return config_locale_;
}
diff --git a/xfa/fxfa/parser/cxfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h
index 3c8376c..1159db9 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.h
+++ b/xfa/fxfa/parser/cxfa_localemgr.h
@@ -62,22 +62,22 @@
// May allocate a new object on the cppgc heap.
CXFA_XMLLocale* GetLocale(LangID lcid);
- UnownedPtr<cppgc::Heap> m_pHeap;
- std::vector<cppgc::Member<CXFA_NodeLocale>> m_LocaleArray;
- std::vector<cppgc::Member<CXFA_XMLLocale>> m_XMLLocaleArray;
- cppgc::Member<GCedLocaleIface> m_pDefLocale;
+ UnownedPtr<cppgc::Heap> heap_;
+ std::vector<cppgc::Member<CXFA_NodeLocale>> locale_array_;
+ std::vector<cppgc::Member<CXFA_XMLLocale>> xmllocale_array_;
+ cppgc::Member<GCedLocaleIface> def_locale_;
// Note: three possiblities
- // 1. we might never have tried to determine |m_wsConfigLocale|.
+ // 1. we might never have tried to determine |config_locale_|.
// 2. we might have tried but gotten nothing and want to continue
// to return nothing without ever trying again.
// 3. we might have tried and gotten something.
- // So |m_bConfigLocaleCached| indicates whether we've already tried,
- // and |m_wsConfigLocale| is the possibly nothing we got if we tried.
- mutable std::optional<WideString> m_wsConfigLocale;
- mutable bool m_bConfigLocaleCached = false;
+ // So |config_locale_cached_| indicates whether we've already tried,
+ // and |config_locale_| is the possibly nothing we got if we tried.
+ mutable std::optional<WideString> config_locale_;
+ mutable bool config_locale_cached_ = false;
- LangID m_eDeflcid;
+ LangID deflcid_;
};
#endif // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index cde836f..872e961 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -71,25 +71,27 @@
public:
ScopedLocale(CXFA_LocaleMgr* pLocaleMgr, GCedLocaleIface* pNewLocale)
- : m_pLocaleMgr(pLocaleMgr),
- m_pNewLocale(pNewLocale),
- m_pOrigLocale(pNewLocale ? m_pLocaleMgr->GetDefLocale() : nullptr) {
- if (m_pNewLocale)
- m_pLocaleMgr->SetDefLocale(pNewLocale);
+ : locale_mgr_(pLocaleMgr),
+ new_locale_(pNewLocale),
+ orig_locale_(pNewLocale ? locale_mgr_->GetDefLocale() : nullptr) {
+ if (new_locale_) {
+ locale_mgr_->SetDefLocale(pNewLocale);
+ }
}
~ScopedLocale() {
- if (m_pNewLocale)
- m_pLocaleMgr->SetDefLocale(m_pOrigLocale);
+ if (new_locale_) {
+ locale_mgr_->SetDefLocale(orig_locale_);
+ }
}
ScopedLocale(const ScopedLocale& that) = delete;
ScopedLocale& operator=(const ScopedLocale& that) = delete;
private:
- UnownedPtr<CXFA_LocaleMgr> const m_pLocaleMgr; // Ok, stack-only.
- UnownedPtr<GCedLocaleIface> const m_pNewLocale; // Ok, stack-only.
- UnownedPtr<GCedLocaleIface> const m_pOrigLocale; // Ok, stack-only.
+ UnownedPtr<CXFA_LocaleMgr> const locale_mgr_; // Ok, stack-only.
+ UnownedPtr<GCedLocaleIface> const new_locale_; // Ok, stack-only.
+ UnownedPtr<GCedLocaleIface> const orig_locale_; // Ok, stack-only.
};
} // namespace
@@ -97,26 +99,26 @@
CXFA_LocaleValue::CXFA_LocaleValue() = default;
CXFA_LocaleValue::CXFA_LocaleValue(ValueType eType, CXFA_LocaleMgr* pLocaleMgr)
- : m_pLocaleMgr(pLocaleMgr),
- m_eType(eType),
- m_bValid(m_eType != ValueType::kNull) {}
+ : locale_mgr_(pLocaleMgr),
+ type_(eType),
+ valid_(type_ != ValueType::kNull) {}
CXFA_LocaleValue::CXFA_LocaleValue(ValueType eType,
const WideString& wsValue,
CXFA_LocaleMgr* pLocaleMgr)
- : m_pLocaleMgr(pLocaleMgr),
- m_wsValue(wsValue),
- m_eType(eType),
- m_bValid(ValidateCanonicalValue(wsValue, eType)) {}
+ : locale_mgr_(pLocaleMgr),
+ value_(wsValue),
+ type_(eType),
+ valid_(ValidateCanonicalValue(wsValue, eType)) {}
CXFA_LocaleValue::CXFA_LocaleValue(ValueType eType,
const WideString& wsValue,
const WideString& wsFormat,
GCedLocaleIface* pLocale,
CXFA_LocaleMgr* pLocaleMgr)
- : m_pLocaleMgr(pLocaleMgr),
- m_eType(eType),
- m_bValid(ParsePatternValue(wsValue, wsFormat, pLocale)) {}
+ : locale_mgr_(pLocaleMgr),
+ type_(eType),
+ valid_(ParsePatternValue(wsValue, wsFormat, pLocale)) {}
CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& that) = default;
@@ -129,10 +131,11 @@
const WideString& wsPattern,
GCedLocaleIface* pLocale,
WideString* pMatchFormat) {
- if (!m_pLocaleMgr)
+ if (!locale_mgr_) {
return false;
+ }
- ScopedLocale scoped_locale(m_pLocaleMgr, pLocale);
+ ScopedLocale scoped_locale(locale_mgr_, pLocale);
std::vector<WideString> wsPatterns =
CFGAS_StringFormatter::SplitOnBars(wsPattern);
@@ -142,7 +145,7 @@
for (; !bRet && i < wsPatterns.size(); i++) {
const WideString& wsFormat = wsPatterns[i];
auto pFormat = std::make_unique<CFGAS_StringFormatter>(wsFormat);
- switch (ValueCategory(pFormat->GetCategory(), m_eType)) {
+ switch (ValueCategory(pFormat->GetCategory(), type_)) {
case CFGAS_StringFormatter::Category::kNull:
bRet = pFormat->ParseNull(wsValue);
if (!bRet)
@@ -155,9 +158,9 @@
break;
case CFGAS_StringFormatter::Category::kNum: {
WideString fNum;
- bRet = pFormat->ParseNum(m_pLocaleMgr, wsValue, &fNum);
+ bRet = pFormat->ParseNum(locale_mgr_, wsValue, &fNum);
if (!bRet)
- bRet = pFormat->FormatNum(m_pLocaleMgr, wsValue, &wsOutput);
+ bRet = pFormat->FormatNum(locale_mgr_, wsValue, &wsOutput);
break;
}
case CFGAS_StringFormatter::Category::kText:
@@ -171,11 +174,11 @@
bRet = ValidateCanonicalDate(wsValue, &dt);
if (!bRet) {
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue, CFGAS_StringFormatter::DateTimeType::kDate,
+ locale_mgr_, wsValue, CFGAS_StringFormatter::DateTimeType::kDate,
&dt);
if (!bRet) {
bRet = pFormat->FormatDateTime(
- m_pLocaleMgr, wsValue,
+ locale_mgr_, wsValue,
CFGAS_StringFormatter::DateTimeType::kDate, &wsOutput);
}
}
@@ -184,11 +187,11 @@
case CFGAS_StringFormatter::Category::kTime: {
CFX_DateTime dt;
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
+ locale_mgr_, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
&dt);
if (!bRet) {
bRet = pFormat->FormatDateTime(
- m_pLocaleMgr, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
+ locale_mgr_, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
&wsOutput);
}
break;
@@ -196,11 +199,11 @@
case CFGAS_StringFormatter::Category::kDateTime: {
CFX_DateTime dt;
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue,
+ locale_mgr_, wsValue,
CFGAS_StringFormatter::DateTimeType::kDateTime, &dt);
if (!bRet) {
bRet = pFormat->FormatDateTime(
- m_pLocaleMgr, wsValue,
+ locale_mgr_, wsValue,
CFGAS_StringFormatter::DateTimeType::kDateTime, &wsOutput);
}
break;
@@ -216,55 +219,57 @@
}
double CXFA_LocaleValue::GetDoubleNum() const {
- if (!m_bValid || (m_eType != CXFA_LocaleValue::ValueType::kBoolean &&
- m_eType != CXFA_LocaleValue::ValueType::kInteger &&
- m_eType != CXFA_LocaleValue::ValueType::kDecimal &&
- m_eType != CXFA_LocaleValue::ValueType::kFloat)) {
+ if (!valid_ || (type_ != CXFA_LocaleValue::ValueType::kBoolean &&
+ type_ != CXFA_LocaleValue::ValueType::kInteger &&
+ type_ != CXFA_LocaleValue::ValueType::kDecimal &&
+ type_ != CXFA_LocaleValue::ValueType::kFloat)) {
return 0;
}
- return StringToDouble(m_wsValue.AsStringView());
+ return StringToDouble(value_.AsStringView());
}
CFX_DateTime CXFA_LocaleValue::GetDate() const {
- if (!m_bValid || m_eType != CXFA_LocaleValue::ValueType::kDate)
+ if (!valid_ || type_ != CXFA_LocaleValue::ValueType::kDate) {
return CFX_DateTime();
+ }
CFX_DateTime dt;
- FX_DateFromCanonical(m_wsValue.span(), &dt);
+ FX_DateFromCanonical(value_.span(), &dt);
return dt;
}
CFX_DateTime CXFA_LocaleValue::GetTime() const {
- if (!m_bValid || m_eType != CXFA_LocaleValue::ValueType::kTime)
+ if (!valid_ || type_ != CXFA_LocaleValue::ValueType::kTime) {
return CFX_DateTime();
+ }
CFX_DateTime dt;
- FX_TimeFromCanonical(m_pLocaleMgr->GetDefLocale(), m_wsValue.span(), &dt);
+ FX_TimeFromCanonical(locale_mgr_->GetDefLocale(), value_.span(), &dt);
return dt;
}
void CXFA_LocaleValue::SetDate(const CFX_DateTime& d) {
- m_eType = CXFA_LocaleValue::ValueType::kDate;
- m_wsValue = WideString::Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(),
- d.GetDay());
+ type_ = CXFA_LocaleValue::ValueType::kDate;
+ value_ = WideString::Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(),
+ d.GetDay());
}
void CXFA_LocaleValue::SetTime(const CFX_DateTime& t) {
- m_eType = CXFA_LocaleValue::ValueType::kTime;
- m_wsValue = WideString::Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
- t.GetSecond());
+ type_ = CXFA_LocaleValue::ValueType::kTime;
+ value_ = WideString::Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
+ t.GetSecond());
if (t.GetMillisecond() > 0)
- m_wsValue += WideString::Format(L"%:03d", t.GetMillisecond());
+ value_ += WideString::Format(L"%:03d", t.GetMillisecond());
}
void CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) {
- m_eType = CXFA_LocaleValue::ValueType::kDateTime;
- m_wsValue = WideString::Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(),
- dt.GetMonth(), dt.GetDay(), dt.GetHour(),
- dt.GetMinute(), dt.GetSecond());
+ type_ = CXFA_LocaleValue::ValueType::kDateTime;
+ value_ = WideString::Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(),
+ dt.GetMonth(), dt.GetDay(), dt.GetHour(),
+ dt.GetMinute(), dt.GetSecond());
if (dt.GetMillisecond() > 0)
- m_wsValue += WideString::Format(L"%:03d", dt.GetMillisecond());
+ value_ += WideString::Format(L"%:03d", dt.GetMillisecond());
}
bool CXFA_LocaleValue::FormatPatterns(WideString& wsResult,
@@ -283,53 +288,56 @@
const WideString& wsFormat,
GCedLocaleIface* pLocale,
XFA_ValuePicture eValueType) const {
- if (!m_pLocaleMgr)
+ if (!locale_mgr_) {
return false;
+ }
- ScopedLocale scoped_locale(m_pLocaleMgr, pLocale);
+ ScopedLocale scoped_locale(locale_mgr_, pLocale);
wsResult.clear();
bool bRet = false;
auto pFormat = std::make_unique<CFGAS_StringFormatter>(wsFormat);
CFGAS_StringFormatter::Category eCategory =
- ValueCategory(pFormat->GetCategory(), m_eType);
+ ValueCategory(pFormat->GetCategory(), type_);
switch (eCategory) {
case CFGAS_StringFormatter::Category::kNull:
- if (m_wsValue.IsEmpty())
+ if (value_.IsEmpty()) {
bRet = pFormat->FormatNull(&wsResult);
+ }
break;
case CFGAS_StringFormatter::Category::kZero:
- if (m_wsValue.EqualsASCII("0"))
+ if (value_.EqualsASCII("0")) {
bRet = pFormat->FormatZero(&wsResult);
+ }
break;
case CFGAS_StringFormatter::Category::kNum:
- bRet = pFormat->FormatNum(m_pLocaleMgr, m_wsValue, &wsResult);
+ bRet = pFormat->FormatNum(locale_mgr_, value_, &wsResult);
break;
case CFGAS_StringFormatter::Category::kText:
- bRet = pFormat->FormatText(m_wsValue, &wsResult);
+ bRet = pFormat->FormatText(value_, &wsResult);
break;
case CFGAS_StringFormatter::Category::kDate:
- bRet = pFormat->FormatDateTime(m_pLocaleMgr, m_wsValue,
+ bRet = pFormat->FormatDateTime(locale_mgr_, value_,
CFGAS_StringFormatter::DateTimeType::kDate,
&wsResult);
break;
case CFGAS_StringFormatter::Category::kTime:
- bRet = pFormat->FormatDateTime(m_pLocaleMgr, m_wsValue,
+ bRet = pFormat->FormatDateTime(locale_mgr_, value_,
CFGAS_StringFormatter::DateTimeType::kTime,
&wsResult);
break;
case CFGAS_StringFormatter::Category::kDateTime:
bRet = pFormat->FormatDateTime(
- m_pLocaleMgr, m_wsValue,
- CFGAS_StringFormatter::DateTimeType::kDateTime, &wsResult);
+ locale_mgr_, value_, CFGAS_StringFormatter::DateTimeType::kDateTime,
+ &wsResult);
break;
default:
- wsResult = m_wsValue;
+ wsResult = value_;
bRet = true;
}
if (!bRet && (eCategory != CFGAS_StringFormatter::Category::kNum ||
eValueType != XFA_ValuePicture::kDisplay)) {
- wsResult = m_wsValue;
+ wsResult = value_;
}
return bRet;
@@ -561,44 +569,45 @@
bool CXFA_LocaleValue::ParsePatternValue(const WideString& wsValue,
const WideString& wsPattern,
GCedLocaleIface* pLocale) {
- if (!m_pLocaleMgr)
+ if (!locale_mgr_) {
return false;
+ }
std::vector<WideString> wsPatterns =
CFGAS_StringFormatter::SplitOnBars(wsPattern);
- ScopedLocale scoped_locale(m_pLocaleMgr, pLocale);
+ ScopedLocale scoped_locale(locale_mgr_, pLocale);
bool bRet = false;
for (size_t i = 0; !bRet && i < wsPatterns.size(); i++) {
const WideString& wsFormat = wsPatterns[i];
auto pFormat = std::make_unique<CFGAS_StringFormatter>(wsFormat);
- switch (ValueCategory(pFormat->GetCategory(), m_eType)) {
+ switch (ValueCategory(pFormat->GetCategory(), type_)) {
case CFGAS_StringFormatter::Category::kNull:
bRet = pFormat->ParseNull(wsValue);
if (bRet)
- m_wsValue.clear();
+ value_.clear();
break;
case CFGAS_StringFormatter::Category::kZero:
bRet = pFormat->ParseZero(wsValue);
if (bRet)
- m_wsValue = L"0";
+ value_ = L"0";
break;
case CFGAS_StringFormatter::Category::kNum: {
WideString fNum;
- bRet = pFormat->ParseNum(m_pLocaleMgr, wsValue, &fNum);
+ bRet = pFormat->ParseNum(locale_mgr_, wsValue, &fNum);
if (bRet)
- m_wsValue = std::move(fNum);
+ value_ = std::move(fNum);
break;
}
case CFGAS_StringFormatter::Category::kText:
- bRet = pFormat->ParseText(wsValue, &m_wsValue);
+ bRet = pFormat->ParseText(wsValue, &value_);
break;
case CFGAS_StringFormatter::Category::kDate: {
CFX_DateTime dt;
bRet = ValidateCanonicalDate(wsValue, &dt);
if (!bRet) {
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue, CFGAS_StringFormatter::DateTimeType::kDate,
+ locale_mgr_, wsValue, CFGAS_StringFormatter::DateTimeType::kDate,
&dt);
}
if (bRet)
@@ -608,7 +617,7 @@
case CFGAS_StringFormatter::Category::kTime: {
CFX_DateTime dt;
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
+ locale_mgr_, wsValue, CFGAS_StringFormatter::DateTimeType::kTime,
&dt);
if (bRet)
SetTime(dt);
@@ -617,20 +626,20 @@
case CFGAS_StringFormatter::Category::kDateTime: {
CFX_DateTime dt;
bRet = pFormat->ParseDateTime(
- m_pLocaleMgr, wsValue,
+ locale_mgr_, wsValue,
CFGAS_StringFormatter::DateTimeType::kDateTime, &dt);
if (bRet)
SetDateTime(dt);
break;
}
default:
- m_wsValue = wsValue;
+ value_ = wsValue;
bRet = true;
break;
}
}
if (!bRet)
- m_wsValue = wsValue;
+ value_ = wsValue;
return bRet;
}
diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
index a0bc793..8b117bf 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.h
+++ b/xfa/fxfa/parser/cxfa_localevalue.h
@@ -64,9 +64,9 @@
const WideString& wsFormat,
GCedLocaleIface* pLocale);
- bool IsValid() const { return m_bValid; }
- const WideString& GetValue() const { return m_wsValue; }
- ValueType GetType() const { return m_eType; }
+ bool IsValid() const { return valid_; }
+ const WideString& GetValue() const { return value_; }
+ ValueType GetType() const { return type_; }
double GetDoubleNum() const;
void SetDate(const CFX_DateTime& d);
CFX_DateTime GetDate() const;
@@ -88,10 +88,10 @@
const WideString& wsPattern,
GCedLocaleIface* pLocale);
- UnownedPtr<CXFA_LocaleMgr> m_pLocaleMgr; // Ok, stack-only.
- WideString m_wsValue;
- ValueType m_eType = ValueType::kNull;
- bool m_bValid = true;
+ UnownedPtr<CXFA_LocaleMgr> locale_mgr_; // Ok, stack-only.
+ WideString value_;
+ ValueType type_ = ValueType::kNull;
+ bool valid_ = true;
};
#endif // XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
diff --git a/xfa/fxfa/parser/cxfa_measurement.h b/xfa/fxfa/parser/cxfa_measurement.h
index 1324a31..2e01129 100644
--- a/xfa/fxfa/parser/cxfa_measurement.h
+++ b/xfa/fxfa/parser/cxfa_measurement.h
@@ -19,12 +19,12 @@
static XFA_Unit GetUnitFromString(WideStringView wsUnit);
void Set(float fValue, XFA_Unit eUnit) {
- m_fValue = fValue;
- m_eUnit = eUnit;
+ value_ = fValue;
+ unit_ = eUnit;
}
- XFA_Unit GetUnit() const { return m_eUnit; }
- float GetValue() const { return m_fValue; }
+ XFA_Unit GetUnit() const { return unit_; }
+ float GetValue() const { return value_; }
WideString ToString() const;
float ToUnit(XFA_Unit eUnit) const;
@@ -33,8 +33,8 @@
void SetString(WideStringView wsMeasure);
bool ToUnitInternal(XFA_Unit eUnit, float* fValue) const;
- float m_fValue = 0.0f;
- XFA_Unit m_eUnit = XFA_Unit::Percent;
+ float value_ = 0.0f;
+ XFA_Unit unit_ = XFA_Unit::Percent;
};
#endif // XFA_FXFA_PARSER_CXFA_MEASUREMENT_H_
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 20862ee..5e9d4f5 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -815,14 +815,14 @@
virtual CXFA_ImageLayoutData* AsImageLayoutData() { return nullptr; }
virtual CXFA_TextLayoutData* AsTextLayoutData() { return nullptr; }
- float GetWidgetHeight() const { return m_fWidgetHeight; }
- void SetWidgetHeight(float height) { m_fWidgetHeight = height; }
+ float GetWidgetHeight() const { return widget_height_; }
+ void SetWidgetHeight(float height) { widget_height_ = height; }
protected:
CXFA_WidgetLayoutData() = default;
private:
- float m_fWidgetHeight = -1.0f;
+ float widget_height_ = -1.0f;
};
class CXFA_TextLayoutData final : public CXFA_WidgetLayoutData {
@@ -832,31 +832,32 @@
void Trace(cppgc::Visitor* visitor) const override {
CXFA_WidgetLayoutData::Trace(visitor);
- visitor->Trace(m_pTextLayout);
- visitor->Trace(m_pTextProvider);
+ visitor->Trace(text_layout_);
+ visitor->Trace(text_provider_);
}
CXFA_TextLayoutData* AsTextLayoutData() override { return this; }
- CXFA_TextLayout* GetTextLayout() const { return m_pTextLayout; }
- CXFA_TextProvider* GetTextProvider() const { return m_pTextProvider; }
+ CXFA_TextLayout* GetTextLayout() const { return text_layout_; }
+ CXFA_TextProvider* GetTextProvider() const { return text_provider_; }
void LoadText(CXFA_FFDoc* doc, CXFA_Node* pNode) {
- if (m_pTextLayout)
+ if (text_layout_) {
return;
+ }
- m_pTextProvider = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
+ text_provider_ = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
doc->GetHeap()->GetAllocationHandle(), pNode,
CXFA_TextProvider::Type::kText);
- m_pTextLayout = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
- doc->GetHeap()->GetAllocationHandle(), doc, m_pTextProvider);
+ text_layout_ = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
+ doc->GetHeap()->GetAllocationHandle(), doc, text_provider_);
}
private:
CXFA_TextLayoutData() = default;
- cppgc::Member<CXFA_TextLayout> m_pTextLayout;
- cppgc::Member<CXFA_TextProvider> m_pTextProvider;
+ cppgc::Member<CXFA_TextLayout> text_layout_;
+ cppgc::Member<CXFA_TextProvider> text_provider_;
};
class CXFA_ImageLayoutData final : public CXFA_WidgetLayoutData {
@@ -867,8 +868,9 @@
CXFA_ImageLayoutData* AsImageLayoutData() override { return this; }
bool LoadImageData(CXFA_FFDoc* doc, CXFA_Node* pNode) {
- if (m_pDIBitmap)
+ if (dibitmap_) {
return true;
+ }
CXFA_Value* value = pNode->GetFormValueIfExists();
if (!value)
@@ -878,24 +880,24 @@
if (!image)
return false;
- pNode->SetLayoutImage(XFA_LoadImageData(doc, image, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
+ pNode->SetLayoutImage(
+ XFA_LoadImageData(doc, image, named_image_, image_xdpi_, image_ydpi_));
+ return !!dibitmap_;
}
- CFX_Size GetDpi() const { return CFX_Size(m_iImageXDpi, m_iImageYDpi); }
- RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pDIBitmap; }
+ CFX_Size GetDpi() const { return CFX_Size(image_xdpi_, image_ydpi_); }
+ RetainPtr<CFX_DIBitmap> GetBitmap() { return dibitmap_; }
void SetBitmap(RetainPtr<CFX_DIBitmap> pBitmap) {
- m_pDIBitmap = std::move(pBitmap);
+ dibitmap_ = std::move(pBitmap);
}
private:
CXFA_ImageLayoutData() = default;
- bool m_bNamedImage = false;
- int32_t m_iImageXDpi = 0;
- int32_t m_iImageYDpi = 0;
- RetainPtr<CFX_DIBitmap> m_pDIBitmap;
+ bool named_image_ = false;
+ int32_t image_xdpi_ = 0;
+ int32_t image_ydpi_ = 0;
+ RetainPtr<CFX_DIBitmap> dibitmap_;
};
class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
@@ -905,8 +907,8 @@
void Trace(cppgc::Visitor* visitor) const override {
CXFA_WidgetLayoutData::Trace(visitor);
- visitor->Trace(m_pCapTextLayout);
- visitor->Trace(m_pCapTextProvider);
+ visitor->Trace(cap_text_layout_);
+ visitor->Trace(cap_text_provider_);
}
CXFA_FieldLayoutData* AsFieldLayoutData() override { return this; }
@@ -914,24 +916,25 @@
virtual CXFA_TextEditData* AsTextEditData() { return nullptr; }
bool LoadCaption(CXFA_FFDoc* doc, CXFA_Node* pNode) {
- if (m_pCapTextLayout)
+ if (cap_text_layout_) {
return true;
+ }
CXFA_Caption* caption = pNode->GetCaptionIfExists();
if (!caption || caption->IsHidden())
return false;
- m_pCapTextProvider = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
+ cap_text_provider_ = cppgc::MakeGarbageCollected<CXFA_TextProvider>(
doc->GetHeap()->GetAllocationHandle(), pNode,
CXFA_TextProvider::Type::kCaption);
- m_pCapTextLayout = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
- doc->GetHeap()->GetAllocationHandle(), doc, m_pCapTextProvider);
+ cap_text_layout_ = cppgc::MakeGarbageCollected<CXFA_TextLayout>(
+ doc->GetHeap()->GetAllocationHandle(), doc, cap_text_provider_);
return true;
}
- cppgc::Member<CXFA_TextLayout> m_pCapTextLayout;
- cppgc::Member<CXFA_TextProvider> m_pCapTextProvider;
- std::unique_ptr<CFDE_TextOut> m_pTextOut;
- std::vector<float> m_FieldSplitArray;
+ cppgc::Member<CXFA_TextLayout> cap_text_layout_;
+ cppgc::Member<CXFA_TextProvider> cap_text_provider_;
+ std::unique_ptr<CFDE_TextOut> text_out_;
+ std::vector<float> field_split_array_;
protected:
CXFA_FieldLayoutData() = default;
@@ -956,8 +959,9 @@
CXFA_ImageEditData* AsImageEditData() override { return this; }
bool LoadImageData(CXFA_FFDoc* doc, CXFA_Node* pNode) {
- if (m_pDIBitmap)
+ if (dibitmap_) {
return true;
+ }
CXFA_Value* value = pNode->GetFormValueIfExists();
if (!value)
@@ -967,24 +971,24 @@
if (!image)
return false;
- pNode->SetEditImage(XFA_LoadImageData(doc, image, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
+ pNode->SetEditImage(
+ XFA_LoadImageData(doc, image, named_image_, image_xdpi_, image_ydpi_));
+ return !!dibitmap_;
}
- CFX_Size GetDpi() const { return CFX_Size(m_iImageXDpi, m_iImageYDpi); }
- RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pDIBitmap; }
+ CFX_Size GetDpi() const { return CFX_Size(image_xdpi_, image_ydpi_); }
+ RetainPtr<CFX_DIBitmap> GetBitmap() { return dibitmap_; }
void SetBitmap(RetainPtr<CFX_DIBitmap> pBitmap) {
- m_pDIBitmap = std::move(pBitmap);
+ dibitmap_ = std::move(pBitmap);
}
private:
CXFA_ImageEditData() = default;
- bool m_bNamedImage = false;
- int32_t m_iImageXDpi = 0;
- int32_t m_iImageYDpi = 0;
- RetainPtr<CFX_DIBitmap> m_pDIBitmap;
+ bool named_image_ = false;
+ int32_t image_xdpi_ = 0;
+ int32_t image_ydpi_ = 0;
+ RetainPtr<CFX_DIBitmap> dibitmap_;
};
CXFA_Node::CXFA_Node(CXFA_Document* pDoc,
@@ -996,11 +1000,11 @@
pdfium::span<const AttributeData> attributes,
CJX_Object* js_object)
: CXFA_Object(pDoc, oType, eType, js_object),
- m_Properties(properties),
- m_Attributes(attributes),
- m_ValidPackets(validPackets),
- m_ePacket(ePacket) {
- DCHECK(m_pDocument);
+ properties_(properties),
+ attributes_(attributes),
+ valid_packets_(validPackets),
+ packet_(ePacket) {
+ DCHECK(document_);
}
CXFA_Node::~CXFA_Node() = default;
@@ -1008,14 +1012,14 @@
void CXFA_Node::Trace(cppgc::Visitor* visitor) const {
CXFA_Object::Trace(visitor);
GCedTreeNodeMixin<CXFA_Node>::Trace(visitor);
- visitor->Trace(m_pAuxNode);
- visitor->Trace(m_pLayoutData);
+ visitor->Trace(aux_node_);
+ visitor->Trace(layout_data_);
visitor->Trace(ui_);
ContainerTrace(visitor, binding_nodes_);
}
CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
- CXFA_Node* pClone = m_pDocument->CreateNode(m_ePacket, m_elementType);
+ CXFA_Node* pClone = document_->CreateNode(packet_, element_type_);
if (!pClone)
return nullptr;
@@ -1089,13 +1093,13 @@
bool CXFA_Node::IsValidInPacket(XFA_PacketType packet) const {
uint32_t bitflag = 1 << static_cast<uint8_t>(packet);
- return !!(m_ValidPackets & static_cast<XFA_XDPPACKET>(bitflag));
+ return !!(valid_packets_ & static_cast<XFA_XDPPACKET>(bitflag));
}
const CXFA_Node::PropertyData* CXFA_Node::GetPropertyData(
XFA_Element property) const {
DCHECK(property != XFA_Element::Unknown);
- for (const auto& prop : m_Properties) {
+ for (const auto& prop : properties_) {
if (prop.property == property)
return ∝
}
@@ -1168,7 +1172,7 @@
std::optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(
XFA_PropertyFlag flag) const {
- for (const auto& prop : m_Properties) {
+ for (const auto& prop : properties_) {
if (prop.flags & flag)
return prop.property;
}
@@ -1178,7 +1182,7 @@
const CXFA_Node::AttributeData* CXFA_Node::GetAttributeData(
XFA_Attribute attr) const {
DCHECK(attr != XFA_Attribute::Unknown);
- for (const auto& cur_attr : m_Attributes) {
+ for (const auto& cur_attr : attributes_) {
if (cur_attr.attribute == attr)
return &cur_attr;
}
@@ -1190,8 +1194,8 @@
}
XFA_Attribute CXFA_Node::GetAttribute(size_t i) const {
- return i < m_Attributes.size() ? m_Attributes[i].attribute
- : XFA_Attribute::Unknown;
+ return i < attributes_.size() ? attributes_[i].attribute
+ : XFA_Attribute::Unknown;
}
XFA_AttributeType CXFA_Node::GetAttributeType(XFA_Attribute type) const {
@@ -1256,7 +1260,7 @@
return nodes;
CXFA_Node* pNewNode =
- m_pDocument->CreateNode(GetPacketType(), property.value());
+ document_->CreateNode(GetPacketType(), property.value());
if (pNewNode) {
InsertChildAndNotify(pNewNode, nullptr);
pNewNode->SetInitializedFlagAndNotify();
@@ -1266,7 +1270,7 @@
}
CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType) {
- CXFA_Node* pNode = m_pDocument->CreateNode(m_ePacket, eType);
+ CXFA_Node* pNode = document_->CreateNode(packet_, eType);
if (!pNode)
return nullptr;
@@ -1275,9 +1279,9 @@
}
CXFA_Node* CXFA_Node::CloneTemplateToForm(bool bRecursive) {
- CHECK_EQ(m_ePacket, XFA_PacketType::Template);
+ CHECK_EQ(packet_, XFA_PacketType::Template);
CXFA_Node* pClone =
- m_pDocument->CreateNode(XFA_PacketType::Form, m_elementType);
+ document_->CreateNode(XFA_PacketType::Form, element_type_);
if (!pClone)
return nullptr;
@@ -1299,11 +1303,11 @@
}
CXFA_Node* CXFA_Node::GetTemplateNodeIfExists() const {
- return m_pAuxNode;
+ return aux_node_;
}
void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) {
- m_pAuxNode = pTemplateNode;
+ aux_node_ = pTemplateNode;
}
CXFA_Node* CXFA_Node::GetBindData() {
@@ -1335,7 +1339,7 @@
binding_nodes_.clear();
binding_nodes_.push_back(pOldFormItem);
binding_nodes_.push_back(pFormNode);
- m_uNodeFlags |= XFA_NodeFlag::kBindFormItems;
+ node_flags_ |= XFA_NodeFlag::kBindFormItems;
}
bool CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) {
@@ -1346,7 +1350,7 @@
binding_nodes_.erase(it);
if (binding_nodes_.size() == 1) {
- m_uNodeFlags.Clear(XFA_NodeFlag::kBindFormItems);
+ node_flags_.Clear(XFA_NodeFlag::kBindFormItems);
return true;
}
return !binding_nodes_.empty();
@@ -1503,7 +1507,7 @@
return XFA_AttributeValue::None;
}
- XFA_VERSION version = m_pDocument->GetCurVersionMode();
+ XFA_VERSION version = document_->GetCurVersionMode();
if (eParLayout == XFA_AttributeValue::Tb && version < XFA_VERSION_208) {
std::optional<CXFA_Measurement> measureH =
JSObject()->TryMeasure(XFA_Attribute::H, false);
@@ -1533,36 +1537,37 @@
}
CXFA_Node* CXFA_Node::GetDataDescriptionNode() {
- if (m_ePacket == XFA_PacketType::Datasets)
- return m_pAuxNode;
+ if (packet_ == XFA_PacketType::Datasets) {
+ return aux_node_;
+ }
return nullptr;
}
void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) {
- DCHECK_EQ(m_ePacket, XFA_PacketType::Datasets);
- m_pAuxNode = pDataDescriptionNode;
+ DCHECK_EQ(packet_, XFA_PacketType::Datasets);
+ aux_node_ = pDataDescriptionNode;
}
CXFA_Node* CXFA_Node::GetModelNode() {
switch (GetPacketType()) {
case XFA_PacketType::Xdp:
- return m_pDocument->GetRoot();
+ return document_->GetRoot();
case XFA_PacketType::Config:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_Config));
case XFA_PacketType::Template:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_Template));
case XFA_PacketType::Form:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_Form));
case XFA_PacketType::Datasets:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_Datasets));
case XFA_PacketType::LocaleSet:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_LocaleSet));
case XFA_PacketType::ConnectionSet:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_ConnectionSet));
case XFA_PacketType::SourceSet:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_SourceSet));
case XFA_PacketType::Xdc:
- return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc));
+ return ToNode(document_->GetXFAObject(XFA_HASHCODE_Xdc));
default:
return this;
}
@@ -1618,7 +1623,7 @@
pNode->ClearFlag(XFA_NodeFlag::kHasRemovedChildren);
InsertBefore(pNode, pBeforeNode);
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
+ CXFA_FFNotify* pNotify = document_->GetNotify();
if (pNotify)
pNotify->OnChildAdded(this);
@@ -1773,7 +1778,7 @@
CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() {
CXFA_Node* pInstanceMgr = nullptr;
- if (m_ePacket == XFA_PacketType::Form) {
+ if (packet_ == XFA_PacketType::Form) {
CXFA_Node* pParentNode = GetParent();
if (!pParentNode || pParentNode->GetElementType() == XFA_Element::Area)
return pInstanceMgr;
@@ -1782,7 +1787,7 @@
pNode = pNode->GetPrevSibling()) {
XFA_Element eType = pNode->GetElementType();
if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) &&
- pNode->m_dwNameHash != m_dwNameHash) {
+ pNode->name_hash_ != name_hash_) {
break;
}
if (eType == XFA_Element::InstanceManager) {
@@ -1805,8 +1810,9 @@
}
bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const {
- if (m_uNodeFlags & dwFlag)
+ if (node_flags_ & dwFlag) {
return true;
+ }
if (dwFlag == XFA_NodeFlag::kHasRemovedChildren)
return GetParent() && GetParent()->HasFlag(dwFlag);
return false;
@@ -1814,19 +1820,19 @@
void CXFA_Node::SetInitializedFlagAndNotify() {
if (!IsInitialized()) {
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
+ CXFA_FFNotify* pNotify = document_->GetNotify();
if (pNotify)
pNotify->OnNodeReady(this);
}
- m_uNodeFlags |= XFA_NodeFlag::kInitialized;
+ node_flags_ |= XFA_NodeFlag::kInitialized;
}
void CXFA_Node::SetFlag(XFA_NodeFlag dwFlag) {
- m_uNodeFlags |= dwFlag;
+ node_flags_ |= dwFlag;
}
void CXFA_Node::ClearFlag(XFA_NodeFlag dwFlag) {
- m_uNodeFlags.Clear(dwFlag);
+ node_flags_.Clear(dwFlag);
}
bool CXFA_Node::IsAttributeInXML() {
@@ -1838,14 +1844,14 @@
if (!bNotify)
return;
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
+ CXFA_FFNotify* pNotify = document_->GetNotify();
if (pNotify)
pNotify->OnChildRemoved();
}
void CXFA_Node::UpdateNameHash() {
WideString wsName = JSObject()->GetCData(XFA_Attribute::Name);
- m_dwNameHash = FX_HashCode_GetW(wsName.AsStringView());
+ name_hash_ = FX_HashCode_GetW(wsName.AsStringView());
}
CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() {
@@ -2361,7 +2367,7 @@
if (intact.value() != XFA_AttributeValue::None ||
eLayoutType != XFA_AttributeValue::Row ||
- m_pDocument->GetCurVersionMode() >= XFA_VERSION_208) {
+ document_->GetCurVersionMode() >= XFA_VERSION_208) {
return intact;
}
@@ -2430,7 +2436,7 @@
return XFA_EventError::kNotExist;
std::vector<CXFA_Event*> eventArray =
- GetEventByActivity(iActivity, pEventParam->m_bIsFormReady);
+ GetEventByActivity(iActivity, pEventParam->is_form_ready_);
bool first = true;
XFA_EventError iRet = XFA_EventError::kNotExist;
for (CXFA_Event* event : eventArray) {
@@ -2491,14 +2497,14 @@
return XFA_EventError::kDisabled;
CXFA_EventParam EventParam(XFA_EVENT_Calculate);
- EventParam.m_bTargeted = false;
+ EventParam.targeted_ = false;
XFA_EventError iRet =
ExecuteScript(pDocView, calc->GetScriptIfExists(), &EventParam);
if (iRet != XFA_EventError::kSuccess)
return iRet;
- if (GetRawValue() != EventParam.m_wsResult) {
- SetValue(XFA_ValuePicture::kRaw, EventParam.m_wsResult);
+ if (GetRawValue() != EventParam.result_) {
+ SetValue(XFA_ValuePicture::kRaw, EventParam.result_);
pDocView->UpdateUIDisplay(this, nullptr);
}
return XFA_EventError::kSuccess;
@@ -2603,8 +2609,9 @@
bool bVersionFlag) {
if (!GetValue(XFA_ValuePicture::kRaw).IsEmpty())
return XFA_EventError::kSuccess;
- if (m_bIsNull && m_bPreNull)
+ if (is_null_ && pre_null_) {
return XFA_EventError::kSuccess;
+ }
XFA_AttributeValue eNullTest = validate->GetNullTest();
WideString wsNullMsg = validate->GetNullMessageText();
@@ -2749,8 +2756,9 @@
CXFA_FFDocView* pDocView,
CXFA_Script* script,
CXFA_EventParam* pEventParam) {
- if (m_ExecuteRecursionDepth > kMaxExecuteRecursion)
+ if (execute_recursion_depth_ > kMaxExecuteRecursion) {
return {XFA_EventError::kSuccess, false};
+ }
DCHECK(pEventParam);
if (!script)
@@ -2769,19 +2777,19 @@
CXFA_FFDoc* pDoc = pDocView->GetDoc();
CFXJSE_Engine* pContext = pDoc->GetXFADoc()->GetScriptContext();
CFXJSE_Engine::EventParamScope paramScope(
- pContext, pEventParam->m_bTargeted ? this : nullptr, pEventParam);
+ pContext, pEventParam->targeted_ ? this : nullptr, pEventParam);
pContext->SetRunAtType(script->GetRunAt());
std::vector<cppgc::Persistent<CXFA_Node>> refNodes;
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
- pEventParam->m_eType == XFA_EVENT_Calculate) {
+ if (pEventParam->type_ == XFA_EVENT_InitCalculate ||
+ pEventParam->type_ == XFA_EVENT_Calculate) {
pContext->SetNodesOfRunScript(&refNodes);
}
CFXJSE_Context::ExecutionResult exec_result;
{
- AutoRestorer<uint8_t> restorer(&m_ExecuteRecursionDepth);
- ++m_ExecuteRecursionDepth;
+ AutoRestorer<uint8_t> restorer(&execute_recursion_depth_);
+ ++execute_recursion_depth_;
exec_result =
pContext->RunScript(eScriptType, wsExpression.AsStringView(), this);
}
@@ -2789,11 +2797,11 @@
XFA_EventError iRet = XFA_EventError::kError;
if (exec_result.status) {
iRet = XFA_EventError::kSuccess;
- if (pEventParam->m_eType == XFA_EVENT_Calculate ||
- pEventParam->m_eType == XFA_EVENT_InitCalculate) {
+ if (pEventParam->type_ == XFA_EVENT_Calculate ||
+ pEventParam->type_ == XFA_EVENT_InitCalculate) {
if (!exec_result.value->IsUndefined(pContext->GetIsolate())) {
if (!exec_result.value->IsNull(pContext->GetIsolate())) {
- pEventParam->m_wsResult =
+ pEventParam->result_ =
exec_result.value->ToWideString(pContext->GetIsolate());
}
@@ -2801,10 +2809,10 @@
} else {
iRet = XFA_EventError::kError;
}
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
+ if (pEventParam->type_ == XFA_EVENT_InitCalculate) {
if ((iRet == XFA_EventError::kSuccess) &&
- (GetRawValue() != pEventParam->m_wsResult)) {
- SetValue(XFA_ValuePicture::kRaw, pEventParam->m_wsResult);
+ (GetRawValue() != pEventParam->result_)) {
+ SetValue(XFA_ValuePicture::kRaw, pEventParam->result_);
pDocView->AddValidateNode(this);
}
}
@@ -2814,8 +2822,9 @@
CJX_Object::CalcData* pGlobalData =
pRefNode->JSObject()->GetOrCreateCalcData(pDoc->GetHeap());
- if (!pdfium::Contains(pGlobalData->m_Globals, this))
+ if (!pdfium::Contains(pGlobalData->m_Globals, this)) {
pGlobalData->m_Globals.push_back(this);
+ }
}
}
}
@@ -3165,7 +3174,7 @@
const bool bVert = iCapPlacement == XFA_AttributeValue::Top ||
iCapPlacement == XFA_AttributeValue::Bottom;
CXFA_TextLayout* pCapTextLayout =
- m_pLayoutData->AsFieldLayoutData()->m_pCapTextLayout;
+ layout_data_->AsFieldLayoutData()->cap_text_layout_;
if (pCapTextLayout) {
if (!bVert && GetFFWidgetType() != XFA_FFWidgetType::kButton)
pszCap->width = fCapReserve;
@@ -3291,10 +3300,10 @@
if (wsText.Back() == L'\n')
wsText += L'\n';
- CXFA_FieldLayoutData* layoutData = m_pLayoutData->AsFieldLayoutData();
- if (!layoutData->m_pTextOut) {
- layoutData->m_pTextOut = std::make_unique<CFDE_TextOut>();
- CFDE_TextOut* pTextOut = layoutData->m_pTextOut.get();
+ CXFA_FieldLayoutData* layoutData = layout_data_->AsFieldLayoutData();
+ if (!layoutData->text_out_) {
+ layoutData->text_out_ = std::make_unique<CFDE_TextOut>();
+ CFDE_TextOut* pTextOut = layoutData->text_out_.get();
pTextOut->SetFont(GetFGASFont(doc));
pTextOut->SetFontSize(fFontSize);
pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
@@ -3307,7 +3316,7 @@
pTextOut->SetStyles(dwStyles);
}
- layoutData->m_pTextOut->CalcLogicSize(wsText.AsStringView(), pSize);
+ layoutData->text_out_->CalcLogicSize(wsText.AsStringView(), pSize);
}
void CXFA_Node::CalculateTextEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {
@@ -3430,22 +3439,22 @@
bool CXFA_Node::LoadLayoutImage(CXFA_FFDoc* doc) {
InitLayoutData(doc);
- return m_pLayoutData->AsImageLayoutData()->LoadImageData(doc, this);
+ return layout_data_->AsImageLayoutData()->LoadImageData(doc, this);
}
bool CXFA_Node::LoadEditImage(CXFA_FFDoc* doc) {
InitLayoutData(doc);
- return m_pLayoutData->AsFieldLayoutData()->AsImageEditData()->LoadImageData(
+ return layout_data_->AsFieldLayoutData()->AsImageEditData()->LoadImageData(
doc, this);
}
CFX_Size CXFA_Node::GetLayoutImageDpi() const {
- return m_pLayoutData->AsImageLayoutData()->GetDpi();
+ return layout_data_->AsImageLayoutData()->GetDpi();
}
CFX_Size CXFA_Node::GetEditImageDpi() const {
CXFA_ImageEditData* pData =
- m_pLayoutData->AsFieldLayoutData()->AsImageEditData();
+ layout_data_->AsFieldLayoutData()->AsImageEditData();
return pData->GetDpi();
}
@@ -3501,14 +3510,14 @@
InitLayoutData(doc);
if (GetFFWidgetType() == XFA_FFWidgetType::kText) {
- m_pLayoutData->SetWidgetHeight(TryHeight().value_or(-1));
+ layout_data_->SetWidgetHeight(TryHeight().value_or(-1));
StartTextLayout(doc, pCalcWidth, pCalcHeight);
return;
}
if (*pCalcWidth > 0 && *pCalcHeight > 0)
return;
- m_pLayoutData->SetWidgetHeight(-1.0f);
+ layout_data_->SetWidgetHeight(-1.0f);
float fWidth = 0;
if (*pCalcWidth > 0 && *pCalcHeight < 0) {
std::optional<float> height = TryHeight();
@@ -3519,7 +3528,7 @@
*pCalcWidth = size.width;
*pCalcHeight = size.height;
}
- m_pLayoutData->SetWidgetHeight(*pCalcHeight);
+ layout_data_->SetWidgetHeight(*pCalcHeight);
return;
}
if (*pCalcWidth < 0 && *pCalcHeight < 0) {
@@ -3539,11 +3548,11 @@
*pCalcWidth = fWidth;
}
}
- m_pLayoutData->SetWidgetHeight(*pCalcHeight);
+ layout_data_->SetWidgetHeight(*pCalcHeight);
}
CFX_SizeF CXFA_Node::CalculateAccWidthAndHeight(CXFA_FFDoc* doc, float fWidth) {
- CFX_SizeF sz(fWidth, m_pLayoutData->GetWidgetHeight());
+ CFX_SizeF sz(fWidth, layout_data_->GetWidgetHeight());
switch (GetFFWidgetType()) {
case XFA_FFWidgetType::kBarcode:
case XFA_FFWidgetType::kChoiceList:
@@ -3579,7 +3588,7 @@
case XFA_FFWidgetType::kNone:
break;
}
- m_pLayoutData->SetWidgetHeight(sz.height);
+ layout_data_->SetWidgetHeight(sz.height);
return sz;
}
@@ -3622,10 +3631,9 @@
fCalcHeight = std::max(fCalcHeight, 0.0f);
}
CXFA_TextLayout* pTextLayout =
- m_pLayoutData->AsTextLayoutData()->GetTextLayout();
+ layout_data_->AsTextLayoutData()->GetTextLayout();
fCalcHeight = pTextLayout->DoSplitLayout(
- szBlockIndex, fCalcHeight,
- m_pLayoutData->GetWidgetHeight() - fTopInset);
+ szBlockIndex, fCalcHeight, layout_data_->GetWidgetHeight() - fTopInset);
if (fCalcHeight != 0) {
if (szBlockIndex == 0)
fCalcHeight += fTopInset;
@@ -3648,27 +3656,27 @@
return 0.0f;
}
if (iCapPlacement == XFA_AttributeValue::Bottom &&
- m_pLayoutData->GetWidgetHeight() - fCapReserve - fBottomInset) {
+ layout_data_->GetWidgetHeight() - fCapReserve - fBottomInset) {
return 0.0f;
}
if (iCapPlacement != XFA_AttributeValue::Top)
fCapReserve = 0;
}
- CXFA_FieldLayoutData* pFieldData = m_pLayoutData->AsFieldLayoutData();
+ CXFA_FieldLayoutData* pFieldData = layout_data_->AsFieldLayoutData();
int32_t iLinesCount = 0;
- float fHeight = m_pLayoutData->GetWidgetHeight();
+ float fHeight = layout_data_->GetWidgetHeight();
if (GetValue(XFA_ValuePicture::kDisplay).IsEmpty()) {
iLinesCount = 1;
} else {
- if (!pFieldData->m_pTextOut) {
+ if (!pFieldData->text_out_) {
CFX_SizeF size = CalculateAccWidthAndHeight(pDocView->GetDoc(),
TryWidth().value_or(0));
fHeight = size.height;
}
- iLinesCount = pFieldData->m_pTextOut->GetTotalLines();
+ iLinesCount = pFieldData->text_out_->GetTotalLines();
}
- std::vector<float>* pFieldArray = &pFieldData->m_FieldSplitArray;
+ std::vector<float>* pFieldArray = &pFieldData->field_split_array_;
size_t szFieldSplitCount = pFieldArray->size();
if (szFieldSplitCount < szBlockIndex * 3)
return std::nullopt;
@@ -3809,35 +3817,36 @@
}
void CXFA_Node::InitLayoutData(CXFA_FFDoc* doc) {
- if (m_pLayoutData)
+ if (layout_data_) {
return;
+ }
switch (GetFFWidgetType()) {
case XFA_FFWidgetType::kText:
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_TextLayoutData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_TextLayoutData>(
doc->GetHeap()->GetAllocationHandle());
return;
case XFA_FFWidgetType::kTextEdit:
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_TextEditData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_TextEditData>(
doc->GetHeap()->GetAllocationHandle());
return;
case XFA_FFWidgetType::kImage:
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_ImageLayoutData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_ImageLayoutData>(
doc->GetHeap()->GetAllocationHandle());
return;
case XFA_FFWidgetType::kImageEdit:
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_ImageEditData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_ImageEditData>(
doc->GetHeap()->GetAllocationHandle());
return;
default:
break;
}
if (GetElementType() == XFA_Element::Field) {
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_FieldLayoutData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_FieldLayoutData>(
doc->GetHeap()->GetAllocationHandle());
return;
}
- m_pLayoutData = cppgc::MakeGarbageCollected<CXFA_WidgetLayoutData>(
+ layout_data_ = cppgc::MakeGarbageCollected<CXFA_WidgetLayoutData>(
doc->GetHeap()->GetAllocationHandle());
}
@@ -3846,7 +3855,7 @@
float* pCalcHeight) {
InitLayoutData(doc);
- CXFA_TextLayoutData* pTextLayoutData = m_pLayoutData->AsTextLayoutData();
+ CXFA_TextLayoutData* pTextLayoutData = layout_data_->AsTextLayoutData();
pTextLayoutData->LoadText(doc, this);
CXFA_TextLayout* pTextLayout = pTextLayoutData->GetTextLayout();
@@ -3874,52 +3883,51 @@
*pCalcWidth = fMaxWidth;
}
}
- if (m_pLayoutData->GetWidgetHeight() < 0) {
- m_pLayoutData->SetWidgetHeight(
+ if (layout_data_->GetWidgetHeight() < 0) {
+ layout_data_->SetWidgetHeight(
CalculateWidgetAutoHeight(pTextLayout->GetLayoutHeight()));
}
- fTextHeight = m_pLayoutData->GetWidgetHeight();
+ fTextHeight = layout_data_->GetWidgetHeight();
fTextHeight = GetHeightWithoutMargin(fTextHeight);
pTextLayout->DoLayout(fTextHeight);
- *pCalcHeight = m_pLayoutData->GetWidgetHeight();
+ *pCalcHeight = layout_data_->GetWidgetHeight();
}
bool CXFA_Node::LoadCaption(CXFA_FFDoc* doc) {
InitLayoutData(doc);
- return m_pLayoutData->AsFieldLayoutData()->LoadCaption(doc, this);
+ return layout_data_->AsFieldLayoutData()->LoadCaption(doc, this);
}
CXFA_TextLayout* CXFA_Node::GetCaptionTextLayout() {
- return m_pLayoutData ? m_pLayoutData->AsFieldLayoutData()->m_pCapTextLayout
- : nullptr;
+ return layout_data_ ? layout_data_->AsFieldLayoutData()->cap_text_layout_
+ : nullptr;
}
CXFA_TextLayout* CXFA_Node::GetTextLayout() {
- return m_pLayoutData ? m_pLayoutData->AsTextLayoutData()->GetTextLayout()
- : nullptr;
+ return layout_data_ ? layout_data_->AsTextLayoutData()->GetTextLayout()
+ : nullptr;
}
RetainPtr<CFX_DIBitmap> CXFA_Node::GetLayoutImage() {
- return m_pLayoutData ? m_pLayoutData->AsImageLayoutData()->GetBitmap()
- : nullptr;
+ return layout_data_ ? layout_data_->AsImageLayoutData()->GetBitmap()
+ : nullptr;
}
RetainPtr<CFX_DIBitmap> CXFA_Node::GetEditImage() {
- return m_pLayoutData ? m_pLayoutData->AsFieldLayoutData()
- ->AsImageEditData()
- ->GetBitmap()
- : nullptr;
+ return layout_data_
+ ? layout_data_->AsFieldLayoutData()->AsImageEditData()->GetBitmap()
+ : nullptr;
}
void CXFA_Node::SetLayoutImage(RetainPtr<CFX_DIBitmap> newImage) {
- CXFA_ImageLayoutData* pData = m_pLayoutData->AsImageLayoutData();
+ CXFA_ImageLayoutData* pData = layout_data_->AsImageLayoutData();
if (pData->GetBitmap() != newImage)
pData->SetBitmap(std::move(newImage));
}
void CXFA_Node::SetEditImage(RetainPtr<CFX_DIBitmap> newImage) {
CXFA_ImageEditData* pData =
- m_pLayoutData->AsFieldLayoutData()->AsImageEditData();
+ layout_data_->AsFieldLayoutData()->AsImageEditData();
if (pData->GetBitmap() != newImage)
pData->SetBitmap(std::move(newImage));
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 29677fe..19a2c0e 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -144,7 +144,7 @@
// Note: returns XFA_Attribute::Unknown for invalid indicies.
XFA_Attribute GetAttribute(size_t i) const;
- XFA_PacketType GetPacketType() const { return m_ePacket; }
+ XFA_PacketType GetPacketType() const { return packet_; }
void SetInitializedFlagAndNotify();
void SetFlag(XFA_NodeFlag dwFlag);
@@ -178,7 +178,7 @@
bool IsAttributeInXML();
bool IsFormContainer() const {
- return m_ePacket == XFA_PacketType::Form && IsContainerNode();
+ return packet_ == XFA_PacketType::Form && IsContainerNode();
}
void SetXMLMappingNode(CFX_XMLNode* node) { xml_node_ = node; }
@@ -188,8 +188,8 @@
void SetToXML(const WideString& value);
- uint32_t GetNameHash() const { return m_dwNameHash; }
- bool IsUnnamed() const { return m_dwNameHash == 0; }
+ uint32_t GetNameHash() const { return name_hash_; }
+ bool IsUnnamed() const { return name_hash_ == 0; }
CXFA_Node* GetModelNode();
void UpdateNameHash();
@@ -320,9 +320,9 @@
CFX_RectF GetUIMargin();
CXFA_Border* GetUIBorder();
- void SetPreNull(bool val) { m_bPreNull = val; }
- bool IsNull() const { return m_bIsNull; }
- void SetIsNull(bool val) { m_bIsNull = val; }
+ void SetPreNull(bool val) { pre_null_ = val; }
+ bool IsNull() const { return is_null_; }
+ void SetIsNull(bool val) { is_null_ = val; }
void SetWidgetReady() { is_widget_ready_ = true; }
bool IsWidgetReady() const { return is_widget_ready_; }
@@ -524,19 +524,19 @@
CFX_XMLDocument* GetXMLDocument() const;
XFA_FFWidgetType ff_widget_type_ = XFA_FFWidgetType::kNone;
- bool m_bIsNull = true;
- bool m_bPreNull = true;
+ bool is_null_ = true;
+ bool pre_null_ = true;
bool is_widget_ready_ = false;
- const pdfium::raw_span<const PropertyData> m_Properties;
- const pdfium::raw_span<const AttributeData> m_Attributes;
- const Mask<XFA_XDPPACKET> m_ValidPackets;
+ const pdfium::raw_span<const PropertyData> properties_;
+ const pdfium::raw_span<const AttributeData> attributes_;
+ const Mask<XFA_XDPPACKET> valid_packets_;
UnownedPtr<CFX_XMLNode> xml_node_;
- const XFA_PacketType m_ePacket;
- uint8_t m_ExecuteRecursionDepth = 0;
- Mask<XFA_NodeFlag> m_uNodeFlags = XFA_NodeFlag::kNone;
- uint32_t m_dwNameHash = 0;
- cppgc::Member<CXFA_Node> m_pAuxNode;
- cppgc::Member<CXFA_WidgetLayoutData> m_pLayoutData;
+ const XFA_PacketType packet_;
+ uint8_t execute_recursion_depth_ = 0;
+ Mask<XFA_NodeFlag> node_flags_ = XFA_NodeFlag::kNone;
+ uint32_t name_hash_ = 0;
+ cppgc::Member<CXFA_Node> aux_node_;
+ cppgc::Member<CXFA_WidgetLayoutData> layout_data_;
cppgc::Member<CXFA_Ui> ui_;
std::vector<cppgc::Member<CXFA_Node>> binding_nodes_;
};
diff --git a/xfa/fxfa/parser/cxfa_nodeiteratortemplate.h b/xfa/fxfa/parser/cxfa_nodeiteratortemplate.h
index 95b0efa..e259627 100644
--- a/xfa/fxfa/parser/cxfa_nodeiteratortemplate.h
+++ b/xfa/fxfa/parser/cxfa_nodeiteratortemplate.h
@@ -23,81 +23,84 @@
public:
explicit CXFA_NodeIteratorTemplate(NodeType* pRoot)
- : m_pRoot(pRoot), m_pCurrent(pRoot) {}
+ : root_(pRoot), current_(pRoot) {}
- NodeType* GetRoot() const { return static_cast<NodeType*>(m_pRoot); }
- NodeType* GetCurrent() const { return static_cast<NodeType*>(m_pCurrent); }
+ NodeType* GetRoot() const { return static_cast<NodeType*>(root_); }
+ NodeType* GetCurrent() const { return static_cast<NodeType*>(current_); }
- void Reset() { m_pCurrent = m_pRoot; }
+ void Reset() { current_ = root_; }
bool SetCurrent(NodeType* pNode) {
if (!RootReachableFromNode(pNode)) {
- m_pCurrent = nullptr;
+ current_ = nullptr;
return false;
}
- m_pCurrent = pNode;
+ current_ = pNode;
return true;
}
NodeType* MoveToPrev() {
- if (!m_pRoot)
+ if (!root_) {
return nullptr;
- if (!m_pCurrent) {
- m_pCurrent = LastDescendant(static_cast<NodeType*>(m_pRoot));
- return static_cast<NodeType*>(m_pCurrent);
+ }
+ if (!current_) {
+ current_ = LastDescendant(static_cast<NodeType*>(root_));
+ return static_cast<NodeType*>(current_);
}
NodeType* pSibling =
- PreviousSiblingWithinSubtree(static_cast<NodeType*>(m_pCurrent));
+ PreviousSiblingWithinSubtree(static_cast<NodeType*>(current_));
if (pSibling) {
- m_pCurrent = LastDescendant(pSibling);
- return static_cast<NodeType*>(m_pCurrent);
+ current_ = LastDescendant(pSibling);
+ return static_cast<NodeType*>(current_);
}
- NodeType* pParent = ParentWithinSubtree(static_cast<NodeType*>(m_pCurrent));
+ NodeType* pParent = ParentWithinSubtree(static_cast<NodeType*>(current_));
if (pParent)
- m_pCurrent = pParent;
+ current_ = pParent;
return pParent;
}
NodeType* MoveToNext() {
- if (!m_pRoot || !m_pCurrent)
+ if (!root_ || !current_) {
return nullptr;
+ }
NodeType* pChild =
- TraverseStrategy::GetFirstChild(static_cast<NodeType*>(m_pCurrent));
+ TraverseStrategy::GetFirstChild(static_cast<NodeType*>(current_));
if (pChild) {
- m_pCurrent = pChild;
+ current_ = pChild;
return pChild;
}
return SkipChildrenAndMoveToNext();
}
NodeType* SkipChildrenAndMoveToNext() {
- if (!m_pRoot)
+ if (!root_) {
return nullptr;
- NodeType* pNode = static_cast<NodeType*>(m_pCurrent);
+ }
+ NodeType* pNode = static_cast<NodeType*>(current_);
while (pNode) {
NodeType* pSibling = NextSiblingWithinSubtree(pNode);
if (pSibling) {
- m_pCurrent = pSibling;
+ current_ = pSibling;
return pSibling;
}
pNode = ParentWithinSubtree(pNode);
}
- m_pCurrent = nullptr;
+ current_ = nullptr;
return nullptr;
}
private:
bool RootReachableFromNode(NodeType* pNode) {
- return pNode && (pNode == m_pRoot ||
+ return pNode && (pNode == root_ ||
RootReachableFromNode(TraverseStrategy::GetParent(pNode)));
}
NodeType* ParentWithinSubtree(NodeType* pNode) {
- return pNode && pNode != m_pRoot ? TraverseStrategy::GetParent(pNode)
- : nullptr;
+ return pNode && pNode != root_ ? TraverseStrategy::GetParent(pNode)
+ : nullptr;
}
NodeType* NextSiblingWithinSubtree(NodeType* pNode) {
- return pNode != m_pRoot ? TraverseStrategy::GetNextSibling(pNode) : nullptr;
+ return pNode != root_ ? TraverseStrategy::GetNextSibling(pNode) : nullptr;
}
NodeType* PreviousSiblingWithinSubtree(NodeType* pNode) {
@@ -128,8 +131,8 @@
return pChild ? LastDescendant(pChild) : pNode;
}
- HolderType m_pRoot;
- HolderType m_pCurrent;
+ HolderType root_;
+ HolderType current_;
};
#endif // XFA_FXFA_PARSER_CXFA_NODEITERATORTEMPLATE_H_
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp
index 60a44de..e3454a1 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.cpp
+++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp
@@ -38,18 +38,18 @@
return WideString();
}
-CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pNode) : m_pNode(pNode) {}
+CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pNode) : node_(pNode) {}
CXFA_NodeLocale::~CXFA_NodeLocale() = default;
void CXFA_NodeLocale::Trace(cppgc::Visitor* visitor) const {
GCedLocaleIface::Trace(visitor);
- visitor->Trace(m_pNode);
+ visitor->Trace(node_);
}
WideString CXFA_NodeLocale::GetName() const {
- return WideString(m_pNode ? m_pNode->JSObject()->GetCData(XFA_Attribute::Name)
- : nullptr);
+ return WideString(node_ ? node_->JSObject()->GetCData(XFA_Attribute::Name)
+ : nullptr);
}
WideString CXFA_NodeLocale::GetDecimalSymbol() const {
@@ -74,9 +74,9 @@
WideString CXFA_NodeLocale::GetDateTimeSymbols() const {
CXFA_DateTimeSymbols* pSymbols =
- m_pNode ? m_pNode->GetChild<CXFA_DateTimeSymbols>(
- 0, XFA_Element::DateTimeSymbols, false)
- : nullptr;
+ node_ ? node_->GetChild<CXFA_DateTimeSymbols>(
+ 0, XFA_Element::DateTimeSymbols, false)
+ : nullptr;
return pSymbols ? pSymbols->JSObject()->GetContent(false) : WideString();
}
@@ -149,7 +149,7 @@
WideString CXFA_NodeLocale::GetSymbol(XFA_Element eElement,
WideStringView symbol_type) const {
CXFA_Node* pSymbols =
- m_pNode ? m_pNode->GetChild<CXFA_Node>(0, eElement, false) : nullptr;
+ node_ ? node_->GetChild<CXFA_Node>(0, eElement, false) : nullptr;
CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
return pSymbol ? pSymbol->JSObject()->GetContent(false) : WideString();
}
@@ -158,9 +158,9 @@
int index,
bool bAbbr) const {
CXFA_CalendarSymbols* pCalendar =
- m_pNode ? m_pNode->GetChild<CXFA_CalendarSymbols>(
- 0, XFA_Element::CalendarSymbols, false)
- : nullptr;
+ node_ ? node_->GetChild<CXFA_CalendarSymbols>(
+ 0, XFA_Element::CalendarSymbols, false)
+ : nullptr;
if (!pCalendar)
return WideString();
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h
index d7e26f3..472108f 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.h
+++ b/xfa/fxfa/parser/cxfa_nodelocale.h
@@ -50,7 +50,7 @@
int index,
bool bAbbr) const;
- cppgc::Member<CXFA_Node> const m_pNode;
+ cppgc::Member<CXFA_Node> const node_;
};
#endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp
index 308b0df..f7fd247 100644
--- a/xfa/fxfa/parser/cxfa_object.cpp
+++ b/xfa/fxfa/parser/cxfa_object.cpp
@@ -21,18 +21,18 @@
XFA_ObjectType objectType,
XFA_Element elementType,
CJX_Object* jsObject)
- : m_objectType(objectType),
- m_elementType(elementType),
- m_elementName(XFA_ElementToName(elementType)),
- m_elementNameHash(FX_HashCode_GetAsIfW(m_elementName)),
- m_pDocument(pDocument),
- m_pJSObject(jsObject) {}
+ : object_type_(objectType),
+ element_type_(elementType),
+ element_name_(XFA_ElementToName(elementType)),
+ element_name_hash_(FX_HashCode_GetAsIfW(element_name_)),
+ document_(pDocument),
+ jsobject_(jsObject) {}
CXFA_Object::~CXFA_Object() = default;
void CXFA_Object::Trace(cppgc::Visitor* visitor) const {
- visitor->Trace(m_pDocument);
- visitor->Trace(m_pJSObject);
+ visitor->Trace(document_);
+ visitor->Trace(jsobject_);
}
WideString CXFA_Object::GetSOMExpression() {
diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h
index c482d3b..80a15ff 100644
--- a/xfa/fxfa/parser/cxfa_object.h
+++ b/xfa/fxfa/parser/cxfa_object.h
@@ -45,52 +45,52 @@
virtual void Trace(cppgc::Visitor* visitor) const;
- CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
- XFA_ObjectType GetObjectType() const { return m_objectType; }
+ CXFA_Document* GetDocument() const { return document_.Get(); }
+ XFA_ObjectType GetObjectType() const { return object_type_; }
bool IsList() const {
- return m_objectType == XFA_ObjectType::List ||
- m_objectType == XFA_ObjectType::TreeList;
+ return object_type_ == XFA_ObjectType::List ||
+ object_type_ == XFA_ObjectType::TreeList;
}
bool IsNode() const {
- return m_objectType == XFA_ObjectType::Node ||
- m_objectType == XFA_ObjectType::NodeC ||
- m_objectType == XFA_ObjectType::NodeV ||
- m_objectType == XFA_ObjectType::ModelNode ||
- m_objectType == XFA_ObjectType::TextNode ||
- m_objectType == XFA_ObjectType::ContainerNode ||
- m_objectType == XFA_ObjectType::ContentNode ||
- m_elementType == XFA_Element::Delta;
+ return object_type_ == XFA_ObjectType::Node ||
+ object_type_ == XFA_ObjectType::NodeC ||
+ object_type_ == XFA_ObjectType::NodeV ||
+ object_type_ == XFA_ObjectType::ModelNode ||
+ object_type_ == XFA_ObjectType::TextNode ||
+ object_type_ == XFA_ObjectType::ContainerNode ||
+ object_type_ == XFA_ObjectType::ContentNode ||
+ element_type_ == XFA_Element::Delta;
}
- bool IsTreeList() const { return m_objectType == XFA_ObjectType::TreeList; }
+ bool IsTreeList() const { return object_type_ == XFA_ObjectType::TreeList; }
bool IsContentNode() const {
- return m_objectType == XFA_ObjectType::ContentNode;
+ return object_type_ == XFA_ObjectType::ContentNode;
}
bool IsContainerNode() const {
- return m_objectType == XFA_ObjectType::ContainerNode;
+ return object_type_ == XFA_ObjectType::ContainerNode;
}
- bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; }
- bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; }
- bool IsThisProxy() const { return m_objectType == XFA_ObjectType::ThisProxy; }
+ bool IsModelNode() const { return object_type_ == XFA_ObjectType::ModelNode; }
+ bool IsNodeV() const { return object_type_ == XFA_ObjectType::NodeV; }
+ bool IsThisProxy() const { return object_type_ == XFA_ObjectType::ThisProxy; }
CXFA_List* AsList();
CXFA_Node* AsNode();
CXFA_TreeList* AsTreeList();
CXFA_ThisProxy* AsThisProxy();
- CJX_Object* JSObject() { return m_pJSObject; }
- const CJX_Object* JSObject() const { return m_pJSObject; }
+ CJX_Object* JSObject() { return jsobject_; }
+ const CJX_Object* JSObject() const { return jsobject_; }
bool HasCreatedUIWidget() const {
- return m_elementType == XFA_Element::Field ||
- m_elementType == XFA_Element::Draw ||
- m_elementType == XFA_Element::Subform ||
- m_elementType == XFA_Element::ExclGroup;
+ return element_type_ == XFA_Element::Field ||
+ element_type_ == XFA_Element::Draw ||
+ element_type_ == XFA_Element::Subform ||
+ element_type_ == XFA_Element::ExclGroup;
}
- XFA_Element GetElementType() const { return m_elementType; }
- ByteStringView GetClassName() const { return m_elementName; }
- uint32_t GetClassHashCode() const { return m_elementNameHash; }
+ XFA_Element GetElementType() const { return element_type_; }
+ ByteStringView GetClassName() const { return element_name_; }
+ uint32_t GetClassHashCode() const { return element_name_hash_; }
WideString GetSOMExpression();
@@ -100,12 +100,12 @@
XFA_Element eType,
CJX_Object* jsObject);
- const XFA_ObjectType m_objectType;
- const XFA_Element m_elementType;
- const ByteStringView m_elementName;
- const uint32_t m_elementNameHash;
- cppgc::WeakMember<CXFA_Document> m_pDocument;
- cppgc::Member<CJX_Object> m_pJSObject;
+ const XFA_ObjectType object_type_;
+ const XFA_Element element_type_;
+ const ByteStringView element_name_;
+ const uint32_t element_name_hash_;
+ cppgc::WeakMember<CXFA_Document> document_;
+ cppgc::Member<CJX_Object> jsobject_;
};
// Helper functions that permit nullptr arguments.
diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp
index c7eb1c3..161c31b 100644
--- a/xfa/fxfa/parser/cxfa_thisproxy.cpp
+++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp
@@ -19,13 +19,13 @@
cppgc::MakeGarbageCollected<CJX_Object>(
pThisNode->GetDocument()->GetHeap()->GetAllocationHandle(),
this)),
- m_pThisNode(pThisNode),
- m_pScriptNode(pScriptNode) {}
+ this_node_(pThisNode),
+ script_node_(pScriptNode) {}
CXFA_ThisProxy::~CXFA_ThisProxy() = default;
void CXFA_ThisProxy::Trace(cppgc::Visitor* visitor) const {
CXFA_Object::Trace(visitor);
- visitor->Trace(m_pThisNode);
- visitor->Trace(m_pScriptNode);
+ visitor->Trace(this_node_);
+ visitor->Trace(script_node_);
}
diff --git a/xfa/fxfa/parser/cxfa_thisproxy.h b/xfa/fxfa/parser/cxfa_thisproxy.h
index 37624e8..1c175ad 100644
--- a/xfa/fxfa/parser/cxfa_thisproxy.h
+++ b/xfa/fxfa/parser/cxfa_thisproxy.h
@@ -21,14 +21,14 @@
void Trace(cppgc::Visitor* visitor) const override;
- CXFA_Node* GetThisNode() const { return m_pThisNode; }
- CXFA_Script* GetScriptNode() const { return m_pScriptNode; }
+ CXFA_Node* GetThisNode() const { return this_node_; }
+ CXFA_Script* GetScriptNode() const { return script_node_; }
private:
CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Script* pScriptNode);
- cppgc::Member<CXFA_Node> m_pThisNode;
- cppgc::Member<CXFA_Script> m_pScriptNode;
+ cppgc::Member<CXFA_Node> this_node_;
+ cppgc::Member<CXFA_Script> script_node_;
};
#endif // XFA_FXFA_PARSER_CXFA_THISPROXY_H_