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.
2 /*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8 #ifndef SkTouchGesture_DEFINED
9 #define SkTouchGesture_DEFINED
11 #include "SkTDArray.h"
12 #include "SkMatrix.h"
14 struct SkFlingState {
15 SkFlingState() : fActive(false) {}
17 bool isActive() const { return fActive; }
18 void stop() { fActive = false; }
20 void reset(float sx, float sy);
21 bool evaluateMatrix(SkMatrix* matrix);
23 private:
24 SkPoint fDirection;
25 SkScalar fSpeed0;
26 double fTime0;
27 bool fActive;
28 };
30 class SkTouchGesture {
31 public:
32 SkTouchGesture();
33 ~SkTouchGesture();
35 void touchBegin(void* owner, float x, float y);
36 void touchMoved(void* owner, float x, float y);
37 void touchEnd(void* owner);
38 void reset();
40 bool isActive() { return fFlinger.isActive(); }
41 void stop() { fFlinger.stop(); }
43 const SkMatrix& localM();
44 const SkMatrix& globalM() const { return fGlobalM; }
46 private:
47 enum State {
48 kEmpty_State,
49 kTranslate_State,
50 kZoom_State,
51 };
53 struct Rec {
54 void* fOwner;
55 float fStartX, fStartY;
56 float fPrevX, fPrevY;
57 float fLastX, fLastY;
58 SkMSec fPrevT, fLastT;
59 };
60 SkTDArray<Rec> fTouches;
62 State fState;
63 SkMatrix fLocalM, fGlobalM;
64 SkFlingState fFlinger;
65 SkMSec fLastUpT;
66 SkPoint fLastUpP;
69 void flushLocalM();
70 int findRec(void* owner) const;
71 void appendNewRec(void* owner, float x, float y);
72 float computePinch(const Rec&, const Rec&);
73 float limitTotalZoom(float scale) const;
74 bool handleDblTap(float, float);
75 };
77 #endif