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 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 // We should invalidate previousPaintInvalidationRect, but for objects that don't save previousPaintInvalidationRect, | |
| 1536 // we have to use the current paint invalidation rect. | |
| 1537 LayoutRect paintInvalidationRect = isBox() || isSVG() ? previousPaintInvalid ationRect() : boundsRectForPaintInvalidation(paintInvalidationContainer); | |
|
leviw_travelin_and_unemployed
2014/07/15 23:41:29
This will still be broken for inlines and such, no
Xianzhu
2014/07/16 00:22:36
Add FIXME with link to crbug.com/394133.
| |
| 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 { |
| 2067 paintInvalidationForWholeRenderer(); | 2068 // The paintInvalidationForWholeRenderer() calls are needed for non- layout changes to style. See the corresponding |
| 2069 // comment in RenderObject::styleWillChange for why. | |
| 2070 | |
| 2071 bool shouldInvalidatePaint; | |
| 2072 if (isBox() || isSVG()) { | |
| 2073 // Should do paint invalidation if the original diff didn't requ ire repaint. | |
| 2074 if (!diff.needsRepaint()) | |
|
leviw_travelin_and_unemployed
2014/07/15 23:41:29
It feels to me like this optimization and the fix
Xianzhu
2014/07/16 00:22:36
Done.
| |
| 2075 shouldInvalidatePaint = true; | |
| 2076 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidatio n(containerForPaintInvalidation()); | |
| 2077 if (paintInvalidationRect != previousPaintInvalidationRect()) { | |
| 2078 shouldInvalidatePaint = true; | |
| 2079 // If the original diff didn't require require repaint, inva lidate the previous paint rect. | |
| 2080 if (!diff.needsRepaint()) | |
| 2081 paintInvalidationForWholeRenderer(); | |
| 2082 setPreviousPaintInvalidationRect(paintInvalidationRect); | |
| 2083 } | |
| 2084 } else { | |
| 2085 shouldInvalidatePaint = true; | |
| 2086 } | |
| 2087 | |
| 2088 if (shouldInvalidatePaint) | |
| 2089 paintInvalidationForWholeRenderer(); | |
| 2090 } | |
| 2068 } | 2091 } |
| 2069 } | 2092 } |
| 2070 | 2093 |
| 2071 static inline bool rendererHasBackground(const RenderObject* renderer) | 2094 static inline bool rendererHasBackground(const RenderObject* renderer) |
| 2072 { | 2095 { |
| 2073 return renderer && renderer->hasBackground(); | 2096 return renderer && renderer->hasBackground(); |
| 2074 } | 2097 } |
| 2075 | 2098 |
| 2076 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) | 2099 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) |
| 2077 { | 2100 { |
| (...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3446 { | 3469 { |
| 3447 if (object1) { | 3470 if (object1) { |
| 3448 const WebCore::RenderObject* root = object1; | 3471 const WebCore::RenderObject* root = object1; |
| 3449 while (root->parent()) | 3472 while (root->parent()) |
| 3450 root = root->parent(); | 3473 root = root->parent(); |
| 3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3474 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3452 } | 3475 } |
| 3453 } | 3476 } |
| 3454 | 3477 |
| 3455 #endif | 3478 #endif |
| OLD | NEW |