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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1428 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState, newPaintInvalidationContainer); | 1428 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState, newPaintInvalidationContainer); |
| 1429 | 1429 |
| 1430 // If we are set to do a full paint invalidation that means the LayoutView w ill be | 1430 // If we are set to do a full paint invalidation that means the LayoutView w ill be |
| 1431 // issue paint invalidations. We can then skip issuing of paint invalidation s for the child | 1431 // issue paint invalidations. We can then skip issuing of paint invalidation s for the child |
| 1432 // layoutObjects as they'll be covered by the LayoutView. | 1432 // layoutObjects as they'll be covered by the LayoutView. |
| 1433 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason( reason)) { | 1433 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason( reason)) { |
| 1434 invalidatePaintForOverflowIfNeeded(); | 1434 invalidatePaintForOverflowIfNeeded(); |
| 1435 | 1435 |
| 1436 // Issue paint invalidations for any scrollbars if there is a scrollable area for this layoutObject. | 1436 // Issue paint invalidations for any scrollbars if there is a scrollable area for this layoutObject. |
| 1437 if (ScrollableArea* area = scrollableArea()) { | 1437 if (ScrollableArea* area = scrollableArea()) { |
| 1438 // In slimming paint mode, we already invalidated the display item c lients of the scrollbars | 1438 if (area->hasVerticalBarDamage()) { |
| 1439 // during PaintLayerScrollableArea::invalidateScrollbarRect(). Howev er, for now we still need to | 1439 if (Scrollbar* verticalScrollbar = area->verticalScrollbar()) |
|
chrishtr
2015/10/22 00:02:41
Why is this conditional needed now but not before?
Xianzhu
2015/10/22 01:17:04
Previously we invalidate the rect directly to Grap
| |
| 1440 // invalidate the rectangles to trigger repaints. | 1440 invalidatePaintRectangleForDisplayItemClient(*verticalScroll bar, LayoutRect(area->verticalBarDamage())); |
| 1441 if (area->hasVerticalBarDamage()) | 1441 else |
| 1442 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage())); | 1442 invalidatePaintRectangle(LayoutRect(area->verticalBarDamage( ))); |
| 1443 if (area->hasHorizontalBarDamage()) | 1443 } |
| 1444 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage())); | 1444 if (area->hasHorizontalBarDamage()) { |
| 1445 if (Scrollbar* horizontalScrollbar = area->horizontalScrollbar() ) | |
| 1446 invalidatePaintRectangleForDisplayItemClient(*horizontalScro llbar, LayoutRect(area->horizontalBarDamage())); | |
| 1447 else | |
| 1448 invalidatePaintRectangle(LayoutRect(area->horizontalBarDamag e())); | |
| 1449 } | |
| 1445 } | 1450 } |
| 1446 } | 1451 } |
| 1447 | 1452 |
| 1448 // This is for the next invalidatePaintIfNeeded so must be at the end. | 1453 // This is for the next invalidatePaintIfNeeded so must be at the end. |
| 1449 savePreviousBoxSizesIfNeeded(); | 1454 savePreviousBoxSizesIfNeeded(); |
| 1450 return reason; | 1455 return reason; |
| 1451 } | 1456 } |
| 1452 | 1457 |
| 1453 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState) | 1458 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState) |
| 1454 { | 1459 { |
| (...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4091 } | 4096 } |
| 4092 | 4097 |
| 4093 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange()) | 4098 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange()) |
| 4094 return PaintInvalidationBorderBoxChange; | 4099 return PaintInvalidationBorderBoxChange; |
| 4095 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange()) | 4100 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange()) |
| 4096 return PaintInvalidationBorderBoxChange; | 4101 return PaintInvalidationBorderBoxChange; |
| 4097 | 4102 |
| 4098 return PaintInvalidationIncremental; | 4103 return PaintInvalidationIncremental; |
| 4099 } | 4104 } |
| 4100 | 4105 |
| 4101 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking) | 4106 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking, Vector<LayoutRect>& pain tInvalidationRects) |
| 4102 { | 4107 { |
| 4103 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); | 4108 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking, paintInvalidationRects); |
| 4104 | 4109 |
| 4105 bool hasBoxDecorations = style()->hasBoxDecorations(); | 4110 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 4106 if (!style()->hasBackground() && !hasBoxDecorations) | 4111 if (!style()->hasBackground() && !hasBoxDecorations) |
| 4107 return; | 4112 return; |
| 4108 | 4113 |
| 4109 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; | 4114 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; |
| 4110 LayoutSize newBorderBoxSize = size(); | 4115 LayoutSize newBorderBoxSize = size(); |
| 4111 | 4116 |
| 4112 // If border box size didn't change, LayoutObject's incrementallyInvalidateP aint() is good. | 4117 // If border box size didn't change, LayoutObject's incrementallyInvalidateP aint() is good. |
| 4113 if (oldBorderBoxSize == newBorderBoxSize) | 4118 if (oldBorderBoxSize == newBorderBoxSize) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 4126 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); | 4131 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); |
| 4127 if (deltaWidth) { | 4132 if (deltaWidth) { |
| 4128 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); | 4133 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); |
| 4129 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); | 4134 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); |
| 4130 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); | 4135 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); |
| 4131 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); | 4136 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); |
| 4132 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, | 4137 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, |
| 4133 positionFromPaintInvalidationBacking.y(), | 4138 positionFromPaintInvalidationBacking.y(), |
| 4134 deltaWidth + borderWidth, | 4139 deltaWidth + borderWidth, |
| 4135 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); | 4140 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); |
| 4136 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds); | 4141 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds, paintInvalidationRects); |
| 4137 } | 4142 } |
| 4138 | 4143 |
| 4139 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. | 4144 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. |
| 4140 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); | 4145 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); |
| 4141 if (deltaHeight) { | 4146 if (deltaHeight) { |
| 4142 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); | 4147 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); |
| 4143 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); | 4148 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); |
| 4144 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); | 4149 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); |
| 4145 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); | 4150 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); |
| 4146 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), | 4151 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), |
| 4147 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, | 4152 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, |
| 4148 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), | 4153 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), |
| 4149 deltaHeight + borderHeight); | 4154 deltaHeight + borderHeight); |
| 4150 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds); | 4155 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds, paintInvalidationRects); |
| 4151 } | 4156 } |
| 4152 } | 4157 } |
| 4153 | 4158 |
| 4154 void LayoutBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModel Object& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& ol dBounds, const LayoutRect& newBounds) | 4159 void LayoutBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModel Object& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& ol dBounds, const LayoutRect& newBounds, Vector<LayoutRect>& paintInvalidationRects ) |
| 4155 { | 4160 { |
| 4156 if (rect.isEmpty()) | 4161 if (rect.isEmpty()) |
| 4157 return; | 4162 return; |
| 4158 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); | 4163 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); |
| 4159 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); | 4164 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); |
| 4160 // Invalidate only once if the clipped rects equal. | 4165 // Invalidate only once if the clipped rects equal. |
| 4161 if (rectClippedByOldBounds == rectClippedByNewBounds) { | 4166 if (rectClippedByOldBounds == rectClippedByNewBounds) { |
| 4162 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO ldBounds, PaintInvalidationIncremental); | 4167 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO ldBounds, PaintInvalidationIncremental, paintInvalidationRects); |
| 4163 return; | 4168 return; |
| 4164 } | 4169 } |
| 4165 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth. | 4170 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth. |
| 4166 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) | 4171 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) |
| 4167 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO ldBounds, PaintInvalidationIncremental); | 4172 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO ldBounds, PaintInvalidationIncremental, paintInvalidationRects); |
| 4168 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) | 4173 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) |
| 4169 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByN ewBounds, PaintInvalidationIncremental); | 4174 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByN ewBounds, PaintInvalidationIncremental, paintInvalidationRects); |
| 4170 } | 4175 } |
| 4171 | 4176 |
| 4172 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) | 4177 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) |
| 4173 { | 4178 { |
| 4174 ASSERT(!needsLayout()); | 4179 ASSERT(!needsLayout()); |
| 4175 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it | 4180 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it |
| 4176 // is childless, though. | 4181 // is childless, though. |
| 4177 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 4182 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
| 4178 layoutScope.setChildNeedsLayout(this); | 4183 layoutScope.setChildNeedsLayout(this); |
| 4179 } | 4184 } |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4836 StyleImage* borderImage = style()->borderImage().image(); | 4841 StyleImage* borderImage = style()->borderImage().image(); |
| 4837 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); | 4842 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); |
| 4838 } | 4843 } |
| 4839 | 4844 |
| 4840 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const | 4845 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const |
| 4841 { | 4846 { |
| 4842 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; | 4847 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; |
| 4843 } | 4848 } |
| 4844 | 4849 |
| 4845 } // namespace blink | 4850 } // namespace blink |
| OLD | NEW |