summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidget.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-11 16:35:12 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-11 16:35:12 +0000
commitce7df754b0608887a923d5083f0bbb999a735fce (patch)
tree03c73474e98e7832eb6601e5933707f3ec087653 /xfa/fxfa/cxfa_ffwidget.cpp
parentb800d149de09ac7d73aa3d1ff8558e33a4c56009 (diff)
downloadpdfium-ce7df754b0608887a923d5083f0bbb999a735fce.tar.xz
Rename CXFA_Box methods to make return clearer
This CL renames the methods in CXFA_Box to make it clearer they can return nullptr. Change-Id: I521c0e06af306f69e390a4057cabb7777a0d72f5 Reviewed-on: https://pdfium-review.googlesource.com/22740 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffwidget.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index cff0697c82..e28aa4314e 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -250,7 +250,8 @@ void XFA_BOX_GetFillPath(CXFA_Box* box,
CXFA_GEPath& fillPath,
uint16_t dwFlags) {
if (box->IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- float fThickness = std::fmax(0.0, box->GetEdge(0)->GetThickness());
+ CXFA_Edge* edge = box->GetEdgeIfExists(0);
+ float fThickness = std::fmax(0.0, edge ? edge->GetThickness() : 0);
float fHalf = fThickness / 2;
XFA_AttributeEnum iHand = box->GetHand();
if (iHand == XFA_AttributeEnum::Left)
@@ -391,12 +392,13 @@ void XFA_BOX_GetFillPath(CXFA_Box* box,
}
}
-void XFA_BOX_Fill_Radial(CXFA_Box* box,
+void XFA_BOX_Fill_Radial(CXFA_Fill* fill,
CXFA_Graphics* pGS,
CXFA_GEPath& fillPath,
CFX_RectF rtFill,
const CFX_Matrix& matrix) {
- CXFA_Fill* fill = box->GetFill();
+ ASSERT(fill);
+
FX_ARGB crStart = fill->GetColor(false);
FX_ARGB crEnd = fill->GetRadialColor();
if (!fill->IsRadialToEdge())
@@ -411,12 +413,13 @@ void XFA_BOX_Fill_Radial(CXFA_Box* box,
pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix);
}
-void XFA_BOX_Fill_Pattern(CXFA_Box* box,
+void XFA_BOX_Fill_Pattern(CXFA_Fill* fill,
CXFA_Graphics* pGS,
CXFA_GEPath& fillPath,
CFX_RectF rtFill,
const CFX_Matrix& matrix) {
- CXFA_Fill* fill = box->GetFill();
+ ASSERT(fill);
+
FX_ARGB crStart = fill->GetColor(false);
FX_ARGB crEnd = fill->GetPatternColor();
FX_HatchStyle iHatch = FX_HatchStyle::Cross;
@@ -445,12 +448,13 @@ void XFA_BOX_Fill_Pattern(CXFA_Box* box,
pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix);
}
-void XFA_BOX_Fill_Linear(CXFA_Box* box,
+void XFA_BOX_Fill_Linear(CXFA_Fill* fill,
CXFA_Graphics* pGS,
CXFA_GEPath& fillPath,
CFX_RectF rtFill,
const CFX_Matrix& matrix) {
- CXFA_Fill* fill = box->GetFill();
+ ASSERT(fill);
+
FX_ARGB crStart = fill->GetColor(false);
FX_ARGB crEnd = fill->GetLinearColor();
@@ -488,7 +492,7 @@ void XFA_BOX_Fill(CXFA_Box* box,
const CFX_RectF& rtWidget,
const CFX_Matrix& matrix,
uint32_t dwFlags) {
- CXFA_Fill* fill = box->GetFill();
+ CXFA_Fill* fill = box->GetFillIfExists();
if (!fill || !fill->IsVisible())
return;
@@ -500,13 +504,13 @@ void XFA_BOX_Fill(CXFA_Box* box,
XFA_Element eType = fill->GetFillType();
switch (eType) {
case XFA_Element::Radial:
- XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, matrix);
+ XFA_BOX_Fill_Radial(fill, pGS, fillPath, rtWidget, matrix);
break;
case XFA_Element::Pattern:
- XFA_BOX_Fill_Pattern(box, pGS, fillPath, rtWidget, matrix);
+ XFA_BOX_Fill_Pattern(fill, pGS, fillPath, rtWidget, matrix);
break;
case XFA_Element::Linear:
- XFA_BOX_Fill_Linear(box, pGS, fillPath, rtWidget, matrix);
+ XFA_BOX_Fill_Linear(fill, pGS, fillPath, rtWidget, matrix);
break;
default: {
FX_ARGB cr;
@@ -559,7 +563,7 @@ void XFA_BOX_StrokeArc(CXFA_Box* box,
CFX_RectF rtWidget,
const CFX_Matrix& matrix,
uint32_t dwFlags) {
- CXFA_Edge* edge = box->GetEdge(0);
+ CXFA_Edge* edge = box->GetEdgeIfExists(0);
if (!edge || !edge->IsVisible())
return;
@@ -987,7 +991,7 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS,
return;
CFX_RectF rtBorder = GetRectWithoutRotate();
- CXFA_Margin* margin = border->GetMargin();
+ CXFA_Margin* margin = border->GetMarginIfExists();
if (margin)
XFA_RectWithoutMargin(rtBorder, margin);
@@ -998,18 +1002,23 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS,
bool CXFA_FFWidget::IsLoaded() {
return !!m_pPageView;
}
+
bool CXFA_FFWidget::LoadWidget() {
PerformLayout();
return true;
}
+
void CXFA_FFWidget::UnloadWidget() {}
+
bool CXFA_FFWidget::PerformLayout() {
RecacheWidgetRect();
return true;
}
+
bool CXFA_FFWidget::UpdateFWLData() {
return false;
}
+
void CXFA_FFWidget::UpdateWidgetProperty() {}
void CXFA_FFWidget::DrawBorder(CXFA_Graphics* pGS,