Replace ui::DomKey implicit constructor with C++17 inline constexpr [chromium/src : main]

0 views
Skip to first unread message

Satoru Takabayashi (Gerrit)

unread,
Apr 19, 2026, 10:18:19 PMApr 19
to devtools...@chromium.org, chromium...@chromium.org, dtapuska+...@chromium.org, blink-...@chromium.org

Satoru Takabayashi has uploaded the change for review

Commit message

Replace ui::DomKey implicit constructor with C++17 inline constexpr

- Removed DomKey::Key enum in favor of static const DomKey objects.
- Added ui::DomKey::FromInteger() helper for the call sites previously
relied on static_cast<ui::DomKey>().
Bug: 324930404
Test: tryjob
Change-Id: I5454455eed9f22870aef93559824cd064aab93eb

Change diff


Change information

Files:
  • M chrome/browser/devtools/devtools_window.cc
  • M chrome/browser/ui/views/autofill/popup/popup_view_views_unittest.cc
  • M components/input/native_web_keyboard_event_aura.cc
  • M components/ui_devtools/views/devtools_event_util.cc
  • M third_party/blink/renderer/core/events/keyboard_event.cc
  • M third_party/blink/renderer/core/input/keyboard_event_manager.cc
  • M ui/events/keycodes/dom/dom_key.h
  • M ui/events/keycodes/dom/keycode_converter_unittest.cc
  • M ui/events/keycodes/dom_us_layout_data.h
  • M ui/events/keycodes/keyboard_code_conversion_unittest.cc
Change size: M
Delta: 10 files changed, 45 insertions(+), 26 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
Gerrit-Change-Number: 7777607
Gerrit-PatchSet: 1
Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Satoru Takabayashi (Gerrit)

unread,
Apr 20, 2026, 11:30:53 PMApr 20
to Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org

Satoru Takabayashi added 1 comment

Patchset-level comments
File-level comment, Patchset 12 (Latest):
Satoru Takabayashi . resolved

PTAL

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
Gerrit-Change-Number: 7777607
Gerrit-PatchSet: 12
Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
Gerrit-CC: Hidehiko Abe <hide...@chromium.org>
Gerrit-Comment-Date: Tue, 21 Apr 2026 03:30:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Hidehiko Abe (Gerrit)

unread,
Apr 20, 2026, 11:59:36 PMApr 20
to Satoru Takabayashi, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
Attention needed from Satoru Takabayashi

Hidehiko Abe added 6 comments

Patchset-level comments
Hidehiko Abe . resolved

LGTM with comments.

File ash/accelerators/accelerator_controller_unittest.cc
Line 1905, Patchset 12 (Latest): /*dom_key=*/ui::DomKey::FromBaseOrNone(2099727),
Hidehiko Abe . unresolved

In this case, we want valid domkey always, so `ui::DomKey::FromBase(2099727).value()`, to crash if unexpected.

We can do the same in most of tests.

File chrome/browser/devtools/devtools_window.cc
Line 375, Patchset 12 (Latest): ui::DomKey::FromBaseOrNone(event.dom_key)));
Hidehiko Abe . unresolved

note: this can slightly change the behavior. We may want log if dom_key is invalid?
Ditto for the same pattern in non-test code.

File components/input/native_web_keyboard_event_aura.cc
Line 90, Patchset 12 (Latest): ui::DomKey::FromBaseOrNone(web_event.dom_key), web_event.TimeStamp(),
Hidehiko Abe . unresolved

ditto.

File components/input/web_input_event_builders_android_unittest.cc
Line 83, Patchset 12 (Latest): ui::DomKey::FromBaseOrNone(web_event.dom_key))
Hidehiko Abe . unresolved

we can just use `ui::DomKey::FromBase` here, IIUC.
It will the check ui::DomKey == std::optional<ui::DomKey>, which returns false if FromBase returns nullopt.
Ditto for below.

File ui/events/keycodes/dom/dom_key.h
Line 109, Patchset 12 (Latest): constexpr static DomKey FromBaseOrNone(Base value) {
Hidehiko Abe . unresolved

so I guess this can be dropped.

Open in Gerrit

Related details

Attention is currently required from:
  • Satoru Takabayashi
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
    Gerrit-Change-Number: 7777607
    Gerrit-PatchSet: 12
    Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
    Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
    Gerrit-CC: Hidehiko Abe <hide...@chromium.org>
    Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
    Gerrit-Comment-Date: Tue, 21 Apr 2026 03:59:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Satoru Takabayashi (Gerrit)

    unread,
    Apr 22, 2026, 2:13:00 AM (14 days ago) Apr 22
    to Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
    Attention needed from Hidehiko Abe

    Satoru Takabayashi added 5 comments

    File ash/accelerators/accelerator_controller_unittest.cc
    Line 1905, Patchset 12: /*dom_key=*/ui::DomKey::FromBaseOrNone(2099727),
    Hidehiko Abe . resolved

    In this case, we want valid domkey always, so `ui::DomKey::FromBase(2099727).value()`, to crash if unexpected.

    We can do the same in most of tests.

    Satoru Takabayashi

    Agreed. Fixed!

    File chrome/browser/devtools/devtools_window.cc
    Line 375, Patchset 12: ui::DomKey::FromBaseOrNone(event.dom_key)));
    Hidehiko Abe . resolved

    note: this can slightly change the behavior. We may want log if dom_key is invalid?
    Ditto for the same pattern in non-test code.

    Satoru Takabayashi

    I think changing the existing behavior is a little risky so I chose to introduce FromBaseAsIs() which creates DomKey just like before, but internally it logs the invalid key. Does this sound good to you?

    File components/input/native_web_keyboard_event_aura.cc
    Line 90, Patchset 12: ui::DomKey::FromBaseOrNone(web_event.dom_key), web_event.TimeStamp(),
    Hidehiko Abe . resolved

    ditto.

    Satoru Takabayashi

    Used FromBaseAsIs() here too.

    File components/input/web_input_event_builders_android_unittest.cc
    Line 83, Patchset 12: ui::DomKey::FromBaseOrNone(web_event.dom_key))
    Hidehiko Abe . resolved

    we can just use `ui::DomKey::FromBase` here, IIUC.
    It will the check ui::DomKey == std::optional<ui::DomKey>, which returns false if FromBase returns nullopt.
    Ditto for below.

    Satoru Takabayashi

    Did you mean ui::DomKey::FromBase(...) would work here? I tried and it didn't build:

    ../../components/input/web_input_event_builders_android_unittest.cc:85:16: error: no viable conversion from 'std::optional<DomKey>' to 'DomKey'
    85 | ui::DomKey::FromBase(web_event.dom_key));
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I went with i::DomKey::FromBase(...).value()
    File ui/events/keycodes/dom/dom_key.h
    Line 109, Patchset 12: constexpr static DomKey FromBaseOrNone(Base value) {
    Hidehiko Abe . resolved

    so I guess this can be dropped.

    Satoru Takabayashi

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hidehiko Abe
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
      Gerrit-Change-Number: 7777607
      Gerrit-PatchSet: 17
      Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
      Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
      Gerrit-CC: Hidehiko Abe <hide...@chromium.org>
      Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
      Gerrit-Comment-Date: Wed, 22 Apr 2026 06:12:23 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Hidehiko Abe <hide...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Hidehiko Abe (Gerrit)

      unread,
      Apr 22, 2026, 7:25:12 PM (13 days ago) Apr 22
      to Satoru Takabayashi, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
      Attention needed from Satoru Takabayashi

      Hidehiko Abe voted and added 4 comments

      Votes added by Hidehiko Abe

      Code-Review+1

      4 comments

      Patchset-level comments
      Hidehiko Abe . resolved

      LGTM

      File components/input/web_input_event_builders_android_unittest.cc
      Line 83, Patchset 12: ui::DomKey::FromBaseOrNone(web_event.dom_key))
      Hidehiko Abe . unresolved

      we can just use `ui::DomKey::FromBase` here, IIUC.
      It will the check ui::DomKey == std::optional<ui::DomKey>, which returns false if FromBase returns nullopt.
      Ditto for below.

      Satoru Takabayashi

      Did you mean ui::DomKey::FromBase(...) would work here? I tried and it didn't build:

      ../../components/input/web_input_event_builders_android_unittest.cc:85:16: error: no viable conversion from 'std::optional<DomKey>' to 'DomKey'
      85 | ui::DomKey::FromBase(web_event.dom_key));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      I went with i::DomKey::FromBase(...).value()
      Hidehiko Abe

      Marked as unresolved. Sorry for miscommunication. I meant:

      ```
      // In anonymous namespace.
      std::ostream& operator<<(
      std::ostream& os, const std::optional<ui::DomKey>& dom_key) {
      if (!dom_key) {
      return os << "nullopt";
      }
      return os << ui::KeycodeConverter::DomKeyToKeyString(dom_key.value());
      }
      ```
      then
      ```
      EXPECT_EQ(ui::DomKey::FromCharacter(entry.character),
      ui::DomKey::FromBase(web_event.dom_key))
      << ui::DomKey::FromBase(web_event.dom_key);
      ```

      if it works.

      File ui/events/keycodes/dom/dom_key.h
      Line 109, Patchset 18 (Latest): // an error if the value is invalid. Used to preserve existing behaviors.
      Hidehiko Abe . unresolved

      I think this is fine to keep the current behavior (regradless whether it's intentional or not) in this refactoring, but at the same time nice if we can remove this eventually.
      Maybe nice to have a TODO with a lower priority bug to audit whether we actually need this or not, and remove this if possible?

      Line 102, Patchset 18 (Latest): static std::optional<DomKey> FromBase(Base value) {
      Hidehiko Abe . unresolved

      clarification: can't we keep this constexpr...?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Satoru Takabayashi
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
        Gerrit-Change-Number: 7777607
        Gerrit-PatchSet: 18
        Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
        Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
        Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
        Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
        Gerrit-Comment-Date: Wed, 22 Apr 2026 23:25:01 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Satoru Takabayashi <sat...@google.com>
        Comment-In-Reply-To: Hidehiko Abe <hide...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Satoru Takabayashi (Gerrit)

        unread,
        Apr 23, 2026, 5:12:01 AM (12 days ago) Apr 23
        to Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
        Attention needed from Hidehiko Abe

        Satoru Takabayashi added 3 comments

        File components/input/web_input_event_builders_android_unittest.cc
        Line 83, Patchset 12: ui::DomKey::FromBaseOrNone(web_event.dom_key))
        Hidehiko Abe . resolved

        we can just use `ui::DomKey::FromBase` here, IIUC.
        It will the check ui::DomKey == std::optional<ui::DomKey>, which returns false if FromBase returns nullopt.
        Ditto for below.

        Satoru Takabayashi

        Did you mean ui::DomKey::FromBase(...) would work here? I tried and it didn't build:

        ../../components/input/web_input_event_builders_android_unittest.cc:85:16: error: no viable conversion from 'std::optional<DomKey>' to 'DomKey'
        85 | ui::DomKey::FromBase(web_event.dom_key));
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        I went with i::DomKey::FromBase(...).value()
        Hidehiko Abe

        Marked as unresolved. Sorry for miscommunication. I meant:

        ```
        // In anonymous namespace.
        std::ostream& operator<<(
        std::ostream& os, const std::optional<ui::DomKey>& dom_key) {
        if (!dom_key) {
        return os << "nullopt";
        }
        return os << ui::KeycodeConverter::DomKeyToKeyString(dom_key.value());
        }
        ```
        then
        ```
        EXPECT_EQ(ui::DomKey::FromCharacter(entry.character),
        ui::DomKey::FromBase(web_event.dom_key))
        << ui::DomKey::FromBase(web_event.dom_key);
        ```

        if it works.

        Satoru Takabayashi

        Done! It looks like the operator<<() needed to be in "ui" namespace due to ADL reasons.

        File ui/events/keycodes/dom/dom_key.h
        Line 109, Patchset 18: // an error if the value is invalid. Used to preserve existing behaviors.
        Hidehiko Abe . resolved

        I think this is fine to keep the current behavior (regradless whether it's intentional or not) in this refactoring, but at the same time nice if we can remove this eventually.
        Maybe nice to have a TODO with a lower priority bug to audit whether we actually need this or not, and remove this if possible?

        Satoru Takabayashi

        Done. Added a TODO reusing the same bug Id.

        Line 102, Patchset 18: static std::optional<DomKey> FromBase(Base value) {
        Hidehiko Abe . resolved

        clarification: can't we keep this constexpr...?

        Satoru Takabayashi

        Done. Sorry for the oversight.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Hidehiko Abe
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
          Gerrit-Change-Number: 7777607
          Gerrit-PatchSet: 23
          Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
          Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
          Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
          Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
          Gerrit-Comment-Date: Thu, 23 Apr 2026 09:11:51 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Hidehiko Abe (Gerrit)

          unread,
          Apr 23, 2026, 4:14:26 PM (12 days ago) Apr 23
          to Satoru Takabayashi, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
          Attention needed from Satoru Takabayashi

          Hidehiko Abe voted and added 2 comments

          Votes added by Hidehiko Abe

          Code-Review+1

          2 comments

          Patchset-level comments
          File-level comment, Patchset 23 (Latest):
          Hidehiko Abe . resolved

          slgtm

          File components/input/web_input_event_builders_android_unittest.cc
          Line 31, Patchset 23 (Latest):namespace ui {
          Hidehiko Abe . unresolved

          nit: nice to wrap the anonymous namespace too, to avoid conflict.
          ```
          namespace ui {
          namespace {
          std::ostream& ...
          } // namespace
          } // namespace ui
          ```

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Satoru Takabayashi
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
            Gerrit-Change-Number: 7777607
            Gerrit-PatchSet: 23
            Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
            Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
            Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
            Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
            Gerrit-Comment-Date: Thu, 23 Apr 2026 20:14:13 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Satoru Takabayashi (Gerrit)

            unread,
            Apr 24, 2026, 1:02:56 AM (12 days ago) Apr 24
            to Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org

            Satoru Takabayashi added 1 comment

            File components/input/web_input_event_builders_android_unittest.cc
            Hidehiko Abe . resolved

            nit: nice to wrap the anonymous namespace too, to avoid conflict.
            ```
            namespace ui {
            namespace {
            std::ostream& ...
            } // namespace
            } // namespace ui
            ```

            Satoru Takabayashi
            Didn't compile due to ADL reasons so let's keep it as is. Since it's defined in unitstest.cc I think there is no need to worry about conflicts.
            ```
            ../../components/input/web_input_event_builders_android_unittest.cc:33:15: error: unused function 'operator<<' [-Werror,-Wunused-function]
            33 | std::ostream& operator<<(std::ostream& os, const ui::DomKey& dom_key) {
            | ^~~~~~~~
            1 error generated.
            ```
            Open in Gerrit

            Related details

            Attention set is empty
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement is not satisfiedCode-Owners
              • requirement is not satisfiedCode-Review
              • requirement satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
              Gerrit-Change-Number: 7777607
              Gerrit-PatchSet: 23
              Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
              Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
              Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
              Gerrit-Comment-Date: Fri, 24 Apr 2026 05:02:28 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Hidehiko Abe <hide...@chromium.org>
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Keren Zhu (Gerrit)

              unread,
              Apr 27, 2026, 1:34:11 AM (9 days ago) Apr 27
              to Satoru Takabayashi, Stephen Nusko, Takashi Toyoshima, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
              Attention needed from Satoru Takabayashi, Stephen Nusko, Takashi Toyoshima and Wez

              Keren Zhu voted Code-Review+1

              Code-Review+1
              Open in Gerrit

              Related details

              Attention is currently required from:
              • Satoru Takabayashi
              • Stephen Nusko
              • Takashi Toyoshima
              • Wez
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement is not satisfiedCode-Owners
                • requirement satisfiedCode-Review
                • requirement satisfiedReview-Enforcement
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: chromium/src
                Gerrit-Branch: main
                Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                Gerrit-Change-Number: 7777607
                Gerrit-PatchSet: 23
                Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                Gerrit-Reviewer: Wez <w...@chromium.org>
                Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
                Gerrit-Attention: Wez <w...@chromium.org>
                Gerrit-Comment-Date: Mon, 27 Apr 2026 05:34:00 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Satoru Takabayashi (Gerrit)

                unread,
                Apr 27, 2026, 1:35:31 AM (9 days ago) Apr 27
                to Keren Zhu, Stephen Nusko, Takashi Toyoshima, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                Attention needed from Stephen Nusko, Takashi Toyoshima and Wez

                Satoru Takabayashi voted Commit-Queue+1

                Commit-Queue+1
                Open in Gerrit

                Related details

                Attention is currently required from:
                Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
                Gerrit-Attention: Wez <w...@chromium.org>
                Gerrit-Comment-Date: Mon, 27 Apr 2026 05:34:48 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Stephen Nusko (Gerrit)

                unread,
                Apr 27, 2026, 2:41:12 AM (8 days ago) Apr 27
                to Satoru Takabayashi, Keren Zhu, Takashi Toyoshima, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                Attention needed from Satoru Takabayashi, Takashi Toyoshima and Wez

                Stephen Nusko voted and added 2 comments

                Votes added by Stephen Nusko

                Code-Review+1

                2 comments

                Patchset-level comments
                Stephen Nusko . resolved

                LGTM for just `//components/input` I didn't look anywhere else besides dom_key.h

                File ui/events/keycodes/dom/dom_key.h
                Line 114, Patchset 23 (Latest): LOG(ERROR) << "Invalid DomKey: " << value;
                Stephen Nusko . unresolved

                I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                Or should this be a if we want this to be out in the field?

                `DUMP_WITHOUT_CRASHING` ?

                Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Satoru Takabayashi
                • Takashi Toyoshima
                • Wez
                Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement is not satisfiedCode-Owners
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                  Gerrit-Change-Number: 7777607
                  Gerrit-PatchSet: 23
                  Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                  Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                  Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                  Gerrit-Reviewer: Wez <w...@chromium.org>
                  Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
                  Gerrit-Attention: Wez <w...@chromium.org>
                  Gerrit-Comment-Date: Mon, 27 Apr 2026 06:40:38 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Takashi Toyoshima (Gerrit)

                  unread,
                  Apr 27, 2026, 3:02:43 AM (8 days ago) Apr 27
                  to Satoru Takabayashi, Stephen Nusko, Keren Zhu, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Satoru Takabayashi and Wez

                  Takashi Toyoshima voted Code-Review+1

                  Code-Review+1
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Satoru Takabayashi
                  • Wez
                  Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement satisfiedCode-Owners
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                  Gerrit-Change-Number: 7777607
                  Gerrit-PatchSet: 23
                  Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                  Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                  Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                  Gerrit-Reviewer: Wez <w...@chromium.org>
                  Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Attention: Wez <w...@chromium.org>
                  Gerrit-Comment-Date: Mon, 27 Apr 2026 07:02:09 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Satoru Takabayashi (Gerrit)

                  unread,
                  Apr 27, 2026, 3:37:31 AM (8 days ago) Apr 27
                  to Takashi Toyoshima, Stephen Nusko, Keren Zhu, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Stephen Nusko and Wez

                  Satoru Takabayashi added 2 comments

                  File ui/events/keycodes/dom/dom_key.h
                  Line 114, Patchset 23 (Latest): LOG(ERROR) << "Invalid DomKey: " << value;
                  Stephen Nusko . unresolved

                  I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                  Or should this be a if we want this to be out in the field?

                  `DUMP_WITHOUT_CRASHING` ?

                  Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                  Satoru Takabayashi

                  Thank you for the input! I added this logging as it could be helpful for debugging DOM key-related issues.

                  Using DumpWithoutCrashing could be an alternative if we want to remove the function as mentioned in the TODO comment. However, on second thought, I think it is not worth the effort. It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous. I can think of two options:

                  1) Remove the TODO comment but keep the logging.
                  2) Remove the TODO comment and the logging.

                  hidehiko@, what do you think?

                  Line 114, Patchset 23 (Latest): LOG(ERROR) << "Invalid DomKey: " << value;
                  Stephen Nusko . unresolved

                  I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                  Or should this be a if we want this to be out in the field?

                  `DUMP_WITHOUT_CRASHING` ?

                  Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                  Satoru Takabayashi

                  Thank you for the input. I'm not certain how

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Stephen Nusko
                  • Wez
                  Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Attention: Wez <w...@chromium.org>
                  Gerrit-Comment-Date: Mon, 27 Apr 2026 07:36:57 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Hidehiko Abe (Gerrit)

                  unread,
                  Apr 27, 2026, 3:54:55 AM (8 days ago) Apr 27
                  to Satoru Takabayashi, Takashi Toyoshima, Stephen Nusko, Keren Zhu, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Satoru Takabayashi, Stephen Nusko and Wez

                  Hidehiko Abe added 1 comment

                  File ui/events/keycodes/dom/dom_key.h
                  Line 114, Patchset 23 (Latest): LOG(ERROR) << "Invalid DomKey: " << value;
                  Stephen Nusko . unresolved

                  I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                  Or should this be a if we want this to be out in the field?

                  `DUMP_WITHOUT_CRASHING` ?

                  Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                  Satoru Takabayashi

                  Thank you for the input! I added this logging as it could be helpful for debugging DOM key-related issues.

                  Using DumpWithoutCrashing could be an alternative if we want to remove the function as mentioned in the TODO comment. However, on second thought, I think it is not worth the effort. It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous. I can think of two options:

                  1) Remove the TODO comment but keep the logging.
                  2) Remove the TODO comment and the logging.

                  hidehiko@, what do you think?

                  Hidehiko Abe

                  It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous.

                  Actually, can we run CHECK() after confirming no fatal crash reports?
                  So that, in the future, if we accidentally introduce something broken in caller side, we can catch.

                  It can be done later with lower priority, though.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Satoru Takabayashi
                  • Stephen Nusko
                  • Wez
                  Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                  Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Attention: Wez <w...@chromium.org>
                  Gerrit-Comment-Date: Mon, 27 Apr 2026 07:54:24 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Satoru Takabayashi <sat...@google.com>
                  Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Wez (Gerrit)

                  unread,
                  Apr 27, 2026, 11:16:28 AM (8 days ago) Apr 27
                  to Satoru Takabayashi, Takashi Toyoshima, Stephen Nusko, Keren Zhu, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Satoru Takabayashi and Stephen Nusko

                  Wez added 6 comments

                  File components/input/web_input_event_builders_android_unittest.cc
                  Hidehiko Abe . unresolved

                  nit: nice to wrap the anonymous namespace too, to avoid conflict.
                  ```
                  namespace ui {
                  namespace {
                  std::ostream& ...
                  } // namespace
                  } // namespace ui
                  ```

                  Satoru Takabayashi
                  Didn't compile due to ADL reasons so let's keep it as is. Since it's defined in unitstest.cc I think there is no need to worry about conflicts.
                  ```
                  ../../components/input/web_input_event_builders_android_unittest.cc:33:15: error: unused function 'operator<<' [-Werror,-Wunused-function]
                  33 | std::ostream& operator<<(std::ostream& os, const ui::DomKey& dom_key) {
                  | ^~~~~~~~
                  1 error generated.
                  ```
                  Wez

                  gTest supports using either `operator<<` if available, or an `AbslStringify()` overload, or a `PrintTo()` method on the type itself.

                  Ideally I think we'd go with a version that sits on the type itself (which basically means we have to go with `PrintTo()`). If we can't do that (given that the string names live in `ui::KeycodeConverter` rather than alongside `ui::DomKey` itself) then I'd suggest perhaps defining the operator in the same header as the `KeycodeConverter` - that way the namespace pollution is at least part of the "correct" bit of code.

                  File ui/events/keycodes/dom/dom_key.h
                  Line 164, Patchset 23 (Latest): // that raw integers cannot be implicitly converted to DomKey.
                  Wez . unresolved

                  Doesn't `explicit` prevent implicit conversions?

                  Line 112, Patchset 23 (Latest): static DomKey FromBaseAsIs(Base value) {
                  Wez . unresolved

                  "as-is" is something of a colloquialism; "unchecked" would be clearer here, for example.

                  Line 112, Patchset 23 (Latest): static DomKey FromBaseAsIs(Base value) {
                  Wez . unresolved

                  Why do we need this at all? It's not a performance optimization (since we use `IsValidValue()` in both calls), so presumably we just have call-sites for which we don't know how to tolerate failure?

                  It seems that we have replaced a number of _explicit_ static-case call-sites with this - can we instead leave the existing from-`Base` constructor in-place, but marked `explicit`, so that we (1) don't need to change those call-sites and (2) it is clear what their semantics are?

                  Whether or not we need "unchecked" behaviour long term seems to hinge on whether the `WebKeyboardEvent`s synthesized by content ever need to pass-through these types - if they do then I'd guess that we need to support invalid values simply because it's valid for content to synthesize events with whatever contents it likes.

                  But then the `IsValidValue()` API is only validating that the value is explicitly tagged as a Unicode, non-Unicode, or dead-key value - we're still not validating beyond that that the value makese sense. We could coerce all "invalid" values to `DomKey::NONE` in `FromBase()` and have it return a plain `DomKey`, or provide a `FromBaseOrNone()` that does that if we prefer to keep it separate.

                  Line 85, Patchset 23 (Latest):// |dom_key_data.inc| describes the non-printable DomKey values, and is
                  // included here to create constants for them in the DomKey:: scope.
                  Wez . unresolved

                  nit: This comment needs updating.

                  Line 83, Patchset 23 (Latest): static const DomKey NONE;
                  Wez . unresolved

                  nit: `NONE` is essentially a not-set or not-valid value, so providing APIs that use `std::optional<DomKey>` is a little odd, and ends up wasting space - see my comment, below, on `FromBaseAsIs()`!

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Satoru Takabayashi
                  • Stephen Nusko
                  Gerrit-Comment-Date: Mon, 27 Apr 2026 15:16:09 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Satoru Takabayashi <sat...@google.com>
                  Comment-In-Reply-To: Hidehiko Abe <hide...@chromium.org>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Stephen Nusko (Gerrit)

                  unread,
                  Apr 27, 2026, 11:57:44 PM (8 days ago) Apr 27
                  to Satoru Takabayashi, Takashi Toyoshima, Keren Zhu, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Satoru Takabayashi

                  Stephen Nusko added 2 comments

                  File components/input/web_input_event_builders_android_unittest.cc
                  Hidehiko Abe . unresolved

                  nit: nice to wrap the anonymous namespace too, to avoid conflict.
                  ```
                  namespace ui {
                  namespace {
                  std::ostream& ...
                  } // namespace
                  } // namespace ui
                  ```

                  Satoru Takabayashi
                  Didn't compile due to ADL reasons so let's keep it as is. Since it's defined in unitstest.cc I think there is no need to worry about conflicts.
                  ```
                  ../../components/input/web_input_event_builders_android_unittest.cc:33:15: error: unused function 'operator<<' [-Werror,-Wunused-function]
                  33 | std::ostream& operator<<(std::ostream& os, const ui::DomKey& dom_key) {
                  | ^~~~~~~~
                  1 error generated.
                  ```
                  Wez

                  gTest supports using either `operator<<` if available, or an `AbslStringify()` overload, or a `PrintTo()` method on the type itself.

                  Ideally I think we'd go with a version that sits on the type itself (which basically means we have to go with `PrintTo()`). If we can't do that (given that the string names live in `ui::KeycodeConverter` rather than alongside `ui::DomKey` itself) then I'd suggest perhaps defining the operator in the same header as the `KeycodeConverter` - that way the namespace pollution is at least part of the "correct" bit of code.

                  Stephen Nusko

                  +1 I like that better.

                  File ui/events/keycodes/dom/dom_key.h
                  Line 114, Patchset 23 (Latest): LOG(ERROR) << "Invalid DomKey: " << value;
                  Stephen Nusko . unresolved

                  I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                  Or should this be a if we want this to be out in the field?

                  `DUMP_WITHOUT_CRASHING` ?

                  Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                  Satoru Takabayashi

                  Thank you for the input! I added this logging as it could be helpful for debugging DOM key-related issues.

                  Using DumpWithoutCrashing could be an alternative if we want to remove the function as mentioned in the TODO comment. However, on second thought, I think it is not worth the effort. It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous. I can think of two options:

                  1) Remove the TODO comment but keep the logging.
                  2) Remove the TODO comment and the logging.

                  hidehiko@, what do you think?

                  Hidehiko Abe

                  It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous.

                  Actually, can we run CHECK() after confirming no fatal crash reports?
                  So that, in the future, if we accidentally introduce something broken in caller side, we can catch.

                  It can be done later with lower priority, though.

                  Stephen Nusko

                  Nothing collects debug logs, are you imagining that someone would make a bug report with the log output or that developers would see this? If that is the case I would recommend a DCHECK, but generally sounds like we should try to move towards a CHECK.

                  I recommend

                  ```
                  CHECK(value != 0 && !IsValidValue(value), base::NotFatalUntil::M150);
                  ```

                  M150 means you have a full stable release (M149) to get crashes reported to you. And then if nothing happens it just becomes a CHECK, and if something does happen you'll get crash bugs and worst case just need to cherrypick a removal in.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Satoru Takabayashi
                  Gerrit-Comment-Date: Tue, 28 Apr 2026 03:57:10 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Satoru Takabayashi <sat...@google.com>
                  Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
                  Comment-In-Reply-To: Wez <w...@chromium.org>
                  Comment-In-Reply-To: Hidehiko Abe <hide...@chromium.org>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Takashi Toyoshima (Gerrit)

                  unread,
                  Apr 30, 2026, 2:39:57 AM (5 days ago) Apr 30
                  to Satoru Takabayashi, Stephen Nusko, Keren Zhu, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                  Attention needed from Hidehiko Abe, Keren Zhu and Satoru Takabayashi

                  Takashi Toyoshima voted Code-Review+1

                  Code-Review+1
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Hidehiko Abe
                  • Keren Zhu
                  • Satoru Takabayashi
                  Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement satisfiedCode-Owners
                    • requirement is not satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                    Gerrit-Change-Number: 7777607
                    Gerrit-PatchSet: 24
                    Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                    Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                    Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                    Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                    Gerrit-Reviewer: Wez <w...@chromium.org>
                    Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                    Gerrit-Attention: Keren Zhu <kere...@chromium.org>
                    Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
                    Gerrit-Comment-Date: Thu, 30 Apr 2026 06:39:32 +0000
                    Gerrit-HasComments: No
                    Gerrit-Has-Labels: Yes
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy

                    Keren Zhu (Gerrit)

                    unread,
                    Apr 30, 2026, 12:52:59 PM (5 days ago) Apr 30
                    to Satoru Takabayashi, Takashi Toyoshima, Stephen Nusko, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                    Attention needed from Hidehiko Abe and Satoru Takabayashi

                    Keren Zhu voted Code-Review+1

                    Code-Review+1
                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Hidehiko Abe
                    • Satoru Takabayashi
                    Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement is not satisfiedNo-Unresolved-Comments
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                      Gerrit-Change-Number: 7777607
                      Gerrit-PatchSet: 24
                      Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                      Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                      Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                      Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                      Gerrit-Reviewer: Wez <w...@chromium.org>
                      Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                      Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
                      Gerrit-Comment-Date: Thu, 30 Apr 2026 16:52:50 +0000
                      Gerrit-HasComments: No
                      Gerrit-Has-Labels: Yes
                      satisfied_requirement
                      unsatisfied_requirement
                      open
                      diffy

                      Satoru Takabayashi (Gerrit)

                      unread,
                      May 1, 2026, 12:55:55 AM (5 days ago) May 1
                      to Keren Zhu, Takashi Toyoshima, Stephen Nusko, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                      Attention needed from Hidehiko Abe, Keren Zhu, Stephen Nusko, Takashi Toyoshima and Wez

                      Satoru Takabayashi added 7 comments

                      File components/input/web_input_event_builders_android_unittest.cc
                      Line 31, Patchset 23:namespace ui {
                      Hidehiko Abe . resolved

                      nit: nice to wrap the anonymous namespace too, to avoid conflict.
                      ```
                      namespace ui {
                      namespace {
                      std::ostream& ...
                      } // namespace
                      } // namespace ui
                      ```

                      Satoru Takabayashi
                      Didn't compile due to ADL reasons so let's keep it as is. Since it's defined in unitstest.cc I think there is no need to worry about conflicts.
                      ```
                      ../../components/input/web_input_event_builders_android_unittest.cc:33:15: error: unused function 'operator<<' [-Werror,-Wunused-function]
                      33 | std::ostream& operator<<(std::ostream& os, const ui::DomKey& dom_key) {
                      | ^~~~~~~~
                      1 error generated.
                      ```
                      Wez

                      gTest supports using either `operator<<` if available, or an `AbslStringify()` overload, or a `PrintTo()` method on the type itself.

                      Ideally I think we'd go with a version that sits on the type itself (which basically means we have to go with `PrintTo()`). If we can't do that (given that the string names live in `ui::KeycodeConverter` rather than alongside `ui::DomKey` itself) then I'd suggest perhaps defining the operator in the same header as the `KeycodeConverter` - that way the namespace pollution is at least part of the "correct" bit of code.

                      Stephen Nusko

                      +1 I like that better.

                      Satoru Takabayashi

                      Good idea! Moved it to ui/events/keycodes/dom/keycode_converter.h.

                      File ui/events/keycodes/dom/dom_key.h
                      Line 164, Patchset 23: // that raw integers cannot be implicitly converted to DomKey.
                      Wez . resolved

                      Doesn't `explicit` prevent implicit conversions?

                      Satoru Takabayashi

                      Thanks. Updated the comment accordingly.

                      Line 114, Patchset 23: LOG(ERROR) << "Invalid DomKey: " << value;
                      Stephen Nusko . resolved

                      I assume this is for testing purposes? There doesn't seem to be a reason to submit with this debugging logging in is there I don't think?

                      Or should this be a if we want this to be out in the field?

                      `DUMP_WITHOUT_CRASHING` ?

                      Or `CHECK(IsValidValue(value), NotFatalUntil::M1##)`?

                      Satoru Takabayashi

                      Thank you for the input! I added this logging as it could be helpful for debugging DOM key-related issues.

                      Using DumpWithoutCrashing could be an alternative if we want to remove the function as mentioned in the TODO comment. However, on second thought, I think it is not worth the effort. It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous. I can think of two options:

                      1) Remove the TODO comment but keep the logging.
                      2) Remove the TODO comment and the logging.

                      hidehiko@, what do you think?

                      Hidehiko Abe

                      It would require confirming the absence of crash reports and updating existing production call sites to use FromBase(x).value(), which is potentially dangerous.

                      Actually, can we run CHECK() after confirming no fatal crash reports?
                      So that, in the future, if we accidentally introduce something broken in caller side, we can catch.

                      It can be done later with lower priority, though.

                      Stephen Nusko

                      Nothing collects debug logs, are you imagining that someone would make a bug report with the log output or that developers would see this? If that is the case I would recommend a DCHECK, but generally sounds like we should try to move towards a CHECK.

                      I recommend

                      ```
                      CHECK(value != 0 && !IsValidValue(value), base::NotFatalUntil::M150);
                      ```

                      M150 means you have a full stable release (M149) to get crashes reported to you. And then if nothing happens it just becomes a CHECK, and if something does happen you'll get crash bugs and worst case just need to cherrypick a removal in.

                      Satoru Takabayashi

                      As mentioned earlier, I just got rid of this function.

                      Line 112, Patchset 23: static DomKey FromBaseAsIs(Base value) {
                      Wez . resolved

                      Why do we need this at all? It's not a performance optimization (since we use `IsValidValue()` in both calls), so presumably we just have call-sites for which we don't know how to tolerate failure?

                      It seems that we have replaced a number of _explicit_ static-case call-sites with this - can we instead leave the existing from-`Base` constructor in-place, but marked `explicit`, so that we (1) don't need to change those call-sites and (2) it is clear what their semantics are?

                      Whether or not we need "unchecked" behaviour long term seems to hinge on whether the `WebKeyboardEvent`s synthesized by content ever need to pass-through these types - if they do then I'd guess that we need to support invalid values simply because it's valid for content to synthesize events with whatever contents it likes.

                      But then the `IsValidValue()` API is only validating that the value is explicitly tagged as a Unicode, non-Unicode, or dead-key value - we're still not validating beyond that that the value makese sense. We could coerce all "invalid" values to `DomKey::NONE` in `FromBase()` and have it return a plain `DomKey`, or provide a `FromBaseOrNone()` that does that if we prefer to keep it separate.

                      Satoru Takabayashi

                      Thank you for the great idea! I just deleted this function and made the from-Base constructor public. Hope I understand your suggestion correctly.

                      Line 112, Patchset 23: static DomKey FromBaseAsIs(Base value) {
                      Wez . resolved

                      "as-is" is something of a colloquialism; "unchecked" would be clearer here, for example.

                      Satoru Takabayashi

                      Acknowledged. The function is gone now.

                      Line 85, Patchset 23:// |dom_key_data.inc| describes the non-printable DomKey values, and is

                      // included here to create constants for them in the DomKey:: scope.
                      Wez . resolved

                      nit: This comment needs updating.

                      Satoru Takabayashi

                      Done

                      Line 83, Patchset 23: static const DomKey NONE;
                      Wez . unresolved

                      nit: `NONE` is essentially a not-set or not-valid value, so providing APIs that use `std::optional<DomKey>` is a little odd, and ends up wasting space - see my comment, below, on `FromBaseAsIs()`!

                      Satoru Takabayashi

                      Good point. It looks like `std::optional<DomKey> FromBase()` is used in only one place:

                      ```
                      std::optional<ui::DomKey> dom_key =
                      ui::DomKey::FromBase(key_data->dom_key);
                      if (!dom_key)
                      return false;
                      ```

                      We could change the code to:

                      ```
                      const ui::DomKey dom_key(key_data->dom_key);
                      if (dom_key != ui::DomKey::NONE && !dom_key.IsValid())
                      return false;
                      ```

                      Then we can get rid of FromBase(). What do you think?

                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Hidehiko Abe
                      • Keren Zhu
                      • Stephen Nusko
                      • Takashi Toyoshima
                      • Wez
                        Submit Requirements:
                        • requirement satisfiedCode-Coverage
                        • requirement is not satisfiedCode-Owners
                        • requirement is not satisfiedCode-Review
                        • requirement is not satisfiedNo-Unresolved-Comments
                        • requirement is not satisfiedReview-Enforcement
                        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                        Gerrit-MessageType: comment
                        Gerrit-Project: chromium/src
                        Gerrit-Branch: main
                        Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                        Gerrit-Change-Number: 7777607
                        Gerrit-PatchSet: 26
                        Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                        Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                        Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                        Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                        Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                        Gerrit-Reviewer: Wez <w...@chromium.org>
                        Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                        Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
                        Gerrit-Attention: Wez <w...@chromium.org>
                        Gerrit-Attention: Keren Zhu <kere...@chromium.org>
                        Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
                        Gerrit-Comment-Date: Fri, 01 May 2026 04:55:22 +0000
                        Gerrit-HasComments: Yes
                        Gerrit-Has-Labels: No
                        Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
                        Comment-In-Reply-To: Satoru Takabayashi <sat...@google.com>
                        satisfied_requirement
                        unsatisfied_requirement
                        open
                        diffy

                        Takashi Toyoshima (Gerrit)

                        unread,
                        May 1, 2026, 2:02:09 AM (5 days ago) May 1
                        to Satoru Takabayashi, Keren Zhu, Stephen Nusko, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                        Attention needed from Hidehiko Abe, Keren Zhu, Satoru Takabayashi, Stephen Nusko and Wez

                        Takashi Toyoshima voted Code-Review+1

                        Code-Review+1
                        Open in Gerrit

                        Related details

                        Attention is currently required from:
                        • Hidehiko Abe
                        • Keren Zhu
                        • Satoru Takabayashi
                        • Stephen Nusko
                        • Wez
                        Submit Requirements:
                          • requirement satisfiedCode-Coverage
                          • requirement is not satisfiedCode-Owners
                          • requirement is not satisfiedCode-Review
                          • requirement is not satisfiedNo-Unresolved-Comments
                          • requirement satisfiedReview-Enforcement
                          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                          Gerrit-MessageType: comment
                          Gerrit-Project: chromium/src
                          Gerrit-Branch: main
                          Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                          Gerrit-Change-Number: 7777607
                          Gerrit-PatchSet: 26
                          Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                          Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                          Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                          Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                          Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                          Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                          Gerrit-Reviewer: Wez <w...@chromium.org>
                          Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                          Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                          Gerrit-Attention: Wez <w...@chromium.org>
                          Gerrit-Attention: Keren Zhu <kere...@chromium.org>
                          Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
                          Gerrit-Comment-Date: Fri, 01 May 2026 06:01:34 +0000
                          Gerrit-HasComments: No
                          Gerrit-Has-Labels: Yes
                          satisfied_requirement
                          unsatisfied_requirement
                          open
                          diffy

                          Keren Zhu (Gerrit)

                          unread,
                          12:28 PM (2 hours ago) 12:28 PM
                          to Satoru Takabayashi, Code Review Nudger, Takashi Toyoshima, Stephen Nusko, Hidehiko Abe, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, crostin...@chromium.org, keithle...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, tranbaod...@chromium.org, michaelcheco+wa...@google.com, longbowei+watc...@google.com, jimmyxgong+wat...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org
                          Attention needed from Hidehiko Abe, Satoru Takabayashi, Stephen Nusko and Wez

                          Keren Zhu voted Code-Review+1

                          Code-Review+1
                          Open in Gerrit

                          Related details

                          Attention is currently required from:
                          • Hidehiko Abe
                          • Satoru Takabayashi
                          • Stephen Nusko
                          • Wez
                            Submit Requirements:
                              • requirement satisfiedCode-Coverage
                              • requirement is not satisfiedCode-Owners
                              • requirement satisfiedCode-Review
                              • requirement is not satisfiedNo-Unresolved-Comments
                              • requirement satisfiedReview-Enforcement
                              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                              Gerrit-MessageType: comment
                              Gerrit-Project: chromium/src
                              Gerrit-Branch: main
                              Gerrit-Change-Id: I5454455eed9f22870aef93559824cd064aab93eb
                              Gerrit-Change-Number: 7777607
                              Gerrit-PatchSet: 26
                              Gerrit-Owner: Satoru Takabayashi <sat...@google.com>
                              Gerrit-Reviewer: Hidehiko Abe <hide...@chromium.org>
                              Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
                              Gerrit-Reviewer: Satoru Takabayashi <sat...@google.com>
                              Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                              Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
                              Gerrit-Reviewer: Wez <w...@chromium.org>
                              Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                              Gerrit-Attention: Satoru Takabayashi <sat...@google.com>
                              Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                              Gerrit-Attention: Wez <w...@chromium.org>
                              Gerrit-Attention: Hidehiko Abe <hide...@chromium.org>
                              Gerrit-Comment-Date: Tue, 05 May 2026 16:28:44 +0000
                              Gerrit-HasComments: No
                              Gerrit-Has-Labels: Yes
                              satisfied_requirement
                              unsatisfied_requirement
                              open
                              diffy
                              Reply all
                              Reply to author
                              Forward
                              0 new messages