Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 948513004: Revert of Revert of Clip incremental invalidation rects for RenderBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3941 matching lines...) Expand 10 before | Expand all | Expand 10 after
3952 { 3952 {
3953 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); 3953 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking);
3954 3954
3955 bool hasBoxDecorations = style()->hasBoxDecorations(); 3955 bool hasBoxDecorations = style()->hasBoxDecorations();
3956 if (!style()->hasBackground() && !hasBoxDecorations) 3956 if (!style()->hasBackground() && !hasBoxDecorations)
3957 return; 3957 return;
3958 3958
3959 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; 3959 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ;
3960 LayoutSize newBorderBoxSize = size(); 3960 LayoutSize newBorderBoxSize = size();
3961 3961
3962 // If border box size didn't change, RenderBox's incrementallyInvalidatePain t() is good. 3962 // If border box size didn't change, RenderObject's incrementallyInvalidateP aint() is good.
3963 if (oldBorderBoxSize == newBorderBoxSize) 3963 if (oldBorderBoxSize == newBorderBoxSize)
3964 return; 3964 return;
3965 3965
3966 // If size of the paint invalidation rect equals to size of border box, Layo utObject::incrementallyInvalidatePaint() 3966 // If size of the paint invalidation rect equals to size of border box, Layo utObject::incrementallyInvalidatePaint()
3967 // is good for boxes having background without box decorations. 3967 // is good for boxes having background without box decorations.
3968 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. 3968 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation.
3969 if (!hasBoxDecorations 3969 if (!hasBoxDecorations
3970 && positionFromPaintInvalidationBacking == newBounds.location() 3970 && positionFromPaintInvalidationBacking == newBounds.location()
3971 && oldBorderBoxSize == oldBounds.size() 3971 && oldBorderBoxSize == oldBounds.size()
3972 && newBorderBoxSize == newBounds.size()) 3972 && newBorderBoxSize == newBounds.size())
3973 return; 3973 return;
3974 3974
3975 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. 3975 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width.
3976 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); 3976 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width());
3977 if (deltaWidth) { 3977 if (deltaWidth) {
3978 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); 3978 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width());
3979 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); 3979 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth);
3980 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); 3980 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth);
3981 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); 3981 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth));
3982 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, 3982 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth,
3983 positionFromPaintInvalidationBacking.y(), 3983 positionFromPaintInvalidationBacking.y(),
3984 deltaWidth + borderWidth, 3984 deltaWidth + borderWidth,
3985 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); 3985 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height()));
3986 invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRec t, PaintInvalidationIncremental); 3986 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds);
3987 } 3987 }
3988 3988
3989 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. 3989 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height.
3990 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); 3990 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height());
3991 if (deltaHeight) { 3991 if (deltaHeight) {
3992 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); 3992 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height());
3993 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); 3993 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight);
3994 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); 3994 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight);
3995 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); 3995 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight));
3996 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), 3996 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(),
3997 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, 3997 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght,
3998 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), 3998 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
3999 deltaHeight + borderHeight); 3999 deltaHeight + borderHeight);
4000 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRe ct, PaintInvalidationIncremental); 4000 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds);
4001 } 4001 }
4002 } 4002 }
4003 4003
4004 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerMod elObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds)
4005 {
4006 if (rect.isEmpty())
4007 return;
4008 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds);
4009 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds);
4010 // Invalidate only once if the clipped rects equal.
4011 if (rectClippedByOldBounds == rectClippedByNewBounds) {
4012 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
4013 return;
4014 }
4015 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth.
4016 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
4017 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
4018 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
4019 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, PaintInvalidationIncremental);
4020 }
4021
4004 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 4022 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
4005 { 4023 {
4006 ASSERT(!needsLayout()); 4024 ASSERT(!needsLayout());
4007 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it 4025 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it
4008 // is childless, though. 4026 // is childless, though.
4009 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 4027 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
4010 layoutScope.setChildNeedsLayout(this); 4028 layoutScope.setChildNeedsLayout(this);
4011 } 4029 }
4012 4030
4013 void RenderBox::addVisualEffectOverflow() 4031 void RenderBox::addVisualEffectOverflow()
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
4605 } 4623 }
4606 4624
4607 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst 4625 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst
4608 { 4626 {
4609 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); 4627 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList);
4610 if (LayerScrollableArea* area = scrollableArea()) 4628 if (LayerScrollableArea* area = scrollableArea())
4611 displayItemList->invalidate(area->displayItemClient()); 4629 displayItemList->invalidate(area->displayItemClient());
4612 } 4630 }
4613 4631
4614 } // namespace blink 4632 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698