From d9aba86443b32b686cf25b5465bbcaad9f04c308 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 23 Feb 2016 15:34:49 -0800 Subject: Moar _CAPS work, part 3. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1730713002 . --- .../fwl/src/basewidget/fwl_datetimepickerimp.cpp | 12 +-- .../fwl/src/basewidget/fwl_monthcalendarimp.cpp | 30 +++---- .../src/basewidget/include/fwl_monthcalendarimp.h | 93 ++++++++++------------ xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp | 10 ++- xfa/src/fxfa/src/app/xfa_ffdoc.h | 4 +- xfa/src/fxfa/src/app/xfa_fftext.cpp | 2 +- xfa/src/fxfa/src/app/xfa_textlayout.cpp | 20 ++--- xfa/src/fxfa/src/app/xfa_textlayout.h | 28 +++---- xfa/src/fxfa/src/common/xfa_object.h | 26 +++--- xfa/src/fxfa/src/common/xfa_script.h | 20 +++-- xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 50 ++++++------ 11 files changed, 146 insertions(+), 149 deletions(-) (limited to 'xfa') diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp index b42b43f9e9..8c957db965 100644 --- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp @@ -301,11 +301,11 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) { pPicker->m_pForm->GetWidgetRect(rt); rt.Set(0, 0, rt.width, rt.height); if (iCurSel > 0) { - LPDATEINFO lpDatesInfo = - (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1); + FWL_DATEINFO* lpDatesInfo = + (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) { - lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1); + lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1); rtInvalidate.Union(lpDatesInfo->rect); } m_pOwner->AddSelDay(iCurSel); @@ -394,11 +394,11 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( } int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); if (iCurSel > 0) { - LPDATEINFO lpDatesInfo = - (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1); + FWL_DATEINFO* lpDatesInfo = + (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) { - lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1); + lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1); rtInvalidate.Union(lpDatesInfo->rect); } m_pOwner->AddSelDay(iCurSel); diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp index 04ac358026..e9ac2af900 100644 --- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp @@ -288,7 +288,7 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics, } int32_t iCount = m_arrDates.GetSize(); for (int32_t j = 0; j < iCount; j++) { - LPDATEINFO pDataInfo = (LPDATEINFO)m_arrDates.GetAt(j); + FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j); if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) { params.m_dwStates |= FWL_PARTSTATE_MCD_Selected; if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) == @@ -422,7 +422,7 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics, } int32_t iCount = m_arrDates.GetSize(); for (int32_t j = 0; j < iCount; j++) { - LPDATEINFO pDataInfo = (LPDATEINFO)m_arrDates.GetAt(j); + FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j); params.m_wsText = pDataInfo->wsDay; params.m_rtPart = pDataInfo->rect; params.m_dwStates = pDataInfo->dwStates; @@ -459,7 +459,7 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics, if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) { return; } - LPDATEINFO pDate = (LPDATEINFO)m_arrDates[m_iDay - 1]; + FWL_DATEINFO* pDate = (FWL_DATEINFO*)m_arrDates[m_iDay - 1]; if (!pDate) return; CFWL_ThemeBackground params; @@ -617,7 +617,7 @@ void CFWL_MonthCalendarImp::CalDateItem() { FX_FLOAT fTop = m_rtDates.top; int32_t iCount = m_arrDates.GetSize(); for (int32_t i = 0; i < iCount; i++) { - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(i); + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i); if (bNewWeek) { iWeekOfMonth++; bNewWeek = FALSE; @@ -756,7 +756,7 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() { void CFWL_MonthCalendarImp::ClearDateItem() { int32_t iCount = m_arrDates.GetSize(); for (int32_t i = 0; i < iCount; i++) { - LPDATEINFO pData = (LPDATEINFO)m_arrDates.GetAt(i); + FWL_DATEINFO* pData = (FWL_DATEINFO*)m_arrDates.GetAt(i); delete pData; } m_arrDates.RemoveAll(); @@ -780,8 +780,8 @@ void CFWL_MonthCalendarImp::ReSetDateItem() { } CFX_RectF rtDate; rtDate.Set(0, 0, 0, 0); - LPDATEINFO pData = new DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay); - m_arrDates.Add(pData); + m_arrDates.Add( + new FWL_DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); iDayOfWeek++; } } @@ -836,7 +836,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { for (int32_t i = 0; i < iCount; i++) { int32_t iSelDay = m_arrSelDays.GetAt(i); if (iSelDay <= iDatesCount) { - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iSelDay - 1); + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1); pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; } } @@ -849,7 +849,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { int32_t iSelDay = m_arrSelDays.GetAt(iDay); int32_t iDatesCount = m_arrDates.GetSize(); if (iSelDay <= iDatesCount) { - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iSelDay - 1); + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1); pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; } m_arrSelDays.RemoveAt(index); @@ -863,7 +863,7 @@ FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) { if (m_arrSelDays.Find(iDay) == -1) { RemoveSelDay(-1, TRUE); if (iDay <= m_arrDates.GetSize()) { - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(iDay - 1); + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iDay - 1); pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; } m_arrSelDays.Add(iDay); @@ -903,7 +903,7 @@ void CFWL_MonthCalendarImp::GetTodayText(int32_t iYear, int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { int32_t iCount = m_arrDates.GetSize(); for (int32_t i = 0; i < iCount; i++) { - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates.GetAt(i); + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i); if (pDateInfo->rect.Contains(x, y)) { return ++i; } @@ -914,7 +914,7 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { if (iDay <= 0 || iDay > m_arrDates.GetSize()) { return FALSE; } - LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates[iDay - 1]; + FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; if (!pDateInfo) return FALSE; rtDay = pDateInfo->rect; @@ -1014,11 +1014,11 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); FX_BOOL bSelChanged = iCurSel > 0 && iCurSel != iOldSel; if (bSelChanged) { - LPDATEINFO lpDatesInfo = - (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iCurSel - 1); + FWL_DATEINFO* lpDatesInfo = + (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); if (iOldSel > 0) { - lpDatesInfo = (LPDATEINFO)m_pOwner->m_arrDates.GetAt(iOldSel - 1); + lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1); rtInvalidate.Union(lpDatesInfo->rect); } m_pOwner->AddSelDay(iCurSel); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h index aba3355e25..26a472b17b 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h @@ -37,6 +37,39 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { virtual FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); protected: + struct DATE { + DATE() : iYear(0), iMonth(0), iDay(0) {} + DATE(int32_t year, int32_t month, int32_t day) + : iYear(year), iMonth(month), iDay(day) {} + FX_BOOL operator<(const DATE& right) { + if (iYear < right.iYear) { + return TRUE; + } else if (iYear == right.iYear) { + if (iMonth < right.iMonth) { + return TRUE; + } else if (iMonth == right.iMonth) { + return iDay < right.iDay; + } + } + return FALSE; + } + FX_BOOL operator>(const DATE& right) { + if (iYear > right.iYear) { + return TRUE; + } else if (iYear == right.iYear) { + if (iMonth > right.iMonth) { + return TRUE; + } else if (iMonth == right.iMonth) { + return iDay > right.iDay; + } + } + return FALSE; + } + int32_t iYear; + int32_t iMonth; + int32_t iDay; + }; + void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); @@ -89,7 +122,6 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { void CalDateItem(); void GetCapValue(); int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay); - FX_BOOL GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); FX_BOOL SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay); FX_BOOL GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); @@ -110,43 +142,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFX_WideString& wsToday); int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y); FX_BOOL GetDayRect(int32_t iDay, CFX_RectF& rtDay); - typedef struct _DATE { - _DATE() { - iYear = 0; - iMonth = 0; - iDay = 0; - } - _DATE(int32_t year, int32_t month, int32_t day) - : iYear(year), iMonth(month), iDay(day) {} - FX_BOOL operator<(const _DATE& right) { - if (iYear < right.iYear) { - return TRUE; - } else if (iYear == right.iYear) { - if (iMonth < right.iMonth) { - return TRUE; - } else if (iMonth == right.iMonth) { - return iDay < right.iDay; - } - } - return FALSE; - } - FX_BOOL operator>(const _DATE& right) { - if (iYear > right.iYear) { - return TRUE; - } else if (iYear == right.iYear) { - if (iMonth > right.iMonth) { - return TRUE; - } else if (iMonth == right.iMonth) { - return iDay > right.iDay; - } - } - return FALSE; - } - int32_t iYear; - int32_t iMonth; - int32_t iDay; - } DATE, *LPDATE; FX_BOOL m_bInit; CFX_RectF m_rtHead; CFX_RectF m_rtWeek; @@ -177,8 +173,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFX_SizeF m_szHead; CFX_SizeF m_szCell; CFX_SizeF m_szToday; - typedef CFX_ArrayTemplate CFWL_Int32Array; - CFWL_Int32Array m_arrSelDays; + CFX_ArrayTemplate m_arrSelDays; int32_t m_iMaxSel; CFX_RectF m_rtClient; FX_FLOAT m_fHeadWid; @@ -193,32 +188,29 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { FX_FLOAT m_fHeadTextVMargin; FX_FLOAT m_fHSepWid; FX_FLOAT m_fHSepHei; - FX_FLOAT m_fWeekNumWid; FX_FLOAT m_fSepDOffset; FX_FLOAT m_fSepX; FX_FLOAT m_fSepY; - FX_FLOAT m_fWeekNumHeigh; FX_FLOAT m_fWeekWid; FX_FLOAT m_fWeekHei; FX_FLOAT m_fDateCellWid; FX_FLOAT m_fDateCellHei; - FX_FLOAT m_fTodayWid; FX_FLOAT m_fTodayHei; FX_FLOAT m_fTodayFlagWid; - FX_FLOAT m_fMCWid; FX_FLOAT m_fMCHei; friend class CFWL_MonthCalendarImpDelegate; }; -typedef struct _DATEINFO { - _DATEINFO(int32_t day, - int32_t dayofweek, - FX_DWORD dwSt, - CFX_RectF rc, - CFX_WideString& wsday) + +struct FWL_DATEINFO { + FWL_DATEINFO(int32_t day, + int32_t dayofweek, + FX_DWORD dwSt, + CFX_RectF rc, + CFX_WideString& wsday) : iDay(day), iDayOfWeek(dayofweek), dwStates(dwSt), @@ -229,7 +221,8 @@ typedef struct _DATEINFO { FX_DWORD dwStates; CFX_RectF rect; CFX_WideString wsDay; -} DATEINFO, *LPDATEINFO; +}; + class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); diff --git a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp index 866d6a6a08..9464776a68 100644 --- a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp @@ -856,13 +856,15 @@ void CFWL_WidgetMgrDelegate::DrawWidgetAfter(IFWL_Widget* pWidget, CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget); pItem->iRedrawCounter = 0; } + #define FWL_NEEDREPAINTHIT_Point 12 #define FWL_NEEDREPAINTHIT_Piece 3 -typedef struct _FWL_NeedRepaintHitData { +struct FWL_NEEDREPAINTHITDATA { CFX_PointF hitPoint; FX_BOOL bNotNeedRepaint; FX_BOOL bNotContainByDirty; -} FWL_NeedRepaintHitData; +}; + FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, CFX_Matrix* pMatrix, const CFX_RectF& rtDirty) { @@ -900,8 +902,8 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, FX_BOOL bOrginPtIntersectWidthChild = FALSE; FX_BOOL bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.left, rtWidget.top); - static FWL_NeedRepaintHitData hitPoint[FWL_NEEDREPAINTHIT_Point]; - static int32_t iSize = sizeof(FWL_NeedRepaintHitData); + static FWL_NEEDREPAINTHITDATA hitPoint[FWL_NEEDREPAINTHIT_Point]; + int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA); FXSYS_memset(hitPoint, 0, iSize); FX_FLOAT fxPiece = rtWidget.width / FWL_NEEDREPAINTHIT_Piece; FX_FLOAT fyPiece = rtWidget.height / FWL_NEEDREPAINTHIT_Piece; diff --git a/xfa/src/fxfa/src/app/xfa_ffdoc.h b/xfa/src/fxfa/src/app/xfa_ffdoc.h index 5d83efbd80..8d2063e66e 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdoc.h +++ b/xfa/src/fxfa/src/app/xfa_ffdoc.h @@ -15,11 +15,11 @@ class CXFA_FFNotify; class CXFA_FFDocView; class IXFA_Locale; -typedef struct _FX_IMAGEDIB_AND_DPI { +struct FX_IMAGEDIB_AND_DPI { CFX_DIBSource* pDibSource; int32_t iImageXDpi; int32_t iImageYDpi; -} FX_IMAGEDIB_AND_DPI; +}; class CXFA_FFDoc : public IXFA_Doc { public: diff --git a/xfa/src/fxfa/src/app/xfa_fftext.cpp b/xfa/src/fxfa/src/app/xfa_fftext.cpp index 126d47d64b..a187e2acda 100644 --- a/xfa/src/fxfa/src/app/xfa_fftext.cpp +++ b/xfa/src/fxfa/src/app/xfa_fftext.cpp @@ -161,7 +161,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { CXFA_PieceLine* pPieceLine = pPieceLines->GetAt(i); int32_t iPieces = pPieceLine->m_textPieces.GetSize(); for (int32_t j = 0; j < iPieces; j++) { - XFA_LPTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j); + XFA_TEXTPIECE* pPiece = pPieceLine->m_textPieces.GetAt(j); if (pPiece->pLinkData && pPiece->rtPiece.Contains(x, y)) { return pPiece->pLinkData->GetLinkURL(); } diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp index 629b7f15a6..37260bba0a 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp +++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp @@ -1268,7 +1268,7 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, int32_t iPieces = pPieceLine->m_textPieces.GetSize(); int32_t j = 0; for (j = 0; j < iPieces; j++) { - XFA_LPCTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j); + const XFA_TEXTPIECE* pPiece = pPieceLine->m_textPieces.GetAt(j); int32_t iChars = pPiece->iChars; if (iCharCount < iChars) { FX_Free(pCharPos); @@ -1308,7 +1308,7 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { CXFA_PieceLine* pPieceLine = m_pieceLines.GetAt(i); int32_t iPieces = pPieceLine->m_textPieces.GetSize(); for (int32_t j = 0; j < iPieces; j++) { - XFA_LPTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j); + XFA_TEXTPIECE* pPiece = pPieceLine->m_textPieces.GetAt(j); CFX_RectF& rect = pPiece->rtPiece; rect.top += fHeight; } @@ -1669,7 +1669,7 @@ void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle, if (iPieces == 0) { return; } - XFA_LPTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(iPieces - 1); + XFA_TEXTPIECE* pPiece = pPieceLine->m_textPieces.GetAt(iPieces - 1); int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex; int32_t iCount = m_textParser.CountTabs(pStyle); if (iTabstopsIndex > m_pTabstopContext->m_iTabCount - 1) { @@ -1680,7 +1680,7 @@ void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle, m_pTabstopContext->m_bTabstops = TRUE; FX_FLOAT fRight = 0; if (iPieces > 1) { - XFA_LPTEXTPIECE p = pPieceLine->m_textPieces.GetAt(iPieces - 2); + XFA_TEXTPIECE* p = pPieceLine->m_textPieces.GetAt(iPieces - 2); fRight = p->rtPiece.right(); } m_pTabstopContext->m_fTabWidth = @@ -1737,8 +1737,8 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, pStyle = pUserData->m_pStyle; } FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; - XFA_LPTEXTPIECE pTP = - (XFA_LPTEXTPIECE)m_pAllocator->Alloc(sizeof(XFA_TEXTPIECE)); + XFA_TEXTPIECE* pTP = + (XFA_TEXTPIECE*)m_pAllocator->Alloc(sizeof(XFA_TEXTPIECE)); pTP->pszText = (FX_WCHAR*)m_pAllocator->Alloc(pPiece->m_iChars * sizeof(FX_WCHAR)); pTP->pWidths = @@ -1784,7 +1784,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, DoTabstops(pStyle, pPieceLine); } for (i = 0; i < iPieces; i++) { - XFA_LPTEXTPIECE pTP = pPieceLine->m_textPieces.GetAt(i); + XFA_TEXTPIECE* pTP = pPieceLine->m_textPieces.GetAt(i); FX_FLOAT& fTop = pTP->rtPiece.top; FX_FLOAT fBaseLineTemp = fTop; fTop = fLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp; @@ -1867,7 +1867,7 @@ void CXFA_TextLayout::RenderString(IFDE_RenderDevice* pDevice, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, const CFX_Matrix& tmDoc2Device) { - XFA_LPCTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(iPiece); + const XFA_TEXTPIECE* pPiece = pPieceLine->m_textPieces.GetAt(iPiece); int32_t iCount = GetDisplayPos(pPiece, pCharPos); if (iCount > 0) { pBrush->SetColor(pPiece->dwColor); @@ -1989,7 +1989,7 @@ void CXFA_TextLayout::RenderPath(IFDE_RenderDevice* pDevice, XFA_RenderPathRet: pPath->Release(); } -int32_t CXFA_TextLayout::GetDisplayPos(XFA_LPCTEXTPIECE pPiece, +int32_t CXFA_TextLayout::GetDisplayPos(const XFA_TEXTPIECE* pPiece, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode) { if (pPiece == NULL) { @@ -2001,7 +2001,7 @@ int32_t CXFA_TextLayout::GetDisplayPos(XFA_LPCTEXTPIECE pPiece, } return m_pBreak->GetDisplayPos(&tr, pCharPos, bCharCode); } -FX_BOOL CXFA_TextLayout::ToRun(XFA_LPCTEXTPIECE pPiece, FX_RTFTEXTOBJ& tr) { +FX_BOOL CXFA_TextLayout::ToRun(const XFA_TEXTPIECE* pPiece, FX_RTFTEXTOBJ& tr) { int32_t iLength = pPiece->iChars; if (iLength < 1) { return FALSE; diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.h b/xfa/src/fxfa/src/app/xfa_textlayout.h index 44a27ad46c..fa32b70961 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.h +++ b/xfa/src/fxfa/src/app/xfa_textlayout.h @@ -225,7 +225,14 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { IFX_MEMAllocator* m_pAllocator; FX_DWORD m_dwRefCount; }; -typedef struct _XFA_TEXTPIECE : public CFX_Target { + +struct XFA_TEXTPIECE : public CFX_Target { + XFA_TEXTPIECE() : pszText(nullptr), pFont(nullptr), pLinkData(nullptr) {} + ~XFA_TEXTPIECE() { + if (pLinkData) + pLinkData->Release(); + } + FX_WCHAR* pszText; int32_t iChars; int32_t* pWidths; @@ -240,20 +247,9 @@ typedef struct _XFA_TEXTPIECE : public CFX_Target { FX_FLOAT fFontSize; CFX_RectF rtPiece; CXFA_LinkUserData* pLinkData; +}; +typedef CFX_ArrayTemplate CXFA_PieceArray; - _XFA_TEXTPIECE() : pszText(NULL), pFont(NULL), pLinkData(NULL) { - pszText = NULL; - } - ~_XFA_TEXTPIECE() { - pszText = NULL; - if (NULL != pLinkData) { - pLinkData->Release(); - pLinkData = NULL; - } - } -} XFA_TEXTPIECE, *XFA_LPTEXTPIECE; -typedef XFA_TEXTPIECE const* XFA_LPCTEXTPIECE; -typedef CFX_ArrayTemplate CXFA_PieceArray; class CXFA_PieceLine : public CFX_Target { public: CXFA_PieceLine() {} @@ -383,10 +379,10 @@ class CXFA_TextLayout { int32_t iPiece, FXTEXT_CHARPOS* pCharPos, const CFX_Matrix& tmDoc2Device); - int32_t GetDisplayPos(XFA_LPCTEXTPIECE pPiece, + int32_t GetDisplayPos(const XFA_TEXTPIECE* pPiece, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode = FALSE); - FX_BOOL ToRun(XFA_LPCTEXTPIECE pPiece, FX_RTFTEXTOBJ& tr); + FX_BOOL ToRun(const XFA_TEXTPIECE* pPiece, FX_RTFTEXTOBJ& tr); void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); FX_BOOL Layout(int32_t iBlock); int32_t CountBlocks() const; diff --git a/xfa/src/fxfa/src/common/xfa_object.h b/xfa/src/fxfa/src/common/xfa_object.h index 54b77c013a..7fcf94550d 100644 --- a/xfa/src/fxfa/src/common/xfa_object.h +++ b/xfa/src/fxfa/src/common/xfa_object.h @@ -107,21 +107,23 @@ enum XFA_SOM_MESSAGETYPE { typedef CFX_StackTemplate CXFA_NodeStack; typedef CXFA_PtrSetTemplate CXFA_NodeSet; typedef void (*PD_CALLBACK_DUPLICATEDATA)(void*& pData); -typedef struct _XFA_MAPDATABLOCKCALLBACKINFO { + +struct XFA_MAPDATABLOCKCALLBACKINFO { PD_CALLBACK_FREEDATA pFree; PD_CALLBACK_DUPLICATEDATA pCopy; -} XFA_MAPDATABLOCKCALLBACKINFO; -typedef struct _XFA_MAPDATABLOCK { - uint8_t* GetData() const { - return (uint8_t*)this + sizeof(_XFA_MAPDATABLOCK); - } +}; + +struct XFA_MAPDATABLOCK { + uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); } XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo; int32_t iBytes; -} XFA_MAPDATABLOCK, *XFA_LPMAPDATABLOCK; -typedef struct _XFA_MAPMODULEDATA { +}; + +struct XFA_MAPMODULEDATA { CFX_MapPtrToPtr m_ValueMap; - CFX_MapPtrTemplate m_BufferMap; -} XFA_MAPMODULEDATA, *XFA_LPMAPMODULEDATA; + CFX_MapPtrTemplate m_BufferMap; +}; + #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') @@ -611,7 +613,7 @@ class CXFA_Node : public CXFA_Object { FX_BOOL bScriptModify = FALSE, FX_BOOL bSyncData = TRUE); CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); - XFA_LPMAPMODULEDATA GetMapModuleData(FX_BOOL bCreateNew); + XFA_MAPMODULEDATA* GetMapModuleData(FX_BOOL bCreateNew); void SetMapModuleValue(void* pKey, void* pValue); FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); @@ -642,7 +644,7 @@ class CXFA_Node : public CXFA_Object { FX_WORD m_ePacket; FX_DWORD m_dwNameHash; CXFA_Node* m_pAuxNode; - XFA_LPMAPMODULEDATA m_pMapModuleData; + XFA_MAPMODULEDATA* m_pMapModuleData; }; class CXFA_OrdinaryObject : public CXFA_Object { public: diff --git a/xfa/src/fxfa/src/common/xfa_script.h b/xfa/src/fxfa/src/common/xfa_script.h index f8ee46dea2..4b8495125d 100644 --- a/xfa/src/fxfa/src/common/xfa_script.h +++ b/xfa/src/fxfa/src/common/xfa_script.h @@ -46,10 +46,11 @@ class CXFA_HVALUEArray : public CFX_ArrayTemplate { } FXJSE_HRUNTIME m_hRunTime; }; -typedef struct _XFA_RESOLVENODE_RS { - _XFA_RESOLVENODE_RS() + +struct XFA_RESOLVENODE_RS { + XFA_RESOLVENODE_RS() : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} - ~_XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } + ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const { if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { FXJSE_HRUNTIME hRunTime = hValueArray.m_hRunTime; @@ -62,16 +63,19 @@ typedef struct _XFA_RESOLVENODE_RS { } return hValueArray.GetSize(); } + CXFA_ObjArray nodes; XFA_RESOVENODE_RSTYPE dwFlags; const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; -} XFA_RESOLVENODE_RS, *XFA_LPRESOLVENODE_RS; -typedef struct _XFA_JSBUILTININFO { +}; + +struct XFA_JSBUILTININFO { uint32_t uUnicodeHash; const FX_CHAR* pName; -} XFA_JSBUILTININFO, *XFA_LPJSBUILTININFO; -typedef XFA_JSBUILTININFO const* XFA_LPCJSBUILTININFO; -XFA_LPCJSBUILTININFO XFA_GetJSBuiltinByHash(uint32_t uHashCode); +}; + +const XFA_JSBUILTININFO* XFA_GetJSBuiltinByHash(uint32_t uHashCode); + class IXFA_ScriptContext { public: virtual ~IXFA_ScriptContext() {} diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index 9662c1debf..b09d44b157 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -5007,21 +5007,21 @@ FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || GetClassID() == XFA_ELEMENT_Xfa); } -XFA_LPMAPMODULEDATA CXFA_Node::GetMapModuleData(FX_BOOL bCreateNew) { +XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData(FX_BOOL bCreateNew) { if (!m_pMapModuleData && bCreateNew) { m_pMapModuleData = new XFA_MAPMODULEDATA; } return m_pMapModuleData; } void CXFA_Node::SetMapModuleValue(void* pKey, void* pValue) { - XFA_LPMAPMODULEDATA pModule = GetMapModuleData(TRUE); + XFA_MAPMODULEDATA* pModule = GetMapModuleData(TRUE); if (pModule) pModule->m_ValueMap.SetAt(pKey, pValue); } FX_BOOL CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { CXFA_Node* pNode = this; while (pNode) { - XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE); + XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData(FALSE); if (pModule && pModule->m_ValueMap.Lookup(pKey, pValue)) { return TRUE; } @@ -5049,20 +5049,20 @@ void CXFA_Node::SetMapModuleBuffer( void* pValue, int32_t iBytes, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { - XFA_LPMAPMODULEDATA pModule = GetMapModuleData(TRUE); + XFA_MAPMODULEDATA* pModule = GetMapModuleData(TRUE); if (!pModule) return; - XFA_LPMAPDATABLOCK& pBuffer = pModule->m_BufferMap[pKey]; + XFA_MAPDATABLOCK*& pBuffer = pModule->m_BufferMap[pKey]; if (pBuffer == NULL) { - pBuffer = (XFA_LPMAPDATABLOCK)FX_Alloc(uint8_t, - sizeof(XFA_MAPDATABLOCK) + iBytes); + pBuffer = + (XFA_MAPDATABLOCK*)FX_Alloc(uint8_t, sizeof(XFA_MAPDATABLOCK) + iBytes); } else if (pBuffer->iBytes != iBytes) { if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); } - pBuffer = (XFA_LPMAPDATABLOCK)FX_Realloc(uint8_t, pBuffer, - sizeof(XFA_MAPDATABLOCK) + iBytes); + pBuffer = (XFA_MAPDATABLOCK*)FX_Realloc(uint8_t, pBuffer, + sizeof(XFA_MAPDATABLOCK) + iBytes); } else if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); } @@ -5077,10 +5077,10 @@ FX_BOOL CXFA_Node::GetMapModuleBuffer(void* pKey, void*& pValue, int32_t& iBytes, FX_BOOL bProtoAlso) { - XFA_LPMAPDATABLOCK pBuffer = NULL; + XFA_MAPDATABLOCK* pBuffer = NULL; CXFA_Node* pNode = this; while (pNode) { - XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE); + XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData(FALSE); if (pModule && pModule->m_BufferMap.Lookup(pKey, pBuffer)) { break; } @@ -5099,10 +5099,10 @@ FX_BOOL CXFA_Node::HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso) { CXFA_Node* pNode = this; while (pNode) { void* pVal; - XFA_LPMAPMODULEDATA pModule = pNode->GetMapModuleData(FALSE); + XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData(FALSE); if (pModule && (pModule->m_ValueMap.Lookup(pKey, pVal) || - pModule->m_BufferMap.Lookup(pKey, (XFA_LPMAPDATABLOCK&)pVal))) { + pModule->m_BufferMap.Lookup(pKey, (XFA_MAPDATABLOCK*&)pVal))) { return TRUE; } pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets) @@ -5112,12 +5112,12 @@ FX_BOOL CXFA_Node::HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso) { return FALSE; } void CXFA_Node::RemoveMapModuleKey(void* pKey) { - XFA_LPMAPMODULEDATA pModule = GetMapModuleData(FALSE); + XFA_MAPMODULEDATA* pModule = GetMapModuleData(FALSE); if (!pModule) return; if (pKey) { - XFA_LPMAPDATABLOCK pBuffer = NULL; + XFA_MAPDATABLOCK* pBuffer = NULL; pModule->m_BufferMap.Lookup(pKey, pBuffer); if (pBuffer) { if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { @@ -5128,7 +5128,7 @@ void CXFA_Node::RemoveMapModuleKey(void* pKey) { pModule->m_BufferMap.RemoveKey(pKey); pModule->m_ValueMap.RemoveKey(pKey); } else { - XFA_LPMAPDATABLOCK pBuffer; + XFA_MAPDATABLOCK* pBuffer; FX_POSITION posBuffer = pModule->m_BufferMap.GetStartPosition(); while (posBuffer) { pModule->m_BufferMap.GetNextAssoc(posBuffer, pKey, pBuffer); @@ -5145,12 +5145,12 @@ void CXFA_Node::RemoveMapModuleKey(void* pKey) { } } void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { - XFA_LPMAPMODULEDATA pDstModuleData = + XFA_MAPMODULEDATA* pDstModuleData = static_cast(pDstModule)->GetMapModuleData(TRUE); if (!pDstModuleData) { return; } - XFA_LPMAPMODULEDATA pSrcModuleData = GetMapModuleData(FALSE); + XFA_MAPMODULEDATA* pSrcModuleData = this->GetMapModuleData(FALSE); if (!pSrcModuleData) { return; } @@ -5166,9 +5166,9 @@ void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { FX_POSITION psBuffer = pSrcModuleData->m_BufferMap.GetStartPosition(); while (psBuffer) { void* pKey; - XFA_LPMAPDATABLOCK pSrcBuffer; + XFA_MAPDATABLOCK* pSrcBuffer; pSrcModuleData->m_BufferMap.GetNextAssoc(psBuffer, pKey, pSrcBuffer); - XFA_LPMAPDATABLOCK& pBuffer = pDstModuleData->m_BufferMap[pKey]; + XFA_MAPDATABLOCK*& pBuffer = pDstModuleData->m_BufferMap[pKey]; if (pBuffer && !bUseSrcAttr) { continue; } @@ -5181,13 +5181,13 @@ void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { continue; } if (pBuffer == NULL) { - pBuffer = (XFA_LPMAPDATABLOCK)FX_Alloc( + pBuffer = (XFA_MAPDATABLOCK*)FX_Alloc( uint8_t, sizeof(XFA_MAPDATABLOCK) + pSrcBuffer->iBytes); } else if (pBuffer->iBytes != pSrcBuffer->iBytes) { if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); } - pBuffer = (XFA_LPMAPDATABLOCK)FX_Realloc( + pBuffer = (XFA_MAPDATABLOCK*)FX_Realloc( uint8_t, pBuffer, sizeof(XFA_MAPDATABLOCK) + pSrcBuffer->iBytes); } else if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) { pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData()); @@ -5214,8 +5214,8 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { if (pDstModule->GetClassID() != GetClassID()) { bNeedMove = FALSE; } - XFA_LPMAPMODULEDATA pSrcModuleData = NULL; - XFA_LPMAPMODULEDATA pDstModuleData = NULL; + XFA_MAPMODULEDATA* pSrcModuleData = NULL; + XFA_MAPMODULEDATA* pDstModuleData = NULL; if (bNeedMove) { pSrcModuleData = GetMapModuleData(FALSE); if (!pSrcModuleData) { @@ -5232,7 +5232,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { pSrcModuleData->m_BufferMap.RemoveKey(pKey); pDstModuleData->m_BufferMap.RemoveKey(pKey); pDstModuleData->m_BufferMap.SetAt(pKey, - (XFA_LPMAPDATABLOCK)pBufferBlockData); + (XFA_MAPDATABLOCK*)pBufferBlockData); } } if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { -- cgit v1.2.3