gfx/skia/trunk/src/sfnt/SkOTTable_head.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

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

mercurial