Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 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) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 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 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1591 return "invalidate paint rectangle"; | 1591 return "invalidate paint rectangle"; |
| 1592 } | 1592 } |
| 1593 ASSERT_NOT_REACHED(); | 1593 ASSERT_NOT_REACHED(); |
| 1594 return ""; | 1594 return ""; |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) | 1597 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) |
| 1598 { | 1598 { |
| 1599 // If we didn't need paint invalidation then our children don't need as well . | 1599 // If we didn't need paint invalidation then our children don't need as well . |
| 1600 // Skip walking down the tree as everything should be fine below us. | 1600 // Skip walking down the tree as everything should be fine below us. |
| 1601 if (!shouldCheckForPaintInvalidation()) | 1601 if (!shouldCheckForSelfOrChildPaintInvalidation()) |
| 1602 return; | 1602 return; |
| 1603 | 1603 |
| 1604 clearPaintInvalidationState(); | 1604 clearPaintInvalidationState(); |
| 1605 | 1605 |
| 1606 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | 1606 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { |
| 1607 if (!child->isOutOfFlowPositioned()) | 1607 if (!child->isOutOfFlowPositioned()) |
| 1608 child->invalidateTreeIfNeeded(paintInvalidationState); | 1608 child->invalidateTreeIfNeeded(paintInvalidationState); |
| 1609 } | 1609 } |
| 1610 } | 1610 } |
| 1611 | 1611 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2048 setNeedsLayoutAndPrefWidthsRecalc(); | 2048 setNeedsLayoutAndPrefWidthsRecalc(); |
| 2049 else if (updatedDiff.needsPositionedMovementLayout()) | 2049 else if (updatedDiff.needsPositionedMovementLayout()) |
| 2050 setNeedsPositionedMovementLayout(); | 2050 setNeedsPositionedMovementLayout(); |
| 2051 } | 2051 } |
| 2052 | 2052 |
| 2053 if (diff.transformChanged() && !needsLayout()) { | 2053 if (diff.transformChanged() && !needsLayout()) { |
| 2054 if (RenderBlock* container = containingBlock()) | 2054 if (RenderBlock* container = containingBlock()) |
| 2055 container->setNeedsOverflowRecalcAfterStyleChange(); | 2055 container->setNeedsOverflowRecalcAfterStyleChange(); |
| 2056 } | 2056 } |
| 2057 | 2057 |
| 2058 if (updatedDiff.needsRepaint()) { | 2058 // FIXME: Should invalidate whole layer if updatedDiff.needsRepaintLayer(). crbug.com/394050. |
| 2059 // Invalidate paints with the new style, e.g., for example if we go from not having | 2059 if (diff.needsRepaintObject() || updatedDiff.needsRepaint()) { |
| 2060 // an outline to having an outline. | 2060 // FIXME: For objects that don't save previousPaintInvalidationRect, we still need |
| 2061 | 2061 // to invalidate now because their invalidateTreeIfNeeded won't invalida te themselves. |
| 2062 // The paintInvalidationForWholeRenderer() call is needed for non-layout changes to style. See the corresponding | 2062 // crbug.com/394133. |
| 2063 // comment in RenderObject::styleWillChange for why. | 2063 // FIXME: Test of parentTransformDidChange in RenderSVGModelObject::inva lidateTreeIfNeeded() |
| 2064 if (needsLayout()) | 2064 // prevents SVG objects from using unified invalidation for repaint-only style change. |
| 2065 // crbug.com/394619. | |
| 2066 if (needsLayout() || (canSelfInvalidateDuringTreeInvalidation() && !isSV G())) | |
| 2065 setShouldDoFullPaintInvalidation(true); | 2067 setShouldDoFullPaintInvalidation(true); |
| 2066 else if (!selfNeedsLayout()) | 2068 else |
| 2067 paintInvalidationForWholeRenderer(); | 2069 paintInvalidationForWholeRenderer(); |
| 2068 } | 2070 } |
| 2069 } | 2071 } |
| 2070 | 2072 |
| 2071 static inline bool rendererHasBackground(const RenderObject* renderer) | 2073 static inline bool rendererHasBackground(const RenderObject* renderer) |
| 2072 { | 2074 { |
| 2073 return renderer && renderer->hasBackground(); | 2075 return renderer && renderer->hasBackground(); |
| 2074 } | 2076 } |
| 2075 | 2077 |
| 2076 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) | 2078 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2092 // We might not have an enclosing layer yet because we might not be in the tree. | 2094 // We might not have an enclosing layer yet because we might not be in the tree. |
| 2093 if (RenderLayer* layer = enclosingLayer()) { | 2095 if (RenderLayer* layer = enclosingLayer()) { |
| 2094 if (newStyle.visibility() == VISIBLE) { | 2096 if (newStyle.visibility() == VISIBLE) { |
| 2095 layer->setHasVisibleContent(); | 2097 layer->setHasVisibleContent(); |
| 2096 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { | 2098 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { |
| 2097 layer->dirtyVisibleContentStatus(); | 2099 layer->dirtyVisibleContentStatus(); |
| 2098 } | 2100 } |
| 2099 } | 2101 } |
| 2100 } | 2102 } |
| 2101 | 2103 |
| 2102 // For style-only changes that need paint invalidation, we currently nee d to issue a paint invalidation before and after the style | |
| 2103 // change. The paint invalidation before style change is accomplished he re. The paint invalidation after style change is accomplished | |
| 2104 // in RenderObject::setStyle. | |
| 2105 if (m_parent && diff.needsRepaintObject()) { | 2104 if (m_parent && diff.needsRepaintObject()) { |
| 2106 if (!diff.needsLayout() && !needsLayout()) | 2105 if (!diff.needsLayout() && !needsLayout()) { |
| 2107 paintInvalidationForWholeRenderer(); | 2106 // Invalidate before style change. |
| 2107 // FIXME: See FIXMEs in setStyle() before calling paintInvalidat ionForWholeRenderer | |
| 2108 // for the reason of this paintInvalidationForWholeRenderer. | |
| 2109 if (!canSelfInvalidateDuringTreeInvalidation() || isSVG()) | |
| 2110 paintInvalidationForWholeRenderer(); | |
| 2111 } | |
| 2108 } | 2112 } |
| 2109 | 2113 |
| 2110 if (isFloating() && (m_style->floating() != newStyle.floating())) | 2114 if (isFloating() && (m_style->floating() != newStyle.floating())) |
| 2111 // For changes in float styles, we need to conceivably remove oursel ves | 2115 // For changes in float styles, we need to conceivably remove oursel ves |
| 2112 // from the floating objects list. | 2116 // from the floating objects list. |
| 2113 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2117 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
| 2114 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) | 2118 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) |
| 2115 // For changes in positioning styles, we need to conceivably remove ourselves | 2119 // For changes in positioning styles, we need to conceivably remove ourselves |
| 2116 // from the positioned objects list. | 2120 // from the positioned objects list. |
| 2117 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2121 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3387 { | 3391 { |
| 3388 ASSERT_NOT_REACHED(); | 3392 ASSERT_NOT_REACHED(); |
| 3389 return false; | 3393 return false; |
| 3390 } | 3394 } |
| 3391 | 3395 |
| 3392 bool RenderObject::isRelayoutBoundaryForInspector() const | 3396 bool RenderObject::isRelayoutBoundaryForInspector() const |
| 3393 { | 3397 { |
| 3394 return objectIsRelayoutBoundary(this); | 3398 return objectIsRelayoutBoundary(this); |
| 3395 } | 3399 } |
| 3396 | 3400 |
| 3401 void RenderObject::setShouldDoFullPaintInvalidation(bool b) | |
|
Julien - ping for review
2014/07/18 18:49:44
I really think we should split the setting from th
| |
| 3402 { | |
| 3403 m_bitfields.setShouldDoFullPaintInvalidation(b); | |
| 3404 if (!b) | |
| 3405 return; | |
| 3406 | |
| 3407 // Make sure our parent is marked so that the next invalidateTreeIfNeeded ca n reach this object. | |
| 3408 for (RenderObject* p = parent(); p && !p->shouldCheckForSelfOrChildPaintInva lidation(); p = p->parent()) | |
|
Julien - ping for review
2014/07/18 18:49:44
This is wrong for 2 reasons:
- We shouldn't walk t
| |
| 3409 p->setChildNeedsPaintInvalidation(true); | |
| 3410 } | |
| 3411 | |
| 3397 void RenderObject::clearPaintInvalidationState() | 3412 void RenderObject::clearPaintInvalidationState() |
| 3398 { | 3413 { |
| 3399 setShouldDoFullPaintInvalidation(false); | 3414 setShouldDoFullPaintInvalidation(false); |
| 3400 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); | 3415 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); |
| 3401 setOnlyNeededPositionedMovementLayout(false); | 3416 setOnlyNeededPositionedMovementLayout(false); |
| 3402 setNeededLayoutBecauseOfChildren(false); | 3417 setNeededLayoutBecauseOfChildren(false); |
| 3403 setShouldInvalidateOverflowForPaint(false); | 3418 setShouldInvalidateOverflowForPaint(false); |
| 3404 setLayoutDidGetCalled(false); | 3419 setLayoutDidGetCalled(false); |
| 3405 setMayNeedPaintInvalidation(false); | 3420 setMayNeedPaintInvalidation(false); |
| 3421 setChildNeedsPaintInvalidation(false); | |
| 3406 } | 3422 } |
| 3407 | 3423 |
| 3408 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) | 3424 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) |
| 3409 { | 3425 { |
| 3410 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState() | 3426 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState() |
| 3411 || document.lifecycle().stateAllowsRenderTreeMutations(); | 3427 || document.lifecycle().stateAllowsRenderTreeMutations(); |
| 3412 } | 3428 } |
| 3413 | 3429 |
| 3414 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts() | 3430 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts() |
| 3415 : m_disabler(gModifyRenderTreeStructureAnyState, true) | 3431 : m_disabler(gModifyRenderTreeStructureAnyState, true) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3446 { | 3462 { |
| 3447 if (object1) { | 3463 if (object1) { |
| 3448 const WebCore::RenderObject* root = object1; | 3464 const WebCore::RenderObject* root = object1; |
| 3449 while (root->parent()) | 3465 while (root->parent()) |
| 3450 root = root->parent(); | 3466 root = root->parent(); |
| 3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3467 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3452 } | 3468 } |
| 3453 } | 3469 } |
| 3454 | 3470 |
| 3455 #endif | 3471 #endif |
| OLD | NEW |