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

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

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 years, 9 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. 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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 const LayoutPoint& paintOffset() const { return m_paintOffset; } 1636 const LayoutPoint& paintOffset() const { return m_paintOffset; }
1637 1637
1638 PaintInvalidationReason fullPaintInvalidationReason() const { 1638 PaintInvalidationReason fullPaintInvalidationReason() const {
1639 return m_bitfields.fullPaintInvalidationReason(); 1639 return m_bitfields.fullPaintInvalidationReason();
1640 } 1640 }
1641 bool shouldDoFullPaintInvalidation() const { 1641 bool shouldDoFullPaintInvalidation() const {
1642 return m_bitfields.fullPaintInvalidationReason() != PaintInvalidationNone; 1642 return m_bitfields.fullPaintInvalidationReason() != PaintInvalidationNone;
1643 } 1643 }
1644 void setShouldDoFullPaintInvalidation( 1644 void setShouldDoFullPaintInvalidation(
1645 PaintInvalidationReason = PaintInvalidationFull); 1645 PaintInvalidationReason = PaintInvalidationFull);
1646 void setShouldDoFullPaintInvalidationWithoutGeometryChange(
pdr. 2017/03/10 06:21:39 It looks like this change is basically recognizing
Xianzhu 2017/03/10 17:43:05 Yes.
1647 PaintInvalidationReason = PaintInvalidationFull);
1646 void clearShouldDoFullPaintInvalidation() { 1648 void clearShouldDoFullPaintInvalidation() {
1647 m_bitfields.setFullPaintInvalidationReason(PaintInvalidationNone); 1649 m_bitfields.setFullPaintInvalidationReason(PaintInvalidationNone);
1648 } 1650 }
1649 1651
1650 void clearPaintInvalidationFlags(); 1652 void clearPaintInvalidationFlags();
1651 1653
1652 bool mayNeedPaintInvalidation() const { 1654 bool mayNeedPaintInvalidation() const {
1653 return m_bitfields.mayNeedPaintInvalidation(); 1655 return m_bitfields.mayNeedPaintInvalidation();
1654 } 1656 }
1655 void setMayNeedPaintInvalidation(); 1657 void setMayNeedPaintInvalidation();
1658 void setMayNeedPaintInvalidationWithoutGeometryChange();
1656 1659
1657 bool mayNeedPaintInvalidationSubtree() const { 1660 bool mayNeedPaintInvalidationSubtree() const {
1658 return m_bitfields.mayNeedPaintInvalidationSubtree(); 1661 return m_bitfields.mayNeedPaintInvalidationSubtree();
1659 } 1662 }
1660 void setMayNeedPaintInvalidationSubtree(); 1663 void setMayNeedPaintInvalidationSubtree();
1661 1664
1665 bool needsPaintOffsetAndVisualRectUpdate() const {
1666 return m_bitfields.needsPaintOffsetAndVisualRectUpdate();
1667 }
1668
1662 bool mayNeedPaintInvalidationAnimatedBackgroundImage() const { 1669 bool mayNeedPaintInvalidationAnimatedBackgroundImage() const {
1663 return m_bitfields.mayNeedPaintInvalidationAnimatedBackgroundImage(); 1670 return m_bitfields.mayNeedPaintInvalidationAnimatedBackgroundImage();
1664 } 1671 }
1665 void setMayNeedPaintInvalidationAnimatedBackgroundImage(); 1672 void setMayNeedPaintInvalidationAnimatedBackgroundImage();
1666 1673
1667 bool shouldInvalidateSelection() const { 1674 bool shouldInvalidateSelection() const {
1668 return m_bitfields.shouldInvalidateSelection(); 1675 return m_bitfields.shouldInvalidateSelection();
1669 } 1676 }
1670 void setShouldInvalidateSelection(); 1677 void setShouldInvalidateSelection();
1671 1678
1672 bool shouldCheckForPaintInvalidation( 1679 bool shouldCheckForPaintInvalidation(
1673 const PaintInvalidationState& paintInvalidationState) const { 1680 const PaintInvalidationState& paintInvalidationState) const {
1674 return paintInvalidationState.hasForcedSubtreeInvalidationFlags() || 1681 return paintInvalidationState.hasForcedSubtreeInvalidationFlags() ||
1675 shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); 1682 shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState();
1676 } 1683 }
1677 1684
1678 bool shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() 1685 bool shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()
1679 const { 1686 const {
1680 return mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation() || 1687 return mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation();
1681 shouldInvalidateSelection() ||
1682 m_bitfields.childShouldCheckForPaintInvalidation();
1683 } 1688 }
1684 1689
1685 virtual LayoutRect viewRect() const; 1690 virtual LayoutRect viewRect() const;
1686 1691
1687 // New version to replace the above old version. 1692 // New version to replace the above old version.
1688 virtual PaintInvalidationReason invalidatePaintIfNeeded( 1693 virtual PaintInvalidationReason invalidatePaintIfNeeded(
1689 const PaintInvalidatorContext&) const; 1694 const PaintInvalidatorContext&) const;
1690 1695
1691 // When this object is invalidated for paint, this method is called to 1696 // When this object is invalidated for paint, this method is called to
1692 // invalidate any DisplayItemClients owned by this object, including the 1697 // invalidate any DisplayItemClients owned by this object, including the
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 // layerOffset is the offset of this layoutObject within the current layer 2014 // layerOffset is the offset of this layoutObject within the current layer
2010 // that should be used for each result. 2015 // that should be used for each result.
2011 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, 2016 virtual void computeSelfHitTestRects(Vector<LayoutRect>&,
2012 const LayoutPoint& layerOffset) const {} 2017 const LayoutPoint& layerOffset) const {}
2013 2018
2014 void setVisualRect(const LayoutRect& rect) { m_visualRect = rect; } 2019 void setVisualRect(const LayoutRect& rect) { m_visualRect = rect; }
2015 2020
2016 #if DCHECK_IS_ON() 2021 #if DCHECK_IS_ON()
2017 virtual bool paintInvalidationStateIsDirty() const { 2022 virtual bool paintInvalidationStateIsDirty() const {
2018 return backgroundChangedSinceLastPaintInvalidation() || 2023 return backgroundChangedSinceLastPaintInvalidation() ||
2019 shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); 2024 shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() | |
2025 shouldInvalidateSelection() || needsPaintOffsetAndVisualRectUpdate();
2020 } 2026 }
2021 #endif 2027 #endif
2022 2028
2023 // Called before paint invalidation. 2029 // Called before paint invalidation.
2024 virtual void ensureIsReadyForPaintInvalidation() { DCHECK(!needsLayout()); } 2030 virtual void ensureIsReadyForPaintInvalidation() { DCHECK(!needsLayout()); }
2025 2031
2026 // This function walks the descendants of |this|, following a 2032 // This function walks the descendants of |this|, following a
2027 // layout ordering. 2033 // layout ordering.
2028 // 2034 //
2029 // The ordering is important for PaintInvalidationState, as it requires to be 2035 // The ordering is important for PaintInvalidationState, as it requires to be
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 2100
2095 // Walk up the parent chain and find the first scrolling block to disable 2101 // Walk up the parent chain and find the first scrolling block to disable
2096 // scroll anchoring on. 2102 // scroll anchoring on.
2097 void setScrollAnchorDisablingStyleChangedOnAncestor(); 2103 void setScrollAnchorDisablingStyleChangedOnAncestor();
2098 2104
2099 // FIXME: This should be 'markContaingBoxChainForOverflowRecalc when we make 2105 // FIXME: This should be 'markContaingBoxChainForOverflowRecalc when we make
2100 // LayoutBox recomputeOverflow-capable. crbug.com/437012 and crbug.com/434700. 2106 // LayoutBox recomputeOverflow-capable. crbug.com/437012 and crbug.com/434700.
2101 inline void markAncestorsForOverflowRecalcIfNeeded(); 2107 inline void markAncestorsForOverflowRecalcIfNeeded();
2102 2108
2103 inline void markAncestorsForPaintInvalidation(); 2109 inline void markAncestorsForPaintInvalidation();
2110 inline void setNeedsPaintOffsetAndVisualRectUpdate();
2104 2111
2105 inline void invalidateContainerPreferredLogicalWidths(); 2112 inline void invalidateContainerPreferredLogicalWidths();
2106 2113
2107 void invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal( 2114 void invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal(
2108 const LayoutBoxModelObject& paintInvalidationContainer); 2115 const LayoutBoxModelObject& paintInvalidationContainer);
2109 2116
2110 LayoutObject* containerForAbsolutePosition(AncestorSkipInfo* = nullptr) const; 2117 LayoutObject* containerForAbsolutePosition(AncestorSkipInfo* = nullptr) const;
2111 2118
2112 const LayoutBoxModelObject* enclosingCompositedContainer() const; 2119 const LayoutBoxModelObject* enclosingCompositedContainer() const;
2113 2120
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 // of the memory constraints on layout objects. 2197 // of the memory constraints on layout objects.
2191 LayoutObjectBitfields(Node* node) 2198 LayoutObjectBitfields(Node* node)
2192 : m_selfNeedsLayout(false), 2199 : m_selfNeedsLayout(false),
2193 m_needsPositionedMovementLayout(false), 2200 m_needsPositionedMovementLayout(false),
2194 m_normalChildNeedsLayout(false), 2201 m_normalChildNeedsLayout(false),
2195 m_posChildNeedsLayout(false), 2202 m_posChildNeedsLayout(false),
2196 m_needsSimplifiedNormalFlowLayout(false), 2203 m_needsSimplifiedNormalFlowLayout(false),
2197 m_selfNeedsOverflowRecalcAfterStyleChange(false), 2204 m_selfNeedsOverflowRecalcAfterStyleChange(false),
2198 m_childNeedsOverflowRecalcAfterStyleChange(false), 2205 m_childNeedsOverflowRecalcAfterStyleChange(false),
2199 m_preferredLogicalWidthsDirty(false), 2206 m_preferredLogicalWidthsDirty(false),
2200 m_childShouldCheckForPaintInvalidation(false),
2201 m_mayNeedPaintInvalidation(false), 2207 m_mayNeedPaintInvalidation(false),
2202 m_mayNeedPaintInvalidationSubtree(false), 2208 m_mayNeedPaintInvalidationSubtree(false),
2203 m_mayNeedPaintInvalidationAnimatedBackgroundImage(false), 2209 m_mayNeedPaintInvalidationAnimatedBackgroundImage(false),
2210 m_needsPaintOffsetAndVisualRectUpdate(false),
2204 m_shouldInvalidateSelection(false), 2211 m_shouldInvalidateSelection(false),
2205 m_floating(false), 2212 m_floating(false),
2206 m_isAnonymous(!node), 2213 m_isAnonymous(!node),
2207 m_isText(false), 2214 m_isText(false),
2208 m_isBox(false), 2215 m_isBox(false),
2209 m_isInline(true), 2216 m_isInline(true),
2210 m_isAtomicInlineLevel(false), 2217 m_isAtomicInlineLevel(false),
2211 m_horizontalWritingMode(true), 2218 m_horizontalWritingMode(true),
2212 m_hasLayer(false), 2219 m_hasLayer(false),
2213 m_hasOverflowClip(false), 2220 m_hasOverflowClip(false),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, 2299 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange,
2293 ChildNeedsOverflowRecalcAfterStyleChange); 2300 ChildNeedsOverflowRecalcAfterStyleChange);
2294 2301
2295 // This boolean marks preferred logical widths for lazy recomputation. 2302 // This boolean marks preferred logical widths for lazy recomputation.
2296 // 2303 //
2297 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those 2304 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those
2298 // widths. 2305 // widths.
2299 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, 2306 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty,
2300 PreferredLogicalWidthsDirty); 2307 PreferredLogicalWidthsDirty);
2301 2308
2302 ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation,
2303 ChildShouldCheckForPaintInvalidation);
2304 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation); 2309 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation);
2305 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationSubtree, 2310 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationSubtree,
2306 MayNeedPaintInvalidationSubtree); 2311 MayNeedPaintInvalidationSubtree);
2307 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationAnimatedBackgroundImage, 2312 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidationAnimatedBackgroundImage,
2308 MayNeedPaintInvalidationAnimatedBackgroundImage); 2313 MayNeedPaintInvalidationAnimatedBackgroundImage);
2314 ADD_BOOLEAN_BITFIELD(needsPaintOffsetAndVisualRectUpdate,
2315 NeedsPaintOffsetAndVisualRectUpdate);
2309 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelection); 2316 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelection);
2310 2317
2311 // This boolean is the cached value of 'float' 2318 // This boolean is the cached value of 'float'
2312 // (see ComputedStyle::isFloating). 2319 // (see ComputedStyle::isFloating).
2313 ADD_BOOLEAN_BITFIELD(floating, Floating); 2320 ADD_BOOLEAN_BITFIELD(floating, Floating);
2314 2321
2315 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 2322 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
2316 ADD_BOOLEAN_BITFIELD(isText, IsText); 2323 ADD_BOOLEAN_BITFIELD(isText, IsText);
2317 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 2324 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
2318 2325
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2784 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2778 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2785 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2779 // We don't make object2 an optional parameter so that showLayoutTree 2786 // We don't make object2 an optional parameter so that showLayoutTree
2780 // can be called from gdb easily. 2787 // can be called from gdb easily.
2781 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2788 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2782 const blink::LayoutObject* object2); 2789 const blink::LayoutObject* object2);
2783 2790
2784 #endif 2791 #endif
2785 2792
2786 #endif // LayoutObject_h 2793 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698