1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

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
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ enum class PaintPhase {
Background, Background,
Border, Border,
Foreground, Foreground,
FocusOutline, Outline,
Overlay, 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)); 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. // 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); 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()); 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.. // 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& line_box : m_line_boxes) {
for (auto& fragment : line_box.fragments()) { for (auto& fragment : line_box.fragments()) {
auto* node = fragment.layout_node().dom_node(); auto* node = fragment.layout_node().dom_node();

View file

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