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

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
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutBoxModelObject.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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 if (!hasOverflowClip()) 730 if (!hasOverflowClip())
731 return false; 731 return false;
732 732
733 bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverfl owY(); 733 bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverfl owY();
734 if (scrollsOverflow() && hasScrollableOverflow) 734 if (scrollsOverflow() && hasScrollableOverflow)
735 return true; 735 return true;
736 736
737 return node && node->hasEditableStyle(); 737 return node && node->hasEditableStyle();
738 } 738 }
739 739
740 bool LayoutBox::usesCompositedScrolling() const
741 {
742 return hasOverflowClip() && hasLayer() && layer()->scrollableArea()->usesCom positedScrolling();
743 }
744
745 void LayoutBox::autoscroll(const IntPoint& positionInRootFrame) 740 void LayoutBox::autoscroll(const IntPoint& positionInRootFrame)
746 { 741 {
747 LocalFrame* frame = this->frame(); 742 LocalFrame* frame = this->frame();
748 if (!frame) 743 if (!frame)
749 return; 744 return;
750 745
751 FrameView* frameView = frame->view(); 746 FrameView* frameView = frame->view();
752 if (!frameView) 747 if (!frameView)
753 return; 748 return;
754 749
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 // during DeprecatedPaintLayerScrollableArea::invalidateScrollbarRec t(). However, for now we still need to 1381 // during DeprecatedPaintLayerScrollableArea::invalidateScrollbarRec t(). However, for now we still need to
1387 // invalidate the rectangles to trigger repaints. 1382 // invalidate the rectangles to trigger repaints.
1388 if (area->hasVerticalBarDamage()) 1383 if (area->hasVerticalBarDamage())
1389 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage())); 1384 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage()));
1390 if (area->hasHorizontalBarDamage()) 1385 if (area->hasHorizontalBarDamage())
1391 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage())); 1386 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage()));
1392 } 1387 }
1393 } 1388 }
1394 1389
1395 // This is for the next invalidatePaintIfNeeded so must be at the end. 1390 // This is for the next invalidatePaintIfNeeded so must be at the end.
1396 savePreviousBoxSizesIfNeeded(); 1391 savePreviousBoxSizesIfNeeded(newPaintInvalidationContainer);
1397 return reason; 1392 return reason;
1398 } 1393 }
1399 1394
1400 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState) 1395 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState)
1401 { 1396 {
1402 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState); 1397 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState);
1403 1398
1404 if (ScrollableArea* area = scrollableArea()) 1399 if (ScrollableArea* area = scrollableArea())
1405 area->resetScrollbarDamage(); 1400 area->resetScrollbarDamage();
1406 } 1401 }
(...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4559 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4565 } 4560 }
4566 4561
4567 void LayoutBox::setPageLogicalOffset(LayoutUnit offset) 4562 void LayoutBox::setPageLogicalOffset(LayoutUnit offset)
4568 { 4563 {
4569 if (!m_rareData && !offset) 4564 if (!m_rareData && !offset)
4570 return; 4565 return;
4571 ensureRareData().m_pageLogicalOffset = offset; 4566 ensureRareData().m_pageLogicalOffset = offset;
4572 } 4567 }
4573 4568
4574 bool LayoutBox::needToSavePreviousBoxSizes() 4569 bool LayoutBox::needToSavePreviousBoxSizes(const LayoutBoxModelObject& paintInva lidationContainer)
4575 { 4570 {
4576 // If m_rareData is already created, always save. 4571 // If m_rareData is already created, always save.
4577 if (m_rareData) 4572 if (m_rareData)
4578 return true; 4573 return true;
4579 4574
4580 LayoutSize paintInvalidationSize = previousPaintInvalidationRect().size(); 4575 LayoutSize paintInvalidationSize = previousPaintInvalidationRectIncludingCom positedScrolling(paintInvalidationContainer).size();
4581 // Don't save old box sizes if the paint rect is empty because we'll 4576 // Don't save old box sizes if the paint rect is empty because we'll
4582 // full invalidate once the paint rect becomes non-empty. 4577 // full invalidate once the paint rect becomes non-empty.
4583 if (paintInvalidationSize.isEmpty()) 4578 if (paintInvalidationSize.isEmpty())
4584 return false; 4579 return false;
4585 4580
4586 // We need the old box sizes only when the box has background, decorations, or masks. 4581 // We need the old box sizes only when the box has background, decorations, or masks.
4587 // Main LayoutView paints base background, thus interested in box size. 4582 // Main LayoutView paints base background, thus interested in box size.
4588 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask()) 4583 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask())
4589 return false; 4584 return false;
4590 4585
4591 // No need to save old border box size if we can use size of the old paint 4586 // No need to save old border box size if we can use size of the old paint
4592 // rect as the old border box size in the next invalidation. 4587 // rect as the old border box size in the next invalidation.
4593 if (paintInvalidationSize != size()) 4588 if (paintInvalidationSize != size())
4594 return true; 4589 return true;
4595 4590
4596 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533 4591 // Background and mask layers can depend on other boxes than border box. See crbug.com/490533
4597 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment() 4592 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> backgroundLayers().thisOrNextLayersHaveLocalAttachment()
4598 || style()->maskLayers().thisOrNextLayersUseContentBox()) 4593 || style()->maskLayers().thisOrNextLayersUseContentBox())
4599 return true; 4594 return true;
4600 4595
4601 return false; 4596 return false;
4602 } 4597 }
4603 4598
4604 void LayoutBox::savePreviousBoxSizesIfNeeded() 4599 void LayoutBox::savePreviousBoxSizesIfNeeded(const LayoutBoxModelObject& paintIn validationContainer)
4605 { 4600 {
4606 if (!needToSavePreviousBoxSizes()) 4601 if (!needToSavePreviousBoxSizes(paintInvalidationContainer))
4607 return; 4602 return;
4608 4603
4609 LayoutBoxRareData& rareData = ensureRareData(); 4604 LayoutBoxRareData& rareData = ensureRareData();
4610 rareData.m_previousBorderBoxSize = size(); 4605 rareData.m_previousBorderBoxSize = size();
4611 rareData.m_previousContentBoxRect = contentBoxRect(); 4606 rareData.m_previousContentBoxRect = contentBoxRect();
4612 rareData.m_previousLayoutOverflowRect = layoutOverflowRect(); 4607 rareData.m_previousLayoutOverflowRect = layoutOverflowRect();
4613 } 4608 }
4614 4609
4615 LayoutSize LayoutBox::computePreviousBorderBoxSize(const LayoutSize& previousBou ndsSize) const 4610 LayoutSize LayoutBox::computePreviousBorderBoxSize(const LayoutSize& previousBou ndsSize) const
4616 { 4611 {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
4733 StyleImage* borderImage = style()->borderImage().image(); 4728 StyleImage* borderImage = style()->borderImage().image();
4734 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4729 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4735 } 4730 }
4736 4731
4737 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4732 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4738 { 4733 {
4739 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4734 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4740 } 4735 }
4741 4736
4742 } // namespace blink 4737 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698