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