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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 const NGLayoutInlineItem& item = items[text_fragment->ItemIndex()]; | 260 const NGLayoutInlineItem& item = items[text_fragment->ItemIndex()]; |
261 LayoutObject* layout_object = item.GetLayoutObject(); | 261 LayoutObject* layout_object = item.GetLayoutObject(); |
262 if (!layout_object) // Skip bidi controls. | 262 if (!layout_object) // Skip bidi controls. |
263 continue; | 263 continue; |
264 BidiRun* run; | 264 BidiRun* run; |
265 if (layout_object->isText()) { | 265 if (layout_object->isText()) { |
266 unsigned text_offset = text_offsets[text_fragment->ItemIndex()]; | 266 unsigned text_offset = text_offsets[text_fragment->ItemIndex()]; |
267 run = new BidiRun(text_fragment->StartOffset() - text_offset, | 267 run = new BidiRun(text_fragment->StartOffset() - text_offset, |
268 text_fragment->EndOffset() - text_offset, | 268 text_fragment->EndOffset() - text_offset, |
269 item.BidiLevel(), LineLayoutItem(layout_object)); | 269 item.BidiLevel(), LineLayoutItem(layout_object)); |
270 } else { | 270 } else { |
271 DCHECK(layout_object->isAtomicInlineLevel()); | 271 DCHECK(layout_object->isAtomicInlineLevel()); |
272 run = new BidiRun(0, 1, item.BidiLevel(), | 272 run = |
273 LineLayoutItem(layout_object)); | 273 new BidiRun(0, 1, item.BidiLevel(), LineLayoutItem(layout_object)); |
274 } | 274 } |
275 bidi_runs.addRun(run); | 275 bidi_runs.addRun(run); |
276 fragments_for_bidi_runs.push_back(text_fragment); | 276 fragments_for_bidi_runs.push_back(text_fragment); |
277 } | 277 } |
278 // TODO(kojii): bidi needs to find the logical last run. | 278 // TODO(kojii): bidi needs to find the logical last run. |
279 bidi_runs.setLogicallyLastRun(bidi_runs.lastRun()); | 279 bidi_runs.setLogicallyLastRun(bidi_runs.lastRun()); |
280 | 280 |
281 // Create a RootInlineBox from BidiRunList. InlineBoxes created for the | 281 // Create a RootInlineBox from BidiRunList. InlineBoxes created for the |
282 // RootInlineBox are set to Bidirun::m_box. | 282 // RootInlineBox are set to Bidirun::m_box. |
283 line_info.setEmpty(false); | 283 line_info.setEmpty(false); |
284 // TODO(kojii): Implement setFirstLine, LastLine, etc. | 284 // TODO(kojii): Implement setFirstLine, LastLine, etc. |
285 RootInlineBox* line_box = block->constructLine(bidi_runs, line_info); | 285 RootInlineBox* line_box = block->constructLine(bidi_runs, line_info); |
286 | 286 |
(...skipping 23 matching lines...) Expand all Loading... |
310 fragments_for_bidi_runs.clear(); | 310 fragments_for_bidi_runs.clear(); |
311 } | 311 } |
312 } | 312 } |
313 | 313 |
314 DEFINE_TRACE(NGLineBuilder) { | 314 DEFINE_TRACE(NGLineBuilder) { |
315 visitor->trace(inline_box_); | 315 visitor->trace(inline_box_); |
316 visitor->trace(constraint_space_); | 316 visitor->trace(constraint_space_); |
317 } | 317 } |
318 | 318 |
319 } // namespace blink | 319 } // namespace blink |
OLD | NEW |