mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibWeb: Move HTML dimension value parsing from CSS to HTML namespace
These are part of HTML, not CSS, so let's not confuse things.
This commit is contained in:
parent
434970f022
commit
fda25f9505
8 changed files with 121 additions and 117 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/Layout/SVGSVGBox.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
|
@ -28,14 +29,14 @@ RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleP
|
|||
void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
// Width defaults to 100%
|
||||
if (auto width_value = parse_dimension_value(attribute(SVG::AttributeNames::width))) {
|
||||
if (auto width_value = HTML::parse_dimension_value(attribute(SVG::AttributeNames::width))) {
|
||||
style.set_property(CSS::PropertyID::Width, width_value.release_nonnull());
|
||||
} else {
|
||||
style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));
|
||||
}
|
||||
|
||||
// Height defaults to 100%
|
||||
if (auto height_value = parse_dimension_value(attribute(SVG::AttributeNames::width))) {
|
||||
if (auto height_value = HTML::parse_dimension_value(attribute(SVG::AttributeNames::width))) {
|
||||
style.set_property(CSS::PropertyID::Height, height_value.release_nonnull());
|
||||
} else {
|
||||
style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue