1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
8 
9 #include "xfa/fxfa/cxfa_ffdoc.h"
10 #include "xfa/fxfa/cxfa_fffield.h"
11 
CXFA_FWLAdapterWidgetMgr()12 CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {}
13 
~CXFA_FWLAdapterWidgetMgr()14 CXFA_FWLAdapterWidgetMgr::~CXFA_FWLAdapterWidgetMgr() {}
15 
RepaintWidget(CFWL_Widget * pWidget)16 void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) {
17   if (!pWidget)
18     return;
19 
20   auto* pFFWidget = static_cast<CXFA_FFWidget*>(pWidget->GetAdapterIface());
21   if (!pFFWidget)
22     return;
23 
24   pFFWidget->InvalidateRect();
25 }
26 
GetPopupPos(CFWL_Widget * pWidget,float fMinHeight,float fMaxHeight,const CFX_RectF & rtAnchor,CFX_RectF * pPopupRect)27 bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
28                                            float fMinHeight,
29                                            float fMaxHeight,
30                                            const CFX_RectF& rtAnchor,
31                                            CFX_RectF* pPopupRect) {
32   auto* pFFWidget = static_cast<CXFA_FFWidget*>(pWidget->GetAdapterIface());
33   CFX_RectF rtRotateAnchor =
34       pFFWidget->GetRotateMatrix().TransformRect(rtAnchor);
35   pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos(
36       pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, pPopupRect);
37   return true;
38 }
39