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

Issue 2845773002: Make TextDecoration an enum class. (Closed)

Created:
3 years, 8 months ago by shend
Modified:
3 years, 7 months ago
CC:
aboxhall, aboxhall+watch_chromium.org, darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-layout_chromium.org, blink-reviews-paint_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, dmazzoni, dmazzoni+watch_chromium.org, dshwang, dougt+watch_chromium.org, dtseng+watch_chromium.org, eae+blinkwatch, haraken, jchaffraix+rendering, je_julie, leviw+renderwatch, nektarios, nektar+watch_chromium.org, pdr+renderingwatchlist_chromium.org, rwlbuis, szager+layoutwatch_chromium.org, yuzo+watch_chromium.org, zoltan1
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make TextDecoration an enum class. This patch makes TextDecoration an enum class for better type safety. However, TextDecoration is a bit flag, so it is often used with bitwise operators. Enum classes do not have bitwise operators by default, so we define our own explicitly as needed. Furthermore, a lot of code involves testing if a bit is set/active in a TextDecoration. Previously, we could do something like: if (text_decoration & TextDecoration::kUnderline) to check if underline is applied. This worked because TextDecoration could be implicitly converted to a bool. However, enum classes cannot. With an enum class, it is more verbose and unintuitive: if ((text_decoration & TextDecoration::kUnderline) != TextDecoration::kNone) Hence, we also provide a helper function called EnumHasFlags that performs this check: if (EnumHasFlags(text_decoration, TextDecoration::kUnderline)) BUG=684966 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2845773002 Cr-Commit-Position: refs/heads/master@{#471219} Committed: https://chromium.googlesource.com/chromium/src/+/9dc275c518d70c4fb4652fdfb5b908d060b53296

Patch Set 1 #

Total comments: 6

Patch Set 2 : Address comments #

Total comments: 7

Patch Set 3 : Rebase #

Patch Set 4 : Rebase #

Patch Set 5 : Rebase #

Patch Set 6 : Rebase #

Patch Set 7 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -57 lines) Patch
M third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h View 1 2 3 4 5 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp View 1 2 3 4 5 1 chunk +5 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTextCombine.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp View 1 2 5 chunks +9 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp View 1 2 5 chunks +11 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/paint/TextPainterBase.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.h View 1 2 3 4 5 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.cpp View 1 2 3 4 5 6 4 chunks +10 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyleConstants.h View 1 2 3 4 5 2 chunks +19 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp View 1 2 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 58 (41 generated)
shend
Hi Bugs, PTAL
3 years, 8 months ago (2017-04-26 23:02:47 UTC) #4
Bugs Nash
https://codereview.chromium.org/2845773002/diff/1/third_party/WebKit/Source/core/style/ComputedStyle.cpp File third_party/WebKit/Source/core/style/ComputedStyle.cpp (right): https://codereview.chromium.org/2845773002/diff/1/third_party/WebKit/Source/core/style/ComputedStyle.cpp#newcode1716 third_party/WebKit/Source/core/style/ComputedStyle.cpp:1716: TextDecoration decorations = TextDecoration::kNone; yass https://codereview.chromium.org/2845773002/diff/1/third_party/WebKit/Source/core/style/ComputedStyleConstants.h File third_party/WebKit/Source/core/style/ComputedStyleConstants.h (right): ...
3 years, 8 months ago (2017-04-27 00:02:23 UTC) #5
shend
Addressed comments, PTAL again :) https://codereview.chromium.org/2845773002/diff/1/third_party/WebKit/Source/core/style/ComputedStyle.cpp File third_party/WebKit/Source/core/style/ComputedStyle.cpp (right): https://codereview.chromium.org/2845773002/diff/1/third_party/WebKit/Source/core/style/ComputedStyle.cpp#newcode1716 third_party/WebKit/Source/core/style/ComputedStyle.cpp:1716: TextDecoration decorations = TextDecoration::kNone; ...
3 years, 8 months ago (2017-04-27 00:27:34 UTC) #7
Bugs Nash
https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp File third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp (right): https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp#newcode12 third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp:12: : lines_(static_cast<unsigned>(line)), style_(style), color_(color) {} Hm. I think this ...
3 years, 8 months ago (2017-04-27 00:53:55 UTC) #10
shend
Addressed comments, PTAL again? https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp File third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp (right): https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp#newcode12 third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp:12: : lines_(static_cast<unsigned>(line)), style_(style), color_(color) {} ...
3 years, 8 months ago (2017-04-27 01:09:17 UTC) #11
Bugs Nash
https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp File third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp (right): https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp#newcode12 third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp:12: : lines_(static_cast<unsigned>(line)), style_(style), color_(color) {} On 2017/04/27 at 01:09:17, ...
3 years, 8 months ago (2017-04-27 01:59:31 UTC) #12
shend
On 2017/04/27 at 01:59:31, bugsnash wrote: > https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp > File third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp (right): > > https://codereview.chromium.org/2845773002/diff/20001/third_party/WebKit/Source/core/style/AppliedTextDecoration.cpp#newcode12 ...
3 years, 8 months ago (2017-04-27 02:03:59 UTC) #13
Bugs Nash
On 2017/04/27 at 02:03:59, shend wrote: > On 2017/04/27 at 01:59:31, bugsnash wrote: > > ...
3 years, 8 months ago (2017-04-27 02:09:26 UTC) #14
shend
Hi Alan, PTAL
3 years, 8 months ago (2017-04-27 03:38:24 UTC) #18
Eric Willigers
lgtm
3 years, 7 months ago (2017-05-05 04:59:04 UTC) #20
shend
Hi Alice, PTAL :)
3 years, 7 months ago (2017-05-08 06:01:09 UTC) #24
shend
On 2017/05/08 at 06:01:09, shend wrote: > Hi Alice, PTAL :) * for OWNERS on ...
3 years, 7 months ago (2017-05-08 06:01:27 UTC) #25
dmazzoni
lgtm for accessibility Feel free to TBR for trivial changes like this whenever a core ...
3 years, 7 months ago (2017-05-08 20:04:13 UTC) #33
shend
On 2017/05/08 at 20:04:13, dmazzoni wrote: > lgtm for accessibility > > Feel free to ...
3 years, 7 months ago (2017-05-08 23:49:38 UTC) #35
alancutter (OOO until 2018)
lgtm
3 years, 7 months ago (2017-05-09 00:11:45 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2845773002/120001
3 years, 7 months ago (2017-05-12 04:18:34 UTC) #55
commit-bot: I haz the power
3 years, 7 months ago (2017-05-12 04:24:24 UTC) #58
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as
https://chromium.googlesource.com/chromium/src/+/9dc275c518d70c4fb4652fdfb5b9...

Powered by Google App Engine
This is Rietveld 408576698