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 2006 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 | #include "SkDrawSaveLayer.h" |
michael@0 | 11 | #include "SkAnimateMaker.h" |
michael@0 | 12 | #include "SkCanvas.h" |
michael@0 | 13 | #include "SkDrawPaint.h" |
michael@0 | 14 | #include "SkDrawRectangle.h" |
michael@0 | 15 | |
michael@0 | 16 | #if SK_USE_CONDENSED_INFO == 0 |
michael@0 | 17 | |
michael@0 | 18 | const SkMemberInfo SkSaveLayer::fInfo[] = { |
michael@0 | 19 | SK_MEMBER(bounds, Rect), |
michael@0 | 20 | SK_MEMBER(paint, Paint) |
michael@0 | 21 | }; |
michael@0 | 22 | |
michael@0 | 23 | #endif |
michael@0 | 24 | |
michael@0 | 25 | DEFINE_GET_MEMBER(SkSaveLayer); |
michael@0 | 26 | |
michael@0 | 27 | SkSaveLayer::SkSaveLayer() : paint(NULL), bounds(NULL) { |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | SkSaveLayer::~SkSaveLayer(){ |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | bool SkSaveLayer::draw(SkAnimateMaker& maker) |
michael@0 | 34 | { |
michael@0 | 35 | if (!bounds) { |
michael@0 | 36 | return false; |
michael@0 | 37 | } |
michael@0 | 38 | SkPaint* save = maker.fPaint; |
michael@0 | 39 | //paint is an SkDrawPaint |
michael@0 | 40 | if (paint) |
michael@0 | 41 | { |
michael@0 | 42 | SkPaint realPaint; |
michael@0 | 43 | paint->setupPaint(&realPaint); |
michael@0 | 44 | maker.fCanvas->saveLayer(&bounds->fRect, &realPaint, SkCanvas::kHasAlphaLayer_SaveFlag); |
michael@0 | 45 | } |
michael@0 | 46 | else |
michael@0 | 47 | maker.fCanvas->saveLayer(&bounds->fRect, save, SkCanvas::kHasAlphaLayer_SaveFlag); |
michael@0 | 48 | SkPaint local = SkPaint(*maker.fPaint); |
michael@0 | 49 | maker.fPaint = &local; |
michael@0 | 50 | bool result = INHERITED::draw(maker); |
michael@0 | 51 | maker.fPaint = save; |
michael@0 | 52 | maker.fCanvas->restore(); |
michael@0 | 53 | return result; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | #ifdef SK_DUMP_ENABLED |
michael@0 | 57 | void SkSaveLayer::dump(SkAnimateMaker* maker) |
michael@0 | 58 | { |
michael@0 | 59 | dumpBase(maker); |
michael@0 | 60 | //would dump enabled be defined but not debug? |
michael@0 | 61 | #ifdef SK_DEBUG |
michael@0 | 62 | if (paint) |
michael@0 | 63 | SkDebugf("paint=\"%s\" ", paint->id); |
michael@0 | 64 | if (bounds) |
michael@0 | 65 | SkDebugf("bounds=\"%s\" ", bounds->id); |
michael@0 | 66 | #endif |
michael@0 | 67 | dumpDrawables(maker); |
michael@0 | 68 | } |
michael@0 | 69 | #endif |
michael@0 | 70 | |
michael@0 | 71 | void SkSaveLayer::onEndElement(SkAnimateMaker& maker) |
michael@0 | 72 | { |
michael@0 | 73 | if (!bounds) |
michael@0 | 74 | maker.setErrorCode(SkDisplayXMLParserError::kSaveLayerNeedsBounds); |
michael@0 | 75 | INHERITED::onEndElement(maker); |
michael@0 | 76 | } |