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 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
10 #include "SkScan.h"
11 #include "SkBlitter.h"
12 #include "SkRasterClip.h"
14 static inline void blitrect(SkBlitter* blitter, const SkIRect& r) {
15 blitter->blitRect(r.fLeft, r.fTop, r.width(), r.height());
16 }
18 void SkScan::FillIRect(const SkIRect& r, const SkRegion* clip,
19 SkBlitter* blitter) {
20 if (!r.isEmpty()) {
21 if (clip) {
22 if (clip->isRect()) {
23 const SkIRect& clipBounds = clip->getBounds();
25 if (clipBounds.contains(r)) {
26 blitrect(blitter, r);
27 } else {
28 SkIRect rr = r;
29 if (rr.intersect(clipBounds)) {
30 blitrect(blitter, rr);
31 }
32 }
33 } else {
34 SkRegion::Cliperator cliper(*clip, r);
35 const SkIRect& rr = cliper.rect();
37 while (!cliper.done()) {
38 blitrect(blitter, rr);
39 cliper.next();
40 }
41 }
42 } else {
43 blitrect(blitter, r);
44 }
45 }
46 }
48 void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip,
49 SkBlitter* blitter) {
50 SkIRect r;
52 XRect_round(xr, &r);
53 SkScan::FillIRect(r, clip, blitter);
54 }
56 void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
57 SkBlitter* blitter) {
58 SkIRect ir;
60 r.round(&ir);
61 SkScan::FillIRect(ir, clip, blitter);
62 }
64 ///////////////////////////////////////////////////////////////////////////////
66 void SkScan::FillIRect(const SkIRect& r, const SkRasterClip& clip,
67 SkBlitter* blitter) {
68 if (clip.isEmpty() || r.isEmpty()) {
69 return;
70 }
72 if (clip.isBW()) {
73 FillIRect(r, &clip.bwRgn(), blitter);
74 return;
75 }
77 SkAAClipBlitterWrapper wrapper(clip, blitter);
78 FillIRect(r, &wrapper.getRgn(), wrapper.getBlitter());
79 }
81 void SkScan::FillXRect(const SkXRect& xr, const SkRasterClip& clip,
82 SkBlitter* blitter) {
83 if (clip.isEmpty() || xr.isEmpty()) {
84 return;
85 }
87 if (clip.isBW()) {
88 FillXRect(xr, &clip.bwRgn(), blitter);
89 return;
90 }
92 SkAAClipBlitterWrapper wrapper(clip, blitter);
93 FillXRect(xr, &wrapper.getRgn(), wrapper.getBlitter());
94 }
96 void SkScan::FillRect(const SkRect& r, const SkRasterClip& clip,
97 SkBlitter* blitter) {
98 if (clip.isEmpty() || r.isEmpty()) {
99 return;
100 }
102 if (clip.isBW()) {
103 FillRect(r, &clip.bwRgn(), blitter);
104 return;
105 }
107 SkAAClipBlitterWrapper wrapper(clip, blitter);
108 FillRect(r, &wrapper.getRgn(), wrapper.getBlitter());
109 }