Chromium Code Reviews| Index: Source/core/css/resolver/StyleResolverState.h |
| diff --git a/Source/core/css/resolver/StyleResolverState.h b/Source/core/css/resolver/StyleResolverState.h |
| index f10d3f6616eae3d972732a8c440dc1275e7a220b..a2ee2882b59e82a007e5719ce02e234a6ad956d4 100644 |
| --- a/Source/core/css/resolver/StyleResolverState.h |
| +++ b/Source/core/css/resolver/StyleResolverState.h |
| @@ -45,8 +45,8 @@ class StyleResolverState { |
| STACK_ALLOCATED(); |
| WTF_MAKE_NONCOPYABLE(StyleResolverState); |
| public: |
| - StyleResolverState(Document&, const ElementResolveContext&, LayoutStyle* parentStyle); |
| - StyleResolverState(Document&, Element*, LayoutStyle* parentStyle = 0); |
| + StyleResolverState(Document&, const ElementResolveContext&, const LayoutStyle* parentStyle); |
| + StyleResolverState(Document&, Element*, const LayoutStyle* parentStyle = 0); |
| ~StyleResolverState(); |
| // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to grab the document from. |
| @@ -83,9 +83,13 @@ public: |
| const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get(); } |
| PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate(); |
| - void setParentStyle(PassRefPtr<LayoutStyle> parentStyle) { m_parentStyle = parentStyle; } |
| - const LayoutStyle* parentStyle() const { return m_parentStyle.get(); } |
| - LayoutStyle* parentStyle() { return m_parentStyle.get(); } |
| + void setParentStyle(PassRefPtr<LayoutStyle> parentStyle) { m_overrideParentStyle = parentStyle; } |
| + const LayoutStyle* parentStyle() const |
| + { |
| + if (m_overrideParentStyle) |
| + return m_overrideParentStyle.get(); |
| + return m_parentStyle; |
| + } |
| // FIXME: These are effectively side-channel "out parameters" for the various |
| // map functions. When we map from CSS to style objects we use this state object |
| @@ -128,7 +132,7 @@ public: |
| // set these directly on the LayoutStyle w/o telling us. Presumably we'll |
| // want to design a better wrapper around LayoutStyle for tracking these mutations |
| // and separate it from StyleResolverState. |
| - const FontDescription& parentFontDescription() { return m_parentStyle->fontDescription(); } |
| + const FontDescription& parentFontDescription() { return parentStyle()->fontDescription(); } |
| void setZoom(float f) |
| { |
| @@ -162,7 +166,8 @@ private: |
| // m_parentStyle is not always just ElementResolveContext::parentStyle, |
| // so we keep it separate. |
| - RefPtr<LayoutStyle> m_parentStyle; |
|
dstockwell
2015/02/19 00:41:50
What was wrong with just RefPtr<LayoutStyle> m_par
Julien - ping for review
2015/02/19 21:04:13
RefPtr mutates the underlying style and we wanted
dstockwell
2015/02/19 23:11:19
Ahh, right :(
I'm not sure there's actually a goo
|
| + const LayoutStyle* m_parentStyle; |
| + RefPtr<LayoutStyle> m_overrideParentStyle; |
| OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; |