summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-10 19:43:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 19:43:56 +0000
commit948879d23226aea31aa9ae5f6eb1fb8572f0fc05 (patch)
treee40d527c3f8757d8038ef7f7cd26dca7a83e3574 /xfa/fxfa/parser
parente844cccc8419dae40720aad57c3bcd7ced14a925 (diff)
downloadpdfium-948879d23226aea31aa9ae5f6eb1fb8572f0fc05.tar.xz
Rename GetFont to GetFontIfExists
This CL makes it explicit that GetFont may return nullptr. Change-Id: Icb7ec5ad4ed6c5f7a728230d1237898b8f2fd778 Reviewed-on: https://pdfium-review.googlesource.com/22673 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_node.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index a8de4907e0..8c0b1956fe 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1546,12 +1546,12 @@ CXFA_Font* CXFA_Node::GetOrCreateFont() {
return JSObject()->GetOrCreateProperty<CXFA_Font>(0, XFA_Element::Font);
}
-CXFA_Font* CXFA_Node::GetFont() const {
+CXFA_Font* CXFA_Node::GetFontIfExists() const {
return JSObject()->GetProperty<CXFA_Font>(0, XFA_Element::Font);
}
float CXFA_Node::GetFontSize() const {
- CXFA_Font* font = GetFont();
+ CXFA_Font* font = GetFontIfExists();
float fFontSize = font ? font->GetFontSize() : 10.0f;
return fFontSize < 0.1f ? 10.0f : fFontSize;
}
@@ -1568,7 +1568,7 @@ float CXFA_Node::GetLineHeight() const {
}
FX_ARGB CXFA_Node::GetTextColor() const {
- CXFA_Font* font = GetFont();
+ CXFA_Font* font = GetFontIfExists();
return font ? font->GetColor() : 0xFF000000;
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 57ab3cae8c..673c430dbb 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -240,7 +240,7 @@ class CXFA_Node : public CXFA_Object {
CXFA_Border* GetOrCreateBorderIfPossible();
CXFA_Caption* GetCaptionIfExists() const;
- CXFA_Font* GetFont() const;
+ CXFA_Font* GetFontIfExists() const;
CXFA_Font* GetOrCreateFont();
float GetFontSize() const;
FX_ARGB GetTextColor() const;