xfa_fwladapter.cpp revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
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_Matrix mt;
34  pFFWidget->GetRotateMatrix(mt);
35  CFX_RectF rtRotateAnchor(rtAnchor);
36  mt.TransformRect(rtRotateAnchor);
37  pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos(
38      pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup);
39  return true;
40}
41