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

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

Issue 1287413002: Fix paint invalidation rect tracking within composited scrolling layers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 if (!hasOverflowClip()) 739 if (!hasOverflowClip())
740 return false; 740 return false;
741 741
742 bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverfl owY(); 742 bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverfl owY();
743 if (scrollsOverflow() && hasScrollableOverflow) 743 if (scrollsOverflow() && hasScrollableOverflow)
744 return true; 744 return true;
745 745
746 return node && node->hasEditableStyle(); 746 return node && node->hasEditableStyle();
747 } 747 }
748 748
749 bool LayoutBox::usesCompositedScrolling() const
750 {
751 return hasOverflowClip() && hasLayer() && layer()->scrollableArea()->usesCom positedScrolling();
752 }
753
754 void LayoutBox::autoscroll(const IntPoint& positionInRootFrame) 749 void LayoutBox::autoscroll(const IntPoint& positionInRootFrame)
755 { 750 {
756 LocalFrame* frame = this->frame(); 751 LocalFrame* frame = this->frame();
757 if (!frame) 752 if (!frame)
758 return; 753 return;
759 754
760 FrameView* frameView = frame->view(); 755 FrameView* frameView = frame->view();
761 if (!frameView) 756 if (!frameView)
762 return; 757 return;
763 758
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // during DeprecatedPaintLayerScrollableArea::invalidateScrollbarRec t(). However, for now we still need to 1390 // during DeprecatedPaintLayerScrollableArea::invalidateScrollbarRec t(). However, for now we still need to
1396 // invalidate the rectangles to trigger repaints. 1391 // invalidate the rectangles to trigger repaints.
1397 if (area->hasVerticalBarDamage()) 1392 if (area->hasVerticalBarDamage())
1398 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage())); 1393 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage()));
1399 if (area->hasHorizontalBarDamage()) 1394 if (area->hasHorizontalBarDamage())
1400 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage())); 1395 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage()));
1401 } 1396 }
1402 } 1397 }
1403 1398
1404 // This is for the next invalidatePaintIfNeeded so must be at the end. 1399 // This is for the next invalidatePaintIfNeeded so must be at the end.
1405 savePreviousBoxSizesIfNeeded(); 1400 savePreviousBoxSizesIfNeeded(newPaintInvalidationContainer);
1406 return reason; 1401 return reason;
1407 } 1402 }
1408 1403
1409 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState) 1404 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState)
1410 { 1405 {
1411 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState); 1406 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState);
1412 1407
1413 if (ScrollableArea* area = scrollableArea()) 1408 if (ScrollableArea* area = scrollableArea())
1414 area->resetScrollbarDamage(); 1409 area->resetScrollbarDamage();
1415 } 1410 }
(...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4573 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4568 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4574 } 4569 }
4575 4570
4576 void LayoutBox::setPageLogicalOffset(LayoutUnit offset) 4571 void LayoutBox::setPageLogicalOffset(LayoutUnit offset)
4577 { 4572 {
4578 if (!m_rareData && !offset) 4573 if (!m_rareData && !offset)
4579 return; 4574 return;
4580 ensureRareData().m_pageLogicalOffset = offset; 4575 ensureRareData().m_pageLogicalOffset = offset;
4581 } 4576 }
4582 4577
4583 bool LayoutBox::needToSavePreviousBoxSizes() 4578 bool LayoutBox::needToSavePreviousBoxSizes(const LayoutBoxModelObject& paintInva lidationContainer)
4584 { 4579 {
4585 // If m_rareData is already created, always save. 4580 // If m_rareData is already created, always save.
4586 if (m_rareData) 4581 if (m_rareData)
4587 return true; 4582 return true;
4588 4583
4589 LayoutSize paintInvalidationSize = previousPaintInvalidationRect().size(); 4584 LayoutSize paintInvalidationSize = previousPaintInvalidationRectIncludingCom positedScrolling(paintInvalidationContainer).size();
4590 // Don't save old box sizes if the paint rect is empty because we'll 4585 // Don't save old box sizes if the paint rect is empty because we'll
4591 // full invalidate once the paint rect becomes non-empty. 4586 // full invalidate once the paint rect becomes non-empty.
4592 if (paintInvalidationSize.isEmpty()) 4587 if (paintInvalidationSize.isEmpty())
4593 return false; 4588 return false;
4594 4589
4595 // We need the old box sizes only when the box has background, decorations, or masks. 4590 // We need the old box sizes only when the box has background, decorations, or masks.
4596 // Main LayoutView paints base background, thus interested in box size. 4591 // Main LayoutView paints base background, thus interested in box size.
4597 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask()) 4592 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask())
4598 return false; 4593 return false;
4599 4594
4600 // No need to save old border box size if we can use size of the old paint 4595 // No need to save old border box size if we can use size of the old paint
4601 // rect as the old border box size in the next invalidation. 4596 // rect as the old border box size in the next invalidation.
4602 if (paintInvalidationSize != size()) 4597 if (paintInvalidationSize != size())
4603 return true; 4598 return true;
4604 4599
4605 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533 4600 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533
4606 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment() 4601 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment()
4607 || style()->maskLayers().thisOrNextLayersUseContentBox()) 4602 || style()->maskLayers().thisOrNextLayersUseContentBox())
4608 return true; 4603 return true;
4609 4604
4610 return false; 4605 return false;
4611 } 4606 }
4612 4607
4613 void LayoutBox::savePreviousBoxSizesIfNeeded() 4608 void LayoutBox::savePreviousBoxSizesIfNeeded(const LayoutBoxModelObject& paintIn validationContainer)
4614 { 4609 {
4615 if (!needToSavePreviousBoxSizes()) 4610 if (!needToSavePreviousBoxSizes(paintInvalidationContainer))
4616 return; 4611 return;
4617 4612
4618 LayoutBoxRareData& rareData = ensureRareData(); 4613 LayoutBoxRareData& rareData = ensureRareData();
4619 rareData.m_previousBorderBoxSize = size(); 4614 rareData.m_previousBorderBoxSize = size();
4620 rareData.m_previousContentBoxRect = contentBoxRect(); 4615 rareData.m_previousContentBoxRect = contentBoxRect();
4621 rareData.m_previousLayoutOverflowRect = layoutOverflowRect(); 4616 rareData.m_previousLayoutOverflowRect = layoutOverflowRect();
4622 } 4617 }
4623 4618
4624 LayoutSize LayoutBox::computePreviousBorderBoxSize(const LayoutSize& previousBou ndsSize) const 4619 LayoutSize LayoutBox::computePreviousBorderBoxSize(const LayoutSize& previousBou ndsSize) const
4625 { 4620 {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 StyleImage* borderImage = style()->borderImage().image(); 4737 StyleImage* borderImage = style()->borderImage().image();
4743 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4738 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4744 } 4739 }
4745 4740
4746 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4741 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4747 { 4742 {
4748 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4743 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4749 } 4744 }
4750 4745
4751 } // namespace blink 4746 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698