From 071d78690a4e2becffaeeb32fe210ee58ab3e532 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 7 Feb 2017 20:46:32 -0500 Subject: Rename x,y to width,height for Size types This Cl fixes the naming of the size types to match their purpose. This makes the code clearer. Change-Id: I37a41ab0fe01782f4749054f1f8ab29ddf8d2790 Reviewed-on: https://pdfium-review.googlesource.com/2551 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fde/tto/fde_textout.cpp | 67 +----- xfa/fde/tto/fde_textout.h | 4 - xfa/fwl/cfwl_edit.cpp | 26 +-- xfa/fwl/cfwl_listbox.cpp | 47 +++-- xfa/fwl/cfwl_monthcalendar.cpp | 88 ++++---- xfa/fwl/cfwl_widget.cpp | 8 +- xfa/fxfa/app/cxfa_textlayout.cpp | 20 +- xfa/fxfa/app/xfa_fffield.cpp | 4 +- xfa/fxfa/app/xfa_ffpageview.cpp | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 10 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 118 +++++------ xfa/fxfa/app/xfa_fwltheme.cpp | 4 +- xfa/fxfa/parser/cxfa_containerlayoutitem.cpp | 2 +- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 300 ++++++++++++++------------- 15 files changed, 333 insertions(+), 369 deletions(-) (limited to 'xfa') diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index b126d4e583..9011b8950f 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -138,10 +138,7 @@ void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { } void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { - m_rtClip = CFX_RectF(static_cast(rtClip.left), - static_cast(rtClip.top), - static_cast(rtClip.Width()), - static_cast(rtClip.Height())); + m_rtClip = rtClip.As(); } void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { @@ -165,61 +162,12 @@ int32_t CFDE_TextOut::GetTotalLines() { return m_iTotalLines; } -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_Size& size) { - CFX_RectF rtText(0.0f, 0.0f, static_cast(size.x), - static_cast(size.y)); - CalcSize(pwsStr, iLength, rtText); - size.x = (int32_t)rtText.Width(); - size.y = (int32_t)rtText.Height(); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_SizeF& size) { - CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); - CalcSize(pwsStr, iLength, rtText); - size.x = rtText.Width(); - size.y = rtText.Height(); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_Rect& rect) { - CFX_RectF rtText(static_cast(rect.left), - static_cast(rect.top), - static_cast(rect.Width()), - static_cast(rect.Height())); - CalcSize(pwsStr, iLength, rtText); - rect = CFX_Rect(static_cast(rtText.left), - static_cast(rtText.top), - static_cast(rtText.Width()), - static_cast(rtText.Height())); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_RectF& rect) { - if (!pwsStr || iLength < 1) { - rect.width = 0.0f; - rect.height = 0.0f; - } else { - CFX_Matrix rm; - rm.SetReverse(m_Matrix); - rm.TransformRect(rect); - CalcTextSize(pwsStr, iLength, rect); - m_Matrix.TransformRect(rect); - } -} - void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size) { - CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); + CFX_RectF rtText(0.0f, 0.0f, size.width, size.height); CalcLogicSize(pwsStr, iLength, rtText); - size.x = rtText.Width(); - size.y = rtText.Height(); + size = rtText.Size(); } void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, @@ -358,17 +306,14 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { - CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); - DrawText(pwsStr, iLength, rtText); + DrawText(pwsStr, iLength, + CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f)); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect) { - CFX_RectF rtText( - static_cast(rect.left), static_cast(rect.top), - static_cast(rect.width), static_cast(rect.height)); - DrawText(pwsStr, iLength, rtText); + DrawText(pwsStr, iLength, rect.As()); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 97ec1251f4..2cd1bcdb70 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -99,10 +99,6 @@ class CFDE_TextOut { void SetClipRect(const CFX_RectF& rtClip); void SetMatrix(const CFX_Matrix& matrix); void SetLineBreakTolerance(FX_FLOAT fTolerance); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Size& size); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Rect& rect); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y); void DrawText(const FX_WCHAR* pwsStr, diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 5c024785f0..667104df74 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -778,8 +778,8 @@ void CFWL_Edit::UpdateVAlignment() { part.m_pWidget = this; CFX_SizeF pSpace = theme->GetSpaceAboveBelow(&part); - fSpaceAbove = pSpace.x; - fSpaceBelow = pSpace.y; + fSpaceAbove = pSpace.width; + fSpaceBelow = pSpace.height; } if (fSpaceAbove < 0.1f) fSpaceAbove = 0; @@ -1500,43 +1500,43 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) { CFX_SizeF fs; - pScrollBar->GetRange(&fs.x, &fs.y); + pScrollBar->GetRange(&fs.width, &fs.height); FX_FLOAT iCurPos = pScrollBar->GetPos(); FX_FLOAT fStep = pScrollBar->GetStepSize(); switch (dwCode) { case CFWL_EventScroll::Code::Min: { - fPos = fs.x; + fPos = fs.width; break; } case CFWL_EventScroll::Code::Max: { - fPos = fs.y; + fPos = fs.height; break; } case CFWL_EventScroll::Code::StepBackward: { fPos -= fStep; - if (fPos < fs.x + fStep / 2) { - fPos = fs.x; + if (fPos < fs.width + fStep / 2) { + fPos = fs.width; } break; } case CFWL_EventScroll::Code::StepForward: { fPos += fStep; - if (fPos > fs.y - fStep / 2) { - fPos = fs.y; + if (fPos > fs.height - fStep / 2) { + fPos = fs.height; } break; } case CFWL_EventScroll::Code::PageBackward: { fPos -= pScrollBar->GetPageSize(); - if (fPos < fs.x) { - fPos = fs.x; + if (fPos < fs.width) { + fPos = fs.width; } break; } case CFWL_EventScroll::Code::PageForward: { fPos += pScrollBar->GetPageSize(); - if (fPos > fs.y) { - fPos = fs.y; + if (fPos > fs.height) { + fPos = fs.height; } break; } diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 14d9886480..aed2a9a733 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -506,7 +506,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { bool bShowVertScr = false; bool bShowHorzScr = false; if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll)) - bShowVertScr = (fs.y > iHeight); + bShowVertScr = (fs.height > iHeight); CFX_SizeF szRange; if (bShowVertScr) { @@ -520,15 +520,15 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { rtScrollBar.height -= m_fScorllBarWidth; m_pVertScrollBar->SetWidgetRect(rtScrollBar); - szRange.x = 0, szRange.y = fs.y - m_rtConent.height; - szRange.y = std::max(szRange.y, m_fItemHeight); + szRange.width = 0; + szRange.height = std::max(fs.height - m_rtConent.height, m_fItemHeight); - m_pVertScrollBar->SetRange(szRange.x, szRange.y); + m_pVertScrollBar->SetRange(szRange.width, szRange.height); m_pVertScrollBar->SetPageSize(rtScrollBar.height * 9 / 10); m_pVertScrollBar->SetStepSize(m_fItemHeight); FX_FLOAT fPos = - std::min(std::max(m_pVertScrollBar->GetPos(), 0.f), szRange.y); + std::min(std::max(m_pVertScrollBar->GetPos(), 0.f), szRange.height); m_pVertScrollBar->SetPos(fPos); m_pVertScrollBar->SetTrackPos(fPos); if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == @@ -553,13 +553,14 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { rtScrollBar.width -= m_fScorllBarWidth; m_pHorzScrollBar->SetWidgetRect(rtScrollBar); - szRange.x = 0, szRange.y = fs.x - rtScrollBar.width; - m_pHorzScrollBar->SetRange(szRange.x, szRange.y); + szRange.width = 0; + szRange.height = fs.width - rtScrollBar.width; + m_pHorzScrollBar->SetRange(szRange.width, szRange.height); m_pHorzScrollBar->SetPageSize(fWidth * 9 / 10); m_pHorzScrollBar->SetStepSize(fWidth / 10); FX_FLOAT fPos = - std::min(std::max(m_pHorzScrollBar->GetPos(), 0.f), szRange.y); + std::min(std::max(m_pHorzScrollBar->GetPos(), 0.f), szRange.height); m_pHorzScrollBar->SetPos(fPos); m_pHorzScrollBar->SetTrackPos(fPos); if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == @@ -587,11 +588,11 @@ void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem, FX_FLOAT fItemHeight, bool bAutoSize) const { if (!bAutoSize && pItem) { - CFX_RectF rtItem(0, size.y, fWidth, fItemHeight); + CFX_RectF rtItem(0, size.height, fWidth, fItemHeight); pItem->SetRect(rtItem); } - size.x = fWidth; - size.y += fItemHeight; + size.width = fWidth; + size.height += fItemHeight; } FX_FLOAT CFWL_ListBox::GetMaxTextWidth() { @@ -604,7 +605,7 @@ FX_FLOAT CFWL_ListBox::GetMaxTextWidth() { CFX_SizeF sz = CalcTextSize(pItem->GetText(), m_pProperties->m_pThemeProvider, false); - fRet = std::max(fRet, sz.x); + fRet = std::max(fRet, sz.width); } return fRet; } @@ -839,40 +840,40 @@ bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar, CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) { CFX_SizeF fs; - pScrollBar->GetRange(&fs.x, &fs.y); + pScrollBar->GetRange(&fs.width, &fs.height); FX_FLOAT iCurPos = pScrollBar->GetPos(); FX_FLOAT fStep = pScrollBar->GetStepSize(); switch (dwCode) { case CFWL_EventScroll::Code::Min: { - fPos = fs.x; + fPos = fs.width; break; } case CFWL_EventScroll::Code::Max: { - fPos = fs.y; + fPos = fs.height; break; } case CFWL_EventScroll::Code::StepBackward: { fPos -= fStep; - if (fPos < fs.x + fStep / 2) - fPos = fs.x; + if (fPos < fs.width + fStep / 2) + fPos = fs.width; break; } case CFWL_EventScroll::Code::StepForward: { fPos += fStep; - if (fPos > fs.y - fStep / 2) - fPos = fs.y; + if (fPos > fs.height - fStep / 2) + fPos = fs.height; break; } case CFWL_EventScroll::Code::PageBackward: { fPos -= pScrollBar->GetPageSize(); - if (fPos < fs.x) - fPos = fs.x; + if (fPos < fs.width) + fPos = fs.width; break; } case CFWL_EventScroll::Code::PageForward: { fPos += pScrollBar->GetPageSize(); - if (fPos > fs.y) - fPos = fs.y; + if (fPos > fs.height) + fPos = fs.height; break; } case CFWL_EventScroll::Code::Pos: diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 2158da2064..32336913bf 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -125,7 +125,7 @@ FWL_Type CFWL_MonthCalendar::GetClassID() const { CFX_RectF CFWL_MonthCalendar::GetAutosizedWidgetRect() { CFX_SizeF fs = CalcSize(); - CFX_RectF rect(0, 0, fs.x, fs.y); + CFX_RectF rect(0, 0, fs.width, fs.height); InflateWidgetRect(rect); return rect; } @@ -314,8 +314,9 @@ void CFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics, for (int32_t i = 0; i < 7; i++) { rtDayOfWeek = - CFX_RectF(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), - m_rtWeek.top, m_szCell.x, m_szCell.y); + CFX_RectF(m_rtWeek.left + i * (m_szCell.width + MONTHCAL_HMARGIN * 2), + m_rtWeek.top, m_szCell); + params.m_rtPart = rtDayOfWeek; params.m_wsText = GetCapacityForDay(pTheme, params, i); params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; @@ -411,7 +412,6 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { if (!m_pProperties->m_pThemeProvider) return CFX_SizeF(); - CFX_SizeF fs; CFWL_ThemePart params; params.m_pWidget = this; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; @@ -421,8 +421,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { for (uint32_t i = 0; i < 7; ++i) { CFX_SizeF sz = CalcTextSize(GetCapacityForDay(pTheme, params, i), m_pProperties->m_pThemeProvider, false); - fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x; - fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y; + fMaxWeekW = (fMaxWeekW >= sz.width) ? fMaxWeekW : sz.width; + fMaxWeekH = (fMaxWeekH >= sz.height) ? fMaxWeekH : sz.height; } FX_FLOAT fDayMaxW = 0.0f; @@ -431,60 +431,65 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { CFX_WideString wsDay; wsDay.Format(L"%d", day); CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider, false); - fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x; - fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y; + fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width; + fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height; } - m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) - : (int)(fDayMaxW + 0.5)); - m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH; - fs.x = m_szCell.x * MONTHCAL_COLUMNS + - MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + - MONTHCAL_HEADER_BTN_HMARGIN * 2; + m_szCell.width = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) + : (int)(fDayMaxW + 0.5)); + m_szCell.height = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH; + + CFX_SizeF fs; + fs.width = m_szCell.width * MONTHCAL_COLUMNS + + MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + + MONTHCAL_HEADER_BTN_HMARGIN * 2; FX_FLOAT fMonthMaxW = 0.0f; FX_FLOAT fMonthMaxH = 0.0f; for (uint32_t i = 0; i < 12; ++i) { CFX_SizeF sz = CalcTextSize(GetCapacityForMonth(pTheme, params, i), m_pProperties->m_pThemeProvider, false); - fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x; - fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y; + fMonthMaxW = (fMonthMaxW >= sz.width) ? fMonthMaxW : sz.width; + fMonthMaxH = (fMonthMaxH >= sz.height) ? fMonthMaxH : sz.height; } CFX_SizeF szYear = CalcTextSize(GetHeadText(m_iYear, m_iMonth), m_pProperties->m_pThemeProvider, false); - fMonthMaxH = std::max(fMonthMaxH, szYear.y); - m_szHead = CFX_SizeF(fMonthMaxW + szYear.x, fMonthMaxH); - fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2; - fs.x = std::max(fs.x, fMonthMaxW); + fMonthMaxH = std::max(fMonthMaxH, szYear.height); + m_szHead = CFX_SizeF(fMonthMaxW + szYear.width, fMonthMaxH); + fMonthMaxW = + m_szHead.width + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.width * 2; + fs.width = std::max(fs.width, fMonthMaxW); CFX_WideString wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay); m_wsToday = L"Today" + wsToday; m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider, false); - m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; - fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y + - MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + MONTHCAL_HEADER_BTN_VMARGIN * 4; + m_szToday.height = (m_szToday.height >= m_szCell.height) ? m_szToday.height + : m_szCell.height; + fs.height = m_szCell.width + m_szCell.height * (MONTHCAL_ROWS - 2) + + m_szToday.height + MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + + MONTHCAL_HEADER_BTN_VMARGIN * 4; return fs; } void CFWL_MonthCalendar::CalcHeadSize() { - FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2; - FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2; + FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.width) / 2; + FX_FLOAT fHeadVMargin = (m_szCell.width - m_szHead.height) / 2; m_rtHeadText = CFX_RectF(m_rtClient.left + fHeadHMargin, m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN + fHeadVMargin, - m_szHead.x, m_szHead.y); + m_szHead); } void CFWL_MonthCalendar::CalcTodaySize() { m_rtTodayFlag = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, - m_szCell.x, m_szToday.y); + m_szCell.width, m_szToday.height); m_rtToday = CFX_RectF( - m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + + m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.width + MONTHCAL_HMARGIN * 2, m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, - m_szToday.x, m_szToday.y); + m_szToday); } void CFWL_MonthCalendar::Layout() { @@ -493,18 +498,18 @@ void CFWL_MonthCalendar::Layout() { m_rtHead = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, - m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); + m_szCell.width + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); m_rtWeek = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtHead.bottom(), m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, - m_szCell.y + MONTHCAL_VMARGIN * 2); + m_szCell.height + MONTHCAL_VMARGIN * 2); m_rtLBtn = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, - m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, - m_szCell.x); + m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, + m_szCell.width, m_szCell.width); m_rtRBtn = CFX_RectF(m_rtClient.left + m_rtClient.width - - MONTHCAL_HEADER_BTN_HMARGIN - m_szCell.x, - m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, - m_szCell.x); + MONTHCAL_HEADER_BTN_HMARGIN - m_szCell.width, + m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, + m_szCell.width, m_szCell.width); m_rtHSep = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, m_rtWeek.bottom() - MONTHCAL_VMARGIN, @@ -513,7 +518,7 @@ void CFWL_MonthCalendar::Layout() { m_rtDates = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtWeek.bottom(), m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, - m_szCell.y * (MONTHCAL_ROWS - 3) + + m_szCell.height * (MONTHCAL_ROWS - 3) + MONTHCAL_VMARGIN * (MONTHCAL_ROWS - 3) * 2); CalDateItem(); @@ -530,10 +535,11 @@ void CFWL_MonthCalendar::CalDateItem() { bNewWeek = false; } pDateInfo->rect = CFX_RectF( - fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), - fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), - m_szCell.x + (MONTHCAL_HMARGIN * 2), - m_szCell.y + (MONTHCAL_VMARGIN * 2)); + fLeft + + pDateInfo->iDayOfWeek * (m_szCell.width + (MONTHCAL_HMARGIN * 2)), + fTop + iWeekOfMonth * (m_szCell.height + (MONTHCAL_VMARGIN * 2)), + m_szCell.width + (MONTHCAL_HMARGIN * 2), + m_szCell.height + (MONTHCAL_VMARGIN * 2)); if (pDateInfo->iDayOfWeek >= 6) bNewWeek = true; } diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index 72af87fc86..e9c6ddc7d8 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -168,11 +168,11 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, szOffset = GetOffsetFromParent(pWidget); } else { szOffset = pWidget->GetOffsetFromParent(this); - szOffset.x = -szOffset.x; - szOffset.y = -szOffset.y; + szOffset.width = -szOffset.width; + szOffset.height = -szOffset.height; } - fx += szOffset.x; - fy += szOffset.y; + fx += szOffset.width; + fy += szOffset.height; return; } CFX_RectF r; diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 0fbe8e0fe3..ad0fc057e2 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -261,7 +261,7 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { m_pLoader->m_fLastPos = 0; CalcSize(szMax, szMax, szDef); m_pLoader->m_bSaveLineHeight = false; - return szDef.y; + return szDef.height; } FX_FLOAT fHeight = m_pLoader->m_fHeight; @@ -293,7 +293,7 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) { m_pLoader->m_fLastPos = 0; CalcSize(szMax, szMax, szDef); m_pLoader->m_bSaveLineHeight = false; - fWidth = szDef.x; + fWidth = szDef.width; } return fWidth; } @@ -388,9 +388,9 @@ int32_t CXFA_TextLayout::CountBlocks() const { bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, const CFX_SizeF& maxSize, CFX_SizeF& defaultSize) { - defaultSize.x = maxSize.x; - if (defaultSize.x < 1) - defaultSize.x = 0xFFFF; + defaultSize.width = maxSize.width; + if (defaultSize.width < 1) + defaultSize.width = 0xFFFF; m_pBreak.reset(CreateBreak(false)); FX_FLOAT fLinePos = 0; @@ -406,7 +406,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, } bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { - if (size.x < 1) + if (size.width < 1) return false; Unload(); @@ -419,7 +419,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { m_iLines = 0; FX_FLOAT fLinePos = 0; Loader(size, fLinePos, true); - UpdateAlign(size.y, fLinePos); + UpdateAlign(size.height, fLinePos); m_pTabstopContext.reset(); if (fHeight) *fHeight = fLinePos; @@ -456,7 +456,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { Loader(szText, fLinePos, true); if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) - UpdateAlign(szText.y, fLinePos); + UpdateAlign(szText.height, fLinePos); } else if (m_pTextDataNode) { iBlock *= 2; if (iBlock < iCount - 2) @@ -668,7 +668,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, const CFX_SizeF& szText, FX_FLOAT& fLinePos, bool bSavePieces) { - InitBreak(szText.x); + InitBreak(szText.width); CXFA_Para para = m_pTextProvider->GetParaNode(); FX_FLOAT fSpaceAbove = 0; @@ -746,7 +746,7 @@ bool CXFA_TextLayout::LoadRichText( pStyle = m_textParser.ComputeStyle(pXMLNode, pParentStyle.Get()); InitBreak(bContentNode ? pParentStyle.Get() : pStyle.Get(), eDisplay, - szText.x, pXMLNode, pParentStyle.Get()); + szText.width, pXMLNode, pParentStyle.Get()); if ((eDisplay == FDE_CSSDisplay::Block || eDisplay == FDE_CSSDisplay::ListItem) && pStyle && diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 0f9bb65b6f..7a2a4cd656 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -208,9 +208,9 @@ void CXFA_FFField::CapPlacement() { pCapTextLayout->CalcSize(minSize, maxSize, size); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { - fCapReserve = size.y; + fCapReserve = size.height; } else { - fCapReserve = size.x; + fCapReserve = size.width; } } } diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index da31cbf3b3..7481fa61aa 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -132,7 +132,7 @@ void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt, const CFX_Rect& rtDisp, int32_t iRotate) const { CFX_SizeF sz = GetPageSize(); - GetPageMatrix(mt, CFX_RectF(0, 0, sz.x, sz.y), rtDisp, iRotate, 0); + GetPageMatrix(mt, CFX_RectF(0, 0, sz), rtDisp, iRotate, 0); } IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator( diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index d34cecc44c..8bfee69578 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -875,18 +875,22 @@ void XFA_DrawImage(CFX_Graphics* pGS, } CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); pRenderDevice->SaveState(); + CFX_PathData path; path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top); pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING); + CFX_Matrix mtImage(1, 0, 0, -1, 0, 1); - mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top); + mtImage.Concat( + CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top)); mtImage.Concat(*pMatrix); + CXFA_ImageRenderer imageRender; bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, FXDIB_INTERPOL); - while (bRet) { + while (bRet) bRet = imageRender.Continue(nullptr); - } + pRenderDevice->RestoreState(false); } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 704aec634d..adc5c31cc6 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -727,12 +727,12 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { ->m_pCapTextLayout.get(); if (pCapTextLayout) { if (!bVert && eUIType != XFA_Element::Button) { - szCap.x = fCapReserve; + szCap.width = fCapReserve; } CFX_SizeF minSize; pCapTextLayout->CalcSize(minSize, szCap, szCap); if (bReserveExit) { - bVert ? szCap.y = fCapReserve : szCap.x = fCapReserve; + bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } } else { FX_FLOAT fFontSize = 10.0f; @@ -742,10 +742,10 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { fFontSize = widgetfont.GetFontSize(); } if (bVert) { - szCap.y = fCapReserve > 0 ? fCapReserve : fFontSize; + szCap.height = fCapReserve > 0 ? fCapReserve : fFontSize; } else { - szCap.x = fCapReserve > 0 ? fCapReserve : 0; - szCap.y = fFontSize; + szCap.width = fCapReserve > 0 ? fCapReserve : 0; + szCap.height = fFontSize; } } if (CXFA_Margin mgCap = caption.GetMargin()) { @@ -755,11 +755,11 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { mgCap.GetRightInset(fRightInset); mgCap.GetBottomInset(fBottomInset); if (bReserveExit) { - bVert ? (szCap.x += fLeftInset + fRightInset) - : (szCap.y += fTopInset + fBottomInset); + bVert ? (szCap.width += fLeftInset + fRightInset) + : (szCap.height += fTopInset + fBottomInset); } else { - szCap.x += fLeftInset + fRightInset; - szCap.y += fTopInset + fBottomInset; + szCap.width += fLeftInset + fRightInset; + szCap.height += fTopInset + fBottomInset; } } } @@ -767,21 +767,21 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { CFX_SizeF szCap; CalcCaptionSize(szCap); CFX_RectF rtUIMargin = GetUIMargin(); - size.x += rtUIMargin.left + rtUIMargin.width; - size.y += rtUIMargin.top + rtUIMargin.height; - if (szCap.x > 0 && szCap.y > 0) { + size.width += rtUIMargin.left + rtUIMargin.width; + size.height += rtUIMargin.top + rtUIMargin.height; + if (szCap.width > 0 && szCap.height > 0) { int32_t iCapPlacement = GetCaption().GetPlacementType(); switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.x += szCap.x; - size.y = std::max(size.y, szCap.y); + size.width += szCap.width; + size.height = std::max(size.height, szCap.height); } break; case XFA_ATTRIBUTEENUM_Top: case XFA_ATTRIBUTEENUM_Bottom: { - size.y += szCap.y; - size.x = std::max(size.x, szCap.x); + size.height += szCap.height; + size.width = std::max(size.width, szCap.width); } default: break; @@ -797,46 +797,47 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { mgWidget.GetTopInset(fTopInset); mgWidget.GetRightInset(fRightInset); mgWidget.GetBottomInset(fBottomInset); - size.x += fLeftInset + fRightInset; - size.y += fTopInset + fBottomInset; + size.width += fLeftInset + fRightInset; + size.height += fTopInset + fBottomInset; } CXFA_Para para = GetPara(); - if (para) { - size.x += para.GetMarginLeft(); - size.x += para.GetTextIndent(); - } - FX_FLOAT fVal = 0, fMin = 0, fMax = 0; + if (para) + size.width += para.GetMarginLeft() + para.GetTextIndent(); + + FX_FLOAT fVal = 0; + FX_FLOAT fMin = 0; + FX_FLOAT fMax = 0; if (GetWidth(fVal)) { - size.x = fVal; + size.width = fVal; } else { - if (GetMinWidth(fMin)) { - size.x = std::max(size.x, fMin); - } - if (GetMaxWidth(fMax) && fMax > 0) { - size.x = std::min(size.x, fMax); - } - } - fVal = 0, fMin = 0, fMax = 0; + if (GetMinWidth(fMin)) + size.width = std::max(size.width, fMin); + if (GetMaxWidth(fMax) && fMax > 0) + size.width = std::min(size.width, fMax); + } + fVal = 0; + fMin = 0; + fMax = 0; if (GetHeight(fVal)) { - size.y = fVal; + size.height = fVal; } else { - if (GetMinHeight(fMin)) { - size.y = std::max(size.y, fMin); - } - if (GetMaxHeight(fMax) && fMax > 0) { - size.y = std::min(size.y, fMax); - } + if (GetMinHeight(fMin)) + size.height = std::max(size.height, fMin); + if (GetMaxHeight(fMax) && fMax > 0) + size.height = std::min(size.height, fMax); } return true; } + void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { FX_FLOAT fFontSize = GetFontSize(); CFX_WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { - size.y += fFontSize; + size.height += fFontSize; return; } + FX_WCHAR wcEnter = '\n'; FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1); if (wsLast == wcEnter) { @@ -862,11 +863,11 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { size); } bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { - if (size.x > 0) { + if (size.width > 0) { CFX_SizeF szOrz = size; CFX_SizeF szCap; CalcCaptionSize(szCap); - bool bCapExit = szCap.x > 0.01 && szCap.y > 0.01; + bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01; int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; if (bCapExit) { iCapPlacement = GetCaption().GetPlacementType(); @@ -874,39 +875,39 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.x -= szCap.x; + size.width -= szCap.width; } default: break; } } CFX_RectF rtUIMargin = GetUIMargin(); - size.x -= rtUIMargin.left + rtUIMargin.width; + size.width -= rtUIMargin.left + rtUIMargin.width; CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { FX_FLOAT fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); - size.x -= fLeftInset + fRightInset; + size.width -= fLeftInset + fRightInset; } CalculateTextContentSize(size); - size.y += rtUIMargin.top + rtUIMargin.height; + size.height += rtUIMargin.top + rtUIMargin.height; if (bCapExit) { switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.y = std::max(size.y, szCap.y); + size.height = std::max(size.height, szCap.height); } break; case XFA_ATTRIBUTEENUM_Top: case XFA_ATTRIBUTEENUM_Bottom: { - size.y += szCap.y; + size.height += szCap.height; } default: break; } } - size.x = szOrz.x; + size.width = szOrz.width; return CalculateWidgetAutoSize(size); } CalculateTextContentSize(size); @@ -914,7 +915,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { } bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) { FX_FLOAT fCheckSize = GetCheckButtonSize(); - size.x = size.y = fCheckSize; + size = CFX_SizeF(fCheckSize, fCheckSize); return CalculateFieldAutoSize(size); } bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) { @@ -946,8 +947,7 @@ bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { } else { rtFit.height = rtImage.height; } - size.x = rtFit.width; - size.y = rtFit.height; + size = rtFit.Size(); } return CalculateWidgetAutoSize(size); } @@ -976,8 +976,8 @@ bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { } else { rtFit.height = rtImage.height; } - size.x = rtFit.width; - size.y = rtFit.height; + size.width = rtFit.width; + size.height = rtFit.height; } return CalculateFieldAutoSize(size); } @@ -1008,8 +1008,8 @@ bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) { CXFA_TextLayout* pTextLayout = static_cast(m_pLayoutData.get())->GetTextLayout(); if (pTextLayout) { - size.x = pTextLayout->StartLayout(size.x); - size.y = pTextLayout->GetLayoutHeight(); + size.width = pTextLayout->StartLayout(size.width); + size.height = pTextLayout->GetLayoutHeight(); } return CalculateWidgetAutoSize(size); } @@ -1139,9 +1139,9 @@ void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType, default: break; } - fWidth = sz.x; - m_pLayoutData->m_fWidgetHeight = sz.y; - fCalcHeight = sz.y; + fWidth = sz.width; + m_pLayoutData->m_fWidgetHeight = sz.height; + fCalcHeight = sz.height; } bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { XFA_Element eUIType = GetUIType(); diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 3398c8a25c..73abaecbc8 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -215,8 +215,8 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); if (CXFA_Para para = pWidgetAcc->GetPara()) { - sizeAboveBelow.x = para.GetSpaceAbove(); - sizeAboveBelow.y = para.GetSpaceBelow(); + sizeAboveBelow.width = para.GetSpaceAbove(); + sizeAboveBelow.height = para.GetSpaceBelow(); } } return sizeAboveBelow; diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp index dd759b699a..5ef29f14cf 100644 --- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp @@ -34,7 +34,7 @@ CFX_SizeF CXFA_ContainerLayoutItem::GetPageSize() const { pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt)); if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) == XFA_ATTRIBUTEENUM_Landscape) { - size = CFX_SizeF(size.y, size.x); + size = CFX_SizeF(size.height, size.width); } return size; } diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 169ed04c70..f38ef0ebfd 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -664,7 +664,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pContentChildLayoutItem->m_pNextSibling) { if (CXFA_ContentLayoutItem* pContent = pContentChildLayoutItem->AsContentLayoutItem()) { - fUsedHeight += pContent->m_sSize.y; + fUsedHeight += pContent->m_sSize.height; } } rgUsedHeights.Add(fUsedHeight); diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index b2f6df585c..dd38c963d6 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -59,9 +59,9 @@ void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem, case XFA_Element::ExclGroup: case XFA_Element::SubformSet: { if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION) - *fWidth = pLayoutItem->m_sSize.x; + *fWidth = pLayoutItem->m_sSize.width; if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION) - *fHeight = pLayoutItem->m_sSize.y; + *fHeight = pLayoutItem->m_sSize.height; break; } case XFA_Element::Draw: @@ -87,25 +87,25 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.x = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerWidthAutoSize = false; } if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.y = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerHeightAutoSize = false; } if (*bContainerWidthAutoSize && eType == XFA_Element::Subform && pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.x = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerWidthAutoSize = false; } if (*bContainerHeightAutoSize && eType == XFA_Element::Subform && pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.y = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerHeightAutoSize = false; } return containerSize; @@ -122,23 +122,23 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize( CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); CXFA_Measurement mTmpValue; if (bContainerWidthAutoSize) { - componentSize.x = fContentCalculatedWidth; + componentSize.width = fContentCalculatedWidth; if (pMarginNode) { if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false)) - componentSize.x += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false)) - componentSize.x += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); } } if (bContainerHeightAutoSize) { - componentSize.y = fContentCalculatedHeight; + componentSize.height = fContentCalculatedHeight; if (pMarginNode) { if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false)) - componentSize.y += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, false)) { - componentSize.y += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); } } } @@ -173,9 +173,9 @@ void RelocateTableRowCells( FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; FX_FLOAT fContentCurrentHeight = - pLayoutRow->m_sSize.y - fTopInset - fBottomInset; + pLayoutRow->m_sSize.height - fTopInset - fBottomInset; FX_FLOAT fContentCalculatedWidth = 0; FX_FLOAT fContentCalculatedHeight = 0; FX_FLOAT fCurrentColX = 0; @@ -198,14 +198,15 @@ void RelocateTableRowCells( fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; if (nColSpan != nOriginalColSpan) { - fColSpanWidth = bMetWholeRowCell ? 0 : std::max(fColSpanWidth, - pLayoutChild->m_sSize.y); + fColSpanWidth = + bMetWholeRowCell ? 0 : std::max(fColSpanWidth, + pLayoutChild->m_sSize.height); } if (nOriginalColSpan == -1) bMetWholeRowCell = true; pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); - pLayoutChild->m_sSize.x = fColSpanWidth; + pLayoutChild->m_sSize.width = fColSpanWidth; if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) continue; @@ -213,10 +214,10 @@ void RelocateTableRowCells( nCurrentColIdx += nColSpan; FX_FLOAT fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight); - pLayoutChild->m_sSize.y = fNewHeight; + pLayoutChild->m_sSize.height = fNewHeight; if (bContainerHeightAutoSize) { fContentCalculatedHeight = - std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.y); + std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height); } } @@ -225,10 +226,10 @@ void RelocateTableRowCells( (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; pLayoutChild; pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.x, + UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, &fContentCalculatedHeight); - FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.y; - pLayoutChild->m_sSize.y = fContentCalculatedHeight; + FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.height; + pLayoutChild->m_sSize.height = fContentCalculatedHeight; CXFA_Node* pParaNode = pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); if (pParaNode && pLayoutChild->m_pFirstChild) { @@ -267,7 +268,7 @@ void RelocateTableRowCells( fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); } else { - fContentCalculatedWidth = containerSize.x - fLeftInset - fRightInset; + fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset; } if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) == @@ -277,7 +278,8 @@ void RelocateTableRowCells( pLayoutChild; pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { pLayoutChild->m_sPos.x = fContentCalculatedWidth - - pLayoutChild->m_sPos.x - pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x - + pLayoutChild->m_sSize.width; } } pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize( @@ -307,7 +309,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, if (!pTrailerLayoutItem) return; - FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.y; + FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.height; if (bUseInherited) { FX_FLOAT fNewSplitPos = 0; if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) @@ -338,7 +340,8 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) { pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY; pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth; - pProcessor->m_pLayoutItem->m_sSize.x += pTrailerLayoutItem->m_sSize.x; + pProcessor->m_pLayoutItem->m_sSize.width += + pTrailerLayoutItem->m_sSize.width; pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); return; } @@ -356,14 +359,14 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Right: - pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.x - + pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - fRightInset - - pTrailerLayoutItem->m_sSize.x; + pTrailerLayoutItem->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Center: pTrailerLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.x - fLeftInset - fRightInset - - pTrailerLayoutItem->m_sSize.x) / + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pTrailerLayoutItem->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Left: @@ -371,7 +374,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, pTrailerLayoutItem->m_sPos.x = fLeftInset; break; } - pProcessor->m_pLayoutItem->m_sSize.y += fHeight; + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); } @@ -390,7 +393,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.y; + FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.height; for (CXFA_ContentLayoutItem* pChildItem = (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild; pChildItem; @@ -401,13 +404,14 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Right: - pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.x - - fRightInset - pLeaderLayoutItem->m_sSize.x; + pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - + fRightInset - + pLeaderLayoutItem->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Center: pLeaderLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.x - fLeftInset - fRightInset - - pLeaderLayoutItem->m_sSize.x) / + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pLeaderLayoutItem->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Left: @@ -415,7 +419,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, pLeaderLayoutItem->m_sPos.x = fLeftInset; break; } - pProcessor->m_pLayoutItem->m_sSize.y += fHeight; + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); } @@ -450,7 +454,7 @@ FX_FLOAT InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, if (pPendingLayoutItem) { AddLeaderAfterSplit(pProcessor, pPendingLayoutItem); if (pProcessor->m_bBreakPending) - fTotalHeight += pPendingLayoutItem->m_sSize.y; + fTotalHeight += pPendingLayoutItem->m_sSize.height; } } return fTotalHeight; @@ -681,8 +685,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( fRealHeight = FLT_MAX; fAvailHeight = FLT_MAX; } - if (bTakeSpace && - (childSize.x > *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && + if (bTakeSpace && (childSize.width > + *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && (fContentWidthLimit - *fContentCurRowAvailWidth > XFA_LAYOUT_FLOAT_PERCISION)) { return XFA_ItemLayoutProcessorResult::RowFullBreak; @@ -720,7 +724,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem) : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); if (bIsAddTrailerHeight) { - childSize.y += pTrailerLayoutItem->m_sSize.y; + childSize.height += pTrailerLayoutItem->m_sSize.height; bIsAddTrailerHeight = true; } } @@ -728,7 +732,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } if (!bTakeSpace || - *fContentCurRowY + childSize.y <= + *fContentCurRowY + childSize.height <= fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || (!bContainerHeightAutoSize && pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= @@ -736,15 +740,15 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) - AddTrailerBeforeSplit(pProcessor, childSize.y, pTrailerLayoutItem, - false); + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) AddPendingNode(pProcessor, pOverflowLeaderNode, false); pProcessor->m_bUseInheriated = false; } else { if (bIsAddTrailerHeight) - childSize.y -= pTrailerLayoutItem->m_sSize.y; + childSize.height -= pTrailerLayoutItem->m_sSize.height; pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, @@ -762,8 +766,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pChildLayoutItem); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } return XFA_ItemLayoutProcessorResult::Done; } @@ -771,8 +776,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) { - AddTrailerBeforeSplit(pProcessor, childSize.y, pTrailerLayoutItem, - false); + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); } if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) AddPendingNode(pProcessor, pOverflowLeaderNode, false); @@ -780,7 +785,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( pProcessor->m_bUseInheriated = false; } else { if (bIsAddTrailerHeight) - childSize.y -= pTrailerLayoutItem->m_sSize.y; + childSize.height -= pTrailerLayoutItem->m_sSize.height; pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, @@ -789,8 +794,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); return eRetValue; } @@ -816,8 +821,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } return XFA_ItemLayoutProcessorResult::PageFullBreak; } @@ -859,8 +865,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } } return XFA_ItemLayoutProcessorResult::PageFullBreak; @@ -868,7 +875,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { childSize = pProcessor->GetCurrentComponentSize(); - if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.y)) { + if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) { CXFA_Node* pTempLeaderNode = nullptr; CXFA_Node* pTempTrailerNode = nullptr; if (pThis->m_pPageMgr) { @@ -890,8 +897,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); } if (eRetValue == XFA_ItemLayoutProcessorResult::Done) *bForceEndPage = false; @@ -939,7 +946,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, bool bCalculateMargin) { CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION || - *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.y - + *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height - XFA_LAYOUT_FLOAT_PERCISION) { return false; } @@ -1062,20 +1069,20 @@ CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType]; switch (nAbsoluteAnchorType / 3) { case 1: - pos.y -= size.y / 2; + pos.y -= size.height / 2; break; case 2: - pos.y -= size.y; + pos.y -= size.height; break; default: break; } switch (nAbsoluteAnchorType % 3) { case 1: - pos.x -= size.x / 2; + pos.x -= size.width / 2; break; case 2: - pos.x -= size.x; + pos.x -= size.width; break; default: break; @@ -1184,21 +1191,21 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); } pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; - pSecondLayoutItem->m_sSize.x = pLayoutItem->m_sSize.x; + pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width; pSecondLayoutItem->m_sPos.y = 0; - pSecondLayoutItem->m_sSize.y = pLayoutItem->m_sSize.y - fSplitPos; - pLayoutItem->m_sSize.y -= pSecondLayoutItem->m_sSize.y; + pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos; + pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height; if (pLayoutItem->m_pFirstChild) - pSecondLayoutItem->m_sSize.y += fCurTopMargin; + pSecondLayoutItem->m_sSize.height += fCurTopMargin; if (pSecondParent) { pSecondParent->AddChild(pSecondLayoutItem); if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) { - pSecondParent->m_sSize.y += fCurTopMargin; + pSecondParent->m_sSize.height += fCurTopMargin; CXFA_ContentLayoutItem* pParentItem = (CXFA_ContentLayoutItem*)pSecondParent->m_pParent; while (pParentItem) { - pParentItem->m_sSize.y += fCurTopMargin; + pParentItem->m_sSize.height += fCurTopMargin; pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; } } @@ -1236,12 +1243,12 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( if (pPreItem->m_sPos.y < 0) pPreItem->m_sPos.y = 0; - if (pPreItem->m_sPos.y + pPreItem->m_sSize.y > lHeightForKeep) { + if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) { pPreItem->m_sPos.y = lHeightForKeep; - lHeightForKeep += pPreItem->m_sSize.y; - pSecondLayoutItem->m_sSize.y += pPreItem->m_sSize.y; + lHeightForKeep += pPreItem->m_sSize.height; + pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height; if (pSecondParent) - pSecondParent->m_sSize.y += pPreItem->m_sSize.y; + pSecondParent->m_sSize.height += pPreItem->m_sSize.height; } pSecondLayoutItem->AddChild(pPreItem); } @@ -1256,7 +1263,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + - pChildItem->m_sSize.y) { + pChildItem->m_sSize.height) { pLayoutItem->AddChild(pChildItem); if (ExistContainerKeep(pChildItem->m_pFormNode, false)) keepLayoutItems.Add(pChildItem); @@ -1266,11 +1273,11 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( continue; } - FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.y; + FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.height; SplitLayoutItem( pChildItem, pSecondLayoutItem, fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); - fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; + fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight; pLayoutItem->AddChild(pChildItem); } } @@ -1671,7 +1678,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( pProcessor->SetCurrentComponentPos(absolutePos); if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.x; + FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.width; if (bChangeParentSize) { fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); @@ -1684,7 +1691,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } if (bContainerHeightAutoSize) { - FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.y; + FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.height; if (bChangeParentSize) { fContentCalculatedHeight = std::max(fContentCalculatedHeight, fChildSuppliedHeight); @@ -1738,7 +1745,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; CFX_WideStringC wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { auto widths = SeparateStringW(wsColumnWidths.c_str(), @@ -1806,7 +1813,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { int32_t iColSpan = pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); rgRowItemsSpan.Add(iColSpan); - rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.x); + rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.width); } } @@ -1831,7 +1838,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { pNewCell ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) : 0; - rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; + rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0; } CXFA_ContentLayoutItem* pCell = rgRowItems[i]; if (!pCell) @@ -1895,10 +1902,11 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Center: pLayoutChild->m_sPos.x = - (fContentWidthLimit - pLayoutChild->m_sSize.x) / 2; + (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Right: - pLayoutChild->m_sPos.x = fContentWidthLimit - pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x = + fContentWidthLimit - pLayoutChild->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Left: default: @@ -1909,7 +1917,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (bContainerWidthAutoSize) { FX_FLOAT fChildSuppliedWidth = - pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width; if (fContentWidthLimit < FLT_MAX && fContentWidthLimit > fChildSuppliedWidth) { fChildSuppliedWidth = fContentWidthLimit; @@ -1917,7 +1925,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); } - fCurrentRowY += pLayoutChild->m_sSize.y; + fCurrentRowY += pLayoutChild->m_sSize.height; } if (bContainerHeightAutoSize) @@ -1934,7 +1942,7 @@ bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( if (!pTrailerItem) return false; - FX_FLOAT fWidth = pTrailerItem->m_sSize.x; + FX_FLOAT fWidth = pTrailerItem->m_sSize.width; XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth; } @@ -1952,7 +1960,7 @@ FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend(); iter++) { AddLeaderAfterSplit(this, *iter); - fTotalHeight += (*iter)->m_sSize.y; + fTotalHeight += (*iter)->m_sSize.height; } m_arrayKeepItems.clear(); @@ -1984,12 +1992,12 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize(); std::vector keepLayoutItems; if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, - childSize.y, &keepLayoutItems)) { + childSize.height, &keepLayoutItems)) { m_arrayKeepItems.clear(); for (auto item : keepLayoutItems) { pParentProcessor->m_pLayoutItem->RemoveChild(item); - *fContentCurRowY -= item->m_sSize.y; + *fContentCurRowY -= item->m_sSize.height; m_arrayKeepItems.push_back(item); } *bAddedItemInRow = true; @@ -2000,8 +2008,8 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( rgCurLineLayoutItem->Add(pChildProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); *result = eRetValue; return true; @@ -2022,7 +2030,7 @@ bool CXFA_ItemLayoutProcessor::JudgePutNextPage( (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { pKeepItems->push_back(pChildLayoutItem); - fItemsHeight += pChildLayoutItem->m_sSize.y; + fItemsHeight += pChildLayoutItem->m_sSize.height; } else { pKeepItems->clear(); fItemsHeight = 0; @@ -2095,10 +2103,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); if (pContext && pContext->m_bCurColumnWidthAvaiable) { bContainerWidthAutoSize = false; - containerSize.x = pContext->m_fCurColumnWidth; + containerSize.width = pContext->m_fCurColumnWidth; } if (!bContainerHeightAutoSize) - containerSize.y -= m_fUsedSize; + containerSize.height -= m_fUsedSize; if (!bContainerHeightAutoSize) { CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -2110,7 +2118,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pChildContainer && pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode)) { - containerSize.y = 0; + containerSize.height = 0; bContainerHeightAutoSize = true; } } @@ -2118,7 +2126,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( CXFA_Node* pMarginNode = m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; + FX_FLOAT fLeftInset = 0; + FX_FLOAT fTopInset = 0; + FX_FLOAT fRightInset = 0; + FX_FLOAT fBottomInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -2131,7 +2142,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; FX_FLOAT fContentCalculatedWidth = 0; FX_FLOAT fContentCalculatedHeight = 0; FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; @@ -2160,12 +2171,12 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode)) continue; - fContentCalculatedWidth = - std::max(fContentCalculatedWidth, - pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.x); - fContentCalculatedHeight = - std::max(fContentCalculatedHeight, - pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.y); + fContentCalculatedWidth = std::max( + fContentCalculatedWidth, + pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width); + fContentCalculatedHeight = std::max( + fContentCalculatedHeight, + pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height); } if (pLayoutChild) @@ -2216,9 +2227,9 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( uCurHAlignState = uHAlign; } if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { - if (pLayoutNext->m_sSize.y > fContentCurRowHeight) - fContentCurRowHeight = pLayoutNext->m_sSize.y; - fContentCurRowAvailWidth -= pLayoutNext->m_sSize.x; + if (pLayoutNext->m_sSize.height > fContentCurRowHeight) + fContentCurRowHeight = pLayoutNext->m_sSize.height; + fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width; } } @@ -2262,7 +2273,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( case XFA_ItemLayoutProcessorStages::BreakBefore: { for (auto item : m_arrayKeepItems) { m_pLayoutItem->RemoveChild(item); - fContentCalculatedHeight -= item->m_sSize.y; + fContentCalculatedHeight -= item->m_sSize.height; } CXFA_Node* pLeaderNode = nullptr; @@ -2291,7 +2302,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( nullptr); InsertFlowedItem( this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2319,13 +2330,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { auto pTempProcessor = pdfium::MakeUnique( pTrailerNode, nullptr); - InsertFlowedItem(this, pTempProcessor.get(), - bContainerWidthAutoSize, bContainerHeightAutoSize, - containerSize.y, eFlowStrategy, &uCurHAlignState, - rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, - fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, false); + InsertFlowedItem( + this, pTempProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, + fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, + &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, + pContext, false); } if (!bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2340,7 +2351,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( nullptr); InsertFlowedItem( this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2376,12 +2387,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pProcessor) { if (InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, - fAvailHeight, fRealHeight, fContentWidthLimit, - &fContentCurRowY, &fContentCurRowAvailWidth, - &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, - pContext, false) != XFA_ItemLayoutProcessorResult::Done) { + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { goto SuspendAndCreateNewRow; } else { pProcessor.reset(); @@ -2403,12 +2415,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pProcessor) { if (InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, - fAvailHeight, fRealHeight, fContentWidthLimit, - &fContentCurRowY, &fContentCurRowAvailWidth, - &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, - pContext, false) != XFA_ItemLayoutProcessorResult::Done) { + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { goto SuspendAndCreateNewRow; } else { pProcessor.reset(); @@ -2441,7 +2454,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( InsertPendingItems(pProcessor.get(), m_pCurChildNode); XFA_ItemLayoutProcessorResult rs = InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2498,17 +2511,17 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); - if (containerSize.y >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || + if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || bRetValue) { if (!m_pLayoutItem) m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - containerSize.y = std::max(containerSize.y, 0.f); + containerSize.height = std::max(containerSize.height, 0.f); SetCurrentComponentSize(containerSize); if (bForceEndPage) m_fUsedSize = 0; else - m_fUsedSize += m_pLayoutItem->m_sSize.y; + m_fUsedSize += m_pLayoutItem->m_sSize.height; } return bRetValue @@ -2537,7 +2550,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( nTotalLength++; if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[i][j]->m_pFormNode)) { - fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.x; + fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width; } } } @@ -2566,7 +2579,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); @@ -2585,7 +2598,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); @@ -2602,7 +2615,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); @@ -2614,7 +2627,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width; } rgCurLineLayoutItems[0][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2627,7 +2640,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width; } rgCurLineLayoutItems[1][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2638,7 +2651,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width; } rgCurLineLayoutItems[2][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2689,13 +2702,13 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { CXFA_Document* pDocument = m_pFormNode->GetDocument(); CXFA_FFNotify* pNotify = pDocument->GetNotify(); CFX_SizeF size(-1, -1); - pNotify->StartFieldDrawLayout(m_pFormNode, size.x, size.y); + pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height); int32_t nRotate = FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); nRotate = XFA_MapRotation(nRotate); if (nRotate == 90 || nRotate == 270) - std::swap(size.x, size.y); + std::swap(size.width, size.height); SetCurrentComponentSize(size); } @@ -2746,8 +2759,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( } CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() { - ASSERT(m_pLayoutItem); - return CFX_SizeF(m_pLayoutItem->m_sSize.x, m_pLayoutItem->m_sSize.y); + return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height); } void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) { -- cgit v1.2.3