aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mapper/style
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-24 15:56:01 +0800
committercrupest <crupest@outlook.com>2022-02-24 15:56:01 +0800
commit640401bf2f4b3da3708970a1408b27e159f93631 (patch)
treec9692f9c6e8a3efdadabc5929029837450efd6af /src/ui/mapper/style
parentd9a3b8c14b9ab1bc591ca7c373daaf7141d2d098 (diff)
downloadcru-640401bf2f4b3da3708970a1408b27e159f93631.tar.gz
cru-640401bf2f4b3da3708970a1408b27e159f93631.tar.bz2
cru-640401bf2f4b3da3708970a1408b27e159f93631.zip
...
Diffstat (limited to 'src/ui/mapper/style')
-rw-r--r--src/ui/mapper/style/PreferredSizeStylerMapper.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/mapper/style/PreferredSizeStylerMapper.cpp b/src/ui/mapper/style/PreferredSizeStylerMapper.cpp
index b4382c19..9e03dfeb 100644
--- a/src/ui/mapper/style/PreferredSizeStylerMapper.cpp
+++ b/src/ui/mapper/style/PreferredSizeStylerMapper.cpp
@@ -1,4 +1,5 @@
#include "cru/ui/mapper/style/PreferredSizeStylerMapper.h"
+#include "cru/ui/mapper/MapperRegistry.h"
#include "cru/ui/render/MeasureRequirement.h"
#include "cru/ui/style/Styler.h"
@@ -11,14 +12,18 @@ bool PreferredSizeStylerMapper::XmlElementIsOfThisType(
ClonablePtr<ui::style::PreferredSizeStyler>
PreferredSizeStylerMapper::DoMapFromXml(xml::XmlElementNode* node) {
render::MeasureSize size;
+
+ auto measure_length_mapper =
+ MapperRegistry::GetInstance()->GetMapper<render::MeasureLength>();
+
auto width_attribute = node->GetOptionalAttributeCaseInsensitive(u"width");
if (width_attribute) {
- size.width = width_attribute->ParseToFloat();
+ size.width = measure_length_mapper->MapFromString(*width_attribute);
}
auto height_attribute = node->GetOptionalAttributeCaseInsensitive(u"height");
if (height_attribute) {
- size.height = height_attribute->ParseToFloat();
+ size.height = measure_length_mapper->MapFromString(*height_attribute);
}
return ui::style::PreferredSizeStyler::Create(size);