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

Side by Side Diff: Source/core/layout/LayoutBox.cpp

Issue 1315213002: (WIP) Paint invalidation for slimming paint v2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | 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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 if (area->hasHorizontalBarDamage()) 1393 if (area->hasHorizontalBarDamage())
1394 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage())); 1394 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage()));
1395 } 1395 }
1396 } 1396 }
1397 1397
1398 // This is for the next invalidatePaintIfNeeded so must be at the end. 1398 // This is for the next invalidatePaintIfNeeded so must be at the end.
1399 savePreviousBoxSizesIfNeeded(); 1399 savePreviousBoxSizesIfNeeded();
1400 return reason; 1400 return reason;
1401 } 1401 }
1402 1402
1403 PaintInvalidationReason LayoutBox::invalidatePaintIfNeededForSlimmingPaintV2(con st LayoutPoint& paintOffset)
1404 {
1405 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason ();
1406 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the
1407 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original
1408 // paint invalidation that chose PaintInvalidationDelayedFull.
1409 if (fullInvalidationReason == PaintInvalidationDelayedFull) {
1410 if (!intersectsVisibleViewport())
1411 return PaintInvalidationDelayedFull;
1412
1413 // Reset state back to regular full paint invalidation if the object is onscreen.
1414 setShouldDoFullPaintInvalidation(PaintInvalidationFull);
1415 }
1416
1417 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed edForSlimmingPaintV2(paintOffset);
1418
1419 // This is for the next invalidatePaintIfNeeded so must be at the end.
1420 savePreviousBoxSizesIfNeeded();
1421 return reason;
1422 }
1423
1403 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState) 1424 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState)
1404 { 1425 {
1405 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState); 1426 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState);
1406 1427
1407 if (ScrollableArea* area = scrollableArea()) 1428 if (ScrollableArea* area = scrollableArea())
1408 area->resetScrollbarDamage(); 1429 area->resetScrollbarDamage();
1409 } 1430 }
1410 1431
1411 #if ENABLE(ASSERT) 1432 #if ENABLE(ASSERT)
1412 bool LayoutBox::paintInvalidationStateIsDirty() const 1433 bool LayoutBox::paintInvalidationStateIsDirty() const
(...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 } 4004 }
3984 4005
3985 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange()) 4006 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange())
3986 return PaintInvalidationBorderBoxChange; 4007 return PaintInvalidationBorderBoxChange;
3987 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange()) 4008 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange())
3988 return PaintInvalidationBorderBoxChange; 4009 return PaintInvalidationBorderBoxChange;
3989 4010
3990 return PaintInvalidationIncremental; 4011 return PaintInvalidationIncremental;
3991 } 4012 }
3992 4013
4014 // TODO: Remove incremental invalidation for slimming paint v2.
3993 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking) 4015 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking)
3994 { 4016 {
3995 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); 4017 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking);
3996 4018
3997 bool hasBoxDecorations = style()->hasBoxDecorations(); 4019 bool hasBoxDecorations = style()->hasBoxDecorations();
3998 if (!style()->hasBackground() && !hasBoxDecorations) 4020 if (!style()->hasBackground() && !hasBoxDecorations)
3999 return; 4021 return;
4000 4022
4001 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; 4023 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ;
4002 LayoutSize newBorderBoxSize = size(); 4024 LayoutSize newBorderBoxSize = size();
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4576 4598
4577 bool LayoutBox::needToSavePreviousBoxSizes() 4599 bool LayoutBox::needToSavePreviousBoxSizes()
4578 { 4600 {
4579 // If m_rareData is already created, always save. 4601 // If m_rareData is already created, always save.
4580 if (m_rareData) 4602 if (m_rareData)
4581 return true; 4603 return true;
4582 4604
4583 LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize(); 4605 LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize();
4584 // Don't save old box sizes if the paint rect is empty because we'll 4606 // Don't save old box sizes if the paint rect is empty because we'll
4585 // full invalidate once the paint rect becomes non-empty. 4607 // full invalidate once the paint rect becomes non-empty.
4586 if (paintInvalidationSize.isEmpty()) 4608 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && paintInvalidationSi ze.isEmpty())
4587 return false; 4609 return false;
4588 4610
4589 // We need the old box sizes only when the box has background, decorations, or masks. 4611 // We need the old box sizes only when the box has background, decorations, or masks.
4590 // Main LayoutView paints base background, thus interested in box size. 4612 // Main LayoutView paints base background, thus interested in box size.
4591 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask()) 4613 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask())
4592 return false; 4614 return false;
4593 4615
4594 // No need to save old border box size if we can use size of the old paint 4616 // No need to save old border box size if we can use size of the old paint
4595 // rect as the old border box size in the next invalidation. 4617 // rect as the old border box size in the next invalidation.
4596 if (paintInvalidationSize != size()) 4618 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && paintInvalidationSi ze != size())
4597 return true; 4619 return true;
4598 4620
4599 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533 4621 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533
4600 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment() 4622 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment()
4601 || style()->maskLayers().thisOrNextLayersUseContentBox()) 4623 || style()->maskLayers().thisOrNextLayersUseContentBox())
4602 return true; 4624 return true;
4603 4625
4604 return false; 4626 return false;
4605 } 4627 }
4606 4628
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4736 StyleImage* borderImage = style()->borderImage().image(); 4758 StyleImage* borderImage = style()->borderImage().image();
4737 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4759 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4738 } 4760 }
4739 4761
4740 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4762 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4741 { 4763 {
4742 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4764 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4743 } 4765 }
4744 4766
4745 } // namespace blink 4767 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698