mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
Browser+LibWeb+WebContent: Show style for pseudo-elements :^)
This expands the InspectorWidget::Selection to include an optional PseudoElement, which is then passed over IPC to request style information for it. As noted, this has some pretty big limitations because pseudo-elements don't have DOM nodes: - Declared style has to be recalculated when it's requested. - We don't display the computed style. - We don't display custom properties.
This commit is contained in:
parent
2c970b9516
commit
0326ad34df
9 changed files with 69 additions and 20 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "ElementSizePreviewWidget.h"
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Layout/BoxModelMetrics.h>
|
||||
|
||||
|
@ -20,14 +21,17 @@ class InspectorWidget final : public GUI::Widget {
|
|||
public:
|
||||
struct Selection {
|
||||
i32 dom_node_id { 0 };
|
||||
Optional<Web::CSS::Selector::PseudoElement> pseudo_element {};
|
||||
|
||||
bool operator==(Selection const& other) const
|
||||
{
|
||||
return dom_node_id == other.dom_node_id;
|
||||
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
|
||||
}
|
||||
|
||||
String to_string() const
|
||||
{
|
||||
if (pseudo_element.has_value())
|
||||
return String::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||
return String::formatted("id: {}", dom_node_id);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue