diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc index 18d16d34d02cb8..dbcd81b740aaa7 100644 --- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc +++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc @@ -487,6 +487,10 @@ static void AdjustStyleForMarker(ComputedStyleBuilder& builder, static void AdjustStyleForHTMLElement(ComputedStyleBuilder& builder, HTMLElement& element) { + if (builder.HasBaseSelectAppearance()) { + builder.SetInBaseSelectAppearance(true); + } + //
and are the most common elements on the web, we skip all the // work for them. if (IsA(element) || IsA(element)) { diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade.cc b/third_party/blink/renderer/core/css/resolver/style_cascade.cc index 3b303cc40a5910..3215ddee4d7c4d 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade.cc @@ -1713,27 +1713,11 @@ bool StyleCascade::ResolveAppearanceAutoBaseSelectInto( } LookupAndApply(appearance, resolver); - // The UA stylesheet only uses -internal-appearance-auto-base-select(), - // on select elements, which is currently the only element which supports - // appearance:base-select. - CHECK(IsA(state_.GetUltimateOriginatingElementOrSelf())); - bool has_base_appearance = state_.StyleBuilder().HasBaseSelectAppearance(); - if (state_.IsForPseudoElement()) { - CHECK_EQ(state_.GetPseudoElement()->GetPseudoId(), kPseudoIdAfter) - << " -internal-appearance-base-select() is only supported on " - "select::after right now."; - // There is a rule in the UA sheet for select::after which uses - // -internal-appearance-auto-base-select(), so for that rule we have to - // account for this here by checking the style of the select element instead - // of this state_ which is for ::after. - // Both state_.LayoutParentStyle() and - // state_.GetElement().GetComputedStyle() seem to have the correct - // appearance value set. - // TODO(crbug.com/1511354): LayoutParentStyle might not be the right thing - // to call for all pseudo-elements. - has_base_appearance = state_.LayoutParentStyle()->EffectiveAppearance() == - ControlPart::kBaseSelectPart; - } + // Note that the InBaseSelectAppearance() flag is set by StyleAdjuster, + // which hasn't happened yet. Therefore we also need to check + // HasBaseSelectAppearance() here. + bool has_base_appearance = state_.StyleBuilder().HasBaseSelectAppearance() || + state_.StyleBuilder().InBaseSelectAppearance(); if (has_base_appearance) { // We want to the second argument. diff --git a/third_party/blink/renderer/core/html/resources/customizable_select.css b/third_party/blink/renderer/core/html/resources/customizable_select.css index a86a8c738930e3..47a2efb4ad9b28 100644 --- a/third_party/blink/renderer/core/html/resources/customizable_select.css +++ b/third_party/blink/renderer/core/html/resources/customizable_select.css @@ -8,6 +8,10 @@ @namespace "http://www.w3.org/1999/xhtml"; +select:not(:-internal-list-box) { + font: -internal-appearance-auto-base-select(-webkit-small-control, inherit); +} + /* These rules are intended to apply to appearance:base-select when the author * provides a child