From 57aa265862ebbb176f433dfc34099126ebf230ea Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Aug 2019 14:41:58 +0200 Subject: [PATCH 1/2] Show wxHtmlCell address in its Dump() This makes it easier to see which cell is which one when debugging. Also use GetMaxTotalWidth() instead of GetWidth(), as the former is more useful for container cells (and the same for the other ones). --- src/html/htmlcell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index c2b3e6d769..bfc928c929 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -292,8 +292,9 @@ wxString wxHtmlCell::GetDescription() const wxString wxHtmlCell::Dump(int indent) const { wxString s(' ', indent); - s += wxString::Format("%s at (%d, %d) %dx%d", - GetDescription(), m_PosX, m_PosY, m_Width, m_Height); + s += wxString::Format("%s(%p) at (%d, %d) %dx%d", + GetDescription(), this, + m_PosX, m_PosY, GetMaxTotalWidth(), m_Height); if ( !m_id.empty() ) s += wxString::Format(" [id=%s]", m_id); From 6cd53a2816543a4f06d11fd900378df73e6b2b1f Mon Sep 17 00:00:00 2001 From: basos Date: Fri, 23 Aug 2019 14:45:00 +0200 Subject: [PATCH 2/2] Fix computation of max total width for container cells in wxHTML We could end up with 0 max total width because we could assign the value of the child max total width, which could have been 0, just because the child "width", which is actually the total available width for the container cells (and a child of a container cell can, of course, be another container cell), was greater than our own total width so far. This is confusing because it might be expected that "width" is always less than "max total width", but actually this is (almost) never the case for the container cells. Closes #10263. --- src/html/htmlcell.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index bfc928c929..f5b115823d 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -824,8 +824,9 @@ void wxHtmlContainerCell::Layout(int w) if (curLineWidth > m_MaxTotalWidth) m_MaxTotalWidth = curLineWidth; - if (wxMax(cell->GetWidth(), cell->GetMaxTotalWidth()) > m_MaxTotalWidth) + if (cell->GetMaxTotalWidth() > m_MaxTotalWidth) m_MaxTotalWidth = cell->GetMaxTotalWidth(); + curLineWidth = 0; } else