mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
LibWeb/Painting: Remove redundant 'Painting::' namespace prefixes
This commit is contained in:
parent
36d35c9c82
commit
352da3623b
5 changed files with 25 additions and 25 deletions
|
@ -293,10 +293,10 @@ void paint_all_borders(PaintContext& context, CSSPixelRect const& bordered_rect,
|
||||||
border_color_no_alpha.set_alpha(255);
|
border_color_no_alpha.set_alpha(255);
|
||||||
|
|
||||||
// Paint the strait line part of the border:
|
// Paint the strait line part of the border:
|
||||||
Painting::paint_border(context, Painting::BorderEdge::Top, top_border_rect, border_radii_data, borders_data);
|
paint_border(context, BorderEdge::Top, top_border_rect, border_radii_data, borders_data);
|
||||||
Painting::paint_border(context, Painting::BorderEdge::Right, right_border_rect, border_radii_data, borders_data);
|
paint_border(context, BorderEdge::Right, right_border_rect, border_radii_data, borders_data);
|
||||||
Painting::paint_border(context, Painting::BorderEdge::Bottom, bottom_border_rect, border_radii_data, borders_data);
|
paint_border(context, BorderEdge::Bottom, bottom_border_rect, border_radii_data, borders_data);
|
||||||
Painting::paint_border(context, Painting::BorderEdge::Left, left_border_rect, border_radii_data, borders_data);
|
paint_border(context, BorderEdge::Left, left_border_rect, border_radii_data, borders_data);
|
||||||
|
|
||||||
if (!top_left && !top_right && !bottom_left && !bottom_right)
|
if (!top_left && !top_right && !bottom_left && !bottom_right)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,11 +29,11 @@ Layout::InlineNode const& InlinePaintable::layout_node() const
|
||||||
return static_cast<Layout::InlineNode const&>(Paintable::layout_node());
|
return static_cast<Layout::InlineNode const&>(Paintable::layout_node());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) const
|
void InlinePaintable::paint(PaintContext& context, PaintPhase phase) const
|
||||||
{
|
{
|
||||||
auto& painter = context.painter();
|
auto& painter = context.painter();
|
||||||
|
|
||||||
if (phase == Painting::PaintPhase::Background) {
|
if (phase == PaintPhase::Background) {
|
||||||
auto top_left_border_radius = computed_values().border_top_left_radius();
|
auto top_left_border_radius = computed_values().border_top_left_radius();
|
||||||
auto top_right_border_radius = computed_values().border_top_right_radius();
|
auto top_right_border_radius = computed_values().border_top_right_radius();
|
||||||
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
|
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
|
||||||
|
@ -54,11 +54,11 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
||||||
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_end_width);
|
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_end_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto border_radii_data = Painting::normalized_border_radii_data(layout_node(), absolute_fragment_rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
|
auto border_radii_data = normalized_border_radii_data(layout_node(), absolute_fragment_rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
|
||||||
Painting::paint_background(context, layout_node(), absolute_fragment_rect, computed_values().background_color(), computed_values().image_rendering(), &computed_values().background_layers(), border_radii_data);
|
paint_background(context, layout_node(), absolute_fragment_rect, computed_values().background_color(), computed_values().image_rendering(), &computed_values().background_layers(), border_radii_data);
|
||||||
|
|
||||||
if (auto computed_box_shadow = computed_values().box_shadow(); !computed_box_shadow.is_empty()) {
|
if (auto computed_box_shadow = computed_values().box_shadow(); !computed_box_shadow.is_empty()) {
|
||||||
Vector<Painting::ShadowData> resolved_box_shadow_data;
|
Vector<ShadowData> resolved_box_shadow_data;
|
||||||
resolved_box_shadow_data.ensure_capacity(computed_box_shadow.size());
|
resolved_box_shadow_data.ensure_capacity(computed_box_shadow.size());
|
||||||
for (auto const& layer : computed_box_shadow) {
|
for (auto const& layer : computed_box_shadow) {
|
||||||
resolved_box_shadow_data.empend(
|
resolved_box_shadow_data.empend(
|
||||||
|
@ -67,22 +67,22 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
||||||
layer.offset_y.to_px(layout_node()),
|
layer.offset_y.to_px(layout_node()),
|
||||||
layer.blur_radius.to_px(layout_node()),
|
layer.blur_radius.to_px(layout_node()),
|
||||||
layer.spread_distance.to_px(layout_node()),
|
layer.spread_distance.to_px(layout_node()),
|
||||||
layer.placement == CSS::ShadowPlacement::Outer ? Painting::ShadowPlacement::Outer : Painting::ShadowPlacement::Inner);
|
layer.placement == CSS::ShadowPlacement::Outer ? ShadowPlacement::Outer : ShadowPlacement::Inner);
|
||||||
}
|
}
|
||||||
Painting::paint_box_shadow(context, absolute_fragment_rect, border_radii_data, resolved_box_shadow_data);
|
paint_box_shadow(context, absolute_fragment_rect, border_radii_data, resolved_box_shadow_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (phase == Painting::PaintPhase::Border) {
|
if (phase == PaintPhase::Border) {
|
||||||
auto top_left_border_radius = computed_values().border_top_left_radius();
|
auto top_left_border_radius = computed_values().border_top_left_radius();
|
||||||
auto top_right_border_radius = computed_values().border_top_right_radius();
|
auto top_right_border_radius = computed_values().border_top_right_radius();
|
||||||
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
|
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
|
||||||
auto bottom_left_border_radius = computed_values().border_bottom_left_radius();
|
auto bottom_left_border_radius = computed_values().border_bottom_left_radius();
|
||||||
|
|
||||||
auto borders_data = Painting::BordersData {
|
auto borders_data = BordersData {
|
||||||
.top = computed_values().border_top(),
|
.top = computed_values().border_top(),
|
||||||
.right = computed_values().border_right(),
|
.right = computed_values().border_right(),
|
||||||
.bottom = computed_values().border_bottom(),
|
.bottom = computed_values().border_bottom(),
|
||||||
|
@ -106,9 +106,9 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bordered_rect = absolute_fragment_rect.inflated(borders_data.top.width, borders_data.right.width, borders_data.bottom.width, borders_data.left.width);
|
auto bordered_rect = absolute_fragment_rect.inflated(borders_data.top.width, borders_data.right.width, borders_data.bottom.width, borders_data.left.width);
|
||||||
auto border_radii_data = Painting::normalized_border_radii_data(layout_node(), bordered_rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
|
auto border_radii_data = normalized_border_radii_data(layout_node(), bordered_rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
|
||||||
|
|
||||||
Painting::paint_all_borders(context, bordered_rect, border_radii_data, borders_data);
|
paint_all_borders(context, bordered_rect, border_radii_data, borders_data);
|
||||||
|
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
@ -116,7 +116,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
||||||
|
|
||||||
// FIXME: We check for a non-null dom_node(), since pseudo-elements have a null one and were getting
|
// FIXME: We check for a non-null dom_node(), since pseudo-elements have a null one and were getting
|
||||||
// highlighted incorrectly. A better solution will be needed if we want to inspect them too.
|
// highlighted incorrectly. A better solution will be needed if we want to inspect them too.
|
||||||
if (phase == Painting::PaintPhase::Overlay && layout_node().dom_node() && layout_node().document().inspected_node() == layout_node().dom_node()) {
|
if (phase == PaintPhase::Overlay && layout_node().dom_node() && layout_node().document().inspected_node() == layout_node().dom_node()) {
|
||||||
// FIXME: This paints a double-thick border between adjacent fragments, where ideally there
|
// FIXME: This paints a double-thick border between adjacent fragments, where ideally there
|
||||||
// would be none. Once we implement non-rectangular outlines for the `outline` CSS
|
// would be none. Once we implement non-rectangular outlines for the `outline` CSS
|
||||||
// property, we can use that here instead.
|
// property, we can use that here instead.
|
||||||
|
|
|
@ -28,7 +28,7 @@ enum class PaintPhase {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HitTestResult {
|
struct HitTestResult {
|
||||||
JS::Handle<Painting::Paintable> paintable;
|
JS::Handle<Paintable> paintable;
|
||||||
int index_in_node { 0 };
|
int index_in_node { 0 };
|
||||||
|
|
||||||
enum InternalPosition {
|
enum InternalPosition {
|
||||||
|
|
|
@ -131,7 +131,7 @@ void PaintableBox::set_containing_line_box_fragment(Optional<Layout::LineBoxFrag
|
||||||
m_containing_line_box_fragment = fragment_coordinate;
|
m_containing_line_box_fragment = fragment_coordinate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Painting::StackingContext* PaintableBox::enclosing_stacking_context()
|
StackingContext* PaintableBox::enclosing_stacking_context()
|
||||||
{
|
{
|
||||||
for (auto* ancestor = layout_box().parent(); ancestor; ancestor = ancestor->parent()) {
|
for (auto* ancestor = layout_box().parent(); ancestor; ancestor = ancestor->parent()) {
|
||||||
if (!is<Layout::Box>(ancestor))
|
if (!is<Layout::Box>(ancestor))
|
||||||
|
@ -236,7 +236,7 @@ void PaintableBox::paint_backdrop_filter(PaintContext& context) const
|
||||||
{
|
{
|
||||||
auto& backdrop_filter = computed_values().backdrop_filter();
|
auto& backdrop_filter = computed_values().backdrop_filter();
|
||||||
if (!backdrop_filter.is_none())
|
if (!backdrop_filter.is_none())
|
||||||
Painting::apply_backdrop_filter(context, layout_node(), absolute_border_box_rect(), normalized_border_radii_data(), backdrop_filter);
|
apply_backdrop_filter(context, layout_node(), absolute_border_box_rect(), normalized_border_radii_data(), backdrop_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintableBox::paint_background(PaintContext& context) const
|
void PaintableBox::paint_background(PaintContext& context) const
|
||||||
|
@ -508,11 +508,11 @@ static void paint_text_decoration(PaintContext& context, Gfx::Painter& painter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void paint_text_fragment(PaintContext& context, Layout::TextNode const& text_node, Layout::LineBoxFragment const& fragment, Painting::PaintPhase phase)
|
static void paint_text_fragment(PaintContext& context, Layout::TextNode const& text_node, Layout::LineBoxFragment const& fragment, PaintPhase phase)
|
||||||
{
|
{
|
||||||
auto& painter = context.painter();
|
auto& painter = context.painter();
|
||||||
|
|
||||||
if (phase == Painting::PaintPhase::Foreground) {
|
if (phase == PaintPhase::Foreground) {
|
||||||
auto fragment_absolute_rect = fragment.absolute_rect();
|
auto fragment_absolute_rect = fragment.absolute_rect();
|
||||||
auto fragment_absolute_device_rect = context.enclosing_device_rect(fragment_absolute_rect);
|
auto fragment_absolute_device_rect = context.enclosing_device_rect(fragment_absolute_rect);
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
|
||||||
ShadowPlacement::Outer);
|
ShadowPlacement::Outer);
|
||||||
}
|
}
|
||||||
context.painter().set_font(fragment.layout_node().font());
|
context.painter().set_font(fragment.layout_node().font());
|
||||||
Painting::paint_text_shadow(context, fragment, resolved_shadow_data);
|
paint_text_shadow(context, fragment, resolved_shadow_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
|
|
||||||
StackingContext* stacking_context() { return m_stacking_context; }
|
StackingContext* stacking_context() { return m_stacking_context; }
|
||||||
StackingContext const* stacking_context() const { return m_stacking_context; }
|
StackingContext const* stacking_context() const { return m_stacking_context; }
|
||||||
void set_stacking_context(NonnullOwnPtr<Painting::StackingContext>);
|
void set_stacking_context(NonnullOwnPtr<StackingContext>);
|
||||||
StackingContext* enclosing_stacking_context();
|
StackingContext* enclosing_stacking_context();
|
||||||
|
|
||||||
DOM::Node const* dom_node() const { return layout_box().dom_node(); }
|
DOM::Node const* dom_node() const { return layout_box().dom_node(); }
|
||||||
|
@ -139,7 +139,7 @@ protected:
|
||||||
No
|
No
|
||||||
};
|
};
|
||||||
|
|
||||||
Painting::BorderRadiiData normalized_border_radii_data(ShrinkRadiiForBorders shrink = ShrinkRadiiForBorders::No) const;
|
BorderRadiiData normalized_border_radii_data(ShrinkRadiiForBorders shrink = ShrinkRadiiForBorders::No) const;
|
||||||
|
|
||||||
Vector<ShadowData> resolve_box_shadow_data() const;
|
Vector<ShadowData> resolve_box_shadow_data() const;
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ private:
|
||||||
// Some boxes hang off of line box fragments. (inline-block, inline-table, replaced, etc)
|
// Some boxes hang off of line box fragments. (inline-block, inline-table, replaced, etc)
|
||||||
Optional<Layout::LineBoxFragmentCoordinate> m_containing_line_box_fragment;
|
Optional<Layout::LineBoxFragmentCoordinate> m_containing_line_box_fragment;
|
||||||
|
|
||||||
OwnPtr<Painting::StackingContext> m_stacking_context;
|
OwnPtr<StackingContext> m_stacking_context;
|
||||||
|
|
||||||
Optional<CSSPixelRect> mutable m_absolute_rect;
|
Optional<CSSPixelRect> mutable m_absolute_rect;
|
||||||
Optional<CSSPixelRect> mutable m_absolute_paint_rect;
|
Optional<CSSPixelRect> mutable m_absolute_paint_rect;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue