gh-13844: Part 3 - Fixed text inputs not being filtered through boosts (gh-13893)

This commit is contained in:
mr. m
2026-05-27 13:39:22 +02:00
committed by GitHub
parent 2fb59e2c82
commit 8a0a6cbede
8 changed files with 280 additions and 20 deletions

View File

@@ -386,8 +386,9 @@ inline static nscolor zenInvertColorChannel(nscolor aColor) {
* not touch (devtools highlighters, screenshots, the boosts overlays
* themselves, and other native-anonymous UI such as scrollbars). A null frame
* gives no document to anchor the boost on, so it is treated the same way.
* CSS generated content (::before/::after/::marker/::backdrop) is
* native-anonymous too but is author content, so it is not exempt.
* Author-facing content that happens to be native-anonymous is not exempt:
* UA-widget form-control internals (including the text the user types into an
* input), and pseudo-elements such as ::before/::after/::marker/::placeholder.
*/
ZEN_HOT_FUNCTION
inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) {
@@ -398,21 +399,17 @@ inline static bool IsBoostExemptFrame(const nsIFrame* aFrame) {
if (!content || !content->IsInNativeAnonymousSubtree()) {
return false;
}
if (const nsIContent* root =
content->GetClosestNativeAnonymousSubtreeRoot()) {
if (root->IsElement()) {
switch (root->AsElement()->GetPseudoElementType()) {
case mozilla::PseudoStyleType::Before:
case mozilla::PseudoStyleType::After:
case mozilla::PseudoStyleType::Marker:
case mozilla::PseudoStyleType::Backdrop:
return false;
default:
break;
}
}
// Form-control internals (and media controls) live in UA-widget shadow
// trees; the text typed into an input is author content and should be
// boosted. Classic native-anonymous UI (scrollbars, devtools) has no
// containing shadow and falls through to the pseudo-element check below.
if (content->GetContainingShadow()) {
return false;
}
return true;
const nsIContent* root = content->GetClosestNativeAnonymousSubtreeRoot();
return !root || !root->IsElement() ||
!mozilla::PseudoStyle::IsPseudoElement(
root->AsElement()->GetPseudoElementType());
}
/**
@@ -429,6 +426,15 @@ inline static void GetZenBoostsDataForFrame(const nsIFrame* aFrame,
if (!presContext) {
return;
}
// SVG images render in their own document with no BrowsingContext; the host
// propagates its boost onto the image document's PresContext instead.
if (presContext->HasZenBoostsOverride()) {
*aData = presContext->ZenBoostsOverrideAccent();
*aComplementaryRotation =
presContext->ZenBoostsOverrideComplementaryRotation();
*aIsInverted = presContext->ZenBoostsOverrideInverted();
return;
}
const mozilla::dom::BrowsingContext* browsingContext = nullptr;
if (auto document = presContext->Document()) {
browsingContext = document->GetBrowsingContext();