Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2012 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef SkSFNTHeader_DEFINED |
michael@0 | 9 | #define SkSFNTHeader_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkEndian.h" |
michael@0 | 12 | #include "SkOTTableTypes.h" |
michael@0 | 13 | |
michael@0 | 14 | //All SK_SFNT_ prefixed types should be considered as big endian. |
michael@0 | 15 | typedef uint16_t SK_SFNT_USHORT; |
michael@0 | 16 | typedef uint32_t SK_SFNT_ULONG; |
michael@0 | 17 | |
michael@0 | 18 | #pragma pack(push, 1) |
michael@0 | 19 | |
michael@0 | 20 | struct SkSFNTHeader { |
michael@0 | 21 | SK_SFNT_ULONG fontType; |
michael@0 | 22 | struct fontType_WindowsTrueType { |
michael@0 | 23 | static const SK_OT_CHAR TAG0 = 0; |
michael@0 | 24 | static const SK_OT_CHAR TAG1 = 1; |
michael@0 | 25 | static const SK_OT_CHAR TAG2 = 0; |
michael@0 | 26 | static const SK_OT_CHAR TAG3 = 0; |
michael@0 | 27 | static const SK_OT_ULONG TAG = SkOTTableTAG<fontType_WindowsTrueType>::value; |
michael@0 | 28 | }; |
michael@0 | 29 | struct fontType_MacTrueType { |
michael@0 | 30 | static const SK_OT_CHAR TAG0 = 't'; |
michael@0 | 31 | static const SK_OT_CHAR TAG1 = 'r'; |
michael@0 | 32 | static const SK_OT_CHAR TAG2 = 'u'; |
michael@0 | 33 | static const SK_OT_CHAR TAG3 = 'e'; |
michael@0 | 34 | static const SK_OT_ULONG TAG = SkOTTableTAG<fontType_MacTrueType>::value; |
michael@0 | 35 | }; |
michael@0 | 36 | struct fontType_PostScript { |
michael@0 | 37 | static const SK_OT_CHAR TAG0 = 't'; |
michael@0 | 38 | static const SK_OT_CHAR TAG1 = 'y'; |
michael@0 | 39 | static const SK_OT_CHAR TAG2 = 'p'; |
michael@0 | 40 | static const SK_OT_CHAR TAG3 = '1'; |
michael@0 | 41 | static const SK_OT_ULONG TAG = SkOTTableTAG<fontType_PostScript>::value; |
michael@0 | 42 | }; |
michael@0 | 43 | struct fontType_OpenTypeCFF { |
michael@0 | 44 | static const SK_OT_CHAR TAG0 = 'O'; |
michael@0 | 45 | static const SK_OT_CHAR TAG1 = 'T'; |
michael@0 | 46 | static const SK_OT_CHAR TAG2 = 'T'; |
michael@0 | 47 | static const SK_OT_CHAR TAG3 = 'O'; |
michael@0 | 48 | static const SK_OT_ULONG TAG = SkOTTableTAG<fontType_OpenTypeCFF>::value; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | SK_SFNT_USHORT numTables; |
michael@0 | 52 | SK_SFNT_USHORT searchRange; |
michael@0 | 53 | SK_SFNT_USHORT entrySelector; |
michael@0 | 54 | SK_SFNT_USHORT rangeShift; |
michael@0 | 55 | |
michael@0 | 56 | struct TableDirectoryEntry { |
michael@0 | 57 | SK_SFNT_ULONG tag; |
michael@0 | 58 | SK_SFNT_ULONG checksum; |
michael@0 | 59 | SK_SFNT_ULONG offset; //From beginning of header. |
michael@0 | 60 | SK_SFNT_ULONG logicalLength; |
michael@0 | 61 | }; //tableDirectoryEntries[numTables] |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | #pragma pack(pop) |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | SK_COMPILE_ASSERT(sizeof(SkSFNTHeader) == 12, sizeof_SkSFNTHeader_not_12); |
michael@0 | 68 | SK_COMPILE_ASSERT(sizeof(SkSFNTHeader::TableDirectoryEntry) == 16, sizeof_SkSFNTHeader_TableDirectoryEntry_not_16); |
michael@0 | 69 | |
michael@0 | 70 | #endif |