diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-10 09:40:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-10 09:40:14 -0800 |
commit | 98329fe75b9c3e5422344a37d787fb22c89c2ca2 (patch) | |
tree | a1e7f3d35bc97695b074756ab7ef531c17c6262d /xfa/fwl/core/ifwl_tooltip.cpp | |
parent | 50feafc7f367a87b7e4e689421eb7ae1484660d9 (diff) | |
download | pdfium-98329fe75b9c3e5422344a37d787fb22c89c2ca2.tar.xz |
Cleanup IFWL_Widget visibility and virtual parameters
This Cl cleans up the IFWL_Widget class including:
* Making members and methods private where possible
* Removing virtual methods that are never overridden
* Removing methods that do nothing
* Removing unchecked FWL_Error return codes
Review-Url: https://codereview.chromium.org/2488953003
Diffstat (limited to 'xfa/fwl/core/ifwl_tooltip.cpp')
-rw-r--r-- | xfa/fwl/core/ifwl_tooltip.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index 99d3b98e95..35718228c3 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -40,7 +40,7 @@ FWL_Type IFWL_ToolTip::GetClassID() const { return FWL_Type::ToolTip; } -FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -63,12 +63,11 @@ FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::Update() { +void IFWL_ToolTip::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -76,10 +75,9 @@ FWL_Error IFWL_ToolTip::Update() { UpdateTextOutStyles(); GetClientRect(m_rtClient); m_rtCaption = m_rtClient; - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { +void IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { FX_FLOAT x = 0; FX_FLOAT y = 0; FX_FLOAT t = 0; @@ -95,18 +93,16 @@ FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics || !m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; DrawBkground(pGraphics, pTheme, pMatrix); DrawText(pGraphics, pTheme, pMatrix); - return FWL_Error::Succeeded; } void IFWL_ToolTip::DrawBkground(CFX_Graphics* pGraphics, @@ -206,14 +202,12 @@ void IFWL_ToolTip::RefreshToolTipPos() { FX_FLOAT fx = rtAnchor.Center().x + 20; FX_FLOAT fy = rtAnchor.Center().y + 20; rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height()); - FX_FLOAT fScreenWidth = 0; - FX_FLOAT fScreenHeight = 0; - GetScreenSize(fScreenWidth, fScreenHeight); - if (rtPopup.bottom() > fScreenHeight) { - rtPopup.Offset(0, fScreenHeight - rtPopup.bottom()); + + if (rtPopup.bottom() > 0.0f) { + rtPopup.Offset(0, 0.0f - rtPopup.bottom()); } - if (rtPopup.right() > fScreenWidth) { - rtPopup.Offset(fScreenWidth - rtPopup.right(), 0); + if (rtPopup.right() > 0.0f) { + rtPopup.Offset(0.0f - rtPopup.right(), 0); } if (rtPopup.left < 0) { rtPopup.Offset(0 - rtPopup.left, 0); |