mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
Browser+LibHTML: Deduplicate inspector code
The `DOMElementStyleModel` and `DOMComputedElementStyleModel` classes were replaced by the `StylePropertiesModel`.
This commit is contained in:
parent
988d1deca8
commit
2ced4c4ec7
7 changed files with 60 additions and 145 deletions
33
Libraries/LibHTML/StylePropertiesModel.h
Normal file
33
Libraries/LibHTML/StylePropertiesModel.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class StyleProperties;
|
||||
|
||||
class StylePropertiesModel final : public GModel {
|
||||
public:
|
||||
enum Column {
|
||||
PropertyName,
|
||||
PropertyValue,
|
||||
__Count
|
||||
};
|
||||
|
||||
static NonnullRefPtr<StylePropertiesModel> create(const StyleProperties& properties) { return adopt(*new StylePropertiesModel(properties)); }
|
||||
|
||||
virtual int row_count(const GModelIndex& = GModelIndex()) const override;
|
||||
virtual int column_count(const GModelIndex& = GModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
|
||||
private:
|
||||
explicit StylePropertiesModel(const StyleProperties& properties);
|
||||
const StyleProperties& properties() const { return *m_properties; }
|
||||
|
||||
NonnullRefPtr<StyleProperties> m_properties;
|
||||
|
||||
struct Value {
|
||||
String name;
|
||||
String value;
|
||||
};
|
||||
Vector<Value> m_values;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue