mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
LibHTML: Paint a magenta rectangle around the currently inspected node
Document now tracks one "inspected" node, set by set_inspected_node() which is called by Browser's DOM inspector view on_selection callback.
This commit is contained in:
parent
7fcb21c935
commit
70a4678d77
5 changed files with 30 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <LibCore/CDirIterator.h>
|
||||
#include <LibDraw/Font.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibHTML/DOM/Document.h>
|
||||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
#include <LibHTML/Layout/LayoutText.h>
|
||||
#include <ctype.h>
|
||||
|
@ -44,6 +45,9 @@ void LayoutText::render_fragment(RenderingContext& context, const LineBoxFragmen
|
|||
auto color = style().color_or_fallback(CSS::PropertyID::Color, document(), Color::Black);
|
||||
auto text_decoration = style().string_or_fallback(CSS::PropertyID::TextDecoration, "none");
|
||||
|
||||
if (document().inspected_node() == &node())
|
||||
context.painter().draw_rect(enclosing_int_rect(fragment.rect()), Color::Magenta);
|
||||
|
||||
bool is_underline = text_decoration == "underline";
|
||||
if (is_underline)
|
||||
painter.draw_line(enclosing_int_rect(fragment.rect()).bottom_left().translated(0, -1), enclosing_int_rect(fragment.rect()).bottom_right().translated(0, -1), color);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue