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

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

Issue 2404213004: Implement incremental paint property tree rebuilding (Closed)
Patch Set: Cleanup needsUpdate finder construction, tighten reasons for updating a property subtree, misc clea… 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { 1711 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) {
1712 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); 1712 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p);
1713 } 1713 }
1714 void setPreviousBackgroundObscured(bool b) { 1714 void setPreviousBackgroundObscured(bool b) {
1715 m_layoutObject.setPreviousBackgroundObscured(b); 1715 m_layoutObject.setPreviousBackgroundObscured(b);
1716 } 1716 }
1717 void clearPreviousPaintInvalidationRects() { 1717 void clearPreviousPaintInvalidationRects() {
1718 m_layoutObject.clearPreviousPaintInvalidationRects(); 1718 m_layoutObject.clearPreviousPaintInvalidationRects();
1719 } 1719 }
1720 1720
1721 void setNeedsPaintPropertyUpdate() {
1722 m_layoutObject.setNeedsPaintPropertyUpdate();
1723 }
1724 void clearNeedsPaintPropertyUpdate() {
1725 m_layoutObject.clearNeedsPaintPropertyUpdate();
1726 }
1727
1721 protected: 1728 protected:
1722 friend class PaintPropertyTreeBuilder; 1729 friend class PaintPropertyTreeBuilder;
1723 // The following two functions can be called from PaintPropertyTreeBuilder 1730 // The following two functions can be called from PaintPropertyTreeBuilder
1724 // only. 1731 // only.
1725 ObjectPaintProperties& ensurePaintProperties() { 1732 ObjectPaintProperties& ensurePaintProperties() {
1726 return m_layoutObject.ensurePaintProperties(); 1733 return m_layoutObject.ensurePaintProperties();
1727 } 1734 }
1728 ObjectPaintProperties* paintProperties() { 1735 ObjectPaintProperties* paintProperties() {
1729 return const_cast<ObjectPaintProperties*>( 1736 return const_cast<ObjectPaintProperties*>(
1730 m_layoutObject.paintProperties()); 1737 m_layoutObject.paintProperties());
1731 } 1738 }
1732 1739
1733 friend class LayoutObject; 1740 friend class LayoutObject;
1734 MutableForPainting(const LayoutObject& layoutObject) 1741 MutableForPainting(const LayoutObject& layoutObject)
1735 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} 1742 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {}
1736 1743
1737 LayoutObject& m_layoutObject; 1744 LayoutObject& m_layoutObject;
1738 }; 1745 };
1739 MutableForPainting getMutableForPainting() const { 1746 MutableForPainting getMutableForPainting() const {
1740 return MutableForPainting(*this); 1747 return MutableForPainting(*this);
1741 } 1748 }
1742 1749
1750 // Paint properties (see: |ObjectPaintProperties|) are built from an object's
1751 // state (location, transform, etc) as well as properties from ancestors.
1752 // When these inputs change, setNeedsPaintPropertyUpdate will cause a property
1753 // tree update during the next document lifecycle update.
1754 // TODO(pdr): Add additional granularity such as the ability to signal that
1755 // only a local paint property update is needed.
1756 void setNeedsPaintPropertyUpdate() {
1757 m_bitfields.setNeedsPaintPropertyUpdate(true);
1758 }
1759 void clearNeedsPaintPropertyUpdate() {
1760 DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint);
1761 m_bitfields.setNeedsPaintPropertyUpdate(false);
1762 }
1763 bool needsPaintPropertyUpdate() const {
1764 return m_bitfields.needsPaintPropertyUpdate();
1765 }
1766
1743 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1767 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
1744 1768
1745 // If unconditionally is true, you are responsible for ensuring that 1769 // If unconditionally is true, you are responsible for ensuring that
1746 // no ScrollAnchors reference this LayoutObject. 1770 // no ScrollAnchors reference this LayoutObject.
1747 void clearIsScrollAnchorObject(bool unconditionally = false); 1771 void clearIsScrollAnchorObject(bool unconditionally = false);
1748 1772
1749 bool scrollAnchorDisablingStyleChanged() { 1773 bool scrollAnchorDisablingStyleChanged() {
1750 return m_bitfields.scrollAnchorDisablingStyleChanged(); 1774 return m_bitfields.scrollAnchorDisablingStyleChanged();
1751 } 1775 }
1752 void setScrollAnchorDisablingStyleChanged(bool changed) { 1776 void setScrollAnchorDisablingStyleChanged(bool changed) {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 m_notifiedOfSubtreeChange(false), 2136 m_notifiedOfSubtreeChange(false),
2113 m_consumesSubtreeChangeNotification(false), 2137 m_consumesSubtreeChangeNotification(false),
2114 m_childrenInline(false), 2138 m_childrenInline(false),
2115 m_containsInlineWithOutlineAndContinuation(false), 2139 m_containsInlineWithOutlineAndContinuation(false),
2116 m_alwaysCreateLineBoxesForLayoutInline(false), 2140 m_alwaysCreateLineBoxesForLayoutInline(false),
2117 m_previousBackgroundObscured(false), 2141 m_previousBackgroundObscured(false),
2118 m_isBackgroundAttachmentFixedObject(false), 2142 m_isBackgroundAttachmentFixedObject(false),
2119 m_isScrollAnchorObject(false), 2143 m_isScrollAnchorObject(false),
2120 m_scrollAnchorDisablingStyleChanged(false), 2144 m_scrollAnchorDisablingStyleChanged(false),
2121 m_hasBoxDecorationBackground(false), 2145 m_hasBoxDecorationBackground(false),
2146 m_needsPaintPropertyUpdate(true),
2122 m_positionedState(IsStaticallyPositioned), 2147 m_positionedState(IsStaticallyPositioned),
2123 m_selectionState(SelectionNone), 2148 m_selectionState(SelectionNone),
2124 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2149 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2125 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2150 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2126 2151
2127 // 32 bits have been used in the first word, and 19 in the second. 2152 // 32 bits have been used in the first word, and 19 in the second.
2128 2153
2129 // Self needs layout means that this layout object is marked for a full 2154 // Self needs layout means that this layout object is marked for a full
2130 // layout. This is the default layout but it is expensive as it recomputes 2155 // layout. This is the default layout but it is expensive as it recomputes
2131 // everything. For CSS boxes, this includes the width (laying out the line 2156 // everything. For CSS boxes, this includes the width (laying out the line
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 // layout should suppress any adjustments that would be made during the next 2301 // layout should suppress any adjustments that would be made during the next
2277 // layout by ScrollAnchor objects for which this LayoutObject is on the path 2302 // layout by ScrollAnchor objects for which this LayoutObject is on the path
2278 // from the anchor node to the scroller. 2303 // from the anchor node to the scroller.
2279 // See http://bit.ly/sanaclap for more info. 2304 // See http://bit.ly/sanaclap for more info.
2280 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, 2305 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged,
2281 ScrollAnchorDisablingStyleChanged); 2306 ScrollAnchorDisablingStyleChanged);
2282 2307
2283 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, 2308 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground,
2284 HasBoxDecorationBackground); 2309 HasBoxDecorationBackground);
2285 2310
2311 // Whether the paint properties need to be updated. For more details, see
2312 // LayoutObject::needsPaintPropertyUpdate().
2313 ADD_BOOLEAN_BITFIELD(needsPaintPropertyUpdate, NeedsPaintPropertyUpdate);
2314
2286 private: 2315 private:
2287 // This is the cached 'position' value of this object 2316 // This is the cached 'position' value of this object
2288 // (see ComputedStyle::position). 2317 // (see ComputedStyle::position).
2289 unsigned m_positionedState : 2; // PositionedState 2318 unsigned m_positionedState : 2; // PositionedState
2290 unsigned m_selectionState : 3; // SelectionState 2319 unsigned m_selectionState : 3; // SelectionState
2291 // Mutable for getter which lazily update this field. 2320 // Mutable for getter which lazily update this field.
2292 mutable unsigned 2321 mutable unsigned
2293 m_backgroundObscurationState : 2; // BackgroundObscurationState 2322 m_backgroundObscurationState : 2; // BackgroundObscurationState
2294 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2323 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
2295 2324
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2623 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2595 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2624 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2596 // We don't make object2 an optional parameter so that showLayoutTree 2625 // We don't make object2 an optional parameter so that showLayoutTree
2597 // can be called from gdb easily. 2626 // can be called from gdb easily.
2598 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2627 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2599 const blink::LayoutObject* object2); 2628 const blink::LayoutObject* object2);
2600 2629
2601 #endif 2630 #endif
2602 2631
2603 #endif // LayoutObject_h 2632 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698