OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_inline_layout_algorithm.h" | 5 #include "core/layout/ng/ng_inline_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/BidiRun.h" | 7 #include "core/layout/BidiRun.h" |
8 #include "core/layout/LayoutBlockFlow.h" | 8 #include "core/layout/LayoutBlockFlow.h" |
9 #include "core/layout/line/LineInfo.h" | 9 #include "core/layout/line/LineInfo.h" |
10 #include "core/layout/line/RootInlineBox.h" | 10 #include "core/layout/line/RootInlineBox.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 // diff writing mode - get the inline size from performing layout. | 324 // diff writing mode - get the inline size from performing layout. |
325 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); | 325 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); |
326 | 326 |
327 NGBoxFragment float_fragment( | 327 NGBoxFragment float_fragment( |
328 float_space->WritingMode(), | 328 float_space->WritingMode(), |
329 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); | 329 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); |
330 | 330 |
331 NGLogicalOffset origin_offset = | 331 NGLogicalOffset origin_offset = |
332 GetOriginPointForFloats(ConstraintSpace(), content_size_); | 332 GetOriginPointForFloats(ConstraintSpace(), content_size_); |
333 NGLogicalOffset from_offset = ConstraintSpace().BfcOffset(); | 333 NGLogicalOffset from_offset = ConstraintSpace().BfcOffset(); |
334 // TODO(glebl): add margins calculation. | 334 NGBoxStrut margins = ComputeMarginsForChild(*float_space.get(), node); |
ikilpatrick
2017/04/06 16:24:31
So I think this should actually be just:
NGBoxStr
Gleb Lanbin
2017/04/06 16:35:36
Done.
| |
335 NGBoxStrut margins; | |
336 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( | 335 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( |
337 node->Style(), float_space->WritingMode(), current_opportunity_.size, | 336 node->Style(), float_space->WritingMode(), current_opportunity_.size, |
338 origin_offset, from_offset, margins, | 337 origin_offset, from_offset, margins, |
339 layout_result->PhysicalFragment().get()); | 338 layout_result->PhysicalFragment().get()); |
340 | 339 |
341 bool float_does_not_fit = end_position + float_fragment.InlineSize() > | 340 bool float_does_not_fit = end_position + float_fragment.InlineSize() > |
342 current_opportunity_.InlineSize(); | 341 current_opportunity_.InlineSize(); |
343 // Check if we already have a pending float. That's because a float cannot be | 342 // Check if we already have a pending float. That's because a float cannot be |
344 // higher than any block or floated box generated before. | 343 // higher than any block or floated box generated before. |
345 if (!container_builder_.UnpositionedFloats().isEmpty() || | 344 if (!container_builder_.UnpositionedFloats().isEmpty() || |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 LayoutUnit baseline = line_top_with_leading + metrics.ascent_and_leading; | 634 LayoutUnit baseline = line_top_with_leading + metrics.ascent_and_leading; |
636 root_line_box->setLineTopBottomPositions( | 635 root_line_box->setLineTopBottomPositions( |
637 baseline - metrics.ascent, baseline + metrics.descent, | 636 baseline - metrics.ascent, baseline + metrics.descent, |
638 line_top_with_leading, baseline + metrics.descent_and_leading); | 637 line_top_with_leading, baseline + metrics.descent_and_leading); |
639 | 638 |
640 bidi_runs.deleteRuns(); | 639 bidi_runs.deleteRuns(); |
641 fragments_for_bidi_runs.clear(); | 640 fragments_for_bidi_runs.clear(); |
642 } | 641 } |
643 } | 642 } |
644 } // namespace blink | 643 } // namespace blink |
OLD | NEW |