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

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: doc 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 // ObjectPaintInvalidator will access the internal global map storing
1746 // previousLocationInBacking only when the flag is set, to avoid unnecessary
1747 // map lookups.
1748 bool hasPreviousLocationInBacking() const {
1749 return m_bitfields.hasPreviousLocationInBacking();
1750 }
1751
1757 protected: 1752 protected:
1758 enum LayoutObjectType { 1753 enum LayoutObjectType {
1759 LayoutObjectBr, 1754 LayoutObjectBr,
1760 LayoutObjectCanvas, 1755 LayoutObjectCanvas,
1761 LayoutObjectFieldset, 1756 LayoutObjectFieldset,
1762 LayoutObjectCounter, 1757 LayoutObjectCounter,
1763 LayoutObjectDetailsMarker, 1758 LayoutObjectDetailsMarker,
1764 LayoutObjectEmbeddedObject, 1759 LayoutObjectEmbeddedObject,
1765 LayoutObjectFileUploadControl, 1760 LayoutObjectFileUploadControl,
1766 LayoutObjectFrame, 1761 LayoutObjectFrame,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 void removeFromLayoutFlowThread(); 1920 void removeFromLayoutFlowThread();
1926 1921
1927 bool containsInlineWithOutlineAndContinuation() const { 1922 bool containsInlineWithOutlineAndContinuation() const {
1928 return m_bitfields.containsInlineWithOutlineAndContinuation(); 1923 return m_bitfields.containsInlineWithOutlineAndContinuation();
1929 } 1924 }
1930 void setContainsInlineWithOutlineAndContinuation(bool b) { 1925 void setContainsInlineWithOutlineAndContinuation(bool b) {
1931 m_bitfields.setContainsInlineWithOutlineAndContinuation(b); 1926 m_bitfields.setContainsInlineWithOutlineAndContinuation(b);
1932 } 1927 }
1933 1928
1934 private: 1929 private:
1935 // Adjusts a visual rect in the space of |m_previousVisualRect| and 1930 // Adjusts a visual rect in the space of |m_previousVisualRect| to be in the
1936 // |m_previousPositionFromPaintInvalidationBacking| to be in the space of the 1931 // space of the |paintInvalidationContainer|, if needed. They can be different
1937 // |paintInvalidationContainer|, if needed. They can be different only if 1932 // only if |paintInvalidationContainer| is a composited scroller.
1938 // |paintInvalidationContainer| is a composited scroller.
1939 void adjustVisualRectForCompositedScrolling( 1933 void adjustVisualRectForCompositedScrolling(
1940 LayoutRect&, 1934 LayoutRect&,
1941 const LayoutBoxModelObject& paintInvalidationContainer) const; 1935 const LayoutBoxModelObject& paintInvalidationContainer) const;
1942 1936
1943 void clearLayoutRootIfNeeded() const; 1937 void clearLayoutRootIfNeeded() const;
1944 1938
1945 bool isInert() const; 1939 bool isInert() const;
1946 1940
1947 void updateImage(StyleImage*, StyleImage*); 1941 void updateImage(StyleImage*, StyleImage*);
1948 1942
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 m_notifiedOfSubtreeChange(false), 2081 m_notifiedOfSubtreeChange(false),
2088 m_consumesSubtreeChangeNotification(false), 2082 m_consumesSubtreeChangeNotification(false),
2089 m_childrenInline(false), 2083 m_childrenInline(false),
2090 m_containsInlineWithOutlineAndContinuation(false), 2084 m_containsInlineWithOutlineAndContinuation(false),
2091 m_alwaysCreateLineBoxesForLayoutInline(false), 2085 m_alwaysCreateLineBoxesForLayoutInline(false),
2092 m_previousBackgroundObscured(false), 2086 m_previousBackgroundObscured(false),
2093 m_isBackgroundAttachmentFixedObject(false), 2087 m_isBackgroundAttachmentFixedObject(false),
2094 m_isScrollAnchorObject(false), 2088 m_isScrollAnchorObject(false),
2095 m_scrollAnchorDisablingStyleChanged(false), 2089 m_scrollAnchorDisablingStyleChanged(false),
2096 m_hasBoxDecorationBackground(false), 2090 m_hasBoxDecorationBackground(false),
2091 m_hasPreviousLocationInBacking(false),
2097 m_positionedState(IsStaticallyPositioned), 2092 m_positionedState(IsStaticallyPositioned),
2098 m_selectionState(SelectionNone), 2093 m_selectionState(SelectionNone),
2099 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2094 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2100 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2095 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2101 2096
2102 // 32 bits have been used in the first word, and 19 in the second. 2097 // 32 bits have been used in the first word, and 20 in the second.
2103 2098
2104 // Self needs layout means that this layout object is marked for a full 2099 // 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 2100 // 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 2101 // everything. For CSS boxes, this includes the width (laying out the line
2107 // boxes again), the margins (due to block collapsing margins), the 2102 // boxes again), the margins (due to block collapsing margins), the
2108 // positions, the height and the potential overflow. 2103 // positions, the height and the potential overflow.
2109 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 2104 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
2110 2105
2111 // A positioned movement layout is a specialized type of layout used on 2106 // A positioned movement layout is a specialized type of layout used on
2112 // positioned objects that only visually moved. This layout is used when 2107 // 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 2246 // 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 2247 // layout by ScrollAnchor objects for which this LayoutObject is on the path
2253 // from the anchor node to the scroller. 2248 // from the anchor node to the scroller.
2254 // See http://bit.ly/sanaclap for more info. 2249 // See http://bit.ly/sanaclap for more info.
2255 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, 2250 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged,
2256 ScrollAnchorDisablingStyleChanged); 2251 ScrollAnchorDisablingStyleChanged);
2257 2252
2258 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, 2253 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground,
2259 HasBoxDecorationBackground); 2254 HasBoxDecorationBackground);
2260 2255
2256 ADD_BOOLEAN_BITFIELD(hasPreviousLocationInBacking,
2257 HasPreviousLocationInBacking);
2258
2261 private: 2259 private:
2262 // This is the cached 'position' value of this object 2260 // This is the cached 'position' value of this object
2263 // (see ComputedStyle::position). 2261 // (see ComputedStyle::position).
2264 unsigned m_positionedState : 2; // PositionedState 2262 unsigned m_positionedState : 2; // PositionedState
2265 unsigned m_selectionState : 3; // SelectionState 2263 unsigned m_selectionState : 3; // SelectionState
2266 // Mutable for getter which lazily update this field. 2264 // Mutable for getter which lazily update this field.
2267 mutable unsigned 2265 mutable unsigned
2268 m_backgroundObscurationState : 2; // BackgroundObscurationState 2266 m_backgroundObscurationState : 2; // BackgroundObscurationState
2269 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2267 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
2270 2268
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 } 2340 }
2343 2341
2344 private: 2342 private:
2345 // Store state between styleWillChange and styleDidChange 2343 // Store state between styleWillChange and styleDidChange
2346 static bool s_affectsParentBlock; 2344 static bool s_affectsParentBlock;
2347 2345
2348 // This stores the visual rect from the previous frame. This rect does *not* 2346 // This stores the visual rect from the previous frame. This rect does *not*
2349 // account for composited scrolling. See 2347 // account for composited scrolling. See
2350 // adjustVisualRectForCompositedScrolling(). 2348 // adjustVisualRectForCompositedScrolling().
2351 LayoutRect m_previousVisualRect; 2349 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 }; 2350 };
2359 2351
2360 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer 2352 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer
2361 // hit. 2353 // hit.
2362 class DeprecatedDisableModifyLayoutTreeStructureAsserts { 2354 class DeprecatedDisableModifyLayoutTreeStructureAsserts {
2363 STACK_ALLOCATED(); 2355 STACK_ALLOCATED();
2364 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); 2356 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts);
2365 2357
2366 public: 2358 public:
2367 DeprecatedDisableModifyLayoutTreeStructureAsserts(); 2359 DeprecatedDisableModifyLayoutTreeStructureAsserts();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2561 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2570 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2562 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2571 // We don't make object2 an optional parameter so that showLayoutTree 2563 // We don't make object2 an optional parameter so that showLayoutTree
2572 // can be called from gdb easily. 2564 // can be called from gdb easily.
2573 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2565 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2574 const blink::LayoutObject* object2); 2566 const blink::LayoutObject* object2);
2575 2567
2576 #endif 2568 #endif
2577 2569
2578 #endif // LayoutObject_h 2570 #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