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

Unified Diff: Source/core/css/resolver/StyleResolverState.h

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated change after Doug's review. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/css/resolver/StyleResolverState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ const LayoutStyle* m_parentStyle;
+ RefPtr<LayoutStyle> m_overrideParentStyle;
OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/css/resolver/StyleResolverState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698