mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibWeb/DOM: Rename Node::{paint => paintable}_box()
It returns a PaintableBox, not a 'PaintBox'.
This commit is contained in:
parent
754e458d0a
commit
d58b671ff6
8 changed files with 25 additions and 25 deletions
|
@ -2041,8 +2041,8 @@ void Document::decrement_number_of_things_delaying_the_load_event(Badge<Document
|
||||||
|
|
||||||
void Document::invalidate_stacking_context_tree()
|
void Document::invalidate_stacking_context_tree()
|
||||||
{
|
{
|
||||||
if (auto* paint_box = this->paint_box())
|
if (auto* paintable_box = this->paintable_box())
|
||||||
const_cast<Painting::PaintableBox*>(paint_box)->invalidate_stacking_context();
|
const_cast<Painting::PaintableBox*>(paintable_box)->invalidate_stacking_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::check_favicon_after_loading_link_resource()
|
void Document::check_favicon_after_loading_link_resource()
|
||||||
|
|
|
@ -699,14 +699,14 @@ JS::NonnullGCPtr<Geometry::DOMRect> Element::get_bounding_client_rect() const
|
||||||
const_cast<Document&>(document()).update_layout();
|
const_cast<Document&>(document()).update_layout();
|
||||||
|
|
||||||
// FIXME: Support inline layout nodes as well.
|
// FIXME: Support inline layout nodes as well.
|
||||||
auto* paint_box = this->paint_box();
|
auto* paintable_box = this->paintable_box();
|
||||||
if (!paint_box)
|
if (!paintable_box)
|
||||||
return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors();
|
return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
VERIFY(document().browsing_context());
|
VERIFY(document().browsing_context());
|
||||||
auto viewport_offset = document().browsing_context()->viewport_scroll_offset();
|
auto viewport_offset = document().browsing_context()->viewport_scroll_offset();
|
||||||
|
|
||||||
return Geometry::DOMRect::create(realm(), paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type<float>()).release_value_but_fixme_should_propagate_errors();
|
return Geometry::DOMRect::create(realm(), paintable_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type<float>()).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
|
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
|
||||||
|
@ -784,12 +784,12 @@ int Element::client_width() const
|
||||||
const_cast<Document&>(document()).update_layout();
|
const_cast<Document&>(document()).update_layout();
|
||||||
|
|
||||||
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
||||||
if (!paint_box())
|
if (!paintable_box())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// 3. Return the width of the padding edge excluding the width of any rendered scrollbar between the padding edge and the border edge,
|
// 3. Return the width of the padding edge excluding the width of any rendered scrollbar between the padding edge and the border edge,
|
||||||
// ignoring any transforms that apply to the element and its ancestors.
|
// ignoring any transforms that apply to the element and its ancestors.
|
||||||
return paint_box()->absolute_padding_box_rect().width().value();
|
return paintable_box()->absolute_padding_box_rect().width().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-element-clientheight
|
// https://drafts.csswg.org/cssom-view/#dom-element-clientheight
|
||||||
|
@ -809,12 +809,12 @@ int Element::client_height() const
|
||||||
const_cast<Document&>(document()).update_layout();
|
const_cast<Document&>(document()).update_layout();
|
||||||
|
|
||||||
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
||||||
if (!paint_box())
|
if (!paintable_box())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// 3. Return the height of the padding edge excluding the height of any rendered scrollbar between the padding edge and the border edge,
|
// 3. Return the height of the padding edge excluding the height of any rendered scrollbar between the padding edge and the border edge,
|
||||||
// ignoring any transforms that apply to the element and its ancestors.
|
// ignoring any transforms that apply to the element and its ancestors.
|
||||||
return paint_box()->absolute_padding_box_rect().height().value();
|
return paintable_box()->absolute_padding_box_rect().height().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::children_changed()
|
void Element::children_changed()
|
||||||
|
|
|
@ -1407,7 +1407,7 @@ Painting::Paintable const* Node::paintable() const
|
||||||
return layout_node()->paintable();
|
return layout_node()->paintable();
|
||||||
}
|
}
|
||||||
|
|
||||||
Painting::PaintableBox const* Node::paint_box() const
|
Painting::PaintableBox const* Node::paintable_box() const
|
||||||
{
|
{
|
||||||
if (!layout_node())
|
if (!layout_node())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -175,7 +175,7 @@ public:
|
||||||
Layout::Node const* layout_node() const { return m_layout_node; }
|
Layout::Node const* layout_node() const { return m_layout_node; }
|
||||||
Layout::Node* layout_node() { return m_layout_node; }
|
Layout::Node* layout_node() { return m_layout_node; }
|
||||||
|
|
||||||
Painting::PaintableBox const* paint_box() const;
|
Painting::PaintableBox const* paintable_box() const;
|
||||||
Painting::Paintable const* paintable() const;
|
Painting::Paintable const* paintable() const;
|
||||||
|
|
||||||
void set_layout_node(Badge<Layout::Node>, JS::NonnullGCPtr<Layout::Node>);
|
void set_layout_node(Badge<Layout::Node>, JS::NonnullGCPtr<Layout::Node>);
|
||||||
|
|
|
@ -200,13 +200,13 @@ int HTMLElement::offset_width() const
|
||||||
const_cast<DOM::Document&>(document()).update_layout();
|
const_cast<DOM::Document&>(document()).update_layout();
|
||||||
|
|
||||||
// 1. If the element does not have any associated CSS layout box return zero and terminate this algorithm.
|
// 1. If the element does not have any associated CSS layout box return zero and terminate this algorithm.
|
||||||
if (!paint_box())
|
if (!paintable_box())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// 2. Return the width of the axis-aligned bounding box of the border boxes of all fragments generated by the element’s principal box,
|
// 2. Return the width of the axis-aligned bounding box of the border boxes of all fragments generated by the element’s principal box,
|
||||||
// ignoring any transforms that apply to the element and its ancestors.
|
// ignoring any transforms that apply to the element and its ancestors.
|
||||||
// FIXME: Account for inline boxes.
|
// FIXME: Account for inline boxes.
|
||||||
return paint_box()->border_box_width().value();
|
return paintable_box()->border_box_width().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetheight
|
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetheight
|
||||||
|
@ -216,13 +216,13 @@ int HTMLElement::offset_height() const
|
||||||
const_cast<DOM::Document&>(document()).update_layout();
|
const_cast<DOM::Document&>(document()).update_layout();
|
||||||
|
|
||||||
// 1. If the element does not have any associated CSS layout box return zero and terminate this algorithm.
|
// 1. If the element does not have any associated CSS layout box return zero and terminate this algorithm.
|
||||||
if (!paint_box())
|
if (!paintable_box())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// 2. Return the height of the axis-aligned bounding box of the border boxes of all fragments generated by the element’s principal box,
|
// 2. Return the height of the axis-aligned bounding box of the border boxes of all fragments generated by the element’s principal box,
|
||||||
// ignoring any transforms that apply to the element and its ancestors.
|
// ignoring any transforms that apply to the element and its ancestors.
|
||||||
// FIXME: Account for inline boxes.
|
// FIXME: Account for inline boxes.
|
||||||
return paint_box()->border_box_height().value();
|
return paintable_box()->border_box_height().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/links.html#cannot-navigate
|
// https://html.spec.whatwg.org/multipage/links.html#cannot-navigate
|
||||||
|
|
|
@ -112,8 +112,8 @@ unsigned HTMLImageElement::width() const
|
||||||
const_cast<DOM::Document&>(document()).update_layout();
|
const_cast<DOM::Document&>(document()).update_layout();
|
||||||
|
|
||||||
// Return the rendered width of the image, in CSS pixels, if the image is being rendered.
|
// Return the rendered width of the image, in CSS pixels, if the image is being rendered.
|
||||||
if (auto* paint_box = this->paint_box())
|
if (auto* paintable_box = this->paintable_box())
|
||||||
return paint_box->content_width().value();
|
return paintable_box->content_width().value();
|
||||||
|
|
||||||
// NOTE: This step seems to not be in the spec, but all browsers do it.
|
// NOTE: This step seems to not be in the spec, but all browsers do it.
|
||||||
auto width_attr = get_attribute(HTML::AttributeNames::width);
|
auto width_attr = get_attribute(HTML::AttributeNames::width);
|
||||||
|
@ -140,8 +140,8 @@ unsigned HTMLImageElement::height() const
|
||||||
const_cast<DOM::Document&>(document()).update_layout();
|
const_cast<DOM::Document&>(document()).update_layout();
|
||||||
|
|
||||||
// Return the rendered height of the image, in CSS pixels, if the image is being rendered.
|
// Return the rendered height of the image, in CSS pixels, if the image is being rendered.
|
||||||
if (auto* paint_box = this->paint_box())
|
if (auto* paintable_box = this->paintable_box())
|
||||||
return paint_box->content_height().value();
|
return paintable_box->content_height().value();
|
||||||
|
|
||||||
// NOTE: This step seems to not be in the spec, but all browsers do it.
|
// NOTE: This step seems to not be in the spec, but all browsers do it.
|
||||||
auto height_attr = get_attribute(HTML::AttributeNames::height);
|
auto height_attr = get_attribute(HTML::AttributeNames::height);
|
||||||
|
|
|
@ -47,7 +47,7 @@ Optional<Gfx::AffineTransform> SVGGeometryBox::layout_transform() const
|
||||||
auto scaled_height = paintable_box()->content_height().value();
|
auto scaled_height = paintable_box()->content_height().value();
|
||||||
scaling = min(scaled_width / original_bounding_box.width(), scaled_height / original_bounding_box.height());
|
scaling = min(scaled_width / original_bounding_box.width(), scaled_height / original_bounding_box.height());
|
||||||
auto scaled_bounding_box = original_bounding_box.scaled(scaling, scaling);
|
auto scaled_bounding_box = original_bounding_box.scaled(scaling, scaling);
|
||||||
paint_offset = (paintable_box()->absolute_rect().location() - svg_box->paint_box()->absolute_rect().location()).to_type<float>() - scaled_bounding_box.location();
|
paint_offset = (paintable_box()->absolute_rect().location() - svg_box->paintable_box()->absolute_rect().location()).to_type<float>() - scaled_bounding_box.location();
|
||||||
}
|
}
|
||||||
return Gfx::AffineTransform {}.translate(paint_offset).scale(scaling, scaling).translate(-origin).multiply(transform);
|
return Gfx::AffineTransform {}.translate(paint_offset).scale(scaling, scaling).translate(-origin).multiply(transform);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,14 +146,14 @@ Painting::PaintableBox* EventHandler::paint_root()
|
||||||
{
|
{
|
||||||
if (!m_browsing_context->active_document())
|
if (!m_browsing_context->active_document())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return const_cast<Painting::PaintableBox*>(m_browsing_context->active_document()->paint_box());
|
return const_cast<Painting::PaintableBox*>(m_browsing_context->active_document()->paintable_box());
|
||||||
}
|
}
|
||||||
|
|
||||||
Painting::PaintableBox const* EventHandler::paint_root() const
|
Painting::PaintableBox const* EventHandler::paint_root() const
|
||||||
{
|
{
|
||||||
if (!m_browsing_context->active_document())
|
if (!m_browsing_context->active_document())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return const_cast<Painting::PaintableBox*>(m_browsing_context->active_document()->paint_box());
|
return const_cast<Painting::PaintableBox*>(m_browsing_context->active_document()->paintable_box());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, unsigned buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y)
|
bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, unsigned buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y)
|
||||||
|
@ -385,7 +385,7 @@ bool EventHandler::handle_mousedown(CSSPixelPoint position, unsigned button, uns
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Dispatching an event may have disturbed the world.
|
// NOTE: Dispatching an event may have disturbed the world.
|
||||||
if (!paint_root() || paint_root() != node->document().paint_box())
|
if (!paint_root() || paint_root() != node->document().paintable_box())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (button == GUI::MouseButton::Primary) {
|
if (button == GUI::MouseButton::Primary) {
|
||||||
|
@ -499,7 +499,7 @@ bool EventHandler::handle_mousemove(CSSPixelPoint position, unsigned buttons, un
|
||||||
auto page_offset = compute_mouse_event_page_offset(client_offset);
|
auto page_offset = compute_mouse_event_page_offset(client_offset);
|
||||||
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::mousemove, offset, client_offset, page_offset, buttons).release_value_but_fixme_should_propagate_errors());
|
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::mousemove, offset, client_offset, page_offset, buttons).release_value_but_fixme_should_propagate_errors());
|
||||||
// NOTE: Dispatching an event may have disturbed the world.
|
// NOTE: Dispatching an event may have disturbed the world.
|
||||||
if (!paint_root() || paint_root() != node->document().paint_box())
|
if (!paint_root() || paint_root() != node->document().paintable_box())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_in_mouse_selection) {
|
if (m_in_mouse_selection) {
|
||||||
|
@ -589,7 +589,7 @@ bool EventHandler::handle_doubleclick(CSSPixelPoint position, unsigned button, u
|
||||||
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::dblclick, offset, client_offset, page_offset, buttons, button).release_value_but_fixme_should_propagate_errors());
|
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::dblclick, offset, client_offset, page_offset, buttons, button).release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
||||||
// NOTE: Dispatching an event may have disturbed the world.
|
// NOTE: Dispatching an event may have disturbed the world.
|
||||||
if (!paint_root() || paint_root() != node->document().paint_box())
|
if (!paint_root() || paint_root() != node->document().paintable_box())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (button == GUI::MouseButton::Primary) {
|
if (button == GUI::MouseButton::Primary) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue