gfx/skia/trunk/include/ports/SkFontStyle.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 2013 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 SkFontStyle_DEFINED
     9 #define SkFontStyle_DEFINED
    11 #include "SkTypes.h"
    13 class SK_API SkFontStyle {
    14 public:
    15     enum Weight {
    16         kThin_Weight        = 100,
    17         kExtraLight_Weight  = 200,
    18         kLight_Weight       = 300,
    19         kNormal_Weight      = 400,
    20         kMedium_Weight      = 500,
    21         kSemiBold_Weight    = 600,
    22         kBold_Weight        = 700,
    23         kExtraBold_Weight   = 800,
    24         kBlack_Weight       = 900
    25     };
    27     enum Width {
    28         kUltraCondensed_Width   = 1,
    29         kExtraCondensed_Width   = 2,
    30         kCondensed_Width        = 3,
    31         kSemiCondensed_Width    = 4,
    32         kNormal_Width           = 5,
    33         kSemiExpanded_Width     = 6,
    34         kExpanded_Width         = 7,
    35         kExtraExpanded_Width    = 8,
    36         kUltaExpanded_Width     = 9
    37     };
    39     enum Slant {
    40         kUpright_Slant,
    41         kItalic_Slant,
    42     };
    44     SkFontStyle();
    45     SkFontStyle(int weight, int width, Slant);
    47     bool operator==(const SkFontStyle& rhs) const {
    48         return fUnion.fU32 == rhs.fUnion.fU32;
    49     }
    51     int weight() const { return fUnion.fR.fWeight; }
    52     int width() const { return fUnion.fR.fWidth; }
    53     Slant slant() const { return (Slant)fUnion.fR.fSlant; }
    55     bool isItalic() const {
    56         return kItalic_Slant == fUnion.fR.fSlant;
    57     }
    59 private:
    60     union {
    61         struct {
    62             uint16_t fWeight;   // 100 .. 900
    63             uint8_t  fWidth;    // 1 .. 9
    64             uint8_t  fSlant;    // 0 .. 2
    65         } fR;
    66         uint32_t    fU32;
    67     } fUnion;
    68 };
    70 #endif

mercurial