From 78729953368ce9ac2ad8f3a0a12f0007ab3bfff2 Mon Sep 17 00:00:00 2001 From: Xiaocheng Hu Date: Thu, 1 Dec 2022 13:22:03 -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 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4053342 Reviewed-by: Ian Kilpatrick Reviewed-by: Koji Ishii Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#1078270} --- ...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-ref.tentative.html | 1 + .../popover-anchor-display.tentative.html | 19 +++++- ...ver-anchor-multicol-display.tentative.html | 62 +++++++++++++++++++ 6 files changed, 188 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 create mode 100644 html/semantics/popovers/popover-anchor-multicol-display.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-ref.tentative.html b/html/semantics/popovers/popover-anchor-display-ref.tentative.html index a04d2dd5ac14415..b9710ee5b5ee536 100644 --- a/html/semantics/popovers/popover-anchor-display-ref.tentative.html +++ b/html/semantics/popovers/popover-anchor-display-ref.tentative.html @@ -6,6 +6,7 @@
+
diff --git a/html/semantics/popovers/popover-anchor-multicol-display.tentative.html b/html/semantics/popovers/popover-anchor-multicol-display.tentative.html new file mode 100644 index 000000000000000..fe65ec5ba4ebac6 --- /dev/null +++ b/html/semantics/popovers/popover-anchor-multicol-display.tentative.html @@ -0,0 +1,62 @@ + +Tests popovers with implicit anchors in out-of-flow boxes + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +