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.
1 /*
2 * Copyright 2006 The Android Open Source Project
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 SkAvoidXfermode_DEFINED
9 #define SkAvoidXfermode_DEFINED
11 #include "SkXfermode.h"
13 /** \class SkAvoidXfermode
15 This xfermode will draw the src everywhere except on top of the specified
16 color.
17 */
18 class SK_API SkAvoidXfermode : public SkXfermode {
19 public:
20 enum Mode {
21 kAvoidColor_Mode, //!< draw everywhere except on the opColor
22 kTargetColor_Mode //!< draw only on top of the opColor
23 };
25 /** This xfermode draws, or doesn't draw, based on the destination's
26 distance from an op-color.
28 There are two modes, and each mode interprets a tolerance value.
30 Avoid: In this mode, drawing is allowed only on destination pixels that
31 are different from the op-color.
32 Tolerance near 0: avoid any colors even remotely similar to the op-color
33 Tolerance near 255: avoid only colors nearly identical to the op-color
35 Target: In this mode, drawing only occurs on destination pixels that
36 are similar to the op-color
37 Tolerance near 0: draw only on colors that are nearly identical to the op-color
38 Tolerance near 255: draw on any colors even remotely similar to the op-color
39 */
40 static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode) {
41 return SkNEW_ARGS(SkAvoidXfermode, (opColor, tolerance, mode));
42 }
44 // overrides from SkXfermode
45 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
46 const SkAlpha aa[]) const SK_OVERRIDE;
47 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
48 const SkAlpha aa[]) const SK_OVERRIDE;
49 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
50 const SkAlpha aa[]) const SK_OVERRIDE;
52 SK_TO_STRING_OVERRIDE()
53 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAvoidXfermode)
55 protected:
56 SkAvoidXfermode(SkReadBuffer&);
57 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
59 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
60 public:
61 #endif
62 SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode);
64 private:
65 SkColor fOpColor;
66 uint32_t fDistMul; // x.14
67 Mode fMode;
69 typedef SkXfermode INHERITED;
70 };
72 #endif