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

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: update TestExpectations Created 3 years, 8 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // fragmentation line. 319 // fragmentation line.
320 // diff writing mode - get the inline size from performing layout. 320 // diff writing mode - get the inline size from performing layout.
321 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get()); 321 RefPtr<NGLayoutResult> layout_result = node->Layout(float_space.get());
322 322
323 NGBoxFragment float_fragment( 323 NGBoxFragment float_fragment(
324 float_space->WritingMode(), 324 float_space->WritingMode(),
325 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get())); 325 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get()));
326 326
327 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( 327 RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create(
328 float_space.get(), constraint_space_, node->Style(), NGBoxStrut(), 328 float_space.get(), constraint_space_, node->Style(), NGBoxStrut(),
329 layout_result->PhysicalFragment().get()); 329 current_opportunity_.size, layout_result->PhysicalFragment().get());
330 330
331 bool float_does_not_fit = end_position + float_fragment.InlineSize() > 331 bool float_does_not_fit = end_position + float_fragment.InlineSize() >
332 current_opportunity_.InlineSize(); 332 current_opportunity_.InlineSize();
333 // Check if we already have a pending float. That's because a float cannot be 333 // Check if we already have a pending float. That's because a float cannot be
334 // higher than any block or floated box generated before. 334 // higher than any block or floated box generated before.
335 if (!container_builder_.UnpositionedFloats().isEmpty() || 335 if (!container_builder_.UnpositionedFloats().isEmpty() ||
336 float_does_not_fit) { 336 float_does_not_fit) {
337 container_builder_.AddUnpositionedFloat(floating_object); 337 container_builder_.AddUnpositionedFloat(floating_object);
338 } else { 338 } else {
339 NGLogicalOffset origin_point = 339 NGLogicalOffset origin_point =
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 root_line_box->setLineTopBottomPositions( 595 root_line_box->setLineTopBottomPositions(
596 baseline - LayoutUnit(metrics.ascent), 596 baseline - LayoutUnit(metrics.ascent),
597 baseline + LayoutUnit(metrics.descent), line_top_with_leading, 597 baseline + LayoutUnit(metrics.descent), line_top_with_leading,
598 baseline + LayoutUnit(metrics.descent_and_leading)); 598 baseline + LayoutUnit(metrics.descent_and_leading));
599 599
600 bidi_runs.deleteRuns(); 600 bidi_runs.deleteRuns();
601 fragments_for_bidi_runs.clear(); 601 fragments_for_bidi_runs.clear();
602 } 602 }
603 } 603 }
604 } // namespace blink 604 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698