summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp54
-rw-r--r--xfa/src/fwl/src/core/include/fwl_widgetimp.h2
2 files changed, 4 insertions, 52 deletions
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 6d37e73689..1e52e04281 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -649,58 +649,12 @@ IFWL_ThemeProvider* CFWL_WidgetImp::GetAvailableTheme() {
}
CFWL_WidgetImp* CFWL_WidgetImp::GetRootOuter() {
IFWL_Widget* pRet = m_pOuter;
- IFWL_Widget* pOuter = pRet;
- while (pOuter) {
+ if (!pRet)
+ return nullptr;
+ while (IFWL_Widget* pOuter = pRet->GetOuter()) {
pRet = pOuter;
- pOuter = pOuter->GetOuter();
}
- return (CFWL_WidgetImp*)pRet;
-}
-CFWL_WidgetImp* CFWL_WidgetImp::GetSameAncestor(CFWL_WidgetImp* pWidget) {
- CFX_PtrArray arr1, arr2;
- CFWL_WidgetImp* pAncestor = pWidget;
- FWL_WGTRELATION relation;
- do {
- arr1.Add(pAncestor);
- relation =
- pAncestor->IsPopup() ? FWL_WGTRELATION_Owner : FWL_WGTRELATION_Parent;
- } while ((pAncestor = (CFWL_WidgetImp*)m_pWidgetMgr->GetWidget(
- pAncestor->m_pInterface, relation)) != NULL);
- pAncestor = this;
- do {
- arr2.Add(pAncestor);
- relation =
- pAncestor->IsPopup() ? FWL_WGTRELATION_Owner : FWL_WGTRELATION_Parent;
- } while ((pAncestor = (CFWL_WidgetImp*)m_pWidgetMgr->GetWidget(
- pAncestor->m_pInterface, relation)) != NULL);
- for (int32_t i = 0; i < arr1.GetSize(); i++) {
- void* pVoid = arr1[i];
- if (arr2.Find(pVoid) < 0) {
- continue;
- } else {
- return (CFWL_WidgetImp*)pVoid;
- }
- }
- return NULL;
-}
-CFX_SizeF CFWL_WidgetImp::GetOffsetFromAncestor(CFWL_WidgetImp* pAncestor) {
- CFX_SizeF szRet;
- szRet.Set(0, 0);
- if (pAncestor == this) {
- return szRet;
- }
- CFWL_WidgetImp* pWidget = this;
- do {
- CFX_RectF rect;
- pWidget->GetWidgetRect(rect);
- szRet.x += rect.left;
- szRet.y += rect.top;
- FWL_WGTRELATION relation =
- pWidget->IsPopup() ? FWL_WGTRELATION_Owner : FWL_WGTRELATION_Parent;
- pWidget = (CFWL_WidgetImp*)m_pWidgetMgr->GetWidget((IFWL_Widget*)pWidget,
- relation);
- } while (pWidget && pWidget != pAncestor);
- return szRet;
+ return static_cast<CFWL_WidgetImp*>(pRet->GetImpl());
}
FX_BOOL CFWL_WidgetImp::TransformToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
if (!m_pOuter)
diff --git a/xfa/src/fwl/src/core/include/fwl_widgetimp.h b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
index efc7883eca..5a8b79f0f9 100644
--- a/xfa/src/fwl/src/core/include/fwl_widgetimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
@@ -89,8 +89,6 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
void* GetThemeCapacity(FX_DWORD dwCapacity);
IFWL_ThemeProvider* GetAvailableTheme();
CFWL_WidgetImp* GetRootOuter();
- CFWL_WidgetImp* GetSameAncestor(CFWL_WidgetImp* pWidget);
- CFX_SizeF GetOffsetFromAncestor(CFWL_WidgetImp* pAncestor);
FX_BOOL TransformToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
FX_BOOL TransformFromOuter(FX_FLOAT& fx, FX_FLOAT& fy);
CFX_SizeF CalcTextSize(const CFX_WideString& wsText,