OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/ng/ng_constraint_space.h" |
| 6 |
| 7 #include "core/layout/LayoutBox.h" |
| 8 #include "core/style/ComputedStyle.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 NGConstraintSpace::NGConstraintSpace(LayoutUnit inlineContainerSize, |
| 13 LayoutUnit blockContainerSize) { |
| 14 m_inlineContainerSize = inlineContainerSize; |
| 15 m_blockContainerSize = blockContainerSize; |
| 16 m_inlineTriggersScrollbar = 0; |
| 17 m_blockTriggersScrollbar = 0; |
| 18 m_fixedInlineSize = 0; |
| 19 m_fixedBlockSize = 0; |
| 20 m_blockFragmentationType = FragmentNone; |
| 21 } |
| 22 |
| 23 NGConstraintSpace NGConstraintSpace::fromLayoutObject(const LayoutBox& child) { |
| 24 bool fixedInline = false, fixedBlock = false; |
| 25 // XXX for orthogonal writing mode this is not right |
| 26 LayoutUnit containerLogicalWidth = |
| 27 std::max(LayoutUnit(), child.containingBlockLogicalWidthForContent()); |
| 28 // XXX Make sure this height is correct |
| 29 LayoutUnit containerLogicalHeight = |
| 30 child.containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding); |
| 31 if (child.hasOverrideLogicalContentWidth()) { |
| 32 containerLogicalWidth = child.overrideLogicalContentWidth(); |
| 33 fixedInline = true; |
| 34 } |
| 35 if (child.hasOverrideLogicalContentHeight()) { |
| 36 containerLogicalWidth = child.overrideLogicalContentHeight(); |
| 37 fixedBlock = true; |
| 38 } |
| 39 NGConstraintSpace space(containerLogicalWidth, containerLogicalHeight); |
| 40 // XXX vertical writing mode |
| 41 space.setOverflowTriggersScrollbar( |
| 42 child.styleRef().overflowX() == OverflowAuto, |
| 43 child.styleRef().overflowY() == OverflowAuto); |
| 44 space.setFixedSize(fixedInline, fixedBlock); |
| 45 return space; |
| 46 } |
| 47 |
| 48 void NGConstraintSpace::addExclusion(const NGExclusion exclusion, |
| 49 unsigned options) {} |
| 50 |
| 51 void NGConstraintSpace::setOverflowTriggersScrollbar(bool inlineTriggers, |
| 52 bool blockTriggers) { |
| 53 m_inlineTriggersScrollbar = inlineTriggers; |
| 54 m_blockTriggersScrollbar = blockTriggers; |
| 55 } |
| 56 |
| 57 void NGConstraintSpace::setFixedSize(bool inlineFixed, bool blockFixed) { |
| 58 m_fixedInlineSize = inlineFixed; |
| 59 m_fixedBlockSize = blockFixed; |
| 60 } |
| 61 |
| 62 void NGConstraintSpace::setFragmentationType(NGFragmentationType type) { |
| 63 m_blockFragmentationType = type; |
| 64 } |
| 65 |
| 66 DoublyLinkedList<const NGExclusion> NGConstraintSpace::exclusions( |
| 67 unsigned options) const { |
| 68 DoublyLinkedList<const NGExclusion> exclusions; |
| 69 // TODO(eae): Implement. |
| 70 return exclusions; |
| 71 } |
| 72 |
| 73 NGLayoutOpportunityIterator NGConstraintSpace::layoutOpportunities( |
| 74 unsigned clear, |
| 75 NGExclusionFlowType avoid) const { |
| 76 // TODO(eae): Implement. |
| 77 NGLayoutOpportunityIterator iterator(this, clear, avoid); |
| 78 return iterator; |
| 79 } |
| 80 |
| 81 } // namespace blink |
OLD | NEW |