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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_box.cc

Issue 2257223002: Allow using overrideContainingBlockContentLogical{Width,Height} outside of grid (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/ng_box.h" 5 #include "core/layout/ng/ng_box.h"
6 6
7 #include "core/layout/LayoutObject.h" 7 #include "core/layout/LayoutObject.h"
8 #include "core/layout/ng/layout_ng_block_flow.h" 8 #include "core/layout/ng/layout_ng_block_flow.h"
9 #include "core/layout/ng/ng_block_layout_algorithm.h" 9 #include "core/layout/ng/ng_block_layout_algorithm.h"
10 #include "core/layout/ng/ng_box_iterator.h" 10 #include "core/layout/ng/ng_box_iterator.h"
(...skipping 10 matching lines...) Expand all
21 NGFragment* fragment = nullptr; 21 NGFragment* fragment = nullptr;
22 if (canUseNewLayout()) { 22 if (canUseNewLayout()) {
23 NGBlockLayoutAlgorithm algorithm(style(), childIterator()); 23 NGBlockLayoutAlgorithm algorithm(style(), childIterator());
24 fragment = algorithm.layout(constraintSpace); 24 fragment = algorithm.layout(constraintSpace);
25 m_layoutBox->setLogicalWidth(fragment->inlineSize()); 25 m_layoutBox->setLogicalWidth(fragment->inlineSize());
26 m_layoutBox->setLogicalHeight(fragment->blockSize()); 26 m_layoutBox->setLogicalHeight(fragment->blockSize());
27 if (m_layoutBox->isLayoutBlock()) 27 if (m_layoutBox->isLayoutBlock())
28 toLayoutBlock(m_layoutBox)->layoutPositionedObjects(true); 28 toLayoutBlock(m_layoutBox)->layoutPositionedObjects(true);
29 m_layoutBox->clearNeedsLayout(); 29 m_layoutBox->clearNeedsLayout();
30 } else { 30 } else {
31 // TODO(layout-ng): If fixedSize is true, set the override width/height too
32 NGLogicalSize containerSize = constraintSpace.ContainerSize();
33 m_layoutBox->setOverrideContainingBlockContentLogicalWidth(
34 containerSize.inlineSize);
35 m_layoutBox->setOverrideContainingBlockContentLogicalHeight(
36 containerSize.blockSize);
31 if (m_layoutBox->isLayoutNGBlockFlow() && m_layoutBox->needsLayout()) { 37 if (m_layoutBox->isLayoutNGBlockFlow() && m_layoutBox->needsLayout()) {
32 toLayoutNGBlockFlow(m_layoutBox)->LayoutBlockFlow::layoutBlock(true); 38 toLayoutNGBlockFlow(m_layoutBox)->LayoutBlockFlow::layoutBlock(true);
33 } else { 39 } else {
34 m_layoutBox->layoutIfNeeded(); 40 m_layoutBox->layoutIfNeeded();
35 } 41 }
36 LayoutRect overflow = m_layoutBox->layoutOverflowRect(); 42 LayoutRect overflow = m_layoutBox->layoutOverflowRect();
37 // This does not handle writing modes correctly (for overflow & the enums) 43 // TODO(layout-ng): This does not handle writing modes correctly (for
44 // overflow & the enums)
38 fragment = new NGFragment( 45 fragment = new NGFragment(
39 m_layoutBox->logicalWidth(), m_layoutBox->logicalHeight(), 46 m_layoutBox->logicalWidth(), m_layoutBox->logicalHeight(),
40 overflow.width(), overflow.height(), HorizontalTopBottom, LeftToRight); 47 overflow.width(), overflow.height(), HorizontalTopBottom, LeftToRight);
41 } 48 }
42 return fragment; 49 return fragment;
43 } 50 }
44 51
45 const ComputedStyle* NGBox::style() const { 52 const ComputedStyle* NGBox::style() const {
46 return m_layoutBox->style(); 53 return m_layoutBox->style();
47 } 54 }
(...skipping 16 matching lines...) Expand all
64 } 71 }
65 72
66 bool NGBox::canUseNewLayout() { 73 bool NGBox::canUseNewLayout() {
67 if (!m_layoutBox) 74 if (!m_layoutBox)
68 return true; 75 return true;
69 if (m_layoutBox->isLayoutBlockFlow() && !m_layoutBox->childrenInline()) 76 if (m_layoutBox->isLayoutBlockFlow() && !m_layoutBox->childrenInline())
70 return true; 77 return true;
71 return false; 78 return false;
72 } 79 }
73 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698