summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-04 15:24:21 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-04 15:24:21 -0800
commit95b63150eabb90b9cc5181f070f49faabfc2c7de (patch)
tree683fb0eb8512a70177dfe1b61436df82acdbae87 /xfa
parentb54ced58fa30b3e85b2a955d25c974532131ed55 (diff)
downloadpdfium-95b63150eabb90b9cc5181f070f49faabfc2c7de.tar.xz
Tidy fwl_widgetimp.cpp.
Remove some dead code. Add missing consts. Convert some integer expressions to bools for return. Remove expression (with bad cast) that can't happen. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1496323004 .
Diffstat (limited to 'xfa')
-rw-r--r--xfa/include/fwl/lightwidget/widget.h2
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp63
-rw-r--r--xfa/src/fwl/src/core/include/fwl_widgetimp.h26
-rw-r--r--xfa/src/fwl/src/lightwidget/widget.cpp22
4 files changed, 28 insertions, 85 deletions
diff --git a/xfa/include/fwl/lightwidget/widget.h b/xfa/include/fwl/lightwidget/widget.h
index 06c425edec..97096a783c 100644
--- a/xfa/include/fwl/lightwidget/widget.h
+++ b/xfa/include/fwl/lightwidget/widget.h
@@ -80,8 +80,6 @@ class CFWL_Widget {
FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
FWL_ERR SetMatrix(const CFX_Matrix& matrix);
FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL);
- FWL_ERR GetProperties(CFWL_WidgetProperties& properties);
- FWL_ERR SetProperties(const CFWL_WidgetProperties& properties);
IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
FWL_ERR Repaint(const CFX_RectF* pRect = NULL);
FWL_ERR SetFocus(FX_BOOL bFocus);
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 1e52e04281..2e6d5b30ed 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -492,16 +492,7 @@ FWL_ERR CFWL_WidgetImp::SetOwnerThread(CFWL_NoteThread* pOwnerThread) {
m_pOwnerThread = pOwnerThread;
return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_WidgetImp::GetProperties(CFWL_WidgetImpProperties& properties) {
- properties = *m_pProperties;
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_WidgetImp::SetProperties(
- const CFWL_WidgetImpProperties& properties) {
- *m_pProperties = properties;
- return FWL_ERR_Succeeded;
-}
-IFWL_Widget* CFWL_WidgetImp::GetInterface() {
+IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
return m_pInterface;
}
void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
@@ -545,36 +536,36 @@ CFWL_WidgetImp::~CFWL_WidgetImp() {
m_pProperties = NULL;
}
}
-FX_BOOL CFWL_WidgetImp::IsEnabled() {
+FX_BOOL CFWL_WidgetImp::IsEnabled() const {
return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0;
}
-FX_BOOL CFWL_WidgetImp::IsVisible() {
+FX_BOOL CFWL_WidgetImp::IsVisible() const {
return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0;
}
-FX_BOOL CFWL_WidgetImp::IsActive() {
+FX_BOOL CFWL_WidgetImp::IsActive() const {
return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0;
}
-FX_BOOL CFWL_WidgetImp::IsOverLapper() {
+FX_BOOL CFWL_WidgetImp::IsOverLapper() const {
return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) ==
FWL_WGTSTYLE_OverLapper;
}
-FX_BOOL CFWL_WidgetImp::IsPopup() {
- return m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup;
+FX_BOOL CFWL_WidgetImp::IsPopup() const {
+ return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup);
}
-FX_BOOL CFWL_WidgetImp::IsChild() {
- return m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child;
+FX_BOOL CFWL_WidgetImp::IsChild() const {
+ return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child);
}
-FX_BOOL CFWL_WidgetImp::IsLocked() {
+FX_BOOL CFWL_WidgetImp::IsLocked() const {
return m_iLock > 0;
}
-FX_BOOL CFWL_WidgetImp::IsOffscreen() {
- return m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen;
+FX_BOOL CFWL_WidgetImp::IsOffscreen() const {
+ return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen);
}
-FX_BOOL CFWL_WidgetImp::HasBorder() {
- return m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border;
+FX_BOOL CFWL_WidgetImp::HasBorder() const {
+ return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border);
}
-FX_BOOL CFWL_WidgetImp::HasEdge() {
- return m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask;
+FX_BOOL CFWL_WidgetImp::HasEdge() const {
+ return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask);
}
void CFWL_WidgetImp::GetEdgeRect(CFX_RectF& rtEdge) {
rtEdge = m_pProperties->m_rtWidget;
@@ -656,22 +647,6 @@ CFWL_WidgetImp* CFWL_WidgetImp::GetRootOuter() {
}
return static_cast<CFWL_WidgetImp*>(pRet->GetImpl());
}
-FX_BOOL CFWL_WidgetImp::TransformToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- if (!m_pOuter)
- return FALSE;
- fx += m_pProperties->m_rtWidget.left;
- fx += m_pProperties->m_rtWidget.top;
- return TRUE;
-}
-FX_BOOL CFWL_WidgetImp::TransformFromOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- if (!m_pOuter)
- return FALSE;
- CFX_RectF rect;
- m_pOuter->GetWidgetRect(rect);
- fx -= rect.left;
- fx -= rect.top;
- return TRUE;
-}
#define FWL_WGT_CalcHeight 2048
#define FWL_WGT_CalcWidth 2048
#define FWL_WGT_CalcMultiLineDefWidth 120.0f
@@ -982,14 +957,10 @@ CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
return szRet;
}
FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) {
- if (pParent == (IFWL_Widget*)this) {
- return FALSE;
- }
IFWL_Widget* pUpWidget = GetParent();
while (pUpWidget) {
- if (pUpWidget == pParent) {
+ if (pUpWidget == pParent)
return TRUE;
- }
pUpWidget = pUpWidget->GetParent();
}
return FALSE;
diff --git a/xfa/src/fwl/src/core/include/fwl_widgetimp.h b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
index 5a8b79f0f9..949738d6d2 100644
--- a/xfa/src/fwl/src/core/include/fwl_widgetimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
@@ -61,9 +61,7 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
virtual IFWL_NoteThread* GetOwnerThread() const;
FWL_ERR SetOwnerThread(CFWL_NoteThread* pOwnerThread);
- FWL_ERR GetProperties(CFWL_WidgetImpProperties& properties);
- FWL_ERR SetProperties(const CFWL_WidgetImpProperties& properties);
- IFWL_Widget* GetInterface();
+ IFWL_Widget* GetInterface() const;
void SetInterface(IFWL_Widget* pInterface);
CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
@@ -72,16 +70,16 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter = NULL);
virtual ~CFWL_WidgetImp();
- FX_BOOL IsEnabled();
- FX_BOOL IsVisible();
- FX_BOOL IsActive();
- FX_BOOL IsOverLapper();
- FX_BOOL IsPopup();
- FX_BOOL IsChild();
- FX_BOOL IsLocked();
- FX_BOOL IsOffscreen();
- FX_BOOL HasBorder();
- FX_BOOL HasEdge();
+ FX_BOOL IsEnabled() const;
+ FX_BOOL IsVisible() const;
+ FX_BOOL IsActive() const;
+ FX_BOOL IsOverLapper() const;
+ FX_BOOL IsPopup() const;
+ FX_BOOL IsChild() const;
+ FX_BOOL IsLocked() const;
+ FX_BOOL IsOffscreen() const;
+ FX_BOOL HasBorder() const;
+ FX_BOOL HasEdge() const;
void GetEdgeRect(CFX_RectF& rtEdge);
FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE);
FX_FLOAT GetEdgeWidth();
@@ -89,8 +87,6 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
void* GetThemeCapacity(FX_DWORD dwCapacity);
IFWL_ThemeProvider* GetAvailableTheme();
CFWL_WidgetImp* GetRootOuter();
- FX_BOOL TransformToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
- FX_BOOL TransformFromOuter(FX_FLOAT& fx, FX_FLOAT& fy);
CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
IFWL_ThemeProvider* pTheme,
FX_BOOL bMultiLine = FALSE,
diff --git a/xfa/src/fwl/src/lightwidget/widget.cpp b/xfa/src/fwl/src/lightwidget/widget.cpp
index 0ca7f57c42..6aeafcef74 100644
--- a/xfa/src/fwl/src/lightwidget/widget.cpp
+++ b/xfa/src/fwl/src/lightwidget/widget.cpp
@@ -209,28 +209,6 @@ FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
return FWL_ERR_Indefinite;
return m_pIface->DrawWidget(pGraphics, pMatrix);
}
-FWL_ERR CFWL_Widget::GetProperties(CFWL_WidgetProperties& properties) {
- properties.m_ctmOnParent = m_pProperties->m_ctmOnParent;
- properties.m_rtWidget = m_pProperties->m_rtWidget;
- properties.m_dwStyles = m_pProperties->m_dwStyles;
- properties.m_dwStyleExes = m_pProperties->m_dwStyleExes;
- properties.m_dwStates = m_pProperties->m_dwStates;
- properties.m_pParent = m_pProperties->m_pParent;
- properties.m_pOwner = m_pProperties->m_pOwner;
- properties.m_wsWindowclass = m_pProperties->m_wsWindowclass;
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_Widget::SetProperties(const CFWL_WidgetProperties& properties) {
- m_pProperties->m_ctmOnParent = properties.m_ctmOnParent;
- m_pProperties->m_rtWidget = properties.m_rtWidget;
- m_pProperties->m_dwStyles = properties.m_dwStyles;
- m_pProperties->m_dwStyleExes = properties.m_dwStyleExes;
- m_pProperties->m_dwStates = properties.m_dwStates;
- m_pProperties->m_pParent = properties.m_pParent;
- m_pProperties->m_pOwner = properties.m_pOwner;
- m_pProperties->m_wsWindowclass = properties.m_wsWindowclass;
- return FWL_ERR_Succeeded;
-}
IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
if (!m_pIface)
return NULL;