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

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

Issue 2869983003: *** DO NOT LAND *** Avoid multiple layout passes in flexbox. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 1801
1802 DCHECK(!flex_item.box->IsOutOfFlowPositioned()); 1802 DCHECK(!flex_item.box->IsOutOfFlowPositioned());
1803 1803
1804 child->SetMayNeedPaintInvalidation(); 1804 child->SetMayNeedPaintInvalidation();
1805 1805
1806 SetOverrideMainAxisContentSizeForChild(*child, 1806 SetOverrideMainAxisContentSizeForChild(*child,
1807 flex_item.flexed_content_size); 1807 flex_item.flexed_content_size);
1808 // The flexed content size and the override size include the scrollbar 1808 // The flexed content size and the override size include the scrollbar
1809 // width, so we need to compare to the size including the scrollbar. 1809 // width, so we need to compare to the size including the scrollbar.
1810 // TODO(cbiesinger): Should it include the scrollbar? 1810 // TODO(cbiesinger): Should it include the scrollbar?
1811 #if 0 // Disabling this eliminates most of the slowness.
1811 if (flex_item.flexed_content_size != 1812 if (flex_item.flexed_content_size !=
1812 MainAxisContentExtentForChildIncludingScrollbar(*child)) { 1813 MainAxisContentExtentForChildIncludingScrollbar(*child)) {
1813 child->SetChildNeedsLayout(kMarkOnlyThis); 1814 child->SetChildNeedsLayout(kMarkOnlyThis);
1814 } else { 1815 } else
1816 #endif
1817 {
1815 // To avoid double applying margin changes in 1818 // To avoid double applying margin changes in
1816 // updateAutoMarginsInCrossAxis, we reset the margins here. 1819 // updateAutoMarginsInCrossAxis, we reset the margins here.
1817 ResetAutoMarginsAndLogicalTopInCrossAxis(*child); 1820 ResetAutoMarginsAndLogicalTopInCrossAxis(*child);
1818 } 1821 }
1819 // We may have already forced relayout for orthogonal flowing children in 1822 // We may have already forced relayout for orthogonal flowing children in
1820 // computeInnerFlexBaseSizeForChild. 1823 // computeInnerFlexBaseSizeForChild.
1821 bool force_child_relayout = 1824 bool force_child_relayout =
1822 relayout_children && !relaid_out_children_.Contains(child); 1825 relayout_children && !relaid_out_children_.Contains(child);
1823 if (child->IsLayoutBlock() && 1826 if (child->IsLayoutBlock() &&
1824 ToLayoutBlock(*child).HasPercentHeightDescendants()) { 1827 ToLayoutBlock(*child).HasPercentHeightDescendants()) {
1825 // Have to force another relayout even though the child is sized 1828 // Have to force another relayout even though the child is sized
1826 // correctly, because its descendants are not sized correctly yet. Our 1829 // correctly, because its descendants are not sized correctly yet. Our
1827 // previous layout of the child was done without an override height set. 1830 // previous layout of the child was done without an override height set.
1828 // So, redo it here. 1831 // So, redo it here.
1829 force_child_relayout = true; 1832 force_child_relayout = true;
1830 } 1833 }
1831 UpdateBlockChildDirtyBitsBeforeLayout(force_child_relayout, *child); 1834 UpdateBlockChildDirtyBitsBeforeLayout(force_child_relayout, *child);
1835 #if 0 // Disabling this also improves speed somewhat.
1832 if (!child->NeedsLayout()) 1836 if (!child->NeedsLayout())
1833 MarkChildForPaginationRelayoutIfNeeded(*child, layout_scope); 1837 MarkChildForPaginationRelayoutIfNeeded(*child, layout_scope);
1838 #endif
1834 if (child->NeedsLayout()) 1839 if (child->NeedsLayout())
1835 relaid_out_children_.insert(child); 1840 relaid_out_children_.insert(child);
1836 child->LayoutIfNeeded(); 1841 child->LayoutIfNeeded();
1837 1842
1838 UpdateAutoMarginsInMainAxis(*child, auto_margin_offset); 1843 UpdateAutoMarginsInMainAxis(*child, auto_margin_offset);
1839 1844
1840 LayoutUnit child_cross_axis_margin_box_extent; 1845 LayoutUnit child_cross_axis_margin_box_extent;
1841 if (AlignmentForChild(*child) == kItemPositionBaseline && 1846 if (AlignmentForChild(*child) == kItemPositionBaseline &&
1842 !HasAutoMarginsInCrossAxis(*child)) { 1847 !HasAutoMarginsInCrossAxis(*child)) {
1843 LayoutUnit ascent = MarginBoxAscentForChild(*child); 1848 LayoutUnit ascent = MarginBoxAscentForChild(*child);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 LayoutUnit original_offset = 2205 LayoutUnit original_offset =
2201 line_contexts[line_number].cross_axis_offset - cross_axis_start_edge; 2206 line_contexts[line_number].cross_axis_offset - cross_axis_start_edge;
2202 LayoutUnit new_offset = 2207 LayoutUnit new_offset =
2203 content_extent - original_offset - line_cross_axis_extent; 2208 content_extent - original_offset - line_cross_axis_extent;
2204 AdjustAlignmentForChild(*flex_item.box, new_offset - original_offset); 2209 AdjustAlignmentForChild(*flex_item.box, new_offset - original_offset);
2205 } 2210 }
2206 } 2211 }
2207 } 2212 }
2208 2213
2209 } // namespace blink 2214 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698