Commit b31a712
Reland "Refactor menu event handling code [2/4]"
This is a reland of commit 95f912cedcfed49b1360d308897f441882b57f13
Original change's description:
> Refactor menu event handling code [2/4]
>
> Another refactoring CL for menu element code. Previously, the command
> invoker logic was split (and roughly duplicated) between
> HTMLButtonElement and HTMLMenuItemElement. Since both can be command
> invokers, it makes sense to move the command management stuff to the
> common ancestor class, HTMLElement. This CL does that, and de-dupes
> the code out of both subclasses. There is now just one base class
> method that is overridden in sub-classes that can be command
> invokers: CanBeCommandInvoker().
>
> There was also a weird combination of popover activation command
> code, which belongs on HTMLElement because any element can be a
> popover, and menu activation command code, which belongs on the
> HTMLMenuItemElement class, because only that class handles menu
> commands.
>
> This touches a few outside classes like ax_object, which get simpler
> now that they don't have to deal with each case of a command invoker.
>
> There is one behavior change here: now, if a menuitem is *both*
> checkable *and* a sub-menu invoker, the sub-menu wins, and the
> item does not do checked/unchecked behaviors.
>
> I also added a test that seemed missing: make sure only buttons and
> menuitems can be command invokers. Even though <menuitem> isn't
> shipped, this test should pass because it explicitly skips <menuitem>,
> and anyway menuitem isn't included in the HTML5_ELEMENTS list.
>
> Bug: 406566432
> Change-Id: I281eda0eda4b0dced3ad38bd09a488f2c6b1ddf4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7078858
> Reviewed-by: Dominic Farolino <dom@chromium.org>
> Commit-Queue: Mason Freed <masonf@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1538871}
Bug: 406566432
Change-Id: Iec91410726ae22a3673bdf32eb64aad79f672d6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7113161
Commit-Queue: Dominic Farolino <dom@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1540144}1 parent be09b58 commit b31a712
File tree
2 files changed
+70
-5
lines changed- html/semantics
- the-button-element/command-and-commandfor
2 files changed
+70
-5
lines changedLines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 131 | + | |
| 132 | + | |
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
139 | 138 | | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
146 | 159 | | |
147 | 160 | | |
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
0 commit comments