summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-06-22 11:51:04 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-22 18:36:57 +0000
commit84d8eb9b6fdd2afd43f5970b3544d63aa990d30e (patch)
treebd3fa0035ada7a7578522ab7470ca3ff72aa10e5
parent7726a581626bbb72d6ab294ae1adbad4ca10dfb0 (diff)
downloadpdfium-84d8eb9b6fdd2afd43f5970b3544d63aa990d30e.tar.xz
Avoid regenerating appearance stream when already present.
Since cpdfsdk_widget.cpp already generates it, we can expect that FPDF_GenerateAP will not be called. That implementation does not work with widgets with a shared field. Bug: chromium:733528 Change-Id: Ia436b4e8bc87ca86b67a02cf7301ac2328339128 Reviewed-on: https://pdfium-review.googlesource.com/6752 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp2
-rw-r--r--testing/resources/pixel/bug_733528.in72
-rw-r--r--testing/resources/pixel/bug_733528_expected.pdf.0.pngbin0 -> 3492 bytes
-rw-r--r--testing/resources/pixel/bug_733528_expected_mac.pdf.0.pngbin0 -> 3349 bytes
4 files changed, 73 insertions, 1 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 1427c85616..1f94779c15 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -86,7 +86,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pAnnots->ConvertToIndirectObjectAt(i, m_pDocument);
m_AnnotList.push_back(pdfium::MakeUnique<CPDF_Annot>(pDict, m_pDocument));
if (bRegenerateAP && subtype == "Widget" &&
- CPDF_InterForm::IsUpdateAPEnabled()) {
+ CPDF_InterForm::IsUpdateAPEnabled() && !pDict->GetDictFor("AP")) {
FPDF_GenerateAP(m_pDocument, pDict);
}
}
diff --git a/testing/resources/pixel/bug_733528.in b/testing/resources/pixel/bug_733528.in
new file mode 100644
index 0000000000..3602c3f2b5
--- /dev/null
+++ b/testing/resources/pixel/bug_733528.in
@@ -0,0 +1,72 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /AcroForm <<
+ /Fields [ 4 0 R 9 0 R ]
+ /DR 5 0 R
+ /NeedAppearances true
+ >>
+>>
+endobj
+{{object 2 0}} <<
+ /Count 1
+ /Kids [ 3 0 R ]
+ /Type /Pages
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources 5 0 R
+ /MediaBox [ 0 0 300 200 ]
+ /Contents 8 0 R
+ /Annots [ 4 0 R 9 0 R ]
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Annot
+ /FT /Tx
+ /T (SharedField)
+ /DA (0 0 0 rg /F1 12 Tf)
+ /Rect [ 100 100 200 130 ]
+ /Subtype /Widget
+ /V (Hello, world)
+>>
+endobj
+{{object 5 0}} <<
+ /Font 6 0 R
+>>
+endobj
+{{object 6 0}} <<
+ /F1 7 0 R
+>>
+endobj
+{{object 7 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+{{object 8 0}} <<
+>>
+stream
+endstream
+endobj
+{{object 9 0}} <<
+ /Type /Annot
+ /FT /Tx
+ /T (SharedField)
+ /DA (0 0 0 rg /F1 12 Tf)
+ /Rect [ 100 40 200 70 ]
+ /Subtype /Widget
+ /V ()
+>>
+endobj
+{{xref}}
+trailer <<
+ /Root 1 0 R
+ /Size 10
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_733528_expected.pdf.0.png b/testing/resources/pixel/bug_733528_expected.pdf.0.png
new file mode 100644
index 0000000000..cdd39c1434
--- /dev/null
+++ b/testing/resources/pixel/bug_733528_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/bug_733528_expected_mac.pdf.0.png b/testing/resources/pixel/bug_733528_expected_mac.pdf.0.png
new file mode 100644
index 0000000000..f7c8302b1e
--- /dev/null
+++ b/testing/resources/pixel/bug_733528_expected_mac.pdf.0.png
Binary files differ