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 3874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3885 { | 3885 { |
| 3886 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); | 3886 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); |
| 3887 | 3887 |
| 3888 bool hasBoxDecorations = style()->hasBoxDecorations(); | 3888 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 3889 if (!style()->hasBackground() && !hasBoxDecorations) | 3889 if (!style()->hasBackground() && !hasBoxDecorations) |
| 3890 return; | 3890 return; |
| 3891 | 3891 |
| 3892 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; | 3892 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; |
| 3893 LayoutSize newBorderBoxSize = size(); | 3893 LayoutSize newBorderBoxSize = size(); |
| 3894 | 3894 |
| 3895 // If border box size didn't change, RenderBox's incrementallyInvalidatePain t() is good. | 3895 // If border box size didn't change, RenderObject's incrementallyInvalidateP aint() is good. |
| 3896 if (oldBorderBoxSize == newBorderBoxSize) | 3896 if (oldBorderBoxSize == newBorderBoxSize) |
| 3897 return; | 3897 return; |
| 3898 | 3898 |
| 3899 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint() | 3899 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint() |
| 3900 // is good for boxes having background without box decorations. | 3900 // is good for boxes having background without box decorations. |
| 3901 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. | 3901 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. |
| 3902 if (!hasBoxDecorations | 3902 if (!hasBoxDecorations |
| 3903 && positionFromPaintInvalidationBacking == newBounds.location() | 3903 && positionFromPaintInvalidationBacking == newBounds.location() |
| 3904 && oldBorderBoxSize == oldBounds.size() | 3904 && oldBorderBoxSize == oldBounds.size() |
| 3905 && newBorderBoxSize == newBounds.size()) | 3905 && newBorderBoxSize == newBounds.size()) |
| 3906 return; | 3906 return; |
| 3907 | 3907 |
| 3908 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. | 3908 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. |
| 3909 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); | 3909 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); |
| 3910 if (deltaWidth) { | 3910 if (deltaWidth) { |
| 3911 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); | 3911 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); |
| 3912 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); | 3912 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); |
| 3913 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); | 3913 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); |
| 3914 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); | 3914 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); |
| 3915 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, | 3915 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, |
| 3916 positionFromPaintInvalidationBacking.y(), | 3916 positionFromPaintInvalidationBacking.y(), |
| 3917 deltaWidth + borderWidth, | 3917 deltaWidth + borderWidth, |
| 3918 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); | 3918 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); |
| 3919 invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRec t, InvalidationIncremental); | 3919 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds); |
| 3920 } | 3920 } |
| 3921 | 3921 |
| 3922 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. | 3922 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. |
| 3923 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); | 3923 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); |
| 3924 if (deltaHeight) { | 3924 if (deltaHeight) { |
| 3925 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); | 3925 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); |
| 3926 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); | 3926 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); |
| 3927 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); | 3927 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); |
| 3928 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); | 3928 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); |
| 3929 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), | 3929 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), |
| 3930 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, | 3930 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, |
| 3931 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), | 3931 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), |
| 3932 deltaHeight + borderHeight); | 3932 deltaHeight + borderHeight); |
| 3933 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRe ct, InvalidationIncremental); | 3933 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds); |
| 3934 } | 3934 } |
| 3935 } | 3935 } |
| 3936 | 3936 |
| 3937 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const RenderLayerMod elObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds) | |
| 3938 { | |
| 3939 if (rect.isEmpty()) | |
| 3940 return; | |
| 3941 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); | |
| 3942 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); | |
| 3943 // Invalidate only once if the clipped rects equal. | |
| 3944 if (rectClippedByOldBounds == rectClippedByNewBounds) { | |
| 3945 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, InvalidationIncremental); | |
| 3946 return; | |
| 3947 } | |
| 3948 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth. | |
| 3949 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) | |
| 3950 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, InvalidationIncremental); | |
| 3951 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) | |
| 3952 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, InvalidationIncremental); | |
|
Julien - ping for review
2014/09/16 18:22:52
I count 3 cases for the non-equal case. Do we have
Xianzhu
2014/09/16 18:36:13
Yes. The existing layout tests cover the cases. Ac
| |
| 3953 } | |
| 3954 | |
| 3937 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) | 3955 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) |
| 3938 { | 3956 { |
| 3939 ASSERT(!needsLayout()); | 3957 ASSERT(!needsLayout()); |
| 3940 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it | 3958 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it |
| 3941 // is childless, though. | 3959 // is childless, though. |
| 3942 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 3960 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
| 3943 layoutScope.setChildNeedsLayout(this); | 3961 layoutScope.setChildNeedsLayout(this); |
| 3944 } | 3962 } |
| 3945 | 3963 |
| 3946 void RenderBox::addVisualEffectOverflow() | 3964 void RenderBox::addVisualEffectOverflow() |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4519 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); | 4537 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); |
| 4520 | 4538 |
| 4521 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) | 4539 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) |
| 4522 return m_rareData->m_previousBorderBoxSize; | 4540 return m_rareData->m_previousBorderBoxSize; |
| 4523 | 4541 |
| 4524 // We didn't save the old border box size because it was the same as the siz e of oldBounds. | 4542 // We didn't save the old border box size because it was the same as the siz e of oldBounds. |
| 4525 return previousBoundsSize; | 4543 return previousBoundsSize; |
| 4526 } | 4544 } |
| 4527 | 4545 |
| 4528 } // namespace blink | 4546 } // namespace blink |
| OLD | NEW |