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

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

Issue 2237623002: Demo patch that demonstrates simple block layout using Layout NG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed NGBlockLayoutAlgorithmTest 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 7f8a30fa105500bd6dd3abbdf290f4cbd5451c08..56a6008cb7e2155a096f4a0100dbe07da71e35b8 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.cc
@@ -6,24 +6,22 @@
#include "core/layout/LayoutObject.h"
#include "core/layout/ng/ng_block_layout_algorithm.h"
+#include "core/layout/ng/ng_fragment.h"
+#include "core/layout/LayoutBox.h"
namespace blink {
NGFragment* NGBox::layout(const NGConstraintSpace& constraintSpace) {
- NGBlockLayoutAlgorithm algorithm(style(), firstChild());
- return algorithm.layout(constraintSpace);
+ NGBlockLayoutAlgorithm algorithm(style(), iterator());
+ m_layoutBox->clearNeedsLayout();
+ NGFragment* fragment = algorithm.layout(constraintSpace);
+ m_layoutBox->setLogicalWidth(fragment->inlineSize());
+ m_layoutBox->setLogicalHeight(fragment->blockSize());
+ return fragment;
}
const ComputedStyle* NGBox::style() const {
- return m_layoutObject->style();
-}
-
-const NGBox NGBox::firstChild() const {
- return NGBox(m_layoutObject->slowFirstChild());
-}
-
-const NGBox NGBox::nextSibling() const {
- return NGBox(m_layoutObject->nextSibling());
+ return m_layoutBox->style();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_box.h ('k') | third_party/WebKit/Source/core/layout/ng/ng_box_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698