| 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/LayoutBox.h" | 7 #include "core/layout/LayoutBox.h" |
| 8 #include "core/style/ComputedStyle.h" | 8 #include "core/style/ComputedStyle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 NGConstraintSpace::NGConstraintSpace(LayoutUnit inlineContainerSize, | 12 NGConstraintSpace::NGConstraintSpace(NGLogicalSize container_size) { |
| 13 LayoutUnit blockContainerSize) { | 13 container_size_ = container_size; |
| 14 m_inlineContainerSize = inlineContainerSize; | |
| 15 m_blockContainerSize = blockContainerSize; | |
| 16 m_inlineTriggersScrollbar = 0; | 14 m_inlineTriggersScrollbar = 0; |
| 17 m_blockTriggersScrollbar = 0; | 15 m_blockTriggersScrollbar = 0; |
| 18 m_fixedInlineSize = 0; | 16 m_fixedInlineSize = 0; |
| 19 m_fixedBlockSize = 0; | 17 m_fixedBlockSize = 0; |
| 20 m_blockFragmentationType = FragmentNone; | 18 m_blockFragmentationType = FragmentNone; |
| 21 } | 19 } |
| 22 | 20 |
| 23 NGConstraintSpace NGConstraintSpace::fromLayoutObject(const LayoutBox& child) { | 21 NGConstraintSpace NGConstraintSpace::fromLayoutObject(const LayoutBox& child) { |
| 24 bool fixedInline = false, fixedBlock = false; | 22 bool fixedInline = false, fixedBlock = false; |
| 25 // XXX for orthogonal writing mode this is not right | 23 // XXX for orthogonal writing mode this is not right |
| 26 LayoutUnit containerLogicalWidth = | 24 LayoutUnit containerLogicalWidth = |
| 27 std::max(LayoutUnit(), child.containingBlockLogicalWidthForContent()); | 25 std::max(LayoutUnit(), child.containingBlockLogicalWidthForContent()); |
| 28 // XXX Make sure this height is correct | 26 // XXX Make sure this height is correct |
| 29 LayoutUnit containerLogicalHeight = | 27 LayoutUnit containerLogicalHeight = |
| 30 child.containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding); | 28 child.containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding); |
| 31 if (child.hasOverrideLogicalContentWidth()) { | 29 if (child.hasOverrideLogicalContentWidth()) { |
| 32 containerLogicalWidth = child.overrideLogicalContentWidth(); | 30 containerLogicalWidth = child.overrideLogicalContentWidth(); |
| 33 fixedInline = true; | 31 fixedInline = true; |
| 34 } | 32 } |
| 35 if (child.hasOverrideLogicalContentHeight()) { | 33 if (child.hasOverrideLogicalContentHeight()) { |
| 36 containerLogicalWidth = child.overrideLogicalContentHeight(); | 34 containerLogicalWidth = child.overrideLogicalContentHeight(); |
| 37 fixedBlock = true; | 35 fixedBlock = true; |
| 38 } | 36 } |
| 39 NGConstraintSpace space(containerLogicalWidth, containerLogicalHeight); | 37 NGLogicalSize size; |
| 38 size.inlineSize = containerLogicalWidth; |
| 39 size.blockSize = containerLogicalHeight; |
| 40 NGConstraintSpace space(size); |
| 40 space.setOverflowTriggersScrollbar( | 41 space.setOverflowTriggersScrollbar( |
| 41 child.styleRef().overflowInlineDirection() == OverflowAuto, | 42 child.styleRef().overflowInlineDirection() == OverflowAuto, |
| 42 child.styleRef().overflowBlockDirection() == OverflowAuto); | 43 child.styleRef().overflowBlockDirection() == OverflowAuto); |
| 43 space.setFixedSize(fixedInline, fixedBlock); | 44 space.setFixedSize(fixedInline, fixedBlock); |
| 44 return space; | 45 return space; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void NGConstraintSpace::addExclusion(const NGExclusion exclusion, | 48 void NGConstraintSpace::addExclusion(const NGExclusion exclusion, |
| 48 unsigned options) {} | 49 unsigned options) {} |
| 49 | 50 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 | 72 |
| 72 NGLayoutOpportunityIterator NGConstraintSpace::layoutOpportunities( | 73 NGLayoutOpportunityIterator NGConstraintSpace::layoutOpportunities( |
| 73 unsigned clear, | 74 unsigned clear, |
| 74 NGExclusionFlowType avoid) const { | 75 NGExclusionFlowType avoid) const { |
| 75 // TODO(eae): Implement. | 76 // TODO(eae): Implement. |
| 76 NGLayoutOpportunityIterator iterator(this, clear, avoid); | 77 NGLayoutOpportunityIterator iterator(this, clear, avoid); |
| 77 return iterator; | 78 return iterator; |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace blink | 81 } // namespace blink |
| OLD | NEW |