mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
Browser+LibHTML: Add "Computed" styles to the DOM inspector
I though it would be nice to also show the style that the browser uses to display an element. In order to do that, in place of the styles table I've put a tab widget, with tabs for both element and computed element styles.
This commit is contained in:
parent
1da31ce8ae
commit
988d1deca8
5 changed files with 102 additions and 4 deletions
33
Libraries/LibHTML/DOMComputedElementStyleModel.h
Normal file
33
Libraries/LibHTML/DOMComputedElementStyleModel.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class Element;
|
||||
|
||||
class DOMComputedElementStyleModel final : public GModel {
|
||||
public:
|
||||
enum Column {
|
||||
PropertyName,
|
||||
PropertyValue,
|
||||
__Count
|
||||
};
|
||||
|
||||
static NonnullRefPtr<DOMComputedElementStyleModel> create(const Element& element) { return adopt(*new DOMComputedElementStyleModel(element)); }
|
||||
|
||||
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 DOMComputedElementStyleModel(const Element&);
|
||||
const Element& element() const { return *m_element; }
|
||||
|
||||
NonnullRefPtr<Element> m_element;
|
||||
|
||||
struct Value {
|
||||
String name;
|
||||
String value;
|
||||
};
|
||||
Vector<Value> m_values;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue