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

Unified Diff: Source/platform/fonts/opentype/OpenTypeSanitizer.h

Issue 983973004: Provide user friendly messages for OTS parsing of fonts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fixes Created 5 years, 7 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
Index: Source/platform/fonts/opentype/OpenTypeSanitizer.h
diff --git a/Source/platform/fonts/opentype/OpenTypeSanitizer.h b/Source/platform/fonts/opentype/OpenTypeSanitizer.h
index 460dd0262ee3a89e3ce70e8ffb96b7c2b3698e91..ff8d05d3c6d0b7ed2d26ad74347dae7223397efa 100644
--- a/Source/platform/fonts/opentype/OpenTypeSanitizer.h
+++ b/Source/platform/fonts/opentype/OpenTypeSanitizer.h
@@ -33,6 +33,7 @@
#include "opentype-sanitiser.h"
#include "wtf/Forward.h"
+#include "wtf/text/WTFString.h"
namespace blink {
@@ -42,42 +43,38 @@ class OpenTypeSanitizer {
public:
explicit OpenTypeSanitizer(SharedBuffer* buffer)
: m_buffer(buffer)
+ , m_otsErrorString("")
{
}
PassRefPtr<SharedBuffer> sanitize();
static bool supportsFormat(const String&);
+ String getErrorString() const { return static_cast<String>(m_otsErrorString); }
+
+ void setErrorString(const String& errorString) { m_otsErrorString = errorString; }
+
+ bool isParsingError() const { return m_parsingError; }
+ void setParsingError(bool parsingError) { m_parsingError = parsingError; }
private:
SharedBuffer* const m_buffer;
+ String m_otsErrorString;
+ bool m_parsingError;
jungshik at Google 2015/05/15 19:17:20 Do you need |m_parsingError|? Nobody uses it other
h.joshi 2015/05/18 05:58:28 Method "setParsingError" was not called at right p
};
class BlinkOTSContext: public ots::OTSContext {
public:
- // TODO: Implement "Message" to support user friendly messages
- virtual ots::TableAction GetTableAction(uint32_t tag)
+ BlinkOTSContext()
+ : m_errorString("")
{
-#define TABLE_TAG(c1, c2, c3, c4) ((uint32_t)((((uint8_t)(c1)) << 24) | (((uint8_t)(c2)) << 16) | (((uint8_t)(c3)) << 8) | ((uint8_t)(c4))))
-
- const uint32_t cbdtTag = TABLE_TAG('C', 'B', 'D', 'T');
- const uint32_t cblcTag = TABLE_TAG('C', 'B', 'L', 'C');
- const uint32_t colrTag = TABLE_TAG('C', 'O', 'L', 'R');
- const uint32_t cpalTag = TABLE_TAG('C', 'P', 'A', 'L');
-
- switch (tag) {
- // Google Color Emoji Tables
- case cbdtTag:
- case cblcTag:
- // Windows Color Emoji Tables
- case colrTag:
- case cpalTag:
- return ots::TABLE_ACTION_PASSTHRU;
- default:
- return ots::TABLE_ACTION_DEFAULT;
- }
-#undef TABLE_TAG
}
+
+ virtual void Message(int level, const char *format, ...);
+ virtual ots::TableAction GetTableAction(uint32_t tag);
+ String getErrorString() const { return static_cast<String>(m_errorString); }
+private:
+ String m_errorString;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698