From ac72c0b09bc616d0e39dbcdead59b7c00b84f3ea Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Fri, 27 May 2022 21:53:28 +0000 Subject: [PATCH] Rename :popup-open pseudo class to :top-layer This CL just does a rename for the :top-layer pseudo class. It does not change behavior, which is/was that this pseudo class only applies to elements using the Popup API [1], and not to all elements that might inhabit the top layer. That will need to wait for a CSSWG resolution. But for now, the [2] resolution means we should use this pseudo class for the Popup API prototype starting now. [1] https://open-ui.org/components/popup.research.explainer [2] https://github.com/openui/open-ui/issues/470#issuecomment-1138868669 Bug: 1307772 Change-Id: I81a89132b84346a360d7b580f5f39be9da697bdc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3668918 Commit-Queue: Dan Clark Auto-Submit: Mason Freed Reviewed-by: Dan Clark Cr-Commit-Position: refs/heads/main@{#1008430} NOKEYCHECK=True GitOrigin-RevId: c3b17215facf56ce6dcd2b660766c73b52df903b --- blink/renderer/core/css/css_selector.cc | 8 +- blink/renderer/core/css/css_selector.h | 2 +- .../core/css/parser/css_proto_converter.cc | 2 +- blink/renderer/core/css/popup.css | 6 +- blink/renderer/core/css/rule_feature_set.cc | 4 +- blink/renderer/core/css/selector_checker.cc | 2 +- blink/renderer/core/dom/element.cc | 4 +- .../core/inspector/inspector_trace_events.cc | 2 +- .../selectmenu-parts-structure.tentative.html | 10 +- .../popup-anchor-nesting.tentative.html | 8 +- .../popup-attribute-basic.tentative.html | 22 +- .../popups/popup-defaultopen-2.tentative.html | 4 +- .../popups/popup-defaultopen.tentative.html | 16 +- .../popups/popup-events.tentative.html | 10 +- .../popups/popup-focus.tentative.html | 34 +-- .../popup-inside-display-none.tentative.html | 2 +- .../popup-invoking-attribute.tentative.html | 4 +- ...pup-light-dismiss-on-scroll.tentative.html | 2 +- .../popups/popup-light-dismiss.tentative.html | 210 +++++++++--------- ...opup-not-keyboard-focusable.tentative.html | 8 +- .../popups/popup-removal-2.tentative.html | 8 +- .../popups/popup-removal.tentative.html | 4 +- .../popups/popup-shadow-dom.tentative.html | 24 +- .../popups/popup-stacking.tentative.html | 14 +- ...opup-top-layer-interactions.tentative.html | 2 +- .../popups/popup-types.tentative.html | 16 +- .../popup/popup-light-dismiss-keyboard.html | 8 +- .../popup-disabled/popup-disabled.html | 2 +- 28 files changed, 219 insertions(+), 219 deletions(-) diff --git a/blink/renderer/core/css/css_selector.cc b/blink/renderer/core/css/css_selector.cc index aefc69cb33d..b8125240864 100644 --- a/blink/renderer/core/css/css_selector.cc +++ b/blink/renderer/core/css/css_selector.cc @@ -339,8 +339,8 @@ PseudoId CSSSelector::GetPseudoId(PseudoType type) { case kPseudoListBox: case kPseudoMultiSelectFocus: case kPseudoHostHasAppearance: - case kPseudoPopupOpen: case kPseudoSlotted: + case kPseudoTopLayer: case kPseudoVideoPersistent: case kPseudoVideoPersistentAncestor: case kPseudoXrOverlay: @@ -452,7 +452,6 @@ const static NameToPseudoStruct kPseudoTypeWithoutArgumentsMap[] = { {"placeholder", CSSSelector::kPseudoPlaceholder}, {"placeholder-shown", CSSSelector::kPseudoPlaceholderShown}, {"playing", CSSSelector::kPseudoPlaying}, - {"popup-open", CSSSelector::kPseudoPopupOpen}, {"read-only", CSSSelector::kPseudoReadOnly}, {"read-write", CSSSelector::kPseudoReadWrite}, {"required", CSSSelector::kPseudoRequired}, @@ -465,6 +464,7 @@ const static NameToPseudoStruct kPseudoTypeWithoutArgumentsMap[] = { {"start", CSSSelector::kPseudoStart}, {"target", CSSSelector::kPseudoTarget}, {"target-text", CSSSelector::kPseudoTargetText}, + {"top-layer", CSSSelector::kPseudoTopLayer}, {"valid", CSSSelector::kPseudoValid}, {"vertical", CSSSelector::kPseudoVertical}, {"visited", CSSSelector::kPseudoVisited}, @@ -553,7 +553,7 @@ CSSSelector::PseudoType CSSSelector::NameToPseudoType(const AtomicString& name, !RuntimeEnabledFeatures::CSSPseudoPlayingPausedEnabled()) return CSSSelector::kPseudoUnknown; - if (match->type == CSSSelector::kPseudoPopupOpen && + if (match->type == CSSSelector::kPseudoTopLayer && !RuntimeEnabledFeatures::HTMLPopupAttributeEnabled()) return CSSSelector::kPseudoUnknown; @@ -749,7 +749,6 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, case kPseudoPictureInPicture: case kPseudoPlaceholderShown: case kPseudoPlaying: - case kPseudoPopupOpen: case kPseudoReadOnly: case kPseudoReadWrite: case kPseudoRelativeLeftmost: @@ -761,6 +760,7 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, case kPseudoStart: case kPseudoState: case kPseudoTarget: + case kPseudoTopLayer: case kPseudoUnknown: case kPseudoValid: case kPseudoVertical: diff --git a/blink/renderer/core/css/css_selector.h b/blink/renderer/core/css/css_selector.h index 91c44633494..9d01bb76ca1 100644 --- a/blink/renderer/core/css/css_selector.h +++ b/blink/renderer/core/css/css_selector.h @@ -280,7 +280,7 @@ class CORE_EXPORT CSSSelector { kPseudoListBox, kPseudoMultiSelectFocus, kPseudoHostHasAppearance, - kPseudoPopupOpen, + kPseudoTopLayer, kPseudoSlotted, kPseudoVideoPersistent, kPseudoVideoPersistentAncestor, diff --git a/blink/renderer/core/css/parser/css_proto_converter.cc b/blink/renderer/core/css/parser/css_proto_converter.cc index 41ebdf606c7..0da5a8ea569 100644 --- a/blink/renderer/core/css/parser/css_proto_converter.cc +++ b/blink/renderer/core/css/parser/css_proto_converter.cc @@ -104,7 +104,6 @@ const std::string Converter::kPseudoLookupTable[] = { "past", "placeholder", "placeholder-shown", - "popup-open", "read-only", "read-write", "required", @@ -115,6 +114,7 @@ const std::string Converter::kPseudoLookupTable[] = { "single-button", "start", "target", + "top-layer", "valid", "vertical", "visited", diff --git a/blink/renderer/core/css/popup.css b/blink/renderer/core/css/popup.css index bf6e09b15e5..5b3703df15d 100644 --- a/blink/renderer/core/css/popup.css +++ b/blink/renderer/core/css/popup.css @@ -9,9 +9,9 @@ @namespace "http://www.w3.org/1999/xhtml"; -[popup=popup i]:not(:popup-open), -[popup=hint i]:not(:popup-open), -[popup=async i]:not(:popup-open) { +[popup=popup i]:not(:top-layer), +[popup=hint i]:not(:top-layer), +[popup=async i]:not(:top-layer) { display: none; } diff --git a/blink/renderer/core/css/rule_feature_set.cc b/blink/renderer/core/css/rule_feature_set.cc index 84c26e05f26..75f9ec997ef 100644 --- a/blink/renderer/core/css/rule_feature_set.cc +++ b/blink/renderer/core/css/rule_feature_set.cc @@ -176,7 +176,7 @@ bool SupportsInvalidation(CSSSelector::PseudoType type) { case CSSSelector::kPseudoListBox: case CSSSelector::kPseudoMultiSelectFocus: case CSSSelector::kPseudoHostHasAppearance: - case CSSSelector::kPseudoPopupOpen: + case CSSSelector::kPseudoTopLayer: case CSSSelector::kPseudoSlotted: case CSSSelector::kPseudoVideoPersistent: case CSSSelector::kPseudoVideoPersistentAncestor: @@ -648,7 +648,7 @@ InvalidationSet* RuleFeatureSet::InvalidationSetForSimpleSelector( case CSSSelector::kPseudoInRange: case CSSSelector::kPseudoOutOfRange: case CSSSelector::kPseudoDefined: - case CSSSelector::kPseudoPopupOpen: + case CSSSelector::kPseudoTopLayer: case CSSSelector::kPseudoVideoPersistent: case CSSSelector::kPseudoVideoPersistentAncestor: case CSSSelector::kPseudoXrOverlay: diff --git a/blink/renderer/core/css/selector_checker.cc b/blink/renderer/core/css/selector_checker.cc index 73bc0b22f33..1e5ad9a091e 100644 --- a/blink/renderer/core/css/selector_checker.cc +++ b/blink/renderer/core/css/selector_checker.cc @@ -1393,7 +1393,7 @@ bool SelectorChecker::CheckPseudoClass(const SelectorCheckingContext& context, } break; } - case CSSSelector::kPseudoPopupOpen: + case CSSSelector::kPseudoTopLayer: if (element.HasValidPopupAttribute()) { return element.popupOpen(); } diff --git a/blink/renderer/core/dom/element.cc b/blink/renderer/core/dom/element.cc index 4f70a36462a..2b61ea8743a 100644 --- a/blink/renderer/core/dom/element.cc +++ b/blink/renderer/core/dom/element.cc @@ -2485,7 +2485,7 @@ void Element::showPopup(ExceptionState& exception_state) { } GetPopupData()->setOpen(true); GetDocument().AddToTopLayer(this); - PseudoStateChanged(CSSSelector::kPseudoPopupOpen); + PseudoStateChanged(CSSSelector::kPseudoTopLayer); GetPopupData()->setPreviouslyFocusedElement( should_restore_focus ? GetDocument().FocusedElement() : nullptr); SetPopupFocusOnShow(); @@ -2527,7 +2527,7 @@ void Element::hidePopupInternal(HidePopupFocusBehavior focus_behavior) { GetPopupData()->setInvoker(nullptr); GetPopupData()->setNeedsRepositioningForSelectMenu(false); GetDocument().RemoveFromTopLayer(this); - PseudoStateChanged(CSSSelector::kPseudoPopupOpen); + PseudoStateChanged(CSSSelector::kPseudoTopLayer); // Queue the hide event. Event* event = Event::CreateBubble(event_type_names::kHide); event->SetTarget(this); diff --git a/blink/renderer/core/inspector/inspector_trace_events.cc b/blink/renderer/core/inspector/inspector_trace_events.cc index 3aa3ab51d70..a9be6386dc7 100644 --- a/blink/renderer/core/inspector/inspector_trace_events.cc +++ b/blink/renderer/core/inspector/inspector_trace_events.cc @@ -380,7 +380,7 @@ const char* PseudoTypeToString(CSSSelector::PseudoType pseudo_type) { DEFINE_STRING_MAPPING(PseudoIsHtml) DEFINE_STRING_MAPPING(PseudoListBox) DEFINE_STRING_MAPPING(PseudoMultiSelectFocus) - DEFINE_STRING_MAPPING(PseudoPopupOpen) + DEFINE_STRING_MAPPING(PseudoTopLayer) DEFINE_STRING_MAPPING(PseudoHostHasAppearance) DEFINE_STRING_MAPPING(PseudoVideoPersistent) DEFINE_STRING_MAPPING(PseudoVideoPersistentAncestor) diff --git a/blink/web_tests/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html b/blink/web_tests/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html index 927b45cdc15..7a11b57fcb7 100644 --- a/blink/web_tests/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html +++ b/blink/web_tests/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html @@ -208,13 +208,13 @@ const selectMenu1Popup = document.getElementById("selectMenu1-popup"); const selectMenu1Button = document.getElementById("selectMenu1-button"); const selectMenu1Child2 = document.getElementById("selectMenu1-child2"); - assert_false(selectMenu1Popup.matches(':popup-open')); + assert_false(selectMenu1Popup.matches(':top-layer')); selectMenu1Button.click(); - assert_false(selectMenu1Popup.matches(':popup-open'), "Clicking a button part that is a descendant of the listbox part should have no effect"); + assert_false(selectMenu1Popup.matches(':top-layer'), "Clicking a button part that is a descendant of the listbox part should have no effect"); assert_equals(selectMenu1.value, "one"); await clickOn(selectMenu1); - assert_true(selectMenu1Popup.matches(':popup-open')); + assert_true(selectMenu1Popup.matches(':top-layer')); await clickOn(selectMenu1Child2); assert_equals(selectMenu1.value, "two", "Clicking an