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

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

Issue 2770483002: CS of out-of-flow positioned objects should have is_new_fc == true (Closed)
Patch Set: fix comments Created 3 years, 9 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 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 18 matching lines...) Expand all
29 29
30 namespace blink { 30 namespace blink {
31 namespace { 31 namespace {
32 32
33 RefPtr<NGConstraintSpace> CreateConstraintSpaceForFloat( 33 RefPtr<NGConstraintSpace> CreateConstraintSpaceForFloat(
34 const ComputedStyle& style, 34 const ComputedStyle& style,
35 const NGConstraintSpace& parent_space, 35 const NGConstraintSpace& parent_space,
36 NGConstraintSpaceBuilder* space_builder) { 36 NGConstraintSpaceBuilder* space_builder) {
37 DCHECK(space_builder) << "space_builder cannot be null here"; 37 DCHECK(space_builder) << "space_builder cannot be null here";
38 bool is_new_bfc = 38 bool is_new_bfc =
39 IsNewFormattingContextForInFlowBlockLevelChild(parent_space, style); 39 IsNewFormattingContextForBlockLevelChild(parent_space, style);
40 return space_builder->SetIsNewFormattingContext(is_new_bfc) 40 return space_builder->SetIsNewFormattingContext(is_new_bfc)
41 .SetTextDirection(style.direction()) 41 .SetTextDirection(style.direction())
42 .SetIsShrinkToFit(ShouldShrinkToFit(parent_space, style)) 42 .SetIsShrinkToFit(ShouldShrinkToFit(parent_space, style))
43 .ToConstraintSpace(FromPlatformWritingMode(style.getWritingMode())); 43 .ToConstraintSpace(FromPlatformWritingMode(style.getWritingMode()));
44 } 44 }
45 45
46 NGLogicalOffset GetOriginPointForFloats(const NGConstraintSpace& space, 46 NGLogicalOffset GetOriginPointForFloats(const NGConstraintSpace& space,
47 LayoutUnit content_size) { 47 LayoutUnit content_size) {
48 NGLogicalOffset origin_point = space.BfcOffset(); 48 NGLogicalOffset origin_point = space.BfcOffset();
49 origin_point.block_offset += content_size; 49 origin_point.block_offset += content_size;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // fragmentation line. 320 // fragmentation line.
321 // diff writing mode - get the inline size from performing layout. 321 // diff writing mode - get the inline size from performing layout.
322 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); 322 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get());
323 323
324 NGBoxFragment float_fragment( 324 NGBoxFragment float_fragment(
325 float_space->WritingMode(), 325 float_space->WritingMode(),
326 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); 326 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get()));
327 327
328 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( 328 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create(
329 float_space.get(), constraint_space_, node->Style(), NGBoxStrut(), 329 float_space.get(), constraint_space_, node->Style(), NGBoxStrut(),
330 layout_result->PhysicalFragment().get()); 330 current_opportunity_.size, layout_result->PhysicalFragment().get());
331 331
332 bool float_does_not_fit = end_position + float_fragment.InlineSize() > 332 bool float_does_not_fit = end_position + float_fragment.InlineSize() >
333 current_opportunity_.InlineSize(); 333 current_opportunity_.InlineSize();
334 // Check if we already have a pending float. That's because a float cannot be 334 // Check if we already have a pending float. That's because a float cannot be
335 // higher than any block or floated box generated before. 335 // higher than any block or floated box generated before.
336 if (!container_builder_.UnpositionedFloats().isEmpty() || 336 if (!container_builder_.UnpositionedFloats().isEmpty() ||
337 float_does_not_fit) { 337 float_does_not_fit) {
338 container_builder_.AddUnpositionedFloat(floating_object); 338 container_builder_.AddUnpositionedFloat(floating_object);
339 } else { 339 } else {
340 NGLogicalOffset origin_point = 340 NGLogicalOffset origin_point =
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 root_line_box->setLineTopBottomPositions( 597 root_line_box->setLineTopBottomPositions(
598 baseline - LayoutUnit(metrics.ascent), 598 baseline - LayoutUnit(metrics.ascent),
599 baseline + LayoutUnit(metrics.descent), line_top_with_leading, 599 baseline + LayoutUnit(metrics.descent), line_top_with_leading,
600 baseline + LayoutUnit(metrics.descent_and_leading)); 600 baseline + LayoutUnit(metrics.descent_and_leading));
601 601
602 bidi_runs.deleteRuns(); 602 bidi_runs.deleteRuns();
603 fragments_for_bidi_runs.clear(); 603 fragments_for_bidi_runs.clear();
604 } 604 }
605 } 605 }
606 } // namespace blink 606 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698