Chromium Code Reviews| 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1121 | 1121 |
| 1122 bool isPaintInvalidationContainer() const; | 1122 bool isPaintInvalidationContainer() const; |
| 1123 | 1123 |
| 1124 // Actually do the paint invalidate of rect r for this object which has been computed in the coordinate space | 1124 // Actually do the paint invalidate of rect r for this object which has been computed in the coordinate space |
| 1125 // of the GraphicsLayer backing of |paintInvalidationContainer|. Note that t his coordinaten space is not the same | 1125 // of the GraphicsLayer backing of |paintInvalidationContainer|. Note that t his coordinaten space is not the same |
| 1126 // as the local coordinate space of |paintInvalidationContainer| in the pres ence of layer squashing. | 1126 // as the local coordinate space of |paintInvalidationContainer| in the pres ence of layer squashing. |
| 1127 void invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalida tionContainer, const LayoutRect&, PaintInvalidationReason) const; | 1127 void invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalida tionContainer, const LayoutRect&, PaintInvalidationReason) const; |
| 1128 | 1128 |
| 1129 // Invalidate the paint of a specific subrectangle within a given object. Th e rect is in the object's coordinate space. | 1129 // Invalidate the paint of a specific subrectangle within a given object. Th e rect is in the object's coordinate space. |
| 1130 void invalidatePaintRectangle(const LayoutRect&) const; | 1130 void invalidatePaintRectangle(const LayoutRect&) const; |
| 1131 void invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutR ect&) const; | |
| 1132 | 1131 |
| 1133 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state. | 1132 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state. |
| 1134 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); | 1133 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); |
| 1135 | 1134 |
| 1136 // This function only invalidates the visual overflow. | 1135 // This function only invalidates the visual overflow. |
| 1137 // | 1136 // |
| 1138 // Note that overflow is a box concept but this function | 1137 // Note that overflow is a box concept but this function |
| 1139 // is only supported for block-flow. | 1138 // is only supported for block-flow. |
| 1140 virtual void invalidatePaintForOverflow(); | 1139 virtual void invalidatePaintForOverflow(); |
| 1141 void invalidatePaintForOverflowIfNeeded(); | 1140 void invalidatePaintForOverflowIfNeeded(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 || shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState (); | 1368 || shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState (); |
| 1370 } | 1369 } |
| 1371 | 1370 |
| 1372 bool shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() con st | 1371 bool shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() con st |
| 1373 { | 1372 { |
| 1374 return mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation() || shouldInvalidateSelection() || m_bitfields.childShouldCheckForPaintInvalidation( ); | 1373 return mayNeedPaintInvalidation() || shouldDoFullPaintInvalidation() || shouldInvalidateSelection() || m_bitfields.childShouldCheckForPaintInvalidation( ); |
| 1375 } | 1374 } |
| 1376 | 1375 |
| 1377 virtual LayoutRect viewRect() const; | 1376 virtual LayoutRect viewRect() const; |
| 1378 | 1377 |
| 1379 void invalidateDisplayItemClient(const DisplayItemClient&) const; | 1378 // TODO(wangxianzhu): Change the call sites to use the faster version if pos sible. |
| 1380 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(const La youtBoxModelObject* paintInvalidationContainer, PaintInvalidationReason) const; | 1379 void slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(const Di splayItemClient& client, PaintInvalidationReason reason) const |
| 1380 { | |
| 1381 slowSetPaintingLayerNeedsRepaint(); | |
|
chrishtr
2016/06/13 20:18:52
Document why it's slow.
Xianzhu
2016/06/13 20:52:01
Done.
| |
| 1382 invalidateDisplayItemClient(client, reason); | |
| 1383 } | |
| 1384 | |
| 1385 // The caller should ensure the painting layer has been setNeedsRepaint befo re calling this function. | |
| 1386 void invalidateDisplayItemClient(const DisplayItemClient&, PaintInvalidation Reason) const; | |
| 1387 | |
| 1388 // Sets painting layer needsRepaint, then calls invaldiateDisplayItemClient( ). | |
| 1389 // Should use this version when PaintInvalidationState is available. | |
| 1390 void invalidateDisplayItemClientWithPaintInvalidationState(const PaintInvali dationState&, const DisplayItemClient&, PaintInvalidationReason) const; | |
| 1391 | |
| 1392 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(PaintInv alidationReason) const; | |
| 1381 | 1393 |
| 1382 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. | 1394 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. |
| 1383 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } | 1395 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } |
| 1384 | 1396 |
| 1385 // Painters can use const methods only, except for these explicitly declared methods. | 1397 // Painters can use const methods only, except for these explicitly declared methods. |
| 1386 class MutableForPainting { | 1398 class MutableForPainting { |
| 1387 public: | 1399 public: |
| 1388 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } | 1400 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } |
| 1389 ObjectPaintProperties& ensureObjectPaintProperties() { return m_layoutOb ject.ensureObjectPaintProperties(); } | 1401 ObjectPaintProperties& ensureObjectPaintProperties() { return m_layoutOb ject.ensureObjectPaintProperties(); } |
| 1390 void clearObjectPaintProperties() { m_layoutObject.clearObjectPaintPrope rties(); } | 1402 void clearObjectPaintProperties() { m_layoutObject.clearObjectPaintPrope rties(); } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 // This function generates the invalidation for this object only. | 1580 // This function generates the invalidation for this object only. |
| 1569 // It doesn't recurse into other object, as this is handled | 1581 // It doesn't recurse into other object, as this is handled |
| 1570 // by invalidatePaintOfSubtreesIfNeeded. | 1582 // by invalidatePaintOfSubtreesIfNeeded. |
| 1571 virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidat ionState&); | 1583 virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidat ionState&); |
| 1572 | 1584 |
| 1573 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients | 1585 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients |
| 1574 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc., | 1586 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc., |
| 1575 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and | 1587 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and |
| 1576 // parts which are invalidated separately (e.g. scrollbars). | 1588 // parts which are invalidated separately (e.g. scrollbars). |
| 1577 // The caller should ensure the painting layer has been setNeedsRepaint befo re calling this function. | 1589 // The caller should ensure the painting layer has been setNeedsRepaint befo re calling this function. |
| 1578 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer, PaintInvalidationReason) const; | 1590 virtual void invalidateDisplayItemClients(PaintInvalidationReason) const; |
| 1579 | 1591 |
| 1580 // If possible, use the faster paintInvalidationState.paintingLayer().setNee dsRepaint(). | 1592 // If possible, use the faster paintInvalidationState.paintingLayer().setNee dsRepaint(). |
| 1581 void setPaintingLayerNeedsRepaint() const; | 1593 void slowSetPaintingLayerNeedsRepaint() const; |
| 1582 | 1594 |
| 1583 // Sets enclosing layer needsRepaint, then calls invalidateDisplayItemClient s(). | 1595 // Sets painting layer needsRepaint, then calls invalidateDisplayItemClients (). |
| 1584 // Should use this version when PaintInvalidationState is available. | 1596 // Should use this version when PaintInvalidationState is available. |
| 1585 void invalidateDisplayItemClientsWithPaintInvalidationState(const LayoutBoxM odelObject& paintInvalidationContainer, const PaintInvalidationState&, PaintInva lidationReason) const; | 1597 void invalidateDisplayItemClientsWithPaintInvalidationState(const PaintInval idationState&, PaintInvalidationReason) const; |
| 1586 | 1598 |
| 1587 void setIsBackgroundAttachmentFixedObject(bool); | 1599 void setIsBackgroundAttachmentFixedObject(bool); |
| 1588 | 1600 |
| 1589 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee dsOverflowRecalcAfterStyleChange(false); } | 1601 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee dsOverflowRecalcAfterStyleChange(false); } |
| 1590 void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidate OverflowForPaint(true); } | 1602 void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidate OverflowForPaint(true); } |
| 1591 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } | 1603 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } |
| 1592 | 1604 |
| 1593 // Remove this object and all descendants from the containing LayoutFlowThre ad. | 1605 // Remove this object and all descendants from the containing LayoutFlowThre ad. |
| 1594 void removeFromLayoutFlowThread(); | 1606 void removeFromLayoutFlowThread(); |
| 1595 | 1607 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1657 void removeShapeImageClient(ShapeValue*); | 1669 void removeShapeImageClient(ShapeValue*); |
| 1658 | 1670 |
| 1659 #if ENABLE(ASSERT) | 1671 #if ENABLE(ASSERT) |
| 1660 void checkBlockPositionedObjectsNeedLayout(); | 1672 void checkBlockPositionedObjectsNeedLayout(); |
| 1661 #endif | 1673 #endif |
| 1662 | 1674 |
| 1663 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; } | 1675 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; } |
| 1664 | 1676 |
| 1665 static bool isAllowedToModifyLayoutTreeStructure(Document&); | 1677 static bool isAllowedToModifyLayoutTreeStructure(Document&); |
| 1666 | 1678 |
| 1667 // The passed rect is mutated into the coordinate space of the paint invalid ation container. | |
| 1668 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const; | |
| 1669 | |
| 1670 // Returns the parent for paint invalidation. | 1679 // Returns the parent for paint invalidation. |
| 1671 // - For LayoutView, returns the owner layout object in the containing frame if any or nullptr; | 1680 // - For LayoutView, returns the owner layout object in the containing frame if any or nullptr; |
| 1672 // - For multi-column spanner, returns the spanner placeholder; | 1681 // - For multi-column spanner, returns the spanner placeholder; |
| 1673 // - Otherwise returns parent(). | 1682 // - Otherwise returns parent(). |
| 1674 LayoutObject* paintInvalidationParent() const; | 1683 LayoutObject* paintInvalidationParent() const; |
| 1675 | 1684 |
| 1676 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); } | 1685 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); } |
| 1677 | 1686 |
| 1678 RefPtr<ComputedStyle> m_style; | 1687 RefPtr<ComputedStyle> m_style; |
| 1679 | 1688 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2192 void showTree(const blink::LayoutObject*); | 2201 void showTree(const blink::LayoutObject*); |
| 2193 void showLineTree(const blink::LayoutObject*); | 2202 void showLineTree(const blink::LayoutObject*); |
| 2194 void showLayoutTree(const blink::LayoutObject* object1); | 2203 void showLayoutTree(const blink::LayoutObject* object1); |
| 2195 // We don't make object2 an optional parameter so that showLayoutTree | 2204 // We don't make object2 an optional parameter so that showLayoutTree |
| 2196 // can be called from gdb easily. | 2205 // can be called from gdb easily. |
| 2197 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); | 2206 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); |
| 2198 | 2207 |
| 2199 #endif | 2208 #endif |
| 2200 | 2209 |
| 2201 #endif // LayoutObject_h | 2210 #endif // LayoutObject_h |
| OLD | NEW |