Add pages object to XFA document catalog fragment.

Change-Id: Ia0ae3b3b150222a0ae3ee7996d4d8f9f223ea606
Reviewed-on: https://pdfium-review.googlesource.com/c/49791
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
index 3fc5deb..4414e53 100644
--- a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
+++ b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
@@ -103,6 +103,7 @@
 endobj
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in
index ba7d1cd..2d8a1cb 100644
--- a/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in
+++ b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../../xfa_catalog_1_0.fragment}}
 {{include ../../../xfa_object_2_0.fragment}}
 {{include ../../../xfa_preamble_3_0.fragment}}
 {{include ../../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -30,10 +27,9 @@
 </template>
 endstream
 endobj
-
 {{include ../../../xfa_locale_6_0.fragment}}
 {{include ../../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in
index 5fc93db..31a37ea 100644
--- a/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in
+++ b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../../xfa_catalog_1_0.fragment}}
 {{include ../../../xfa_object_2_0.fragment}}
 {{include ../../../xfa_preamble_3_0.fragment}}
 {{include ../../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -49,10 +46,9 @@
 </template>
 endstream
 endobj
-
 {{include ../../../xfa_locale_6_0.fragment}}
 {{include ../../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_bmp_image.in b/testing/resources/pixel/xfa_specific/xfa_bmp_image.in
index 3241242..9b444f1 100644
--- a/testing/resources/pixel/xfa_specific/xfa_bmp_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_bmp_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_gif_image.in b/testing/resources/pixel/xfa_specific/xfa_gif_image.in
index 847057b..2bf4f86 100644
--- a/testing/resources/pixel/xfa_specific/xfa_gif_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_gif_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_jpg_image.in b/testing/resources/pixel/xfa_specific/xfa_jpg_image.in
index 4f49636..72e54db 100644
--- a/testing/resources/pixel/xfa_specific/xfa_jpg_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_jpg_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_png_image.in b/testing/resources/pixel/xfa_specific/xfa_png_image.in
index 6772f1f..993a9af 100644
--- a/testing/resources/pixel/xfa_specific/xfa_png_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_png_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_rectangle_node.in b/testing/resources/pixel/xfa_specific/xfa_rectangle_node.in
index 347d4ae..8ee0496 100644
--- a/testing/resources/pixel/xfa_specific/xfa_rectangle_node.in
+++ b/testing/resources/pixel/xfa_specific/xfa_rectangle_node.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -35,10 +32,9 @@
 </template>
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_tiff_deflate_image.in b/testing/resources/pixel/xfa_specific/xfa_tiff_deflate_image.in
index 0927583..797f84c 100644
--- a/testing/resources/pixel/xfa_specific/xfa_tiff_deflate_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_tiff_deflate_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_tiff_image.in b/testing/resources/pixel/xfa_specific/xfa_tiff_image.in
index c94b041..0b316a9 100644
--- a/testing/resources/pixel/xfa_specific/xfa_tiff_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_tiff_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_tiff_lzw_image.in b/testing/resources/pixel/xfa_specific/xfa_tiff_lzw_image.in
index 85a8853..ab5779a 100644
--- a/testing/resources/pixel/xfa_specific/xfa_tiff_lzw_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_tiff_lzw_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/pixel/xfa_specific/xfa_tiff_packbits_image.in b/testing/resources/pixel/xfa_specific/xfa_tiff_packbits_image.in
index f496f1c..5fd86b5 100644
--- a/testing/resources/pixel/xfa_specific/xfa_tiff_packbits_image.in
+++ b/testing/resources/pixel/xfa_specific/xfa_tiff_packbits_image.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../../xfa_catalog_1_0.fragment}}
 {{include ../../xfa_object_2_0.fragment}}
 {{include ../../xfa_preamble_3_0.fragment}}
 {{include ../../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,13 +28,11 @@
     </subform>
   </subform>
 </template>
-
 endstream
 endobj
-
 {{include ../../xfa_locale_6_0.fragment}}
 {{include ../../xfa_postamble_7_0.fragment}}
-
+{{include ../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/xfa/xfa_combobox.in b/testing/resources/xfa/xfa_combobox.in
index 966c518..da86e23 100644
--- a/testing/resources/xfa/xfa_combobox.in
+++ b/testing/resources/xfa/xfa_combobox.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../xfa_catalog_1_0.fragment}}
 {{include ../xfa_object_2_0.fragment}}
 {{include ../xfa_preamble_3_0.fragment}}
 {{include ../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -34,10 +31,9 @@
 </template>
 endstream
 endobj
-
 {{include ../xfa_locale_6_0.fragment}}
 {{include ../xfa_postamble_7_0.fragment}}
-
+{{include ../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/xfa/xfa_date_time_edit.in b/testing/resources/xfa/xfa_date_time_edit.in
index deacc67..a61fc2c 100644
--- a/testing/resources/xfa/xfa_date_time_edit.in
+++ b/testing/resources/xfa/xfa_date_time_edit.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../xfa_catalog_1_0.fragment}}
 {{include ../xfa_object_2_0.fragment}}
 {{include ../xfa_preamble_3_0.fragment}}
 {{include ../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -29,10 +26,9 @@
 </template>
 endstream
 endobj
-
 {{include ../xfa_locale_6_0.fragment}}
 {{include ../xfa_postamble_7_0.fragment}}
-
+{{include ../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/xfa/xfa_image_edit.in b/testing/resources/xfa/xfa_image_edit.in
index cf67f23..a24c0ca 100644
--- a/testing/resources/xfa/xfa_image_edit.in
+++ b/testing/resources/xfa/xfa_image_edit.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../xfa_catalog_1_0.fragment}}
 {{include ../xfa_object_2_0.fragment}}
 {{include ../xfa_preamble_3_0.fragment}}
 {{include ../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -32,10 +29,9 @@
 </template>
 endstream
 endobj
-
 {{include ../xfa_locale_6_0.fragment}}
 {{include ../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/xfa/xfa_multiline_textfield.in b/testing/resources/xfa/xfa_multiline_textfield.in
index dec526b..796be52 100644
--- a/testing/resources/xfa/xfa_multiline_textfield.in
+++ b/testing/resources/xfa/xfa_multiline_textfield.in
@@ -1,12 +1,9 @@
 {{header}}
-
 {{include ../xfa_catalog_1_0.fragment}}
 {{include ../xfa_object_2_0.fragment}}
 {{include ../xfa_preamble_3_0.fragment}}
 {{include ../xfa_config_4_0.fragment}}
-
-{{object 5 0}}
-<<
+{{object 5 0}} <<
   {{streamlen}}
 >>
 stream
@@ -31,10 +28,9 @@
 </template>
 endstream
 endobj
-
 {{include ../xfa_locale_6_0.fragment}}
 {{include ../xfa_postamble_7_0.fragment}}
-
+{{include ../../../xfa_pages_8_0.fragment}}
 {{xref}}
 {{trailer}}
 {{startxref}}
diff --git a/testing/resources/xfa_catalog_1_0.fragment b/testing/resources/xfa_catalog_1_0.fragment
index 13f9ee5..4e3c83f 100644
--- a/testing/resources/xfa_catalog_1_0.fragment
+++ b/testing/resources/xfa_catalog_1_0.fragment
@@ -7,6 +7,7 @@
     >>
   >>
   /NeedsRendering true
+  /Pages [8 0 R]
   /Type /Catalog
 >>
 endobj
diff --git a/testing/resources/xfa_pages_8_0.fragment b/testing/resources/xfa_pages_8_0.fragment
new file mode 100644
index 0000000..ce089c4
--- /dev/null
+++ b/testing/resources/xfa_pages_8_0.fragment
@@ -0,0 +1,12 @@
+{{object 8 0}} <<
+  /Type /Pages
+  /Count 1
+  /Kids [9 0 R]
+>>
+endobj
+{{object 9 0}} <<
+  /Type /Page
+  /Parent 2 0 R
+  /MediaBox [0 0 612 792]
+>>
+endobj