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