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 | /* |
michael@0 | 3 | * Copyright 2010 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkLayer_DEFINED |
michael@0 | 11 | #define SkLayer_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkRefCnt.h" |
michael@0 | 14 | #include "SkTDArray.h" |
michael@0 | 15 | #include "SkColor.h" |
michael@0 | 16 | #include "SkMatrix.h" |
michael@0 | 17 | #include "SkPoint.h" |
michael@0 | 18 | #include "SkRect.h" |
michael@0 | 19 | #include "SkSize.h" |
michael@0 | 20 | |
michael@0 | 21 | class SkCanvas; |
michael@0 | 22 | |
michael@0 | 23 | class SkLayer : public SkRefCnt { |
michael@0 | 24 | |
michael@0 | 25 | public: |
michael@0 | 26 | SK_DECLARE_INST_COUNT(SkLayer) |
michael@0 | 27 | |
michael@0 | 28 | SkLayer(); |
michael@0 | 29 | SkLayer(const SkLayer&); |
michael@0 | 30 | virtual ~SkLayer(); |
michael@0 | 31 | |
michael@0 | 32 | bool isInheritFromRootTransform() const; |
michael@0 | 33 | SkScalar getOpacity() const { return m_opacity; } |
michael@0 | 34 | const SkSize& getSize() const { return m_size; } |
michael@0 | 35 | const SkPoint& getPosition() const { return m_position; } |
michael@0 | 36 | const SkPoint& getAnchorPoint() const { return m_anchorPoint; } |
michael@0 | 37 | const SkMatrix& getMatrix() const { return fMatrix; } |
michael@0 | 38 | const SkMatrix& getChildrenMatrix() const { return fChildrenMatrix; } |
michael@0 | 39 | |
michael@0 | 40 | SkScalar getWidth() const { return m_size.width(); } |
michael@0 | 41 | SkScalar getHeight() const { return m_size.height(); } |
michael@0 | 42 | |
michael@0 | 43 | void setInheritFromRootTransform(bool); |
michael@0 | 44 | void setOpacity(SkScalar opacity) { m_opacity = opacity; } |
michael@0 | 45 | void setSize(SkScalar w, SkScalar h) { m_size.set(w, h); } |
michael@0 | 46 | void setPosition(SkScalar x, SkScalar y) { m_position.set(x, y); } |
michael@0 | 47 | void setAnchorPoint(SkScalar x, SkScalar y) { m_anchorPoint.set(x, y); } |
michael@0 | 48 | void setMatrix(const SkMatrix&); |
michael@0 | 49 | void setChildrenMatrix(const SkMatrix&); |
michael@0 | 50 | |
michael@0 | 51 | // children |
michael@0 | 52 | |
michael@0 | 53 | /** Return the number of layers in our child list. |
michael@0 | 54 | */ |
michael@0 | 55 | int countChildren() const; |
michael@0 | 56 | |
michael@0 | 57 | /** Return the child at the specified index (starting at 0). This does not |
michael@0 | 58 | affect the reference count of the child. |
michael@0 | 59 | */ |
michael@0 | 60 | SkLayer* getChild(int index) const; |
michael@0 | 61 | |
michael@0 | 62 | /** Add this layer to our child list at the end (top-most), and ref() it. |
michael@0 | 63 | If it was already in another hierarchy, remove it from that list. |
michael@0 | 64 | Return the new child. |
michael@0 | 65 | */ |
michael@0 | 66 | SkLayer* addChild(SkLayer* child); |
michael@0 | 67 | |
michael@0 | 68 | /** Remove this layer from its parent's list (or do nothing if it has no |
michael@0 | 69 | parent.) If it had a parent, then unref() is called. |
michael@0 | 70 | */ |
michael@0 | 71 | void detachFromParent(); |
michael@0 | 72 | |
michael@0 | 73 | /** Remove, and unref(), all of the layers in our child list. |
michael@0 | 74 | */ |
michael@0 | 75 | void removeChildren(); |
michael@0 | 76 | |
michael@0 | 77 | /** Return our parent layer, or NULL if we have none. |
michael@0 | 78 | */ |
michael@0 | 79 | SkLayer* getParent() const { return fParent; } |
michael@0 | 80 | |
michael@0 | 81 | /** Return the root layer in this hiearchy. If this layer is the root |
michael@0 | 82 | (i.e. has no parent), then this returns itself. |
michael@0 | 83 | */ |
michael@0 | 84 | SkLayer* getRootLayer() const; |
michael@0 | 85 | |
michael@0 | 86 | // coordinate system transformations |
michael@0 | 87 | |
michael@0 | 88 | /** Return, in matrix, the matix transfomations that are applied locally |
michael@0 | 89 | when this layer draws (i.e. its position and matrix/anchorPoint). |
michael@0 | 90 | This does not include the childrenMatrix, since that is only applied |
michael@0 | 91 | after this layer draws (but before its children draw). |
michael@0 | 92 | */ |
michael@0 | 93 | void getLocalTransform(SkMatrix* matrix) const; |
michael@0 | 94 | |
michael@0 | 95 | /** Return, in matrix, the concatenation of transforms that are applied |
michael@0 | 96 | from this layer's root parent to the layer itself. |
michael@0 | 97 | This is the matrix that is applied to the layer during drawing. |
michael@0 | 98 | */ |
michael@0 | 99 | void localToGlobal(SkMatrix* matrix) const; |
michael@0 | 100 | |
michael@0 | 101 | // paint method |
michael@0 | 102 | |
michael@0 | 103 | void draw(SkCanvas*, SkScalar opacity); |
michael@0 | 104 | void draw(SkCanvas* canvas) { |
michael@0 | 105 | this->draw(canvas, SK_Scalar1); |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | protected: |
michael@0 | 109 | virtual void onDraw(SkCanvas*, SkScalar opacity); |
michael@0 | 110 | |
michael@0 | 111 | private: |
michael@0 | 112 | enum Flags { |
michael@0 | 113 | kInheritFromRootTransform_Flag = 0x01 |
michael@0 | 114 | }; |
michael@0 | 115 | |
michael@0 | 116 | SkLayer* fParent; |
michael@0 | 117 | SkScalar m_opacity; |
michael@0 | 118 | SkSize m_size; |
michael@0 | 119 | SkPoint m_position; |
michael@0 | 120 | SkPoint m_anchorPoint; |
michael@0 | 121 | SkMatrix fMatrix; |
michael@0 | 122 | SkMatrix fChildrenMatrix; |
michael@0 | 123 | uint32_t fFlags; |
michael@0 | 124 | |
michael@0 | 125 | SkTDArray<SkLayer*> m_children; |
michael@0 | 126 | |
michael@0 | 127 | typedef SkRefCnt INHERITED; |
michael@0 | 128 | }; |
michael@0 | 129 | |
michael@0 | 130 | #endif |