From bb6ecbad918e52c46400caffbff6ffc70a494bce Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 7 Dec 2017 14:39:01 +0000 Subject: Fix nits from previous CL. This CL fixs up some nits from previous CL. Change-Id: I3d24d149d91b1290258291f5b79894496b195459 Reviewed-on: https://pdfium-review.googlesource.com/20290 Commit-Queue: dsinclair Reviewed-by: Lei Zhang --- xfa/fxfa/parser/cxfa_node.cpp | 53 ++++++++++++++------------------- xfa/fxfa/parser/xfa_basic_data_enum.cpp | 7 ++--- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 378d3063a9..b2966457b1 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -684,53 +684,46 @@ XFA_AttributeEnum CXFA_Node::GetIntact() { return *intact; } } + switch (GetElementType()) { case XFA_Element::Subform: switch (eLayoutType) { case XFA_AttributeEnum::Position: case XFA_AttributeEnum::Row: return XFA_AttributeEnum::ContentArea; - case XFA_AttributeEnum::Tb: - case XFA_AttributeEnum::Table: - case XFA_AttributeEnum::Lr_tb: - case XFA_AttributeEnum::Rl_tb: - return XFA_AttributeEnum::None; default: - break; + return XFA_AttributeEnum::None; } - break; case XFA_Element::Field: { - CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || - pParentNode->GetElementType() == XFA_Element::PageArea) + CXFA_Node* parent = GetNodeItem(XFA_NODEITEM_Parent); + if (!parent || parent->GetElementType() == XFA_Element::PageArea) return XFA_AttributeEnum::ContentArea; - if (pParentNode->GetIntact() == XFA_AttributeEnum::None) { - XFA_AttributeEnum eParLayout = - pParentNode->JSNode() - ->TryEnum(XFA_Attribute::Layout, true) - .value_or(XFA_AttributeEnum::Position); - if (eParLayout == XFA_AttributeEnum::Position || - eParLayout == XFA_AttributeEnum::Row || - eParLayout == XFA_AttributeEnum::Table) { - return XFA_AttributeEnum::None; - } - XFA_VERSION version = m_pDocument->GetCurVersionMode(); - if (eParLayout == XFA_AttributeEnum::Tb && version < XFA_VERSION_208) { - pdfium::Optional measureH = - JSNode()->TryMeasure(XFA_Attribute::H, false); - if (measureH) - return XFA_AttributeEnum::ContentArea; - } + if (parent->GetIntact() != XFA_AttributeEnum::None) + return XFA_AttributeEnum::ContentArea; + + XFA_AttributeEnum eParLayout = parent->JSNode() + ->TryEnum(XFA_Attribute::Layout, true) + .value_or(XFA_AttributeEnum::Position); + if (eParLayout == XFA_AttributeEnum::Position || + eParLayout == XFA_AttributeEnum::Row || + eParLayout == XFA_AttributeEnum::Table) { return XFA_AttributeEnum::None; } - return XFA_AttributeEnum::ContentArea; + + XFA_VERSION version = m_pDocument->GetCurVersionMode(); + if (eParLayout == XFA_AttributeEnum::Tb && version < XFA_VERSION_208) { + pdfium::Optional measureH = + JSNode()->TryMeasure(XFA_Attribute::H, false); + if (measureH) + return XFA_AttributeEnum::ContentArea; + } + return XFA_AttributeEnum::None; } case XFA_Element::Draw: return XFA_AttributeEnum::ContentArea; default: - break; + return XFA_AttributeEnum::None; } - return XFA_AttributeEnum::None; } CXFA_Node* CXFA_Node::GetDataDescriptionNode() { diff --git a/xfa/fxfa/parser/xfa_basic_data_enum.cpp b/xfa/fxfa/parser/xfa_basic_data_enum.cpp index 35e6700ef8..33c5cf444e 100644 --- a/xfa/fxfa/parser/xfa_basic_data_enum.cpp +++ b/xfa/fxfa/parser/xfa_basic_data_enum.cpp @@ -23,8 +23,7 @@ const XFA_AttributeEnumInfo g_XFAEnumData[] = { {0x3848b3f, L"next", XFA_AttributeEnum::Next}, {0x48b6670, L"none", XFA_AttributeEnum::None}, {0x51aafe5, L"shortEdge", XFA_AttributeEnum::ShortEdge}, - {0x55264c4, L"Checksum_1mod10_1mod11", - XFA_AttributeEnum::Checksum_1mod10_1mod11}, + {0x55264c4, L"1mod10_1mod11", XFA_AttributeEnum::Checksum_1mod10_1mod11}, {0x5a5c519, L"height", XFA_AttributeEnum::Height}, {0x89ce549, L"crossDiagonal", XFA_AttributeEnum::CrossDiagonal}, {0x9f9d0f9, L"all", XFA_AttributeEnum::All}, @@ -143,7 +142,7 @@ const XFA_AttributeEnumInfo g_XFAEnumData[] = { {0x7145e6bf, L"moveFirst", XFA_AttributeEnum::MoveFirst}, {0x7375465c, L"diamond", XFA_AttributeEnum::Diamond}, {0x7461aef4, L"pageOdd", XFA_AttributeEnum::PageOdd}, - {0x75f8aeb2, L"Checksum_1mod10", XFA_AttributeEnum::Checksum_1mod10}, + {0x75f8aeb2, L"1mod10", XFA_AttributeEnum::Checksum_1mod10}, {0x76d708e0, L"Korean", XFA_AttributeEnum::Korean}, {0x789f14d7, L"aboveEmbedded", XFA_AttributeEnum::AboveEmbedded}, {0x792ea39f, L"zipCompress", XFA_AttributeEnum::ZipCompress}, @@ -201,7 +200,7 @@ const XFA_AttributeEnumInfo g_XFAEnumData[] = { {0xb1833cad, L"both", XFA_AttributeEnum::Both}, {0xb221123f, L"butt", XFA_AttributeEnum::Butt}, {0xb40c36bf, L"client", XFA_AttributeEnum::Client}, - {0xb56c7053, L"Checksum_2mod10", XFA_AttributeEnum::Checksum_2mod10}, + {0xb56c7053, L"2mod10", XFA_AttributeEnum::Checksum_2mod10}, {0xb683a345, L"imageOnly", XFA_AttributeEnum::ImageOnly}, {0xb7732dea, L"horizontal", XFA_AttributeEnum::Horizontal}, {0xb88652a4, L"dotted", XFA_AttributeEnum::Dotted}, -- cgit v1.2.3