| 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 "core/fpdfdoc/include/cpdf_annotlist.h" | 7 #include "core/fpdfdoc/include/cpdf_annotlist.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 CPDF_Dictionary* pParentDict = pAnnot->GetAnnotDict(); | 23 CPDF_Dictionary* pParentDict = pAnnot->GetAnnotDict(); |
| 24 if (!pParentDict) | 24 if (!pParentDict) |
| 25 return std::unique_ptr<CPDF_Annot>(); | 25 return std::unique_ptr<CPDF_Annot>(); |
| 26 | 26 |
| 27 // TODO(jaepark): We shouldn't strip BOM for some strings and not for others. | 27 // TODO(jaepark): We shouldn't strip BOM for some strings and not for others. |
| 28 // See pdfium:593. | 28 // See pdfium:593. |
| 29 CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents"); | 29 CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents"); |
| 30 if (sContents.IsEmpty()) | 30 if (sContents.IsEmpty()) |
| 31 return std::unique_ptr<CPDF_Annot>(); | 31 return std::unique_ptr<CPDF_Annot>(); |
| 32 | 32 |
| 33 CPDF_Dictionary* pAnnotDict = new CPDF_Dictionary; | 33 CPDF_Dictionary* pAnnotDict = |
| 34 new CPDF_Dictionary(pDocument->GetByteStringPool()); |
| 34 pAnnotDict->SetNameFor("Type", "Annot"); | 35 pAnnotDict->SetNameFor("Type", "Annot"); |
| 35 pAnnotDict->SetNameFor("Subtype", "Popup"); | 36 pAnnotDict->SetNameFor("Subtype", "Popup"); |
| 36 pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T")); | 37 pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T")); |
| 37 pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode()); | 38 pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode()); |
| 38 | 39 |
| 39 CFX_FloatRect rect = pParentDict->GetRectFor("Rect"); | 40 CFX_FloatRect rect = pParentDict->GetRectFor("Rect"); |
| 40 rect.Normalize(); | 41 rect.Normalize(); |
| 41 CFX_FloatRect popupRect(0, 0, 200, 200); | 42 CFX_FloatRect popupRect(0, 0, 200, 200); |
| 42 popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); | 43 popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); |
| 43 | 44 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 CPDF_RenderContext* pContext, | 176 CPDF_RenderContext* pContext, |
| 176 FX_BOOL bPrinting, | 177 FX_BOOL bPrinting, |
| 177 CFX_Matrix* pMatrix, | 178 CFX_Matrix* pMatrix, |
| 178 FX_BOOL bShowWidget, | 179 FX_BOOL bShowWidget, |
| 179 CPDF_RenderOptions* pOptions) { | 180 CPDF_RenderOptions* pOptions) { |
| 180 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN | 181 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN |
| 181 : ANNOTFLAG_INVISIBLE; | 182 : ANNOTFLAG_INVISIBLE; |
| 182 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags, | 183 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags, |
| 183 pOptions, nullptr); | 184 pOptions, nullptr); |
| 184 } | 185 } |
| OLD | NEW |