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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 2382733002: Introduce markChildForPaginationRelayoutIfNeeded(). (Closed)
Patch Set: Created 4 years, 2 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
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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 // we are, estimate its logical top now. We need to know this up-fro nt, to correctly 719 // we are, estimate its logical top now. We need to know this up-fro nt, to correctly
720 // evaluate if we need to mark for relayout, and, if our estimate is correct, we'll 720 // evaluate if we need to mark for relayout, and, if our estimate is correct, we'll
721 // even be able to insert correct pagination struts on the first att empt. 721 // even be able to insert correct pagination struts on the first att empt.
722 LogicalExtentComputedValues computedValues; 722 LogicalExtentComputedValues computedValues;
723 positionedObject->computeLogicalHeight(positionedObject->logicalHeig ht(), positionedObject->logicalTop(), computedValues); 723 positionedObject->computeLogicalHeight(positionedObject->logicalHeig ht(), positionedObject->logicalTop(), computedValues);
724 logicalTopEstimate = computedValues.m_position; 724 logicalTopEstimate = computedValues.m_position;
725 positionedObject->setLogicalTop(logicalTopEstimate); 725 positionedObject->setLogicalTop(logicalTopEstimate);
726 } 726 }
727 727
728 if (!positionedObject->needsLayout()) 728 if (!positionedObject->needsLayout())
729 positionedObject->markForPaginationRelayoutIfNeeded(layoutScope); 729 markChildForPaginationRelayoutIfNeeded(*positionedObject, layoutScop e);
730 730
731 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout( ) here instead of a full layout. Need 731 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout( ) here instead of a full layout. Need
732 // to investigate why it does not trigger the correct invalidations in t hat case. crbug.com/350756 732 // to investigate why it does not trigger the correct invalidations in t hat case. crbug.com/350756
733 if (info == ForcedLayoutAfterContainingBlockMoved) 733 if (info == ForcedLayoutAfterContainingBlockMoved)
734 positionedObject->setNeedsLayout(LayoutInvalidationReason::AncestorM oved, MarkOnlyThis); 734 positionedObject->setNeedsLayout(LayoutInvalidationReason::AncestorM oved, MarkOnlyThis);
735 735
736 positionedObject->layoutIfNeeded(); 736 positionedObject->layoutIfNeeded();
737 737
738 LayoutObject* parent = positionedObject->parent(); 738 LayoutObject* parent = positionedObject->parent();
739 bool layoutChanged = false; 739 bool layoutChanged = false;
(...skipping 12 matching lines...) Expand all
752 } 752 }
753 753
754 void LayoutBlock::markPositionedObjectsForLayout() 754 void LayoutBlock::markPositionedObjectsForLayout()
755 { 755 {
756 if (TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects() ) { 756 if (TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects() ) {
757 for (auto* descendant : *positionedDescendants) 757 for (auto* descendant : *positionedDescendants)
758 descendant->setChildNeedsLayout(); 758 descendant->setChildNeedsLayout();
759 } 759 }
760 } 760 }
761 761
762 void LayoutBlock::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutSc ope)
763 {
764 ASSERT(!needsLayout());
765 if (needsLayout())
766 return;
767
768 if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutStat e()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(*this, logi calTop()) != pageLogicalOffset()))
769 layoutScope.setChildNeedsLayout(this);
770 }
771
772 void LayoutBlock::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs et) const 762 void LayoutBlock::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs et) const
773 { 763 {
774 BlockPainter(*this).paint(paintInfo, paintOffset); 764 BlockPainter(*this).paint(paintInfo, paintOffset);
775 } 765 }
776 766
777 void LayoutBlock::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) const 767 void LayoutBlock::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) const
778 { 768 {
779 BlockPainter(*this).paintChildren(paintInfo, paintOffset); 769 BlockPainter(*this).paintChildren(paintInfo, paintOffset);
780 } 770 }
781 771
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 1938
1949 return availableHeight; 1939 return availableHeight;
1950 } 1940 }
1951 1941
1952 bool LayoutBlock::hasDefiniteLogicalHeight() const 1942 bool LayoutBlock::hasDefiniteLogicalHeight() const
1953 { 1943 {
1954 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 1944 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
1955 } 1945 }
1956 1946
1957 } // namespace blink 1947 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698