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

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

Issue 2476813002: Move LayoutObject::m_previousPosition... into a global map in ObjectPaintInvalidator (Closed)
Patch Set: - 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 const LayoutRect& previousVisualRect() const { return m_previousVisualRect; } 1582 const LayoutRect& previousVisualRect() const { return m_previousVisualRect; }
1583 1583
1584 // Called when the previous visual rect(s) is no longer valid. 1584 // Called when the previous visual rect(s) is no longer valid.
1585 virtual void clearPreviousVisualRects(); 1585 virtual void clearPreviousVisualRects();
1586 1586
1587 // Only adjusts if the paint invalidation container is not a composited 1587 // Only adjusts if the paint invalidation container is not a composited
1588 // scroller. 1588 // scroller.
1589 void adjustPreviousPaintInvalidationForScrollIfNeeded( 1589 void adjustPreviousPaintInvalidationForScrollIfNeeded(
1590 const DoubleSize& scrollDelta); 1590 const DoubleSize& scrollDelta);
1591 1591
1592 // The previous position of the top-left corner of the object in its previous
1593 // paint backing.
1594 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const {
1595 return m_previousPositionFromPaintInvalidationBacking;
1596 }
1597 void setPreviousPositionFromPaintInvalidationBacking(
1598 const LayoutPoint& positionFromPaintInvalidationBacking) {
1599 m_previousPositionFromPaintInvalidationBacking =
1600 positionFromPaintInvalidationBacking;
1601 }
1602
1603 PaintInvalidationReason fullPaintInvalidationReason() const { 1592 PaintInvalidationReason fullPaintInvalidationReason() const {
1604 return m_bitfields.fullPaintInvalidationReason(); 1593 return m_bitfields.fullPaintInvalidationReason();
1605 } 1594 }
1606 bool shouldDoFullPaintInvalidation() const { 1595 bool shouldDoFullPaintInvalidation() const {
1607 return m_bitfields.fullPaintInvalidationReason() != PaintInvalidationNone; 1596 return m_bitfields.fullPaintInvalidationReason() != PaintInvalidationNone;
1608 } 1597 }
1609 void setShouldDoFullPaintInvalidation( 1598 void setShouldDoFullPaintInvalidation(
1610 PaintInvalidationReason = PaintInvalidationFull); 1599 PaintInvalidationReason = PaintInvalidationFull);
1611 void clearShouldDoFullPaintInvalidation() { 1600 void clearShouldDoFullPaintInvalidation() {
1612 m_bitfields.setFullPaintInvalidationReason(PaintInvalidationNone); 1601 m_bitfields.setFullPaintInvalidationReason(PaintInvalidationNone);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { 1672 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) {
1684 m_layoutObject.setShouldDoFullPaintInvalidation(reason); 1673 m_layoutObject.setShouldDoFullPaintInvalidation(reason);
1685 } 1674 }
1686 void ensureIsReadyForPaintInvalidation() { 1675 void ensureIsReadyForPaintInvalidation() {
1687 m_layoutObject.ensureIsReadyForPaintInvalidation(); 1676 m_layoutObject.ensureIsReadyForPaintInvalidation();
1688 } 1677 }
1689 1678
1690 void setPreviousVisualRect(const LayoutRect& r) { 1679 void setPreviousVisualRect(const LayoutRect& r) {
1691 m_layoutObject.setPreviousVisualRect(r); 1680 m_layoutObject.setPreviousVisualRect(r);
1692 } 1681 }
1693 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { 1682 void setHasPreviousLocationInBacking(bool b) {
1694 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); 1683 m_layoutObject.m_bitfields.setHasPreviousLocationInBacking(b);
1695 } 1684 }
1696 void setPreviousBackgroundObscured(bool b) { 1685 void setPreviousBackgroundObscured(bool b) {
1697 m_layoutObject.setPreviousBackgroundObscured(b); 1686 m_layoutObject.setPreviousBackgroundObscured(b);
1698 } 1687 }
1699 void clearPreviousVisualRects() { 1688 void clearPreviousVisualRects() {
1700 m_layoutObject.clearPreviousVisualRects(); 1689 m_layoutObject.clearPreviousVisualRects();
1701 } 1690 }
1702
1703 protected: 1691 protected:
1704 friend class PaintPropertyTreeBuilder; 1692 friend class PaintPropertyTreeBuilder;
1705 // The following two functions can be called from PaintPropertyTreeBuilder 1693 // The following two functions can be called from PaintPropertyTreeBuilder
1706 // only. 1694 // only.
1707 ObjectPaintProperties& ensurePaintProperties() { 1695 ObjectPaintProperties& ensurePaintProperties() {
1708 return m_layoutObject.ensurePaintProperties(); 1696 return m_layoutObject.ensurePaintProperties();
1709 } 1697 }
1710 ObjectPaintProperties* paintProperties() { 1698 ObjectPaintProperties* paintProperties() {
1711 return const_cast<ObjectPaintProperties*>( 1699 return const_cast<ObjectPaintProperties*>(
1712 m_layoutObject.paintProperties()); 1700 m_layoutObject.paintProperties());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 return m_bitfields.previousBackgroundObscured(); 1735 return m_bitfields.previousBackgroundObscured();
1748 } 1736 }
1749 void setPreviousBackgroundObscured(bool b) { 1737 void setPreviousBackgroundObscured(bool b) {
1750 m_bitfields.setPreviousBackgroundObscured(b); 1738 m_bitfields.setPreviousBackgroundObscured(b);
1751 } 1739 }
1752 1740
1753 bool isBackgroundAttachmentFixedObject() const { 1741 bool isBackgroundAttachmentFixedObject() const {
1754 return m_bitfields.isBackgroundAttachmentFixedObject(); 1742 return m_bitfields.isBackgroundAttachmentFixedObject();
1755 } 1743 }
1756 1744
1745 bool hasPreviousLocationInBacking() const {
chrishtr 2016/11/04 21:48:07 Document why this bit is here and what it does.
Xianzhu 2016/11/04 22:10:24 Done.
1746 return m_bitfields.hasPreviousLocationInBacking();
1747 }
1748
1757 protected: 1749 protected:
1758 enum LayoutObjectType { 1750 enum LayoutObjectType {
1759 LayoutObjectBr, 1751 LayoutObjectBr,
1760 LayoutObjectCanvas, 1752 LayoutObjectCanvas,
1761 LayoutObjectFieldset, 1753 LayoutObjectFieldset,
1762 LayoutObjectCounter, 1754 LayoutObjectCounter,
1763 LayoutObjectDetailsMarker, 1755 LayoutObjectDetailsMarker,
1764 LayoutObjectEmbeddedObject, 1756 LayoutObjectEmbeddedObject,
1765 LayoutObjectFileUploadControl, 1757 LayoutObjectFileUploadControl,
1766 LayoutObjectFrame, 1758 LayoutObjectFrame,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 void removeFromLayoutFlowThread(); 1917 void removeFromLayoutFlowThread();
1926 1918
1927 bool containsInlineWithOutlineAndContinuation() const { 1919 bool containsInlineWithOutlineAndContinuation() const {
1928 return m_bitfields.containsInlineWithOutlineAndContinuation(); 1920 return m_bitfields.containsInlineWithOutlineAndContinuation();
1929 } 1921 }
1930 void setContainsInlineWithOutlineAndContinuation(bool b) { 1922 void setContainsInlineWithOutlineAndContinuation(bool b) {
1931 m_bitfields.setContainsInlineWithOutlineAndContinuation(b); 1923 m_bitfields.setContainsInlineWithOutlineAndContinuation(b);
1932 } 1924 }
1933 1925
1934 private: 1926 private:
1935 // Adjusts a visual rect in the space of |m_previousVisualRect| and 1927 // Adjusts a visual rect in the space of |m_previousVisualRect| to be in the
1936 // |m_previousPositionFromPaintInvalidationBacking| to be in the space of the 1928 // space of the |paintInvalidationContainer|, if needed. They can be different
1937 // |paintInvalidationContainer|, if needed. They can be different only if 1929 // only if |paintInvalidationContainer| is a composited scroller.
1938 // |paintInvalidationContainer| is a composited scroller.
1939 void adjustVisualRectForCompositedScrolling( 1930 void adjustVisualRectForCompositedScrolling(
1940 LayoutRect&, 1931 LayoutRect&,
1941 const LayoutBoxModelObject& paintInvalidationContainer) const; 1932 const LayoutBoxModelObject& paintInvalidationContainer) const;
1942 1933
1943 void clearLayoutRootIfNeeded() const; 1934 void clearLayoutRootIfNeeded() const;
1944 1935
1945 bool isInert() const; 1936 bool isInert() const;
1946 1937
1947 void updateImage(StyleImage*, StyleImage*); 1938 void updateImage(StyleImage*, StyleImage*);
1948 1939
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 m_notifiedOfSubtreeChange(false), 2078 m_notifiedOfSubtreeChange(false),
2088 m_consumesSubtreeChangeNotification(false), 2079 m_consumesSubtreeChangeNotification(false),
2089 m_childrenInline(false), 2080 m_childrenInline(false),
2090 m_containsInlineWithOutlineAndContinuation(false), 2081 m_containsInlineWithOutlineAndContinuation(false),
2091 m_alwaysCreateLineBoxesForLayoutInline(false), 2082 m_alwaysCreateLineBoxesForLayoutInline(false),
2092 m_previousBackgroundObscured(false), 2083 m_previousBackgroundObscured(false),
2093 m_isBackgroundAttachmentFixedObject(false), 2084 m_isBackgroundAttachmentFixedObject(false),
2094 m_isScrollAnchorObject(false), 2085 m_isScrollAnchorObject(false),
2095 m_scrollAnchorDisablingStyleChanged(false), 2086 m_scrollAnchorDisablingStyleChanged(false),
2096 m_hasBoxDecorationBackground(false), 2087 m_hasBoxDecorationBackground(false),
2088 m_hasPreviousLocationInBacking(false),
2097 m_positionedState(IsStaticallyPositioned), 2089 m_positionedState(IsStaticallyPositioned),
2098 m_selectionState(SelectionNone), 2090 m_selectionState(SelectionNone),
2099 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2091 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2100 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2092 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2101 2093
2102 // 32 bits have been used in the first word, and 19 in the second. 2094 // 32 bits have been used in the first word, and 20 in the second.
2103 2095
2104 // Self needs layout means that this layout object is marked for a full 2096 // Self needs layout means that this layout object is marked for a full
2105 // layout. This is the default layout but it is expensive as it recomputes 2097 // layout. This is the default layout but it is expensive as it recomputes
2106 // everything. For CSS boxes, this includes the width (laying out the line 2098 // everything. For CSS boxes, this includes the width (laying out the line
2107 // boxes again), the margins (due to block collapsing margins), the 2099 // boxes again), the margins (due to block collapsing margins), the
2108 // positions, the height and the potential overflow. 2100 // positions, the height and the potential overflow.
2109 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 2101 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
2110 2102
2111 // A positioned movement layout is a specialized type of layout used on 2103 // A positioned movement layout is a specialized type of layout used on
2112 // positioned objects that only visually moved. This layout is used when 2104 // positioned objects that only visually moved. This layout is used when
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 // layout should suppress any adjustments that would be made during the next 2243 // layout should suppress any adjustments that would be made during the next
2252 // layout by ScrollAnchor objects for which this LayoutObject is on the path 2244 // layout by ScrollAnchor objects for which this LayoutObject is on the path
2253 // from the anchor node to the scroller. 2245 // from the anchor node to the scroller.
2254 // See http://bit.ly/sanaclap for more info. 2246 // See http://bit.ly/sanaclap for more info.
2255 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, 2247 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged,
2256 ScrollAnchorDisablingStyleChanged); 2248 ScrollAnchorDisablingStyleChanged);
2257 2249
2258 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, 2250 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground,
2259 HasBoxDecorationBackground); 2251 HasBoxDecorationBackground);
2260 2252
2253 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking,
2254 HasPreviousLocationInBacking);
2255
2261 private: 2256 private:
2262 // This is the cached 'position' value of this object 2257 // This is the cached 'position' value of this object
2263 // (see ComputedStyle::position). 2258 // (see ComputedStyle::position).
2264 unsigned m_positionedState : 2; // PositionedState 2259 unsigned m_positionedState : 2; // PositionedState
2265 unsigned m_selectionState : 3; // SelectionState 2260 unsigned m_selectionState : 3; // SelectionState
2266 // Mutable for getter which lazily update this field. 2261 // Mutable for getter which lazily update this field.
2267 mutable unsigned 2262 mutable unsigned
2268 m_backgroundObscurationState : 2; // BackgroundObscurationState 2263 m_backgroundObscurationState : 2; // BackgroundObscurationState
2269 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2264 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
2270 2265
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 } 2337 }
2343 2338
2344 private: 2339 private:
2345 // Store state between styleWillChange and styleDidChange 2340 // Store state between styleWillChange and styleDidChange
2346 static bool s_affectsParentBlock; 2341 static bool s_affectsParentBlock;
2347 2342
2348 // This stores the visual rect from the previous frame. This rect does *not* 2343 // This stores the visual rect from the previous frame. This rect does *not*
2349 // account for composited scrolling. See 2344 // account for composited scrolling. See
2350 // adjustVisualRectForCompositedScrolling(). 2345 // adjustVisualRectForCompositedScrolling().
2351 LayoutRect m_previousVisualRect; 2346 LayoutRect m_previousVisualRect;
2352
2353 // This stores the position in the paint invalidation backing's coordinate.
2354 // It is used to detect layoutObject shifts that forces a full invalidation.
2355 // This point does *not* account for composited scrolling. See
2356 // adjustInvalidationRectForCompositedScrolling().
2357 LayoutPoint m_previousPositionFromPaintInvalidationBacking;
2358 }; 2347 };
2359 2348
2360 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer 2349 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer
2361 // hit. 2350 // hit.
2362 class DeprecatedDisableModifyLayoutTreeStructureAsserts { 2351 class DeprecatedDisableModifyLayoutTreeStructureAsserts {
2363 STACK_ALLOCATED(); 2352 STACK_ALLOCATED();
2364 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); 2353 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts);
2365 2354
2366 public: 2355 public:
2367 DeprecatedDisableModifyLayoutTreeStructureAsserts(); 2356 DeprecatedDisableModifyLayoutTreeStructureAsserts();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2558 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2570 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2559 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2571 // We don't make object2 an optional parameter so that showLayoutTree 2560 // We don't make object2 an optional parameter so that showLayoutTree
2572 // can be called from gdb easily. 2561 // can be called from gdb easily.
2573 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2562 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2574 const blink::LayoutObject* object2); 2563 const blink::LayoutObject* object2);
2575 2564
2576 #endif 2565 #endif
2577 2566
2578 #endif // LayoutObject_h 2567 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.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