mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibWeb: Implement some viewport proximity features
This commit is contained in:
parent
8632ce5cdd
commit
331b1b22f5
Notes:
github-actions[bot]
2025-01-04 11:54:35 +00:00
Author: https://github.com/Psychpsyo
Commit: 331b1b22f5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2603
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 119 additions and 3 deletions
|
@ -85,6 +85,17 @@ enum class CustomElementState {
|
|||
Custom,
|
||||
};
|
||||
|
||||
// https://drafts.csswg.org/css-contain/#proximity-to-the-viewport
|
||||
// An element that has content-visibility: auto is in one of three states when it comes to its proximity to the viewport:
|
||||
enum class ProximityToTheViewport {
|
||||
// - The element is close to the viewport:
|
||||
CloseToTheViewport,
|
||||
// - The element is far away from the viewport:
|
||||
FarAwayFromTheViewport,
|
||||
// - The element’s proximity to the viewport is not determined:
|
||||
NotDetermined,
|
||||
};
|
||||
|
||||
class Element
|
||||
: public ParentNode
|
||||
, public ChildNode<Element>
|
||||
|
@ -377,6 +388,10 @@ public:
|
|||
void resolve_counters(CSS::ComputedProperties&);
|
||||
void inherit_counters();
|
||||
|
||||
ProximityToTheViewport proximity_to_the_viewport() const { return m_proximity_to_the_viewport; }
|
||||
void determine_proximity_to_the_viewport();
|
||||
bool is_relevant_to_the_user();
|
||||
|
||||
protected:
|
||||
Element(Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
@ -469,6 +484,9 @@ private:
|
|||
OwnPtr<CSS::CountersSet> m_counters_set;
|
||||
|
||||
GC::Ptr<DOM::Element> m_aria_active_descendant_element;
|
||||
|
||||
// https://drafts.csswg.org/css-contain/#proximity-to-the-viewport
|
||||
ProximityToTheViewport m_proximity_to_the_viewport { ProximityToTheViewport::NotDetermined };
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue