summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-27 19:20:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-27 19:52:18 +0200
commit35040dd2c459f9baacd71b435a3f97ac090010a3 (patch)
treef04f2989e5f36993ee0fb4fa604ed9b2432d4e68 /Libraries/LibWeb
parenta8f0e4d56e70013803c09943ffb33e4d86c768fa (diff)
downloadserenity-35040dd2c459f9baacd71b435a3f97ac090010a3.zip
LibWeb: LayoutMode line_break_policy => LayoutMode layout_mode
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r--Libraries/LibWeb/Layout/LayoutBlock.cpp28
-rw-r--r--Libraries/LibWeb/Layout/LayoutCanvas.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutDocument.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutImage.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutListItem.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutNode.cpp8
-rw-r--r--Libraries/LibWeb/Layout/LayoutReplaced.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutTable.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutTableRow.cpp4
-rw-r--r--Libraries/LibWeb/Layout/LayoutText.cpp14
-rw-r--r--Libraries/LibWeb/Layout/LayoutWidget.cpp4
11 files changed, 41 insertions, 41 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp
index aa525c186a..6886fb3671 100644
--- a/Libraries/LibWeb/Layout/LayoutBlock.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp
@@ -53,27 +53,27 @@ LayoutNode& LayoutBlock::inline_wrapper()
return *last_child();
}
-void LayoutBlock::layout(LayoutMode line_break_policy)
+void LayoutBlock::layout(LayoutMode layout_mode)
{
compute_width();
if (!is_inline())
compute_position();
- layout_children(line_break_policy);
+ layout_children(layout_mode);
compute_height();
}
-void LayoutBlock::layout_children(LayoutMode line_break_policy)
+void LayoutBlock::layout_children(LayoutMode layout_mode)
{
if (children_are_inline())
- layout_inline_children(line_break_policy);
+ layout_inline_children(layout_mode);
else
- layout_block_children(line_break_policy);
+ layout_block_children(layout_mode);
}
-void LayoutBlock::layout_block_children(LayoutMode line_break_policy)
+void LayoutBlock::layout_block_children(LayoutMode layout_mode)
{
ASSERT(!children_are_inline());
float content_height = 0;
@@ -82,10 +82,10 @@ void LayoutBlock::layout_block_children(LayoutMode line_break_policy)
if (child.is_inline())
return;
auto& child_block = static_cast<LayoutBlock&>(child);
- child_block.layout(line_break_policy);
+ child_block.layout(layout_mode);
content_height = child_block.rect().bottom() + child_block.box_model().full_margin().bottom - rect().top();
});
- if (line_break_policy != LayoutMode::Default) {
+ if (layout_mode != LayoutMode::Default) {
float max_width = 0;
for_each_child([&](auto& child) {
if (child.is_box())
@@ -96,13 +96,13 @@ void LayoutBlock::layout_block_children(LayoutMode line_break_policy)
rect().set_height(content_height);
}
-void LayoutBlock::layout_inline_children(LayoutMode line_break_policy)
+void LayoutBlock::layout_inline_children(LayoutMode layout_mode)
{
ASSERT(children_are_inline());
m_line_boxes.clear();
for_each_child([&](auto& child) {
ASSERT(child.is_inline());
- child.split_into_lines(*this, line_break_policy);
+ child.split_into_lines(*this, layout_mode);
});
for (auto& line_box : m_line_boxes) {
@@ -188,7 +188,7 @@ void LayoutBlock::layout_inline_children(LayoutMode line_break_policy)
if (fragment.layout_node().is_inline_block()) {
auto& inline_block = const_cast<LayoutBlock&>(to<LayoutBlock>(fragment.layout_node()));
inline_block.set_rect(fragment.rect());
- inline_block.layout(line_break_policy);
+ inline_block.layout(layout_mode);
}
float final_line_box_width = 0;
@@ -202,7 +202,7 @@ void LayoutBlock::layout_inline_children(LayoutMode line_break_policy)
content_height += max_height;
}
- if (line_break_policy != LayoutMode::Default) {
+ if (layout_mode != LayoutMode::Default) {
rect().set_width(max_linebox_width);
}
@@ -501,11 +501,11 @@ LineBox& LayoutBlock::add_line_box()
return m_line_boxes.last();
}
-void LayoutBlock::split_into_lines(LayoutBlock& container, LayoutMode line_break_policy)
+void LayoutBlock::split_into_lines(LayoutBlock& container, LayoutMode layout_mode)
{
ASSERT(is_inline());
- layout(line_break_policy);
+ layout(layout_mode);
auto* line_box = &container.ensure_last_line_box();
if (line_box->width() > 0 && line_box->width() + width() > container.width())
diff --git a/Libraries/LibWeb/Layout/LayoutCanvas.cpp b/Libraries/LibWeb/Layout/LayoutCanvas.cpp
index 820ca07dfe..15ac24c297 100644
--- a/Libraries/LibWeb/Layout/LayoutCanvas.cpp
+++ b/Libraries/LibWeb/Layout/LayoutCanvas.cpp
@@ -40,11 +40,11 @@ LayoutCanvas::~LayoutCanvas()
{
}
-void LayoutCanvas::layout(LayoutMode line_break_policy)
+void LayoutCanvas::layout(LayoutMode layout_mode)
{
rect().set_width(node().requested_width());
rect().set_height(node().requested_height());
- LayoutReplaced::layout(line_break_policy);
+ LayoutReplaced::layout(layout_mode);
}
void LayoutCanvas::render(RenderingContext& context)
diff --git a/Libraries/LibWeb/Layout/LayoutDocument.cpp b/Libraries/LibWeb/Layout/LayoutDocument.cpp
index 7e6b77fe09..278a509c92 100644
--- a/Libraries/LibWeb/Layout/LayoutDocument.cpp
+++ b/Libraries/LibWeb/Layout/LayoutDocument.cpp
@@ -40,12 +40,12 @@ LayoutDocument::~LayoutDocument()
{
}
-void LayoutDocument::layout(LayoutMode line_break_policy)
+void LayoutDocument::layout(LayoutMode layout_mode)
{
ASSERT(document().frame());
rect().set_width(document().frame()->size().width());
- LayoutNode::layout(line_break_policy);
+ LayoutNode::layout(layout_mode);
ASSERT(!children_are_inline());
diff --git a/Libraries/LibWeb/Layout/LayoutImage.cpp b/Libraries/LibWeb/Layout/LayoutImage.cpp
index d12246e4c9..f386372d80 100644
--- a/Libraries/LibWeb/Layout/LayoutImage.cpp
+++ b/Libraries/LibWeb/Layout/LayoutImage.cpp
@@ -40,7 +40,7 @@ LayoutImage::~LayoutImage()
{
}
-void LayoutImage::layout(LayoutMode line_break_policy)
+void LayoutImage::layout(LayoutMode layout_mode)
{
if (node().preferred_width() && node().preferred_height()) {
rect().set_width(node().preferred_width());
@@ -57,7 +57,7 @@ void LayoutImage::layout(LayoutMode line_break_policy)
rect().set_height(16);
}
- LayoutReplaced::layout(line_break_policy);
+ LayoutReplaced::layout(layout_mode);
}
void LayoutImage::render(RenderingContext& context)
diff --git a/Libraries/LibWeb/Layout/LayoutListItem.cpp b/Libraries/LibWeb/Layout/LayoutListItem.cpp
index c82c2cea08..0a1d2b9932 100644
--- a/Libraries/LibWeb/Layout/LayoutListItem.cpp
+++ b/Libraries/LibWeb/Layout/LayoutListItem.cpp
@@ -38,14 +38,14 @@ LayoutListItem::~LayoutListItem()
{
}
-void LayoutListItem::layout(LayoutMode line_break_policy)
+void LayoutListItem::layout(LayoutMode layout_mode)
{
if (m_marker) {
remove_child(*m_marker);
m_marker = nullptr;
}
- LayoutBlock::layout(line_break_policy);
+ LayoutBlock::layout(layout_mode);
if (!m_marker) {
m_marker = adopt(*new LayoutListItemMarker);
diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp
index c784ac302c..678e49b8b9 100644
--- a/Libraries/LibWeb/Layout/LayoutNode.cpp
+++ b/Libraries/LibWeb/Layout/LayoutNode.cpp
@@ -46,10 +46,10 @@ LayoutNode::~LayoutNode()
m_node->set_layout_node({}, nullptr);
}
-void LayoutNode::layout(LayoutMode line_break_policy)
+void LayoutNode::layout(LayoutMode layout_mode)
{
for_each_child([&](auto& child) {
- child.layout(line_break_policy);
+ child.layout(layout_mode);
});
}
@@ -111,11 +111,11 @@ LayoutDocument& LayoutNode::root()
return *document().layout_node();
}
-void LayoutNode::split_into_lines(LayoutBlock& container, LayoutMode line_break_policy)
+void LayoutNode::split_into_lines(LayoutBlock& container, LayoutMode layout_mode)
{
for_each_child([&](auto& child) {
if (child.is_inline()) {
- child.split_into_lines(container, line_break_policy);
+ child.split_into_lines(container, layout_mode);
} else {
// FIXME: Support block children of inlines.
}
diff --git a/Libraries/LibWeb/Layout/LayoutReplaced.cpp b/Libraries/LibWeb/Layout/LayoutReplaced.cpp
index 904cf9769a..f4cddfcb86 100644
--- a/Libraries/LibWeb/Layout/LayoutReplaced.cpp
+++ b/Libraries/LibWeb/Layout/LayoutReplaced.cpp
@@ -41,9 +41,9 @@ LayoutReplaced::~LayoutReplaced()
{
}
-void LayoutReplaced::split_into_lines(LayoutBlock& container, LayoutMode line_break_policy)
+void LayoutReplaced::split_into_lines(LayoutBlock& container, LayoutMode layout_mode)
{
- layout(line_break_policy);
+ layout(layout_mode);
auto* line_box = &container.ensure_last_line_box();
if (line_box->width() > 0 && line_box->width() + width() > container.width())
diff --git a/Libraries/LibWeb/Layout/LayoutTable.cpp b/Libraries/LibWeb/Layout/LayoutTable.cpp
index 8ad59649c0..44b741107a 100644
--- a/Libraries/LibWeb/Layout/LayoutTable.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTable.cpp
@@ -39,9 +39,9 @@ LayoutTable::~LayoutTable()
{
}
-void LayoutTable::layout(LayoutMode line_break_policy)
+void LayoutTable::layout(LayoutMode layout_mode)
{
- LayoutBlock::layout(line_break_policy);
+ LayoutBlock::layout(layout_mode);
}
LayoutTableRow* LayoutTable::first_row()
diff --git a/Libraries/LibWeb/Layout/LayoutTableRow.cpp b/Libraries/LibWeb/Layout/LayoutTableRow.cpp
index 9d0920d754..44f9209783 100644
--- a/Libraries/LibWeb/Layout/LayoutTableRow.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTableRow.cpp
@@ -39,9 +39,9 @@ LayoutTableRow::~LayoutTableRow()
{
}
-void LayoutTableRow::layout(LayoutMode line_break_policy)
+void LayoutTableRow::layout(LayoutMode layout_mode)
{
- LayoutBox::layout(line_break_policy);
+ LayoutBox::layout(layout_mode);
}
LayoutTableCell* LayoutTableRow::first_cell()
diff --git a/Libraries/LibWeb/Layout/LayoutText.cpp b/Libraries/LibWeb/Layout/LayoutText.cpp
index a1d70087d3..e4cdd4c4bd 100644
--- a/Libraries/LibWeb/Layout/LayoutText.cpp
+++ b/Libraries/LibWeb/Layout/LayoutText.cpp
@@ -95,7 +95,7 @@ void LayoutText::render_fragment(RenderingContext& context, const LineBoxFragmen
}
template<typename Callback>
-void LayoutText::for_each_chunk(Callback callback, LayoutMode line_break_policy, bool do_wrap_lines, bool do_wrap_breaks) const
+void LayoutText::for_each_chunk(Callback callback, LayoutMode layout_mode, bool do_wrap_lines, bool do_wrap_breaks) const
{
Utf8View view(m_text_for_rendering);
if (view.is_empty())
@@ -104,7 +104,7 @@ void LayoutText::for_each_chunk(Callback callback, LayoutMode line_break_policy,
auto start_of_chunk = view.begin();
auto commit_chunk = [&](auto it, bool has_breaking_newline, bool must_commit = false) {
- if (line_break_policy == LayoutMode::OnlyRequiredLineBreaks && !must_commit)
+ if (layout_mode == LayoutMode::OnlyRequiredLineBreaks && !must_commit)
return;
int start = view.byte_offset_of(start_of_chunk);
@@ -120,7 +120,7 @@ void LayoutText::for_each_chunk(Callback callback, LayoutMode line_break_policy,
bool last_was_space = isspace(*view.begin());
bool last_was_newline = false;
for (auto it = view.begin(); it != view.end();) {
- if (line_break_policy == LayoutMode::AllPossibleLineBreaks) {
+ if (layout_mode == LayoutMode::AllPossibleLineBreaks) {
commit_chunk(it, false);
}
if (last_was_newline) {
@@ -146,7 +146,7 @@ void LayoutText::for_each_chunk(Callback callback, LayoutMode line_break_policy,
commit_chunk(view.end(), false, true);
}
-void LayoutText::split_into_lines_by_rules(LayoutBlock& container, LayoutMode line_break_policy, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks)
+void LayoutText::split_into_lines_by_rules(LayoutBlock& container, LayoutMode layout_mode, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks)
{
auto& font = style().font();
float space_width = font.glyph_width(' ') + font.glyph_spacing();
@@ -192,7 +192,7 @@ void LayoutText::split_into_lines_by_rules(LayoutBlock& container, LayoutMode li
[&](const Utf8View& view, int start, int length, bool is_break) {
chunks.append({ Utf8View(view), start, length, is_break });
},
- line_break_policy, do_wrap_lines, do_wrap_breaks);
+ layout_mode, do_wrap_lines, do_wrap_breaks);
for (size_t i = 0; i < chunks.size(); ++i) {
auto& chunk = chunks[i];
@@ -236,7 +236,7 @@ void LayoutText::split_into_lines_by_rules(LayoutBlock& container, LayoutMode li
}
}
-void LayoutText::split_into_lines(LayoutBlock& container, LayoutMode line_break_policy)
+void LayoutText::split_into_lines(LayoutBlock& container, LayoutMode layout_mode)
{
bool do_collapse = true;
bool do_wrap_lines = true;
@@ -261,7 +261,7 @@ void LayoutText::split_into_lines(LayoutBlock& container, LayoutMode line_break_
do_wrap_breaks = true;
}
- split_into_lines_by_rules(container, line_break_policy, do_collapse, do_wrap_lines, do_wrap_breaks);
+ split_into_lines_by_rules(container, layout_mode, do_collapse, do_wrap_lines, do_wrap_breaks);
}
}
diff --git a/Libraries/LibWeb/Layout/LayoutWidget.cpp b/Libraries/LibWeb/Layout/LayoutWidget.cpp
index acc02befcc..72ef5a0c07 100644
--- a/Libraries/LibWeb/Layout/LayoutWidget.cpp
+++ b/Libraries/LibWeb/Layout/LayoutWidget.cpp
@@ -43,10 +43,10 @@ LayoutWidget::~LayoutWidget()
widget().remove_from_parent();
}
-void LayoutWidget::layout(LayoutMode line_break_policy)
+void LayoutWidget::layout(LayoutMode layout_mode)
{
rect().set_size(widget().width(), widget().height());
- LayoutReplaced::layout(line_break_policy);
+ LayoutReplaced::layout(layout_mode);
widget().move_to(rect().x(), rect().y());
}