
We currently have DOMTreeModel and AccessibilityTreeModel in LibWebView. These depend on GUI::Model and GUI::ModelIndex, which is the only reason that the non-Serenity Ladybird chromes require LibGUI. Further, these classes are very nearly idenitical. This creates a TreeModel class to provide the base functionality for all tree-based model types used by all Ladybird chromes. It contains code common to the DOM / accessibility tree models, and handles the slight differences between the two (namely, just the formatting of each node's text for display). The Qt and Serenity chromes can create thin wrappers around this class to adapt its interface to their chrome-specific model classes (i.e. QAbstractItemModel and GUI::Model).
19 lines
324 B
C++
19 lines
324 B
C++
/*
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace WebView {
|
|
|
|
struct ModelIndex {
|
|
bool is_valid() const { return row != -1 && column != -1; }
|
|
|
|
int row { -1 };
|
|
int column { -1 };
|
|
void const* internal_data { nullptr };
|
|
};
|
|
|
|
}
|