OLD | NEW |
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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 { | 1165 { |
1166 ASSERT(!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); | 1166 ASSERT(!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); |
1167 m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvali
dationBacking; | 1167 m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvali
dationBacking; |
1168 } | 1168 } |
1169 | 1169 |
1170 bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const | 1170 bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const |
1171 { | 1171 { |
1172 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); | 1172 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); |
1173 return m_previousPositionFromPaintInvalidationBacking != uninitializedPa
intOffset() && m_previousPositionFromPaintInvalidationBacking != newPaintOffset; | 1173 return m_previousPositionFromPaintInvalidationBacking != uninitializedPa
intOffset() && m_previousPositionFromPaintInvalidationBacking != newPaintOffset; |
1174 } | 1174 } |
1175 void setPreviousPaintOffset(const LayoutPoint& paintOffset) const | 1175 void setPreviousPaintOffset(const LayoutPoint& paintOffset) |
1176 { | 1176 { |
1177 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); | 1177 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); |
1178 m_previousPositionFromPaintInvalidationBacking = paintOffset; | 1178 m_previousPositionFromPaintInvalidationBacking = paintOffset; |
1179 } | 1179 } |
1180 | 1180 |
1181 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi
elds.fullPaintInvalidationReason(); } | 1181 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi
elds.fullPaintInvalidationReason(); } |
1182 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv
alidationReason() != PaintInvalidationNone; } | 1182 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv
alidationReason() != PaintInvalidationNone; } |
1183 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid
ationFull); | 1183 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid
ationFull); |
1184 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida
tionReason(PaintInvalidationNone); } | 1184 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida
tionReason(PaintInvalidationNone); } |
1185 | 1185 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 // to invalidate its descendants which are painted on the same backing. Howe
ver, for | 1220 // to invalidate its descendants which are painted on the same backing. Howe
ver, for |
1221 // an object (e.g. LayoutScrollbarPart, custom scroll corner, custom resizer
) which is | 1221 // an object (e.g. LayoutScrollbarPart, custom scroll corner, custom resizer
) which is |
1222 // not hooked up in the layout tree and not able to find its paint backing,
it should | 1222 // not hooked up in the layout tree and not able to find its paint backing,
it should |
1223 // let its owning layout object call the following function. | 1223 // let its owning layout object call the following function. |
1224 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48
4263. | 1224 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48
4263. |
1225 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO
bject&) const; | 1225 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO
bject&) const; |
1226 | 1226 |
1227 // Called before anonymousChild.setStyle(). Override to set custom styles fo
r the child. | 1227 // Called before anonymousChild.setStyle(). Override to set custom styles fo
r the child. |
1228 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C
omputedStyle& style) const { } | 1228 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C
omputedStyle& style) const { } |
1229 | 1229 |
| 1230 // Painters can use const methods only, except for these explicitly declared
methods. |
| 1231 class MutableForPainting { |
| 1232 public: |
| 1233 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb
ject.setPreviousPaintOffset(paintOffset); } |
| 1234 void invalidatePaintIfNeeded(const PaintInfo& paintInfo) { m_layoutObjec
t.invalidatePaintIfNeededForSynchronizedPainting(paintInfo); } |
| 1235 |
| 1236 private: |
| 1237 friend class LayoutObject; |
| 1238 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co
nst_cast<LayoutObject&>(layoutObject)) { } |
| 1239 |
| 1240 LayoutObject& m_layoutObject; |
| 1241 }; |
| 1242 MutableForPainting mutableForPainting() const { return MutableForPainting(*t
his); } |
| 1243 |
1230 protected: | 1244 protected: |
1231 enum LayoutObjectType { | 1245 enum LayoutObjectType { |
1232 LayoutObjectBr, | 1246 LayoutObjectBr, |
1233 LayoutObjectCanvas, | 1247 LayoutObjectCanvas, |
1234 LayoutObjectFieldset, | 1248 LayoutObjectFieldset, |
1235 LayoutObjectCounter, | 1249 LayoutObjectCounter, |
1236 LayoutObjectDetailsMarker, | 1250 LayoutObjectDetailsMarker, |
1237 LayoutObjectEmbeddedObject, | 1251 LayoutObjectEmbeddedObject, |
1238 LayoutObjectFileUploadControl, | 1252 LayoutObjectFileUploadControl, |
1239 LayoutObjectFrame, | 1253 LayoutObjectFrame, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 | 1365 |
1352 #if ENABLE(ASSERT) | 1366 #if ENABLE(ASSERT) |
1353 virtual bool paintInvalidationStateIsDirty() const | 1367 virtual bool paintInvalidationStateIsDirty() const |
1354 { | 1368 { |
1355 return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPain
tInvalidationRegardlessOfPaintInvalidationState(); | 1369 return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPain
tInvalidationRegardlessOfPaintInvalidationState(); |
1356 } | 1370 } |
1357 #endif | 1371 #endif |
1358 | 1372 |
1359 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child
PaintInvalidationState); | 1373 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child
PaintInvalidationState); |
1360 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta
te&, const LayoutBoxModelObject& paintInvalidationContainer); | 1374 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta
te&, const LayoutBoxModelObject& paintInvalidationContainer); |
| 1375 void invalidatePaintIfNeededForSynchronizedPainting(const PaintInfo&); |
1361 | 1376 |
1362 // When this object is invalidated for paint, this method is called to inval
idate any DisplayItemClients | 1377 // When this object is invalidated for paint, this method is called to inval
idate any DisplayItemClients |
1363 // owned by this object, including the object itself, LayoutText/LayoutInlin
e line boxes, etc., | 1378 // owned by this object, including the object itself, LayoutText/LayoutInlin
e line boxes, etc., |
1364 // not including children which will be invalidated normally during invalida
teTreeIfNeeded() and | 1379 // not including children which will be invalidated normally during invalida
teTreeIfNeeded() and |
1365 // parts which are invalidated separately (e.g. scrollbars). | 1380 // parts which are invalidated separately (e.g. scrollbars). |
1366 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI
nvalidationContainer, PaintInvalidationReason, const LayoutRect& previousPaintIn
validationRect, const LayoutRect& newPaintInvalidationRect) const; | 1381 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI
nvalidationContainer, PaintInvalidationReason, const LayoutRect& previousPaintIn
validationRect, const LayoutRect& newPaintInvalidationRect) const; |
1367 | 1382 |
1368 void setIsSlowRepaintObject(bool); | 1383 void setIsSlowRepaintObject(bool); |
1369 | 1384 |
1370 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee
dsOverflowRecalcAfterStyleChange(false); } | 1385 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee
dsOverflowRecalcAfterStyleChange(false); } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 | 1730 |
1716 // This stores the paint invalidation rect from the previous frame. This rec
t does *not* account for composited scrolling. See | 1731 // This stores the paint invalidation rect from the previous frame. This rec
t does *not* account for composited scrolling. See |
1717 // adjustInvalidationRectForCompositedScrolling(). | 1732 // adjustInvalidationRectForCompositedScrolling(). |
1718 LayoutRect m_previousPaintInvalidationRect; | 1733 LayoutRect m_previousPaintInvalidationRect; |
1719 | 1734 |
1720 // This stores the position in the paint invalidation backing's coordinate. | 1735 // This stores the position in the paint invalidation backing's coordinate. |
1721 // It is used to detect layoutObject shifts that forces a full invalidation. | 1736 // It is used to detect layoutObject shifts that forces a full invalidation. |
1722 // This point does *not* account for composited scrolling. See adjustInvalid
ationRectForCompositedScrolling(). | 1737 // This point does *not* account for composited scrolling. See adjustInvalid
ationRectForCompositedScrolling(). |
1723 // For slimmingPaintOffsetCaching, this stores the previous paint offset. | 1738 // For slimmingPaintOffsetCaching, this stores the previous paint offset. |
1724 // TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable sl
immingPaintOffsetCaching. | 1739 // TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable sl
immingPaintOffsetCaching. |
1725 // TODO(wangxianzhu): Better mutation control for painting. | 1740 LayoutPoint m_previousPositionFromPaintInvalidationBacking; |
1726 mutable LayoutPoint m_previousPositionFromPaintInvalidationBacking; | |
1727 }; | 1741 }; |
1728 | 1742 |
1729 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit
. | 1743 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit
. |
1730 class DeprecatedDisableModifyLayoutTreeStructureAsserts { | 1744 class DeprecatedDisableModifyLayoutTreeStructureAsserts { |
1731 STACK_ALLOCATED(); | 1745 STACK_ALLOCATED(); |
1732 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); | 1746 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); |
1733 public: | 1747 public: |
1734 DeprecatedDisableModifyLayoutTreeStructureAsserts(); | 1748 DeprecatedDisableModifyLayoutTreeStructureAsserts(); |
1735 | 1749 |
1736 static bool canModifyLayoutTreeStateInAnyState(); | 1750 static bool canModifyLayoutTreeStateInAnyState(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 void showTree(const blink::LayoutObject*); | 1969 void showTree(const blink::LayoutObject*); |
1956 void showLineTree(const blink::LayoutObject*); | 1970 void showLineTree(const blink::LayoutObject*); |
1957 void showLayoutTree(const blink::LayoutObject* object1); | 1971 void showLayoutTree(const blink::LayoutObject* object1); |
1958 // We don't make object2 an optional parameter so that showLayoutTree | 1972 // We don't make object2 an optional parameter so that showLayoutTree |
1959 // can be called from gdb easily. | 1973 // can be called from gdb easily. |
1960 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); | 1974 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); |
1961 | 1975 |
1962 #endif | 1976 #endif |
1963 | 1977 |
1964 #endif // LayoutObject_h | 1978 #endif // LayoutObject_h |
OLD | NEW |