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

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

Issue 2270983002: [layoutng] Add an NGFragmentBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove SwapChildren 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_box.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box.cc b/third_party/WebKit/Source/core/layout/ng/ng_box.cc
index b2c849938f4d7cea0e96a73e6f65b2e7d7c51c45..1afd50b7171fdf702efeda1c244936d69375ed54 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.cc
@@ -9,6 +9,7 @@
#include "core/layout/ng/ng_block_layout_algorithm.h"
#include "core/layout/ng/ng_box_iterator.h"
#include "core/layout/ng/ng_fragment.h"
+#include "core/layout/ng/ng_fragment_builder.h"
#include "core/layout/LayoutBlockFlow.h"
#include "core/layout/LayoutBox.h"
@@ -22,8 +23,8 @@ NGFragment* NGBox::layout(const NGConstraintSpace& constraintSpace) {
if (canUseNewLayout()) {
NGBlockLayoutAlgorithm algorithm(style(), childIterator());
fragment = algorithm.layout(constraintSpace);
- m_layoutBox->setLogicalWidth(fragment->inlineSize());
- m_layoutBox->setLogicalHeight(fragment->blockSize());
+ m_layoutBox->setLogicalWidth(fragment->InlineSize());
+ m_layoutBox->setLogicalHeight(fragment->BlockSize());
if (m_layoutBox->isLayoutBlock())
toLayoutBlock(m_layoutBox)->layoutPositionedObjects(true);
m_layoutBox->clearNeedsLayout();
@@ -42,9 +43,12 @@ NGFragment* NGBox::layout(const NGConstraintSpace& constraintSpace) {
LayoutRect overflow = m_layoutBox->layoutOverflowRect();
// TODO(layout-ng): This does not handle writing modes correctly (for
// overflow & the enums)
- fragment = new NGFragment(
- m_layoutBox->logicalWidth(), m_layoutBox->logicalHeight(),
- overflow.width(), overflow.height(), HorizontalTopBottom, LeftToRight);
+ NGFragmentBuilder builder(NGFragmentBase::FragmentBox);
+ builder.SetInlineSize(m_layoutBox->logicalWidth())
+ .SetBlockSize(m_layoutBox->logicalHeight())
+ .SetInlineOverflow(overflow.width())
+ .SetBlockOverflow(overflow.height());
+ fragment = builder.ToFragment();
}
return fragment;
}
@@ -66,8 +70,8 @@ NGBox NGBox::firstChild() const {
}
void NGBox::positionUpdated(const NGFragment& fragment) {
- m_layoutBox->setLogicalLeft(fragment.inlineOffset());
- m_layoutBox->setLogicalTop(fragment.blockOffset());
+ m_layoutBox->setLogicalLeft(fragment.InlineOffset());
+ m_layoutBox->setLogicalTop(fragment.BlockOffset());
}
bool NGBox::canUseNewLayout() {

Powered by Google App Engine
This is Rietveld 408576698