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

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

Issue 899813004: Revert of Clip incremental invalidation rects for RenderBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline 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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 { 3954 {
3955 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); 3955 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking);
3956 3956
3957 bool hasBoxDecorations = style()->hasBoxDecorations(); 3957 bool hasBoxDecorations = style()->hasBoxDecorations();
3958 if (!style()->hasBackground() && !hasBoxDecorations) 3958 if (!style()->hasBackground() && !hasBoxDecorations)
3959 return; 3959 return;
3960 3960
3961 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; 3961 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ;
3962 LayoutSize newBorderBoxSize = size(); 3962 LayoutSize newBorderBoxSize = size();
3963 3963
3964 // If border box size didn't change, RenderObject's incrementallyInvalidateP aint() is good. 3964 // If border box size didn't change, RenderBox's incrementallyInvalidatePain t() is good.
3965 if (oldBorderBoxSize == newBorderBoxSize) 3965 if (oldBorderBoxSize == newBorderBoxSize)
3966 return; 3966 return;
3967 3967
3968 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint() 3968 // If size of the paint invalidation rect equals to size of border box, Rend erObject::incrementallyInvalidatePaint()
3969 // is good for boxes having background without box decorations. 3969 // is good for boxes having background without box decorations.
3970 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation. 3970 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't do incremental invalidation.
3971 if (!hasBoxDecorations 3971 if (!hasBoxDecorations
3972 && positionFromPaintInvalidationBacking == newBounds.location() 3972 && positionFromPaintInvalidationBacking == newBounds.location()
3973 && oldBorderBoxSize == oldBounds.size() 3973 && oldBorderBoxSize == oldBounds.size()
3974 && newBorderBoxSize == newBounds.size()) 3974 && newBorderBoxSize == newBounds.size())
3975 return; 3975 return;
3976 3976
3977 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width. 3977 // Invalidate the right delta part and the right border of the old or new bo x which has smaller width.
3978 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width()); 3978 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo xSize.width());
3979 if (deltaWidth) { 3979 if (deltaWidth) {
3980 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width()); 3980 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo xSize.width());
3981 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth); 3981 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop RightRadius().width(), smallerWidth);
3982 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth); 3982 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border BottomRightRadius().width(), smallerWidth);
3983 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); 3983 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(bo rderTopRightRadiusWidth, borderBottomRightRadiusWidth));
3984 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth, 3984 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma llerWidth - borderWidth,
3985 positionFromPaintInvalidationBacking.y(), 3985 positionFromPaintInvalidationBacking.y(),
3986 deltaWidth + borderWidth, 3986 deltaWidth + borderWidth,
3987 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); 3987 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height()));
3988 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds); 3988 invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRec t, PaintInvalidationIncremental);
3989 } 3989 }
3990 3990
3991 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. 3991 // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height.
3992 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height()); 3992 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder BoxSize.height());
3993 if (deltaHeight) { 3993 if (deltaHeight) {
3994 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height()); 3994 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder BoxSize.height());
3995 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight); 3995 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border BottomLeftRadius().height(), smallerHeight);
3996 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight); 3996 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde rBottomRightRadius().height(), smallerHeight);
3997 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); 3997 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max( borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight));
3998 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), 3998 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(),
3999 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght, 3999 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei ght,
4000 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), 4000 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
4001 deltaHeight + borderHeight); 4001 deltaHeight + borderHeight);
4002 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds); 4002 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRe ct, PaintInvalidationIncremental);
4003 } 4003 }
4004 } 4004 }
4005 4005
4006 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerMod elObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds)
4007 {
4008 if (rect.isEmpty())
4009 return;
4010 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds);
4011 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds);
4012 // Invalidate only once if the clipped rects equal.
4013 if (rectClippedByOldBounds == rectClippedByNewBounds) {
4014 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
4015 return;
4016 }
4017 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth.
4018 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
4019 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
4020 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
4021 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, PaintInvalidationIncremental);
4022 }
4023
4024 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 4006 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
4025 { 4007 {
4026 ASSERT(!needsLayout()); 4008 ASSERT(!needsLayout());
4027 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it 4009 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it
4028 // is childless, though. 4010 // is childless, though.
4029 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 4011 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
4030 layoutScope.setChildNeedsLayout(this); 4012 layoutScope.setChildNeedsLayout(this);
4031 } 4013 }
4032 4014
4033 void RenderBox::addVisualEffectOverflow() 4015 void RenderBox::addVisualEffectOverflow()
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 } 4559 }
4578 4560
4579 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst 4561 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c onst
4580 { 4562 {
4581 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); 4563 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList);
4582 if (LayerScrollableArea* area = scrollableArea()) 4564 if (LayerScrollableArea* area = scrollableArea())
4583 displayItemList->invalidate(area->displayItemClient()); 4565 displayItemList->invalidate(area->displayItemClient());
4584 } 4566 }
4585 4567
4586 } // namespace blink 4568 } // 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