| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/cpdfsdk_baannothandler.h" | 7 #include "fpdfsdk/cpdfsdk_baannothandler.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 21 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" |
| 22 #endif // PDF_ENABLE_XFA | 22 #endif // PDF_ENABLE_XFA |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 void UpdateAnnotRects(CPDFSDK_PageView* pPageView, CPDFSDK_BAAnnot* pBAAnnot) { | 26 void UpdateAnnotRects(CPDFSDK_PageView* pPageView, CPDFSDK_BAAnnot* pBAAnnot) { |
| 27 std::vector<CFX_FloatRect> rects; | 27 std::vector<CFX_FloatRect> rects; |
| 28 rects.push_back(pBAAnnot->GetRect()); | 28 rects.push_back(pBAAnnot->GetRect()); |
| 29 if (CPDF_Annot* pPopupAnnot = pBAAnnot->GetPDFPopupAnnot()) | 29 if (CPDF_Annot* pPopupAnnot = pBAAnnot->GetPDFPopupAnnot()) |
| 30 rects.push_back(pPopupAnnot->GetRect()); | 30 rects.push_back(pPopupAnnot->GetRect()); |
| 31 |
| 32 // Make the rects round up to avoid https://crbug.com/662804 |
| 33 for (CFX_FloatRect& rect : rects) |
| 34 rect.Inflate(1, 1); |
| 35 |
| 31 pPageView->UpdateRects(rects); | 36 pPageView->UpdateRects(rects); |
| 32 } | 37 } |
| 33 | 38 |
| 34 } // namespace | 39 } // namespace |
| 35 | 40 |
| 36 CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {} | 41 CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {} |
| 37 | 42 |
| 38 CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {} | 43 CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {} |
| 39 | 44 |
| 40 FX_BOOL CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 45 FX_BOOL CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 211 |
| 207 FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 212 FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 208 CPDFSDK_Annot* pAnnot, | 213 CPDFSDK_Annot* pAnnot, |
| 209 const CFX_FloatPoint& point) { | 214 const CFX_FloatPoint& point) { |
| 210 ASSERT(pPageView); | 215 ASSERT(pPageView); |
| 211 ASSERT(pAnnot); | 216 ASSERT(pAnnot); |
| 212 | 217 |
| 213 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 218 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
| 214 return rect.Contains(point.x, point.y); | 219 return rect.Contains(point.x, point.y); |
| 215 } | 220 } |
| OLD | NEW |