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

Issue 686723002: Improve RAII of StyleResolverState. (Closed)

Created:
6 years, 1 month ago by andersr
Modified:
6 years ago
Reviewers:
rune
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, dglazkov+blink, eae+blinkwatch, ed+blinkwatch_opera.com, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Improve RAII of StyleResolverState. This patch ensures that the correct RenderStyle and parent is provided upon construction of StyleResolverState, and *removes* the possibility of these pointers changing from the outside at arbitrary times. This makes construction of member objects easier, removes unnecessary 'setStyle' methods, and reduces elements of surprise in general. Also, StyleResolverState::parentStyle is now never nullptr for the lifetime of the object. Changes: * The parentNode-style-if-null logic in the StyleResolverState constructor has been moved to ElementResolveContext. This makes it possible to use the result of this logic without constructing a StyleResolverState. * StyleBasisContext has been added as a subclass of ElementResolveContext. It contains additional context related to animation, inheritance and pseudo elements. R=rune@opera.com

Patch Set 1 #

Patch Set 2 : Make StyleResolverContext STACK_ALLOCATED. #

Patch Set 3 : Drop StyleResolverContext. Extend ElementResolveContext instead. #

Patch Set 4 : Fix very incorrect parentStyles (plus minor stuff). #

Patch Set 5 : When baseRenderStyle!=0: 1) don't inherit, and 2) use defaultStyleForElement as fallback parent. #

Total comments: 7

Patch Set 6 : Rebased, added StyleBasisContext and AnimationResolveContext. #

Patch Set 7 : Fix unused var + minor diff noise. #

Total comments: 8

Patch Set 8 : Reduce the number of contexts. #

Patch Set 9 : Rebase. #

Patch Set 10 : Fixed issues. #

Patch Set 11 : Fix assertions. #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -104 lines) Patch
M Source/core/css/CSSToLengthConversionData.h View 1 chunk +0 lines, -3 lines 0 comments Download
M Source/core/css/resolver/ElementResolveContext.h View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/css/resolver/ElementResolveContext.cpp View 1 2 3 4 5 2 chunks +5 lines, -1 line 0 comments Download
M Source/core/css/resolver/FontBuilder.h View 1 chunk +1 line, -2 lines 0 comments Download
M Source/core/css/resolver/FontBuilder.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -2 lines 0 comments Download
M Source/core/css/resolver/FontBuilderTest.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M Source/core/css/resolver/StyleBuilderConverter.cpp View 1 2 3 1 chunk +1 line, -5 lines 0 comments Download
M Source/core/css/resolver/StyleBuilderCustom.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/css/resolver/StyleResolver.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -2 lines 0 comments Download
M Source/core/css/resolver/StyleResolver.cpp View 1 2 3 4 5 6 7 8 9 20 chunks +92 lines, -67 lines 4 comments Download
M Source/core/css/resolver/StyleResolverState.h View 1 2 3 4 5 6 3 chunks +2 lines, -8 lines 1 comment Download
M Source/core/css/resolver/StyleResolverState.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +24 lines, -8 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
andersr
Note that this patch currently contains https://codereview.chromium.org/686723002/ , because I want to use the trybots ...
6 years, 1 month ago (2014-10-28 12:52:40 UTC) #1
andersr
Hmm, maybe it's better to just modify ElementResolveContext.
6 years, 1 month ago (2014-10-28 13:12:33 UTC) #2
andersr
Patch #1 was ugly, sorry. ;) Patch #3 should be better: * Extend ElementResolveContext instead ...
6 years, 1 month ago (2014-10-28 14:54:41 UTC) #3
rune
https://codereview.chromium.org/686723002/diff/70001/Source/core/css/resolver/FontBuilder.h File Source/core/css/resolver/FontBuilder.h (right): https://codereview.chromium.org/686723002/diff/70001/Source/core/css/resolver/FontBuilder.h#newcode44 Source/core/css/resolver/FontBuilder.h:44: FontBuilder(const Document&, RenderStyle*); Seems like the FontBuilder construction change ...
6 years, 1 month ago (2014-10-29 12:01:15 UTC) #4
rune
https://codereview.chromium.org/686723002/diff/70001/Source/core/css/CSSToLengthConversionData.h File Source/core/css/CSSToLengthConversionData.h (left): https://codereview.chromium.org/686723002/diff/70001/Source/core/css/CSSToLengthConversionData.h#oldcode60 Source/core/css/CSSToLengthConversionData.h:60: void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } ...
6 years, 1 month ago (2014-10-29 12:15:21 UTC) #5
rune
On 2014/10/28 at 12:52:40, andersr wrote: > Note that this patch currently contains https://codereview.chromium.org/686723002/ , ...
6 years, 1 month ago (2014-10-29 13:01:52 UTC) #6
rune
https://codereview.chromium.org/686723002/diff/70001/Source/core/css/resolver/ElementResolveContext.h File Source/core/css/resolver/ElementResolveContext.h (right): https://codereview.chromium.org/686723002/diff/70001/Source/core/css/resolver/ElementResolveContext.h#newcode39 Source/core/css/resolver/ElementResolveContext.h:39: ElementResolveContext(Document&, Element*, RenderStyle* parentStyle); I liked it better when ...
6 years, 1 month ago (2014-10-29 13:02:14 UTC) #7
andersr
On 2014/10/29 13:01:52, rune wrote: > On 2014/10/28 at 12:52:40, andersr wrote: > > Note ...
6 years, 1 month ago (2014-10-29 13:23:39 UTC) #8
andersr
https://codereview.chromium.org/686723002/diff/70001/Source/core/css/CSSToLengthConversionData.h File Source/core/css/CSSToLengthConversionData.h (left): https://codereview.chromium.org/686723002/diff/70001/Source/core/css/CSSToLengthConversionData.h#oldcode60 Source/core/css/CSSToLengthConversionData.h:60: void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } ...
6 years, 1 month ago (2014-10-29 13:29:47 UTC) #9
andersr
Rebased, dropped [WIP], rewrote description, ... rewrote patch. PTAL.
6 years, 1 month ago (2014-10-30 13:31:40 UTC) #10
rune
I've done an initial pass over this. Everything outside of StyleResolver.h/cpp looks good, I think. ...
6 years, 1 month ago (2014-10-30 15:23:51 UTC) #11
andersr
On 2014/10/30 15:23:51, rune wrote: > I've done an initial pass over this. Everything outside ...
6 years, 1 month ago (2014-10-30 16:06:44 UTC) #12
andersr
https://codereview.chromium.org/686723002/diff/110001/Source/core/css/resolver/FontBuilder.cpp File Source/core/css/resolver/FontBuilder.cpp (right): https://codereview.chromium.org/686723002/diff/110001/Source/core/css/resolver/FontBuilder.cpp#newcode65 Source/core/css/resolver/FontBuilder.cpp:65: , m_style(style) On 2014/10/30 15:23:50, rune wrote: > It ...
6 years, 1 month ago (2014-10-31 13:02:15 UTC) #13
rune
https://codereview.chromium.org/686723002/diff/190001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/686723002/diff/190001/Source/core/css/resolver/StyleResolver.cpp#newcode131 Source/core/css/resolver/StyleResolver.cpp:131: class StyleBasisContext : public ElementResolveContext { I don't like ...
6 years, 1 month ago (2014-11-13 14:28:43 UTC) #14
andersr
https://codereview.chromium.org/686723002/diff/190001/Source/core/css/resolver/StyleResolver.cpp File Source/core/css/resolver/StyleResolver.cpp (right): https://codereview.chromium.org/686723002/diff/190001/Source/core/css/resolver/StyleResolver.cpp#newcode131 Source/core/css/resolver/StyleResolver.cpp:131: class StyleBasisContext : public ElementResolveContext { On 2014/11/13 14:28:42, ...
6 years, 1 month ago (2014-11-13 14:57:20 UTC) #15
andersr
6 years, 1 month ago (2014-11-21 15:19:11 UTC) #16
This does not lgtm to me anymore. I'm not sure this actually constitutes a net
improvement, even after fixing the resolved issues.

Powered by Google App Engine
This is Rietveld 408576698