diff options
Diffstat (limited to 'src/ui/render/TextRenderObject.cpp')
-rw-r--r-- | src/ui/render/TextRenderObject.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp index 0b9009c5..11548106 100644 --- a/src/ui/render/TextRenderObject.cpp +++ b/src/ui/render/TextRenderObject.cpp @@ -6,6 +6,7 @@ #include "cru/platform/graphics/Painter.h" #include "cru/platform/graphics/TextLayout.h" #include "cru/ui/DebugFlags.h" +#include "cru/ui/render/RenderObject.h" #include <algorithm> #include <limits> @@ -226,6 +227,17 @@ Size TextRenderObject::OnMeasureContent(const MeasureRequirement& requirement, return result; } +Size TextRenderObject::OnMeasureContent1(const BoxConstraint& constraint) { + text_layout_->SetMaxWidth(constraint.max.width); + text_layout_->SetMaxHeight(std::numeric_limits<float>::max()); + + const Size text_size( + text_layout_->GetTextBounds(is_measure_including_trailing_space_) + .GetRightBottom()); + + return constraint.Coerce(text_size); +} + void TextRenderObject::OnLayoutContent(const Rect& content_rect) { CRU_UNUSED(content_rect) } |