14
14
15
15
namespace WebView {
16
16
17
- DOMTreeModel::DOMTreeModel (JsonObject dom_tree, GUI::TreeView& tree_view)
17
+ DOMTreeModel::DOMTreeModel (JsonObject dom_tree, GUI::TreeView* tree_view)
18
18
: m_tree_view(tree_view)
19
19
, m_dom_tree(move(dom_tree))
20
20
{
21
+ // FIXME: Get these from the outside somehow instead of hard-coding paths here.
22
+ #ifdef __serenity__
21
23
m_document_icon.set_bitmap_for_size (16 , Gfx::Bitmap::try_load_from_file (" /res/icons/16x16/filetype-html.png" sv).release_value_but_fixme_should_propagate_errors ());
22
24
m_element_icon.set_bitmap_for_size (16 , Gfx::Bitmap::try_load_from_file (" /res/icons/16x16/inspector-object.png" sv).release_value_but_fixme_should_propagate_errors ());
23
25
m_text_icon.set_bitmap_for_size (16 , Gfx::Bitmap::try_load_from_file (" /res/icons/16x16/filetype-unknown.png" sv).release_value_but_fixme_should_propagate_errors ());
26
+ #endif
24
27
25
28
map_dom_nodes_to_parent (nullptr , &m_dom_tree);
26
29
}
@@ -119,18 +122,23 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
119
122
auto node_name = node.get (" name" sv).as_string ();
120
123
auto type = node.get (" type" sv).as_string_or (" unknown" sv);
121
124
125
+ // FIXME: This FIXME can go away when we fix the one below.
126
+ #ifdef __serenity__
122
127
if (role == GUI::ModelRole::ForegroundColor) {
123
128
// FIXME: Allow models to return a foreground color *role*.
124
129
// Then we won't need to have a GUI::TreeView& member anymore.
125
130
if (type == " comment" sv)
126
- return m_tree_view. palette ().syntax_comment ();
131
+ return m_tree_view-> palette ().syntax_comment ();
127
132
if (type == " pseudo-element" sv)
128
- return m_tree_view. palette ().syntax_type ();
133
+ return m_tree_view-> palette ().syntax_type ();
129
134
if (!node.get (" visible" sv).to_bool (true ))
130
- return m_tree_view. palette ().syntax_comment ();
135
+ return m_tree_view-> palette ().syntax_comment ();
131
136
return {};
132
137
}
138
+ #endif
133
139
140
+ // FIXME: This FIXME can go away when the icons are provided from the outside (see constructor).
141
+ #ifdef __serenity__
134
142
if (role == GUI::ModelRole::Icon) {
135
143
if (type == " document" )
136
144
return m_document_icon;
@@ -139,6 +147,8 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
139
147
// FIXME: More node type icons?
140
148
return m_text_icon;
141
149
}
150
+ #endif
151
+
142
152
if (role == GUI::ModelRole::Display) {
143
153
if (type == " text" )
144
154
return with_whitespace_collapsed (node.get (" text" sv).as_string ());
0 commit comments