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 4081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4092 { | 4092 { |
| 4093 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationContainer); | 4093 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationContainer); |
| 4094 | 4094 |
| 4095 bool hasBoxDecorations = style()->hasBoxDecorations(); | 4095 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 4096 if (!style()->hasBackground() && !hasBoxDecorations) | 4096 if (!style()->hasBackground() && !hasBoxDecorations) |
| 4097 return; | 4097 return; |
| 4098 | 4098 |
| 4099 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; | 4099 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; |
| 4100 LayoutSize newBorderBoxSize = size(); | 4100 LayoutSize newBorderBoxSize = size(); |
| 4101 | 4101 |
| 4102 // If border box size didn't change, RenderBox's incrementallyInvalidatePain t() is good. | 4102 // If border box size didn't change, RenderObject's incrementallyInvalidateP aint() is good. |
| 4103 if (oldBorderBoxSize == newBorderBoxSize) | 4103 if (oldBorderBoxSize == newBorderBoxSize) |
| 4104 return; | 4104 return; |
| 4105 | 4105 |
| 4106 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint() | 4106 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint() |
| 4107 // is good for boxes having background without box decorations. | 4107 // is good for boxes having background without box decorations. |
| 4108 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. | 4108 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. |
| 4109 if (!hasBoxDecorations | 4109 if (!hasBoxDecorations |
| 4110 && positionFromPaintInvalidationContainer == newBounds.location() | 4110 && positionFromPaintInvalidationContainer == newBounds.location() |
| 4111 && oldBorderBoxSize == oldBounds.size() | 4111 && oldBorderBoxSize == oldBounds.size() |
| 4112 && newBorderBoxSize == newBounds.size()) | 4112 && newBorderBoxSize == newBounds.size()) |
| 4113 return; | 4113 return; |
| 4114 | 4114 |
| 4115 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. | 4115 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. |
| 4116 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); | 4116 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); |
| 4117 if (deltaWidth) { | 4117 if (deltaWidth) { |
| 4118 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); | 4118 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); |
| 4119 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); | 4119 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); |
| 4120 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); | 4120 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); |
| 4121 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); | 4121 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); |
| 4122 LayoutRect rightDeltaRect(positionFromPaintInvalidationContainer.x() + s mallerWidth - borderWidth, | 4122 LayoutRect rightDeltaRect(positionFromPaintInvalidationContainer.x() + s mallerWidth - borderWidth, |
| 4123 positionFromPaintInvalidationContainer.y(), | 4123 positionFromPaintInvalidationContainer.y(), |
| 4124 deltaWidth + borderWidth, | 4124 deltaWidth + borderWidth, |
| 4125 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); | 4125 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); |
| 4126 invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRec t, InvalidationIncremental); | 4126 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds); |
| 4127 } | 4127 } |
| 4128 | 4128 |
| 4129 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. | 4129 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. |
| 4130 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); | 4130 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); |
| 4131 if (deltaHeight) { | 4131 if (deltaHeight) { |
| 4132 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); | 4132 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); |
| 4133 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); | 4133 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); |
| 4134 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); | 4134 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); |
| 4135 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); | 4135 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); |
| 4136 LayoutRect bottomDeltaRect(positionFromPaintInvalidationContainer.x(), | 4136 LayoutRect bottomDeltaRect(positionFromPaintInvalidationContainer.x(), |
| 4137 positionFromPaintInvalidationContainer.y() + smallerHeight - borderH eight, | 4137 positionFromPaintInvalidationContainer.y() + smallerHeight - borderH eight, |
| 4138 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), | 4138 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), |
| 4139 deltaHeight + borderHeight); | 4139 deltaHeight + borderHeight); |
| 4140 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRe ct, InvalidationIncremental); | 4140 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds); |
| 4141 } | 4141 } |
| 4142 } | 4142 } |
| 4143 | 4143 |
| 4144 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const RenderLayerMod elObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds) | |
| 4145 { | |
| 4146 if (rect.isEmpty()) | |
| 4147 return; | |
| 4148 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); | |
| 4149 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); | |
| 4150 // - Invalidate only once if they equal; | |
| 4151 // - Invalidate the bigger one if one contains another; | |
| 4152 // - Otherwise invalidate both. | |
| 4153 bool equal = rectClippedByOldBounds == rectClippedByNewBounds; | |
|
Julien - ping for review
2014/09/16 18:22:52
(FYI as it's on the old patch) coding style violat
Xianzhu
2014/09/16 18:36:13
Acknowledged.
| |
| 4154 if (equal || !rectClippedByNewBounds.contains(rectClippedByOldBounds)) | |
| 4155 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, InvalidationIncremental); | |
| 4156 if (!equal && !rectClippedByOldBounds.contains(rectClippedByNewBounds)) | |
| 4157 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, InvalidationIncremental); | |
|
dsinclair
2014/09/16 15:24:01
This maybe a bit easier to read if the conditions
Xianzhu
2014/09/16 15:53:27
Good idea. Done.
| |
| 4158 } | |
| 4159 | |
| 4144 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) | 4160 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) |
| 4145 { | 4161 { |
| 4146 ASSERT(!needsLayout()); | 4162 ASSERT(!needsLayout()); |
| 4147 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it | 4163 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it |
| 4148 // is childless, though. | 4164 // is childless, though. |
| 4149 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 4165 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
| 4150 layoutScope.setChildNeedsLayout(this); | 4166 layoutScope.setChildNeedsLayout(this); |
| 4151 } | 4167 } |
| 4152 | 4168 |
| 4153 void RenderBox::addVisualEffectOverflow() | 4169 void RenderBox::addVisualEffectOverflow() |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4746 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 4762 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 4747 { | 4763 { |
| 4748 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); | 4764 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); |
| 4749 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 4765 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 4750 ASSERT(hasBackground == style.hasBackground()); | 4766 ASSERT(hasBackground == style.hasBackground()); |
| 4751 hasBorder = style.hasBorder(); | 4767 hasBorder = style.hasBorder(); |
| 4752 hasAppearance = style.hasAppearance(); | 4768 hasAppearance = style.hasAppearance(); |
| 4753 } | 4769 } |
| 4754 | 4770 |
| 4755 } // namespace blink | 4771 } // namespace blink |
| OLD | NEW |