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 2011 Google Inc. |
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 | #include "SkProxyCanvas.h" |
michael@0 | 9 | |
michael@0 | 10 | SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) { |
michael@0 | 11 | SkSafeRef(fProxy); |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | SkProxyCanvas::~SkProxyCanvas() { |
michael@0 | 15 | SkSafeUnref(fProxy); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | void SkProxyCanvas::setProxy(SkCanvas* proxy) { |
michael@0 | 19 | SkRefCnt_SafeAssign(fProxy, proxy); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | ///////////////////////////////// Overrides /////////// |
michael@0 | 23 | |
michael@0 | 24 | void SkProxyCanvas::willSave(SaveFlags flags) { |
michael@0 | 25 | fProxy->save(flags); |
michael@0 | 26 | this->INHERITED::willSave(flags); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | SkCanvas::SaveLayerStrategy SkProxyCanvas::willSaveLayer(const SkRect* bounds, const SkPaint* paint, |
michael@0 | 30 | SaveFlags flags) { |
michael@0 | 31 | fProxy->saveLayer(bounds, paint, flags); |
michael@0 | 32 | this->INHERITED::willSaveLayer(bounds, paint, flags); |
michael@0 | 33 | // No need for a layer. |
michael@0 | 34 | return kNoLayer_SaveLayerStrategy; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | void SkProxyCanvas::willRestore() { |
michael@0 | 38 | fProxy->restore(); |
michael@0 | 39 | this->INHERITED::willRestore(); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | void SkProxyCanvas::didTranslate(SkScalar dx, SkScalar dy) { |
michael@0 | 43 | fProxy->translate(dx, dy); |
michael@0 | 44 | this->INHERITED::didTranslate(dx, dy); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | void SkProxyCanvas::didScale(SkScalar sx, SkScalar sy) { |
michael@0 | 48 | fProxy->scale(sx, sy); |
michael@0 | 49 | this->INHERITED::didScale(sx, sy); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | void SkProxyCanvas::didRotate(SkScalar degrees) { |
michael@0 | 53 | fProxy->rotate(degrees); |
michael@0 | 54 | this->INHERITED::didRotate(degrees); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | void SkProxyCanvas::didSkew(SkScalar sx, SkScalar sy) { |
michael@0 | 58 | fProxy->skew(sx, sy); |
michael@0 | 59 | this->INHERITED::didSkew(sx, sy); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | void SkProxyCanvas::didConcat(const SkMatrix& matrix) { |
michael@0 | 63 | fProxy->concat(matrix); |
michael@0 | 64 | this->INHERITED::didConcat(matrix); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | void SkProxyCanvas::didSetMatrix(const SkMatrix& matrix) { |
michael@0 | 68 | fProxy->setMatrix(matrix); |
michael@0 | 69 | this->INHERITED::didSetMatrix(matrix); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | void SkProxyCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) { |
michael@0 | 73 | fProxy->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | void SkProxyCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) { |
michael@0 | 77 | fProxy->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | void SkProxyCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) { |
michael@0 | 81 | fProxy->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
michael@0 | 85 | fProxy->clipRegion(deviceRgn, op); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | void SkProxyCanvas::drawPaint(const SkPaint& paint) { |
michael@0 | 89 | fProxy->drawPaint(paint); |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | void SkProxyCanvas::drawPoints(PointMode mode, size_t count, |
michael@0 | 93 | const SkPoint pts[], const SkPaint& paint) { |
michael@0 | 94 | fProxy->drawPoints(mode, count, pts, paint); |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { |
michael@0 | 98 | fProxy->drawOval(rect, paint); |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { |
michael@0 | 102 | fProxy->drawRect(rect, paint); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
michael@0 | 106 | fProxy->drawRRect(rrect, paint); |
michael@0 | 107 | } |
michael@0 | 108 | |
michael@0 | 109 | void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, |
michael@0 | 110 | const SkPaint& paint) { |
michael@0 | 111 | fProxy->drawDRRect(outer, inner, paint); |
michael@0 | 112 | } |
michael@0 | 113 | |
michael@0 | 114 | void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
michael@0 | 115 | fProxy->drawPath(path, paint); |
michael@0 | 116 | } |
michael@0 | 117 | |
michael@0 | 118 | void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
michael@0 | 119 | const SkPaint* paint) { |
michael@0 | 120 | fProxy->drawBitmap(bitmap, x, y, paint); |
michael@0 | 121 | } |
michael@0 | 122 | |
michael@0 | 123 | void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
michael@0 | 124 | const SkRect& dst, const SkPaint* paint, |
michael@0 | 125 | DrawBitmapRectFlags flags) { |
michael@0 | 126 | fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags); |
michael@0 | 127 | } |
michael@0 | 128 | |
michael@0 | 129 | void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
michael@0 | 130 | const SkPaint* paint) { |
michael@0 | 131 | fProxy->drawBitmapMatrix(bitmap, m, paint); |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, |
michael@0 | 135 | const SkPaint* paint) { |
michael@0 | 136 | fProxy->drawSprite(bitmap, x, y, paint); |
michael@0 | 137 | } |
michael@0 | 138 | |
michael@0 | 139 | void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x, |
michael@0 | 140 | SkScalar y, const SkPaint& paint) { |
michael@0 | 141 | fProxy->drawText(text, byteLength, x, y, paint); |
michael@0 | 142 | } |
michael@0 | 143 | |
michael@0 | 144 | void SkProxyCanvas::drawPosText(const void* text, size_t byteLength, |
michael@0 | 145 | const SkPoint pos[], const SkPaint& paint) { |
michael@0 | 146 | fProxy->drawPosText(text, byteLength, pos, paint); |
michael@0 | 147 | } |
michael@0 | 148 | |
michael@0 | 149 | void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength, |
michael@0 | 150 | const SkScalar xpos[], SkScalar constY, |
michael@0 | 151 | const SkPaint& paint) { |
michael@0 | 152 | fProxy->drawPosTextH(text, byteLength, xpos, constY, paint); |
michael@0 | 153 | } |
michael@0 | 154 | |
michael@0 | 155 | void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength, |
michael@0 | 156 | const SkPath& path, const SkMatrix* matrix, |
michael@0 | 157 | const SkPaint& paint) { |
michael@0 | 158 | fProxy->drawTextOnPath(text, byteLength, path, matrix, paint); |
michael@0 | 159 | } |
michael@0 | 160 | |
michael@0 | 161 | void SkProxyCanvas::drawPicture(SkPicture& picture) { |
michael@0 | 162 | fProxy->drawPicture(picture); |
michael@0 | 163 | } |
michael@0 | 164 | |
michael@0 | 165 | void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount, |
michael@0 | 166 | const SkPoint vertices[], const SkPoint texs[], |
michael@0 | 167 | const SkColor colors[], SkXfermode* xmode, |
michael@0 | 168 | const uint16_t indices[], int indexCount, |
michael@0 | 169 | const SkPaint& paint) { |
michael@0 | 170 | fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors, |
michael@0 | 171 | xmode, indices, indexCount, paint); |
michael@0 | 172 | } |
michael@0 | 173 | |
michael@0 | 174 | void SkProxyCanvas::drawData(const void* data, size_t length) { |
michael@0 | 175 | fProxy->drawData(data, length); |
michael@0 | 176 | } |
michael@0 | 177 | |
michael@0 | 178 | void SkProxyCanvas::beginCommentGroup(const char* description) { |
michael@0 | 179 | fProxy->beginCommentGroup(description); |
michael@0 | 180 | } |
michael@0 | 181 | |
michael@0 | 182 | void SkProxyCanvas::addComment(const char* kywd, const char* value) { |
michael@0 | 183 | fProxy->addComment(kywd, value); |
michael@0 | 184 | } |
michael@0 | 185 | |
michael@0 | 186 | void SkProxyCanvas::endCommentGroup() { |
michael@0 | 187 | fProxy->endCommentGroup(); |
michael@0 | 188 | } |
michael@0 | 189 | |
michael@0 | 190 | SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) { |
michael@0 | 191 | return fProxy->setBounder(bounder); |
michael@0 | 192 | } |
michael@0 | 193 | |
michael@0 | 194 | SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) { |
michael@0 | 195 | return fProxy->setDrawFilter(filter); |
michael@0 | 196 | } |