diff --git a/blink/renderer/core/css/css_selector.cc b/blink/renderer/core/css/css_selector.cc index 2c0e2491817..ab07633484a 100644 --- a/blink/renderer/core/css/css_selector.cc +++ b/blink/renderer/core/css/css_selector.cc @@ -258,106 +258,106 @@ PseudoId CSSSelector::GetPseudoId(PseudoType type) { return kPseudoIdPageTransitionOutgoingImage; case kPseudoPageTransitionIncomingImage: return kPseudoIdPageTransitionIncomingImage; - case kPseudoUnknown: - case kPseudoEmpty: - case kPseudoFirstChild: - case kPseudoFirstOfType: - case kPseudoLastChild: - case kPseudoLastOfType: - case kPseudoOnlyChild: - case kPseudoOnlyOfType: - case kPseudoNthChild: - case kPseudoNthOfType: - case kPseudoNthLastChild: - case kPseudoNthLastOfType: - case kPseudoLink: - case kPseudoVisited: + case kPseudoActive: case kPseudoAny: - case kPseudoIs: - case kPseudoWhere: case kPseudoAnyLink: - case kPseudoWebkitAnyLink: case kPseudoAutofill: - case kPseudoWebKitAutofill: case kPseudoAutofillPreviewed: case kPseudoAutofillSelected: - case kPseudoHover: + case kPseudoBlinkInternalElement: + case kPseudoChecked: + case kPseudoCornerPresent: + case kPseudoCue: + case kPseudoDecrement: + case kPseudoDefault: + case kPseudoDefined: + case kPseudoDir: + case kPseudoDisabled: + case kPseudoDoubleButton: case kPseudoDrag: + case kPseudoEmpty: + case kPseudoEnabled: + case kPseudoEnd: + case kPseudoFileSelectorButton: + case kPseudoFirstChild: + case kPseudoFirstOfType: + case kPseudoFirstPage: case kPseudoFocus: case kPseudoFocusVisible: case kPseudoFocusWithin: - case kPseudoActive: - case kPseudoChecked: - case kPseudoEnabled: case kPseudoFullPageMedia: - case kPseudoDefault: - case kPseudoDisabled: - case kPseudoOptional: - case kPseudoPlaceholder: - case kPseudoPlaceholderShown: - case kPseudoFileSelectorButton: - case kPseudoRequired: - case kPseudoReadOnly: - case kPseudoReadWrite: - case kPseudoValid: - case kPseudoInvalid: + case kPseudoFullScreen: + case kPseudoFullScreenAncestor: + case kPseudoFullscreen: + case kPseudoFutureCue: + case kPseudoHas: + case kPseudoHasDatalist: + case kPseudoHorizontal: + case kPseudoHost: + case kPseudoHostContext: + case kPseudoHostHasAppearance: + case kPseudoHover: + case kPseudoInRange: + case kPseudoIncrement: case kPseudoIndeterminate: - case kPseudoTarget: + case kPseudoInvalid: + case kPseudoIs: + case kPseudoIsHtml: case kPseudoLang: - case kPseudoDir: - case kPseudoNot: - case kPseudoRoot: - case kPseudoScope: - case kPseudoWindowInactive: - case kPseudoCornerPresent: - case kPseudoDecrement: - case kPseudoIncrement: - case kPseudoHorizontal: - case kPseudoVertical: - case kPseudoStart: - case kPseudoEnd: - case kPseudoDoubleButton: - case kPseudoSingleButton: - case kPseudoNoButton: - case kPseudoFirstPage: + case kPseudoLastChild: + case kPseudoLastOfType: case kPseudoLeftPage: - case kPseudoRightPage: - case kPseudoInRange: + case kPseudoLink: + case kPseudoListBox: + case kPseudoModal: + case kPseudoMultiSelectFocus: + case kPseudoNoButton: + case kPseudoNot: + case kPseudoNthChild: + case kPseudoNthLastChild: + case kPseudoNthLastOfType: + case kPseudoNthOfType: + case kPseudoOnlyChild: + case kPseudoOnlyOfType: + case kPseudoOpen: + case kPseudoOptional: case kPseudoOutOfRange: - case kPseudoToggle: - case kPseudoWebKitCustomElement: - case kPseudoBlinkInternalElement: - case kPseudoCue: - case kPseudoFutureCue: - case kPseudoPastCue: - case kPseudoDefined: - case kPseudoHost: - case kPseudoHostContext: case kPseudoPart: - case kPseudoState: - case kPseudoFullScreen: - case kPseudoFullScreenAncestor: - case kPseudoFullscreen: + case kPseudoPastCue: case kPseudoPaused: case kPseudoPictureInPicture: + case kPseudoPlaceholder: + case kPseudoPlaceholderShown: case kPseudoPlaying: + case kPseudoPopupHidden: + case kPseudoReadOnly: + case kPseudoReadWrite: + case kPseudoRelativeAnchor: + case kPseudoRequired: + case kPseudoRightPage: + case kPseudoRoot: + case kPseudoScope: + case kPseudoSelectorFragmentAnchor: + case kPseudoSingleButton: + case kPseudoSlotted: case kPseudoSpatialNavigationFocus: case kPseudoSpatialNavigationInterest: - case kPseudoHasDatalist: - case kPseudoIsHtml: - case kPseudoListBox: - case kPseudoMultiSelectFocus: - case kPseudoHostHasAppearance: - case kPseudoSlotted: - case kPseudoTopLayer: - case kPseudoPopupHidden: + case kPseudoStart: + case kPseudoState: + case kPseudoTarget: + case kPseudoToggle: + case kPseudoUnknown: + case kPseudoValid: + case kPseudoVertical: case kPseudoVideoPersistent: case kPseudoVideoPersistentAncestor: + case kPseudoVisited: + case kPseudoWebKitAutofill: + case kPseudoWebKitCustomElement: + case kPseudoWebkitAnyLink: + case kPseudoWhere: + case kPseudoWindowInactive: case kPseudoXrOverlay: - case kPseudoModal: - case kPseudoSelectorFragmentAnchor: - case kPseudoHas: - case kPseudoRelativeAnchor: return kPseudoIdNone; } @@ -454,6 +454,7 @@ const static NameToPseudoStruct kPseudoTypeWithoutArgumentsMap[] = { {"no-button", CSSSelector::kPseudoNoButton}, {"only-child", CSSSelector::kPseudoOnlyChild}, {"only-of-type", CSSSelector::kPseudoOnlyOfType}, + {"open", CSSSelector::kPseudoOpen}, {"optional", CSSSelector::kPseudoOptional}, {"out-of-range", CSSSelector::kPseudoOutOfRange}, {"page-transition", CSSSelector::kPseudoPageTransition}, @@ -475,7 +476,6 @@ 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}, @@ -573,7 +573,7 @@ CSSSelector::PseudoType CSSSelector::NameToPseudoType( bool popup_attribute_enabled = !document || RuntimeEnabledFeatures::HTMLPopupAttributeEnabled( document->GetExecutionContext()); - if (match->type == CSSSelector::kPseudoTopLayer && !popup_attribute_enabled) + if (match->type == CSSSelector::kPseudoOpen && !popup_attribute_enabled) return CSSSelector::kPseudoUnknown; if (match->type == CSSSelector::kPseudoPopupHidden && @@ -771,6 +771,7 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, case kPseudoNthOfType: case kPseudoOnlyChild: case kPseudoOnlyOfType: + case kPseudoOpen: case kPseudoOptional: case kPseudoOutOfRange: case kPseudoPastCue: @@ -791,7 +792,6 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, case kPseudoState: case kPseudoTarget: case kPseudoToggle: - 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 a8a6a7f4e47..66bdd878516 100644 --- a/blink/renderer/core/css/css_selector.h +++ b/blink/renderer/core/css/css_selector.h @@ -173,64 +173,65 @@ class CORE_EXPORT CSSSelector { }; enum PseudoType { - kPseudoUnknown, - kPseudoEmpty, - kPseudoFirstChild, - kPseudoFirstOfType, - kPseudoLastChild, - kPseudoLastOfType, - kPseudoOnlyChild, - kPseudoOnlyOfType, - kPseudoFirstLine, - kPseudoFirstLetter, - kPseudoNthChild, - kPseudoNthOfType, - kPseudoNthLastChild, - kPseudoNthLastOfType, - kPseudoPart, - kPseudoState, - kPseudoLink, - kPseudoVisited, + kPseudoActive, + kPseudoAfter, kPseudoAny, - kPseudoIs, - kPseudoWhere, kPseudoAnyLink, - kPseudoWebkitAnyLink, kPseudoAutofill, - kPseudoWebKitAutofill, kPseudoAutofillPreviewed, kPseudoAutofillSelected, - kPseudoHover, + kPseudoBackdrop, + kPseudoBefore, + kPseudoChecked, + kPseudoCornerPresent, + kPseudoDecrement, + kPseudoDefault, + kPseudoDisabled, + kPseudoDoubleButton, kPseudoDrag, + kPseudoEmpty, + kPseudoEnabled, + kPseudoEnd, + kPseudoFileSelectorButton, + kPseudoFirstChild, + kPseudoFirstLetter, + kPseudoFirstLine, + kPseudoFirstOfType, + kPseudoFirstPage, kPseudoFocus, kPseudoFocusVisible, kPseudoFocusWithin, - kPseudoActive, - kPseudoChecked, - kPseudoEnabled, kPseudoFullPageMedia, - kPseudoDefault, - kPseudoDisabled, - kPseudoOptional, - kPseudoPlaceholderShown, - kPseudoRequired, - kPseudoReadOnly, - kPseudoReadWrite, - kPseudoValid, - kPseudoInvalid, + kPseudoHorizontal, + kPseudoHover, + kPseudoIncrement, kPseudoIndeterminate, - kPseudoTarget, - kPseudoBefore, - kPseudoAfter, + kPseudoInvalid, + kPseudoIs, + kPseudoLang, + kPseudoLastChild, + kPseudoLastOfType, + kPseudoLeftPage, + kPseudoLink, kPseudoMarker, kPseudoModal, - kPseudoSelectorFragmentAnchor, - kPseudoBackdrop, - kPseudoLang, + kPseudoNoButton, kPseudoNot, + kPseudoNthChild, + kPseudoNthLastChild, + kPseudoNthLastOfType, + kPseudoNthOfType, + kPseudoOnlyChild, + kPseudoOnlyOfType, + kPseudoOptional, + kPseudoPart, kPseudoPlaceholder, - kPseudoFileSelectorButton, + kPseudoPlaceholderShown, + kPseudoReadOnly, + kPseudoReadWrite, + kPseudoRequired, kPseudoResizer, + kPseudoRightPage, kPseudoRoot, kPseudoScope, kPseudoScrollbar, @@ -239,21 +240,20 @@ class CORE_EXPORT CSSSelector { kPseudoScrollbarThumb, kPseudoScrollbarTrack, kPseudoScrollbarTrackPiece, - kPseudoWindowInactive, - kPseudoCornerPresent, - kPseudoDecrement, - kPseudoIncrement, - kPseudoHorizontal, - kPseudoVertical, - kPseudoStart, - kPseudoEnd, - kPseudoDoubleButton, - kPseudoSingleButton, - kPseudoNoButton, kPseudoSelection, - kPseudoLeftPage, - kPseudoRightPage, - kPseudoFirstPage, + kPseudoSelectorFragmentAnchor, + kPseudoSingleButton, + kPseudoStart, + kPseudoState, + kPseudoTarget, + kPseudoUnknown, + kPseudoValid, + kPseudoVertical, + kPseudoVisited, + kPseudoWebKitAutofill, + kPseudoWebkitAnyLink, + kPseudoWhere, + kPseudoWindowInactive, // TODO(foolip): When the unprefixed Fullscreen API is enabled, merge // kPseudoFullScreen and kPseudoFullscreen into one. (kPseudoFullscreen is // controlled by the FullscreenUnprefixed REF, but is otherwise an alias.) @@ -284,7 +284,7 @@ class CORE_EXPORT CSSSelector { kPseudoListBox, kPseudoMultiSelectFocus, kPseudoHostHasAppearance, - kPseudoTopLayer, + kPseudoOpen, kPseudoPopupHidden, kPseudoSlotted, kPseudoVideoPersistent, diff --git a/blink/renderer/core/css/parser/css_proto_converter.cc b/blink/renderer/core/css/parser/css_proto_converter.cc index 64aadd42b8f..b289249b6d8 100644 --- a/blink/renderer/core/css/parser/css_proto_converter.cc +++ b/blink/renderer/core/css/parser/css_proto_converter.cc @@ -100,6 +100,7 @@ const std::string Converter::kPseudoLookupTable[] = { "no-button", "only-child", "only-of-type", + "open", "optional", "out-of-range", "past", @@ -115,7 +116,6 @@ const std::string Converter::kPseudoLookupTable[] = { "single-button", "start", "target", - "top-layer", "valid", "vertical", "visited", diff --git a/blink/renderer/core/css/rule_feature_set.cc b/blink/renderer/core/css/rule_feature_set.cc index e8c3e0d0e01..fdc37e68643 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::kPseudoTopLayer: + case CSSSelector::kPseudoOpen: case CSSSelector::kPseudoPopupHidden: case CSSSelector::kPseudoSlotted: case CSSSelector::kPseudoVideoPersistent: @@ -652,7 +652,7 @@ InvalidationSet* RuleFeatureSet::InvalidationSetForSimpleSelector( case CSSSelector::kPseudoInRange: case CSSSelector::kPseudoOutOfRange: case CSSSelector::kPseudoDefined: - case CSSSelector::kPseudoTopLayer: + case CSSSelector::kPseudoOpen: case CSSSelector::kPseudoPopupHidden: case CSSSelector::kPseudoVideoPersistent: case CSSSelector::kPseudoVideoPersistentAncestor: diff --git a/blink/renderer/core/css/selector_checker.cc b/blink/renderer/core/css/selector_checker.cc index b113230a524..36f8c991b88 100644 --- a/blink/renderer/core/css/selector_checker.cc +++ b/blink/renderer/core/css/selector_checker.cc @@ -1498,7 +1498,7 @@ bool SelectorChecker::CheckPseudoClass(const SelectorCheckingContext& context, } break; } - case CSSSelector::kPseudoTopLayer: + case CSSSelector::kPseudoOpen: if (element.HasValidPopupAttribute()) { return element.popupOpen(); } diff --git a/blink/renderer/core/dom/element.cc b/blink/renderer/core/dom/element.cc index 0713ac92cf3..323e07afd18 100644 --- a/blink/renderer/core/dom/element.cc +++ b/blink/renderer/core/dom/element.cc @@ -2486,7 +2486,7 @@ PopupValueType Element::PopupType() const { return GetPopupData() ? GetPopupData()->type() : PopupValueType::kNone; } -// This should be true when :top-layer should match. +// This should be true when `:open` should match. bool Element::popupOpen() const { DCHECK(RuntimeEnabledFeatures::HTMLPopupAttributeEnabled( GetDocument().GetExecutionContext())); @@ -2501,7 +2501,7 @@ bool Element::popupOpen() const { // style. // 2. Update style. (Transition initial style can be specified in this // state.) -// 3. Set the :top-layer pseudo class. +// 3. Set the `:open` pseudo class. // 4. Update style. (Animations/transitions happen here.) void Element::showPopUp(ExceptionState& exception_state) { DCHECK(RuntimeEnabledFeatures::HTMLPopupAttributeEnabled( @@ -2584,14 +2584,14 @@ void Element::showPopUp(ExceptionState& exception_state) { PseudoStateChanged(CSSSelector::kPseudoPopupHidden); // Force a style update. This ensures that base property values are set prior - // to `:top-layer` matching, so that transitions can start on the change to + // to `:open` matching, so that transitions can start on the change to // top layer. document.UpdateStyleAndLayoutTreeForNode(this); EnsureComputedStyle(); - // Make the popup match :top-layer: + // Make the popup match `:open`: GetPopupData()->setVisibilityState(PopupVisibilityState::kShowing); - PseudoStateChanged(CSSSelector::kPseudoTopLayer); + PseudoStateChanged(CSSSelector::kPseudoOpen); SetPopupFocusOnShow(); @@ -2691,7 +2691,7 @@ void Element::hidePopUp(ExceptionState& exception_state) { // transitions: // 1. Capture any already-running animations via getAnimations(), including // animations on descendant elements. -// 2. Remove the :top-layer pseudo class. +// 2. Remove the `:open` pseudo class. // 3. Fire the 'hide' event. // 4. If the hidePopup() call is *not* the result of the pop-up being "forced // out" of the top layer, e.g. by a modal dialog or fullscreen element: @@ -2744,9 +2744,9 @@ void Element::HidePopUpInternal(HidePopupFocusBehavior focus_behavior, GetPopupData()->setInvoker(nullptr); GetPopupData()->setNeedsRepositioningForSelectMenu(false); - // Stop matching :top-layer: + // Stop matching `:open`: GetPopupData()->setVisibilityState(PopupVisibilityState::kTransitioning); - PseudoStateChanged(CSSSelector::kPseudoTopLayer); + PseudoStateChanged(CSSSelector::kPseudoOpen); // Fire the hide event (bubbles, not cancelable). Event* event = Event::CreateBubble(event_type_names::kHide); @@ -2771,7 +2771,7 @@ void Element::HidePopUpInternal(HidePopupFocusBehavior focus_behavior, // Grab all animations, so that we can "finish" the hide operation once // they complete. This will *also* force a style update, ensuring property - // values are set after `:top-layer` stops matching, so that transitions + // values are set after `:open` stops matching, so that transitions // can start. HeapHashSet> animations; for (const auto& animation : GetAnimationsInternal( diff --git a/blink/renderer/core/inspector/inspector_trace_events.cc b/blink/renderer/core/inspector/inspector_trace_events.cc index 04ebc82fc2a..934d02ca0c3 100644 --- a/blink/renderer/core/inspector/inspector_trace_events.cc +++ b/blink/renderer/core/inspector/inspector_trace_events.cc @@ -381,7 +381,7 @@ const char* PseudoTypeToString(CSSSelector::PseudoType pseudo_type) { DEFINE_STRING_MAPPING(PseudoIsHtml) DEFINE_STRING_MAPPING(PseudoListBox) DEFINE_STRING_MAPPING(PseudoMultiSelectFocus) - DEFINE_STRING_MAPPING(PseudoTopLayer) + DEFINE_STRING_MAPPING(PseudoOpen) DEFINE_STRING_MAPPING(PseudoPopupHidden) DEFINE_STRING_MAPPING(PseudoHostHasAppearance) DEFINE_STRING_MAPPING(PseudoVideoPersistent) 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 2f907c4fb53..e7b0bf77055 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(':top-layer')); + assert_false(selectMenu1Popup.matches(':open')); selectMenu1Button.click(); - assert_false(selectMenu1Popup.matches(':top-layer'), "Clicking a button part that is a descendant of the listbox part should have no effect"); + assert_false(selectMenu1Popup.matches(':open'), "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(':top-layer')); + assert_true(selectMenu1Popup.matches(':open')); await clickOn(selectMenu1Child2); assert_equals(selectMenu1.value, "two", "Clicking an