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 SkOTTable_head_DEFINED |
michael@0 | 9 | #define SkOTTable_head_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkEndian.h" |
michael@0 | 12 | #include "SkOTTableTypes.h" |
michael@0 | 13 | #include "SkTypedEnum.h" |
michael@0 | 14 | |
michael@0 | 15 | #pragma pack(push, 1) |
michael@0 | 16 | |
michael@0 | 17 | struct SkOTTableHead { |
michael@0 | 18 | static const SK_OT_CHAR TAG0 = 'h'; |
michael@0 | 19 | static const SK_OT_CHAR TAG1 = 'e'; |
michael@0 | 20 | static const SK_OT_CHAR TAG2 = 'a'; |
michael@0 | 21 | static const SK_OT_CHAR TAG3 = 'd'; |
michael@0 | 22 | static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableHead>::value; |
michael@0 | 23 | |
michael@0 | 24 | SK_OT_Fixed version; |
michael@0 | 25 | static const SK_OT_Fixed version1 = SkTEndian_SwapBE32(0x00010000); |
michael@0 | 26 | SK_OT_Fixed fontRevision; |
michael@0 | 27 | static const uint32_t fontChecksum = 0xB1B0AFBA; //checksum of all TT fonts |
michael@0 | 28 | SK_OT_ULONG checksumAdjustment; |
michael@0 | 29 | SK_OT_ULONG magicNumber; |
michael@0 | 30 | static const SK_OT_ULONG magicNumberConst = SkTEndian_SwapBE32(0x5F0F3CF5); |
michael@0 | 31 | union Flags { |
michael@0 | 32 | struct Field { |
michael@0 | 33 | //8-15 |
michael@0 | 34 | SK_OT_BYTE_BITFIELD( |
michael@0 | 35 | GXMetamorphosis_Apple, |
michael@0 | 36 | HasStrongRTL_Apple, |
michael@0 | 37 | HasIndicStyleRearrangement, |
michael@0 | 38 | AgfaMicroTypeExpressProcessed, |
michael@0 | 39 | FontConverted, |
michael@0 | 40 | DesignedForClearType, |
michael@0 | 41 | LastResort, |
michael@0 | 42 | Reserved15) |
michael@0 | 43 | //0-7 |
michael@0 | 44 | SK_OT_BYTE_BITFIELD( |
michael@0 | 45 | BaselineAtY0, |
michael@0 | 46 | LeftSidebearingAtX0, |
michael@0 | 47 | InstructionsDependOnPointSize, |
michael@0 | 48 | IntegerScaling, |
michael@0 | 49 | InstructionsAlterAdvanceWidth, |
michael@0 | 50 | VerticalCenteredGlyphs_Apple, |
michael@0 | 51 | Reserved06, |
michael@0 | 52 | RequiresLayout_Apple) |
michael@0 | 53 | } field; |
michael@0 | 54 | struct Raw { |
michael@0 | 55 | static const SK_OT_USHORT BaselineAtY0Mask = SkTEndian_SwapBE16(1 << 0); |
michael@0 | 56 | static const SK_OT_USHORT LeftSidebearingAtX0Mask = SkTEndian_SwapBE16(1 << 1); |
michael@0 | 57 | static const SK_OT_USHORT InstructionsDependOnPointSizeMask = SkTEndian_SwapBE16(1 << 2); |
michael@0 | 58 | static const SK_OT_USHORT IntegerScalingMask = SkTEndian_SwapBE16(1 << 3); |
michael@0 | 59 | static const SK_OT_USHORT InstructionsAlterAdvanceWidthMask = SkTEndian_SwapBE16(1 << 4); |
michael@0 | 60 | static const SK_OT_USHORT VerticalCenteredGlyphs_AppleMask = SkTEndian_SwapBE16(1 << 5); |
michael@0 | 61 | //Reserved |
michael@0 | 62 | static const SK_OT_USHORT RequiresLayout_AppleMask = SkTEndian_SwapBE16(1 << 7); |
michael@0 | 63 | |
michael@0 | 64 | static const SK_OT_USHORT GXMetamorphosis_AppleMask = SkTEndian_SwapBE16(1 << 8); |
michael@0 | 65 | static const SK_OT_USHORT HasStrongRTL_AppleMask = SkTEndian_SwapBE16(1 << 9); |
michael@0 | 66 | static const SK_OT_USHORT HasIndicStyleRearrangementMask = SkTEndian_SwapBE16(1 << 10); |
michael@0 | 67 | static const SK_OT_USHORT AgfaMicroTypeExpressProcessedMask = SkTEndian_SwapBE16(1 << 11); |
michael@0 | 68 | static const SK_OT_USHORT FontConvertedMask = SkTEndian_SwapBE16(1 << 12); |
michael@0 | 69 | static const SK_OT_USHORT DesignedForClearTypeMask = SkTEndian_SwapBE16(1 << 13); |
michael@0 | 70 | static const SK_OT_USHORT LastResortMask = SkTEndian_SwapBE16(1 << 14); |
michael@0 | 71 | //Reserved |
michael@0 | 72 | SK_OT_USHORT value; |
michael@0 | 73 | } raw; |
michael@0 | 74 | } flags; |
michael@0 | 75 | SK_OT_USHORT unitsPerEm; |
michael@0 | 76 | SK_OT_LONGDATETIME created; |
michael@0 | 77 | SK_OT_LONGDATETIME modified; |
michael@0 | 78 | SK_OT_SHORT xMin; |
michael@0 | 79 | SK_OT_SHORT yMin; |
michael@0 | 80 | SK_OT_SHORT xMax; |
michael@0 | 81 | SK_OT_SHORT yMax; |
michael@0 | 82 | union MacStyle { |
michael@0 | 83 | struct Field { |
michael@0 | 84 | //8-15 |
michael@0 | 85 | SK_OT_BYTE_BITFIELD( |
michael@0 | 86 | Reserved08, |
michael@0 | 87 | Reserved09, |
michael@0 | 88 | Reserved10, |
michael@0 | 89 | Reserved11, |
michael@0 | 90 | Reserved12, |
michael@0 | 91 | Reserved13, |
michael@0 | 92 | Reserved14, |
michael@0 | 93 | Reserved15) |
michael@0 | 94 | //0-7 |
michael@0 | 95 | SK_OT_BYTE_BITFIELD( |
michael@0 | 96 | Bold, |
michael@0 | 97 | Italic, |
michael@0 | 98 | Underline, |
michael@0 | 99 | Outline, |
michael@0 | 100 | Shadow, |
michael@0 | 101 | Condensed, |
michael@0 | 102 | Extended, |
michael@0 | 103 | Reserved07) |
michael@0 | 104 | } field; |
michael@0 | 105 | struct Raw { |
michael@0 | 106 | static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1); |
michael@0 | 107 | static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 1); |
michael@0 | 108 | static const SK_OT_USHORT UnderlineMask = SkTEndian_SwapBE16(1 << 2); |
michael@0 | 109 | static const SK_OT_USHORT OutlineMask = SkTEndian_SwapBE16(1 << 3); |
michael@0 | 110 | static const SK_OT_USHORT ShadowMask = SkTEndian_SwapBE16(1 << 4); |
michael@0 | 111 | static const SK_OT_USHORT CondensedMask = SkTEndian_SwapBE16(1 << 5); |
michael@0 | 112 | static const SK_OT_USHORT ExtendedMask = SkTEndian_SwapBE16(1 << 6); |
michael@0 | 113 | |
michael@0 | 114 | SK_OT_USHORT value; |
michael@0 | 115 | } raw; |
michael@0 | 116 | } macStyle; |
michael@0 | 117 | SK_OT_USHORT lowestRecPPEM; |
michael@0 | 118 | struct FontDirectionHint { |
michael@0 | 119 | SK_TYPED_ENUM(Value, SK_OT_SHORT, |
michael@0 | 120 | ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0))) |
michael@0 | 121 | ((OnlyStronglyLTR, SkTEndian_SwapBE16(1))) |
michael@0 | 122 | ((StronglyLTR, SkTEndian_SwapBE16(2))) |
michael@0 | 123 | ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-1)))) |
michael@0 | 124 | ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-2)))) |
michael@0 | 125 | SK_SEQ_END, |
michael@0 | 126 | (value)SK_SEQ_END) |
michael@0 | 127 | } fontDirectionHint; |
michael@0 | 128 | struct IndexToLocFormat { |
michael@0 | 129 | SK_TYPED_ENUM(Value, SK_OT_SHORT, |
michael@0 | 130 | ((ShortOffsets, SkTEndian_SwapBE16(0))) |
michael@0 | 131 | ((LongOffsets, SkTEndian_SwapBE16(1))) |
michael@0 | 132 | SK_SEQ_END, |
michael@0 | 133 | (value)SK_SEQ_END) |
michael@0 | 134 | } indexToLocFormat; |
michael@0 | 135 | struct GlyphDataFormat { |
michael@0 | 136 | SK_TYPED_ENUM(Value, SK_OT_SHORT, |
michael@0 | 137 | ((CurrentFormat, SkTEndian_SwapBE16(0))) |
michael@0 | 138 | SK_SEQ_END, |
michael@0 | 139 | (value)SK_SEQ_END) |
michael@0 | 140 | } glyphDataFormat; |
michael@0 | 141 | }; |
michael@0 | 142 | |
michael@0 | 143 | #pragma pack(pop) |
michael@0 | 144 | |
michael@0 | 145 | |
michael@0 | 146 | #include <stddef.h> |
michael@0 | 147 | SK_COMPILE_ASSERT(offsetof(SkOTTableHead, glyphDataFormat) == 52, SkOTTableHead_glyphDataFormat_not_at_52); |
michael@0 | 148 | SK_COMPILE_ASSERT(sizeof(SkOTTableHead) == 54, sizeof_SkOTTableHead_not_54); |
michael@0 | 149 | |
michael@0 | 150 | #endif |