mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
LibHTML: Add some convenient geometry getters on LayoutNode
Add x(), y(), size() and position() and use them around the codebase.
This commit is contained in:
parent
aefc7f9b22
commit
3309bdf722
7 changed files with 26 additions and 22 deletions
|
@ -128,7 +128,7 @@ void LayoutText::split_into_lines(LayoutBlock& container)
|
|||
auto& line_boxes = container.line_boxes();
|
||||
if (line_boxes.is_empty())
|
||||
line_boxes.append(LineBox());
|
||||
int available_width = container.rect().width() - line_boxes.last().width();
|
||||
int available_width = container.width() - line_boxes.last().width();
|
||||
|
||||
bool is_preformatted = style().string_or_fallback(CSS::PropertyID::WhiteSpace, "normal") == "pre";
|
||||
if (is_preformatted) {
|
||||
|
@ -179,7 +179,7 @@ void LayoutText::split_into_lines(LayoutBlock& container)
|
|||
|
||||
if (word_width > available_width) {
|
||||
line_boxes.append(LineBox());
|
||||
available_width = container.rect().width();
|
||||
available_width = container.width();
|
||||
}
|
||||
|
||||
if (is_whitespace && line_boxes.last().fragments().is_empty())
|
||||
|
@ -190,7 +190,7 @@ void LayoutText::split_into_lines(LayoutBlock& container)
|
|||
|
||||
if (available_width < 0) {
|
||||
line_boxes.append(LineBox());
|
||||
available_width = container.rect().width();
|
||||
available_width = container.width();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue