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

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

Issue 593873002: Alternate way to track first paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix a bug Created 6 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
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 InvalidationFull, 110 InvalidationFull,
111 InvalidationBorderFitLines, 111 InvalidationBorderFitLines,
112 InvalidationBorderBoxChange, 112 InvalidationBorderBoxChange,
113 InvalidationBoundsChange, 113 InvalidationBoundsChange,
114 InvalidationLocationChange, 114 InvalidationLocationChange,
115 InvalidationBecameVisible, 115 InvalidationBecameVisible,
116 InvalidationBecameInvisible, 116 InvalidationBecameInvisible,
117 InvalidationScroll, 117 InvalidationScroll,
118 InvalidationSelection, 118 InvalidationSelection,
119 InvalidationLayer, 119 InvalidationLayer,
120 InvalidationRendererInsertion,
120 InvalidationRendererRemoval, 121 InvalidationRendererRemoval,
121 InvalidationPaintRectangle 122 InvalidationPaintRectangle
122 }; 123 };
123 124
124 const int caretWidth = 1; 125 const int caretWidth = 1;
125 126
126 struct AnnotatedRegionValue { 127 struct AnnotatedRegionValue {
127 bool operator==(const AnnotatedRegionValue& o) const 128 bool operator==(const AnnotatedRegionValue& o) const
128 { 129 {
129 return draggable == o.draggable && bounds == o.bounds; 130 return draggable == o.draggable && bounds == o.bounds;
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const; 827 virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
827 828
828 struct AppliedTextDecoration { 829 struct AppliedTextDecoration {
829 Color color; 830 Color color;
830 TextDecorationStyle style; 831 TextDecorationStyle style;
831 AppliedTextDecoration() : color(Color::transparent), style(TextDecoratio nStyleSolid) { } 832 AppliedTextDecoration() : color(Color::transparent), style(TextDecoratio nStyleSolid) { }
832 }; 833 };
833 834
834 void getTextDecorations(unsigned decorations, AppliedTextDecoration& underli ne, AppliedTextDecoration& overline, AppliedTextDecoration& linethrough, bool qu irksMode = false, bool firstlineStyle = false); 835 void getTextDecorations(unsigned decorations, AppliedTextDecoration& underli ne, AppliedTextDecoration& overline, AppliedTextDecoration& linethrough, bool qu irksMode = false, bool firstlineStyle = false);
835 836
836 void setHadPaintInvalidation();
837 bool hadPaintInvalidation() const;
838
839 // Return the RenderLayerModelObject in the container chain which is respons ible for painting this object, or 0 837 // Return the RenderLayerModelObject in the container chain which is respons ible for painting this object, or 0
840 // if painting is root-relative. This is the container that should be passed to the 'forPaintInvalidation' 838 // if painting is root-relative. This is the container that should be passed to the 'forPaintInvalidation'
841 // methods. 839 // methods.
842 const RenderLayerModelObject* containerForPaintInvalidation() const; 840 const RenderLayerModelObject* containerForPaintInvalidation() const;
843 const RenderLayerModelObject* adjustCompositedContainerForSpecialAncestors(c onst RenderLayerModelObject* paintInvalidationContainer) const; 841 const RenderLayerModelObject* adjustCompositedContainerForSpecialAncestors(c onst RenderLayerModelObject* paintInvalidationContainer) const;
844 bool isPaintInvalidationContainer() const; 842 bool isPaintInvalidationContainer() const;
845 843
846 LayoutRect computePaintInvalidationRect() 844 LayoutRect computePaintInvalidationRect()
847 { 845 {
848 return computePaintInvalidationRect(containerForPaintInvalidation()); 846 return computePaintInvalidationRect(containerForPaintInvalidation());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 bool isRelayoutBoundaryForInspector() const; 1008 bool isRelayoutBoundaryForInspector() const;
1011 1009
1012 // The previous paint invalidation rect in the object's previous paint backi ng. 1010 // The previous paint invalidation rect in the object's previous paint backi ng.
1013 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; } 1011 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; }
1014 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; } 1012 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; }
1015 1013
1016 // The previous position of the top-left corner of the object in its previou s paint backing. 1014 // The previous position of the top-left corner of the object in its previou s paint backing.
1017 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { re turn m_previousPositionFromPaintInvalidationBacking; } 1015 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { re turn m_previousPositionFromPaintInvalidationBacking; }
1018 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking) { m_previousPositionFromPaintInvalidationBacki ng = positionFromPaintInvalidationBacking; } 1016 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking) { m_previousPositionFromPaintInvalidationBacki ng = positionFromPaintInvalidationBacking; }
1019 1017
1020 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); } 1018 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv alidationReason() != InvalidationNone; }
1021 void setShouldDoFullPaintInvalidation(bool, MarkingBehavior = MarkContaining BlockChain); 1019 void setShouldDoFullPaintInvalidation(bool, MarkingBehavior = MarkContaining BlockChain);
1020 void setShouldDoFullPaintInvalidationWithReason(InvalidationReason = Invalid ationFull, MarkingBehavior = MarkContainingBlockChain);
Julien - ping for review 2014/09/26 17:56:24 I don't think the default InvalidationReason is gi
Xianzhu 2014/09/26 18:36:21 - Removed the default value for InvalidationReason
1022 1021
1023 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1022 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1024 1023
1025 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } 1024 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); }
1026 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) 1025 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b)
1027 { 1026 {
1028 m_bitfields.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); 1027 m_bitfields.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b);
1029 1028
1030 if (b) 1029 if (b)
1031 markContainingBlockChainForPaintInvalidation(); 1030 markContainingBlockChainForPaintInvalidation();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 class RenderObjectBitfields { 1192 class RenderObjectBitfields {
1194 enum PositionedState { 1193 enum PositionedState {
1195 IsStaticallyPositioned = 0, 1194 IsStaticallyPositioned = 0,
1196 IsRelativelyPositioned = 1, 1195 IsRelativelyPositioned = 1,
1197 IsOutOfFlowPositioned = 2, 1196 IsOutOfFlowPositioned = 2,
1198 }; 1197 };
1199 1198
1200 public: 1199 public:
1201 RenderObjectBitfields(Node* node) 1200 RenderObjectBitfields(Node* node)
1202 : m_selfNeedsLayout(false) 1201 : m_selfNeedsLayout(false)
1203 , m_shouldDoFullPaintInvalidation(false)
1204 , m_shouldInvalidateOverflowForPaint(false) 1202 , m_shouldInvalidateOverflowForPaint(false)
1205 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false) 1203 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false)
1206 // FIXME: We should remove mayNeedPaintInvalidation once we are able to 1204 // FIXME: We should remove mayNeedPaintInvalidation once we are able to
1207 // use the other layout flags to detect the same cases. crbug.com/37 0118 1205 // use the other layout flags to detect the same cases. crbug.com/37 0118
1208 , m_mayNeedPaintInvalidation(false) 1206 , m_mayNeedPaintInvalidation(false)
1209 , m_onlyNeededPositionedMovementLayout(false) 1207 , m_onlyNeededPositionedMovementLayout(false)
1210 , m_neededLayoutBecauseOfChildren(false) 1208 , m_neededLayoutBecauseOfChildren(false)
1211 , m_needsPositionedMovementLayout(false) 1209 , m_needsPositionedMovementLayout(false)
1212 , m_normalChildNeedsLayout(false) 1210 , m_normalChildNeedsLayout(false)
1213 , m_posChildNeedsLayout(false) 1211 , m_posChildNeedsLayout(false)
(...skipping 18 matching lines...) Expand all
1232 , m_ancestorLineBoxDirty(false) 1230 , m_ancestorLineBoxDirty(false)
1233 , m_layoutDidGetCalled(false) 1231 , m_layoutDidGetCalled(false)
1234 , m_hasPendingResourceUpdate(false) 1232 , m_hasPendingResourceUpdate(false)
1235 , m_childrenInline(false) 1233 , m_childrenInline(false)
1236 , m_hasColumns(false) 1234 , m_hasColumns(false)
1237 , m_alwaysCreateLineBoxesForRenderInline(false) 1235 , m_alwaysCreateLineBoxesForRenderInline(false)
1238 , m_positionedState(IsStaticallyPositioned) 1236 , m_positionedState(IsStaticallyPositioned)
1239 , m_selectionState(SelectionNone) 1237 , m_selectionState(SelectionNone)
1240 , m_flowThreadState(NotInsideFlowThread) 1238 , m_flowThreadState(NotInsideFlowThread)
1241 , m_boxDecorationBackgroundState(NoBoxDecorationBackground) 1239 , m_boxDecorationBackgroundState(NoBoxDecorationBackground)
1240 , m_fullPaintInvalidationReason(InvalidationNone)
1242 { 1241 {
1243 } 1242 }
1244 1243
1245 // 32 bits have been used in the first word, and 11 in the second. 1244 // 32 bits have been used in the first word, and 11 in the second.
Julien - ping for review 2014/09/26 17:56:24 Let's update the number of remaining bits please!
Xianzhu 2014/09/26 18:36:21 Done.
1246 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1245 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1247 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidation, ShouldDoFullPaintInv alidation);
1248 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); 1246 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1249 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer); 1247 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer);
1250 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1248 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1251 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1249 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1252 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren); 1250 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1253 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1251 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1254 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1252 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1255 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1253 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1256 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1254 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1257 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1255 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
(...skipping 27 matching lines...) Expand all
1285 ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns); 1283 ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns);
1286 1284
1287 // from RenderInline 1285 // from RenderInline
1288 ADD_BOOLEAN_BITFIELD(alwaysCreateLineBoxesForRenderInline, AlwaysCreateL ineBoxesForRenderInline); 1286 ADD_BOOLEAN_BITFIELD(alwaysCreateLineBoxesForRenderInline, AlwaysCreateL ineBoxesForRenderInline);
1289 1287
1290 private: 1288 private:
1291 unsigned m_positionedState : 2; // PositionedState 1289 unsigned m_positionedState : 2; // PositionedState
1292 unsigned m_selectionState : 3; // SelectionState 1290 unsigned m_selectionState : 3; // SelectionState
1293 unsigned m_flowThreadState : 2; // FlowThreadState 1291 unsigned m_flowThreadState : 2; // FlowThreadState
1294 unsigned m_boxDecorationBackgroundState : 2; // BoxDecorationBackgroundS tate 1292 unsigned m_boxDecorationBackgroundState : 2; // BoxDecorationBackgroundS tate
1293 unsigned m_fullPaintInvalidationReason : 4; // InvalidationReason
1295 1294
1296 public: 1295 public:
1297 bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOf FlowPositioned; } 1296 bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOf FlowPositioned; }
1298 bool isRelPositioned() const { return m_positionedState == IsRelativelyP ositioned; } 1297 bool isRelPositioned() const { return m_positionedState == IsRelativelyP ositioned; }
1299 bool isPositioned() const { return m_positionedState != IsStaticallyPosi tioned; } 1298 bool isPositioned() const { return m_positionedState != IsStaticallyPosi tioned; }
1300 1299
1301 void setPositionedState(int positionState) 1300 void setPositionedState(int positionState)
1302 { 1301 {
1303 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowP ositioned, saving one bit. 1302 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowP ositioned, saving one bit.
1304 m_positionedState = static_cast<PositionedState>(positionState & 0x3 ); 1303 m_positionedState = static_cast<PositionedState>(positionState & 0x3 );
1305 } 1304 }
1306 void clearPositionedState() { m_positionedState = StaticPosition; } 1305 void clearPositionedState() { m_positionedState = StaticPosition; }
1307 1306
1308 ALWAYS_INLINE SelectionState selectionState() const { return static_cast <SelectionState>(m_selectionState); } 1307 ALWAYS_INLINE SelectionState selectionState() const { return static_cast <SelectionState>(m_selectionState); }
1309 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_ selectionState = selectionState; } 1308 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_ selectionState = selectionState; }
1310 1309
1311 ALWAYS_INLINE FlowThreadState flowThreadState() const { return static_ca st<FlowThreadState>(m_flowThreadState); } 1310 ALWAYS_INLINE FlowThreadState flowThreadState() const { return static_ca st<FlowThreadState>(m_flowThreadState); }
1312 ALWAYS_INLINE void setFlowThreadState(FlowThreadState flowThreadState) { m_flowThreadState = flowThreadState; } 1311 ALWAYS_INLINE void setFlowThreadState(FlowThreadState flowThreadState) { m_flowThreadState = flowThreadState; }
1313 1312
1314 ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState( ) const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgr oundState); } 1313 ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState( ) const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgr oundState); }
1315 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou ndState s) { m_boxDecorationBackgroundState = s; } 1314 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou ndState s) { m_boxDecorationBackgroundState = s; }
1315
1316 InvalidationReason fullPaintInvalidationReason() const { return static_c ast<InvalidationReason>(m_fullPaintInvalidationReason); }
1317 void setFullPaintInvalidationReason(InvalidationReason reason)
1318 {
1319 ASSERT(reason != InvalidationIncremental);
1320 m_fullPaintInvalidationReason = reason;
1321 }
1316 }; 1322 };
1317 1323
1318 #undef ADD_BOOLEAN_BITFIELD 1324 #undef ADD_BOOLEAN_BITFIELD
1319 1325
1320 RenderObjectBitfields m_bitfields; 1326 RenderObjectBitfields m_bitfields;
1321 1327
1322 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); } 1328 void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
1323 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); } 1329 void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPosition edMovementLayout(b); }
1324 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); } 1330 void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayo ut(b); }
1325 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); } 1331 void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 void showTree(const blink::RenderObject*); 1563 void showTree(const blink::RenderObject*);
1558 void showLineTree(const blink::RenderObject*); 1564 void showLineTree(const blink::RenderObject*);
1559 void showRenderTree(const blink::RenderObject* object1); 1565 void showRenderTree(const blink::RenderObject* object1);
1560 // We don't make object2 an optional parameter so that showRenderTree 1566 // We don't make object2 an optional parameter so that showRenderTree
1561 // can be called from gdb easily. 1567 // can be called from gdb easily.
1562 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2); 1568 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2);
1563 1569
1564 #endif 1570 #endif
1565 1571
1566 #endif // RenderObject_h 1572 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerModelObject.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698