1 // Copyright 2014 The PDFium Authors
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 "core/fxcrt/fx_coordinates.h"
10 #include "xfa/fxfa/cxfa_ffdoc.h"
11 #include "xfa/fxfa/cxfa_fffield.h"
12
13 CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() = default;
14
15 CXFA_FWLAdapterWidgetMgr::~CXFA_FWLAdapterWidgetMgr() = default;
16
Trace(cppgc::Visitor * visitor) const17 void CXFA_FWLAdapterWidgetMgr::Trace(cppgc::Visitor* visitor) const {}
18
RepaintWidget(CFWL_Widget * pWidget)19 void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) {
20 if (!pWidget)
21 return;
22
23 auto* pFFWidget = static_cast<CXFA_FFWidget*>(pWidget->GetAdapterIface());
24 if (!pFFWidget)
25 return;
26
27 pFFWidget->InvalidateRect();
28 }
29
GetPopupPos(CFWL_Widget * pWidget,float fMinHeight,float fMaxHeight,const CFX_RectF & rtAnchor,CFX_RectF * pPopupRect)30 bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
31 float fMinHeight,
32 float fMaxHeight,
33 const CFX_RectF& rtAnchor,
34 CFX_RectF* pPopupRect) {
35 auto* pFFWidget = static_cast<CXFA_FFWidget*>(pWidget->GetAdapterIface());
36 CFX_RectF rtRotateAnchor =
37 pFFWidget->GetRotateMatrix().TransformRect(rtAnchor);
38 pFFWidget->GetDoc()->GetPopupPos(pFFWidget, fMinHeight, fMaxHeight,
39 rtRotateAnchor, pPopupRect);
40 return true;
41 }
42