aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/render')
-rw-r--r--src/ui/render/BorderRenderObject.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/render/BorderRenderObject.cpp b/src/ui/render/BorderRenderObject.cpp
index 8e16d8cb..5abc7832 100644
--- a/src/ui/render/BorderRenderObject.cpp
+++ b/src/ui/render/BorderRenderObject.cpp
@@ -5,6 +5,7 @@
#include "cru/platform/graphics/Factory.hpp"
#include "cru/platform/graphics/Geometry.hpp"
#include "cru/platform/graphics/util/Painter.hpp"
+#include "cru/ui/style/ApplyBorderStyleInfo.hpp"
#include <algorithm>
@@ -25,6 +26,16 @@ void BorderRenderObject::SetBorderStyle(const BorderStyle& style) {
InvalidateLayout();
}
+void BorderRenderObject::ApplyBorderStyle(
+ const style::ApplyBorderStyleInfo& style) {
+ if (style.border_brush != nullptr) border_brush_ = style.border_brush;
+ if (style.border_thickness) border_thickness_ = *style.border_thickness;
+ if (style.border_radius) border_radius_ = *style.border_radius;
+ if (style.foreground_brush) foreground_brush_ = style.foreground_brush;
+ if (style.background_brush) background_brush_ = style.background_brush;
+ InvalidateLayout();
+}
+
RenderObject* BorderRenderObject::HitTest(const Point& point) {
if (const auto child = GetSingleChild()) {
auto offset = child->GetOffset();
@@ -109,9 +120,10 @@ Size BorderRenderObject::OnMeasureCore(const MeasureRequirement& requirement,
if (!requirement.max.height.IsNotSpecified()) {
const auto max_height = requirement.max.height.GetLengthOrMax();
if (coerced_space_size.height > max_height) {
- log::TagWarn(log_tag,
- u"(Measure) Vertical length of padding, border and margin is "
- u"bigger than required max length.");
+ log::TagWarn(
+ log_tag,
+ u"(Measure) Vertical length of padding, border and margin is "
+ u"bigger than required max length.");
coerced_space_size.height = max_height;
}
content_requirement.max.height = max_height - coerced_space_size.height;