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

Side by Side Diff: Source/WebCore/rendering/RenderObject.h

Issue 13679002: Add StyleChangeState to get rid of a bunch of static state in the render tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 #endif 141 #endif
142 }; 142 };
143 #endif 143 #endif
144 144
145 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet; 145 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet;
146 146
147 #ifndef NDEBUG 147 #ifndef NDEBUG
148 const int showTreeCharacterOffset = 39; 148 const int showTreeCharacterOffset = 39;
149 #endif 149 #endif
150 150
151 struct StyleChangeState {
152 // RenderObject
153 unsigned affectsParentBlock : 1;
154
155 // RenderLayerModelObject
156 unsigned wasFloating : 1;
157 unsigned hadLayer : 1;
158 unsigned hadTransform : 1;
159 unsigned layerWasSelfPainting : 1;
160
161 // RenderBox
162 unsigned hadOverflowClip : 1;
163
164 // RenderBlock
165 unsigned couldPropagateFloatIntoSibling : 1;
166
167 StyleChangeState() :
168 affectsParentBlock(0),
eseidel 2013/04/05 01:50:36 I take it the compiler doesn't like "false"?
esprehn 2013/04/17 03:29:01 Nah, I was just moving fast. I'll change to false.
169 wasFloating(0),
170 hadLayer(0),
171 hadTransform(0),
172 layerWasSelfPainting(0),
173 hadOverflowClip(0),
174 couldPropagateFloatIntoSibling(0)
175 {
176 }
177 };
178
151 // Base class for all rendering tree objects. 179 // Base class for all rendering tree objects.
152 class RenderObject : public CachedImageClient { 180 class RenderObject : public CachedImageClient {
153 friend class RenderBlock; 181 friend class RenderBlock;
154 friend class RenderLayer; 182 friend class RenderLayer;
155 friend class RenderObjectChildList; 183 friend class RenderObjectChildList;
156 public: 184 public:
157 // Anonymous objects should pass the document as their node, and they will t hen automatically be 185 // Anonymous objects should pass the document as their node, and they will t hen automatically be
158 // marked as anonymous in the constructor. 186 // marked as anonymous in the constructor.
159 explicit RenderObject(Node*); 187 explicit RenderObject(Node*);
160 virtual ~RenderObject(); 188 virtual ~RenderObject();
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 1020
993 // Return the renderer whose background style is used to paint the root back ground. Should only be called on the renderer for which isRoot() is true. 1021 // Return the renderer whose background style is used to paint the root back ground. Should only be called on the renderer for which isRoot() is true.
994 RenderObject* rendererForRootBackground(); 1022 RenderObject* rendererForRootBackground();
995 1023
996 RespectImageOrientationEnum shouldRespectImageOrientation() const; 1024 RespectImageOrientationEnum shouldRespectImageOrientation() const;
997 1025
998 protected: 1026 protected:
999 inline bool layerCreationAllowedForSubtree() const; 1027 inline bool layerCreationAllowedForSubtree() const;
1000 1028
1001 // Overrides should call the superclass at the end 1029 // Overrides should call the superclass at the end
1002 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 1030 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle, S tyleChangeState&);
1003 // Overrides should call the superclass at the start 1031 // Overrides should call the superclass at the start
1004 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 1032 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle, co nst StyleChangeState&);
1005 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); 1033 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
1006 1034
1007 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide, 1035 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide,
1008 Color, EBorderStyle, int adjbw1, int adjbw2, bool an tialias = false); 1036 Color, EBorderStyle, int adjbw1, int adjbw2, bool an tialias = false);
1009 1037
1010 void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*); 1038 void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
1011 void paintOutline(PaintInfo&, const LayoutRect&); 1039 void paintOutline(PaintInfo&, const LayoutRect&);
1012 void addPDFURLRect(GraphicsContext*, const LayoutRect&); 1040 void addPDFURLRect(GraphicsContext*, const LayoutRect&);
1013 1041
1014 virtual LayoutRect viewRect() const; 1042 virtual LayoutRect viewRect() const;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 #undef ADD_BOOLEAN_BITFIELD 1190 #undef ADD_BOOLEAN_BITFIELD
1163 1191
1164 RenderObjectBitfields m_bitfields; 1192 RenderObjectBitfields m_bitfields;
1165 1193
1166 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1194 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1167 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1195 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1168 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1196 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
1169 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); } 1197 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); }
1170 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } 1198 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
1171 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } 1199 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
1172
1173 private:
1174 // Store state between styleWillChange and styleDidChange
1175 static bool s_affectsParentBlock;
1176 }; 1200 };
1177 1201
1178 inline bool RenderObject::documentBeingDestroyed() const 1202 inline bool RenderObject::documentBeingDestroyed() const
1179 { 1203 {
1180 return !document()->renderer(); 1204 return !document()->renderer();
1181 } 1205 }
1182 1206
1183 inline bool RenderObject::isBeforeContent() const 1207 inline bool RenderObject::isBeforeContent() const
1184 { 1208 {
1185 if (style()->styleType() != BEFORE) 1209 if (style()->styleType() != BEFORE)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 // Outside the WebCore namespace for ease of invocation from gdb. 1396 // Outside the WebCore namespace for ease of invocation from gdb.
1373 void showTree(const WebCore::RenderObject*); 1397 void showTree(const WebCore::RenderObject*);
1374 void showLineTree(const WebCore::RenderObject*); 1398 void showLineTree(const WebCore::RenderObject*);
1375 void showRenderTree(const WebCore::RenderObject* object1); 1399 void showRenderTree(const WebCore::RenderObject* object1);
1376 // We don't make object2 an optional parameter so that showRenderTree 1400 // We don't make object2 an optional parameter so that showRenderTree
1377 // can be called from gdb easily. 1401 // can be called from gdb easily.
1378 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1402 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1379 #endif 1403 #endif
1380 1404
1381 #endif // RenderObject_h 1405 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698