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

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

Issue 2211283003: Revert of Replace LayoutObject::skipInvalidationWhenLaidOutChildren() with painted... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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. 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 void assertSubtreeClearedPaintInvalidationFlags() const 349 void assertSubtreeClearedPaintInvalidationFlags() const
350 { 350 {
351 for (const LayoutObject* layoutObject = this; layoutObject; layoutObject = layoutObject->nextInPreOrder()) 351 for (const LayoutObject* layoutObject = this; layoutObject; layoutObject = layoutObject->nextInPreOrder())
352 layoutObject->assertClearedPaintInvalidationFlags(); 352 layoutObject->assertClearedPaintInvalidationFlags();
353 } 353 }
354 354
355 #endif 355 #endif
356 356
357 // Correct version of !layoutObjectHasNoBoxEffectObsolete().
358 bool hasBoxEffect() const
359 {
360 return hasBoxDecorationBackground() || style()->hasVisualOverflowingEffe ct();
361 }
362
357 // LayoutObject tree manipulation 363 // LayoutObject tree manipulation
358 ////////////////////////////////////////// 364 //////////////////////////////////////////
359 virtual bool canHaveChildren() const { return virtualChildren(); } 365 virtual bool canHaveChildren() const { return virtualChildren(); }
360 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const { ret urn true; } 366 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const { ret urn true; }
361 367
362 // This function is called whenever a child is inserted under |this|. 368 // This function is called whenever a child is inserted under |this|.
363 // 369 //
364 // The main purpose of this function is to generate a consistent layout 370 // The main purpose of this function is to generate a consistent layout
365 // tree, which means generating the missing anonymous objects. Most of the 371 // tree, which means generating the missing anonymous objects. Most of the
366 // time there'll be no anonymous objects to generate. 372 // time there'll be no anonymous objects to generate.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag ; } 437 void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag ; }
432 #endif 438 #endif
433 439
434 void addAbsoluteRectForLayer(IntRect& result); 440 void addAbsoluteRectForLayer(IntRect& result);
435 bool requiresAnonymousTableWrappers(const LayoutObject*) const; 441 bool requiresAnonymousTableWrappers(const LayoutObject*) const;
436 442
437 // Gets pseudoStyle from Shadow host(in case of input elements) 443 // Gets pseudoStyle from Shadow host(in case of input elements)
438 // or from Parent element. 444 // or from Parent element.
439 PassRefPtr<ComputedStyle> getUncachedPseudoStyleFromParentOrShadowHost() con st; 445 PassRefPtr<ComputedStyle> getUncachedPseudoStyleFromParentOrShadowHost() con st;
440 446
447 bool skipInvalidationWhenLaidOutChildren() const;
448
441 public: 449 public:
442 #ifndef NDEBUG 450 #ifndef NDEBUG
443 void showTreeForThis() const; 451 void showTreeForThis() const;
444 void showLayoutTreeForThis() const; 452 void showLayoutTreeForThis() const;
445 void showLineTreeForThis() const; 453 void showLineTreeForThis() const;
446 454
447 void showLayoutObject() const; 455 void showLayoutObject() const;
448 // We don't make stringBuilder an optional parameter so that 456 // We don't make stringBuilder an optional parameter so that
449 // showLayoutObject can be called from gdb easily. 457 // showLayoutObject can be called from gdb easily.
450 void showLayoutObject(StringBuilder&) const; 458 void showLayoutObject(StringBuilder&) const;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 enum BoxDecorationBackgroundState { 687 enum BoxDecorationBackgroundState {
680 NoBoxDecorationBackground, 688 NoBoxDecorationBackground,
681 HasBoxDecorationBackgroundObscurationStatusInvalid, 689 HasBoxDecorationBackgroundObscurationStatusInvalid,
682 HasBoxDecorationBackgroundKnownToBeObscured, 690 HasBoxDecorationBackgroundKnownToBeObscured,
683 HasBoxDecorationBackgroundMayBeVisible, 691 HasBoxDecorationBackgroundMayBeVisible,
684 }; 692 };
685 bool hasBoxDecorationBackground() const { return m_bitfields.getBoxDecoratio nBackgroundState() != NoBoxDecorationBackground; } 693 bool hasBoxDecorationBackground() const { return m_bitfields.getBoxDecoratio nBackgroundState() != NoBoxDecorationBackground; }
686 bool boxDecorationBackgroundIsKnownToBeObscured() const; 694 bool boxDecorationBackgroundIsKnownToBeObscured() const;
687 bool hasBackground() const { return style()->hasBackground(); } 695 bool hasBackground() const { return style()->hasBackground(); }
688 696
697 bool needsLayoutBecauseOfChildren() const { return needsLayout() && !selfNee dsLayout() && !needsPositionedMovementLayout() && !needsSimplifiedNormalFlowLayo ut(); }
698
689 bool needsLayout() const 699 bool needsLayout() const
690 { 700 {
691 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout() 701 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo ut() || m_bitfields.posChildNeedsLayout()
692 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout(); 702 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need sPositionedMovementLayout();
693 } 703 }
694 704
695 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); } 705 bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); }
696 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); } 706 bool needsPositionedMovementLayout() const { return m_bitfields.needsPositio nedMovementLayout(); }
697 707
698 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); } 708 bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 // Invalidate the paint of a specific subrectangle within a given object. Th e rect is in the object's coordinate space. 1124 // Invalidate the paint of a specific subrectangle within a given object. Th e rect is in the object's coordinate space.
1115 void invalidatePaintRectangle(const LayoutRect&) const; 1125 void invalidatePaintRectangle(const LayoutRect&) const;
1116 1126
1117 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state. 1127 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state.
1118 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); 1128 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&);
1119 1129
1120 void invalidatePaintIncludingNonCompositingDescendants(); 1130 void invalidatePaintIncludingNonCompositingDescendants();
1121 void invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBox ModelObject& paintInvalidationContainer); 1131 void invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBox ModelObject& paintInvalidationContainer);
1122 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 1132 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
1123 1133
1124 // Returns true if the object will not generate any effective painted output .
1125 // It's used to skip unforced paint invalidation (which is when shouldDoFull PaintInvalidation
1126 // is false, but mayNeedPaintInvalidation or childShouldCheckForPaintInvalid ation is true) to
1127 // avoid unnecessary paint invalidations of empty areas covered by such obje cts.
1128 virtual bool paintedOutputOfObjectHasNoEffect() const { return false; }
1129
1130 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's 1134 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's
1131 // coordinate space. This method deals with outlines and overflow. 1135 // coordinate space. This method deals with outlines and overflow.
1132 virtual LayoutRect absoluteClippedOverflowRect() const; 1136 virtual LayoutRect absoluteClippedOverflowRect() const;
1133 1137
1134 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the object's 1138 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the object's
1135 // local coordinate space. This is for non-SVG objects and LayoutSVGRoot onl y. SVG objects (except LayoutSVGRoot) 1139 // local coordinate space. This is for non-SVG objects and LayoutSVGRoot onl y. SVG objects (except LayoutSVGRoot)
1136 // should use paintInvalidationRectInLocalSVGCoordinates() and map with SVG transforms instead. 1140 // should use paintInvalidationRectInLocalSVGCoordinates() and map with SVG transforms instead.
1137 virtual LayoutRect localOverflowRectForPaintInvalidation() const; 1141 virtual LayoutRect localOverflowRectForPaintInvalidation() const;
1138 1142
1139 // Given a rect in the object's coordinate space, mutates the rect into one representing the size of its visual painted 1143 // Given a rect in the object's coordinate space, mutates the rect into one representing the size of its visual painted
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 // 1548 //
1545 // If we don't meet the criteria for an incremental paint, the 1549 // If we don't meet the criteria for an incremental paint, the
1546 // alternative is a full paint invalidation. 1550 // alternative is a full paint invalidation.
1547 virtual void incrementallyInvalidatePaint(const LayoutBoxModelObject& paintI nvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking); 1551 virtual void incrementallyInvalidatePaint(const LayoutBoxModelObject& paintI nvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking);
1548 1552
1549 virtual bool hasNonCompositedScrollbars() const { return false; } 1553 virtual bool hasNonCompositedScrollbars() const { return false; }
1550 1554
1551 #if ENABLE(ASSERT) 1555 #if ENABLE(ASSERT)
1552 virtual bool paintInvalidationStateIsDirty() const 1556 virtual bool paintInvalidationStateIsDirty() const
1553 { 1557 {
1554 return shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState (); 1558 return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPain tInvalidationRegardlessOfPaintInvalidationState();
1555 } 1559 }
1556 #endif 1560 #endif
1557 1561
1558 // This function walks the descendants of |this|, following a 1562 // This function walks the descendants of |this|, following a
1559 // layout ordering. 1563 // layout ordering.
1560 // 1564 //
1561 // The ordering is important for PaintInvalidationState, as 1565 // The ordering is important for PaintInvalidationState, as
1562 // it requires to be called following a descendant/container 1566 // it requires to be called following a descendant/container
1563 // relationship. 1567 // relationship.
1564 // 1568 //
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 , m_normalChildNeedsLayout(false) 1741 , m_normalChildNeedsLayout(false)
1738 , m_posChildNeedsLayout(false) 1742 , m_posChildNeedsLayout(false)
1739 , m_needsSimplifiedNormalFlowLayout(false) 1743 , m_needsSimplifiedNormalFlowLayout(false)
1740 , m_selfNeedsOverflowRecalcAfterStyleChange(false) 1744 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1741 , m_childNeedsOverflowRecalcAfterStyleChange(false) 1745 , m_childNeedsOverflowRecalcAfterStyleChange(false)
1742 , m_preferredLogicalWidthsDirty(false) 1746 , m_preferredLogicalWidthsDirty(false)
1743 , m_childShouldCheckForPaintInvalidation(false) 1747 , m_childShouldCheckForPaintInvalidation(false)
1744 , m_mayNeedPaintInvalidation(false) 1748 , m_mayNeedPaintInvalidation(false)
1745 , m_mayNeedPaintInvalidationSubtree(false) 1749 , m_mayNeedPaintInvalidationSubtree(false)
1746 , m_shouldInvalidateSelection(false) 1750 , m_shouldInvalidateSelection(false)
1751 , m_neededLayoutBecauseOfChildren(false)
1747 , m_floating(false) 1752 , m_floating(false)
1748 , m_isAnonymous(!node) 1753 , m_isAnonymous(!node)
1749 , m_isText(false) 1754 , m_isText(false)
1750 , m_isBox(false) 1755 , m_isBox(false)
1751 , m_isInline(true) 1756 , m_isInline(true)
1752 , m_isAtomicInlineLevel(false) 1757 , m_isAtomicInlineLevel(false)
1753 , m_horizontalWritingMode(true) 1758 , m_horizontalWritingMode(true)
1754 , m_isDragging(false) 1759 , m_isDragging(false)
1755 , m_hasLayer(false) 1760 , m_hasLayer(false)
1756 , m_hasOverflowClip(false) 1761 , m_hasOverflowClip(false)
(...skipping 13 matching lines...) Expand all
1770 , m_lastBoxDecorationBackgroundObscured(false) 1775 , m_lastBoxDecorationBackgroundObscured(false)
1771 , m_isBackgroundAttachmentFixedObject(false) 1776 , m_isBackgroundAttachmentFixedObject(false)
1772 , m_isScrollAnchorObject(false) 1777 , m_isScrollAnchorObject(false)
1773 , m_positionedState(IsStaticallyPositioned) 1778 , m_positionedState(IsStaticallyPositioned)
1774 , m_selectionState(SelectionNone) 1779 , m_selectionState(SelectionNone)
1775 , m_boxDecorationBackgroundState(NoBoxDecorationBackground) 1780 , m_boxDecorationBackgroundState(NoBoxDecorationBackground)
1776 , m_fullPaintInvalidationReason(PaintInvalidationNone) 1781 , m_fullPaintInvalidationReason(PaintInvalidationNone)
1777 { 1782 {
1778 } 1783 }
1779 1784
1780 // 32 bits have been used in the first word, and 16 in the second. 1785 // 32 bits have been used in the first word, and 17 in the second.
1781 1786
1782 // Self needs layout means that this layout object is marked for a full layout. 1787 // Self needs layout means that this layout object is marked for a full layout.
1783 // This is the default layout but it is expensive as it recomputes every thing. 1788 // This is the default layout but it is expensive as it recomputes every thing.
1784 // For CSS boxes, this includes the width (laying out the line boxes aga in), the margins 1789 // For CSS boxes, this includes the width (laying out the line boxes aga in), the margins
1785 // (due to block collapsing margins), the positions, the height and the potential overflow. 1790 // (due to block collapsing margins), the positions, the height and the potential overflow.
1786 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1791 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1787 1792
1788 // A positioned movement layout is a specialized type of layout used on positioned objects 1793 // A positioned movement layout is a specialized type of layout used on positioned objects
1789 // that only visually moved. This layout is used when changing 'top'/'le ft' on a positioned 1794 // that only visually moved. This layout is used when changing 'top'/'le ft' on a positioned
1790 // element or margins on an out-of-flow one. Because the following opera tions don't impact 1795 // element or margins on an out-of-flow one. Because the following opera tions don't impact
(...skipping 30 matching lines...) Expand all
1821 1826
1822 // This boolean marks preferred logical widths for lazy recomputation. 1827 // This boolean marks preferred logical widths for lazy recomputation.
1823 // 1828 //
1824 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those 1829 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those
1825 // widths. 1830 // widths.
1826 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1831 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1827 1832
1828 ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation, ChildShouldCh eckForPaintInvalidation); 1833 ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation, ChildShouldCh eckForPaintInvalidation);
1829 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1834 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1830 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationSubtree, MayNeedPaintInvali dationSubtree); 1835 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationSubtree, MayNeedPaintInvali dationSubtree);
1831 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelectio n); 1836 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelectio n); // TODO(wangxianzhu): Remove for slimming paint v2.
1837 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren); // TODO(wangxianzhu): Remove for slimming paint v2.
1832 1838
1833 // This boolean is the cached value of 'float' 1839 // This boolean is the cached value of 'float'
1834 // (see ComputedStyle::isFloating). 1840 // (see ComputedStyle::isFloating).
1835 ADD_BOOLEAN_BITFIELD(floating, Floating); 1841 ADD_BOOLEAN_BITFIELD(floating, Floating);
1836 1842
1837 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1843 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
1838 ADD_BOOLEAN_BITFIELD(isText, IsText); 1844 ADD_BOOLEAN_BITFIELD(isText, IsText);
1839 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 1845 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
1840 1846
1841 // This boolean represents whether the LayoutObject is 'inline-level' 1847 // This boolean represents whether the LayoutObject is 'inline-level'
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 { 2044 {
2039 setNeedsLayout(reason, markParents, layouter); 2045 setNeedsLayout(reason, markParents, layouter);
2040 setShouldDoFullPaintInvalidation(); 2046 setShouldDoFullPaintInvalidation();
2041 } 2047 }
2042 2048
2043 inline void LayoutObject::clearNeedsLayout() 2049 inline void LayoutObject::clearNeedsLayout()
2044 { 2050 {
2045 // Set flags for later stages/cycles. 2051 // Set flags for later stages/cycles.
2046 setEverHadLayout(); 2052 setEverHadLayout();
2047 setMayNeedPaintInvalidation(); 2053 setMayNeedPaintInvalidation();
2054 m_bitfields.setNeededLayoutBecauseOfChildren(needsLayoutBecauseOfChildren()) ;
2048 2055
2049 // Clear needsLayout flags. 2056 // Clear needsLayout flags.
2050 setSelfNeedsLayout(false); 2057 setSelfNeedsLayout(false);
2051 setPosChildNeedsLayout(false); 2058 setPosChildNeedsLayout(false);
2052 setNeedsSimplifiedNormalFlowLayout(false); 2059 setNeedsSimplifiedNormalFlowLayout(false);
2053 setNormalChildNeedsLayout(false); 2060 setNormalChildNeedsLayout(false);
2054 setNeedsPositionedMovementLayout(false); 2061 setNeedsPositionedMovementLayout(false);
2055 setAncestorLineBoxDirty(false); 2062 setAncestorLineBoxDirty(false);
2056 2063
2057 #if ENABLE(ASSERT) 2064 #if ENABLE(ASSERT)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 void showTree(const blink::LayoutObject*); 2187 void showTree(const blink::LayoutObject*);
2181 void showLineTree(const blink::LayoutObject*); 2188 void showLineTree(const blink::LayoutObject*);
2182 void showLayoutTree(const blink::LayoutObject* object1); 2189 void showLayoutTree(const blink::LayoutObject* object1);
2183 // We don't make object2 an optional parameter so that showLayoutTree 2190 // We don't make object2 an optional parameter so that showLayoutTree
2184 // can be called from gdb easily. 2191 // can be called from gdb easily.
2185 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 2192 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
2186 2193
2187 #endif 2194 #endif
2188 2195
2189 #endif // LayoutObject_h 2196 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.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