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 2012 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 SkPathOpsQuad_DEFINED |
michael@0 | 9 | #define SkPathOpsQuad_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkPathOpsPoint.h" |
michael@0 | 12 | |
michael@0 | 13 | struct SkDQuadPair { |
michael@0 | 14 | const SkDQuad& first() const { return (const SkDQuad&) pts[0]; } |
michael@0 | 15 | const SkDQuad& second() const { return (const SkDQuad&) pts[2]; } |
michael@0 | 16 | SkDPoint pts[5]; |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | struct SkDQuad { |
michael@0 | 20 | SkDPoint fPts[3]; |
michael@0 | 21 | |
michael@0 | 22 | SkDQuad flip() const { |
michael@0 | 23 | SkDQuad result = {{fPts[2], fPts[1], fPts[0]}}; |
michael@0 | 24 | return result; |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | void set(const SkPoint pts[3]) { |
michael@0 | 28 | fPts[0] = pts[0]; |
michael@0 | 29 | fPts[1] = pts[1]; |
michael@0 | 30 | fPts[2] = pts[2]; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 3); return fPts[n]; } |
michael@0 | 34 | SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 3); return fPts[n]; } |
michael@0 | 35 | |
michael@0 | 36 | static int AddValidTs(double s[], int realRoots, double* t); |
michael@0 | 37 | void align(int endIndex, SkDPoint* dstPt) const; |
michael@0 | 38 | SkDQuadPair chopAt(double t) const; |
michael@0 | 39 | SkDVector dxdyAtT(double t) const; |
michael@0 | 40 | static int FindExtrema(double a, double b, double c, double tValue[1]); |
michael@0 | 41 | bool isLinear(int startIndex, int endIndex) const; |
michael@0 | 42 | bool monotonicInY() const; |
michael@0 | 43 | double nearestT(const SkDPoint&) const; |
michael@0 | 44 | bool pointInHull(const SkDPoint&) const; |
michael@0 | 45 | SkDPoint ptAtT(double t) const; |
michael@0 | 46 | static int RootsReal(double A, double B, double C, double t[2]); |
michael@0 | 47 | static int RootsValidT(const double A, const double B, const double C, double s[2]); |
michael@0 | 48 | static void SetABC(const double* quad, double* a, double* b, double* c); |
michael@0 | 49 | SkDQuad subDivide(double t1, double t2) const; |
michael@0 | 50 | static SkDQuad SubDivide(const SkPoint a[3], double t1, double t2) { |
michael@0 | 51 | SkDQuad quad; |
michael@0 | 52 | quad.set(a); |
michael@0 | 53 | return quad.subDivide(t1, t2); |
michael@0 | 54 | } |
michael@0 | 55 | SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t2) const; |
michael@0 | 56 | static SkDPoint SubDivide(const SkPoint pts[3], const SkDPoint& a, const SkDPoint& c, |
michael@0 | 57 | double t1, double t2) { |
michael@0 | 58 | SkDQuad quad; |
michael@0 | 59 | quad.set(pts); |
michael@0 | 60 | return quad.subDivide(a, c, t1, t2); |
michael@0 | 61 | } |
michael@0 | 62 | SkDCubic toCubic() const; |
michael@0 | 63 | SkDPoint top(double startT, double endT) const; |
michael@0 | 64 | |
michael@0 | 65 | #ifdef SK_DEBUG |
michael@0 | 66 | void dump(); |
michael@0 | 67 | #endif |
michael@0 | 68 | private: |
michael@0 | 69 | // static double Tangent(const double* quadratic, double t); // uncalled |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | #endif |