Remove code that checks GetSystemHandler() return value.
GetSystemHandler() never returns nullptr. Fix some nits along the way.
Change-Id: I6003053fa2d23d887f94e24a5fab8a26b1d50555
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/58812
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 6ce6a0f..99fe2c2 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -172,7 +172,7 @@
switch (GetBorderStyle()) {
case BorderStyle::SOLID: {
CFX_GraphStateData gsd;
- gsd.m_LineWidth = (float)GetBorderWidth();
+ gsd.m_LineWidth = GetBorderWidth();
CFX_PathData path;
@@ -237,10 +237,9 @@
pRange = &wrRange;
}
- IPWL_SystemHandler* pSysHandler = GetSystemHandler();
CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pEdit.get(),
GetTextColor().ToFXColor(GetTransparency()), rcClip,
- CFX_PointF(), pRange, pSysHandler,
+ CFX_PointF(), pRange, GetSystemHandler(),
m_pFormFiller.Get());
}
@@ -279,10 +278,6 @@
if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point))
return true;
- IPWL_SystemHandler* pSH = GetSystemHandler();
- if (!pSH)
- return false;
-
SetFocus();
return false;
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 6197dd7..0705478 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -498,7 +498,7 @@
bSelect = place > wrSelect.BeginPos && place <= wrSelect.EndPos;
crCurFill = bSelect ? crWhite : crTextFill;
}
- if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
+ if (pSystemHandler->IsSelectionImplemented()) {
crCurFill = crTextFill;
crOldFill = crCurFill;
}
@@ -508,7 +508,7 @@
CPVT_Line line;
pIterator->GetLine(line);
- if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
+ if (pSystemHandler->IsSelectionImplemented()) {
CFX_FloatRect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent,
word.ptWord.x + word.fWidth,
line.ptLine.y + line.fLineAscent);
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index b64b4a0..f6f7201 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -107,15 +107,13 @@
CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (CPWL_EditImpl* pEdit = m_pList->GetItemEdit(i)) {
CFX_FloatRect rcContent = pEdit->GetContentRect();
- if (rcContent.Width() > rcClient.Width())
- rcItem.Intersect(rcList);
- else
- rcItem.Intersect(rcClient);
+ rcItem.Intersect(rcContent.Width() > rcClient.Width() ? rcList
+ : rcClient);
}
IPWL_SystemHandler* pSysHandler = GetSystemHandler();
if (m_pList->IsItemSelected(i)) {
- if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
+ if (pSysHandler->IsSelectionImplemented()) {
CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
GetTextColor().ToFXColor(255), rcList, ptOffset,
nullptr, pSysHandler, m_pFormFiller.Get());
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index d2daa9c..0b77ee4 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -269,15 +269,11 @@
rcWin.Inflate(1, 1);
rcWin.Normalize();
- IPWL_SystemHandler* pSH = GetSystemHandler();
- if (!pSH)
- return true;
-
CPDFSDK_Widget* widget = m_pAttachedData->GetWidget();
if (!widget)
return true;
- pSH->InvalidateRect(widget, rcWin);
+ GetSystemHandler()->InvalidateRect(widget, rcWin);
return !!thisObserved;
}
@@ -605,10 +601,8 @@
void CPWL_Wnd::CreateChildWnd(const CreateParams& cp) {}
void CPWL_Wnd::SetCursor() {
- if (IsValid()) {
- if (IPWL_SystemHandler* pSH = GetSystemHandler())
- pSH->SetCursor(GetCreationParams()->eCursorType);
- }
+ if (IsValid())
+ GetSystemHandler()->SetCursor(GetCreationParams()->eCursorType);
}
void CPWL_Wnd::CreateMsgControl() {