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

Issue 2793193004: Remove mutable from ComputedStyle by const_cast. (Closed)

Created:
3 years, 8 months ago by shend
Modified:
3 years, 8 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove mutable from ComputedStyle by const_cast. This patch removes mutable from ComputedStyle::hasViewportUnits and hasRemUnits. The only case where this mutability is required is in CSSToLengthConversionData, where resolving a viewport/rem unit would set those two members to true on a const ComputedStyle. Instead of having mutable in ComputedStyle, which is hard to generate, we perform const_cast on the computed style in CSSToLengthConversionData. This is safe as all computed styles are initially nonconst. This patch does not change any behaviour. This is prework for generating the two fields in ComputedStyleBase. BUG=628043 Review-Url: https://codereview.chromium.org/2793193004 Cr-Commit-Position: refs/heads/master@{#462258} Committed: https://chromium.googlesource.com/chromium/src/+/5b97f21d9cd473b57b8ce169f75d9cdc135184fc

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -13 lines) Patch
M third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp View 1 1 chunk +8 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.h View 1 2 chunks +5 lines, -8 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 16 (10 generated)
shend
Hi Alan, PTAL :)
3 years, 8 months ago (2017-04-05 05:13:49 UTC) #2
alancutter (OOO until 2018)
lgtm, the description should make it clear there are no behavioural changes intended.
3 years, 8 months ago (2017-04-05 05:21:19 UTC) #3
alancutter (OOO until 2018)
https://codereview.chromium.org/2793193004/diff/1/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp File third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp (right): https://codereview.chromium.org/2793193004/diff/1/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp#newcode101 third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp:101: const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); Let's add a TODO to plumb these bits ...
3 years, 8 months ago (2017-04-05 05:22:23 UTC) #4
shend
https://codereview.chromium.org/2793193004/diff/1/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp File third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp (right): https://codereview.chromium.org/2793193004/diff/1/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp#newcode101 third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp:101: const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); On 2017/04/05 at 05:22:23, alancutter wrote: > Let's ...
3 years, 8 months ago (2017-04-05 06:19:11 UTC) #8
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/2793193004/20001
3 years, 8 months ago (2017-04-05 22:58:55 UTC) #13
commit-bot: I haz the power
3 years, 8 months ago (2017-04-05 23:10:19 UTC) #16
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/5b97f21d9cd473b57b8ce169f75d...

Powered by Google App Engine
This is Rietveld 408576698