summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-02-07 20:46:32 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 02:13:33 +0000
commit071d78690a4e2becffaeeb32fe210ee58ab3e532 (patch)
tree60484551e89fa689e9af6ee7008bcd8e737ea10c /xfa/fwl
parentbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (diff)
downloadpdfium-071d78690a4e2becffaeeb32fe210ee58ab3e532.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_edit.cpp26
-rw-r--r--xfa/fwl/cfwl_listbox.cpp47
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp88
-rw-r--r--xfa/fwl/cfwl_widget.cpp8
4 files changed, 88 insertions, 81 deletions
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;