mirror of
https://github.com/RGBCube/serenity
synced 2025-07-04 15:17:35 +00:00
LibGUI: Move GUI::Model::Role to GUI::ModelRole
This is preparation for using ModelRole in the ModelIndex API.
This commit is contained in:
parent
f6d7204689
commit
a1e381a0f8
66 changed files with 201 additions and 167 deletions
|
@ -115,10 +115,10 @@ static String with_whitespace_collapsed(const StringView& string)
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, Role role) const
|
||||
GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
auto& node = *static_cast<DOM::Node*>(index.internal_data());
|
||||
if (role == Role::Icon) {
|
||||
if (role == GUI::ModelRole::Icon) {
|
||||
if (node.is_document())
|
||||
return m_document_icon;
|
||||
if (node.is_element())
|
||||
|
@ -126,7 +126,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, Role role) const
|
|||
// FIXME: More node type icons?
|
||||
return m_text_icon;
|
||||
}
|
||||
if (role == Role::Display) {
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
if (node.is_text())
|
||||
return String::format("%s", with_whitespace_collapsed(downcast<DOM::Text>(node).data()).characters());
|
||||
if (!node.is_element())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue