[pdf] Properly handle drawing not on a page

Initially motivated by the drawing of Type3 glyphs into the PDF
document, which normally happens after the last page is ended and the
document is being finished. In order to properly target bookmarks it is
necessary to keep track of where marks (drawings) are made, which is a
position on a page. However, there may be marks (like those of a Type3
font) which are not bound with or drawn to any particular page. When
these are emitted there is no current page and attempting to access the
current page attributes currently results in a crash. This can also
happen if a user draws an attribute or tags a structure element node
while there is no currently active page.

The SkPDFDocument already abstracts the currently active page and any
marks made to it. Update this abstraction to handle the cases where
there is no currently active page. Also add a portable test by making
the test Jupiter glyph somewhat transparent to force a layer.

Bug: chromium:1523260
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/807817
Reverted-on: https://skia-review.googlesource.com/c/skia/+/808498
Change-Id: I4bb74ea3a023ea57f82ec6e1115ae33e1085a9f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/808660
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
4 files changed