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

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -27,7 +27,7 @@ bool BlockContainer::is_scrollable() const
return computed_values().overflow_y() == CSS::Overflow::Scroll;
}
void BlockContainer::set_scroll_offset(const Gfx::FloatPoint& offset)
void BlockContainer::set_scroll_offset(Gfx::FloatPoint const& offset)
{
// FIXME: If there is horizontal and vertical scroll ignore only part of the new offset
if (offset.y() < 0 || m_scroll_offset == offset)

View file

@ -19,13 +19,13 @@ public:
virtual ~BlockContainer() override;
BlockContainer* previous_sibling() { return verify_cast<BlockContainer>(Node::previous_sibling()); }
const BlockContainer* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); }
BlockContainer const* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); }
BlockContainer* next_sibling() { return verify_cast<BlockContainer>(Node::next_sibling()); }
const BlockContainer* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); }
BlockContainer const* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); }
bool is_scrollable() const;
const Gfx::FloatPoint& scroll_offset() const { return m_scroll_offset; }
void set_scroll_offset(const Gfx::FloatPoint&);
Gfx::FloatPoint const& scroll_offset() const { return m_scroll_offset; }
void set_scroll_offset(Gfx::FloatPoint const&);
Painting::PaintableWithLines const* paint_box() const;

View file

@ -115,10 +115,10 @@ void BlockFormattingContext::compute_width(Box const& box, LayoutMode layout_mod
auto margin_left = CSS::Length::make_auto();
auto margin_right = CSS::Length::make_auto();
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
auto try_compute_width = [&](const auto& a_width) {
auto try_compute_width = [&](auto const& a_width) {
CSS::Length width = a_width;
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box);
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box);
@ -253,8 +253,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Layo
auto margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box);
auto margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box);
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
// If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
if (margin_left.is_auto())

View file

@ -29,7 +29,7 @@ FormattingContext::FormattingContext(Type type, FormattingState& state, Box cons
FormattingContext::~FormattingContext() = default;
bool FormattingContext::creates_block_formatting_context(const Box& box)
bool FormattingContext::creates_block_formatting_context(Box const& box)
{
if (box.is_root_element())
return true;
@ -472,12 +472,12 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
auto margin_left = CSS::Length::make_auto();
auto margin_right = CSS::Length::make_auto();
const auto border_left = computed_values.border_left().width;
const auto border_right = computed_values.border_right().width;
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box);
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box);
auto const border_left = computed_values.border_left().width;
auto const border_right = computed_values.border_right().width;
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box);
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box);
auto try_compute_width = [&](const auto& a_width) {
auto try_compute_width = [&](auto const& a_width) {
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box);
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block).resolved(box);

View file

@ -29,14 +29,14 @@ public:
Box const& context_box() const { return m_context_box; }
FormattingContext* parent() { return m_parent; }
const FormattingContext* parent() const { return m_parent; }
FormattingContext const* parent() const { return m_parent; }
Type type() const { return m_type; }
bool is_block_formatting_context() const { return type() == Type::Block; }
virtual bool inhibits_floating() const { return false; }
static bool creates_block_formatting_context(const Box&);
static bool creates_block_formatting_context(Box const&);
static float compute_width_for_replaced_element(FormattingState const&, ReplacedBox const&);
static float compute_height_for_replaced_element(FormattingState const&, ReplacedBox const&);

View file

@ -12,7 +12,7 @@
namespace Web::Layout {
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, const ImageLoader& image_loader)
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, ImageLoader const& image_loader)
: ReplacedBox(document, element, move(style))
, m_image_loader(image_loader)
{

View file

@ -16,7 +16,7 @@ class ImageBox
: public ReplacedBox
, public HTML::BrowsingContext::ViewportClient {
public:
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&);
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, ImageLoader const&);
virtual ~ImageBox() override;
virtual void prepare_for_replaced_layout() override;
@ -36,7 +36,7 @@ private:
int preferred_width() const;
int preferred_height() const;
const ImageLoader& m_image_loader;
ImageLoader const& m_image_loader;
};
}

View file

@ -78,13 +78,13 @@ void InitialContainingBlock::recompute_selection_states()
});
}
void InitialContainingBlock::set_selection(const LayoutRange& selection)
void InitialContainingBlock::set_selection(LayoutRange const& selection)
{
m_selection = selection;
recompute_selection_states();
}
void InitialContainingBlock::set_selection_end(const LayoutPosition& position)
void InitialContainingBlock::set_selection_end(LayoutPosition const& position)
{
m_selection.set_end(position);
recompute_selection_states();

View file

@ -20,9 +20,9 @@ public:
void paint_all_phases(PaintContext&);
const LayoutRange& selection() const { return m_selection; }
void set_selection(const LayoutRange&);
void set_selection_end(const LayoutPosition&);
LayoutRange const& selection() const { return m_selection; }
void set_selection(LayoutRange const&);
void set_selection_end(LayoutPosition const&);
void build_stacking_context_tree_if_needed();
void recompute_selection_states();

View file

@ -65,7 +65,7 @@ void Label::handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPo
}
}
bool Label::is_inside_associated_label(LabelableNode const& control, const Gfx::IntPoint& position)
bool Label::is_inside_associated_label(LabelableNode const& control, Gfx::IntPoint const& position)
{
if (auto* label = label_for_control_node(control); label)
return enclosing_int_rect(label->paint_box()->absolute_rect()).contains(position);

View file

@ -22,9 +22,9 @@ public:
const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
void handle_mousedown_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
void handle_mouseup_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
void handle_mousemove_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
void handle_mousedown_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
void handle_mouseup_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
void handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
LabelableNode* labeled_control();

View file

@ -24,7 +24,7 @@ struct LayoutPosition {
class LayoutRange {
public:
LayoutRange() = default;
LayoutRange(const LayoutPosition& start, const LayoutPosition& end)
LayoutRange(LayoutPosition const& start, LayoutPosition const& end)
: m_start(start)
, m_end(end)
{
@ -32,18 +32,18 @@ public:
bool is_valid() const { return m_start.layout_node && m_end.layout_node; }
void set(const LayoutPosition& start, const LayoutPosition& end)
void set(LayoutPosition const& start, LayoutPosition const& end)
{
m_start = start;
m_end = end;
}
void set_start(const LayoutPosition& start) { m_start = start; }
void set_end(const LayoutPosition& end) { m_end = end; }
void set_start(LayoutPosition const& start) { m_start = start; }
void set_end(LayoutPosition const& end) { m_end = end; }
const LayoutPosition& start() const { return m_start; }
LayoutPosition const& start() const { return m_start; }
LayoutPosition& start() { return m_start; }
const LayoutPosition& end() const { return m_end; }
LayoutPosition const& end() const { return m_end; }
LayoutPosition& end() { return m_end; }
LayoutRange normalized() const;

View file

@ -65,7 +65,7 @@ int LineBoxFragment::text_index_at(float x) const
return m_start + m_length;
}
Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const
Gfx::FloatRect LineBoxFragment::selection_rect(Gfx::Font const& font) const
{
if (layout_node().selection_state() == Node::SelectionState::None)
return {};
@ -79,8 +79,8 @@ Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const
if (!is<TextNode>(layout_node()))
return {};
const auto start_index = m_start;
const auto end_index = m_start + m_length;
auto const start_index = m_start;
auto const end_index = m_start + m_length;
auto text = this->text();
if (layout_node().selection_state() == Node::SelectionState::StartAndEnd) {

View file

@ -40,14 +40,14 @@ public:
const Gfx::FloatRect absolute_rect() const;
Type type() const { return m_type; }
const Gfx::FloatPoint& offset() const { return m_offset; }
void set_offset(const Gfx::FloatPoint& offset) { m_offset = offset; }
Gfx::FloatPoint const& offset() const { return m_offset; }
void set_offset(Gfx::FloatPoint const& offset) { m_offset = offset; }
// The baseline of a fragment is the number of pixels from the top to the text baseline.
void set_baseline(float y) { m_baseline = y; }
float baseline() const { return m_baseline; }
const Gfx::FloatSize& size() const { return m_size; }
Gfx::FloatSize const& size() const { return m_size; }
void set_width(float width) { m_size.set_width(width); }
void set_height(float height) { m_size.set_height(height); }
float width() const { return m_size.width(); }
@ -65,7 +65,7 @@ public:
int text_index_at(float x) const;
Gfx::FloatRect selection_rect(const Gfx::Font&) const;
Gfx::FloatRect selection_rect(Gfx::Font const&) const;
float height_of_inline_level_box(FormattingState const&) const;
float top_of_inline_level_box(FormattingState const&) const;

View file

@ -54,7 +54,7 @@ bool Node::can_contain_boxes_with_position_absolute() const
return computed_values().position() != CSS::Position::Static || is<InitialContainingBlock>(*this);
}
const BlockContainer* Node::containing_block() const
BlockContainer const* Node::containing_block() const
{
if (is<TextNode>(*this))
return first_ancestor_of_type<BlockContainer>();
@ -67,7 +67,7 @@ const BlockContainer* Node::containing_block() const
ancestor = ancestor->parent();
while (ancestor && (!is<BlockContainer>(*ancestor) || ancestor->is_anonymous()))
ancestor = ancestor->containing_block();
return static_cast<const BlockContainer*>(ancestor);
return static_cast<BlockContainer const*>(ancestor);
}
if (position == CSS::Position::Fixed)
@ -102,7 +102,7 @@ HTML::BrowsingContext& Node::browsing_context()
return *document().browsing_context();
}
const InitialContainingBlock& Node::root() const
InitialContainingBlock const& Node::root() const
{
VERIFY(document().layout_node());
return *document().layout_node();

View file

@ -57,7 +57,7 @@ public:
HTML::BrowsingContext const& browsing_context() const;
HTML::BrowsingContext& browsing_context();
const InitialContainingBlock& root() const;
InitialContainingBlock const& root() const;
InitialContainingBlock& root();
bool is_root_element() const;
@ -99,19 +99,19 @@ public:
bool is_flex_item() const { return m_is_flex_item; }
void set_flex_item(bool b) { m_is_flex_item = b; }
const BlockContainer* containing_block() const;
BlockContainer* containing_block() { return const_cast<BlockContainer*>(const_cast<const Node*>(this)->containing_block()); }
BlockContainer const* containing_block() const;
BlockContainer* containing_block() { return const_cast<BlockContainer*>(const_cast<Node const*>(this)->containing_block()); }
bool establishes_stacking_context() const;
bool can_contain_boxes_with_position_absolute() const;
const Gfx::Font& font() const;
Gfx::Font const& font() const;
const CSS::ImmutableComputedValues& computed_values() const;
float line_height() const;
NodeWithStyle* parent();
const NodeWithStyle* parent() const;
NodeWithStyle const* parent() const;
void inserted_into(Node&) { }
void removed_from(Node&) { }
@ -165,7 +165,7 @@ public:
void apply_style(const CSS::StyleProperties&);
const Gfx::Font& font() const { return *m_font; }
Gfx::Font const& font() const { return *m_font; }
float line_height() const { return m_line_height; }
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
const CSS::ImageStyleValue* list_style_image() const { return m_list_style_image; }
@ -197,7 +197,7 @@ private:
class NodeWithStyleAndBoxModelMetrics : public NodeWithStyle {
public:
BoxModelMetrics& box_model() { return m_box_model; }
const BoxModelMetrics& box_model() const { return m_box_model; }
BoxModelMetrics const& box_model() const { return m_box_model; }
protected:
NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
@ -214,17 +214,17 @@ private:
BoxModelMetrics m_box_model;
};
inline const Gfx::Font& Node::font() const
inline Gfx::Font const& Node::font() const
{
if (m_has_style)
return static_cast<const NodeWithStyle*>(this)->font();
return static_cast<NodeWithStyle const*>(this)->font();
return parent()->font();
}
inline const CSS::ImmutableComputedValues& Node::computed_values() const
{
if (m_has_style)
return static_cast<const NodeWithStyle*>(this)->computed_values();
return static_cast<NodeWithStyle const*>(this)->computed_values();
return parent()->computed_values();
}
@ -235,9 +235,9 @@ inline float Node::line_height() const
return parent()->line_height();
}
inline const NodeWithStyle* Node::parent() const
inline NodeWithStyle const* Node::parent() const
{
return static_cast<const NodeWithStyle*>(TreeNode<Node>::parent());
return static_cast<NodeWithStyle const*>(TreeNode<Node>::parent());
}
inline NodeWithStyle* Node::parent()

View file

@ -17,7 +17,7 @@ public:
virtual ~TableCellBox() override;
TableCellBox* next_cell() { return next_sibling_of_type<TableCellBox>(); }
const TableCellBox* next_cell() const { return next_sibling_of_type<TableCellBox>(); }
TableCellBox const* next_cell() const { return next_sibling_of_type<TableCellBox>(); }
size_t colspan() const;

View file

@ -21,7 +21,7 @@ public:
const DOM::Text& dom_node() const { return static_cast<const DOM::Text&>(*Node::dom_node()); }
const String& text_for_rendering() const { return m_text_for_rendering; }
String const& text_for_rendering() const { return m_text_for_rendering; }
struct Chunk {
Utf8View view;
@ -40,8 +40,8 @@ public:
Optional<Chunk> try_commit_chunk(Utf8View::Iterator const& start, Utf8View::Iterator const& end, bool has_breaking_newline, bool must_commit = false) const;
const LayoutMode m_layout_mode;
const bool m_wrap_lines;
const bool m_respect_linebreaks;
bool const m_wrap_lines;
bool const m_respect_linebreaks;
Utf8View m_utf8_view;
Utf8View::Iterator m_iterator;
};

View file

@ -343,7 +343,7 @@ static bool is_table_track_group(CSS::Display display)
|| display.is_table_column_group();
}
static bool is_not_proper_table_child(const Node& node)
static bool is_not_proper_table_child(Node const& node)
{
if (!node.has_style())
return true;
@ -351,7 +351,7 @@ static bool is_not_proper_table_child(const Node& node)
return !is_table_track_group(display) && !is_table_track(display) && !display.is_table_caption();
}
static bool is_not_table_row(const Node& node)
static bool is_not_table_row(Node const& node)
{
if (!node.has_style())
return true;
@ -359,7 +359,7 @@ static bool is_not_table_row(const Node& node)
return !display.is_table_row();
}
static bool is_not_table_cell(const Node& node)
static bool is_not_table_cell(Node const& node)
{
if (!node.has_style())
return true;