From 8520afaa11f0104cfe5dc932b1ba8915782e1d55 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 2 Aug 2023 13:58:34 +0100 Subject: [PATCH] LibWeb: Rename PaintPhase::FocusOutline -> Outline Any element can have an outline, whether because of focus or not. --- Userland/Libraries/LibWeb/Painting/Paintable.h | 2 +- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 4 ++-- Userland/Libraries/LibWeb/Painting/StackingContext.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.h b/Userland/Libraries/LibWeb/Painting/Paintable.h index 857f9f65b1..0ccb448256 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.h +++ b/Userland/Libraries/LibWeb/Painting/Paintable.h @@ -23,7 +23,7 @@ enum class PaintPhase { Background, Border, Foreground, - FocusOutline, + Outline, Overlay, }; diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 4960613ae4..047991c8d7 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -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(*layout_box().dom_node()).is_focused()) { + if (phase == PaintPhase::Outline && layout_box().dom_node() && layout_box().dom_node()->is_element() && verify_cast(*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(), 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(); diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index ebce39212b..b904f74a76 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -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); }