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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.cpp

Issue 2228593005: [LayoutNG] Move createConstraintSpaceFromLayoutObject to NGConstraintSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/NGConstraintSpace.h" 5 #include "core/layout/ng/NGConstraintSpace.h"
6 6
7 #include "core/layout/LayoutBox.h"
8 #include "core/style/ComputedStyle.h"
9
7 namespace blink { 10 namespace blink {
8 11
9 NGConstraintSpace::NGConstraintSpace(LayoutUnit inlineContainerSize, 12 NGConstraintSpace::NGConstraintSpace(LayoutUnit inlineContainerSize,
10 LayoutUnit blockContainerSize) 13 LayoutUnit blockContainerSize)
11 { 14 {
12 m_inlineContainerSize = inlineContainerSize; 15 m_inlineContainerSize = inlineContainerSize;
13 m_blockContainerSize = blockContainerSize; 16 m_blockContainerSize = blockContainerSize;
14 m_inlineTriggersScrollbar = 0; 17 m_inlineTriggersScrollbar = 0;
15 m_blockTriggersScrollbar = 0; 18 m_blockTriggersScrollbar = 0;
16 m_fixedInlineSize = 0; 19 m_fixedInlineSize = 0;
17 m_fixedBlockSize = 0; 20 m_fixedBlockSize = 0;
18 m_blockFragmentationType = FragmentNone; 21 m_blockFragmentationType = FragmentNone;
19 } 22 }
20 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
21 void NGConstraintSpace::addExclusion(const NGExclusion exclusion, 52 void NGConstraintSpace::addExclusion(const NGExclusion exclusion,
22 unsigned options) 53 unsigned options)
23 { 54 {
24 55
25 } 56 }
26 57
27 void NGConstraintSpace::setOverflowTriggersScrollbar(bool inlineTriggers, 58 void NGConstraintSpace::setOverflowTriggersScrollbar(bool inlineTriggers,
28 bool blockTriggers) 59 bool blockTriggers)
29 { 60 {
30 m_inlineTriggersScrollbar = inlineTriggers; 61 m_inlineTriggersScrollbar = inlineTriggers;
(...skipping 21 matching lines...) Expand all
52 83
53 NGLayoutOpportunityIterator NGConstraintSpace::layoutOpportunities( 84 NGLayoutOpportunityIterator NGConstraintSpace::layoutOpportunities(
54 unsigned clear, NGExclusionFlowType avoid) const 85 unsigned clear, NGExclusionFlowType avoid) const
55 { 86 {
56 // TODO(eae): Implement. 87 // TODO(eae): Implement.
57 NGLayoutOpportunityIterator iterator(this, clear, avoid); 88 NGLayoutOpportunityIterator iterator(this, clear, avoid);
58 return iterator; 89 return iterator;
59 } 90 }
60 91
61 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698