Skip to content

Commit 6f36dd2

Browse files
committed
Add const qualifier to calc_document_size method
1 parent bfcca39 commit 6f36dd2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/litehtml/render_item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ namespace litehtml
412412
std::tuple<int, int> element_static_offset(const std::shared_ptr<litehtml::render_item> &el);
413413
void add_positioned(const std::shared_ptr<litehtml::render_item> &el);
414414
void get_redraw_box(litehtml::position& pos, int x = 0, int y = 0);
415-
void calc_document_size( litehtml::size& sz, int x = 0, int y = 0 );
415+
void calc_document_size( litehtml::size& sz, int x = 0, int y = 0 ) const;
416416
virtual void get_inline_boxes( position::vector& /*boxes*/ ) const {};
417417
virtual void set_inline_boxes( position::vector& /*boxes*/ ) {};
418418
virtual void add_inline_box( const position& /*box*/ ) {};

src/render_item.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ void litehtml::render_item::get_redraw_box(litehtml::position& pos, int x /*= 0*
707707
}
708708
}
709709

710-
void litehtml::render_item::calc_document_size( litehtml::size& sz, int x /*= 0*/, int y /*= 0*/ )
710+
void litehtml::render_item::calc_document_size( litehtml::size& sz, int x /*= 0*/, int y /*= 0*/ ) const
711711
{
712712
if(css().get_display() != display_inline && css().get_display() != display_table_row)
713713
{
@@ -717,7 +717,7 @@ void litehtml::render_item::calc_document_size( litehtml::size& sz, int x /*= 0*
717717
sz.height = std::max(sz.height, y + bottom());
718718

719719
// All children of tables and blocks with style other than "overflow: visible" are inside element.
720-
// We can skip calculating size of children
720+
// We can skip calculating the size of children
721721
if (src_el()->css().get_overflow() == overflow_visible && src_el()->css().get_display() != display_table)
722722
{
723723
for (auto &el: m_children)
@@ -730,7 +730,7 @@ void litehtml::render_item::calc_document_size( litehtml::size& sz, int x /*= 0*
730730
{
731731
position::vector boxes;
732732
get_inline_boxes(boxes);
733-
for(auto& box : boxes)
733+
for(const auto& box : boxes)
734734
{
735735
sz.width = std::max(sz.width, x + box.x + box.width);
736736
sz.height = std::max(sz.height, y + box.y + box.height);

0 commit comments

Comments
 (0)