summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidget.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-08 14:30:00 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-08 20:03:36 +0000
commit0c53b008b4f2f7a790f756d706a00e8de98dfedd (patch)
tree7e8a3e6c22792f8ee4e79c85a808ce6ea346dac1 /xfa/fxfa/cxfa_ffwidget.cpp
parent2f265dbf12831dece93a6a932fd99e5737cd1afd (diff)
downloadpdfium-0c53b008b4f2f7a790f756d706a00e8de98dfedd.tar.xz
Change the FFWidgets to store the node
This CL changes the various CXFA_FF* widgets to hold a CXFA_Node instead of a CXFA_WidgetAcc wrapper. Change-Id: I7e31633d5ffd3b61abcdcdfeee7822514c5b28da Reviewed-on: https://pdfium-review.googlesource.com/22410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffwidget.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 54a666d3a8..2d3b8fb17c 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -917,10 +917,8 @@ bool IsFXCodecErrorStatus(FXCODEC_STATUS status) {
} // namespace
-CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc)
- : CXFA_ContentLayoutItem(pDataAcc->GetNode()),
- m_pPageView(nullptr),
- m_pDataAcc(pDataAcc) {}
+CXFA_FFWidget::CXFA_FFWidget(CXFA_Node* node)
+ : CXFA_ContentLayoutItem(node), m_pNode(node) {}
CXFA_FFWidget::~CXFA_FFWidget() {}
@@ -943,7 +941,7 @@ const CFX_RectF& CXFA_FFWidget::RecacheWidgetRect() const {
CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
CFX_RectF rtWidget = GetWidgetRect();
float fValue = 0;
- switch (m_pDataAcc->GetNode()->GetRotate()) {
+ switch (m_pNode->GetRotate()) {
case 90:
rtWidget.top = rtWidget.bottom();
fValue = rtWidget.width;
@@ -978,17 +976,13 @@ CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
return m_pPageView->GetPageViewRect();
}
-CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
- return m_pDataAcc.Get();
-}
-
void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS,
const CFX_Matrix& matrix,
uint32_t dwStatus) {
if (!IsMatchVisibleStatus(dwStatus))
return;
- CXFA_Border* border = m_pDataAcc->GetNode()->GetBorder(false);
+ CXFA_Border* border = m_pNode->GetBorder(false);
if (!border)
return;
@@ -1089,8 +1083,9 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
m_dwStatus |= XFA_WidgetStatus_Focused;
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Enter;
- eParam.m_pTarget = m_pDataAcc.Get();
- m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Enter, &eParam);
+ eParam.m_pTarget = m_pNode->GetWidgetAcc();
+ m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Enter,
+ &eParam);
return true;
}
@@ -1261,7 +1256,7 @@ static void XFA_GetMatrix(CFX_Matrix& m,
CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
CFX_Matrix mt;
- int32_t iRotate = m_pDataAcc->GetNode()->GetRotate();
+ int32_t iRotate = m_pNode->GetRotate();
if (!iRotate)
return mt;
@@ -1277,8 +1272,7 @@ bool CXFA_FFWidget::IsLayoutRectEmpty() {
return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
}
CXFA_FFWidget* CXFA_FFWidget::GetParent() {
- CXFA_Node* pParentNode =
- m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
if (pParentNode) {
CXFA_WidgetAcc* pParentWidgetAcc =
static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetAcc());
@@ -1295,10 +1289,9 @@ bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
if (!pWidget)
return false;
- CXFA_Node* pNode = m_pDataAcc->GetNode();
- CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
+ CXFA_Node* pChildNode = pWidget->GetNode();
while (pChildNode) {
- if (pChildNode == pNode)
+ if (pChildNode == m_pNode)
return true;
pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
@@ -1341,8 +1334,9 @@ void CXFA_FFWidget::EventKillFocus() {
}
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Exit;
- eParam.m_pTarget = m_pDataAcc.Get();
- m_pDataAcc->ProcessEvent(GetDocView(), XFA_AttributeEnum::Exit, &eParam);
+ eParam.m_pTarget = m_pNode->GetWidgetAcc();
+ m_pNode->GetWidgetAcc()->ProcessEvent(GetDocView(), XFA_AttributeEnum::Exit,
+ &eParam);
}
bool CXFA_FFWidget::IsButtonDown() {