LibWeb: Rename PaintPhase::FocusOutline -> Outline

Any element can have an outline, whether because of focus or not.
This commit is contained in:
Sam Atkins 2023-08-02 13:58:34 +01:00 committed by Andreas Kling
parent 9e5c7abd94
commit 8520afaa11
Notes: sideshowbarker 2024-07-17 14:33:07 +09:00
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ enum class PaintPhase {
Background,
Border,
Foreground,
FocusOutline,
Outline,
Overlay,
};

View file

@ -217,7 +217,7 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
context.painter().draw_text(size_text_device_rect, size_text, font, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText));
}
if (phase == PaintPhase::FocusOutline && layout_box().dom_node() && layout_box().dom_node()->is_element() && verify_cast<DOM::Element>(*layout_box().dom_node()).is_focused()) {
if (phase == PaintPhase::Outline && layout_box().dom_node() && layout_box().dom_node()->is_element() && verify_cast<DOM::Element>(*layout_box().dom_node()).is_focused()) {
// FIXME: Implement this as `outline` using :focus-visible in the default UA stylesheet to make it possible to override/disable.
auto focus_outline_rect = context.enclosing_device_rect(absolute_border_box_rect()).inflated(4, 4);
context.painter().draw_focus_rect(focus_outline_rect.to_type<int>(), context.palette().focus_outline());
@ -641,7 +641,7 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
}
// FIXME: Merge this loop with the above somehow..
if (phase == PaintPhase::FocusOutline) {
if (phase == PaintPhase::Outline) {
for (auto& line_box : m_line_boxes) {
for (auto& fragment : line_box.fragments()) {
auto* node = fragment.layout_node().dom_node();

View file

@ -125,7 +125,7 @@ void StackingContext::paint_descendants(PaintContext& context, Layout::Node cons
break;
case StackingContextPaintPhase::FocusAndOverlay:
if (context.has_focus()) {
paint_node(child, context, PaintPhase::FocusOutline);
paint_node(child, context, PaintPhase::Outline);
}
paint_node(child, context, PaintPhase::Overlay);
paint_descendants(context, child, phase);
@ -213,7 +213,7 @@ void StackingContext::paint_internal(PaintContext& context) const
paint_descendants(context, layout_node, StackingContextPaintPhase::BackgroundAndBordersForInlineLevelAndReplaced);
paint_node(layout_node, context, PaintPhase::Foreground);
paint_descendants(context, layout_node, StackingContextPaintPhase::Foreground);
paint_node(layout_node, context, PaintPhase::FocusOutline);
paint_node(layout_node, context, PaintPhase::Outline);
paint_node(layout_node, context, PaintPhase::Overlay);
paint_descendants(context, layout_node, StackingContextPaintPhase::FocusAndOverlay);
if (parent_paintable)
@ -230,7 +230,7 @@ void StackingContext::paint_internal(PaintContext& context) const
paint_child(child);
}
paint_node(m_box, context, PaintPhase::FocusOutline);
paint_node(m_box, context, PaintPhase::Outline);
paint_node(m_box, context, PaintPhase::Overlay);
paint_descendants(context, m_box, StackingContextPaintPhase::FocusAndOverlay);
}