summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-14 13:07:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 13:07:47 -0800
commit727a304f2ab5b72846186af0e75e6c047de0a13c (patch)
treebac247223dd7f43e7da029cd6f7e2bc0878fe0f3
parentbe5f0297256ba3c597dd32eb7eefef57fbd8e201 (diff)
downloadpdfium-727a304f2ab5b72846186af0e75e6c047de0a13c.tar.xz
This CL removes some of the unused CFWL widget flags.
Several of the widgets have flags which are no longer set. This CL removes the flags and any flag conditional code. Review-Url: https://codereview.chromium.org/2570083002
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp105
-rw-r--r--xfa/fwl/cfwl_checkbox.h19
-rw-r--r--xfa/fwl/cfwl_combobox.cpp27
-rw-r--r--xfa/fwl/cfwl_combobox.h14
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp10
-rw-r--r--xfa/fwl/cfwl_datetimepicker.h11
-rw-r--r--xfa/fwl/cfwl_picturebox.h15
7 files changed, 22 insertions, 179 deletions
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 3f8ca905c3..e72695fa6b 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -131,35 +131,9 @@ void CFWL_CheckBox::Layout() {
m_rtClient = GetClientRect();
FX_FLOAT fBoxTop = m_rtClient.top;
- FX_FLOAT fClientBottom = m_rtClient.bottom();
-
- switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) {
- case FWL_STYLEEXT_CKB_Top:
- break;
- case FWL_STYLEEXT_CKB_Bottom: {
- fBoxTop = fClientBottom - m_fBoxHeight;
- break;
- }
- case FWL_STYLEEXT_CKB_VCenter:
- default: {
- fBoxTop = m_rtClient.top + (m_rtClient.height - m_fBoxHeight) / 2;
- fBoxTop = FXSYS_floor(fBoxTop);
- break;
- }
- }
-
FX_FLOAT fBoxLeft = m_rtClient.left;
- FX_FLOAT fTextLeft = 0.0;
- FX_FLOAT fTextRight = 0.0;
- FX_FLOAT fClientRight = m_rtClient.right();
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_LeftText) {
- fBoxLeft = fClientRight - m_fBoxHeight;
- fTextLeft = m_rtClient.left;
- fTextRight = fBoxLeft;
- } else {
- fTextLeft = fBoxLeft + m_fBoxHeight;
- fTextRight = fClientRight;
- }
+ FX_FLOAT fTextLeft = fBoxLeft + m_fBoxHeight;
+ FX_FLOAT fTextRight = m_rtClient.right();
m_rtBox.Set(fBoxLeft, fBoxTop, m_fBoxHeight, m_fBoxHeight);
m_rtCaption.Set(fTextLeft, m_rtClient.top, fTextRight - fTextLeft,
m_rtClient.height);
@@ -171,29 +145,12 @@ void CFWL_CheckBox::Layout() {
CalcTextRect(L"Check box", m_pProperties->m_pThemeProvider, m_dwTTOStyles,
m_iTTOAlign, rtFocus);
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine) == 0) {
- FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width);
- FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height);
- FX_FLOAT fLeft = m_rtCaption.left;
- FX_FLOAT fTop = m_rtCaption.top;
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_HLayoutMask) ==
- FWL_STYLEEXT_CKB_Center) {
- fLeft = m_rtCaption.left + (m_rtCaption.width - fWidth) / 2;
- } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_HLayoutMask) ==
- FWL_STYLEEXT_CKB_Right) {
- fLeft = m_rtCaption.right() - fWidth;
- }
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) ==
- FWL_STYLEEXT_CKB_VCenter) {
- fTop = m_rtCaption.top + (m_rtCaption.height - fHeight) / 2;
- } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) ==
- FWL_STYLEEXT_CKB_Bottom) {
- fTop = m_rtCaption.bottom() - fHeight;
- }
- m_rtFocus.Set(fLeft, fTop, fWidth, fHeight);
- } else {
- m_rtFocus.Set(rtFocus.left, rtFocus.top, rtFocus.width, rtFocus.height);
- }
+
+ FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width);
+ FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height);
+ FX_FLOAT fLeft = m_rtCaption.left;
+ FX_FLOAT fTop = m_rtCaption.top;
+ m_rtFocus.Set(fLeft, fTop, fWidth, fHeight);
m_rtFocus.Inflate(1, 1);
}
@@ -220,53 +177,11 @@ uint32_t CFWL_CheckBox::GetPartStates() const {
}
void CFWL_CheckBox::UpdateTextOutStyles() {
- switch (m_pProperties->m_dwStyleExes &
- (FWL_STYLEEXT_CKB_HLayoutMask | FWL_STYLEEXT_CKB_VLayoutMask)) {
- case FWL_STYLEEXT_CKB_Left | FWL_STYLEEXT_CKB_Top: {
- m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft;
- break;
- }
- case FWL_STYLEEXT_CKB_Center | FWL_STYLEEXT_CKB_Top: {
- m_iTTOAlign = FDE_TTOALIGNMENT_TopCenter;
- break;
- }
- case FWL_STYLEEXT_CKB_Right | FWL_STYLEEXT_CKB_Top: {
- m_iTTOAlign = FDE_TTOALIGNMENT_TopRight;
- break;
- }
- case FWL_STYLEEXT_CKB_Left | FWL_STYLEEXT_CKB_VCenter: {
- m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft;
- break;
- }
- case FWL_STYLEEXT_CKB_Right | FWL_STYLEEXT_CKB_VCenter: {
- m_iTTOAlign = FDE_TTOALIGNMENT_CenterRight;
- break;
- }
- case FWL_STYLEEXT_CKB_Left | FWL_STYLEEXT_CKB_Bottom: {
- m_iTTOAlign = FDE_TTOALIGNMENT_BottomLeft;
- break;
- }
- case FWL_STYLEEXT_CKB_Center | FWL_STYLEEXT_CKB_Bottom: {
- m_iTTOAlign = FDE_TTOALIGNMENT_BottomCenter;
- break;
- }
- case FWL_STYLEEXT_CKB_Right | FWL_STYLEEXT_CKB_Bottom: {
- m_iTTOAlign = FDE_TTOALIGNMENT_BottomRight;
- break;
- }
- case FWL_STYLEEXT_CKB_Center | FWL_STYLEEXT_CKB_VCenter:
- default: {
- m_iTTOAlign = FDE_TTOALIGNMENT_Center;
- break;
- }
- }
+ m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft;
m_dwTTOStyles = 0;
if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading)
m_dwTTOStyles |= FDE_TTOSTYLE_RTL;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine)
- m_dwTTOStyles |= FDE_TTOSTYLE_LineWrap;
- else
- m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine;
+ m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine;
}
void CFWL_CheckBox::NextStates() {
diff --git a/xfa/fwl/cfwl_checkbox.h b/xfa/fwl/cfwl_checkbox.h
index d228eee057..6df7440894 100644
--- a/xfa/fwl/cfwl_checkbox.h
+++ b/xfa/fwl/cfwl_checkbox.h
@@ -13,33 +13,18 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetproperties.h"
-#define FWL_STYLEEXT_CKB_Left (0L << 0)
-#define FWL_STYLEEXT_CKB_Center (1L << 0)
-#define FWL_STYLEEXT_CKB_Right (2L << 0)
-#define FWL_STYLEEXT_CKB_Top (0L << 2)
-#define FWL_STYLEEXT_CKB_VCenter (1L << 2)
-#define FWL_STYLEEXT_CKB_Bottom (2L << 2)
-#define FWL_STYLEEXT_CKB_LeftText (1L << 4)
-#define FWL_STYLEEXT_CKB_MultiLine (1L << 5)
#define FWL_STYLEEXT_CKB_3State (1L << 6)
#define FWL_STYLEEXT_CKB_RadioButton (1L << 7)
-#define FWL_STYLEEXT_CKB_ShapeSolidSquare (0L << 8)
-#define FWL_STYLEEXT_CKB_ShapeSunkenSquare (1L << 8)
-#define FWL_STYLEEXT_CKB_ShapeSolidCircle (2L << 8)
-#define FWL_STYLEEXT_CKB_ShapeSunkenCircle (3L << 8)
-#define FWL_STYLEEXT_CKB_SignShapeCheck (0L << 10)
+#define FWL_STYLEEXT_CKB_SignShapeCheck 0
#define FWL_STYLEEXT_CKB_SignShapeCircle (1L << 10)
#define FWL_STYLEEXT_CKB_SignShapeCross (2L << 10)
#define FWL_STYLEEXT_CKB_SignShapeDiamond (3L << 10)
#define FWL_STYLEEXT_CKB_SignShapeSquare (4L << 10)
#define FWL_STYLEEXT_CKB_SignShapeStar (5L << 10)
-#define FWL_STYLEEXT_CKB_HLayoutMask (3L << 0)
-#define FWL_STYLEEXT_CKB_VLayoutMask (3L << 2)
-#define FWL_STYLEEXT_CKB_ShapeMask (3L << 8)
#define FWL_STYLEEXT_CKB_SignShapeMask (7L << 10)
#define FWL_STATE_CKB_Hovered (1 << FWL_WGTSTATE_MAX)
#define FWL_STATE_CKB_Pressed (1 << (FWL_WGTSTATE_MAX + 1))
-#define FWL_STATE_CKB_Unchecked (0 << (FWL_WGTSTATE_MAX + 2))
+#define FWL_STATE_CKB_Unchecked 0
#define FWL_STATE_CKB_Checked (1 << (FWL_WGTSTATE_MAX + 2))
#define FWL_STATE_CKB_Neutral (2 << (FWL_WGTSTATE_MAX + 2))
#define FWL_STATE_CKB_CheckMask (3L << (FWL_WGTSTATE_MAX + 2))
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index f7b10475c1..93b595f753 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -342,23 +342,9 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) {
m_rtList.width = std::max(m_rtList.width, m_rtClient.width);
m_rtProxy = m_rtList;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListDrag)
- m_rtProxy.height += m_fComboFormHandler;
GetPopupPos(0, m_rtProxy.height, rtAnchor, m_rtProxy);
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListDrag) {
- FX_FLOAT fx = 0;
- FX_FLOAT fy = m_rtClient.top + m_rtClient.height / 2;
- TransformTo(nullptr, fx, fy);
-
- m_bUpFormHandler = fy > m_rtProxy.top;
- if (m_bUpFormHandler) {
- m_rtHandler.Set(0, 0, m_rtList.width, m_fComboFormHandler);
- m_rtList.top = m_fComboFormHandler;
- } else {
- m_rtHandler.Set(0, m_rtList.height, m_rtList.width, m_fComboFormHandler);
- }
- }
+
m_pComboBoxProxy->SetWidgetRect(m_rtProxy);
m_pComboBoxProxy->Update();
m_pListBox->SetWidgetRect(m_rtList);
@@ -447,11 +433,10 @@ void CFWL_ComboBox::ResetEditAlignment() {
dwAdd |= FWL_STYLEEXT_EDT_HCenter;
break;
}
- case FWL_STYLEEXT_CMB_EditHFar: {
- dwAdd |= FWL_STYLEEXT_EDT_HFar;
+ default: {
+ dwAdd |= FWL_STYLEEXT_EDT_HNear;
break;
}
- default: { dwAdd |= FWL_STYLEEXT_EDT_HNear; }
}
switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_EditVAlignMask) {
case FWL_STYLEEXT_CMB_EditVCenter: {
@@ -469,8 +454,6 @@ void CFWL_ComboBox::ResetEditAlignment() {
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_EditJustified)
dwAdd |= FWL_STYLEEXT_EDT_Justified;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_EditDistributed)
- dwAdd |= FWL_STYLEEXT_EDT_Distributed;
m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
FWL_STYLEEXT_EDT_HAlignModeMask |
@@ -487,10 +470,6 @@ void CFWL_ComboBox::ResetListItemAlignment() {
dwAdd |= FWL_STYLEEXT_LTB_CenterAlign;
break;
}
- case FWL_STYLEEXT_CMB_ListItemRightAlign: {
- dwAdd |= FWL_STYLEEXT_LTB_RightAlign;
- break;
- }
default: {
dwAdd |= FWL_STYLEEXT_LTB_LeftAlign;
break;
diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h
index 491b360752..c1c4ed42e0 100644
--- a/xfa/fwl/cfwl_combobox.h
+++ b/xfa/fwl/cfwl_combobox.h
@@ -23,27 +23,20 @@ class CFWL_FormProxy;
class CFWL_ListBox;
class CFWL_Widget;
-#define FWL_STYLEEXT_CMB_DropList (0L << 0)
#define FWL_STYLEEXT_CMB_DropDown (1L << 0)
#define FWL_STYLEEXT_CMB_Sort (1L << 1)
-#define FWL_STYLEEXT_CMB_ListDrag (1L << 2)
#define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3)
-#define FWL_STYLEEXT_CMB_EditHNear (0L << 4)
+#define FWL_STYLEEXT_CMB_EditHNear 0
#define FWL_STYLEEXT_CMB_EditHCenter (1L << 4)
-#define FWL_STYLEEXT_CMB_EditHFar (2L << 4)
-#define FWL_STYLEEXT_CMB_EditVNear (0L << 6)
+#define FWL_STYLEEXT_CMB_EditVNear 0
#define FWL_STYLEEXT_CMB_EditVCenter (1L << 6)
#define FWL_STYLEEXT_CMB_EditVFar (2L << 6)
#define FWL_STYLEEXT_CMB_EditJustified (1L << 8)
-#define FWL_STYLEEXT_CMB_EditDistributed (2L << 8)
#define FWL_STYLEEXT_CMB_EditHAlignMask (3L << 4)
#define FWL_STYLEEXT_CMB_EditVAlignMask (3L << 6)
-#define FWL_STYLEEXT_CMB_EditHAlignModeMask (3L << 8)
-#define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10)
+#define FWL_STYLEEXT_CMB_ListItemLeftAlign 0
#define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10)
-#define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10)
#define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10)
-#define FWL_STYLEEXT_CMB_ListItemText (0L << 12)
#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
class CFWL_ComboBox : public CFWL_Widget {
@@ -161,7 +154,6 @@ class CFWL_ComboBox : public CFWL_Widget {
std::unique_ptr<CFWL_ComboList> m_pListBox;
CFWL_ComboBoxProxy* m_pComboBoxProxy; // Can this be a unique_ptr?
bool m_bLButtonDown;
- bool m_bUpFormHandler;
int32_t m_iCurSel;
int32_t m_iBtnState;
FX_FLOAT m_fComboFormHandler;
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 5819a27cfc..9e13b18d3b 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -205,11 +205,6 @@ void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
void CFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) ==
- FWL_STYLEEXT_DTP_Spin) {
- return;
- }
-
CFWL_ThemeBackground param;
param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
@@ -308,8 +303,6 @@ void CFWL_DateTimePicker::ResetEditAlignment() {
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditJustified)
dwAdd |= FWL_STYLEEXT_EDT_Justified;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditDistributed)
- dwAdd |= FWL_STYLEEXT_EDT_Distributed;
m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask |
FWL_STYLEEXT_EDT_HAlignModeMask |
@@ -567,8 +560,7 @@ void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
ShowMonthCalendar(false);
return;
}
- if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_TimeFormat))
- ShowMonthCalendar(true);
+ ShowMonthCalendar(true);
m_bLBtnDown = true;
RepaintRect(m_rtClient);
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index 8c9d70ce75..47d1c70fc3 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -15,22 +15,17 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetproperties.h"
-#define FWL_STYLEEXT_DTP_AllowEdit (1L << 0)
-#define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1)
+#define FWL_STYLEEXT_DTP_LongDateFormat 0
#define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1)
-#define FWL_STYLEEXT_DTP_TimeFormat (2L << 1)
-#define FWL_STYLEEXT_DTP_Spin (1L << 3)
-#define FWL_STYLEEXT_DTP_EditHNear (0L << 4)
+#define FWL_STYLEEXT_DTP_EditHNear 0
#define FWL_STYLEEXT_DTP_EditHCenter (1L << 4)
#define FWL_STYLEEXT_DTP_EditHFar (2L << 4)
-#define FWL_STYLEEXT_DTP_EditVNear (0L << 6)
+#define FWL_STYLEEXT_DTP_EditVNear 0
#define FWL_STYLEEXT_DTP_EditVCenter (1L << 6)
#define FWL_STYLEEXT_DTP_EditVFar (2L << 6)
#define FWL_STYLEEXT_DTP_EditJustified (1L << 8)
-#define FWL_STYLEEXT_DTP_EditDistributed (2L << 8)
#define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4)
#define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6)
-#define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8)
class CFWL_DateTimeEdit;
class CFWL_FormProxy;
diff --git a/xfa/fwl/cfwl_picturebox.h b/xfa/fwl/cfwl_picturebox.h
index 81ff3911f6..743ea1dc6d 100644
--- a/xfa/fwl/cfwl_picturebox.h
+++ b/xfa/fwl/cfwl_picturebox.h
@@ -12,21 +12,6 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetproperties.h"
-#define FWL_STYLEEXT_PTB_Left 0L << 0
-#define FWL_STYLEEXT_PTB_Center 1L << 0
-#define FWL_STYLEEXT_PTB_Right 2L << 0
-#define FWL_STYLEEXT_PTB_Top 0L << 2
-#define FWL_STYLEEXT_PTB_Vcenter 1L << 2
-#define FWL_STYLEEXT_PTB_Bottom 2L << 2
-#define FWL_STYLEEXT_PTB_Normal 0L << 4
-#define FWL_STYLEEXT_PTB_AutoSize 1L << 4
-#define FWL_STYLEEXT_PTB_StretchImage 2L << 4
-#define FWL_STYLEEXT_PTB_StretchHImage 3L << 4
-#define FWL_STYLEEXT_PTB_StretchVImage 4L << 4
-#define FWL_STYLEEXT_PTB_HAlignMask 3L << 0
-#define FWL_STYLEEXT_PTB_VAlignMask 3L << 2
-#define FWL_STYLEEXT_PTB_StretchAlignMask 7L << 4
-
class CFX_DIBitmap;
class CFWL_Widget;