Commit Graph

8 Commits

Author SHA1 Message Date
Dominic Mazzoni
2eb3c17ba3 Add appendNodeIdArray to avoid code duplication.
Add SkPDF::AttributeList::appendNodeIdArray so that clients
don't need to re-implement/duplicate NodeIdToString in order to
add attributes that express the relationship between nodes.

Follow-up to:
https://chromium-review.googlesource.com/c/chromium/src/+/2251058

This deletes appendNameArray and appendStringArray since there's
no immediate need for them, but we may add them back if needed.

Bug: chromium:607777
Change-Id: If9b1527f97c7b52bb1bdad3c0828067bb76f25f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297277
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-23 14:25:33 +00:00
Dominic Mazzoni
8c662a7d6e Get rid of deprecated API to add children to PDF tag nodes.
fChildren/fChildCount was replaced with fChildVector and Chromium
migrated to the new API a while back, it's now safe to remove the
older interface.

Bug: chromium:607777
Change-Id: I7311d3b51f1b71209dcc024ae51637536d560619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297260
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-18 13:57:23 +00:00
Dominic Mazzoni
127c607818 Add separate PDF tag attribute interfaces for names and strings
In PDF files, "names" and "strings" are not the same thing, but I was
conflating them. Separate out the interfaces for adding attributes to
PDF struct tree elements so there's a way to add either a name or a string,
and similarly for arrays of names or arrays of strings.

Fix the table test to correctly use a name for the "Scope" attribute
and an array of strings for the "Headers" attribute.

Bug: chromium:607777
Change-Id: Ib30bded2bbcf96e31ba6925fb062615558dea0db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296338
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2020-06-15 15:46:29 +00:00
Dominic Mazzoni
6ffabbb4c4 Simplify interface to StructureElementNode.
Use a std::vector of std::unique_ptr for the children, rather than an
error-prone raw pointer.

Use a string for the element type, rather than an enum.

In both cases, both the old and new format are supported and tested
within Skia until Chromium has migrated.

Also add support for Alt and Lang, which are like attributes
but go right on the structure node. There are only a small
handful of attributes that go on the structure node so this
seems like the simplest solution.

Bug: chromium:607777
Change-Id: I4f315685df35dd9dcd8e1bca6d275cbeb8f2c67a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271816
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
2020-02-20 21:16:48 +00:00
Robert Phillips
979b223056 Add private GrContext::compile API (take 2)
Currently this is only implemented for GL.

Bug: skia:9455
Change-Id: I851471d6334d6a38e6fde3a46f09b7dc0209fb78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272346
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-20 16:24:03 +00:00
Dominic Mazzoni
7dfb46e7f3 Re-land: Support adding attributes to PDF document structure nodes.
Originally landed: https://skia-review.googlesource.com/c/skia/+/268878
Reverted: https://skia-review.googlesource.com/c/skia/+/271858

The issue was with compilation when PDF support is disabled. See
the diff between patchsets 1 and 2.

This is an important part of writing a tagged PDF. Many of the nodes
in the document structure tree need additional attributes, just like
in HTML.

This change aims to add support for a few useful attributes, not to
be comprehensive.

Bug: chromium:1039816
Change-Id: I15f8b6c41d4fdaa4b6e21775ab6d26ec57eb0f5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271916
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-19 20:50:14 +00:00
Mike Reed
86b4388fdc Revert "Support adding attributes to PDF document structure nodes."
This reverts commit 80474156d1.

Reason for revert: breaking chrome roll

https://ci.chromium.org/p/chromium/builders/try/cast_shell_linux/533554

Original change's description:
> Support adding attributes to PDF document structure nodes.
> 
> This is an important part of writing a tagged PDF. Many of the nodes
> in the document structure tree need additional attributes, just like
> in HTML.
> 
> This change aims to add support for a few useful attributes, not to
> be comprehensive.
> 
> Bug: chromium:1039816
> 
> Change-Id: I64a6b36b0b4ec42fd27ae4ad702afce95c95af5d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268878
> Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Dominic Mazzoni <dmazzoni@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,reed@google.com,dmazzoni@chromium.org,dmazzoni@google.com

Change-Id: Iedd397303e870144e8d282db0cb81c535a783e8b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1039816
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271858
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-19 14:23:31 +00:00
Dominic Mazzoni
80474156d1 Support adding attributes to PDF document structure nodes.
This is an important part of writing a tagged PDF. Many of the nodes
in the document structure tree need additional attributes, just like
in HTML.

This change aims to add support for a few useful attributes, not to
be comprehensive.

Bug: chromium:1039816

Change-Id: I64a6b36b0b4ec42fd27ae4ad702afce95c95af5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268878
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-02-18 18:14:36 +00:00