1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibHTML+Browser: Support scrolling to anchor with <a href="#foo">

This patch implements basic support for <a href="#foo"> fragment links.

To figure out where we actually want to scroll to, we have to do
something different based on the layout node's box type. So if it's a
regular LayoutBox we can just use the LayoutBox::position().

However, if it's an inline layout node, we use the position of the
first line box fragment in the containing block contributed by this
layout node or one of its descendants.
This commit is contained in:
Andreas Kling 2019-10-20 09:14:12 +02:00
parent 202dfbd6cd
commit c41bae3d54
8 changed files with 100 additions and 13 deletions

View file

@ -80,9 +80,6 @@ public:
virtual void set_needs_display();
template<typename Callback>
void for_each_fragment_of_this(Callback);
bool children_are_inline() const { return m_children_are_inline; }
void set_children_are_inline(bool value) { m_children_are_inline = value; }
@ -104,6 +101,8 @@ public:
template<typename T>
T* first_ancestor_of_type();
Point box_type_agnostic_position() const;
protected:
explicit LayoutNode(const Node*);