From 9c0fbe2f0f71bd6b4945a66db8d8fb06eed460c2 Mon Sep 17 00:00:00 2001 From: Xiaocheng Hu Date: Mon, 28 Nov 2022 15:05:45 -0800 Subject: [PATCH] [popover][anchor-position] Implement implicit anchoring (2/2) - https://drafts.csswg.org/css-anchor-1/#implicit-anchor-element - https://github.com/josepharhar/html/pull/2 This is the 2/2 patch implementing implicit anchoring for popovers, focusing on layout-level changes. With the info of which elements are used as implicit anchors, this patch adds the implicit anchors into NG*AnchorQuery with LayoutObject as keys, so that implicit anchor queries can be evaluated without an anchor name. At a more detailed level, now all the NG*AnchorQuery classes need to maintain two hashmaps: one keyed by names for the named anchors, and the other keyed by LayoutObjects for the implicit anchors. To reduce code verbosity, the common structure of these classes is abstracted into a base class NGAnchorQueryBase. Bug: 1307772, 1380112 Change-Id: I9bdec5e3c08f9b9b20442503dedf32995643f037 --- ...r-anchor-change-display-ref.tentative.html | 24 +++++++++ ...pover-anchor-change-display.tentative.html | 50 +++++++++++++++++++ ...popover-anchor-display-none.tentative.html | 33 ++++++++++++ .../popover-anchor-display.tentative.html | 2 +- 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 html/semantics/popovers/popover-anchor-change-display-ref.tentative.html create mode 100644 html/semantics/popovers/popover-anchor-change-display.tentative.html create mode 100644 html/semantics/popovers/popover-anchor-display-none.tentative.html diff --git a/html/semantics/popovers/popover-anchor-change-display-ref.tentative.html b/html/semantics/popovers/popover-anchor-change-display-ref.tentative.html new file mode 100644 index 000000000000000..9530e7d3c4b98d7 --- /dev/null +++ b/html/semantics/popovers/popover-anchor-change-display-ref.tentative.html @@ -0,0 +1,24 @@ + + + +

There should be a green box attached to the right side of each orange box.

+
+
+ + diff --git a/html/semantics/popovers/popover-anchor-change-display.tentative.html b/html/semantics/popovers/popover-anchor-change-display.tentative.html new file mode 100644 index 000000000000000..a10331b2ae93930 --- /dev/null +++ b/html/semantics/popovers/popover-anchor-change-display.tentative.html @@ -0,0 +1,50 @@ + + + + + + + +

There should be a green box attached to the right side of each orange box.

+ +
+
+
+
+ +
+
+
+
+ + + + diff --git a/html/semantics/popovers/popover-anchor-display-none.tentative.html b/html/semantics/popovers/popover-anchor-display-none.tentative.html new file mode 100644 index 000000000000000..a4285607fd30360 --- /dev/null +++ b/html/semantics/popovers/popover-anchor-display-none.tentative.html @@ -0,0 +1,33 @@ + + +Tests that a popover can be anchored to an unrendered element. + + + + + +
+
+ + + + diff --git a/html/semantics/popovers/popover-anchor-display.tentative.html b/html/semantics/popovers/popover-anchor-display.tentative.html index 103bc9849fdbd60..b7079279edab6b1 100644 --- a/html/semantics/popovers/popover-anchor-display.tentative.html +++ b/html/semantics/popovers/popover-anchor-display.tentative.html @@ -10,7 +10,7 @@
-
+