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. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 // debugging output | 1650 // debugging output |
1651 virtual LayoutRect debugRect() const; | 1651 virtual LayoutRect debugRect() const; |
1652 | 1652 |
1653 // Painters can use const methods only, except for these explicitly declared | 1653 // Painters can use const methods only, except for these explicitly declared |
1654 // methods. | 1654 // methods. |
1655 class MutableForPainting { | 1655 class MutableForPainting { |
1656 public: | 1656 public: |
1657 // Convenience mutator that clears paint invalidation flags and this object | 1657 // Convenience mutator that clears paint invalidation flags and this object |
1658 // and its descendants' needs-paint-property-update flags. | 1658 // and its descendants' needs-paint-property-update flags. |
1659 void clearPaintFlags() { | 1659 void clearPaintFlags() { |
| 1660 DCHECK_EQ(m_layoutObject.document().lifecycle().state(), |
| 1661 DocumentLifecycle::InPrePaint); |
1660 m_layoutObject.clearPaintInvalidationFlags(); | 1662 m_layoutObject.clearPaintInvalidationFlags(); |
1661 m_layoutObject.clearNeedsPaintPropertyUpdate(); | 1663 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(false); |
1662 m_layoutObject.clearDescendantNeedsPaintPropertyUpdate(); | 1664 m_layoutObject.m_bitfields.setSubtreeNeedsPaintPropertyUpdate(false); |
| 1665 m_layoutObject.m_bitfields.setDescendantNeedsPaintPropertyUpdate(false); |
1663 } | 1666 } |
1664 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { | 1667 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { |
1665 m_layoutObject.setShouldDoFullPaintInvalidation(reason); | 1668 m_layoutObject.setShouldDoFullPaintInvalidation(reason); |
1666 } | 1669 } |
1667 void setBackgroundChangedSinceLastPaintInvalidation() { | 1670 void setBackgroundChangedSinceLastPaintInvalidation() { |
1668 m_layoutObject.setBackgroundChangedSinceLastPaintInvalidation(); | 1671 m_layoutObject.setBackgroundChangedSinceLastPaintInvalidation(); |
1669 } | 1672 } |
1670 void ensureIsReadyForPaintInvalidation() { | 1673 void ensureIsReadyForPaintInvalidation() { |
1671 m_layoutObject.ensureIsReadyForPaintInvalidation(); | 1674 m_layoutObject.ensureIsReadyForPaintInvalidation(); |
1672 } | 1675 } |
(...skipping 16 matching lines...) Expand all Loading... |
1689 } | 1692 } |
1690 void setPreviousBackgroundObscured(bool b) { | 1693 void setPreviousBackgroundObscured(bool b) { |
1691 m_layoutObject.setPreviousBackgroundObscured(b); | 1694 m_layoutObject.setPreviousBackgroundObscured(b); |
1692 } | 1695 } |
1693 void clearPreviousVisualRects() { | 1696 void clearPreviousVisualRects() { |
1694 m_layoutObject.clearPreviousVisualRects(); | 1697 m_layoutObject.clearPreviousVisualRects(); |
1695 } | 1698 } |
1696 void setNeedsPaintPropertyUpdate() { | 1699 void setNeedsPaintPropertyUpdate() { |
1697 m_layoutObject.setNeedsPaintPropertyUpdate(); | 1700 m_layoutObject.setNeedsPaintPropertyUpdate(); |
1698 } | 1701 } |
| 1702 #if DCHECK_IS_ON() |
| 1703 // Same as setNeedsPaintPropertyUpdate() but does not mark ancestors as |
| 1704 // having a descendant needing a paint property update. |
| 1705 void setOnlyThisNeedsPaintPropertyUpdateForTesting() { |
| 1706 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(true); |
| 1707 } |
| 1708 void clearNeedsPaintPropertyUpdateForTesting() { |
| 1709 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(false); |
| 1710 } |
| 1711 #endif |
1699 | 1712 |
1700 protected: | 1713 protected: |
1701 friend class PaintPropertyTreeBuilder; | 1714 friend class PaintPropertyTreeBuilder; |
1702 // The following two functions can be called from PaintPropertyTreeBuilder | 1715 // The following two functions can be called from PaintPropertyTreeBuilder |
1703 // only. | 1716 // only. |
1704 ObjectPaintProperties& ensurePaintProperties() { | 1717 ObjectPaintProperties& ensurePaintProperties() { |
1705 return m_layoutObject.ensurePaintProperties(); | 1718 return m_layoutObject.ensurePaintProperties(); |
1706 } | 1719 } |
1707 ObjectPaintProperties* paintProperties() { | 1720 ObjectPaintProperties* paintProperties() { |
1708 return const_cast<ObjectPaintProperties*>( | 1721 return const_cast<ObjectPaintProperties*>( |
(...skipping 12 matching lines...) Expand all Loading... |
1721 | 1734 |
1722 // Paint properties (see: |ObjectPaintProperties|) are built from an object's | 1735 // Paint properties (see: |ObjectPaintProperties|) are built from an object's |
1723 // state (location, transform, etc) as well as properties from ancestors. | 1736 // state (location, transform, etc) as well as properties from ancestors. |
1724 // When these inputs change, setNeedsPaintPropertyUpdate will cause a property | 1737 // When these inputs change, setNeedsPaintPropertyUpdate will cause a property |
1725 // tree update during the next document lifecycle update. | 1738 // tree update during the next document lifecycle update. |
1726 // | 1739 // |
1727 // In addition to tracking if an object needs its own paint properties | 1740 // In addition to tracking if an object needs its own paint properties |
1728 // updated, setNeedsPaintPropertyUpdate marks all ancestors as having a | 1741 // updated, setNeedsPaintPropertyUpdate marks all ancestors as having a |
1729 // descendant needing a paint property update too. | 1742 // descendant needing a paint property update too. |
1730 void setNeedsPaintPropertyUpdate(); | 1743 void setNeedsPaintPropertyUpdate(); |
1731 #if DCHECK_IS_ON() | |
1732 // Same as setNeedsPaintPropertyUpdate() but does not mark ancestors as | |
1733 // having a descendant needing a paint property update. | |
1734 void setOnlyThisNeedsPaintPropertyUpdateForTesting() { | |
1735 m_bitfields.setNeedsPaintPropertyUpdate(true); | |
1736 } | |
1737 #endif | |
1738 bool needsPaintPropertyUpdate() const { | 1744 bool needsPaintPropertyUpdate() const { |
1739 return m_bitfields.needsPaintPropertyUpdate(); | 1745 return m_bitfields.needsPaintPropertyUpdate(); |
1740 } | 1746 } |
1741 void clearNeedsPaintPropertyUpdate() { | 1747 void setSubtreeNeedsPaintPropertyUpdate() { |
1742 DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint); | 1748 m_bitfields.setSubtreeNeedsPaintPropertyUpdate(true); |
1743 m_bitfields.setNeedsPaintPropertyUpdate(false); | 1749 m_bitfields.setNeedsPaintPropertyUpdate(true); |
| 1750 } |
| 1751 bool subtreeNeedsPaintPropertyUpdate() const { |
| 1752 return m_bitfields.subtreeNeedsPaintPropertyUpdate(); |
1744 } | 1753 } |
1745 bool descendantNeedsPaintPropertyUpdate() const { | 1754 bool descendantNeedsPaintPropertyUpdate() const { |
1746 return m_bitfields.descendantNeedsPaintPropertyUpdate(); | 1755 return m_bitfields.descendantNeedsPaintPropertyUpdate(); |
1747 } | 1756 } |
1748 void clearDescendantNeedsPaintPropertyUpdate() { | |
1749 DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint); | |
1750 m_bitfields.setDescendantNeedsPaintPropertyUpdate(false); | |
1751 } | |
1752 // Main thread scrolling reasons require fully updating paint propeties of all | 1757 // Main thread scrolling reasons require fully updating paint propeties of all |
1753 // ancestors (see: ScrollPaintPropertyNode.h). | 1758 // ancestors (see: ScrollPaintPropertyNode.h). |
1754 void setAncestorsNeedPaintPropertyUpdateForMainThreadScrolling(); | 1759 void setAncestorsNeedPaintPropertyUpdateForMainThreadScrolling(); |
1755 | 1760 |
1756 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } | 1761 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } |
1757 // Clears the IsScrollAnchorObject bit if and only if no ScrollAnchors still | 1762 // Clears the IsScrollAnchorObject bit if and only if no ScrollAnchors still |
1758 // reference this LayoutObject. | 1763 // reference this LayoutObject. |
1759 void maybeClearIsScrollAnchorObject(); | 1764 void maybeClearIsScrollAnchorObject(); |
1760 | 1765 |
1761 bool scrollAnchorDisablingStyleChanged() { | 1766 bool scrollAnchorDisablingStyleChanged() { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 m_alwaysCreateLineBoxesForLayoutInline(false), | 2147 m_alwaysCreateLineBoxesForLayoutInline(false), |
2143 m_previousBackgroundObscured(false), | 2148 m_previousBackgroundObscured(false), |
2144 m_isBackgroundAttachmentFixedObject(false), | 2149 m_isBackgroundAttachmentFixedObject(false), |
2145 m_isScrollAnchorObject(false), | 2150 m_isScrollAnchorObject(false), |
2146 m_scrollAnchorDisablingStyleChanged(false), | 2151 m_scrollAnchorDisablingStyleChanged(false), |
2147 m_hasBoxDecorationBackground(false), | 2152 m_hasBoxDecorationBackground(false), |
2148 m_hasPreviousLocationInBacking(false), | 2153 m_hasPreviousLocationInBacking(false), |
2149 m_hasPreviousSelectionVisualRect(false), | 2154 m_hasPreviousSelectionVisualRect(false), |
2150 m_hasPreviousBoxGeometries(false), | 2155 m_hasPreviousBoxGeometries(false), |
2151 m_needsPaintPropertyUpdate(true), | 2156 m_needsPaintPropertyUpdate(true), |
| 2157 m_subtreeNeedsPaintPropertyUpdate(true), |
2152 m_descendantNeedsPaintPropertyUpdate(true), | 2158 m_descendantNeedsPaintPropertyUpdate(true), |
2153 m_backgroundChangedSinceLastPaintInvalidation(false), | 2159 m_backgroundChangedSinceLastPaintInvalidation(false), |
2154 m_positionedState(IsStaticallyPositioned), | 2160 m_positionedState(IsStaticallyPositioned), |
2155 m_selectionState(SelectionNone), | 2161 m_selectionState(SelectionNone), |
2156 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), | 2162 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), |
2157 m_fullPaintInvalidationReason(PaintInvalidationNone) {} | 2163 m_fullPaintInvalidationReason(PaintInvalidationNone) {} |
2158 | 2164 |
2159 // Self needs layout means that this layout object is marked for a full | 2165 // Self needs layout means that this layout object is marked for a full |
2160 // layout. This is the default layout but it is expensive as it recomputes | 2166 // layout. This is the default layout but it is expensive as it recomputes |
2161 // everything. For CSS boxes, this includes the width (laying out the line | 2167 // everything. For CSS boxes, this includes the width (laying out the line |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 | 2321 |
2316 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking, | 2322 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking, |
2317 HasPreviousLocationInBacking); | 2323 HasPreviousLocationInBacking); |
2318 ADD_BOOLEAN_BITFIELD(hasPreviousSelectionVisualRect, | 2324 ADD_BOOLEAN_BITFIELD(hasPreviousSelectionVisualRect, |
2319 HasPreviousSelectionVisualRect); | 2325 HasPreviousSelectionVisualRect); |
2320 ADD_BOOLEAN_BITFIELD(hasPreviousBoxGeometries, HasPreviousBoxGeometries); | 2326 ADD_BOOLEAN_BITFIELD(hasPreviousBoxGeometries, HasPreviousBoxGeometries); |
2321 | 2327 |
2322 // Whether the paint properties need to be updated. For more details, see | 2328 // Whether the paint properties need to be updated. For more details, see |
2323 // LayoutObject::needsPaintPropertyUpdate(). | 2329 // LayoutObject::needsPaintPropertyUpdate(). |
2324 ADD_BOOLEAN_BITFIELD(needsPaintPropertyUpdate, NeedsPaintPropertyUpdate); | 2330 ADD_BOOLEAN_BITFIELD(needsPaintPropertyUpdate, NeedsPaintPropertyUpdate); |
| 2331 // Whether paint properties of the whole subtree need to be updated. |
| 2332 ADD_BOOLEAN_BITFIELD(subtreeNeedsPaintPropertyUpdate, |
| 2333 SubtreeNeedsPaintPropertyUpdate) |
2325 // Whether the paint properties of a descendant need to be updated. For more | 2334 // Whether the paint properties of a descendant need to be updated. For more |
2326 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate(). | 2335 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate(). |
2327 ADD_BOOLEAN_BITFIELD(descendantNeedsPaintPropertyUpdate, | 2336 ADD_BOOLEAN_BITFIELD(descendantNeedsPaintPropertyUpdate, |
2328 DescendantNeedsPaintPropertyUpdate); | 2337 DescendantNeedsPaintPropertyUpdate); |
2329 | 2338 |
2330 ADD_BOOLEAN_BITFIELD(backgroundChangedSinceLastPaintInvalidation, | 2339 ADD_BOOLEAN_BITFIELD(backgroundChangedSinceLastPaintInvalidation, |
2331 BackgroundChangedSinceLastPaintInvalidation); | 2340 BackgroundChangedSinceLastPaintInvalidation); |
2332 | 2341 |
2333 protected: | 2342 protected: |
2334 // Use protected to avoid warning about unused variable. | 2343 // Use protected to avoid warning about unused variable. |
2335 unsigned m_unusedBits : 7; | 2344 unsigned m_unusedBits : 6; |
2336 | 2345 |
2337 private: | 2346 private: |
2338 // This is the cached 'position' value of this object | 2347 // This is the cached 'position' value of this object |
2339 // (see ComputedStyle::position). | 2348 // (see ComputedStyle::position). |
2340 unsigned m_positionedState : 2; // PositionedState | 2349 unsigned m_positionedState : 2; // PositionedState |
2341 unsigned m_selectionState : 3; // SelectionState | 2350 unsigned m_selectionState : 3; // SelectionState |
2342 // Mutable for getter which lazily update this field. | 2351 // Mutable for getter which lazily update this field. |
2343 mutable unsigned | 2352 mutable unsigned |
2344 m_backgroundObscurationState : 2; // BackgroundObscurationState | 2353 m_backgroundObscurationState : 2; // BackgroundObscurationState |
2345 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason | 2354 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2665 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
2657 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2666 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
2658 // We don't make object2 an optional parameter so that showLayoutTree | 2667 // We don't make object2 an optional parameter so that showLayoutTree |
2659 // can be called from gdb easily. | 2668 // can be called from gdb easily. |
2660 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2669 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
2661 const blink::LayoutObject* object2); | 2670 const blink::LayoutObject* object2); |
2662 | 2671 |
2663 #endif | 2672 #endif |
2664 | 2673 |
2665 #endif // LayoutObject_h | 2674 #endif // LayoutObject_h |
OLD | NEW |