| 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_context.h" | 21 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.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 bool CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 45 bool CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 195 |
| 191 bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 196 bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 192 CPDFSDK_Annot* pAnnot, | 197 CPDFSDK_Annot* pAnnot, |
| 193 const CFX_FloatPoint& point) { | 198 const CFX_FloatPoint& point) { |
| 194 ASSERT(pPageView); | 199 ASSERT(pPageView); |
| 195 ASSERT(pAnnot); | 200 ASSERT(pAnnot); |
| 196 | 201 |
| 197 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 202 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
| 198 return rect.Contains(point.x, point.y); | 203 return rect.Contains(point.x, point.y); |
| 199 } | 204 } |
| OLD | NEW |