OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef OpenTypeSanitizer_h | 31 #ifndef OpenTypeSanitizer_h |
32 #define OpenTypeSanitizer_h | 32 #define OpenTypeSanitizer_h |
33 | 33 |
| 34 #include "opentype-sanitiser.h" |
34 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class SharedBuffer; | 39 class SharedBuffer; |
39 | 40 |
40 class OpenTypeSanitizer { | 41 class OpenTypeSanitizer { |
41 public: | 42 public: |
42 explicit OpenTypeSanitizer(SharedBuffer* buffer) | 43 explicit OpenTypeSanitizer(SharedBuffer* buffer) |
43 : m_buffer(buffer) | 44 : m_buffer(buffer) |
44 { | 45 { |
45 } | 46 } |
46 | 47 |
47 PassRefPtr<SharedBuffer> sanitize(); | 48 PassRefPtr<SharedBuffer> sanitize(); |
48 | 49 |
49 static bool supportsFormat(const String&); | 50 static bool supportsFormat(const String&); |
50 | 51 |
51 private: | 52 private: |
52 SharedBuffer* const m_buffer; | 53 SharedBuffer* const m_buffer; |
53 }; | 54 }; |
54 | 55 |
| 56 class BlinkOTSContext: public ots::OTSContext { |
| 57 public: |
| 58 // TODO: Implement "Message" to support user friendly messages |
| 59 virtual ots::TableAction GetTableAction(uint32_t tag) |
| 60 { |
| 61 #define TABLE_TAG(c1, c2, c3, c4) ((uint32_t)((((uint8_t)(c1)) << 24) | (((uint8
_t)(c2)) << 16) | (((uint8_t)(c3)) << 8) | ((uint8_t)(c4)))) |
| 62 |
| 63 const uint32_t cbdtTag = TABLE_TAG('C', 'B', 'D', 'T'); |
| 64 const uint32_t cblcTag = TABLE_TAG('C', 'B', 'L', 'C'); |
| 65 const uint32_t colrTag = TABLE_TAG('C', 'O', 'L', 'R'); |
| 66 const uint32_t cpalTag = TABLE_TAG('C', 'P', 'A', 'L'); |
| 67 |
| 68 switch (tag) { |
| 69 // Google Color Emoji Tables |
| 70 case cbdtTag: |
| 71 case cblcTag: |
| 72 // Windows Color Emoji Tables |
| 73 case colrTag: |
| 74 case cpalTag: |
| 75 return ots::TABLE_ACTION_PASSTHRU; |
| 76 default: |
| 77 return ots::TABLE_ACTION_DEFAULT; |
| 78 } |
| 79 #undef TABLE_TAG |
| 80 } |
| 81 }; |
| 82 |
55 } // namespace blink | 83 } // namespace blink |
56 | 84 |
57 #endif // OpenTypeSanitizer_h | 85 #endif // OpenTypeSanitizer_h |
OLD | NEW |