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