gfx/skia/trunk/src/views/SkViewPriv.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 "SkViewPriv.h"
michael@0 9
michael@0 10 //////////////////////////////////////////////////////////////////////
michael@0 11
michael@0 12 void SkView::Artist::draw(SkView* view, SkCanvas* canvas)
michael@0 13 {
michael@0 14 SkASSERT(view && canvas);
michael@0 15 this->onDraw(view, canvas);
michael@0 16 }
michael@0 17
michael@0 18 void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
michael@0 19 {
michael@0 20 SkASSERT(&dom && node);
michael@0 21 this->onInflate(dom, node);
michael@0 22 }
michael@0 23
michael@0 24 void SkView::Artist::onInflate(const SkDOM&, const SkDOM::Node*)
michael@0 25 {
michael@0 26 // subclass should override this as needed
michael@0 27 }
michael@0 28
michael@0 29 SkView::Artist* SkView::getArtist() const
michael@0 30 {
michael@0 31 Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
michael@0 32 SkASSERT(rec == NULL || rec->fArtist != NULL);
michael@0 33
michael@0 34 return rec ? rec->fArtist : NULL;
michael@0 35 }
michael@0 36
michael@0 37 SkView::Artist* SkView::setArtist(Artist* obj)
michael@0 38 {
michael@0 39 if (obj == NULL)
michael@0 40 {
michael@0 41 this->removeTagList(kViewArtist_SkTagList);
michael@0 42 }
michael@0 43 else // add/replace
michael@0 44 {
michael@0 45 Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
michael@0 46
michael@0 47 if (rec)
michael@0 48 SkRefCnt_SafeAssign(rec->fArtist, obj);
michael@0 49 else
michael@0 50 this->addTagList(new Artist_SkTagList(obj));
michael@0 51 }
michael@0 52 return obj;
michael@0 53 }
michael@0 54
michael@0 55 ////////////////////////////////////////////////////////////////////////////////
michael@0 56
michael@0 57 void SkView::Layout::layoutChildren(SkView* parent)
michael@0 58 {
michael@0 59 SkASSERT(parent);
michael@0 60 if (parent->width() > 0 && parent->height() > 0)
michael@0 61 this->onLayoutChildren(parent);
michael@0 62 }
michael@0 63
michael@0 64 void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
michael@0 65 {
michael@0 66 SkASSERT(&dom && node);
michael@0 67 this->onInflate(dom, node);
michael@0 68 }
michael@0 69
michael@0 70 void SkView::Layout::onInflate(const SkDOM&, const SkDOM::Node*)
michael@0 71 {
michael@0 72 // subclass should override this as needed
michael@0 73 }
michael@0 74
michael@0 75 SkView::Layout* SkView::getLayout() const
michael@0 76 {
michael@0 77 Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
michael@0 78 SkASSERT(rec == NULL || rec->fLayout != NULL);
michael@0 79
michael@0 80 return rec ? rec->fLayout : NULL;
michael@0 81 }
michael@0 82
michael@0 83 SkView::Layout* SkView::setLayout(Layout* obj, bool invokeLayoutNow)
michael@0 84 {
michael@0 85 if (obj == NULL)
michael@0 86 {
michael@0 87 this->removeTagList(kViewLayout_SkTagList);
michael@0 88 }
michael@0 89 else // add/replace
michael@0 90 {
michael@0 91 Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
michael@0 92
michael@0 93 if (rec)
michael@0 94 SkRefCnt_SafeAssign(rec->fLayout, obj);
michael@0 95 else
michael@0 96 this->addTagList(new Layout_SkTagList(obj));
michael@0 97 }
michael@0 98
michael@0 99 if (invokeLayoutNow)
michael@0 100 this->invokeLayout();
michael@0 101
michael@0 102 return obj;
michael@0 103 }

mercurial