mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Remove reference counting for CSS::StyleProperties
`AK::CopyOnWrite` already does reference counting, so there is no need to do it again.
This commit is contained in:
parent
e636f3976d
commit
07cd7d479f
Notes:
github-actions[bot]
2024-10-27 12:27:19 +00:00
Author: https://github.com/yyny
Commit: 07cd7d479f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1980
125 changed files with 207 additions and 216 deletions
|
@ -954,13 +954,13 @@ void KeyframeEffect::update_style_properties()
|
|||
if (!target)
|
||||
return;
|
||||
|
||||
CSS::StyleProperties* style = nullptr;
|
||||
Optional<CSS::StyleProperties&> style = {};
|
||||
if (!pseudo_element_type().has_value())
|
||||
style = target->computed_css_values();
|
||||
else
|
||||
style = target->pseudo_element_computed_css_values(pseudo_element_type().value());
|
||||
|
||||
if (!style)
|
||||
if (!style.has_value())
|
||||
return;
|
||||
|
||||
auto animated_properties_before_update = style->animated_property_values();
|
||||
|
@ -970,8 +970,8 @@ void KeyframeEffect::update_style_properties()
|
|||
|
||||
// Traversal of the subtree is necessary to update the animated properties inherited from the target element.
|
||||
target->for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
|
||||
auto* element_style = element.computed_css_values();
|
||||
if (!element_style || !element.layout_node())
|
||||
auto element_style = element.computed_css_values();
|
||||
if (!element_style.has_value() || !element.layout_node())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
|
||||
|
|
|
@ -520,8 +520,7 @@ WebIDL::ExceptionOr<void> ElementInlineCSSStyleDeclaration::set_css_text(StringV
|
|||
|
||||
// 3. Parse the given value and, if the return value is not the empty list, insert the items in the list into the declarations, in specified order.
|
||||
auto style = parse_css_style_attribute(CSS::Parser::ParsingContext(m_element->document()), css_text, *m_element.ptr());
|
||||
auto custom_properties = TRY_OR_THROW_OOM(vm(), style->custom_properties().clone());
|
||||
set_the_declarations(style->properties(), move(custom_properties));
|
||||
set_the_declarations(style->properties(), style->custom_properties());
|
||||
|
||||
// 4. Update style attribute for the CSS declaration block.
|
||||
update_style_attribute();
|
||||
|
|
|
@ -581,7 +581,7 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
|
|||
auto style = m_element->document().style_computer().compute_style(const_cast<DOM::Element&>(*m_element), m_pseudo_element);
|
||||
|
||||
// FIXME: This is a stopgap until we implement shorthand -> longhand conversion.
|
||||
auto value = style->maybe_null_property(property_id);
|
||||
auto value = style.maybe_null_property(property_id);
|
||||
if (!value) {
|
||||
dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id={:#x}) No value for property ID in newly computed style case.", to_underlying(property_id));
|
||||
return {};
|
||||
|
|
|
@ -1172,7 +1172,7 @@ static void compute_transitioned_properties(StyleProperties const& style, DOM::E
|
|||
auto const source_declaration = style.transition_property_source();
|
||||
if (!source_declaration)
|
||||
return;
|
||||
if (!element.computed_css_values())
|
||||
if (!element.computed_css_values().has_value())
|
||||
return;
|
||||
if (source_declaration == element.cached_transition_property_source())
|
||||
return;
|
||||
|
@ -1482,13 +1482,13 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
|
|||
// Then we apply the declarations from the matched rules in cascade order:
|
||||
|
||||
// Normal user agent declarations
|
||||
auto previous_origin_style = style.clone();
|
||||
auto previous_layer_style = style.clone();
|
||||
auto previous_origin_style = style;
|
||||
auto previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::No, previous_origin_style, previous_layer_style);
|
||||
|
||||
// Normal user declarations
|
||||
previous_origin_style = style.clone();
|
||||
previous_layer_style = style.clone();
|
||||
previous_origin_style = style;
|
||||
previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::No, previous_origin_style, previous_layer_style);
|
||||
|
||||
// Author presentational hints
|
||||
|
@ -1497,7 +1497,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
|
|||
// however for the purpose of the revert keyword (but not for the revert-layer keyword) it is considered
|
||||
// part of the author origin."
|
||||
// https://drafts.csswg.org/css-cascade-5/#author-presentational-hint-origin
|
||||
previous_origin_style = style.clone();
|
||||
previous_origin_style = style;
|
||||
if (!pseudo_element.has_value()) {
|
||||
element.apply_presentational_hints(style);
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
|
|||
|
||||
// Normal author declarations, ordered by @layer, with un-@layer-ed rules last
|
||||
for (auto const& layer : matching_rule_set.author_rules) {
|
||||
previous_layer_style = style.clone();
|
||||
previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::No, previous_origin_style, previous_layer_style);
|
||||
}
|
||||
|
||||
|
@ -1587,20 +1587,20 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
|
|||
}
|
||||
|
||||
// Important author declarations, with un-@layer-ed rules first, followed by each @layer in reverse order.
|
||||
previous_origin_style = style.clone();
|
||||
previous_origin_style = style;
|
||||
for (auto const& layer : matching_rule_set.author_rules.in_reverse()) {
|
||||
previous_layer_style = style.clone();
|
||||
previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::Yes, previous_origin_style, previous_layer_style);
|
||||
}
|
||||
|
||||
// Important user declarations
|
||||
previous_origin_style = style.clone();
|
||||
previous_layer_style = style.clone();
|
||||
previous_origin_style = style;
|
||||
previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::Yes, previous_origin_style, previous_layer_style);
|
||||
|
||||
// Important user agent declarations
|
||||
previous_origin_style = style.clone();
|
||||
previous_layer_style = style.clone();
|
||||
previous_origin_style = style;
|
||||
previous_layer_style = style;
|
||||
cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::Yes, previous_origin_style, previous_layer_style);
|
||||
|
||||
// Transition declarations [css-transitions-1]
|
||||
|
@ -1624,7 +1624,7 @@ NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(JS::Realm& i
|
|||
{
|
||||
auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
|
||||
|
||||
if (!parent_element || !parent_element->computed_css_values())
|
||||
if (!parent_element || !parent_element->computed_css_values().has_value())
|
||||
return property_initial_value(initial_value_context_realm, property_id);
|
||||
return parent_element->computed_css_values()->property(property_id);
|
||||
}
|
||||
|
@ -1814,12 +1814,12 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|||
CSSPixels font_size_in_px = 16;
|
||||
|
||||
Gfx::FontPixelMetrics font_pixel_metrics;
|
||||
if (parent_element && parent_element->computed_css_values())
|
||||
if (parent_element && parent_element->computed_css_values().has_value())
|
||||
font_pixel_metrics = parent_element->computed_css_values()->first_available_computed_font().pixel_metrics();
|
||||
else
|
||||
font_pixel_metrics = Platform::FontPlugin::the().default_font().pixel_metrics();
|
||||
auto parent_font_size = [&]() -> CSSPixels {
|
||||
if (!parent_element || !parent_element->computed_css_values())
|
||||
if (!parent_element || !parent_element->computed_css_values().has_value())
|
||||
return font_size_in_px;
|
||||
auto value = parent_element->computed_css_values()->property(CSS::PropertyID::FontSize);
|
||||
if (value->is_length()) {
|
||||
|
@ -1870,7 +1870,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|||
// If the specified value font-size is math then the computed value of font-size is obtained by multiplying
|
||||
// the inherited value of font-size by a nonzero scale factor calculated by the following procedure:
|
||||
// 1. Let A be the inherited math-depth value, B the computed math-depth value, C be 0.71 and S be 1.0
|
||||
int inherited_math_depth = parent_element && parent_element->computed_css_values()
|
||||
int inherited_math_depth = parent_element && parent_element->computed_css_values().has_value()
|
||||
? parent_element->computed_css_values()->math_depth()
|
||||
: InitialValues::math_depth();
|
||||
int computed_math_depth = math_depth;
|
||||
|
@ -1910,7 +1910,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|||
// larger may compute the font size to the next entry in the table,
|
||||
// and smaller may compute the font size to the previous entry in the table.
|
||||
if (keyword == Keyword::Smaller || keyword == Keyword::Larger) {
|
||||
if (parent_element && parent_element->computed_css_values()) {
|
||||
if (parent_element && parent_element->computed_css_values().has_value()) {
|
||||
font_size_in_px = CSSPixels::nearest_value_for(parent_element->computed_css_values()->first_available_computed_font().pixel_metrics().size);
|
||||
}
|
||||
}
|
||||
|
@ -2172,7 +2172,7 @@ static BoxTypeTransformation required_box_type_transformation(StyleProperties co
|
|||
auto const* parent = pseudo_element.has_value() ? &element : element.parent_element();
|
||||
|
||||
// A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1]
|
||||
if (parent && parent->computed_css_values()) {
|
||||
if (parent && parent->computed_css_values().has_value()) {
|
||||
auto const& parent_display = parent->computed_css_values()->display();
|
||||
if (parent_display.is_grid_inside() || parent_display.is_flex_inside())
|
||||
return BoxTypeTransformation::Blockify;
|
||||
|
@ -2271,30 +2271,30 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El
|
|||
style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display));
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
|
||||
StyleProperties StyleComputer::create_document_style() const
|
||||
{
|
||||
auto style = StyleProperties::create();
|
||||
StyleProperties style = {};
|
||||
compute_math_depth(style, nullptr, {});
|
||||
compute_font(style, nullptr, {});
|
||||
compute_defaulted_values(style, nullptr, {});
|
||||
absolutize_values(style);
|
||||
style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())));
|
||||
style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())));
|
||||
style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
|
||||
style.set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())));
|
||||
style.set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())));
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
|
||||
return style;
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleProperties> StyleComputer::compute_style(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
StyleProperties StyleComputer::compute_style(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
{
|
||||
return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::Normal).release_nonnull();
|
||||
return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::Normal).release_value();
|
||||
}
|
||||
|
||||
RefPtr<StyleProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
Optional<StyleProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
|
||||
{
|
||||
return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::CreatePseudoElementStyleIfNeeded);
|
||||
}
|
||||
|
||||
RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, ComputeStyleMode mode) const
|
||||
Optional<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, ComputeStyleMode mode) const
|
||||
{
|
||||
build_rule_cache_if_needed();
|
||||
|
||||
|
@ -2306,14 +2306,14 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
|
|||
// Merge back inline styles
|
||||
if (auto inline_style = element.inline_style()) {
|
||||
for (auto const& property : inline_style->properties())
|
||||
style->set_property(property.property_id, property.value);
|
||||
style.set_property(property.property_id, property.value);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
ScopeGuard guard { [&element]() { element.set_needs_style_update(false); } };
|
||||
|
||||
auto style = StyleProperties::create();
|
||||
StyleProperties style = {};
|
||||
// 1. Perform the cascade. This produces the "specified style"
|
||||
bool did_match_any_pseudo_element_rules = false;
|
||||
compute_cascaded_values(style, element, pseudo_element, did_match_any_pseudo_element_rules, mode);
|
||||
|
@ -2323,17 +2323,17 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
|
|||
|
||||
// Bail if no pseudo-element rules matched.
|
||||
if (!did_match_any_pseudo_element_rules)
|
||||
return nullptr;
|
||||
return {};
|
||||
|
||||
// Bail if no pseudo-element would be generated due to...
|
||||
// - content: none
|
||||
// - content: normal (for ::before and ::after)
|
||||
bool content_is_normal = false;
|
||||
if (auto content_value = style->maybe_null_property(CSS::PropertyID::Content)) {
|
||||
if (auto content_value = style.maybe_null_property(CSS::PropertyID::Content)) {
|
||||
if (content_value->is_keyword()) {
|
||||
auto content = content_value->as_keyword().keyword();
|
||||
if (content == CSS::Keyword::None)
|
||||
return nullptr;
|
||||
return {};
|
||||
content_is_normal = content == CSS::Keyword::Normal;
|
||||
} else {
|
||||
content_is_normal = false;
|
||||
|
@ -2343,7 +2343,7 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
|
|||
content_is_normal = true;
|
||||
}
|
||||
if (content_is_normal && first_is_one_of(*pseudo_element, CSS::Selector::PseudoElement::Type::Before, CSS::Selector::PseudoElement::Type::After)) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2371,7 +2371,7 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
|
|||
// 9. Transition declarations [css-transitions-1]
|
||||
// Theoretically this should be part of the cascade, but it works with computed values, which we don't have until now.
|
||||
compute_transitioned_properties(style, element, pseudo_element);
|
||||
if (auto const* previous_style = element.computed_css_values()) {
|
||||
if (auto previous_style = element.computed_css_values(); previous_style.has_value()) {
|
||||
start_needed_transitions(*previous_style, style, element, pseudo_element);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,10 +134,10 @@ public:
|
|||
void push_ancestor(DOM::Element const&);
|
||||
void pop_ancestor(DOM::Element const&);
|
||||
|
||||
NonnullRefPtr<StyleProperties> create_document_style() const;
|
||||
StyleProperties create_document_style() const;
|
||||
|
||||
NonnullRefPtr<StyleProperties> compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
|
||||
RefPtr<StyleProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
StyleProperties compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
|
||||
Optional<StyleProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
|
||||
|
||||
Vector<MatchingRule> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::Selector::PseudoElement::Type>, FlyString const& qualified_layer_name = {}) const;
|
||||
|
||||
|
@ -176,7 +176,7 @@ private:
|
|||
|
||||
[[nodiscard]] bool should_reject_with_ancestor_filter(Selector const&) const;
|
||||
|
||||
RefPtr<StyleProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
|
||||
Optional<StyleProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
|
||||
void compute_cascaded_values(StyleProperties&, DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_pseudo_element_rules, ComputeStyleMode) const;
|
||||
static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_ascending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
|
||||
static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_descending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
|
||||
|
|
|
@ -53,13 +53,6 @@ NonnullRefPtr<StyleProperties::Data> StyleProperties::Data::clone() const
|
|||
return clone;
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleProperties> StyleProperties::clone() const
|
||||
{
|
||||
auto cloned = adopt_ref(*new StyleProperties);
|
||||
cloned->m_data = m_data;
|
||||
return cloned;
|
||||
}
|
||||
|
||||
bool StyleProperties::is_property_important(CSS::PropertyID property_id) const
|
||||
{
|
||||
size_t n = to_underlying(property_id);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
class StyleProperties : public RefCounted<StyleProperties> {
|
||||
class StyleProperties {
|
||||
public:
|
||||
static constexpr size_t number_of_properties = to_underlying(CSS::last_property_id) + 1;
|
||||
|
||||
|
@ -48,9 +48,6 @@ private:
|
|||
public:
|
||||
StyleProperties() = default;
|
||||
|
||||
static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); }
|
||||
NonnullRefPtr<StyleProperties> clone() const;
|
||||
|
||||
template<typename Callback>
|
||||
inline void for_each_property(Callback callback) const
|
||||
{
|
||||
|
|
|
@ -385,16 +385,16 @@ Vector<String> Element::get_attribute_names() const
|
|||
return names;
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> Element::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
if (local_name() == "noscript" && document().is_scripting_enabled())
|
||||
return nullptr;
|
||||
|
||||
auto display = style->display();
|
||||
auto display = style.display();
|
||||
return create_layout_node_for_display_type(document(), display, move(style), this);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, NonnullRefPtr<CSS::StyleProperties> style, Element* element)
|
||||
JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, CSS::StyleProperties style, Element* element)
|
||||
{
|
||||
if (display.is_table_inside() || display.is_table_row_group() || display.is_table_header_group() || display.is_table_footer_group() || display.is_table_row())
|
||||
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
|
||||
|
@ -540,14 +540,14 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
// Tables must not inherit -libweb-* values for text-align.
|
||||
// FIXME: Find the spec for this.
|
||||
if (is<HTML::HTMLTableElement>(*this)) {
|
||||
auto text_align = new_computed_css_values->text_align();
|
||||
auto text_align = new_computed_css_values.text_align();
|
||||
if (text_align.has_value() && (text_align.value() == CSS::TextAlign::LibwebLeft || text_align.value() == CSS::TextAlign::LibwebCenter || text_align.value() == CSS::TextAlign::LibwebRight))
|
||||
new_computed_css_values->set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Start));
|
||||
new_computed_css_values.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Start));
|
||||
}
|
||||
|
||||
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
||||
if (m_computed_css_values)
|
||||
invalidation = compute_required_invalidation(*m_computed_css_values, *new_computed_css_values);
|
||||
if (m_computed_css_values.has_value())
|
||||
invalidation = compute_required_invalidation(*m_computed_css_values, new_computed_css_values);
|
||||
else
|
||||
invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
|
||||
|
||||
|
@ -562,9 +562,9 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
auto new_pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed(*this, pseudo_element);
|
||||
|
||||
// TODO: Can we be smarter about invalidation?
|
||||
if (pseudo_element_style && new_pseudo_element_style) {
|
||||
if (pseudo_element_style.has_value() && new_pseudo_element_style.has_value()) {
|
||||
invalidation |= compute_required_invalidation(*pseudo_element_style, *new_pseudo_element_style);
|
||||
} else if (pseudo_element_style || new_pseudo_element_style) {
|
||||
} else if (pseudo_element_style.has_value() || new_pseudo_element_style.has_value()) {
|
||||
invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
continue;
|
||||
|
||||
auto pseudo_element_style = pseudo_element_computed_css_values(pseudo_element_type);
|
||||
if (!pseudo_element_style)
|
||||
if (!pseudo_element_style.has_value())
|
||||
continue;
|
||||
|
||||
if (auto* node_with_style = dynamic_cast<Layout::NodeWithStyle*>(pseudo_element->layout_node.ptr())) {
|
||||
|
@ -609,17 +609,17 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
return invalidation;
|
||||
}
|
||||
|
||||
NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> type)
|
||||
CSS::StyleProperties Element::resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> type)
|
||||
{
|
||||
auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this, type);
|
||||
auto properties = CSS::StyleProperties::create();
|
||||
CSS::StyleProperties properties = {};
|
||||
|
||||
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
|
||||
auto property_id = (CSS::PropertyID)i;
|
||||
auto maybe_value = element_computed_style->property(property_id);
|
||||
if (!maybe_value.has_value())
|
||||
continue;
|
||||
properties->set_property(property_id, maybe_value.release_value().value);
|
||||
properties.set_property(property_id, maybe_value.release_value().value);
|
||||
}
|
||||
|
||||
return properties;
|
||||
|
@ -627,7 +627,7 @@ NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values(Optional<CSS::S
|
|||
|
||||
void Element::reset_animated_css_properties()
|
||||
{
|
||||
if (!m_computed_css_values)
|
||||
if (!m_computed_css_values.has_value())
|
||||
return;
|
||||
m_computed_css_values->reset_animated_properties();
|
||||
}
|
||||
|
@ -2273,25 +2273,25 @@ size_t Element::attribute_list_size() const
|
|||
return m_attributes->length();
|
||||
}
|
||||
|
||||
void Element::set_computed_css_values(RefPtr<CSS::StyleProperties> style)
|
||||
void Element::set_computed_css_values(Optional<CSS::StyleProperties> style)
|
||||
{
|
||||
m_computed_css_values = move(style);
|
||||
computed_css_values_changed();
|
||||
}
|
||||
|
||||
void Element::set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type pseudo_element, RefPtr<CSS::StyleProperties> style)
|
||||
void Element::set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type pseudo_element, Optional<CSS::StyleProperties> style)
|
||||
{
|
||||
if (!m_pseudo_element_data && !style)
|
||||
if (!m_pseudo_element_data && !style.has_value())
|
||||
return;
|
||||
ensure_pseudo_element(pseudo_element).computed_css_values = move(style);
|
||||
}
|
||||
|
||||
RefPtr<CSS::StyleProperties> Element::pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type type)
|
||||
Optional<CSS::StyleProperties&> Element::pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type type)
|
||||
{
|
||||
auto pseudo_element = get_pseudo_element(type);
|
||||
if (pseudo_element.has_value())
|
||||
return pseudo_element->computed_css_values;
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<Element::PseudoElement&> Element::get_pseudo_element(CSS::Selector::PseudoElement::Type type) const
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <LibWeb/ARIA/ARIAMixin.h>
|
||||
#include <LibWeb/Animations/Animatable.h>
|
||||
#include <LibWeb/Bindings/ElementPrototype.h>
|
||||
|
@ -14,6 +15,7 @@
|
|||
#include <LibWeb/CSS/CountersSet.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/CSS/StyleInvalidation.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/CSS/StyleProperty.h>
|
||||
#include <LibWeb/DOM/ChildNode.h>
|
||||
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
|
||||
|
@ -183,13 +185,13 @@ public:
|
|||
JS::GCPtr<Layout::NodeWithStyle> layout_node();
|
||||
JS::GCPtr<Layout::NodeWithStyle const> layout_node() const;
|
||||
|
||||
CSS::StyleProperties* computed_css_values() { return m_computed_css_values.ptr(); }
|
||||
CSS::StyleProperties const* computed_css_values() const { return m_computed_css_values.ptr(); }
|
||||
void set_computed_css_values(RefPtr<CSS::StyleProperties>);
|
||||
NonnullRefPtr<CSS::StyleProperties> resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> = {});
|
||||
Optional<CSS::StyleProperties>& computed_css_values() { return m_computed_css_values; }
|
||||
Optional<CSS::StyleProperties> const& computed_css_values() const { return m_computed_css_values; }
|
||||
void set_computed_css_values(Optional<CSS::StyleProperties>);
|
||||
CSS::StyleProperties resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> = {});
|
||||
|
||||
void set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type, RefPtr<CSS::StyleProperties>);
|
||||
RefPtr<CSS::StyleProperties> pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type);
|
||||
void set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type, Optional<CSS::StyleProperties>);
|
||||
Optional<CSS::StyleProperties&> pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type);
|
||||
|
||||
void reset_animated_css_properties();
|
||||
|
||||
|
@ -235,13 +237,13 @@ public:
|
|||
JS::NonnullGCPtr<Geometry::DOMRect> get_bounding_client_rect() const;
|
||||
JS::NonnullGCPtr<Geometry::DOMRectList> get_client_rects() const;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>);
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties);
|
||||
virtual void adjust_computed_style(CSS::StyleProperties&) { }
|
||||
|
||||
virtual void did_receive_focus() { }
|
||||
virtual void did_lose_focus() { }
|
||||
|
||||
static JS::GCPtr<Layout::NodeWithStyle> create_layout_node_for_display_type(DOM::Document&, CSS::Display const&, NonnullRefPtr<CSS::StyleProperties>, Element*);
|
||||
static JS::GCPtr<Layout::NodeWithStyle> create_layout_node_for_display_type(DOM::Document&, CSS::Display const&, CSS::StyleProperties, Element*);
|
||||
|
||||
void set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::Selector::PseudoElement::Type, JS::GCPtr<Layout::NodeWithStyle>);
|
||||
JS::GCPtr<Layout::NodeWithStyle> get_pseudo_element_node(CSS::Selector::PseudoElement::Type) const;
|
||||
|
@ -456,12 +458,12 @@ private:
|
|||
JS::GCPtr<DOMTokenList> m_class_list;
|
||||
JS::GCPtr<ShadowRoot> m_shadow_root;
|
||||
|
||||
RefPtr<CSS::StyleProperties> m_computed_css_values;
|
||||
Optional<CSS::StyleProperties> m_computed_css_values;
|
||||
HashMap<FlyString, CSS::StyleProperty> m_custom_properties;
|
||||
|
||||
struct PseudoElement {
|
||||
JS::GCPtr<Layout::NodeWithStyle> layout_node;
|
||||
RefPtr<CSS::StyleProperties> computed_css_values;
|
||||
Optional<CSS::StyleProperties> computed_css_values;
|
||||
HashMap<FlyString, CSS::StyleProperty> custom_properties;
|
||||
};
|
||||
// TODO: CSS::Selector::PseudoElement::Type includes a lot of pseudo-elements that exist in shadow trees,
|
||||
|
|
|
@ -394,7 +394,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
|
|||
}
|
||||
}
|
||||
|
||||
if (show_specified_style && layout_node.dom_node() && layout_node.dom_node()->is_element() && verify_cast<DOM::Element>(layout_node.dom_node())->computed_css_values()) {
|
||||
if (show_specified_style && layout_node.dom_node() && layout_node.dom_node()->is_element() && verify_cast<DOM::Element>(layout_node.dom_node())->computed_css_values().has_value()) {
|
||||
struct NameAndValue {
|
||||
FlyString name;
|
||||
String value;
|
||||
|
|
|
@ -28,7 +28,7 @@ void HTMLAudioElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::AudioBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
virtual void on_playing() override;
|
||||
virtual void on_paused() override;
|
||||
|
|
|
@ -26,7 +26,7 @@ void HTMLBRElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBRElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class HTMLBRElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLBRElement() override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
private:
|
||||
virtual bool is_html_br_element() const override { return true; }
|
||||
|
|
|
@ -128,7 +128,7 @@ WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
|
|||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::CanvasBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
enum class HasOrCreatedContext {
|
||||
No,
|
||||
|
|
|
@ -32,7 +32,7 @@ void HTMLIFrameElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLIFrameElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class HTMLIFrameElement final
|
|||
public:
|
||||
virtual ~HTMLIFrameElement() override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
void set_current_navigation_was_lazy_loaded(bool value);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void HTMLImageElement::form_associated_element_attribute_changed(FlyString const
|
|||
}
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLImageElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:dimension-attributes
|
||||
virtual bool supports_dimension_attributes() const override { return true; }
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
virtual void did_set_viewport_rect(CSSPixelRect const&) override;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ JS::NonnullGCPtr<ValidityState const> HTMLInputElement::validity() const
|
|||
return vm.heap().allocate<ValidityState>(realm, realm);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
if (type_state() == TypeAttributeState::Hidden)
|
||||
return nullptr;
|
||||
|
@ -113,8 +113,8 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
|
|||
// This specification introduces the appearance property to provide some control over this behavior.
|
||||
// In particular, using appearance: none allows authors to suppress the native appearance of widgets,
|
||||
// giving them a primitive appearance where CSS can be used to restyle them.
|
||||
if (style->appearance() == CSS::Appearance::None) {
|
||||
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
|
||||
if (style.appearance() == CSS::Appearance::None) {
|
||||
return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
|
||||
}
|
||||
|
||||
if (type_state() == TypeAttributeState::SubmitButton || type_state() == TypeAttributeState::Button || type_state() == TypeAttributeState::ResetButton)
|
||||
|
@ -126,7 +126,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
|
|||
if (type_state() == TypeAttributeState::RadioButton)
|
||||
return heap().allocate_without_realm<Layout::RadioButton>(document(), *this, move(style));
|
||||
|
||||
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
|
||||
return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
|
||||
}
|
||||
|
||||
void HTMLInputElement::adjust_computed_style(CSS::StyleProperties& style)
|
||||
|
|
|
@ -59,7 +59,7 @@ class HTMLInputElement final
|
|||
public:
|
||||
virtual ~HTMLInputElement() override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
virtual void adjust_computed_style(CSS::StyleProperties&) override;
|
||||
|
||||
enum class TypeAttributeState {
|
||||
|
|
|
@ -27,7 +27,7 @@ void HTMLLabelElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLabelElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::Label>(document(), this, move(style));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class HTMLLabelElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLLabelElement() override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
Optional<String> for_() const { return attribute(HTML::AttributeNames::for_); }
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ String HTMLObjectElement::data() const
|
|||
return MUST(document().parse_url(*data).to_string());
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
switch (m_representation) {
|
||||
case Representation::Children:
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String>
|
|||
}
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLVideoElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> HTMLVideoElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::VideoBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
|
||||
virtual bool supports_dimension_attributes() const override { return true; }
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
virtual void on_playing() override;
|
||||
virtual void on_paused() override;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(AudioBox);
|
||||
|
||||
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
{
|
||||
set_natural_width(300);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
|
||||
|
||||
private:
|
||||
AudioBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
AudioBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
|
||||
: Box(document, node, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class BlockContainer : public Box {
|
|||
JS_CELL(BlockContainer, Box);
|
||||
|
||||
public:
|
||||
BlockContainer(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
BlockContainer(DOM::Document&, DOM::Node*, CSS::StyleProperties);
|
||||
BlockContainer(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
|
||||
virtual ~BlockContainer() override;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
Box::Box(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
Box::Box(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
|
||||
: NodeWithStyleAndBoxModelMetrics(document, node, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
protected:
|
||||
Box(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
Box(DOM::Document&, DOM::Node*, CSS::StyleProperties);
|
||||
Box(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
|
||||
|
||||
private:
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(BreakNode);
|
||||
|
||||
BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, CSS::StyleProperties style)
|
||||
: Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class BreakNode final : public NodeWithStyleAndBoxModelMetrics {
|
|||
JS_DECLARE_ALLOCATOR(BreakNode);
|
||||
|
||||
public:
|
||||
BreakNode(DOM::Document&, HTML::HTMLBRElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
BreakNode(DOM::Document&, HTML::HTMLBRElement&, CSS::StyleProperties);
|
||||
virtual ~BreakNode() override;
|
||||
|
||||
const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(CanvasBox);
|
||||
|
||||
CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, CSS::StyleProperties style)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class CanvasBox final : public ReplacedBox {
|
|||
JS_DECLARE_ALLOCATOR(CanvasBox);
|
||||
|
||||
public:
|
||||
CanvasBox(DOM::Document&, HTML::HTMLCanvasElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
CanvasBox(DOM::Document&, HTML::HTMLCanvasElement&, CSS::StyleProperties);
|
||||
virtual ~CanvasBox() override;
|
||||
|
||||
virtual void prepare_for_replaced_layout() override;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(CheckBox);
|
||||
|
||||
CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
|
||||
: FormAssociatedLabelableNode(document, element, move(style))
|
||||
{
|
||||
set_natural_width(13);
|
||||
|
|
|
@ -16,7 +16,7 @@ class CheckBox final : public FormAssociatedLabelableNode {
|
|||
JS_DECLARE_ALLOCATOR(CheckBox);
|
||||
|
||||
public:
|
||||
CheckBox(DOM::Document&, HTML::HTMLInputElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
CheckBox(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
|
||||
virtual ~CheckBox() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
HTML::FormAssociatedElement& dom_node() { return dynamic_cast<HTML::FormAssociatedElement&>(LabelableNode::dom_node()); }
|
||||
|
||||
protected:
|
||||
FormAssociatedLabelableNode(DOM::Document& document, HTML::FormAssociatedElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
FormAssociatedLabelableNode(DOM::Document& document, HTML::FormAssociatedElement& element, CSS::StyleProperties style)
|
||||
: LabelableNode(document, element.form_associated_element_to_html_element(), move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(FrameBox);
|
||||
|
||||
FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class FrameBox final : public ReplacedBox {
|
|||
JS_DECLARE_ALLOCATOR(FrameBox);
|
||||
|
||||
public:
|
||||
FrameBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
FrameBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
|
||||
virtual ~FrameBox() override;
|
||||
|
||||
virtual void prepare_for_replaced_layout() override;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(ImageBox);
|
||||
|
||||
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, ImageProvider const& image_provider)
|
||||
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style, ImageProvider const& image_provider)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
, m_image_provider(image_provider)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ class ImageBox final : public ReplacedBox {
|
|||
JS_DECLARE_ALLOCATOR(ImageBox);
|
||||
|
||||
public:
|
||||
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, ImageProvider const&);
|
||||
ImageBox(DOM::Document&, DOM::Element&, CSS::StyleProperties, ImageProvider const&);
|
||||
virtual ~ImageBox() override;
|
||||
|
||||
virtual void prepare_for_replaced_layout() override;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(InlineNode);
|
||||
|
||||
InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
|
||||
: Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class InlineNode final : public NodeWithStyleAndBoxModelMetrics {
|
|||
JS_DECLARE_ALLOCATOR(InlineNode);
|
||||
|
||||
public:
|
||||
InlineNode(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
InlineNode(DOM::Document&, DOM::Element*, CSS::StyleProperties);
|
||||
virtual ~InlineNode() override;
|
||||
|
||||
JS::GCPtr<Painting::PaintableWithLines> create_paintable_for_line_with_index(size_t line_index) const;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(Label);
|
||||
|
||||
Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, CSS::StyleProperties style)
|
||||
: BlockContainer(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class Label final : public BlockContainer {
|
|||
JS_DECLARE_ALLOCATOR(Label);
|
||||
|
||||
public:
|
||||
Label(DOM::Document&, HTML::HTMLLabelElement*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
Label(DOM::Document&, HTML::HTMLLabelElement*, CSS::StyleProperties);
|
||||
virtual ~Label() override;
|
||||
|
||||
static bool is_inside_associated_label(LabelableNode const&, CSSPixelPoint);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
Painting::LabelablePaintable const* paintable() const;
|
||||
|
||||
protected:
|
||||
LabelableNode(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
LabelableNode(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(ListItemBox);
|
||||
|
||||
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
|
||||
: Layout::BlockContainer(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class ListItemBox final : public BlockContainer {
|
|||
JS_DECLARE_ALLOCATOR(ListItemBox);
|
||||
|
||||
public:
|
||||
ListItemBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
ListItemBox(DOM::Document&, DOM::Element*, CSS::StyleProperties);
|
||||
virtual ~ListItemBox() override;
|
||||
|
||||
DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockContainer::dom_node()); }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(ListItemMarkerBox);
|
||||
|
||||
ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, CSS::ListStylePosition style_position, size_t index, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, CSS::ListStylePosition style_position, size_t index, CSS::StyleProperties style)
|
||||
: Box(document, nullptr, move(style))
|
||||
, m_list_style_type(style_type)
|
||||
, m_list_style_position(style_position)
|
||||
|
|
|
@ -16,7 +16,7 @@ class ListItemMarkerBox final : public Box {
|
|||
JS_DECLARE_ALLOCATOR(ListItemMarkerBox);
|
||||
|
||||
public:
|
||||
explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, NonnullRefPtr<CSS::StyleProperties>);
|
||||
explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, CSS::StyleProperties);
|
||||
virtual ~ListItemMarkerBox() override;
|
||||
|
||||
Optional<ByteString> const& text() const { return m_text; }
|
||||
|
|
|
@ -261,12 +261,12 @@ bool Node::is_sticky_position() const
|
|||
return position == CSS::Positioning::Sticky;
|
||||
}
|
||||
|
||||
NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> computed_style)
|
||||
NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, CSS::StyleProperties computed_style)
|
||||
: Node(document, node)
|
||||
, m_computed_values(make<CSS::ComputedValues>())
|
||||
{
|
||||
m_has_style = true;
|
||||
apply_style(*computed_style);
|
||||
apply_style(computed_style);
|
||||
}
|
||||
|
||||
NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullOwnPtr<CSS::ComputedValues> computed_values)
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
virtual void visit_edges(Cell::Visitor& visitor) override;
|
||||
|
||||
protected:
|
||||
NodeWithStyle(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
NodeWithStyle(DOM::Document&, DOM::Node*, CSS::StyleProperties);
|
||||
NodeWithStyle(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
|
||||
|
||||
private:
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
BoxModelMetrics const& box_model() const { return m_box_model; }
|
||||
|
||||
protected:
|
||||
NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
|
||||
: NodeWithStyle(document, node, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(RadioButton);
|
||||
|
||||
RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
|
||||
: FormAssociatedLabelableNode(document, element, move(style))
|
||||
{
|
||||
set_natural_width(12);
|
||||
|
|
|
@ -16,7 +16,7 @@ class RadioButton final : public FormAssociatedLabelableNode {
|
|||
JS_DECLARE_ALLOCATOR(RadioButton);
|
||||
|
||||
public:
|
||||
RadioButton(DOM::Document&, HTML::HTMLInputElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
RadioButton(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
|
||||
virtual ~RadioButton() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
ReplacedBox::ReplacedBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
ReplacedBox::ReplacedBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
|
||||
: Box(document, &element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class ReplacedBox : public Box {
|
|||
JS_CELL(ReplacedBox, Box);
|
||||
|
||||
public:
|
||||
ReplacedBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
ReplacedBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
|
||||
virtual ~ReplacedBox() override;
|
||||
|
||||
DOM::Element const& dom_node() const { return verify_cast<DOM::Element>(*Node::dom_node()); }
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, CSS::StyleProperties style)
|
||||
: Box(document, &element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGBox : public Box {
|
|||
JS_CELL(SVGBox, Box);
|
||||
|
||||
public:
|
||||
SVGBox(DOM::Document&, SVG::SVGElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGBox(DOM::Document&, SVG::SVGElement&, CSS::StyleProperties);
|
||||
virtual ~SVGBox() override = default;
|
||||
|
||||
SVG::SVGElement& dom_node() { return verify_cast<SVG::SVGElement>(*Box::dom_node()); }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGClipBox);
|
||||
|
||||
SVGClipBox::SVGClipBox(DOM::Document& document, SVG::SVGClipPathElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGClipBox::SVGClipBox(DOM::Document& document, SVG::SVGClipPathElement& element, CSS::StyleProperties properties)
|
||||
: SVGBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGClipBox : public SVGBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGClipBox);
|
||||
|
||||
public:
|
||||
SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, CSS::StyleProperties);
|
||||
virtual ~SVGClipBox() override = default;
|
||||
|
||||
SVG::SVGClipPathElement& dom_node() { return verify_cast<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGForeignObjectBox);
|
||||
|
||||
SVGForeignObjectBox::SVGForeignObjectBox(DOM::Document& document, SVG::SVGForeignObjectElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGForeignObjectBox::SVGForeignObjectBox(DOM::Document& document, SVG::SVGForeignObjectElement& element, CSS::StyleProperties properties)
|
||||
: BlockContainer(document, &element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class SVGForeignObjectBox final : public BlockContainer {
|
|||
JS_DECLARE_ALLOCATOR(SVGForeignObjectBox);
|
||||
|
||||
public:
|
||||
SVGForeignObjectBox(DOM::Document&, SVG::SVGForeignObjectElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGForeignObjectBox(DOM::Document&, SVG::SVGForeignObjectElement&, CSS::StyleProperties);
|
||||
virtual ~SVGForeignObjectBox() override = default;
|
||||
|
||||
SVG::SVGForeignObjectElement& dom_node() { return static_cast<SVG::SVGForeignObjectElement&>(*BlockContainer::dom_node()); }
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGGeometryBox);
|
||||
|
||||
SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, CSS::StyleProperties properties)
|
||||
: SVGGraphicsBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGGeometryBox final : public SVGGraphicsBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGGeometryBox);
|
||||
|
||||
public:
|
||||
SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, CSS::StyleProperties);
|
||||
virtual ~SVGGeometryBox() override = default;
|
||||
|
||||
SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement& element, CSS::StyleProperties properties)
|
||||
: SVGBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGGraphicsBox : public SVGBox {
|
|||
JS_CELL(SVGGraphicsBox, SVGBox);
|
||||
|
||||
public:
|
||||
SVGGraphicsBox(DOM::Document&, SVG::SVGGraphicsElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGGraphicsBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
|
||||
virtual ~SVGGraphicsBox() override = default;
|
||||
|
||||
SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
SVGImageBox::SVGImageBox(DOM::Document& document, SVG::SVGGraphicsElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGImageBox::SVGImageBox(DOM::Document& document, SVG::SVGGraphicsElement& element, CSS::StyleProperties properties)
|
||||
: SVGGraphicsBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGImageBox : public SVGGraphicsBox {
|
|||
JS_CELL(SVGImageBox, SVGGraphicsBox);
|
||||
|
||||
public:
|
||||
SVGImageBox(DOM::Document&, SVG::SVGGraphicsElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGImageBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
|
||||
virtual ~SVGImageBox() override = default;
|
||||
|
||||
SVG::SVGImageElement& dom_node() { return static_cast<SVG::SVGImageElement&>(SVGGraphicsBox::dom_node()); }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGMaskBox);
|
||||
|
||||
SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, CSS::StyleProperties properties)
|
||||
: SVGGraphicsBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGMaskBox : public SVGGraphicsBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGMaskBox);
|
||||
|
||||
public:
|
||||
SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, CSS::StyleProperties);
|
||||
virtual ~SVGMaskBox() override = default;
|
||||
|
||||
virtual bool is_svg_mask_box() const override { return true; }
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGSVGBox);
|
||||
|
||||
SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, CSS::StyleProperties properties)
|
||||
: ReplacedBox(document, element, move(properties))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGSVGBox final : public ReplacedBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGSVGBox);
|
||||
|
||||
public:
|
||||
SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, CSS::StyleProperties);
|
||||
virtual ~SVGSVGBox() override = default;
|
||||
|
||||
SVG::SVGSVGElement& dom_node() { return verify_cast<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGTextBox);
|
||||
|
||||
SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& element, CSS::StyleProperties properties)
|
||||
: SVGGraphicsBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGTextBox final : public SVGGraphicsBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGTextBox);
|
||||
|
||||
public:
|
||||
SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, CSS::StyleProperties);
|
||||
virtual ~SVGTextBox() override = default;
|
||||
|
||||
SVG::SVGTextPositioningElement& dom_node() { return static_cast<SVG::SVGTextPositioningElement&>(SVGGraphicsBox::dom_node()); }
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(SVGTextPathBox);
|
||||
|
||||
SVGTextPathBox::SVGTextPathBox(DOM::Document& document, SVG::SVGTextPathElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
||||
SVGTextPathBox::SVGTextPathBox(DOM::Document& document, SVG::SVGTextPathElement& element, CSS::StyleProperties properties)
|
||||
: SVGGraphicsBox(document, element, properties)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGTextPathBox final : public SVGGraphicsBox {
|
|||
JS_DECLARE_ALLOCATOR(SVGTextPathBox);
|
||||
|
||||
public:
|
||||
SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, CSS::StyleProperties);
|
||||
virtual ~SVGTextPathBox() override = default;
|
||||
|
||||
SVG::SVGTextPathElement& dom_node() { return static_cast<SVG::SVGTextPathElement&>(SVGGraphicsBox::dom_node()); }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(TableWrapper);
|
||||
|
||||
TableWrapper::TableWrapper(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
TableWrapper::TableWrapper(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
|
||||
: BlockContainer(document, node, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class TableWrapper : public BlockContainer {
|
|||
JS_DECLARE_ALLOCATOR(TableWrapper);
|
||||
|
||||
public:
|
||||
TableWrapper(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableWrapper(DOM::Document&, DOM::Node*, CSS::StyleProperties);
|
||||
TableWrapper(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
|
||||
virtual ~TableWrapper() override;
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
|
|||
auto& document = element.document();
|
||||
|
||||
auto pseudo_element_style = element.pseudo_element_computed_css_values(pseudo_element);
|
||||
if (!pseudo_element_style)
|
||||
if (!pseudo_element_style.has_value())
|
||||
return;
|
||||
|
||||
auto initial_quote_nesting_level = m_quote_nesting_level;
|
||||
|
@ -221,7 +221,7 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
|
|||
pseudo_element_node->computed_values().list_style_type(),
|
||||
pseudo_element_node->computed_values().list_style_position(),
|
||||
0,
|
||||
*marker_style);
|
||||
marker_style);
|
||||
static_cast<ListItemBox&>(*pseudo_element_node).set_marker(list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
|
||||
pseudo_element_node->append_child(*list_item_marker);
|
||||
|
@ -341,7 +341,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
|
|||
|
||||
auto& document = dom_node.document();
|
||||
auto& style_computer = document.style_computer();
|
||||
RefPtr<CSS::StyleProperties> style;
|
||||
Optional<CSS::StyleProperties> style;
|
||||
CSS::Display display;
|
||||
|
||||
if (is<DOM::Element>(dom_node)) {
|
||||
|
@ -429,7 +429,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
|
|||
if (is<ListItemBox>(*layout_node)) {
|
||||
auto& element = static_cast<DOM::Element&>(dom_node);
|
||||
auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Type::Marker);
|
||||
auto list_item_marker = document.heap().allocate_without_realm<ListItemMarkerBox>(document, layout_node->computed_values().list_style_type(), layout_node->computed_values().list_style_position(), calculate_list_item_index(dom_node), *marker_style);
|
||||
auto list_item_marker = document.heap().allocate_without_realm<ListItemMarkerBox>(document, layout_node->computed_values().list_style_type(), layout_node->computed_values().list_style_position(), calculate_list_item_index(dom_node), marker_style);
|
||||
static_cast<ListItemBox&>(*layout_node).set_marker(list_item_marker);
|
||||
element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
|
||||
layout_node->append_child(*list_item_marker);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(VideoBox);
|
||||
|
||||
VideoBox::VideoBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
VideoBox::VideoBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
{
|
||||
document.register_viewport_client(*this);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
|
||||
|
||||
private:
|
||||
VideoBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
VideoBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
|
||||
|
||||
// ^Document::ViewportClient
|
||||
virtual void did_set_viewport_rect(CSSPixelRect const&) final;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::Layout {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(Viewport);
|
||||
|
||||
Viewport::Viewport(DOM::Document& document, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
Viewport::Viewport(DOM::Document& document, CSS::StyleProperties style)
|
||||
: BlockContainer(document, &document, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class Viewport final : public BlockContainer {
|
|||
JS_DECLARE_ALLOCATOR(Viewport);
|
||||
|
||||
public:
|
||||
explicit Viewport(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
explicit Viewport(DOM::Document&, CSS::StyleProperties);
|
||||
virtual ~Viewport() override;
|
||||
|
||||
struct TextPosition {
|
||||
|
|
|
@ -59,7 +59,7 @@ JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
|
|||
return *m_rel_list;
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
JS::NonnullGCPtr<DOM::DOMTokenList> rel_list();
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
private:
|
||||
SVGAElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -35,7 +35,7 @@ void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<Strin
|
|||
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(CSS::StyleProperties)
|
||||
{
|
||||
// Clip paths are handled as a special case in the TreeBuilder.
|
||||
return nullptr;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
return m_clip_path_units.value_or(ClipPathUnits::UserSpaceOnUse);
|
||||
}
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
private:
|
||||
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -133,8 +133,8 @@ Optional<CSSPixels> SVGDecodedImageData::intrinsic_width() const
|
|||
{
|
||||
// https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
|
||||
m_document->update_style();
|
||||
auto const* root_element_style = m_root_element->computed_css_values();
|
||||
VERIFY(root_element_style);
|
||||
auto const root_element_style = m_root_element->computed_css_values();
|
||||
VERIFY(root_element_style.has_value());
|
||||
auto const& width_value = root_element_style->size_value(CSS::PropertyID::Width);
|
||||
if (width_value.is_length() && width_value.length().is_absolute())
|
||||
return width_value.length().absolute_length_to_px();
|
||||
|
@ -145,8 +145,8 @@ Optional<CSSPixels> SVGDecodedImageData::intrinsic_height() const
|
|||
{
|
||||
// https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
|
||||
m_document->update_style();
|
||||
auto const* root_element_style = m_root_element->computed_css_values();
|
||||
VERIFY(root_element_style);
|
||||
auto const root_element_style = m_root_element->computed_css_values();
|
||||
VERIFY(root_element_style.has_value());
|
||||
auto const& height_value = root_element_style->size_value(CSS::PropertyID::Height);
|
||||
if (height_value.is_length() && height_value.length().is_absolute())
|
||||
return height_value.length().absolute_length_to_px();
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGDefsElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGDefsElement();
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void SVGDescElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGDescElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGDescElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
JS::GCPtr<Layout::Node> SVGDescElement::create_layout_node(CSS::StyleProperties)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGElement::svg_animated_length_for_property
|
|||
{
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto make_length = [&] {
|
||||
if (auto const* style = computed_css_values(); style) {
|
||||
if (auto const style = computed_css_values(); style.has_value()) {
|
||||
if (auto length = style->length_percentage(property); length.has_value())
|
||||
return SVGLength::from_length_percentage(realm(), *length);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_height);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGForeignObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGForeignObjectElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGForeignObjectBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class SVGForeignObjectElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGForeignObjectElement() override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
|
||||
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
|
||||
|
|
|
@ -26,7 +26,7 @@ void SVGGElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGGElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGGElement() override = default;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||
|
||||
private:
|
||||
SVGGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue