Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: src/pdf/SkPDFMetadata.cpp

Issue 1864173004: SkPDF Fix PDF/A to be more valid (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFMetadata.cpp
diff --git a/src/pdf/SkPDFMetadata.cpp b/src/pdf/SkPDFMetadata.cpp
index 5a1d7aa406e6747aaebe903044f07791a8238e07..4ca1903d21b2a23fce8268b994b513044a30c7ec 100644
--- a/src/pdf/SkPDFMetadata.cpp
+++ b/src/pdf/SkPDFMetadata.cpp
@@ -263,7 +263,7 @@ const SkString escape_xml(const SkString& input,
// Validate that we haven't written outside of our string.
SkASSERT(out == &output.writable_str()[output.size()]);
*out = '\0';
- return std::move(output);
+ return output;
}
SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc,
@@ -285,7 +285,6 @@ SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc,
"<pdfaid:conformance>B</pdfaid:conformance>\n"
"%s" // ModifyDate
"%s" // CreateDate
- "%s" // MetadataDate
"%s" // xmp:CreatorTool
"<dc:format>application/pdf</dc:format>\n"
"%s" // dc:title
@@ -303,7 +302,6 @@ SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc,
SkString creationDate;
SkString modificationDate;
- SkString metadataDate;
if (fCreation) {
SkString tmp;
fCreation->toISO8601(&tmp);
@@ -318,25 +316,25 @@ SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc,
SkASSERT(0 == count_xml_escape_size(tmp));
modificationDate = sk_string_printf(
"<xmp:ModifyDate>%s</xmp:ModifyDate>\n", tmp.c_str());
- metadataDate = sk_string_printf(
- "<xmp:MetadataDate>%s</xmp:MetadataDate>\n", tmp.c_str());
}
-
- SkString title =
- escape_xml(get(fInfo, "Title"), "<dc:title><rdf:Alt><rdf:li>",
- "</rdf:li></rdf:Alt></dc:title>\n");
- SkString author =
- escape_xml(get(fInfo, "Author"), "<dc:creator><rdf:Bag><rdf:li>",
- "</rdf:li></rdf:Bag></dc:creator>\n");
+ SkString title = escape_xml(
+ get(fInfo, "Title"),
+ "<dc:title><rdf:Alt><rdf:li xml:lang=\"x-default\">",
+ "</rdf:li></rdf:Alt></dc:title>\n");
+ SkString author = escape_xml(
+ get(fInfo, "Author"), "<dc:creator><rdf:Bag><rdf:li>",
+ "</rdf:li></rdf:Bag></dc:creator>\n");
// TODO: in theory, XMP can support multiple authors. Split on a delimiter?
- SkString subject = escape_xml(get(fInfo, "Subject"),
- "<dc:description><rdf:Alt><rdf:li>",
- "</rdf:li></rdf:Alt></dc:description>\n");
- SkString keywords1 =
- escape_xml(get(fInfo, "Keywords"), "<dc:subject><rdf:Bag><rdf:li>",
- "</rdf:li></rdf:Bag></dc:subject>\n");
- SkString keywords2 = escape_xml(get(fInfo, "Keywords"), "<pdf:Keywords>",
- "</pdf:Keywords>\n");
+ SkString subject = escape_xml(
+ get(fInfo, "Subject"),
+ "<dc:description><rdf:Alt><rdf:li xml:lang=\"x-default\">",
+ "</rdf:li></rdf:Alt></dc:description>\n");
+ SkString keywords1 = escape_xml(
+ get(fInfo, "Keywords"), "<dc:subject><rdf:Bag><rdf:li>",
+ "</rdf:li></rdf:Bag></dc:subject>\n");
+ SkString keywords2 = escape_xml(
+ get(fInfo, "Keywords"), "<pdf:Keywords>",
+ "</pdf:Keywords>\n");
// TODO: in theory, keywords can be a list too.
SkString creator = escape_xml(get(fInfo, "Creator"), "<xmp:CreatorTool>",
@@ -347,7 +345,7 @@ SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc,
SkASSERT(0 == count_xml_escape_size(instanceID));
return new PDFXMLObject(sk_string_printf(
templateString, modificationDate.c_str(), creationDate.c_str(),
- metadataDate.c_str(), creator.c_str(), title.c_str(),
+ creator.c_str(), title.c_str(),
subject.c_str(), author.c_str(), keywords1.c_str(),
documentID.c_str(), instanceID.c_str(), keywords2.c_str()));
}
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698