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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1524 if (!isRooted()) | 1524 if (!isRooted()) |
1525 return; | 1525 return; |
1526 | 1526 |
1527 if (view()->document().printing()) | 1527 if (view()->document().printing()) |
1528 return; // Don't invalidate paints if we're printing. | 1528 return; // Don't invalidate paints if we're printing. |
1529 | 1529 |
1530 // FIXME: really, we're in the paint invalidation phase here, and the follow ing queries are legal. | 1530 // FIXME: really, we're in the paint invalidation phase here, and the follow ing queries are legal. |
1531 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1531 // Until those states are fully fledged, I'll just disable the ASSERTS. |
1532 DisableCompositingQueryAsserts disabler; | 1532 DisableCompositingQueryAsserts disabler; |
1533 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation(); | 1533 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation(); |
1534 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidation(paintInval idationContainer); | 1534 |
1535 // FIXME: We should invalidate previousPaintInvalidationRect, but for object s that don't save previousPaintInvalidationRect, | |
1536 // we have to use the current paint invalidation rect. crbug.com/394133. | |
1537 LayoutRect paintInvalidationRect = savesPreviousPaintInvalidationRect() ? pr eviousPaintInvalidationRect() : boundsRectForPaintInvalidation(paintInvalidation Container); | |
1535 invalidatePaintUsingContainer(paintInvalidationContainer, paintInvalidationR ect, InvalidationPaint); | 1538 invalidatePaintUsingContainer(paintInvalidationContainer, paintInvalidationR ect, InvalidationPaint); |
1536 } | 1539 } |
1537 | 1540 |
1538 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const | 1541 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const |
1539 { | 1542 { |
1540 if (!paintInvalidationContainer) | 1543 if (!paintInvalidationContainer) |
1541 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); | 1544 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); |
1542 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont ainer->layer(), paintInvalidationState); | 1545 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont ainer->layer(), paintInvalidationState); |
1543 } | 1546 } |
1544 | 1547 |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2052 | 2055 |
2053 if (diff.transformChanged() && !needsLayout()) { | 2056 if (diff.transformChanged() && !needsLayout()) { |
2054 if (RenderBlock* container = containingBlock()) | 2057 if (RenderBlock* container = containingBlock()) |
2055 container->setNeedsOverflowRecalcAfterStyleChange(); | 2058 container->setNeedsOverflowRecalcAfterStyleChange(); |
2056 } | 2059 } |
2057 | 2060 |
2058 if (updatedDiff.needsRepaint()) { | 2061 if (updatedDiff.needsRepaint()) { |
2059 // Invalidate paints with the new style, e.g., for example if we go from not having | 2062 // Invalidate paints with the new style, e.g., for example if we go from not having |
2060 // an outline to having an outline. | 2063 // an outline to having an outline. |
2061 | 2064 |
2062 // The paintInvalidationForWholeRenderer() call is needed for non-layout changes to style. See the corresponding | 2065 if (needsLayout()) { |
2063 // comment in RenderObject::styleWillChange for why. | |
2064 if (needsLayout()) | |
2065 setShouldDoFullPaintInvalidationAfterLayout(true); | 2066 setShouldDoFullPaintInvalidationAfterLayout(true); |
2066 else if (!selfNeedsLayout()) | 2067 } else { |
2068 // The paintInvalidationForWholeRenderer() calls are needed for non- layout changes to style. See the corresponding | |
2069 // comment in RenderObject::styleWillChange for why. | |
2070 if (savesPreviousPaintInvalidationRect()) { | |
2071 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidatio n(containerForPaintInvalidation()); | |
2072 if (paintInvalidationRect != previousPaintInvalidationRect()) { | |
2073 // If the original diff didn't require repaint, invalidate p reviousPaintInvalidationRect | |
2074 // before we save a new previousPaintInvalidationRect. | |
2075 if (!diff.needsRepaint()) | |
chrishtr
2014/07/16 00:49:22
Why the !diff.needsRepaint() conditional?
Why don
Xianzhu
2014/07/16 01:59:49
'!diff.needsRepaint() && updatedDiff.needsRepaint(
| |
2076 paintInvalidationForWholeRenderer(); | |
2077 setPreviousPaintInvalidationRect(paintInvalidationRect); | |
2078 } | |
2079 } | |
2067 paintInvalidationForWholeRenderer(); | 2080 paintInvalidationForWholeRenderer(); |
2081 } | |
2068 } | 2082 } |
2069 } | 2083 } |
2070 | 2084 |
2071 static inline bool rendererHasBackground(const RenderObject* renderer) | 2085 static inline bool rendererHasBackground(const RenderObject* renderer) |
2072 { | 2086 { |
2073 return renderer && renderer->hasBackground(); | 2087 return renderer && renderer->hasBackground(); |
2074 } | 2088 } |
2075 | 2089 |
2076 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) | 2090 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) |
2077 { | 2091 { |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3446 { | 3460 { |
3447 if (object1) { | 3461 if (object1) { |
3448 const WebCore::RenderObject* root = object1; | 3462 const WebCore::RenderObject* root = object1; |
3449 while (root->parent()) | 3463 while (root->parent()) |
3450 root = root->parent(); | 3464 root = root->parent(); |
3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3465 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3452 } | 3466 } |
3453 } | 3467 } |
3454 | 3468 |
3455 #endif | 3469 #endif |
OLD | NEW |