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

Side by Side Diff: Source/core/layout/LayoutObject.h

Issue 1306993002: Cleanup friends of LayoutObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove LayoutBlock::promoteAllChildrenAndInsertAfter Created 5 years, 3 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
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 }; 110 };
111 111
112 typedef WTF::HashMap<const DeprecatedPaintLayer*, Vector<LayoutRect>> LayerHitTe stRects; 112 typedef WTF::HashMap<const DeprecatedPaintLayer*, Vector<LayoutRect>> LayerHitTe stRects;
113 113
114 #ifndef NDEBUG 114 #ifndef NDEBUG
115 const int showTreeCharacterOffset = 39; 115 const int showTreeCharacterOffset = 39;
116 #endif 116 #endif
117 117
118 // Base class for all layout tree objects. 118 // Base class for all layout tree objects.
119 class CORE_EXPORT LayoutObject : public ImageResourceClient { 119 class CORE_EXPORT LayoutObject : public ImageResourceClient {
120 friend class LayoutBlock;
121 friend class LayoutBlockFlow;
122 friend class DeprecatedPaintLayerReflectionInfo; // For setParent
123 friend class DeprecatedPaintLayerScrollableArea; // For setParent.
124 friend class LayoutObjectChildList; 120 friend class LayoutObjectChildList;
125 WTF_MAKE_NONCOPYABLE(LayoutObject); 121 WTF_MAKE_NONCOPYABLE(LayoutObject);
126 public: 122 public:
127 // Anonymous objects should pass the document as their node, and they will t hen automatically be 123 // Anonymous objects should pass the document as their node, and they will t hen automatically be
128 // marked as anonymous in the constructor. 124 // marked as anonymous in the constructor.
129 explicit LayoutObject(Node*); 125 explicit LayoutObject(Node*);
130 ~LayoutObject() override; 126 ~LayoutObject() override;
131 127
132 // Returns the name of the layout object. 128 // Returns the name of the layout object.
133 virtual const char* name() const = 0; 129 virtual const char* name() const = 0;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // LayoutObject tree manipulation 254 // LayoutObject tree manipulation
259 ////////////////////////////////////////// 255 //////////////////////////////////////////
260 virtual bool canHaveChildren() const { return virtualChildren(); } 256 virtual bool canHaveChildren() const { return virtualChildren(); }
261 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const { ret urn true; } 257 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const { ret urn true; }
262 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu llptr); 258 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu llptr);
263 virtual void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObje ct* beforeChild = nullptr) { return addChild(newChild, beforeChild); } 259 virtual void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObje ct* beforeChild = nullptr) { return addChild(newChild, beforeChild); }
264 virtual void removeChild(LayoutObject*); 260 virtual void removeChild(LayoutObject*);
265 virtual bool createsAnonymousWrapper() const { return false; } 261 virtual bool createsAnonymousWrapper() const { return false; }
266 ////////////////////////////////////////// 262 //////////////////////////////////////////
267 263
268 protected: 264 void setDangerousOneWayParent(LayoutObject* parent)
265 {
266 ASSERT(!previousSibling());
267 ASSERT(!nextSibling());
268 ASSERT(!parent || !m_parent);
269 setParent(parent);
270 }
271
272 private:
269 ////////////////////////////////////////// 273 //////////////////////////////////////////
270 // Helper functions. Dangerous to use! 274 // Helper functions. Dangerous to use!
271 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } 275 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; }
272 void setNextSibling(LayoutObject* next) { m_next = next; } 276 void setNextSibling(LayoutObject* next) { m_next = next; }
273 void setParent(LayoutObject* parent) 277 void setParent(LayoutObject* parent)
274 { 278 {
275 m_parent = parent; 279 m_parent = parent;
276 280
277 // Only update if our flow thread state is different from our new parent and if we're not a LayoutFlowThread. 281 // Only update if our flow thread state is different from our new parent and if we're not a LayoutFlowThread.
278 // A LayoutFlowThread is always considered to be inside itself, so it ne ver has to change its state 282 // A LayoutFlowThread is always considered to be inside itself, so it ne ver has to change its state
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 void invalidateDisplayItemClient(const DisplayItemClientWrapper&) const; 1050 void invalidateDisplayItemClient(const DisplayItemClientWrapper&) const;
1047 void invalidateDisplayItemClientForNonCompositingDescendants() const { inval idateDisplayItemClientForNonCompositingDescendantsOf(*this); } 1051 void invalidateDisplayItemClientForNonCompositingDescendants() const { inval idateDisplayItemClientForNonCompositingDescendantsOf(*this); }
1048 // A normal object should use invalidateDisplayItemClientForNonCompositingDe scendants() 1052 // A normal object should use invalidateDisplayItemClientForNonCompositingDe scendants()
1049 // to invalidate its descendants which are painted on the same backing. Howe ver, for 1053 // to invalidate its descendants which are painted on the same backing. Howe ver, for
1050 // an object (e.g. LayoutScrollbarPart, custom scroll corner, custom resizer ) which is 1054 // an object (e.g. LayoutScrollbarPart, custom scroll corner, custom resizer ) which is
1051 // not hooked up in the layout tree and not able to find its paint backing, it should 1055 // not hooked up in the layout tree and not able to find its paint backing, it should
1052 // let its owning layout object call the following function. 1056 // let its owning layout object call the following function.
1053 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48 4263. 1057 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48 4263.
1054 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO bject&) const; 1058 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO bject&) const;
1055 1059
1060 void removeFromLayoutFlowThread();
chrishtr 2015/08/25 23:27:35 Document.
Xianzhu 2015/08/26 00:23:53 Done.
1061
1062 virtual void updateAnonymousChildStyle(const LayoutObject& child, ComputedSt yle& style) const { }
chrishtr 2015/08/25 23:27:35 Document.
Xianzhu 2015/08/26 00:23:53 Done.
1063
1056 protected: 1064 protected:
1057 enum LayoutObjectType { 1065 enum LayoutObjectType {
1058 LayoutObjectBr, 1066 LayoutObjectBr,
1059 LayoutObjectCanvas, 1067 LayoutObjectCanvas,
1060 LayoutObjectFieldset, 1068 LayoutObjectFieldset,
1061 LayoutObjectCounter, 1069 LayoutObjectCounter,
1062 LayoutObjectDetailsMarker, 1070 LayoutObjectDetailsMarker,
1063 LayoutObjectEmbeddedObject, 1071 LayoutObjectEmbeddedObject,
1064 LayoutObjectFileUploadControl, 1072 LayoutObjectFileUploadControl,
1065 LayoutObjectFrame, 1073 LayoutObjectFrame,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1134
1127 inline bool layerCreationAllowedForSubtree() const; 1135 inline bool layerCreationAllowedForSubtree() const;
1128 1136
1129 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time 1137 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time
1130 // this function will be called. 1138 // this function will be called.
1131 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle) ; 1139 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle) ;
1132 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first 1140 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first
1133 // time this function is called. 1141 // time this function is called.
1134 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); 1142 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle);
1135 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); 1143 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
1136 virtual void updateAnonymousChildStyle(const LayoutObject& child, ComputedSt yle& style) const { }
1137 1144
1138 protected: 1145 protected:
1139 virtual void willBeDestroyed(); 1146 virtual void willBeDestroyed();
1140 1147
1141 virtual void insertedIntoTree(); 1148 virtual void insertedIntoTree();
1142 virtual void willBeRemovedFromTree(); 1149 virtual void willBeRemovedFromTree();
1143 1150
1144 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; } 1151 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; }
1145 1152
1146 // Add hit-test rects for the layout tree rooted at this node to the provide d collection on a 1153 // Add hit-test rects for the layout tree rooted at this node to the provide d collection on a
(...skipping 29 matching lines...) Expand all
1176 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer); 1183 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer);
1177 1184
1178 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients 1185 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients
1179 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc., 1186 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc.,
1180 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and 1187 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and
1181 // parts which are invalidated separately (e.g. scrollbars). 1188 // parts which are invalidated separately (e.g. scrollbars).
1182 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer) const; 1189 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer) const;
1183 1190
1184 void setIsSlowRepaintObject(bool); 1191 void setIsSlowRepaintObject(bool);
1185 1192
1193 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee dsOverflowRecalcAfterStyleChange(false); }
1194 void clearChildNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setChildN eedsOverflowRecalcAfterStyleChange(false); }
1195 void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidate OverflowForPaint(true); }
1196 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); }
1197
1186 private: 1198 private:
1187 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; } 1199 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; }
1188 1200
1189 // Adjusts a paint invalidation rect in the space of |m_previousPaintInvalid ationRect| and |m_previousPositionFromPaintInvalidationBacking| 1201 // Adjusts a paint invalidation rect in the space of |m_previousPaintInvalid ationRect| and |m_previousPositionFromPaintInvalidationBacking|
1190 // to be in the space of the |paintInvalidationContainer|, 1202 // to be in the space of the |paintInvalidationContainer|,
1191 // if needed. They can be different only if |paintInvalidationContainer| is a composited scroller. 1203 // if needed. They can be different only if |paintInvalidationContainer| is a composited scroller.
1192 void adjustInvalidationRectForCompositedScrolling(LayoutRect&, const LayoutB oxModelObject& paintInvalidationContainer) const; 1204 void adjustInvalidationRectForCompositedScrolling(LayoutRect&, const LayoutB oxModelObject& paintInvalidationContainer) const;
1193 1205
1194 void clearLayoutRootIfNeeded() const; 1206 void clearLayoutRootIfNeeded() const;
1195 1207
(...skipping 19 matching lines...) Expand all
1215 inline void invalidateContainerPreferredLogicalWidths(); 1227 inline void invalidateContainerPreferredLogicalWidths();
1216 1228
1217 void invalidatePaintIncludingNonCompositingDescendantsInternal(const LayoutB oxModelObject& repaintContainer); 1229 void invalidatePaintIncludingNonCompositingDescendantsInternal(const LayoutB oxModelObject& repaintContainer);
1218 1230
1219 LayoutRect previousSelectionRectForPaintInvalidation() const; 1231 LayoutRect previousSelectionRectForPaintInvalidation() const;
1220 void setPreviousSelectionRectForPaintInvalidation(const LayoutRect&); 1232 void setPreviousSelectionRectForPaintInvalidation(const LayoutRect&);
1221 1233
1222 const LayoutBoxModelObject* enclosingCompositedContainer() const; 1234 const LayoutBoxModelObject* enclosingCompositedContainer() const;
1223 1235
1224 LayoutFlowThread* locateFlowThreadContainingBlock() const; 1236 LayoutFlowThread* locateFlowThreadContainingBlock() const;
1225 void removeFromLayoutFlowThread();
1226 void removeFromLayoutFlowThreadRecursive(LayoutFlowThread*); 1237 void removeFromLayoutFlowThreadRecursive(LayoutFlowThread*);
1227 1238
1228 ComputedStyle* cachedFirstLineStyle() const; 1239 ComputedStyle* cachedFirstLineStyle() const;
1229 StyleDifference adjustStyleDifference(StyleDifference) const; 1240 StyleDifference adjustStyleDifference(StyleDifference) const;
1230 1241
1231 Color selectionColor(int colorProperty, const GlobalPaintFlags) const; 1242 Color selectionColor(int colorProperty, const GlobalPaintFlags) const;
1232 1243
1233 void removeShapeImageClient(ShapeValue*); 1244 void removeShapeImageClient(ShapeValue*);
1234 1245
1235 #if ENABLE(ASSERT) 1246 #if ENABLE(ASSERT)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 #undef ADD_BOOLEAN_BITFIELD 1414 #undef ADD_BOOLEAN_BITFIELD
1404 1415
1405 LayoutObjectBitfields m_bitfields; 1416 LayoutObjectBitfields m_bitfields;
1406 1417
1407 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } 1418 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
1408 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1419 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1409 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1420 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1410 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1421 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
1411 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); } 1422 void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimpli fiedNormalFlowLayout(b); }
1412 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } 1423 void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
1413 void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } 1424 void clearShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalida teOverflowForPaint(false); }
1414 void setShouldInvalidateOverflowForPaint(bool b) { m_bitfields.setShouldInva lidateOverflowForPaint(b); } 1425 void setSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNeeds OverflowRecalcAfterStyleChange(true); }
1415 void setSelfNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setSel fNeedsOverflowRecalcAfterStyleChange(b); } 1426 void setChildNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setChildNee dsOverflowRecalcAfterStyleChange(true); }
1416 void setChildNeedsOverflowRecalcAfterStyleChange(bool b) { m_bitfields.setCh ildNeedsOverflowRecalcAfterStyleChange(b); }
1417 1427
1418 private: 1428 private:
1419 // Store state between styleWillChange and styleDidChange 1429 // Store state between styleWillChange and styleDidChange
1420 static bool s_affectsParentBlock; 1430 static bool s_affectsParentBlock;
1421 1431
1422 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See 1432 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See
1423 // adjustInvalidationRectForCompositedScrolling(). 1433 // adjustInvalidationRectForCompositedScrolling().
1424 LayoutRect m_previousPaintInvalidationRect; 1434 LayoutRect m_previousPaintInvalidationRect;
1425 1435
1426 // This stores the position in the paint invalidation backing's coordinate. 1436 // This stores the position in the paint invalidation backing's coordinate.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 1515
1506 inline void LayoutObject::setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidat ionReasonForTracing reason, MarkingBehavior markParents, SubtreeLayoutScope* lay outer) 1516 inline void LayoutObject::setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidat ionReasonForTracing reason, MarkingBehavior markParents, SubtreeLayoutScope* lay outer)
1507 { 1517 {
1508 setNeedsLayout(reason, markParents, layouter); 1518 setNeedsLayout(reason, markParents, layouter);
1509 setShouldDoFullPaintInvalidation(); 1519 setShouldDoFullPaintInvalidation();
1510 } 1520 }
1511 1521
1512 inline void LayoutObject::clearNeedsLayout() 1522 inline void LayoutObject::clearNeedsLayout()
1513 { 1523 {
1514 // Set flags for later stages/cycles. 1524 // Set flags for later stages/cycles.
1515 setEverHadLayout(true); 1525 setEverHadLayout();
1516 setMayNeedPaintInvalidation(); 1526 setMayNeedPaintInvalidation();
1517 m_bitfields.setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()) ; 1527 m_bitfields.setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()) ;
1518 1528
1519 // Clear needsLayout flags. 1529 // Clear needsLayout flags.
1520 setSelfNeedsLayout(false); 1530 setSelfNeedsLayout(false);
1521 setPosChildNeedsLayout(false); 1531 setPosChildNeedsLayout(false);
1522 setNeedsSimplifiedNormalFlowLayout(false); 1532 setNeedsSimplifiedNormalFlowLayout(false);
1523 setNormalChildNeedsLayout(false); 1533 setNormalChildNeedsLayout(false);
1524 setNeedsPositionedMovementLayout(false); 1534 setNeedsPositionedMovementLayout(false);
1525 setAncestorLineBoxDirty(false); 1535 setAncestorLineBoxDirty(false);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 void showTree(const blink::LayoutObject*); 1666 void showTree(const blink::LayoutObject*);
1657 void showLineTree(const blink::LayoutObject*); 1667 void showLineTree(const blink::LayoutObject*);
1658 void showLayoutTree(const blink::LayoutObject* object1); 1668 void showLayoutTree(const blink::LayoutObject* object1);
1659 // We don't make object2 an optional parameter so that showLayoutTree 1669 // We don't make object2 an optional parameter so that showLayoutTree
1660 // can be called from gdb easily. 1670 // can be called from gdb easily.
1661 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 1671 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
1662 1672
1663 #endif 1673 #endif
1664 1674
1665 #endif // LayoutObject_h 1675 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698