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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc

Issue 2812983002: Change NGLayoutOpportunityIterator API to work with list of exclusions (Closed)
Patch Set: git rebase-update Created 3 years, 8 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 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/ng_floats_utils.h" 5 #include "core/layout/ng/ng_floats_utils.h"
6 6
7 #include "core/layout/ng/ng_box_fragment.h" 7 #include "core/layout/ng/ng_box_fragment.h"
8 8
9 namespace blink { 9 namespace blink {
10 namespace { 10 namespace {
(...skipping 28 matching lines...) Expand all
39 // @param floating_object Floating object for which we need to find a layout 39 // @param floating_object Floating object for which we need to find a layout
40 // opportunity. 40 // opportunity.
41 // @return Layout opportunity for the fragment. 41 // @return Layout opportunity for the fragment.
42 const NGLayoutOpportunity FindLayoutOpportunityForFragment( 42 const NGLayoutOpportunity FindLayoutOpportunityForFragment(
43 const NGConstraintSpace* space, 43 const NGConstraintSpace* space,
44 const NGFragment& fragment, 44 const NGFragment& fragment,
45 const NGFloatingObject* floating_object) { 45 const NGFloatingObject* floating_object) {
46 NGLogicalOffset adjusted_origin_point = 46 NGLogicalOffset adjusted_origin_point =
47 AdjustToTopEdgeAlignmentRule(*space, floating_object->origin_offset); 47 AdjustToTopEdgeAlignmentRule(*space, floating_object->origin_offset);
48 48
49 NGLayoutOpportunityIterator opportunity_iter( 49 NGLayoutOpportunityIterator opportunity_iter(space->Exclusions().get(),
50 space, floating_object->available_size, adjusted_origin_point); 50 floating_object->available_size,
51 adjusted_origin_point);
51 NGLayoutOpportunity opportunity; 52 NGLayoutOpportunity opportunity;
52 NGLayoutOpportunity opportunity_candidate = opportunity_iter.Next(); 53 NGLayoutOpportunity opportunity_candidate = opportunity_iter.Next();
53 54
54 NGBoxStrut margins = floating_object->margins; 55 NGBoxStrut margins = floating_object->margins;
55 while (!opportunity_candidate.IsEmpty()) { 56 while (!opportunity_candidate.IsEmpty()) {
56 opportunity = opportunity_candidate; 57 opportunity = opportunity_candidate;
57 // Checking opportunity's block size is not necessary as a float cannot be 58 // Checking opportunity's block size is not necessary as a float cannot be
58 // positioned on top of another float inside of the same constraint space. 59 // positioned on top of another float inside of the same constraint space.
59 auto fragment_inline_size = fragment.InlineSize() + margins.InlineSum(); 60 auto fragment_inline_size = fragment.InlineSize() + margins.InlineSum();
60 if (opportunity.size.inline_size >= fragment_inline_size) 61 if (opportunity.size.inline_size >= fragment_inline_size)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 floating_object->origin_offset.block_offset = origin_block_offset; 174 floating_object->origin_offset.block_offset = origin_block_offset;
174 floating_object->from_offset.block_offset = bfc_block_offset; 175 floating_object->from_offset.block_offset = bfc_block_offset;
175 176
176 NGLogicalOffset offset = PositionFloat(floating_object.Get(), space); 177 NGLogicalOffset offset = PositionFloat(floating_object.Get(), space);
177 builder->AddFloatingObject(floating_object, offset); 178 builder->AddFloatingObject(floating_object, offset);
178 } 179 }
179 builder->MutableUnpositionedFloats().Clear(); 180 builder->MutableUnpositionedFloats().Clear();
180 } 181 }
181 182
182 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698