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

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: 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..54c6bcd73db420c7a9a1efccb1ba26bbd5791a67 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,23 @@
#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_layoutObject->clearNeedsLayout();
+ NGFragment* fragement = algorithm.layout(constraintSpace);
+ DCHECK(m_layoutObject->isBox());
+ toLayoutBox(m_layoutObject)->setLogicalWidth(fragement->inlineSize());
eae 2016/08/11 15:40:49 We probably want to add a fragment->size method an
Gleb Lanbin 2016/08/11 16:08:16 Acknowledged.
+ toLayoutBox(m_layoutObject)->setLogicalHeight(fragement->blockSize());
+ return fragement;
}
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());
-}
-
} // 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