diff options
author | crupest <crupest@outlook.com> | 2022-03-12 21:43:40 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-12 21:43:40 +0800 |
commit | 3ce391f85443ce8bb47a7e0ff3bef0051cf4006e (patch) | |
tree | 59f8c4b4a6c66676d206bda5bfce3ff5020e4d26 /src/ui/render/ScrollRenderObject.cpp | |
parent | f3b5009040a05e8efd15c385cacf5dd594ecf801 (diff) | |
download | cru-3ce391f85443ce8bb47a7e0ff3bef0051cf4006e.tar.gz cru-3ce391f85443ce8bb47a7e0ff3bef0051cf4006e.tar.bz2 cru-3ce391f85443ce8bb47a7e0ff3bef0051cf4006e.zip |
...
Diffstat (limited to 'src/ui/render/ScrollRenderObject.cpp')
-rw-r--r-- | src/ui/render/ScrollRenderObject.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/render/ScrollRenderObject.cpp b/src/ui/render/ScrollRenderObject.cpp index 03bb1a2d..b8b6904d 100644 --- a/src/ui/render/ScrollRenderObject.cpp +++ b/src/ui/render/ScrollRenderObject.cpp @@ -2,6 +2,7 @@ #include "cru/platform/graphics/Painter.h" #include "cru/ui/controls/Control.h" +#include "cru/ui/render/RenderObject.h" #include "cru/ui/render/ScrollBar.h" #include <algorithm> @@ -185,7 +186,14 @@ Size ScrollRenderObject::OnMeasureContent(const MeasureRequirement& requirement, : requirement.min.height.GetLengthOr0()}; return result; } -} // namespace cru::ui::render +} + +Size ScrollRenderObject::OnMeasureContent1(const BoxConstraint& constraint) { + auto child = GetChild(); + if (child == nullptr) return constraint.min; + auto child_size = child->Measure1(BoxConstraint::kNotLimit); + return constraint.Coerce(child_size); +} void ScrollRenderObject::OnLayoutContent(const Rect& content_rect) { if (auto child = GetChild()) { |