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

Issue 1841143002: Add enum class |WebEditingCommandType| for EditorCommand (Closed)

Created:
4 years, 8 months ago by chongz
Modified:
4 years, 8 months ago
Reviewers:
tkent, dtapuska, yosin_UTC9
CC:
blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, dglazkov+blink
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add enum class |WebEditingCommandType| for EditorCommand Motivation: Using strings for actions is error prone (see http://crbug.com/251275) and ideally we want to replace string names with enum (e.g. replace strings in https://goo.gl/VeUZFX). Also with enum we could eliminate the huge |EditorCommand::CommandMap| with switch statements to improve readability. This CL is the first step and adds |WebEditingCommandType| enum class in public/platform/ and provides conversion between string command name and enum type in EditorCommand.cpp. Also |EditorInternalCommand.idForUserMetrics| is replaced by |EditorInternalCommand.commandType| but remains the same enum value, so the user matrics won't be affected. BUG=596064 Committed: https://crrev.com/2dcc34c1e14d6847a6340da3d03fbe5e04801bfb Cr-Commit-Position: refs/heads/master@{#386702}

Patch Set 1 #

Total comments: 2

Patch Set 2 : dtapuska's review #

Patch Set 3 : Fix windows |strcasecmp| compile issue #

Total comments: 11

Patch Set 4 : yosin's review #

Total comments: 6

Patch Set 5 : yosin's review 2 #

Total comments: 6

Patch Set 6 : tkent's review #

Total comments: 4

Patch Set 7 : Introducing |codePointCompareIgnoringASCIICase()| #

Unified diffs Side-by-side diffs Delta from patch set Stats (+675 lines, -220 lines) Patch
M third_party/WebKit/Source/core/core.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/EditingCommandTest.cpp View 1 2 3 4 5 6 1 chunk +73 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp View 1 2 3 4 5 6 6 chunks +192 lines, -220 lines 0 comments Download
A third_party/WebKit/Source/core/editing/commands/EditorCommandNames.h View 1 2 3 4 1 chunk +155 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringImpl.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringImpl.cpp View 1 2 3 4 5 6 1 chunk +36 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.cpp View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/public/blink_headers.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/public/platform/WebEditingCommandType.h View 1 2 3 4 5 1 chunk +208 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (12 generated)
chongz
Hi dtapuska, can you take a look at this CL please? Thanks!
4 years, 8 months ago (2016-03-29 18:24:28 UTC) #4
dtapuska
https://codereview.chromium.org/1841143002/diff/1/third_party/WebKit/Source/core/editing/EditingCommandTest.cpp File third_party/WebKit/Source/core/editing/EditingCommandTest.cpp (right): https://codereview.chromium.org/1841143002/diff/1/third_party/WebKit/Source/core/editing/EditingCommandTest.cpp#newcode13 third_party/WebKit/Source/core/editing/EditingCommandTest.cpp:13: const struct CommandNameEntry { This table is duplicated.. Perhaps ...
4 years, 8 months ago (2016-03-29 18:47:50 UTC) #5
chongz
Hi dtapuska, I've updated CL as per your comments, PTAL, thanks!
4 years, 8 months ago (2016-03-29 20:00:10 UTC) #6
chongz
Hi yosin, can you take a look at this CL please? Thanks!
4 years, 8 months ago (2016-03-29 20:43:53 UTC) #8
dtapuska
https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode1526 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:1526: { WebEditingCommandType::AlignJustified, executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled ...
4 years, 8 months ago (2016-03-29 20:46:05 UTC) #9
dtapuska
On 2016/03/29 20:46:05, dtapuska wrote: > https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp > File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): > > https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode1526 > ...
4 years, 8 months ago (2016-03-29 20:57:02 UTC) #10
yosin_UTC9
https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/EditingCommandTest.cpp File third_party/WebKit/Source/core/editing/EditingCommandTest.cpp (right): https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/EditingCommandTest.cpp#newcode25 third_party/WebKit/Source/core/editing/EditingCommandTest.cpp:25: static_assert(arraysize(kCommandNameEntries) + 1 == static_cast<int>(WebEditingCommandType::NumberOfCommandTypes), "must test all valid ...
4 years, 8 months ago (2016-03-30 01:50:52 UTC) #11
dtapuska
https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode104 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:104: bsearch(&keyEntry, kCommandNameEntries, arraysize(kCommandNameEntries), On 2016/03/30 01:50:51, Yosi_UTC9 wrote: > ...
4 years, 8 months ago (2016-03-30 02:04:10 UTC) #12
yosin_UTC9
https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode104 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:104: bsearch(&keyEntry, kCommandNameEntries, arraysize(kCommandNameEntries), On 2016/03/30 at 02:04:09, dtapuska wrote: ...
4 years, 8 months ago (2016-03-30 03:48:12 UTC) #13
chongz
Hi yosin, I've updated CL as per your comments, PTAL, thanks! https://codereview.chromium.org/1841143002/diff/40001/third_party/WebKit/Source/core/editing/EditingCommandTest.cpp File third_party/WebKit/Source/core/editing/EditingCommandTest.cpp (right): ...
4 years, 8 months ago (2016-03-30 15:25:41 UTC) #14
yosin_UTC9
https://codereview.chromium.org/1841143002/diff/60001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/60001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode82 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:82: #define EDITOR_COMMAND_MAP_DECLARATION const CommandNameEntry kCommandNameEntries[] = V8 team invents ...
4 years, 8 months ago (2016-03-31 01:29:37 UTC) #15
chongz
Hi yosin@, I've updated CL as per your comments, PTAL, thanks! https://codereview.chromium.org/1841143002/diff/60001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): ...
4 years, 8 months ago (2016-03-31 21:44:45 UTC) #16
yosin_UTC9
lgtm +tkent@ for public/
4 years, 8 months ago (2016-04-01 01:31:00 UTC) #18
tkent
https://codereview.chromium.org/1841143002/diff/80001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/80001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode1673 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:1673: ASSERT(commandIndex >= 0 && commandIndex < static_cast<int>(arraysize(kEditorCommands))); Please do ...
4 years, 8 months ago (2016-04-01 04:43:42 UTC) #19
chongz
Hi tkent@, PTAL, thanks! https://codereview.chromium.org/1841143002/diff/80001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/80001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode1673 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:1673: ASSERT(commandIndex >= 0 && commandIndex ...
4 years, 8 months ago (2016-04-01 16:05:49 UTC) #22
tkent
Thank you for the explanation. Introducing WebEditingCommandType.h is ok. https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode102 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:102: ...
4 years, 8 months ago (2016-04-04 00:35:56 UTC) #23
dtapuska
https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode102 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:102: return strcasecmp(entry1.name, entry2.name) < 0; On 2016/04/04 00:35:56, unavailable_until_Apr_7 ...
4 years, 8 months ago (2016-04-04 15:42:46 UTC) #24
chongz
Hi yosin@, can you take a look again please? Thanks! https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode102 ...
4 years, 8 months ago (2016-04-04 15:56:12 UTC) #25
yosin_UTC9
On 2016/04/04 at 15:56:12, chongz wrote: > Hi yosin@, can you take a look again ...
4 years, 8 months ago (2016-04-05 01:57:09 UTC) #26
tkent
https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp File third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp (right): https://codereview.chromium.org/1841143002/diff/100001/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp#newcode102 third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp:102: return strcasecmp(entry1.name, entry2.name) < 0; On 2016/04/04 at 15:56:12, ...
4 years, 8 months ago (2016-04-08 00:05:02 UTC) #27
chongz
I've added method |codePointCompareIgnoringASCIICase()|, PTAL, thanks!
4 years, 8 months ago (2016-04-08 17:24:14 UTC) #28
tkent
lgtm
4 years, 8 months ago (2016-04-10 23:46:18 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1841143002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1841143002/140001
4 years, 8 months ago (2016-04-12 14:35:15 UTC) #33
commit-bot: I haz the power
Committed patchset #7 (id:140001)
4 years, 8 months ago (2016-04-12 16:05:27 UTC) #35
commit-bot: I haz the power
4 years, 8 months ago (2016-04-12 16:07:16 UTC) #37
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/2dcc34c1e14d6847a6340da3d03fbe5e04801bfb
Cr-Commit-Position: refs/heads/master@{#386702}

Powered by Google App Engine
This is Rietveld 408576698