Avoid RetainPtr<Retainable>::As<CFX_TextUserData>() calls. CFX_Char::m_pUserData always holds only one type of object, so specify it directly and avoid casting via As<>() Change-Id: Ifd193d94c3fb68ef350a7735d7ecd43eb7f3e64e Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62770 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/layout/cfx_char.h b/xfa/fgas/layout/cfx_char.h index ffd80ad..c4bafcc 100644 --- a/xfa/fgas/layout/cfx_char.h +++ b/xfa/fgas/layout/cfx_char.h
@@ -13,6 +13,7 @@ #include "core/fxcrt/fx_unicode.h" #include "core/fxcrt/retain_ptr.h" +#include "xfa/fgas/layout/cfx_textuserdata.h" #include "xfa/fgas/layout/fx_linebreak.h" enum class CFX_BreakType : uint8_t { None = 0, Piece, Line, Paragraph, Page }; @@ -44,7 +45,7 @@ uint16_t m_iBidiOrder = 0; int32_t m_iFontSize = 0; uint32_t m_dwIdentity = 0; - RetainPtr<Retainable> m_pUserData; + RetainPtr<CFX_TextUserData> m_pUserData; private: uint16_t m_wCharCode;
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index 72191ce..87740d5 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -395,7 +395,7 @@ tp.m_iVerticalScale = pTC->vertical_scale(); dwIdentity = pTC->m_dwIdentity; tp.m_dwIdentity = dwIdentity; - tp.m_pUserData = pTC->m_pUserData.As<CFX_TextUserData>(); + tp.m_pUserData = pTC->m_pUserData; j = i; bNew = false; } @@ -468,7 +468,7 @@ tp.m_iVerticalScale = pTC->vertical_scale(); dwIdentity = pTC->m_dwIdentity; tp.m_dwIdentity = dwIdentity; - tp.m_pUserData = pTC->m_pUserData.As<CFX_TextUserData>(); + tp.m_pUserData = pTC->m_pUserData; tp.m_dwStatus = CFX_BreakType::Piece; ++i; } else if (iBidiLevel != pTC->m_iBidiLevel ||