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