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 const ComputedStyle& float_style = node->Style(); |
335 NGBoxStrut margins; | 335 NGBoxStrut margins = |
336 ComputeMargins(*float_space, float_style, float_space->WritingMode(), | |
ikilpatrick
2017/04/06 17:44:21
.nit (can fix later)
I'm not sure why we passed w
| |
337 float_space->Direction()); | |
336 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( | 338 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( |
337 node->Style(), float_space->WritingMode(), current_opportunity_.size, | 339 float_style, float_space->WritingMode(), current_opportunity_.size, |
338 origin_offset, from_offset, margins, | 340 origin_offset, from_offset, margins, |
339 layout_result->PhysicalFragment().get()); | 341 layout_result->PhysicalFragment().get()); |
340 | 342 |
341 bool float_does_not_fit = end_position + float_fragment.InlineSize() > | 343 bool float_does_not_fit = end_position + float_fragment.InlineSize() > |
342 current_opportunity_.InlineSize(); | 344 current_opportunity_.InlineSize(); |
343 // Check if we already have a pending float. That's because a float cannot be | 345 // 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. | 346 // higher than any block or floated box generated before. |
345 if (!container_builder_.UnpositionedFloats().isEmpty() || | 347 if (!container_builder_.UnpositionedFloats().isEmpty() || |
346 float_does_not_fit) { | 348 float_does_not_fit) { |
347 container_builder_.AddUnpositionedFloat(floating_object); | 349 container_builder_.AddUnpositionedFloat(floating_object); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 LayoutUnit baseline = line_top_with_leading + metrics.ascent_and_leading; | 637 LayoutUnit baseline = line_top_with_leading + metrics.ascent_and_leading; |
636 root_line_box->setLineTopBottomPositions( | 638 root_line_box->setLineTopBottomPositions( |
637 baseline - metrics.ascent, baseline + metrics.descent, | 639 baseline - metrics.ascent, baseline + metrics.descent, |
638 line_top_with_leading, baseline + metrics.descent_and_leading); | 640 line_top_with_leading, baseline + metrics.descent_and_leading); |
639 | 641 |
640 bidi_runs.deleteRuns(); | 642 bidi_runs.deleteRuns(); |
641 fragments_for_bidi_runs.clear(); | 643 fragments_for_bidi_runs.clear(); |
642 } | 644 } |
643 } | 645 } |
644 } // namespace blink | 646 } // namespace blink |
OLD | NEW |