mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Add basic parse floating point number function
This commit is contained in:
parent
3175557cb8
commit
761d824b72
Notes:
sideshowbarker
2024-07-18 00:41:35 +09:00
Author: https://github.com/bplaat
Commit: 761d824b72
Pull-request: https://github.com/SerenityOS/serenity/pull/21622
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 42 additions and 32 deletions
|
@ -402,8 +402,7 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
bar_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::FlowRoot)));
|
||||
auto value_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressValue));
|
||||
value_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
|
||||
auto position = progress.position();
|
||||
value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to<int>(100 * position) : 0)));
|
||||
value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(progress.position() * 100)));
|
||||
auto bar_display = bar_style->display();
|
||||
auto value_display = value_style->display();
|
||||
auto progress_bar = DOM::Element::create_layout_node_for_display_type(document, bar_display, bar_style, nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue