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

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

Issue 1774193002: New paint invalidation using paint property tree walk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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. 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 25 matching lines...) Expand all
36 #include "core/inspector/InspectorTraceEvents.h" 36 #include "core/inspector/InspectorTraceEvents.h"
37 #include "core/layout/HitTestRequest.h" 37 #include "core/layout/HitTestRequest.h"
38 #include "core/layout/LayoutObjectChildList.h" 38 #include "core/layout/LayoutObjectChildList.h"
39 #include "core/layout/PaintInvalidationState.h" 39 #include "core/layout/PaintInvalidationState.h"
40 #include "core/layout/ScrollAlignment.h" 40 #include "core/layout/ScrollAlignment.h"
41 #include "core/layout/SubtreeLayoutScope.h" 41 #include "core/layout/SubtreeLayoutScope.h"
42 #include "core/layout/api/HitTestAction.h" 42 #include "core/layout/api/HitTestAction.h"
43 #include "core/layout/api/SelectionState.h" 43 #include "core/layout/api/SelectionState.h"
44 #include "core/layout/compositing/CompositingState.h" 44 #include "core/layout/compositing/CompositingState.h"
45 #include "core/layout/compositing/CompositingTriggers.h" 45 #include "core/layout/compositing/CompositingTriggers.h"
46 #include "core/paint/ObjectPaintProperties.h"
46 #include "core/style/ComputedStyle.h" 47 #include "core/style/ComputedStyle.h"
47 #include "core/style/StyleInheritedData.h" 48 #include "core/style/StyleInheritedData.h"
48 #include "platform/geometry/FloatQuad.h" 49 #include "platform/geometry/FloatQuad.h"
49 #include "platform/geometry/LayoutRect.h" 50 #include "platform/geometry/LayoutRect.h"
50 #include "platform/graphics/CompositingReasons.h" 51 #include "platform/graphics/CompositingReasons.h"
51 #include "platform/graphics/PaintInvalidationReason.h" 52 #include "platform/graphics/PaintInvalidationReason.h"
52 #include "platform/graphics/paint/DisplayItemClient.h" 53 #include "platform/graphics/paint/DisplayItemClient.h"
53 #include "platform/transforms/TransformationMatrix.h" 54 #include "platform/transforms/TransformationMatrix.h"
54 55
55 namespace blink { 56 namespace blink {
56 57
57 class AffineTransform; 58 class AffineTransform;
58 class Cursor; 59 class Cursor;
59 class Document; 60 class Document;
60 class HitTestLocation; 61 class HitTestLocation;
61 class HitTestResult; 62 class HitTestResult;
62 class InlineBox; 63 class InlineBox;
63 class LayoutBoxModelObject; 64 class LayoutBoxModelObject;
64 class LayoutBlock; 65 class LayoutBlock;
65 class LayoutFlowThread; 66 class LayoutFlowThread;
66 class LayoutGeometryMap; 67 class LayoutGeometryMap;
67 class LayoutMultiColumnSpannerPlaceholder; 68 class LayoutMultiColumnSpannerPlaceholder;
68 class LayoutView; 69 class LayoutView;
69 class ObjectPaintProperties;
70 class PaintLayer; 70 class PaintLayer;
71 class PseudoStyleRequest; 71 class PseudoStyleRequest;
72 class TransformState; 72 class TransformState;
73 73
74 struct PaintInfo; 74 struct PaintInfo;
75 75
76 enum CursorDirective { 76 enum CursorDirective {
77 SetCursorBasedOnStyle, 77 SetCursorBasedOnStyle,
78 SetCursor, 78 SetCursor,
79 DoNotSetCursor 79 DoNotSetCursor
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 LayoutRect previousPaintInvalidationRectIncludingCompositedScrolling(const L ayoutBoxModelObject& paintInvalidationContainer) const; 1293 LayoutRect previousPaintInvalidationRectIncludingCompositedScrolling(const L ayoutBoxModelObject& paintInvalidationContainer) const;
1294 LayoutSize previousPaintInvalidationRectSize() const { return previousPaintI nvalidationRect().size(); } 1294 LayoutSize previousPaintInvalidationRectSize() const { return previousPaintI nvalidationRect().size(); }
1295 1295
1296 // Called when the previous paint invalidation rect(s) is no longer valid. 1296 // Called when the previous paint invalidation rect(s) is no longer valid.
1297 virtual void clearPreviousPaintInvalidationRects(); 1297 virtual void clearPreviousPaintInvalidationRects();
1298 1298
1299 // Only adjusts if the paint invalidation container is not a composited scro ller. 1299 // Only adjusts if the paint invalidation container is not a composited scro ller.
1300 void adjustPreviousPaintInvalidationForScrollIfNeeded(const DoubleSize& scro llDelta); 1300 void adjustPreviousPaintInvalidationForScrollIfNeeded(const DoubleSize& scro llDelta);
1301 1301
1302 // The previous position of the top-left corner of the object in its previou s paint backing. 1302 // The previous position of the top-left corner of the object in its previou s paint backing.
1303 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const 1303 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { re turn m_previousPositionFromPaintInvalidationBacking; }
1304 { 1304 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking) { m_previousPositionFromPaintInvalidationBacki ng = positionFromPaintInvalidationBacking; }
1305 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1306 return m_previousPositionFromPaintInvalidationBacking;
1307 }
1308 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking)
1309 {
1310 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1311 m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvali dationBacking;
1312 }
1313
1314 bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const
1315 {
1316 ASSERT(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1317 return m_previousPositionFromPaintInvalidationBacking != uninitializedPa intOffset() && m_previousPositionFromPaintInvalidationBacking != newPaintOffset;
1318 }
1319 void setPreviousPaintOffset(const LayoutPoint& paintOffset)
1320 {
1321 ASSERT(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1322 m_previousPositionFromPaintInvalidationBacking = paintOffset;
1323 }
1324 1305
1325 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi elds.fullPaintInvalidationReason(); } 1306 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi elds.fullPaintInvalidationReason(); }
1326 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv alidationReason() != PaintInvalidationNone; } 1307 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv alidationReason() != PaintInvalidationNone; }
1327 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid ationFull); 1308 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid ationFull);
1328 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida tionReason(PaintInvalidationNone); } 1309 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida tionReason(PaintInvalidationNone); }
1329 1310
1330 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1311 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1331 1312
1332 virtual void clearPaintInvalidationState(const PaintInvalidationState&); 1313 virtual void clearPaintInvalidationState(const PaintInvalidationState&);
1333 1314
(...skipping 24 matching lines...) Expand all
1358 1339
1359 void invalidateDisplayItemClient(const DisplayItemClient&) const; 1340 void invalidateDisplayItemClient(const DisplayItemClient&) const;
1360 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(const La youtBoxModelObject* paintInvalidationContainer, PaintInvalidationReason) const; 1341 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(const La youtBoxModelObject* paintInvalidationContainer, PaintInvalidationReason) const;
1361 1342
1362 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. 1343 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child.
1363 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } 1344 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { }
1364 1345
1365 // Painters can use const methods only, except for these explicitly declared methods. 1346 // Painters can use const methods only, except for these explicitly declared methods.
1366 class MutableForPainting { 1347 class MutableForPainting {
1367 public: 1348 public:
1368 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } 1349 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) { return m_layoutObject.invalidatePaintIfNeeded(const_cast<PaintInvalidati onState&>(paintInvalidationState), paintInvalidationContainer); }
1350 void clearPaintInvalidationState(const PaintInvalidationState& paintInva lidationState) { m_layoutObject.clearPaintInvalidationState(paintInvalidationSta te); }
1351 void setObjectPaintProperties(PassOwnPtr<ObjectPaintProperties> properti es) { m_layoutObject.setObjectPaintProperties(properties); }
1352 void clearObjectPaintProperties() { m_layoutObject.clearObjectPaintPrope rties(); }
1369 1353
1370 private: 1354 private:
1371 friend class LayoutObject; 1355 friend class LayoutObject;
1372 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { } 1356 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { }
1373 1357
1374 LayoutObject& m_layoutObject; 1358 LayoutObject& m_layoutObject;
1375 }; 1359 };
1376 MutableForPainting getMutableForPainting() const { return MutableForPainting (*this); } 1360 MutableForPainting getMutableForPainting() const { return MutableForPainting (*this); }
1377 1361
1378 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1362 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 void checkBlockPositionedObjectsNeedLayout(); 1611 void checkBlockPositionedObjectsNeedLayout();
1628 #endif 1612 #endif
1629 1613
1630 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; } 1614 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; }
1631 1615
1632 static bool isAllowedToModifyLayoutTreeStructure(Document&); 1616 static bool isAllowedToModifyLayoutTreeStructure(Document&);
1633 1617
1634 // The passed rect is mutated into the coordinate space of the paint invalid ation container. 1618 // The passed rect is mutated into the coordinate space of the paint invalid ation container.
1635 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const; 1619 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const;
1636 1620
1637 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); } 1621 LayoutObject* parentCrossingFrameBoundaries() const;
1638 1622
1639 RefPtr<ComputedStyle> m_style; 1623 RefPtr<ComputedStyle> m_style;
1640 1624
1641 // Oilpan: This untraced pointer to the owning Node is considered safe. 1625 // Oilpan: This untraced pointer to the owning Node is considered safe.
1642 RawPtrWillBeUntracedMember<Node> m_node; 1626 RawPtrWillBeUntracedMember<Node> m_node;
1643 1627
1644 LayoutObject* m_parent; 1628 LayoutObject* m_parent;
1645 LayoutObject* m_previous; 1629 LayoutObject* m_previous;
1646 LayoutObject* m_next; 1630 LayoutObject* m_next;
1647 1631
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descenda nt overflow can 1757 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descenda nt overflow can
1774 // bleed into its containing block's so we have to recompute it in some cases. 1758 // bleed into its containing block's so we have to recompute it in some cases.
1775 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange); 1759 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
1776 1760
1777 // This boolean marks preferred logical widths for lazy recomputation. 1761 // This boolean marks preferred logical widths for lazy recomputation.
1778 // 1762 //
1779 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those 1763 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those
1780 // widths. 1764 // widths.
1781 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1765 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1782 1766
1783 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); // TODO(wangxianzhu): Remove for slimming paint v2. 1767 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1784 ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation, ChildShouldCh eckForPaintInvalidation); 1768 ADD_BOOLEAN_BITFIELD(childShouldCheckForPaintInvalidation, ChildShouldCh eckForPaintInvalidation);
1785 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1769 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1786 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelectio n); // TODO(wangxianzhu): Remove for slimming paint v2. 1770 ADD_BOOLEAN_BITFIELD(shouldInvalidateSelection, ShouldInvalidateSelectio n);
1787 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren); // TODO(wangxianzhu): Remove for slimming paint v2. 1771 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1788 1772
1789 // This boolean is the cached value of 'float' 1773 // This boolean is the cached value of 'float'
1790 // (see ComputedStyle::isFloating). 1774 // (see ComputedStyle::isFloating).
1791 ADD_BOOLEAN_BITFIELD(floating, Floating); 1775 ADD_BOOLEAN_BITFIELD(floating, Floating);
1792 1776
1793 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); 1777 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
1794 ADD_BOOLEAN_BITFIELD(isText, IsText); 1778 ADD_BOOLEAN_BITFIELD(isText, IsText);
1795 ADD_BOOLEAN_BITFIELD(isBox, IsBox); 1779 ADD_BOOLEAN_BITFIELD(isBox, IsBox);
1796 1780
1797 // This boolean represents whether the LayoutObject is 'inline-level' 1781 // This boolean represents whether the LayoutObject is 'inline-level'
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 // Store state between styleWillChange and styleDidChange 1898 // Store state between styleWillChange and styleDidChange
1915 static bool s_affectsParentBlock; 1899 static bool s_affectsParentBlock;
1916 1900
1917 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See 1901 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See
1918 // adjustInvalidationRectForCompositedScrolling(). 1902 // adjustInvalidationRectForCompositedScrolling().
1919 LayoutRect m_previousPaintInvalidationRect; 1903 LayoutRect m_previousPaintInvalidationRect;
1920 1904
1921 // This stores the position in the paint invalidation backing's coordinate. 1905 // This stores the position in the paint invalidation backing's coordinate.
1922 // It is used to detect layoutObject shifts that forces a full invalidation. 1906 // It is used to detect layoutObject shifts that forces a full invalidation.
1923 // This point does *not* account for composited scrolling. See adjustInvalid ationRectForCompositedScrolling(). 1907 // This point does *not* account for composited scrolling. See adjustInvalid ationRectForCompositedScrolling().
1924 // For slimmingPaintInvalidation, this stores the previous paint offset.
1925 // TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable sl immingPaintInvalidation.
1926 LayoutPoint m_previousPositionFromPaintInvalidationBacking; 1908 LayoutPoint m_previousPositionFromPaintInvalidationBacking;
1927 }; 1909 };
1928 1910
1929 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit . 1911 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit .
1930 class DeprecatedDisableModifyLayoutTreeStructureAsserts { 1912 class DeprecatedDisableModifyLayoutTreeStructureAsserts {
1931 STACK_ALLOCATED(); 1913 STACK_ALLOCATED();
1932 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); 1914 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts);
1933 public: 1915 public:
1934 DeprecatedDisableModifyLayoutTreeStructureAsserts(); 1916 DeprecatedDisableModifyLayoutTreeStructureAsserts();
1935 1917
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 void showTree(const blink::LayoutObject*); 2137 void showTree(const blink::LayoutObject*);
2156 void showLineTree(const blink::LayoutObject*); 2138 void showLineTree(const blink::LayoutObject*);
2157 void showLayoutTree(const blink::LayoutObject* object1); 2139 void showLayoutTree(const blink::LayoutObject* object1);
2158 // We don't make object2 an optional parameter so that showLayoutTree 2140 // We don't make object2 an optional parameter so that showLayoutTree
2159 // can be called from gdb easily. 2141 // can be called from gdb easily.
2160 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 2142 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
2161 2143
2162 #endif 2144 #endif
2163 2145
2164 #endif // LayoutObject_h 2146 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698