| 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_line_builder.h" | 5 #include "core/layout/ng/ng_line_builder.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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 unsigned logical_index = indices_in_visual_order[visual_index]; | 302 unsigned logical_index = indices_in_visual_order[visual_index]; |
| 303 line_item_chunks_in_visual_order[visual_index] = | 303 line_item_chunks_in_visual_order[visual_index] = |
| 304 (*line_item_chunks)[logical_index]; | 304 (*line_item_chunks)[logical_index]; |
| 305 } | 305 } |
| 306 line_item_chunks->swap(line_item_chunks_in_visual_order); | 306 line_item_chunks->swap(line_item_chunks_in_visual_order); |
| 307 } | 307 } |
| 308 | 308 |
| 309 // TODO(glebl): Add the support of clearance for inline floats. | 309 // TODO(glebl): Add the support of clearance for inline floats. |
| 310 void NGLineBuilder::LayoutAndPositionFloat(LayoutUnit end_position, | 310 void NGLineBuilder::LayoutAndPositionFloat(LayoutUnit end_position, |
| 311 LayoutObject* layout_object) { | 311 LayoutObject* layout_object) { |
| 312 LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(layout_object); | 312 NGBlockNode* node = new NGBlockNode(layout_object); |
| 313 NGBlockNode* node = new NGBlockNode(block_flow); | |
| 314 | |
| 315 RefPtr<NGConstraintSpace> float_space = CreateConstraintSpaceForFloat( | 313 RefPtr<NGConstraintSpace> float_space = CreateConstraintSpaceForFloat( |
| 316 node->Style(), ConstraintSpace(), &space_builder_); | 314 node->Style(), ConstraintSpace(), &space_builder_); |
| 315 |
| 317 // TODO(glebl): add the fragmentation support: | 316 // TODO(glebl): add the fragmentation support: |
| 318 // same writing mode - get the inline size ComputeInlineSizeForFragment to | 317 // same writing mode - get the inline size ComputeInlineSizeForFragment to |
| 319 // determine if it fits on this line, then perform layout with the correct | 318 // determine if it fits on this line, then perform layout with the correct |
| 320 // fragmentation line. | 319 // fragmentation line. |
| 321 // diff writing mode - get the inline size from performing layout. | 320 // diff writing mode - get the inline size from performing layout. |
| 322 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); | 321 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); |
| 323 | 322 |
| 324 NGBoxFragment float_fragment( | 323 NGBoxFragment float_fragment( |
| 325 float_space->WritingMode(), | 324 float_space->WritingMode(), |
| 326 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); | 325 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 root_line_box->setLineTopBottomPositions( | 595 root_line_box->setLineTopBottomPositions( |
| 597 baseline - LayoutUnit(metrics.ascent), | 596 baseline - LayoutUnit(metrics.ascent), |
| 598 baseline + LayoutUnit(metrics.descent), line_top_with_leading, | 597 baseline + LayoutUnit(metrics.descent), line_top_with_leading, |
| 599 baseline + LayoutUnit(metrics.descent_and_leading)); | 598 baseline + LayoutUnit(metrics.descent_and_leading)); |
| 600 | 599 |
| 601 bidi_runs.deleteRuns(); | 600 bidi_runs.deleteRuns(); |
| 602 fragments_for_bidi_runs.clear(); | 601 fragments_for_bidi_runs.clear(); |
| 603 } | 602 } |
| 604 } | 603 } |
| 605 } // namespace blink | 604 } // namespace blink |
| OLD | NEW |