summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-08 14:05:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-08 14:05:14 -0800
commit43ac44cbf52076fd2354d5276c95d5b4b4a06d64 (patch)
tree28670fc2d1ee83358c717fb43ca7bc9301b2480f /xfa/fwl/cfwl_edit.cpp
parent53ed03d9d865c312fdaa4434b83ed60619881226 (diff)
downloadpdfium-43ac44cbf52076fd2354d5276c95d5b4b4a06d64.tar.xz
Cleanup CFWL_Widget code to return CFX_RectFs where appropriate
This Cl changes the various Get*Rect methods in CFWL_Widget to return CFX_RectF classes instead of taking an out parameter. The Repaint method is split into Repaint() and RepaintRect() in order to change the param to a const CFX_RectF& from a CFX_RectF*. Review-Url: https://codereview.chromium.org/2560873005
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 321303942e..913f08d7b9 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -429,7 +429,7 @@ void CFWL_Edit::OnCaretChanged() {
if (bRepaintContent || bRepaintScroll) {
if (bRepaintContent)
rtInvalid.Union(m_rtEngine);
- Repaint(&rtInvalid);
+ RepaintRect(rtInvalid);
}
}
@@ -437,21 +437,16 @@ void CFWL_Edit::OnTextChanged(const FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask)
UpdateVAlignment();
- CFX_RectF rtTemp;
- GetClientRect(rtTemp);
-
CFWL_EventTextChanged event(this);
event.wsPrevText = ChangeInfo.wsPrevText;
DispatchEvent(&event);
LayoutScrollBar();
- Repaint(&rtTemp);
+ RepaintRect(GetClientRect());
}
void CFWL_Edit::OnSelChanged() {
- CFX_RectF rtTemp;
- GetClientRect(rtTemp);
- Repaint(&rtTemp);
+ RepaintRect(GetClientRect());
}
bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) {
@@ -863,10 +858,8 @@ void CFWL_Edit::UpdateCaret() {
CFX_RectF rtCaret;
rtCaret.Set(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height);
- CFX_RectF rtClient;
- GetClientRect(rtClient);
+ CFX_RectF rtClient = GetClientRect();
rtCaret.Intersect(rtClient);
-
if (rtCaret.left > rtClient.right()) {
FX_FLOAT right = rtCaret.right();
rtCaret.left = rtClient.right() - 1;
@@ -990,7 +983,7 @@ int32_t CFWL_Edit::AddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord) {
}
void CFWL_Edit::Layout() {
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtEngine = m_rtClient;
FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -1162,7 +1155,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
m_pCaret->ShowCaret();
if (!pRect->IsEmpty())
m_pCaret->SetWidgetRect(*pRect);
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
return;
}
@@ -1196,7 +1189,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
void CFWL_Edit::HideCaret(CFX_RectF* pRect) {
if (m_pCaret) {
m_pCaret->HideCaret();
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
return;
}
@@ -1391,7 +1384,7 @@ void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -1417,7 +1410,7 @@ void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) {
m_nSelStart = nIndex;
}
if (bRepaint)
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
}
void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -1439,7 +1432,7 @@ void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) {
m_EdtEngine.AddSelRange(nIndex, nCount);
m_EdtEngine.SetCaretPos(nIndex + nCount - 1, false);
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
}
void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
@@ -1639,6 +1632,6 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar,
CFX_RectF rect = GetWidgetRect();
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
return true;
}