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/app/xfa_fwladapter.h"
8
9#include "xfa/fxfa/app/xfa_fffield.h"
10#include "xfa/fxfa/xfa_ffdoc.h"
11
12CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {}
13
14CXFA_FWLAdapterWidgetMgr::~CXFA_FWLAdapterWidgetMgr() {}
15
16void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) {
17  if (!pWidget)
18    return;
19
20  CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
21  if (!pFFWidget)
22    return;
23
24  pFFWidget->AddInvalidateRect(nullptr);
25}
26
27bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
28                                           FX_FLOAT fMinHeight,
29                                           FX_FLOAT fMaxHeight,
30                                           const CFX_RectF& rtAnchor,
31                                           CFX_RectF& rtPopup) {
32  CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
33  CFX_RectF rtRotateAnchor(rtAnchor);
34  pFFWidget->GetRotateMatrix().TransformRect(rtRotateAnchor);
35  pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos(
36      pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup);
37  return true;
38}
39