Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Issue 716773002: Use union types for HTMLSelectElement.add()'s arguments (Closed)

Created:
6 years, 1 month ago by Jens Widell
Modified:
6 years, 1 month ago
Reviewers:
haraken, bashi
CC:
blink-reviews, blink-reviews-bindings_chromium.org, dglazkov+blink, blink-reviews-html_chromium.org, arv+blink, Inactive
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Use union types for HTMLSelectElement.add()'s arguments According to the specification, the first argument should be (HTMLOptionElement or HTMLOptGroupElement) and the second argument should be (HTMLElement or long)? (and also be optional and default to null). This changes behavior for the first argument (previously HTMLElement) where a call was a silent no-op for invalid element types, and where HTMLHRElement was allowed against the specification and with no observable effects. The new behavior is to throw TypeError for all invalid arguments, which is compatible with Firefox and MSIE. Also apply the same change to HTMLOptionsCollection.add(), which is little more than a short-hand for calling add() on the owning select element. Also drop the custom bindings implementation for that method, which was essentially implementing the unionized second argument. The behavior of HTMLOptionsCollection.add() is changed to ignore all invalid (out of range) integer second arguments, rather than to throw for negative ones below than -1. This change is also per specification and compatible with other implementations. BUG=430337 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=185199

Patch Set 1 #

Total comments: 1

Patch Set 2 : simplify HTMLSelectElement::setLength() #

Patch Set 3 : don't include GlobalEventHandlers.h in UnionTypes*.cpp #

Total comments: 2

Patch Set 4 : added FIXME #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -139 lines) Patch
M LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/fast/dom/incompatible-operations-expected.txt View 1 chunk +4 lines, -4 lines 0 comments Download
M LayoutTests/fast/forms/select/select-add-expected.txt View 2 chunks +12 lines, -12 lines 0 comments Download
M LayoutTests/fast/js/script-tests/select-options-add.js View 1 chunk +14 lines, -14 lines 0 comments Download
M LayoutTests/fast/js/select-options-add-expected.txt View 2 chunks +32 lines, -32 lines 0 comments Download
M Source/bindings/core/v8/custom/V8HTMLOptionsCollectionCustom.cpp View 1 chunk +0 lines, -23 lines 0 comments Download
M Source/bindings/scripts/v8_union.py View 1 2 3 2 chunks +12 lines, -1 line 0 comments Download
M Source/core/html/HTMLOptionsCollection.h View 2 chunks +3 lines, -2 lines 0 comments Download
M Source/core/html/HTMLOptionsCollection.cpp View 1 chunk +2 lines, -26 lines 0 comments Download
M Source/core/html/HTMLOptionsCollection.idl View 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/html/HTMLSelectElement.h View 2 chunks +3 lines, -2 lines 0 comments Download
M Source/core/html/HTMLSelectElement.cpp View 1 4 chunks +22 lines, -18 lines 0 comments Download
M Source/core/html/HTMLSelectElement.idl View 1 chunk +2 lines, -3 lines 0 comments Download

Messages

Total messages: 18 (4 generated)
Jens Widell
PTAL Note that this is not quite ready to land: having a union that contains ...
6 years, 1 month ago (2014-11-11 11:50:22 UTC) #2
Jens Widell
https://codereview.chromium.org/716773002/diff/1/Source/core/html/HTMLSelectElement.cpp File Source/core/html/HTMLSelectElement.cpp (right): https://codereview.chromium.org/716773002/diff/1/Source/core/html/HTMLSelectElement.cpp#newcode502 Source/core/html/HTMLSelectElement.cpp:502: add(element, HTMLElementOrLong(), exceptionState); Could simplify a bit by using ...
6 years, 1 month ago (2014-11-11 12:08:44 UTC) #3
bashi
Thank you for working on this! On 2014/11/11 11:50:22, Jens Widell wrote: > PTAL > ...
6 years, 1 month ago (2014-11-11 23:51:27 UTC) #4
Jens Widell
On 2014/11/11 23:51:27, bashi1 wrote: > Thank you for working on this! > > On ...
6 years, 1 month ago (2014-11-12 07:51:49 UTC) #5
bashi
On 2014/11/12 07:51:49, Jens Widell wrote: > On 2014/11/11 23:51:27, bashi1 wrote: > > Thank ...
6 years, 1 month ago (2014-11-12 08:25:57 UTC) #6
haraken
LGTM https://codereview.chromium.org/716773002/diff/40001/Source/bindings/scripts/v8_union.py File Source/bindings/scripts/v8_union.py (right): https://codereview.chromium.org/716773002/diff/40001/Source/bindings/scripts/v8_union.py#newcode18 Source/bindings/scripts/v8_union.py:18: # compilation errors. Add a FIXME?
6 years, 1 month ago (2014-11-12 08:34:34 UTC) #7
Jens Widell
https://codereview.chromium.org/716773002/diff/40001/Source/bindings/scripts/v8_union.py File Source/bindings/scripts/v8_union.py (right): https://codereview.chromium.org/716773002/diff/40001/Source/bindings/scripts/v8_union.py#newcode18 Source/bindings/scripts/v8_union.py:18: # compilation errors. On 2014/11/12 08:34:34, haraken wrote: > ...
6 years, 1 month ago (2014-11-12 08:40:14 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/716773002/60001
6 years, 1 month ago (2014-11-12 08:40:52 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/36031)
6 years, 1 month ago (2014-11-12 10:43:38 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/716773002/60001
6 years, 1 month ago (2014-11-12 10:49:07 UTC) #14
commit-bot: I haz the power
Committed patchset #4 (id:60001) as 185199
6 years, 1 month ago (2014-11-12 11:31:35 UTC) #15
tkent
> HTMLHRElement was allowed against the specification and with no > observable effects. It's used ...
6 years, 1 month ago (2014-11-13 00:33:46 UTC) #16
Jens Widell
On 2014/11/13 00:33:46, tkent wrote: > > HTMLHRElement was allowed against the specification and with ...
6 years, 1 month ago (2014-11-13 08:25:32 UTC) #17
tkent
6 years, 1 month ago (2014-11-14 00:20:24 UTC) #18
Message was sent while issue was closed.
On 2014/11/13 08:25:32, Jens Widell wrote:
> AFAICT, this still works, and if I found the right code, the <hr> is added
using
> Node.appendChild(), so not affected by this CL.

Wow, we're lucky.

> I don't know how I tested when I came to the conclusion that adding a <hr> had
> no observable effects, however. It quite clearly adds a thin line between
> options. (Not the greatest visual effect IMO, but it's certainly there.)
> 
> Do we think that we should restore this extended functionality of
> HTMLSelectElement.add()?

I don't think we need any additional actions for this.
 - chrome://settings/fonts works
 - New behavior is compatible with IE and Firefox.  Normal web pages don't use
<hr> in <select>.
 - Even for Chrome extensions, the usage should be almost zero.  I have never
seen any articles about this behavior, and extension developers don't know this.

Powered by Google App Engine
This is Rietveld 408576698