Remove deprecated fType field in StructureElementNode.
It was added for Chromium, and Chromium has switched to using fTypeString instead. Change-Id: I8cd8ae00b0c3abf3691ce14837afbe3be939538e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316209 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
21f7a9a757
commit
065c5d9408
@ -23,60 +23,6 @@ class SkPDFTagTree;
|
||||
|
||||
namespace SkPDF {
|
||||
|
||||
/** Table 333 in PDF 32000-1:2008 §14.8.4.2
|
||||
*/
|
||||
enum class DocumentStructureType {
|
||||
kDocument, //!< Document
|
||||
kPart, //!< Part
|
||||
kArt, //!< Article
|
||||
kSect, //!< Section
|
||||
kDiv, //!< Division
|
||||
kBlockQuote, //!< Block quotation
|
||||
kCaption, //!< Caption
|
||||
kTOC, //!< Table of Contents
|
||||
kTOCI, //!< Table of Contents Item
|
||||
kIndex, //!< Index
|
||||
kNonStruct, //!< Nonstructural element
|
||||
kPrivate, //!< Private element
|
||||
kH, //!< Heading
|
||||
kH1, //!< Heading level 1
|
||||
kH2, //!< Heading level 2
|
||||
kH3, //!< Heading level 3
|
||||
kH4, //!< Heading level 4
|
||||
kH5, //!< Heading level 5
|
||||
kH6, //!< Heading level 6
|
||||
kP, //!< Paragraph
|
||||
kL, //!< List
|
||||
kLI, //!< List item
|
||||
kLbl, //!< List item label
|
||||
kLBody, //!< List item body
|
||||
kTable, //!< Table
|
||||
kTR, //!< Table row
|
||||
kTH, //!< Table header cell
|
||||
kTD, //!< Table data cell
|
||||
kTHead, //!< Table header row group
|
||||
kTBody, //!< Table body row group
|
||||
kTFoot, //!< table footer row group
|
||||
kSpan, //!< Span
|
||||
kQuote, //!< Quotation
|
||||
kNote, //!< Note
|
||||
kReference, //!< Reference
|
||||
kBibEntry, //!< Bibliography entry
|
||||
kCode, //!< Code
|
||||
kLink, //!< Link
|
||||
kAnnot, //!< Annotation
|
||||
kRuby, //!< Ruby annotation
|
||||
kRB, //!< Ruby base text
|
||||
kRT, //!< Ruby annotation text
|
||||
kRP, //!< Ruby punctuation
|
||||
kWarichu, //!< Warichu annotation
|
||||
kWT, //!< Warichu text
|
||||
kWP, //!< Warichu punctuation
|
||||
kFigure, //!< Figure
|
||||
kFormula, //!< Formula
|
||||
kForm, //!< Form control (not like an HTML FORM element)
|
||||
};
|
||||
|
||||
/** Attributes for nodes in the PDF tree. */
|
||||
class SK_API AttributeList : SkNoncopyable {
|
||||
public:
|
||||
@ -120,9 +66,6 @@ struct StructureElementNode {
|
||||
AttributeList fAttributes;
|
||||
SkString fAlt;
|
||||
SkString fLang;
|
||||
|
||||
// Deprecated. Use fTypeString instead.
|
||||
DocumentStructureType fType = DocumentStructureType::kNonStruct;
|
||||
};
|
||||
|
||||
/** Optional metadata to be passed into the PDF factory function.
|
||||
|
@ -8,64 +8,6 @@
|
||||
#include "src/pdf/SkPDFDocumentPriv.h"
|
||||
#include "src/pdf/SkPDFTag.h"
|
||||
|
||||
// Table 333 in PDF 32000-1:2008
|
||||
static const char* tag_name_from_type(SkPDF::DocumentStructureType type) {
|
||||
switch (type) {
|
||||
#define M(X) case SkPDF::DocumentStructureType::k ## X: return #X
|
||||
M(Document);
|
||||
M(Part);
|
||||
M(Art);
|
||||
M(Sect);
|
||||
M(Div);
|
||||
M(BlockQuote);
|
||||
M(Caption);
|
||||
M(TOC);
|
||||
M(TOCI);
|
||||
M(Index);
|
||||
M(NonStruct);
|
||||
M(Private);
|
||||
M(H);
|
||||
M(H1);
|
||||
M(H2);
|
||||
M(H3);
|
||||
M(H4);
|
||||
M(H5);
|
||||
M(H6);
|
||||
M(P);
|
||||
M(L);
|
||||
M(LI);
|
||||
M(Lbl);
|
||||
M(LBody);
|
||||
M(Table);
|
||||
M(TR);
|
||||
M(TH);
|
||||
M(TD);
|
||||
M(THead);
|
||||
M(TBody);
|
||||
M(TFoot);
|
||||
M(Span);
|
||||
M(Quote);
|
||||
M(Note);
|
||||
M(Reference);
|
||||
M(BibEntry);
|
||||
M(Code);
|
||||
M(Link);
|
||||
M(Annot);
|
||||
M(Ruby);
|
||||
M(RB);
|
||||
M(RT);
|
||||
M(RP);
|
||||
M(Warichu);
|
||||
M(WT);
|
||||
M(WP);
|
||||
M(Figure);
|
||||
M(Formula);
|
||||
M(Form);
|
||||
#undef M
|
||||
}
|
||||
SK_ABORT("bad tag");
|
||||
}
|
||||
|
||||
// The struct parent tree consists of one entry per page, followed by
|
||||
// entries for individual struct tree nodes corresponding to
|
||||
// annotations. Each entry is a key/value pair with an integer key
|
||||
@ -98,7 +40,6 @@ struct SkPDFTagNode {
|
||||
};
|
||||
SkTArray<MarkedContentInfo> fMarkedContent;
|
||||
int fNodeId;
|
||||
SkPDF::DocumentStructureType fType;
|
||||
SkString fTypeString;
|
||||
SkString fAlt;
|
||||
SkString fLang;
|
||||
@ -224,7 +165,6 @@ void SkPDFTagTree::Copy(SkPDF::StructureElementNode& node,
|
||||
nodeMap->set(nodeId, dst);
|
||||
}
|
||||
dst->fNodeId = node.fNodeId;
|
||||
dst->fType = node.fType;
|
||||
dst->fTypeString = node.fTypeString;
|
||||
dst->fAlt = node.fAlt;
|
||||
dst->fLang = node.fLang;
|
||||
@ -334,11 +274,7 @@ SkPDFIndirectReference SkPDFTagTree::PrepareTagTreeToEmit(SkPDFIndirectReference
|
||||
}
|
||||
node->fRef = ref;
|
||||
SkPDFDict dict("StructElem");
|
||||
if (!node->fTypeString.isEmpty()) {
|
||||
dict.insertName("S", node->fTypeString.c_str());
|
||||
} else {
|
||||
dict.insertName("S", tag_name_from_type(node->fType));
|
||||
}
|
||||
dict.insertName("S", node->fTypeString.isEmpty() ? "NonStruct" : node->fTypeString.c_str());
|
||||
if (!node->fAlt.isEmpty()) {
|
||||
dict.insertString("Alt", node->fAlt);
|
||||
}
|
||||
|
@ -38,49 +38,49 @@ DEF_TEST(SkPDF_tagged_doc, r) {
|
||||
// The document tag.
|
||||
auto root = std::make_unique<PDFTag>();
|
||||
root->fNodeId = 1;
|
||||
root->fType = SkPDF::DocumentStructureType::kDocument;
|
||||
root->fTypeString = "Document";
|
||||
|
||||
// Heading.
|
||||
auto h1 = std::make_unique<PDFTag>();
|
||||
h1->fNodeId = 2;
|
||||
h1->fType = SkPDF::DocumentStructureType::kH1;
|
||||
h1->fTypeString = "H1";
|
||||
root->fChildVector.push_back(std::move(h1));
|
||||
|
||||
// Initial paragraph.
|
||||
auto p = std::make_unique<PDFTag>();
|
||||
p->fNodeId = 3;
|
||||
p->fType = SkPDF::DocumentStructureType::kP;
|
||||
p->fTypeString = "P";
|
||||
root->fChildVector.push_back(std::move(p));
|
||||
|
||||
// Hidden div. This is never referenced by marked content
|
||||
// so it should not appear in the resulting PDF.
|
||||
auto div = std::make_unique<PDFTag>();
|
||||
div->fNodeId = 4;
|
||||
div->fType = SkPDF::DocumentStructureType::kDiv;
|
||||
div->fTypeString = "Div";
|
||||
root->fChildVector.push_back(std::move(div));
|
||||
|
||||
// A bulleted list of two items.
|
||||
auto l = std::make_unique<PDFTag>();
|
||||
l->fNodeId = 5;
|
||||
l->fType = SkPDF::DocumentStructureType::kL;
|
||||
l->fTypeString = "L";
|
||||
|
||||
auto lm1 = std::make_unique<PDFTag>();
|
||||
lm1->fNodeId = 6;
|
||||
lm1->fType = SkPDF::DocumentStructureType::kLbl;
|
||||
lm1->fTypeString = "Lbl";
|
||||
l->fChildVector.push_back(std::move(lm1));
|
||||
|
||||
auto li1 = std::make_unique<PDFTag>();
|
||||
li1->fNodeId = 7;
|
||||
li1->fType = SkPDF::DocumentStructureType::kLI;
|
||||
li1->fTypeString = "LI";
|
||||
l->fChildVector.push_back(std::move(li1));
|
||||
|
||||
auto lm2 = std::make_unique<PDFTag>();
|
||||
lm2->fNodeId = 8;
|
||||
lm2->fType = SkPDF::DocumentStructureType::kLbl;
|
||||
lm2->fTypeString = "Lbl";
|
||||
l->fChildVector.push_back(std::move(lm2));
|
||||
auto li2 = std::make_unique<PDFTag>();
|
||||
li2->fNodeId = 9;
|
||||
li2->fType = SkPDF::DocumentStructureType::kLI;
|
||||
li2->fTypeString = "LI";
|
||||
l->fChildVector.push_back(std::move(li2));
|
||||
|
||||
root->fChildVector.push_back(std::move(l));
|
||||
@ -88,13 +88,13 @@ DEF_TEST(SkPDF_tagged_doc, r) {
|
||||
// Paragraph spanning two pages.
|
||||
auto p2 = std::make_unique<PDFTag>();
|
||||
p2->fNodeId = 10;
|
||||
p2->fType = SkPDF::DocumentStructureType::kP;
|
||||
p2->fTypeString = "P";
|
||||
root->fChildVector.push_back(std::move(p2));
|
||||
|
||||
// Image with alt text.
|
||||
auto img = std::make_unique<PDFTag>();
|
||||
img->fNodeId = 11;
|
||||
img->fType = SkPDF::DocumentStructureType::kFigure;
|
||||
img->fTypeString = "Figure";
|
||||
img->fAlt = "Red box";
|
||||
root->fChildVector.push_back(std::move(img));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user