Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp

Issue 1441243005: Add AsLayoutItem()/ToLayoutItem() functions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Typos Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 3d1959f46c506ee0f35fca667fc84a762508162f..42d0bcab02918ff6b6106c970713a91d71de2d89 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -543,11 +543,10 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
pContentChildLayoutItem;
pContentChildLayoutItem =
pContentChildLayoutItem->m_pNextSibling) {
- if (!pContentChildLayoutItem->IsContentLayoutItem()) {
- continue;
+ if (CXFA_ContentLayoutItem* pContent =
+ pContentChildLayoutItem->AsContentLayoutItem()) {
+ fUsedHeight += pContent->m_sSize.y;
}
- fUsedHeight +=
- ((CXFA_ContentLayoutItem*)pContentChildLayoutItem)->m_sSize.y;
}
rgUsedHeights.Add(fUsedHeight);
}
@@ -1865,15 +1864,12 @@ void XFA_SyncContainer(IXFA_Notify* pNotify,
pNotify->OnLayoutEvent(pDocLayout, pContainerItem, XFA_LAYOUTEVENT_ItemAdded,
(void*)(uintptr_t)nPageIndex,
(void*)(uintptr_t)dwStatus);
- CXFA_LayoutItem* pChild = pContainerItem->m_pFirstChild;
- while (pChild) {
- if (!pChild->IsContentLayoutItem()) {
- pChild = pChild->m_pNextSibling;
- continue;
+ for (CXFA_LayoutItem* pChild = pContainerItem->m_pFirstChild; pChild;
+ pChild = pChild->m_pNextSibling) {
+ if (pChild->IsContentLayoutItem()) {
+ XFA_SyncContainer(pNotify, pDocLayout, pChild, dwRelevantContainer,
+ bVisibleItem, nPageIndex);
}
- XFA_SyncContainer(pNotify, pDocLayout, pChild, dwRelevantContainer,
- bVisibleItem, nPageIndex);
- pChild = pChild->m_pNextSibling;
}
}
void CXFA_LayoutPageMgr::SyncLayoutData() {
@@ -1900,14 +1896,14 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
CXFA_TraverseStrategy_LayoutItem>
iterator(pContainerItem);
- for (CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent();
- pChildLayoutItem;) {
- if (!pChildLayoutItem->IsContentLayoutItem()) {
+ CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent();
+ while (pChildLayoutItem) {
+ CXFA_ContentLayoutItem* pContentItem =
+ pChildLayoutItem->AsContentLayoutItem();
+ if (!pContentItem) {
pChildLayoutItem = iterator.MoveToNext();
continue;
}
- CXFA_ContentLayoutItem* pContentItem =
- (CXFA_ContentLayoutItem*)pChildLayoutItem;
FX_BOOL bVisible =
(pContentItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Presence) ==
XFA_ATTRIBUTEENUM_Visible);
« no previous file with comments | « xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698