Bug 1905743 - Unify text control button storage. r=dholbert

Split out from the other patch for readability. This doesn't change
behavior but unifies where we store the buttons of
number/search/password inputs.

Differential Revision: https://phabricator.services.mozilla.com/D215548
This commit is contained in:
Emilio Cobos Álvarez
2024-07-02 21:17:34 +00:00
parent b23bb988a7
commit f925429501
7 changed files with 32 additions and 81 deletions

View File

@@ -4004,7 +4004,7 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
if (mType == FormControlType::InputSearch) {
if (nsSearchControlFrame* searchControlFrame =
do_QueryFrame(GetPrimaryFrame())) {
Element* clearButton = searchControlFrame->GetAnonClearButton();
Element* clearButton = searchControlFrame->GetButton();
if (clearButton &&
aVisitor.mEvent->mOriginalTarget == clearButton) {
SetUserInput(EmptyString(),
@@ -4018,7 +4018,7 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
} else if (mType == FormControlType::InputPassword) {
if (nsTextControlFrame* textControlFrame =
do_QueryFrame(GetPrimaryFrame())) {
auto* reveal = textControlFrame->GetRevealButton();
auto* reveal = textControlFrame->GetButton();
if (reveal && aVisitor.mEvent->mOriginalTarget == reveal) {
SetRevealPassword(!RevealPassword());
// TODO(emilio): This should focus the input, but calling