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_constraint_space.h" | 5 #include "core/layout/ng/ng_constraint_space.h" |
6 | 6 |
7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" | 10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 if (box.hasOverrideLogicalContentHeight()) { | 63 if (box.hasOverrideLogicalContentHeight()) { |
64 available_logical_height = box.borderAndPaddingLogicalHeight() + | 64 available_logical_height = box.borderAndPaddingLogicalHeight() + |
65 box.overrideLogicalContentHeight(); | 65 box.overrideLogicalContentHeight(); |
66 fixed_block = true; | 66 fixed_block = true; |
67 } | 67 } |
68 | 68 |
69 bool is_new_fc = | 69 bool is_new_fc = |
70 box.isLayoutBlock() && toLayoutBlock(box).createsNewFormattingContext(); | 70 box.isLayoutBlock() && toLayoutBlock(box).createsNewFormattingContext(); |
71 | 71 |
72 NGLogicalSize size = {available_logical_width, available_logical_height}; | 72 NGLogicalSize size = {available_logical_width, available_logical_height}; |
73 NGLogicalSize percentage_size = { | |
74 box.containingBlockLogicalWidthForContent(), | |
75 box.containingBlockLogicalHeightForContent(IncludeMarginBorderPadding)}; | |
cbiesinger
2017/01/09 18:17:10
OK, a few questions:
- Here you explicitly choose
atotic
2017/01/09 23:22:13
You are right. The real problem was that available
| |
73 auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode()); | 76 auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode()); |
74 return NGConstraintSpaceBuilder(writing_mode) | 77 return NGConstraintSpaceBuilder(writing_mode) |
75 .SetAvailableSize(size) | 78 .SetAvailableSize(size) |
76 .SetPercentageResolutionSize(size) | 79 .SetPercentageResolutionSize(percentage_size) |
77 .SetIsInlineDirectionTriggersScrollbar( | 80 .SetIsInlineDirectionTriggersScrollbar( |
78 box.styleRef().overflowInlineDirection() == EOverflow::Auto) | 81 box.styleRef().overflowInlineDirection() == EOverflow::Auto) |
79 .SetIsBlockDirectionTriggersScrollbar( | 82 .SetIsBlockDirectionTriggersScrollbar( |
80 box.styleRef().overflowBlockDirection() == EOverflow::Auto) | 83 box.styleRef().overflowBlockDirection() == EOverflow::Auto) |
81 .SetIsFixedSizeInline(fixed_inline) | 84 .SetIsFixedSizeInline(fixed_inline) |
82 .SetIsFixedSizeBlock(fixed_block) | 85 .SetIsFixedSizeBlock(fixed_block) |
83 .SetIsShrinkToFit( | 86 .SetIsShrinkToFit( |
84 box.sizesLogicalWidthToFitContent(box.styleRef().logicalWidth())) | 87 box.sizesLogicalWidthToFitContent(box.styleRef().logicalWidth())) |
85 .SetIsNewFormattingContext(is_new_fc) | 88 .SetIsNewFormattingContext(is_new_fc) |
86 .SetTextDirection(box.styleRef().direction()) | 89 .SetTextDirection(box.styleRef().direction()) |
(...skipping 21 matching lines...) Expand all Loading... | |
108 | 111 |
109 String NGConstraintSpace::ToString() const { | 112 String NGConstraintSpace::ToString() const { |
110 return String::format("%s,%s %sx%s", | 113 return String::format("%s,%s %sx%s", |
111 offset_.inline_offset.toString().ascii().data(), | 114 offset_.inline_offset.toString().ascii().data(), |
112 offset_.block_offset.toString().ascii().data(), | 115 offset_.block_offset.toString().ascii().data(), |
113 AvailableSize().inline_size.toString().ascii().data(), | 116 AvailableSize().inline_size.toString().ascii().data(), |
114 AvailableSize().block_size.toString().ascii().data()); | 117 AvailableSize().block_size.toString().ascii().data()); |
115 } | 118 } |
116 | 119 |
117 } // namespace blink | 120 } // namespace blink |
OLD | NEW |