diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-11-25 10:54:46 +0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-11-25 10:54:46 +0800 |
commit | 696d9faba208b0233cdfe0a43f3c6e5c90935843 (patch) | |
tree | 5200be6f8e077896fe8a8b115e56747dfed7d2cf /xfa/src/fxfa | |
parent | d3116dc173ab3e798b056e008c0cb68f69acdca7 (diff) | |
download | pdfium-696d9faba208b0233cdfe0a43f3c6e5c90935843.tar.xz |
Refactor CXFA_FFPageView::GetWidgetByPos
BUG=pdfium:276
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1438333005 .
Diffstat (limited to 'xfa/src/fxfa')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffpageview.cpp | 18 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fftext.cpp | 5 |
2 files changed, 11 insertions, 12 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp index 68e4b6b505..c083c2b141 100644 --- a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp @@ -20,8 +20,7 @@ CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
: CXFA_ContainerLayoutItem(pPageArea),
m_pDocView(pDocView),
- m_bLoaded(FALSE) {
-}
+ m_bLoaded(FALSE) {}
CXFA_FFPageView::~CXFA_FFPageView() {}
IXFA_DocView* CXFA_FFPageView::GetDocView() {
return m_pDocView;
@@ -60,10 +59,11 @@ FX_BOOL CXFA_FFPageView::IsPageViewLoaded() { }
IXFA_Widget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) {
if (!m_bLoaded) {
- return NULL;
+ return nullptr;
}
IXFA_WidgetIterator* pIterator = CreateWidgetIterator();
- while (CXFA_FFWidget* pWidget = (CXFA_FFWidget*)pIterator->MoveToNext()) {
+ CXFA_FFWidget* pWidget = nullptr;
+ while (pWidget = static_cast<CXFA_FFWidget*>(pIterator->MoveToNext())) {
if (!(pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
continue;
}
@@ -72,17 +72,17 @@ IXFA_Widget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { if (type != XFA_ELEMENT_Field && type != XFA_ELEMENT_Draw) {
continue;
}
- FX_FLOAT fWidgetx = fx, fWidgety = fy;
+ FX_FLOAT fWidgetx = fx;
+ FX_FLOAT fWidgety = fy;
pWidget->Rotate2Normal(fWidgetx, fWidgety);
FX_DWORD dwFlag = pWidget->OnHitTest(fWidgetx, fWidgety);
if ((FWL_WGTHITTEST_Client == dwFlag ||
- FWL_WGTHITTEST_Transparent == dwFlag)) {
- pIterator->Release();
- return pWidget;
+ FWL_WGTHITTEST_HyperLink == dwFlag)) {
+ break;
}
}
pIterator->Release();
- return NULL;
+ return pWidget;
}
IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
FX_DWORD dwTraverseWay,
diff --git a/xfa/src/fxfa/src/app/xfa_fftext.cpp b/xfa/src/fxfa/src/app/xfa_fftext.cpp index e02b1f614f..15719190ca 100644 --- a/xfa/src/fxfa/src/app/xfa_fftext.cpp +++ b/xfa/src/fxfa/src/app/xfa_fftext.cpp @@ -143,11 +143,10 @@ FX_DWORD CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { if (!rtBox.Contains(fx, fy)) {
return FWL_WGTHITTEST_Unknown;
}
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (NULL == wsURLContent) {
+ if (!GetLinkURLAtPoint(fx, fy)) {
return FWL_WGTHITTEST_Unknown;
}
- return FWL_WGTHITTEST_Transparent;
+ return FWL_WGTHITTEST_HyperLink;
}
const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
|