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

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

Issue 2495893002: Implement incremental paint property tree rebuilding (Closed)
Patch Set: Suppress main thread scrolling invalidation failures 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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1695 }
1696 void setHasPreviousBoxGeometries(bool b) { 1696 void setHasPreviousBoxGeometries(bool b) {
1697 m_layoutObject.m_bitfields.setHasPreviousBoxGeometries(b); 1697 m_layoutObject.m_bitfields.setHasPreviousBoxGeometries(b);
1698 } 1698 }
1699 void setPreviousBackgroundObscured(bool b) { 1699 void setPreviousBackgroundObscured(bool b) {
1700 m_layoutObject.setPreviousBackgroundObscured(b); 1700 m_layoutObject.setPreviousBackgroundObscured(b);
1701 } 1701 }
1702 void clearPreviousVisualRects() { 1702 void clearPreviousVisualRects() {
1703 m_layoutObject.clearPreviousVisualRects(); 1703 m_layoutObject.clearPreviousVisualRects();
1704 } 1704 }
1705 void setNeedsPaintPropertyUpdate() {
1706 m_layoutObject.setNeedsPaintPropertyUpdate();
1707 }
1708 void clearNeedsPaintPropertyUpdate() {
1709 m_layoutObject.clearNeedsPaintPropertyUpdate();
1710 }
1711
1705 protected: 1712 protected:
1706 friend class PaintPropertyTreeBuilder; 1713 friend class PaintPropertyTreeBuilder;
1707 // The following two functions can be called from PaintPropertyTreeBuilder 1714 // The following two functions can be called from PaintPropertyTreeBuilder
1708 // only. 1715 // only.
1709 ObjectPaintProperties& ensurePaintProperties() { 1716 ObjectPaintProperties& ensurePaintProperties() {
1710 return m_layoutObject.ensurePaintProperties(); 1717 return m_layoutObject.ensurePaintProperties();
1711 } 1718 }
1712 ObjectPaintProperties* paintProperties() { 1719 ObjectPaintProperties* paintProperties() {
1713 return const_cast<ObjectPaintProperties*>( 1720 return const_cast<ObjectPaintProperties*>(
1714 m_layoutObject.paintProperties()); 1721 m_layoutObject.paintProperties());
1715 } 1722 }
1716 1723
1717 friend class LayoutObject; 1724 friend class LayoutObject;
1718 MutableForPainting(const LayoutObject& layoutObject) 1725 MutableForPainting(const LayoutObject& layoutObject)
1719 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} 1726 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {}
1720 1727
1721 LayoutObject& m_layoutObject; 1728 LayoutObject& m_layoutObject;
1722 }; 1729 };
1723 MutableForPainting getMutableForPainting() const { 1730 MutableForPainting getMutableForPainting() const {
1724 return MutableForPainting(*this); 1731 return MutableForPainting(*this);
1725 } 1732 }
1726 1733
1734 // Paint properties (see: |ObjectPaintProperties|) are built from an object's
1735 // state (location, transform, etc) as well as properties from ancestors.
1736 // When these inputs change, setNeedsPaintPropertyUpdate will cause a property
1737 // tree update during the next document lifecycle update.
1738 // TODO(pdr): Add additional granularity such as the ability to signal that
1739 // only a local paint property update is needed.
1740 void setNeedsPaintPropertyUpdate() {
1741 m_bitfields.setNeedsPaintPropertyUpdate(true);
1742 }
1743 void clearNeedsPaintPropertyUpdate() {
1744 DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint);
1745 m_bitfields.setNeedsPaintPropertyUpdate(false);
1746 }
1747 bool needsPaintPropertyUpdate() const {
1748 return m_bitfields.needsPaintPropertyUpdate();
1749 }
1750
1727 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1751 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
1728 // Clears the IsScrollAnchorObject bit if and only if no ScrollAnchors still 1752 // Clears the IsScrollAnchorObject bit if and only if no ScrollAnchors still
1729 // reference this LayoutObject. 1753 // reference this LayoutObject.
1730 void maybeClearIsScrollAnchorObject(); 1754 void maybeClearIsScrollAnchorObject();
1731 1755
1732 bool scrollAnchorDisablingStyleChanged() { 1756 bool scrollAnchorDisablingStyleChanged() {
1733 return m_bitfields.scrollAnchorDisablingStyleChanged(); 1757 return m_bitfields.scrollAnchorDisablingStyleChanged();
1734 } 1758 }
1735 void setScrollAnchorDisablingStyleChanged(bool changed) { 1759 void setScrollAnchorDisablingStyleChanged(bool changed) {
1736 m_bitfields.setScrollAnchorDisablingStyleChanged(changed); 1760 m_bitfields.setScrollAnchorDisablingStyleChanged(changed);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 m_containsInlineWithOutlineAndContinuation(false), 2127 m_containsInlineWithOutlineAndContinuation(false),
2104 m_alwaysCreateLineBoxesForLayoutInline(false), 2128 m_alwaysCreateLineBoxesForLayoutInline(false),
2105 m_previousBackgroundObscured(false), 2129 m_previousBackgroundObscured(false),
2106 m_isBackgroundAttachmentFixedObject(false), 2130 m_isBackgroundAttachmentFixedObject(false),
2107 m_isScrollAnchorObject(false), 2131 m_isScrollAnchorObject(false),
2108 m_scrollAnchorDisablingStyleChanged(false), 2132 m_scrollAnchorDisablingStyleChanged(false),
2109 m_hasBoxDecorationBackground(false), 2133 m_hasBoxDecorationBackground(false),
2110 m_hasPreviousLocationInBacking(false), 2134 m_hasPreviousLocationInBacking(false),
2111 m_hasPreviousSelectionVisualRect(false), 2135 m_hasPreviousSelectionVisualRect(false),
2112 m_hasPreviousBoxGeometries(false), 2136 m_hasPreviousBoxGeometries(false),
2137 m_needsPaintPropertyUpdate(true),
2113 m_positionedState(IsStaticallyPositioned), 2138 m_positionedState(IsStaticallyPositioned),
2114 m_selectionState(SelectionNone), 2139 m_selectionState(SelectionNone),
2115 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2140 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2116 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2141 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2117 2142
2118 // Self needs layout means that this layout object is marked for a full 2143 // Self needs layout means that this layout object is marked for a full
2119 // layout. This is the default layout but it is expensive as it recomputes 2144 // layout. This is the default layout but it is expensive as it recomputes
2120 // everything. For CSS boxes, this includes the width (laying out the line 2145 // everything. For CSS boxes, this includes the width (laying out the line
2121 // boxes again), the margins (due to block collapsing margins), the 2146 // boxes again), the margins (due to block collapsing margins), the
2122 // positions, the height and the potential overflow. 2147 // positions, the height and the potential overflow.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 2296
2272 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, 2297 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground,
2273 HasBoxDecorationBackground); 2298 HasBoxDecorationBackground);
2274 2299
2275 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking, 2300 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking,
2276 HasPreviousLocationInBacking); 2301 HasPreviousLocationInBacking);
2277 ADD_BOOLEAN_BITFIELD(hasPreviousSelectionVisualRect, 2302 ADD_BOOLEAN_BITFIELD(hasPreviousSelectionVisualRect,
2278 HasPreviousSelectionVisualRect); 2303 HasPreviousSelectionVisualRect);
2279 ADD_BOOLEAN_BITFIELD(hasPreviousBoxGeometries, HasPreviousBoxGeometries); 2304 ADD_BOOLEAN_BITFIELD(hasPreviousBoxGeometries, HasPreviousBoxGeometries);
2280 2305
2306 // Whether the paint properties need to be updated. For more details, see
2307 // LayoutObject::needsPaintPropertyUpdate().
2308 ADD_BOOLEAN_BITFIELD(needsPaintPropertyUpdate, NeedsPaintPropertyUpdate);
2309
2281 protected: 2310 protected:
2282 // Use protected to avoid warning about unused variable. 2311 // Use protected to avoid warning about unused variable.
2283 unsigned m_unusedBits : 10; 2312 unsigned m_unusedBits : 9;
2284 2313
2285 private: 2314 private:
2286 // This is the cached 'position' value of this object 2315 // This is the cached 'position' value of this object
2287 // (see ComputedStyle::position). 2316 // (see ComputedStyle::position).
2288 unsigned m_positionedState : 2; // PositionedState 2317 unsigned m_positionedState : 2; // PositionedState
2289 unsigned m_selectionState : 3; // SelectionState 2318 unsigned m_selectionState : 3; // SelectionState
2290 // Mutable for getter which lazily update this field. 2319 // Mutable for getter which lazily update this field.
2291 mutable unsigned 2320 mutable unsigned
2292 m_backgroundObscurationState : 2; // BackgroundObscurationState 2321 m_backgroundObscurationState : 2; // BackgroundObscurationState
2293 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2322 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2627 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2599 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2628 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2600 // We don't make object2 an optional parameter so that showLayoutTree 2629 // We don't make object2 an optional parameter so that showLayoutTree
2601 // can be called from gdb easily. 2630 // can be called from gdb easily.
2602 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2631 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2603 const blink::LayoutObject* object2); 2632 const blink::LayoutObject* object2);
2604 2633
2605 #endif 2634 #endif
2606 2635
2607 #endif // LayoutObject_h 2636 #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