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

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

Issue 2404213004: Implement incremental paint property tree rebuilding (Closed)
Patch Set: Fix bug in how svg local to border box was updated, no longer crash in tests Created 4 years, 1 month 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
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. 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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { 1716 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) {
1717 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); 1717 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p);
1718 } 1718 }
1719 void setPreviousBackgroundObscured(bool b) { 1719 void setPreviousBackgroundObscured(bool b) {
1720 m_layoutObject.setPreviousBackgroundObscured(b); 1720 m_layoutObject.setPreviousBackgroundObscured(b);
1721 } 1721 }
1722 void clearPreviousPaintInvalidationRects() { 1722 void clearPreviousPaintInvalidationRects() {
1723 m_layoutObject.clearPreviousPaintInvalidationRects(); 1723 m_layoutObject.clearPreviousPaintInvalidationRects();
1724 } 1724 }
1725 1725
1726 void setPaintPropertiesInvalid() {
1727 m_layoutObject.setPaintPropertiesInvalid();
1728 }
1729 void setPaintPropertiesValid() { m_layoutObject.setPaintPropertiesValid(); }
1730
1726 protected: 1731 protected:
1727 friend class PaintPropertyTreeBuilder; 1732 friend class PaintPropertyTreeBuilder;
1728 // The following two functions can be called from PaintPropertyTreeBuilder 1733 // The following two functions can be called from PaintPropertyTreeBuilder
1729 // only. 1734 // only.
1730 ObjectPaintProperties& ensurePaintProperties() { 1735 ObjectPaintProperties& ensurePaintProperties() {
1731 return m_layoutObject.ensurePaintProperties(); 1736 return m_layoutObject.ensurePaintProperties();
1732 } 1737 }
1733 ObjectPaintProperties* paintProperties() { 1738 ObjectPaintProperties* paintProperties() {
1734 return const_cast<ObjectPaintProperties*>( 1739 return const_cast<ObjectPaintProperties*>(
1735 m_layoutObject.paintProperties()); 1740 m_layoutObject.paintProperties());
1736 } 1741 }
1737 1742
1738 friend class LayoutObject; 1743 friend class LayoutObject;
1739 MutableForPainting(const LayoutObject& layoutObject) 1744 MutableForPainting(const LayoutObject& layoutObject)
1740 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} 1745 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {}
1741 1746
1742 LayoutObject& m_layoutObject; 1747 LayoutObject& m_layoutObject;
1743 }; 1748 };
1744 MutableForPainting getMutableForPainting() const { 1749 MutableForPainting getMutableForPainting() const {
1745 return MutableForPainting(*this); 1750 return MutableForPainting(*this);
1746 } 1751 }
1747 1752
1753 // Paint properties (see: |ObjectPaintProperties|) are built from the Object's
1754 // state (location, transform style, etc.) and need to be invalidated when
1755 // these values change (see: PaintPropertyTreeBuilder). Invalid paint
1756 // properties will be rebuilt during the next document lifecycle update.
1757 void setPaintPropertiesInvalid() {
1758 m_bitfields.setPaintPropertiesValid(false);
1759 }
1760 void setPaintPropertiesValid() {
1761 DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint);
1762 m_bitfields.setPaintPropertiesValid(true);
1763 }
1764 bool paintPropertiesValid() const {
1765 return m_bitfields.paintPropertiesValid();
1766 }
1767
1748 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1768 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
1749 1769
1750 // If unconditionally is true, you are responsible for ensuring that 1770 // If unconditionally is true, you are responsible for ensuring that
1751 // no ScrollAnchors reference this LayoutObject. 1771 // no ScrollAnchors reference this LayoutObject.
1752 void clearIsScrollAnchorObject(bool unconditionally = false); 1772 void clearIsScrollAnchorObject(bool unconditionally = false);
1753 1773
1754 bool scrollAnchorDisablingStyleChanged() { 1774 bool scrollAnchorDisablingStyleChanged() {
1755 return m_bitfields.scrollAnchorDisablingStyleChanged(); 1775 return m_bitfields.scrollAnchorDisablingStyleChanged();
1756 } 1776 }
1757 void setScrollAnchorDisablingStyleChanged(bool changed) { 1777 void setScrollAnchorDisablingStyleChanged(bool changed) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 m_notifiedOfSubtreeChange(false), 2133 m_notifiedOfSubtreeChange(false),
2114 m_consumesSubtreeChangeNotification(false), 2134 m_consumesSubtreeChangeNotification(false),
2115 m_childrenInline(false), 2135 m_childrenInline(false),
2116 m_containsInlineWithOutlineAndContinuation(false), 2136 m_containsInlineWithOutlineAndContinuation(false),
2117 m_alwaysCreateLineBoxesForLayoutInline(false), 2137 m_alwaysCreateLineBoxesForLayoutInline(false),
2118 m_previousBackgroundObscured(false), 2138 m_previousBackgroundObscured(false),
2119 m_isBackgroundAttachmentFixedObject(false), 2139 m_isBackgroundAttachmentFixedObject(false),
2120 m_isScrollAnchorObject(false), 2140 m_isScrollAnchorObject(false),
2121 m_scrollAnchorDisablingStyleChanged(false), 2141 m_scrollAnchorDisablingStyleChanged(false),
2122 m_hasBoxDecorationBackground(false), 2142 m_hasBoxDecorationBackground(false),
2143 m_paintPropertiesValid(false),
2123 m_positionedState(IsStaticallyPositioned), 2144 m_positionedState(IsStaticallyPositioned),
2124 m_selectionState(SelectionNone), 2145 m_selectionState(SelectionNone),
2125 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2146 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2126 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2147 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2127 2148
2128 // 32 bits have been used in the first word, and 18 in the second. 2149 // 32 bits have been used in the first word, and 19 in the second.
2129 2150
2130 // Self needs layout means that this layout object is marked for a full 2151 // Self needs layout means that this layout object is marked for a full
2131 // layout. This is the default layout but it is expensive as it recomputes 2152 // layout. This is the default layout but it is expensive as it recomputes
2132 // everything. For CSS boxes, this includes the width (laying out the line 2153 // everything. For CSS boxes, this includes the width (laying out the line
2133 // boxes again), the margins (due to block collapsing margins), the 2154 // boxes again), the margins (due to block collapsing margins), the
2134 // positions, the height and the potential overflow. 2155 // positions, the height and the potential overflow.
2135 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 2156 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
2136 2157
2137 // A positioned movement layout is a specialized type of layout used on 2158 // A positioned movement layout is a specialized type of layout used on
2138 // positioned objects that only visually moved. This layout is used when 2159 // positioned objects that only visually moved. This layout is used when
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 // layout should suppress any adjustments that would be made during the next 2300 // layout should suppress any adjustments that would be made during the next
2280 // layout by ScrollAnchor objects for which this LayoutObject is on the path 2301 // layout by ScrollAnchor objects for which this LayoutObject is on the path
2281 // from the anchor node to the scroller. 2302 // from the anchor node to the scroller.
2282 // See http://bit.ly/sanaclap for more info. 2303 // See http://bit.ly/sanaclap for more info.
2283 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, 2304 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged,
2284 ScrollAnchorDisablingStyleChanged); 2305 ScrollAnchorDisablingStyleChanged);
2285 2306
2286 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, 2307 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground,
2287 HasBoxDecorationBackground); 2308 HasBoxDecorationBackground);
2288 2309
2310 // Whether the object paint properties are up to date with the Object's
2311 // state (see: setPaintPropertiesInvalid and setPaintPropertiesValid).
2312 ADD_BOOLEAN_BITFIELD(paintPropertiesValid, PaintPropertiesValid)
2313
2289 private: 2314 private:
2290 // This is the cached 'position' value of this object 2315 // This is the cached 'position' value of this object
2291 // (see ComputedStyle::position). 2316 // (see ComputedStyle::position).
2292 unsigned m_positionedState : 2; // PositionedState 2317 unsigned m_positionedState : 2; // PositionedState
2293 unsigned m_selectionState : 3; // SelectionState 2318 unsigned m_selectionState : 3; // SelectionState
2294 // Mutable for getter which lazily update this field. 2319 // Mutable for getter which lazily update this field.
2295 mutable unsigned 2320 mutable unsigned
2296 m_backgroundObscurationState : 2; // BackgroundObscurationState 2321 m_backgroundObscurationState : 2; // BackgroundObscurationState
2297 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2322 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
2298 2323
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2622 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2598 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2623 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2599 // We don't make object2 an optional parameter so that showLayoutTree 2624 // We don't make object2 an optional parameter so that showLayoutTree
2600 // can be called from gdb easily. 2625 // can be called from gdb easily.
2601 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2626 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2602 const blink::LayoutObject* object2); 2627 const blink::LayoutObject* object2);
2603 2628
2604 #endif 2629 #endif
2605 2630
2606 #endif // LayoutObject_h 2631 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698