Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: xfa/fxfa/app/xfa_fftext.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_fftext.h ('k') | xfa/fxfa/app/xfa_fftextedit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_fftext.cpp
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index 1000b91c089244c1bbfb1e5bcb4c6654002088d1..2cefa09364537cebd5ca1208699d3a760ac15c40 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -39,15 +39,15 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
GetRectWithoutRotate(rtText);
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
CXFA_LayoutItem* pItem = this;
- if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) {
+ if (!pItem->GetPrev() && !pItem->GetNext()) {
XFA_RectWidthoutMargin(rtText, mgWidget);
} else {
FX_FLOAT fLeftInset, fRightInset, fTopInset = 0, fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
- if (pItem->GetPrev() == NULL) {
+ if (!pItem->GetPrev()) {
mgWidget.GetTopInset(fTopInset);
- } else if (pItem->GetNext() == NULL) {
+ } else if (!pItem->GetNext()) {
mgWidget.GetBottomInset(fBottomInset);
}
rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
@@ -77,7 +77,7 @@ FX_BOOL CXFA_FFText::PerformLayout() {
}
pTextLayout->m_Blocks.RemoveAll();
CXFA_LayoutItem* pItem = this;
- if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) {
+ if (!pItem->GetPrev() && !pItem->GetNext()) {
return TRUE;
}
pItem = pItem->GetFirst();
@@ -85,11 +85,11 @@ FX_BOOL CXFA_FFText::PerformLayout() {
CFX_RectF rtText;
pItem->GetRect(rtText);
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- if (pItem->GetPrev() == NULL) {
+ if (!pItem->GetPrev()) {
FX_FLOAT fTopInset;
mgWidget.GetTopInset(fTopInset);
rtText.height -= fTopInset;
- } else if (pItem->GetNext() == NULL) {
+ } else if (!pItem->GetNext()) {
FX_FLOAT fBottomInset;
mgWidget.GetBottomInset(fBottomInset);
rtText.height -= fBottomInset;
@@ -108,37 +108,35 @@ FX_BOOL CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return FALSE;
}
const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (NULL == wsURLContent) {
+ if (!wsURLContent)
return FALSE;
- }
+
SetButtonDown(TRUE);
return TRUE;
}
+
FX_BOOL CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtBox;
GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy)) {
- return FALSE;
- }
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (NULL == wsURLContent) {
+ if (!rtBox.Contains(fx, fy))
return FALSE;
- }
- return TRUE;
+ return !!GetLinkURLAtPoint(fx, fy);
}
+
FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!IsButtonDown()) {
return FALSE;
}
SetButtonDown(FALSE);
const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (NULL == wsURLContent) {
+ if (!wsURLContent)
return FALSE;
- }
+
CXFA_FFDoc* pDoc = GetDoc();
pDoc->GetDocProvider()->GotoURL(pDoc, wsURLContent, FALSE);
return TRUE;
}
+
FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtBox;
GetRectWithoutRotate(rtBox);
@@ -150,9 +148,9 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
}
const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
- if (NULL == pTextLayout) {
- return NULL;
- }
+ if (!pTextLayout)
+ return nullptr;
+
FX_FLOAT x(fx), y(fy);
FWLToClient(x, y);
const CXFA_PieceLineArray* pPieceLines = pTextLayout->GetPieceLines();
@@ -167,7 +165,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
}
}
- return NULL;
+ return nullptr;
}
void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
CFX_RectF rtWidget;
« no previous file with comments | « xfa/fxfa/app/xfa_fftext.h ('k') | xfa/fxfa/app/xfa_fftextedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698