UnownedPtrs<> should ideally be const, part 2.
Follow-on from
https://pdfium-review.googlesource.com/c/pdfium/+/79730
Change-Id: I9750316ae3e7f44a2a353d5fb1d9489a6c2a4d95
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79751
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cjs_eventrecorder.cpp b/fxjs/cjs_eventrecorder.cpp
index 23429a6..74a25d6 100644
--- a/fxjs/cjs_eventrecorder.cpp
+++ b/fxjs/cjs_eventrecorder.cpp
@@ -334,7 +334,7 @@
m_pTargetFormFillEnv.Reset(pTargetFormFillEnv);
}
-void CJS_EventRecorder::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) {
+void CJS_EventRecorder::OnBookmark_MouseUp(const CPDF_Bookmark* pBookMark) {
Initialize(JET_BOOKMARK_MOUSEUP);
m_pTargetBookMark = pBookMark;
}
diff --git a/fxjs/cjs_eventrecorder.h b/fxjs/cjs_eventrecorder.h
index acf9856..69f6410 100644
--- a/fxjs/cjs_eventrecorder.h
+++ b/fxjs/cjs_eventrecorder.h
@@ -126,7 +126,7 @@
void OnScreen_InView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
void OnScreen_OutView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
- void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+ void OnBookmark_MouseUp(const CPDF_Bookmark* pBookMark);
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -193,7 +193,7 @@
bool m_bFieldFull = false;
bool m_bRcDu = false;
UnownedPtr<bool> m_pbRc;
- UnownedPtr<CPDF_Bookmark> m_pTargetBookMark;
+ UnownedPtr<const CPDF_Bookmark> m_pTargetBookMark;
ObservedPtr<CPDFSDK_FormFillEnvironment> m_pTargetFormFillEnv;
ObservedPtr<CPDFSDK_Annot> m_pTargetAnnot;
};
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index cc664cd..20e5de3 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -319,7 +319,8 @@
return pResult;
}
-CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) : m_pContext(lpContext) {}
+CFXJSE_Class::CFXJSE_Class(const CFXJSE_Context* lpContext)
+ : m_pContext(lpContext) {}
CFXJSE_Class::~CFXJSE_Class() = default;
diff --git a/fxjs/xfa/cfxjse_class.h b/fxjs/xfa/cfxjse_class.h
index f23e2d9..ff3b2f2 100644
--- a/fxjs/xfa/cfxjse_class.h
+++ b/fxjs/xfa/cfxjse_class.h
@@ -20,17 +20,17 @@
const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion,
bool bIsJSGlobal);
- explicit CFXJSE_Class(CFXJSE_Context* lpContext);
+ explicit CFXJSE_Class(const CFXJSE_Context* lpContext);
~CFXJSE_Class();
bool IsName(ByteStringView name) const { return name == m_szClassName; }
- CFXJSE_Context* GetContext() const { return m_pContext.Get(); }
+ const CFXJSE_Context* GetContext() const { return m_pContext.Get(); }
v8::Local<v8::FunctionTemplate> GetTemplate(v8::Isolate* pIsolate);
protected:
ByteString m_szClassName;
UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_lpClassDefinition;
- UnownedPtr<CFXJSE_Context> const m_pContext;
+ UnownedPtr<const CFXJSE_Context> const m_pContext;
v8::Global<v8::FunctionTemplate> m_hTemplate;
};
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index 0395741..130e634 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -29,7 +29,7 @@
} // namespace
-CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(CPDF_Document* pDoc) : m_pDoc(pDoc) {
+CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(const CPDF_Document* pDoc) : m_pDoc(pDoc) {
DCHECK(pDoc);
}
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h
index 8c3b01e..3bf9324 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.h
+++ b/xfa/fgas/font/cfgas_pdffontmgr.h
@@ -20,7 +20,7 @@
class CFGAS_PDFFontMgr final : public Observable {
public:
- explicit CFGAS_PDFFontMgr(CPDF_Document* pDoc);
+ explicit CFGAS_PDFFontMgr(const CPDF_Document* pDoc);
~CFGAS_PDFFontMgr();
RetainPtr<CFGAS_GEFont> GetFont(WideStringView wsFontFamily,
@@ -41,7 +41,7 @@
const ByteString& bsDRFontName,
bool bStrictMatch);
- UnownedPtr<CPDF_Document> const m_pDoc;
+ UnownedPtr<const CPDF_Document> const m_pDoc;
std::map<ByteString, RetainPtr<CFGAS_GEFont>> m_FontMap;
};
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index 2b8e4b5..62e2173 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -166,13 +166,13 @@
m_info.fillColor = color;
}
-void CFGAS_GEGraphics::StrokePath(CFGAS_GEPath* path,
+void CFGAS_GEGraphics::StrokePath(const CFGAS_GEPath* path,
const CFX_Matrix* matrix) {
if (path)
RenderDeviceStrokePath(path, matrix);
}
-void CFGAS_GEGraphics::FillPath(CFGAS_GEPath* path,
+void CFGAS_GEGraphics::FillPath(const CFGAS_GEPath* path,
CFX_FillRenderOptions::FillType fill_type,
const CFX_Matrix& matrix) {
if (path)
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.h b/xfa/fgas/graphics/cfgas_gegraphics.h
index d29ff20..2f9763d 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.h
+++ b/xfa/fgas/graphics/cfgas_gegraphics.h
@@ -50,8 +50,8 @@
void SetStrokeColor(const CFGAS_GEColor& color);
void SetFillColor(const CFGAS_GEColor& color);
void SetClipRect(const CFX_RectF& rect);
- void StrokePath(CFGAS_GEPath* path, const CFX_Matrix* matrix);
- void FillPath(CFGAS_GEPath* path,
+ void StrokePath(const CFGAS_GEPath* path, const CFX_Matrix* matrix);
+ void FillPath(const CFGAS_GEPath* path,
CFX_FillRenderOptions::FillType fill_type,
const CFX_Matrix& matrix);
void ConcatMatrix(const CFX_Matrix& matrix);
diff --git a/xfa/fwl/cfwl_themebackground.h b/xfa/fwl/cfwl_themebackground.h
index fd09ca2..8751e3c 100644
--- a/xfa/fwl/cfwl_themebackground.h
+++ b/xfa/fwl/cfwl_themebackground.h
@@ -19,7 +19,7 @@
~CFWL_ThemeBackground();
UnownedPtr<CFGAS_GEGraphics> m_pGraphics;
- UnownedPtr<CFGAS_GEPath> m_pPath;
+ UnownedPtr<const CFGAS_GEPath> m_pPath;
};
inline CFWL_ThemeBackground::CFWL_ThemeBackground() = default;
diff --git a/xfa/fwl/cfwl_themepart.h b/xfa/fwl/cfwl_themepart.h
index 56ad8c8..73d10a9 100644
--- a/xfa/fwl/cfwl_themepart.h
+++ b/xfa/fwl/cfwl_themepart.h
@@ -85,7 +85,7 @@
CFX_Matrix m_matrix;
CFX_RectF m_PartRect;
UnownedPtr<CFWL_Widget> m_pWidget;
- UnownedPtr<CFX_RectF> m_pRtData;
+ UnownedPtr<const CFX_RectF> m_pRtData;
uint32_t m_dwStates = CFWL_PartState_Normal;
CFWL_Part m_iPart = CFWL_Part::None;
bool m_bMaximize = false;
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 5b09f4d..bad44e0 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -50,7 +50,7 @@
}
CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CFX_XMLDocument> doc,
- CFX_XMLElement* locale)
+ const CFX_XMLElement* locale)
: xml_doc_(std::move(doc)), locale_(locale) {
DCHECK(xml_doc_);
DCHECK(locale_);
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h
index 3d48aaf..5bc41cf 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.h
+++ b/xfa/fxfa/parser/cxfa_xmllocale.h
@@ -46,7 +46,8 @@
WideString GetNumPattern(NumSubcategory eType) const override;
private:
- CXFA_XMLLocale(std::unique_ptr<CFX_XMLDocument> root, CFX_XMLElement* locale);
+ CXFA_XMLLocale(std::unique_ptr<CFX_XMLDocument> root,
+ const CFX_XMLElement* locale);
WideString GetPattern(CFX_XMLElement* pElement,
WideStringView bsTag,
@@ -56,7 +57,7 @@
bool bAbbr) const;
std::unique_ptr<CFX_XMLDocument> xml_doc_;
- UnownedPtr<CFX_XMLElement> locale_;
+ UnownedPtr<const CFX_XMLElement> locale_;
};
#endif // XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_