mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
LibWeb: Support multi-keyword syntax for CSS display property
The Display class already supported all specific values, and now they will be parsed too. The display property now has a special type DisplayStyleValue.
This commit is contained in:
parent
81c11bc6f2
commit
31e1be0438
13 changed files with 249 additions and 55 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Error.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -292,9 +293,9 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
auto& progress = static_cast<HTML::HTMLProgressElement&>(dom_node);
|
||||
if (!progress.using_system_appearance()) {
|
||||
auto bar_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressBar));
|
||||
bar_style->set_property(CSS::PropertyID::Display, CSS::IdentifierStyleValue::create(CSS::ValueID::InlineBlock));
|
||||
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::IdentifierStyleValue::create(CSS::ValueID::Block));
|
||||
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)));
|
||||
auto bar_display = bar_style->display();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue